[PATCH] Mach64: Check pScreenInfo->driverName in ATIMach64XVInitialiseAdaptor

Aaron Plattner aplattner at nvidia.com
Mon Sep 8 19:05:13 PDT 2008


This patch fixes a bug that causes problems when non-mach64 screens are
present.  ATIMach64XVInitialiseAdaptor gets called by any driver that calls
xf86XVListGenericAdaptors, and it happily does this:

Breakpoint 1, ATIMach64XVInitialiseAdaptor (pScreenInfo=0x81f2b0, pppAdaptor=0x7fff75dcdea0) at atimach64xv.c:1351
1351        ScreenPtr           pScreen    = screenInfo.screens[pScreenInfo->scrnIndex];
(gdb) n
1352        ATIPtr              pATI       = ATIPTR(pScreenInfo);
(gdb) 
1353        XF86VideoAdaptorPtr *ppAdaptor = NULL;
(gdb) p pScreenInfo->driverName
$1 = 0x2afb386547b8 "nvidia"
(gdb) p pScreenInfo->driverPrivate
$2 = (pointer) 0x820af0
(gdb) p pATI
$3 = (ATIPtr) 0x820af0
(gdb) bt
#0  ATIMach64XVInitialiseAdaptor (pScreenInfo=0x81f2b0, pppAdaptor=0x7fff75dcdea0) at atimach64xv.c:1353
#1  0x00000000004995f4 in xf86XVListGenericAdaptors ()
#2  0x00002afb384be128 in ?? () from /usr/lib64/xorg/modules//drivers/nvidia_drv.so
#3  0x00002afb3847fa42 in ?? () from /usr/lib64/xorg/modules//drivers/nvidia_drv.so
#4  0x00000000004390b8 in AddScreen ()
#5  0x00000000004684f6 in InitOutput ()
#6  0x0000000000439865 in main ()

As you can imagine, this doesn't always work out so well.

-- Aaron
-------------- next part --------------
From 09da76bae4d9d9aed048975b7123a7d539d96c61 Mon Sep 17 00:00:00 2001
From: Aaron Plattner <aplattner at nvidia.com>
Date: Mon, 8 Sep 2008 11:59:06 -0700
Subject: [PATCH] Make sure the screen is a mach64 screen before doing anything in ATIMach64XVInitialiseAdaptor.

---
 src/atimach64xv.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/atimach64xv.c b/src/atimach64xv.c
index ef17861..1b38d71 100644
--- a/src/atimach64xv.c
+++ b/src/atimach64xv.c
@@ -31,6 +31,7 @@
 #include "atimach64accel.h"
 #include "atimach64io.h"
 #include "atixv.h"
+#include "atimach64version.h"
 
 #include <X11/extensions/Xv.h>
 #include "fourcc.h"
@@ -1358,6 +1359,9 @@ ATIMach64XVInitialiseAdaptor
     XF86OffscreenImagePtr surf0 = &(ATIMach64Surface[0]);
     XF86OffscreenImagePtr surf1 = &(ATIMach64Surface[1]);
 
+    if (xf86NameCmp(pScreenInfo->driverName, MACH64_DRIVER_NAME) != 0)
+        return 0;
+
     if (pppAdaptor)
         *pppAdaptor = NULL;
 
-- 
1.5.2.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20080908/c848aee0/attachment.pgp>


More information about the xorg mailing list