Re: [PATCH] Add fb_check_var() for fixed mode device.
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2008-08-29 12:16:58
On Fri, 29 Aug 2008, Michel D�nzer wrote:
On Fri, 2008-08-29 at 14:15 +0900, Takashi Yoshii wrote:quoted
+ /* bigger is error, smaller is OK */ + if( ( var->xres > constant->xres ) + ||( var->yres > constant->yres )The resolution must match, otherwise userspace thinks it can e.g. set 800x600 when the fixed mode is 1024x768.
It will be set later to the correct resolution. The above hunk just taks care of the rounding rules. Anyway, I'm still wondering whether this check is really needed. If your application doesn't look at how fb_var_screeninfo was changed by calling FBIOPUT_VSCREENINFO, you're in deep trouble anyway, due to the rounding rules. As I don't have access to a PA-RISC machine with the mentioned hardware, I modified ps3fb by commenting out its fb_check_var() and fb_set_par() routines (this also gave a black screen, but as far as the fbdev subsystem is concerned, it has a working frame buffer device that supports one single video mode only). Surprisingly, X indeed didn't like it: | X.Org X Server 1.4.2 | Release Date: 11 June 2008 | X Protocol Version 11, Revision 0 | Build Operating System: Linux Debian (xorg-server 2:1.4.2-3) | Current Operating System: Linux ps3 2.6.27-rc4-00176-gb8e6c91-dirty #1815 SMP Fri Aug 29 13:54:57 CEST 2008 ppc64 | Build Date: 03 August 2008 03:08:04AM | | Before reporting problems, check http://wiki.x.org | to make sure that you have the latest version. | Module Loader present | Markers: (--) probed, (**) from config file, (==) default setting, | (++) from command line, (!!) notice, (II) informational, | (WW) warning, (EE) error, (NI) not implemented, (??) unknown. | (==) Log file: "/var/log/Xorg.0.log", Time: Fri Aug 29 13:57:26 2008 | (==) Using config file: "/etc/X11/xorg.conf" | (EE) FBDEV(0): FBIOPUT_VSCREENINFO succeeded but modified mode ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | (EE) FBDEV(0): mode initialization failed | | Fatal server error: | AddScreen/ScreenInit failed for driver 0 The "Screen" / "Display" (sub)section has `Modes "1920x1200"'. Removing this indeed doesn't make a difference. As I had added debug code to drivers/video/fbmem.c:fb_set_var(), I could see what happened in the working version with mode-setting vs. the non-working version without modesetting: - working, with mode-setting: o fb_set_var() fails for the standard 1920x1200 mode in the Xorg database, o X fallbacks to the current 1920x1200 mode. - non-working, without modesetting: o fb_set_var() doesn't fail for the standard 1920x1200 mode in the Xorg database, but it returns the current 1920x1200 mode, o X complains that the mode got modified. Hence Xorg is broken on all embedded devices with a frame buffer driver that supports a single fixed video mode only? BTW, I know current Xorg is broken on several m68k platforms with non-chunky frame buffer layouts, due to some serious bugs in the way some uncommon values of frame buffer parameters are handled, but IIRC they shouldn't affect `common' chunky frame buffers. Still have to look into it to fix it properly (anyone who can donate me some spare time? ;-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds