Bug#412058: libsdl1.2debian: XRandR rotation ignored when looking at resolutions for fullscreen mode

2012-03-04 Thread Manuel A. Fernandez Montecelo
forwarded 412058 http://bugzilla.libsdl.org/show_bug.cgi?id=1440
stop

Hello,

Thank you for your interest in improving Debian, and sorry to keep the
bug unattended for so long.  There's now an effort to review the open
bugs related with SDL packages.

I forwarded the bug report to upstream for them to take a look and
tell what do they think and/or incorporate the patch.

Regards.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#412058: libsdl1.2debian: XRandR rotation ignored when looking at resolutions for fullscreen mode

2007-02-23 Thread Brice Goglin
Package: libsdl1.2debian
Version: 1.2.11-8
Severity: normal

Hi,

I have been tracking down a problem with programs running in 
fullscreen mode when the screen is rotated (with xrandr -o left).
After talking with XSF people, we came to the conclusion that the 
problem was in libsdl because only SDL programs had the issue.

Assuming you have a 1024x768 resolution, rotated into 768x1024,
a program such a xmoto (with -fs for fullscreen) behaves as if
the resolution was 1024x768, which means the bottom of the screen
is not used while the right part of the display is outside of the
screen.

>From what I understand, the problem is caused by SDL manipulating
actual resolutions (such as 768x1024) while XRandR functions return
and take regular resolution such as 1024x768 with a rotation flag.
Thus, libSDL should look at the rotation flag and swap the vertical
and horizontal resolutions if required when talking to XRandR.
This is what the following patch does. xmoto -fs then uses the right 
resolution.

There are probably some other problems since the font are ugly (they
were before my patch). And some other programs are still not using
the right resolution, such as mplayer and stellarium (maybe the problem 
is in these programs, not in libSDL).

The problem occurs with both X packages from Etch and experimental
(xserver-xorg-core 1.2.0-2 and libxrandr{-dev,2} 1.2.0-3). I only
tested my fix against experimental but I expect it to work with Etch
too. I'll try to check that in the next days.

Note that SDL_VIDEO_X11_XRANDR=1 must be set in the environment to 
enable XRandR support in libSDL. This is kind of boring for me since
the code says it is disabled by default because of KDE, which I don't
use at all :)

Since XRandR will become very common and important with the upcoming 
Xserver 1.3.0 (expected to enter unstable right after Etch is released), 
it would be great to have this fixed soon.
The bug is also relevant for Etch, but there is only one free X driver 
(i810) supporting rotation so far, and XRandR is disabled by default in 
libSDL. So there might not be enough people this problem to justify a
fix in Etch.

Thanks,
Brice

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.21-rc1=topinambour
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages libsdl1.2debian depends on:
ii  libsdl1.2debian-alsa  1.2.11-8   Simple DirectMedia Layer (with X11

libsdl1.2debian recommends no packages.

-- no debconf information
--- Begin Message ---
Fix XRandR rotation managing by swapping horizontal and vertical resolutions
when RR_Rotate_90 or RR_Rotate_270 (we assume both won't be set at the same
time).
It is required because SDL manipulates actual resolution (such as 768x1024)
while XRandR returns/takes non-rotated resolutions (such as 1024x768) plus
a rotation flag.
The problem appears when running a fullscreen program such as "xmoto -fs" after
running xrandr -o left to rotate the screen (not supported by all X drivers,
but at least i810 works).
SDL_VIDEO_X11_XRANDR=1 must be set in the environment to enable XRandR in 
libSDL.
---
 src/video/x11/SDL_x11modes.c |   34 --
 1 file changed, 24 insertions(+), 10 deletions(-)

Index: libsdl1.2-1.2.11/src/video/x11/SDL_x11modes.c
===
--- libsdl1.2-1.2.11.orig/src/video/x11/SDL_x11modes.c  2007-02-23 
09:42:25.0 +0100
+++ libsdl1.2-1.2.11/src/video/x11/SDL_x11modes.c   2007-02-23 
09:44:29.0 +0100
@@ -36,6 +36,8 @@
 #define X11MODES_DEBUG 1
 
 #define MAX(a, b)(a > b ? a : b)
+#define XRANDR_RESOLUTION_SWAP(a,b) { a += b; b = a - b; a -= b; }
+#define XRANDR_RESOLUTION_NEEDS_SWAP(rotation) (rotation & 
(RR_Rotate_90|RR_Rotate_270))
 
 #if SDL_VIDEO_DRIVER_X11_XRANDR
 static int cmpmodelist(const void *va, const void *vb)
@@ -217,8 +219,12 @@
 
 /* find the matching size entry index */
 for ( size_id = 0; size_id < nsizes; ++size_id ) {
-if ( (sizes[size_id].width == SDL_modelist[i]->w) &&
- (sizes[size_id].height == SDL_modelist[i]->h) )
+   int xrw = sizes[size_id].width;
+   int xrh = sizes[size_id].height;
+   if (XRANDR_RESOLUTION_NEEDS_SWAP(saved_rotation))
+   XRANDR_RESOLUTION_SWAP(xrw, xrh);
+if ( (xrw == SDL_modelist[i]->w) &&
+ (xrh == SDL_modelist[i]->h) )
 break;
 }
 
@@ -275,8 +281,12 @@
 
 cur_size = XRRConfigCurrentConfiguration(screen_config, 
&cur_rotation);
 if ( cur_size >= 0 && cur_size < nsizes ) {
-*w = sizes[cur_size].width;
-*h = sizes[cur_size].height;
+