SDL's SDL_SetVideoMode() function doesn't understand rotation for FULLSCREEN

Bug #1085350 reported by Steve Payne
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Kodi
Unknown
Unknown
libsdl
Confirmed
Medium
ubuntu-nexus7
Fix Released
Undecided
Alex Chiang
libsdl1.2 (Ubuntu)
Confirmed
Undecided
Alex Chiang
xbmc (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

If applications call something like
 buffer = SDL_SetVideoMode(0, 0, 0, SDL_FULLSCREEN)
(where the '0's can be whatever) then the result is broken. I think that this is because SDL is reading the xrandr stuff and getting confused by the fact that the screen is rotated by default:

For example:

$ xrandr
Screen 0: minimum 256 x 128, current 1280 x 800, maximum 2048 x 2048
LVDS-1 connected 1280x800+0+0 right (normal left inverted right x axis y axis) 0mm x 0mm
   800x1280 0.0*+
HDMI-1 disconnected (normal left inverted right x axis y axis)

The mode reported is the modeline from the tegra driver, but it's rotated (from the Xorg.0.log file):

[ 12.349] (II) TEGRA(0): GPU is a T30
[ 12.350] (II) TEGRA(0): Creating default Display subsection in Screen section
        "Screen" for depth/fbbpp 24/32
[ 12.350] (==) TEGRA(0): Depth 24, (--) framebuffer bpp 32
[ 12.350] (==) TEGRA(0): RGB weight 888
[ 12.351] (==) TEGRA(0): Default visual is TrueColor
[ 12.351] (==) TEGRA(0): Using gamma correction (1.0, 1.0, 1.0)
[ 12.351] (II) TEGRA(0): Output LVDS-1 using monitor section Monitor
[ 12.351] (**) TEGRA(0): Option "Rotate" "right"
[ 12.351] (II) TEGRA(0): Output HDMI-1 has no monitor section
[ 12.352] (WW) TEGRA(0): LVDS-1: Error querying display modes: No such device.
[ 12.352] (II) TEGRA(0): EDID for output LVDS-1
[ 12.352] (II) TEGRA(0): Printing probed modes for output LVDS-1
[ 12.352] (II) TEGRA(0): Modeline "800x1280"x0.0 0.00 800 800 800 800 1280 1280 1280 1280 (0.0 kHz eP)
[ 12.352] (II) TEGRA(0): EDID for output HDMI-1
[ 12.352] (II) TEGRA(0): Output LVDS-1 connected
[ 12.352] (II) TEGRA(0): Output HDMI-1 disconnected
[ 12.352] (II) TEGRA(0): Using exact sizes for initial modes
[ 12.352] (II) TEGRA(0): Output LVDS-1 using initial mode 800x1280
[ 12.352] (II) TEGRA(0): Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.
[ 12.352] (--) TEGRA(0): VideoRAM: 32768 kByte
[ 12.352] (--) TEGRA(0): Virtual size is 1280x800 (pitch 0)
[ 12.352] (**) TEGRA(0): Driver mode "800x1280"
[ 12.352] (==) TEGRA(0): DPI set to (96, 96)

SDL isn't spotting the rotation and doesn't understand to mutate the modeline accordingly. This may well be an upstream bug.

I'm currently poking through the SDL source to see where it's getting it wrong...

Revision history for this message
Steve Payne (c-launchpad-iamsrp-com) wrote :

Okay, I tracked down the appropriate piece of code. It's in .../libsdl1.2-1.2.15/src/video/x11/SDL_x11modes.c and is called get_real_resolution(). In here it's calling XF86VidModeGetModeLine() which is going to give the raw modeline value (as above). However, as a work-around you can persuade the code to use Xinerama by setting "SDL_VIDEO_FULLSCREEN_DISPLAY=0" in the environment. Since Xinerama actually gets things right then the rest of the code will then work.

This is a bit of a fudge (and I don't know why the code doesn't attempt to default the value to the current display) but it seems to be a decent work-around.

Anyways, with this the fixed version of xbmc (see https://bugs.launchpad.net/bugs/1084201) now actually looks sane. Haven't actually tried to make it do much yet but at least it's rendering correctly :) However, I do suspect that there are going to be other apps which will get bitten by this issue. (Maybe the variable should be set globally for users..?)

Revision history for this message
Steve Payne (c-launchpad-iamsrp-com) wrote :

Actually, I did have to make one other fix to XBMC to make it look okay. This is being tracked in http://trac.xbmc.org/ticket/13641

Revision history for this message
Steve Payne (c-launchpad-iamsrp-com) wrote :
Revision history for this message
Sean Feole (sfeole) wrote :

Thanks Steve,

Marking Confirmed and assigning to the desktop team for triage

Changed in ubuntu-nexus7:
status: New → Confirmed
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
Sean Feole (sfeole)
tags: added: mobile nexus7
Revision history for this message
Sean Feole (sfeole) wrote :

After revisiting this, going to re-assign to Alex and validate the tegra tag is added.

Changed in ubuntu-nexus7:
assignee: Canonical Desktop Team (canonical-desktop-team) → Alex Chiang (achiang)
Changed in xbmc (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xbmc - 2:11.0~git20120510.82388d5-1ubuntu7

---------------
xbmc (2:11.0~git20120510.82388d5-1ubuntu7) raring; urgency=low

  * debian/rules: Removed GL check suppression via build-time architecture-
    specific change in /usr/bin/xbmc, as this file is in an architecture-
    independent package which the Ubuntu build servers always build on an
    an i386 server.
  * xbmc-startup-script-workarounds-for-arm.patch: Add two workarounds for
    ARM/Nexus 7 to the /usr/bin/xbmc startup script, once suppressing the GL
    check (LP: #1084201) and second, setting SDL_VIDEO_FULLSCREEN_DISPLAY=0
    to make fullscreen desktop application mode of XBMC working (LP: #1085350).
 -- Till Kamppeter <email address hidden> Wed, 12 Dec 2012 12:57:30 +0100

Changed in xbmc (Ubuntu):
status: Fix Committed → Fix Released
Changed in ubuntu-nexus7:
status: Confirmed → Fix Released
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tested the -1ubuntu7 on the Nexus 7 and the problem is solved. XBMC appears correctly fullscreen now. Closing the Nexus 7 task ...

Steve, thank you very much for the upstream patch and "SDL_VIDEO_FULLSCREEN_DISPLAY=0" workaround in comment #1!

Note that touchscreen interaction still does not work, you have to use an external mouse, remote control by VNC, run XBMC in a window, or (recommended solution) run XBMC as desktop environment (log out, click Ubuntu icon near user name, choose "XBMC", "OK", log in again).

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Added kibsdl task, see comment #3.

Changed in libsdl1.2 (Ubuntu):
status: New → Confirmed
assignee: nobody → Alex Chiang (achiang)
Changed in xbmc:
status: Unknown → New
Revision history for this message
Steve Payne (c-launchpad-iamsrp-com) wrote :

You're welcome! I'll give the "desktop mode" thing a try at some point.

Changed in libsdl:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
David Henningsson (diwic) wrote :

Hi,

I've tested the patch at http://bugzilla.libsdl.org/show_bug.cgi?id=1440 . When testing it with my own game on the nexus7, the result is slightly improved:

 - when run in portrait mode, things seem to work correctly
 - when run in landscape mode, screen seems to be offset by about half.

When the game is run with SDL_VIDEO_FULLSCREEN_DISPLAY=0 in landscape, there is no such offset (i e correct behavior).

Changed in xbmc:
status: New → Unknown
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.