[MPlayer-dev-eng] [PATCH] radeon_vid + fglrx support - try 2

Vladimir Mosgalin mosgalin at VM10124.spb.edu
Tue Apr 6 11:12:42 CEST 2004


OK, since pre4 will be soon, maybe this patch will be accepted? Original
patch was made long ago by Marcel Naziri, and it allowed to use vidix
output on radeon cards with ati binary driver (the best driver for
8500 & up), which was messed otherwise.

It was said that this patch breaks compiling vidix without X11, hence it
is not acceptable to apply it, but it can be avoided by several ifdefs..
Dunno why it wasn't done before.

Anyway, fixed version is here. All X11 calls are surrounded with #ifdef
HAVE_X11, defined in config.h, so the problem doesn't exist anymore.
Hope I (and all other ati users) won't need to apply it on every
mplayer compilation anymore.

-- 

Vladimir
-------------- next part --------------
--- main.orig/vidix/drivers/radeon_vid-ori.c	2004-04-06 12:47:30.000000000 +0400
+++ main/vidix/drivers/radeon_vid.c	2004-04-06 13:01:45.000000000 +0400
@@ -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 at 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,7 @@
   DECLARE_VREG(CONFIG_CNTL)
 };
 
+static uint32_t firegl_shift = 0;
 static void * radeon_mmio_base = 0;
 static void * radeon_mem_base = 0; 
 static int32_t radeon_overlay_off = 0;
@@ -910,6 +918,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, 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 +977,9 @@
 	}
 #ifndef RAGE128	
 	if(idx != -1)
+#ifdef HAVE_X11
+	probe_fireGL_driver();
+#endif
 	{
           switch(ati_card_ids[idx]) {
             /* Original radeon */
@@ -1668,7 +1704,7 @@
   nfr = info->num_frames;
   for(;nfr>0; nfr--)
   {
-      radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
+      radeon_overlay_off = radeon_ram_size - info->frame_size*nfr - firegl_shift;
       radeon_overlay_off &= 0xffff0000;
       if(radeon_overlay_off >= (int)rgb_size ) break;
   }
@@ -1677,7 +1713,7 @@
    nfr = info->num_frames;
    for(;nfr>0; nfr--)
    {
-      radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
+      radeon_overlay_off = radeon_ram_size - info->frame_size*nfr - firegl_shift;
       radeon_overlay_off &= 0xffff0000;
       if(radeon_overlay_off > 0) break;
    }


More information about the MPlayer-dev-eng mailing list