xorg-server wrongly tries to load 'vesa' driver instead of 'fbdev' on PS3

Bug #219424 reported by Dan Munckton on 2008-04-19
Affects Status Importance Assigned to Milestone
Ubuntu PS3 Port
Dan Munckton
xorg-server (Ubuntu)
Dan Munckton
Nominated for Intrepid by Martin Pitt

Bug Description

In Hardy the new minimal xorg.conf does not specify a device driver instead it defers this choice the X server. On PS3 however it is wrongly selecting the vesa driver where it should be using fbdev.

Related branches

Dan Munckton (munckfish) wrote :
Dan Munckton (munckfish) wrote :

Setting importance to high. If we don't fix for this X will not run on PS3 without hand editing xorg.conf.

Changed in ubuntu-ps3-port:
assignee: nobody → munckfish
importance: Undecided → High
status: New → In Progress
Dan Munckton (munckfish) wrote :

Here's a GDB session stepping through chooseVideoDriver() in hw/xfree86/common/xf86AutoConfig.c. Hope that helps. I can do more traces if needed.

Alfred Chen (alfredchen) wrote :

Based on your gdb trace log and the code I google from
Here is my analysis

+ /* Find the primary device, and get some information about it. */
+ if (xf86PciVideoInfo) {
+ for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) {
+ if (xf86IsPrimaryPci(info)) {
+ break;
+ }
+ }
+ if (!info) {
+ ErrorF("Primary device is not PCI\n");
+ }
+ } else {
+ ErrorF("xf86PciVideoInfo is not set\n");
+ }
+ if (!info) {
+ ErrorF("Could not get primary PCI info\n");
+ goto end;
+ }
+ idsdir = opendir("/usr/share/xserver-xorg/pci");
+ /* TODO Handle multiple drivers claiming to support the same PCI ID */
+ if (matches[0]) {
+ chosen_driver = matches[0];
+ } else {
+ #if defined __i386__ || defined __amd64__ || defined __hurd__
+ chosen_driver = "vesa";
+ #elif defined __alpha__
+ chosen_driver = "vga";
+ #elif defined __sparc__
+ chosen_driver = "sunffb";
+ #else
+ chosen_driver = "fbdev";
+ #endif
+ }
+ xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n",
+ end:
+ i = 0;
+ while (matches[i]) {
+ if (matches[i] != chosen_driver) {
+ xfree(matches[i]);
+ }
+ i++;
+ }
+ xfree(line);
+ closedir(idsdir);
+ return chosen_driver;

I think the root cause is xf86PciVideoInfo is not set in PS3, which
cause the 'info' is NULL and 'goto end' is called.
Above the end label, you can see there is platform default
chosen_driver selection, we are missing these code when 'goto end'
This also casue the crash problem you descript at
In the 'xf86PciVideoInfo is not set' situation, 'closedir(idsdir);' is
called before its initialized, so the crash comes. PS, I agreed with
Bryce's patch.

Solutions I can think about,
1. Find out why xf86PciVideoInfo is not set in PS3, is it normal or
not. AIK, the vedio card device provided in ps3 linux may not be a
real device. Some info may missing.
2. Move the 'end' label above the /* TODO xxxx*/ comment. I don't know
what the author want chooseVideoDriver function to do, but if it is
"chose a driver whatever info is missing or error occurred", the
platform device selection code should be called in the worst case
rather than just let it be like what's now in PS3.

Dan Munckton (munckfish) wrote :

Thanks for the analysis alpachen. Could you follow up on point 1 and see if you can find out whether no pci info is normal? To start with I suggest you could ask on #ps3linux or #ps3dev on IRC. If you cannot make time for this please say and I will continue to work on it.

I have noticed that running lspci on hardy outputs absolutely nothing. I can't remember what it did on Gutsy and I've now upgraded.

Also note the chooseVideoDriver() function is patched in to Ubuntu Xorg source. You can find it by getting the Ubuntu xorg-server source. It is introduced by patches 03 and 04 under the "debian/patches" directory.


Dan Munckton (munckfish) wrote :

Attaching a fix for this. Simple solution instead of jumping to the cleanup code at the end of chooseVideoDriver() jump to the logic just before which will select the platform default driver (vesa, vga, or fbdev).

Regression tested on a laptop with an ATI card - fine both with and without xorg.conf. Tested on PS3 (obviously) and works lovely with or without config.

This first patch is my full git commit with the patch integrated into the patch series and an explanatory comment for the debian changelog.

(Note to get this to compile against the current head of the ubuntu branch I had to temporarily disable patches 166_fix_lpl_monitors.diff and 167_xf86AutoConfig_geode_addition.diff which don't currently apply cleanly)

Dan Munckton (munckfish) wrote :

This is the bare changes to xf86AutoConfig.c after all other debian patches have been applied.

Dan Munckton (munckfish) on 2008-05-10
Changed in xorg-server:
assignee: nobody → munckfish
status: New → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server - 2:1.4.1~git20080131-1ubuntu11

xorg-server (2:1.4.1~git20080131-1ubuntu11) intrepid; urgency=low

  * 169_xf86AutoConfig_choose_default_driver_if_no_pci.patch
    - Choose the default driver for the platform instead of the generic
      default (vesa) if there is no PCI info. Without this, on platforms
      like PS3 where fbdev should be used rather than vesa, the system
      will fail to start up. (LP: #219424)

 -- Bryce Harrington <email address hidden> Tue, 13 May 2008 13:09:17 -0700

Changed in xorg-server:
status: In Progress → Fix Released
Dan Munckton (munckfish) on 2008-05-13
Changed in ubuntu-ps3-port:
status: In Progress → Fix Released
Rolf Leggewie (r0lf) wrote :

Hardy has seen the end of its life and is no longer receiving any updates. Marking the Hardy task for this ticket as "Won't Fix".

Changed in xorg-server (Ubuntu Hardy):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers