SDL's SDL_SetVideoMode() function doesn't understand rotation for FULLSCREEN
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...
Related branches
tags: | added: mobile nexus7 |
Changed in xbmc (Ubuntu): | |
status: | New → Fix Committed |
Changed in ubuntu-nexus7: | |
status: | Confirmed → Fix Released |
Changed in xbmc: | |
status: | Unknown → New |
Changed in libsdl: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in xbmc: | |
status: | New → Unknown |
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 XF86VidModeGetM odeLine( ) 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..?)