Compare commits

...
Sign in to create a new pull request.

12 commits

Author SHA1 Message Date
Stefan
ed92568fb6 Add integer scaling option (#2)
This patch adds option ‚3‘ integer scaling. dst_rect is an integral
multiple of src_rect. Should prevent scaling artifacts.
2016-07-14 20:12:29 +01:00
Stefan
c1a44d38a0 Use dispmanx scaling (#1)
* Use dispmanx scaling
* There is the new SDL hint SDL_VIDEO_RPI_SCALE_MODE. There are three
values.
 * The variable can be set to the following values:
 *   "0"       - Window resolution is desktop resolution.
 *               This is the behaviour of SDL <= 2.0.4. (default)
 *   "1"       - Requested video resolution will be scaled to desktop
resolution.
 *               Aspect ratio of requested video resolution will be
respected.
 *   "2"       - Requested video resolution will be scaled to desktop
resolution.
* Add aspect ratio hint
2016-07-06 20:53:43 +01:00
Jools Wills
dbd2aa7753 silence log output for unknown input 2016-04-22 20:36:23 +01:00
Jools Wills
57fc057a74 Revert "Linux joystick: Look at entire axis namespace for controls (thanks, "spaz16"!)."
This reverts commit 4cb7923f25.

see https://github.com/RetroPie/RetroPie-Setup/issues/1297
2016-04-09 22:07:12 +01:00
Jools Wills
6b81462524 added /usr/lib/*/cmake/SDL2 to installed files 2016-02-17 14:23:53 +00:00
Jools Wills
6bfb10345f Merge branch 'retropie-2.0.3' into retropie-2.0.4 2016-02-17 13:53:06 +00:00
Jools Wills
5ae5391677 added libx11-dev dependency for libsdl2-dev 2015-12-13 03:22:49 +00:00
Jools Wills
0e43d4b1e0 remove gl1-mesa-dev dependency 2015-11-22 17:00:52 +00:00
Jools Wills
220c56e111 correct configure option to enable opengles 2015-11-22 16:34:38 +00:00
Jools Wills
a991a65cf1 disable tslib as it doesn't exist in Debian Jessie but does exist in Raspbian Jessie and we want to use the same binaries on both 2015-11-22 15:55:38 +00:00
Jools Wills
73e9772ad3 split configure options onto multiple lines 2015-11-22 15:54:43 +00:00
Jools Wills
35b2ffc8f5 update debian control/rules for retropie 2015-09-12 19:44:33 +01:00
8 changed files with 125 additions and 20 deletions

16
debian/control vendored
View file

@ -12,8 +12,6 @@ Build-Depends: debhelper (>= 9),
dh-autoreconf,
dpkg-dev (>= 1.16.1~),
libasound2-dev [linux-any],
libgl1-mesa-dev,
libpulse-dev,
libudev-dev [linux-any],
libdbus-1-dev [linux-any],
libibus-1.0-dev[linux-any],
@ -30,16 +28,16 @@ Build-Depends: debhelper (>= 9),
libxxf86vm-dev
Homepage: http://www.libsdl.org/
Package: libsdl2
Package: libsdl2-2.0-0
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends},
${shlibs:Depends},
libudev0 [linux-any],
libudev0 | libudev1 [linux-any],
libdbus-1-3 [linux-any]
Conflicts: libsdl-1.3-0
Replaces: libsdl-1.3-0
Conflicts: libsdl-1.3-0, libsdl2
Replaces: libsdl-1.3-0, libsdl2
Description: Simple DirectMedia Layer
SDL is a library that allows programs portable low level access to
a video framebuffer, audio output, mouse, and keyboard.
@ -51,9 +49,9 @@ Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2 (= ${binary:Version}),
libsdl2-2.0-0 (= ${binary:Version}),
libc6-dev,
libgl1-mesa-dev
libx11-dev
Conflicts: libsdl-1.3-dev
Replaces: libsdl-1.3-dev
Description: Simple DirectMedia Layer development files
@ -68,7 +66,7 @@ Section: debug
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2 (= ${binary:Version}),
libsdl2-2.0-0 (= ${binary:Version}),
Description: Simple DirectMedia Layer debug files
SDL is a library that allows programs portable low level access to a video
framebuffer, audio output, mouse, and keyboard.

View file

@ -5,4 +5,5 @@ usr/lib/*/libSDL2.a
usr/lib/*/libSDL2main.a
usr/lib/*/libSDL2_test.a
usr/lib/*/pkgconfig/sdl2.pc
usr/lib/*/cmake/SDL2
usr/share/aclocal/sdl2.m4

5
debian/rules vendored
View file

@ -6,7 +6,10 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
confflags = --disable-rpath --disable-video-directfb \
--disable-nas --disable-esd --disable-arts \
--disable-alsa-shared --disable-pulseaudio-shared \
--disable-x11-shared
--disable-x11-shared --disable-video-opengl --enable-video-opengles \
--disable-esd --disable-pulseaudio \
--disable-input-tslib \
--host=armv6l-raspberry-linux-gnueabihf
%:
dh $@ --parallel

View file

@ -621,6 +621,33 @@ extern "C" {
*/
#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
/**
* \brief Tell dispmanx to stretch the SDL window to fill the display.
*
* This hint only applies to the rpi video driver.
*
* The variable can be set to the following values:
* "0" - Window resolution is desktop resolution.
* This is the behaviour of SDL <= 2.0.4. (default)
* "1" - Requested video resolution will be scaled to desktop resolution.
* Aspect ratio of requested video resolution will be respected.
* "2" - Requested video resolution will be scaled to desktop resolution.
* "3" - Requested video resolution will be scaled to desktop resolution.
* Aspect ratio of requested video resolution will be respected.
* If possible output resolution will be integral multiple of video
* resolution.
*/
#define SDL_HINT_VIDEO_RPI_SCALE_MODE "SDL_VIDEO_RPI_SCALE_MODE"
/**
* \brief Tell dispmanx to set a specific aspect ratio.
*
* This hint only applies to the rpi video driver.
*
* Must be set together with SDL_HINT_VIDEO_RPI_SCALE_MODE=1.
*/
#define SDL_HINT_VIDEO_RPI_RATIO "SDL_VIDEO_RPI_RATIO"
/**
* \brief Tell SDL not to generate window-close events for Alt+F4 on Windows.
*

View file

@ -712,9 +712,11 @@ SDL_EVDEV_translate_keycode(int keycode)
if (keycode < SDL_arraysize(EVDEV_Keycodes)) {
scancode = EVDEV_Keycodes[keycode];
}
/*
if (scancode == SDL_SCANCODE_UNKNOWN) {
SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <sdl@libsdl.org> EVDEV KeyCode %d \n", keycode);
}
*/
return scancode;
}

View file

@ -492,7 +492,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
++joystick->nbuttons;
}
}
for (i = 0; i < ABS_MAX; ++i) {
for (i = 0; i < ABS_MISC; ++i) {
/* Skip hats */
if (i == ABS_HAT0X) {
i = ABS_HAT3Y;
@ -753,6 +753,10 @@ HandleInputEvents(SDL_Joystick * joystick)
}
break;
case EV_ABS:
if (code >= ABS_MISC) {
break;
}
switch (code) {
case ABS_HAT0X:
case ABS_HAT0Y:

View file

@ -31,6 +31,7 @@
*/
/* SDL internals */
#include "SDL_hints.h"
#include "../SDL_sysvideo.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
@ -214,6 +215,9 @@ RPI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
int
RPI_CreateWindow(_THIS, SDL_Window * window)
{
const char *hintScale = SDL_GetHint(SDL_HINT_VIDEO_RPI_SCALE_MODE);
const char *hintRatio = SDL_GetHint(SDL_HINT_VIDEO_RPI_RATIO);
char scalemode = '0';
SDL_WindowData *wdata;
SDL_VideoDisplay *display;
SDL_DisplayData *displaydata;
@ -235,23 +239,89 @@ RPI_CreateWindow(_THIS, SDL_Window * window)
display = SDL_GetDisplayForWindow(window);
displaydata = (SDL_DisplayData *) display->driverdata;
/* Windows have one size for now */
window->w = display->desktop_mode.w;
window->h = display->desktop_mode.h;
float srcAspect = 1;
float dstAspect = 1;
int factor_x = 0;
int factor_y = 0;
/* OpenGL ES is the law here, buddy */
window->flags |= SDL_WINDOW_OPENGL;
if (hintScale != NULL)
scalemode = *hintScale;
/* Create a dispman element and associate a window to it */
dst_rect.x = 0;
dst_rect.y = 0;
dst_rect.width = window->w;
dst_rect.height = window->h;
switch(scalemode) {
case '3':
/* Pixel perfect scaling mode. */
factor_x = (display->desktop_mode.w / window->w);
factor_y = (display->desktop_mode.h / window->h);
if ((factor_x != 0) && (factor_y != 0)) {
if (factor_x >= factor_y) {
dst_rect.width = window->w * factor_y;
dst_rect.height = window->h * factor_y;
}
else {
dst_rect.width = window->w * factor_x;
dst_rect.height = window->h * factor_x;
}
/* Center window. */
dst_rect.x = (display->desktop_mode.w - dst_rect.width) / 2;
dst_rect.y = (display->desktop_mode.h - dst_rect.height) / 2;
break;
}
/* If integer scale is not possible fallback to mode 1. */
case '1':
/* Fullscreen mode. */
/* Calculate source and destination aspect ratios. */
if (hintRatio != NULL)
srcAspect = strtof(hintRatio, NULL);
else
srcAspect = (float)window->w / (float)window->h;
/* only allow sensible aspect ratios */
if (srcAspect < 0.2f || srcAspect > 6.0f)
srcAspect = (float)window->w / (float)window->h;
dstAspect = (float)display->desktop_mode.w / (float)display->desktop_mode.h;
/* If source and destination aspect ratios are not equal correct destination width. */
if (srcAspect < dstAspect) {
dst_rect.width = (unsigned)(display->desktop_mode.h * srcAspect);
dst_rect.height = display->desktop_mode.h;
}
else if (srcAspect > dstAspect) {
dst_rect.width = display->desktop_mode.w;
dst_rect.height = (unsigned)((float)display->desktop_mode.w / srcAspect);
}
else {
dst_rect.width = display->desktop_mode.w;
dst_rect.height = display->desktop_mode.h;
}
/* Center window. */
dst_rect.x = (display->desktop_mode.w - dst_rect.width) / 2;
dst_rect.y = (display->desktop_mode.h - dst_rect.height) / 2;
break;
case '2':
/* Fullscreen streched mode. */
dst_rect.x = 0;
dst_rect.y = 0;
dst_rect.width = display->desktop_mode.w;
dst_rect.height = display->desktop_mode.h;
break;
default:
/* Default mode. */
window->w = display->desktop_mode.w;
window->h = display->desktop_mode.h;
dst_rect.x = 0;
dst_rect.y = 0;
dst_rect.width = window->w;
dst_rect.height = window->h;
break;
}
src_rect.x = 0;
src_rect.y = 0;
src_rect.width = window->w << 16;
src_rect.height = window->h << 16;
/* OpenGL ES is the law here, buddy */
window->flags |= SDL_WINDOW_OPENGL;
dispman_update = vc_dispmanx_update_start( 0 );
wdata->dispman_window.element = vc_dispmanx_element_add ( dispman_update, displaydata->dispman_display, SDL_RPI_VIDEOLAYER /* layer */, &dst_rect, 0/*src*/, &src_rect, DISPMANX_PROTECTION_NONE, &dispman_alpha /*alpha*/, 0/*clamp*/, 0/*transform*/);