changeset 12286:b52e831261b1

support for ATI fireglx
author alex
date Mon, 26 Apr 2004 08:59:22 +0000
parents 67b8d64af8c7
children 98225ad57fc2
files vidix/drivers/radeon_vid.c
diffstat 1 files changed, 44 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/drivers/radeon_vid.c	Mon Apr 26 08:53:41 2004 +0000
+++ b/vidix/drivers/radeon_vid.c	Mon Apr 26 08:59:22 2004 +0000
@@ -3,6 +3,9 @@
    Copyrights 2002 Nick Kurshev. This file is based on sources from
    GATOS (gatos.sf.net) and X11 (www.xfree86.org)
    Licence: GPL
+
+   31.12.2002 added support for fglrx drivers by Marcel Naziri (zwobbl@zwobbl.de)
+   6.04.2004 fixes to allow compiling vidix without X11 (broken in original patch)
    PPC support by Alex Beregszaszi
 */
 
@@ -22,6 +25,10 @@
 #include "../../libdha/libdha.h"
 #include "radeon.h"
 
+#ifdef HAVE_X11
+#include <X11/Xlib.h>
+#endif
+
 #ifdef RAGE128
 #define RADEON_MSG "[rage128]"
 #define X_ADJUST 0
@@ -198,6 +205,9 @@
   DECLARE_VREG(CONFIG_CNTL)
 };
 
+#ifdef HAVE_X11
+static uint32_t firegl_shift = 0;
+#endif
 static void * radeon_mmio_base = 0;
 static void * radeon_mem_base = 0; 
 static int32_t radeon_overlay_off = 0;
@@ -910,6 +920,31 @@
     { 0, 0, 0, 0}
 };
 
+#ifdef HAVE_X11
+void probe_fireGL_driver() {
+  Display *dp = XOpenDisplay ((void*)0);
+  int n = 0;
+  char **extlist = XListExtensions (dp, &n);
+  XCloseDisplay (dp);
+  if (extlist) {
+    int i;
+    int ext_fgl = 0, ext_fglrx = 0;
+    for (i = 0; i < n; i++) {
+      if (!strcmp(extlist[i], "ATIFGLEXTENSION")) ext_fgl = 1;
+      if (!strcmp(extlist[i], "ATIFGLRXDRI")) ext_fglrx = 1;
+    }
+    if (ext_fgl) {
+      printf(RADEON_MSG" ATI FireGl driver detected");
+      firegl_shift = 0x500000;
+      if (!ext_fglrx) {
+        printf(", but DRI seems not to be activated\n");
+        printf(RADEON_MSG" Output may not work correctly, check your DRI configuration!");
+      }
+      printf("\n");
+    }
+  }
+}
+#endif
 
 int vixProbe( int verbose,int force )
 {
@@ -944,6 +979,9 @@
 	}
 #ifndef RAGE128	
 	if(idx != -1)
+#ifdef HAVE_X11
+	probe_fireGL_driver();
+#endif
 	{
           switch(ati_card_ids[idx]) {
             /* Original radeon */
@@ -1669,6 +1707,9 @@
   for(;nfr>0; nfr--)
   {
       radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
+#ifdef HAVE_X11
+      radeon_overlay_off -= firegl_shift;
+#endif
       radeon_overlay_off &= 0xffff0000;
       if(radeon_overlay_off >= (int)rgb_size ) break;
   }
@@ -1678,6 +1719,9 @@
    for(;nfr>0; nfr--)
    {
       radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
+#ifdef HAVE_X11
+      radeon_overlay_off -= firegl_shift;
+#endif
       radeon_overlay_off &= 0xffff0000;
       if(radeon_overlay_off > 0) break;
    }