[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RFC: xorg configuration generation on sparc



Hi,

As mentioned before, the xorg.conf generation on sparc is currently broken. Attached patch (which, I hope, eventually will be applied) against xorg source package fixes all currently known problems:

* The type of the installed video card is detected properly using prtconf from the sparc-utils package. discover currently does not support detecting SBUS and, I believe, UPA cards, so it's pretty useless on sparc.

* cfb and cfb32 modules are loaded by default on sparc. Currently sunffb driver (probably most common) depends on symbols from these modules. sunffb is also made a default driver, in case detection fails.

* The default keyboard rules are set to 'xorg' and not 'sun'. The 'sun' keyboard rules were correct for 2.4 kernels, but in 2.6 kernels the keyboard layer has been unified across architectures, so 'xorg' is the correct setting in most (all?) cases. Please correct me if I'm wrong.

The source and binary packages built from the revision 2466 of the xorg source package in XSF svn repository, including the attached patch, are available for testing from http://www.wooyd.org/debian/xorg/. If you would like to test it, make a backup copy of your /etc/X11/xorg.conf file, purge the xserver-xorg package, and install the patched one. It should generate a working xorg.conf file. If it does not, please provide the information on how it needs to be fixed.

Best regards,

Jurij Smakov                                        jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                   KeyID: C99E03CC
--- a/debian/xserver-xorg.config.in	2006-05-02 19:02:10.000000000 -0700
+++ b/debian/xserver-xorg.config.in	2006-07-13 21:51:58.000000000 -0700
@@ -58,6 +58,85 @@
   debug_echo "$1 exited with status $2"
 }
 
+discover_sparc_video () {
+  # Detect video cards on sparc by parsing prtconf output
+  prtconf -p -v | awk '
+  BEGIN {
+          display_node = 0; 
+          model = ""; 
+          name = ""; 
+  }
+  /Node/ {
+           if(display_node == 1) {
+             printf "model=\"%s\" name=\"%s\"\n", model, name
+             display_node = 0;
+           };
+           model = "";
+           name = ""
+  }
+  /device_type:/ {
+                   if(index($2, "display") != 0) {
+                     display_node = 1
+                   }
+  }
+  /model:/ { l=length($2); model = substr($2, 2, l-2) }
+  /name:/  { l=length($2); name = substr($2, 2, l-2) }
+  END{
+       if(display_node == 1) {
+         printf "model=\"%s\" name=\"%s\"\n", model, name
+       }; 
+  }' | \
+  while read line
+  do
+    eval "${line}"
+#   Match the name and the model to the driver.
+    test -z "${name}" && continue
+#   The model stored in the prom is usually not too
+#   informative, so that we need to provide some
+#   sensible human-readable card identification as well.
+    server='XFree86'
+    case "${name}" in
+      'cgsix' )
+        card='Sun CG6 framebuffer'
+        driver='suncg6' 
+	;;
+      'SUNW,sx' )
+        card='Sun CG14 framebuffer'
+        driver='suncg14'
+        ;;
+      'SUNW,leo' )
+        card='Sun LEO framebuffer'
+        driver='sunleo'
+        ;;
+      'SUNW,tcx' )
+        card='Sun TCX framebuffer' 
+        driver='suntcx'
+	;;
+      'SUNW,m64B' )
+        card='ATI Technologies 3D Rage Pro or similar'
+        driver='ati'
+        ;;
+      'SUNW,ffb' )
+        card='Sun Creator3D framebuffer or similar'
+        driver='sunffb'
+        ;;
+      'SUNW,afb' )
+        card='Sun Elite3D framebuffer or similar'
+        driver='sunffb'
+        ;;
+      * )
+        card='Unknown'
+        server='unknown'
+        driver='unknown'
+        ;;
+    esac
+    if [ -n "${model}" ]; then
+      card="${card} (${model})"
+    fi
+    echo -e "${card}\t${server}\t${driver}"
+  done
+}
+
 discover_video () {
   # wrapper for discover command that can distinguish Discover 1.x and 2.x
 
@@ -550,8 +629,18 @@
 fi
 
 # collect information about installed video card(s), if possible
-if which discover > /dev/null 2>&1; then
-  DISCOVERED_VIDEO=$(discover_video)
+case "$ARCH" in
+  sparc)
+    DISCOVER_PROG='prtconf'
+    DISCOVER_FUNC='discover_sparc_video'
+    ;;
+  *)
+    DISCOVER_PROG='discover'
+    DISCOVER_FUNC='discover_video'
+    ;;
+esac
+if which $DISCOVER_PROG > /dev/null 2>&1; then
+  DISCOVERED_VIDEO=$($DISCOVER_FUNC)
   MULTIHEAD=$(echo "$DISCOVERED_VIDEO" | wc -l)
   DISCOVERED_VIDEO=$(echo "$DISCOVERED_VIDEO" | head -n 1)
   if [ -n "$DISCOVERED_VIDEO" ]; then
@@ -670,6 +759,9 @@
   amd64|hurd-i386|i386)
     DEFAULT_DRIVER=vesa
     ;;
+  sparc)
+    DEFAULT_DRIVER=sunffb
+    ;;
   *)
     DEFAULT_DRIVER=fbdev
     ;;
@@ -985,11 +1077,7 @@
 # these questions require input validation
 PRIORITY=medium
 
-if [ "$ARCH" = "sparc" ]; then
-  DEFAULT=sun
-else
-  DEFAULT=xorg
-fi
+DEFAULT=xorg
 MAY_BE_NULL= auto_answer validate_string_db_input "$(priority_ceil $PRIORITY)" xserver-xorg/config/inputdevice/keyboard/rules "$DEFAULT"
 
 if [ -z "$XKBMODEL" ]; then
@@ -1117,7 +1205,11 @@
   db_set xserver-xorg/config/modules "$MODULES"
 fi
 
-auto_answer db_input "$(priority_ceil low)" xserver-xorg/config/modules "i2c, bitmap, ddc, dri, extmod, freetype, glx, int10, type1, vbe" || true
+DEFAULT_MODULES='i2c, bitmap, ddc, dri, extmod, freetype, glx, int10, type1, vbe'
+if [ "$ARCH" = 'sparc' ]; then
+  DEFAULT_MODULES="${DEFAULT_MODULES}, cfb, cfb32"
+fi
+auto_answer db_input "$(priority_ceil low)" xserver-xorg/config/modules "${DEFAULT_MODULES}" || true
 db_go
 
 # files and dri sections

Reply to: