[PATCH] xf86dga: handle DGAAvailable for gpu screens. (v2)

Dave Airlie airlied at gmail.com
Tue Jul 3 02:34:00 PDT 2012


From: Dave Airlie <airlied at redhat.com>

v2: Split out DGAAvailable into two interfaces, one for calls from protocol
decoding and one for internal usage, after discussion with ajax and keithp.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/common/xf86DGA.c         |   15 ++++++++++++---
 hw/xfree86/dixmods/extmod/dgaproc.h |    1 +
 hw/xfree86/modes/xf86DiDGA.c        |    2 +-
 hw/xfree86/vgahw/vgaCmap.c          |    2 +-
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 6416372..61612c3 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -521,18 +521,27 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
 }
 
 Bool
-DGAAvailable(int index)
+DGAScreenAvailable(ScreenPtr pScreen)
 {
     if (!DGAScreenKeyRegistered)
         return FALSE;
 
-    if (DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
+    if (DGA_GET_SCREEN_PRIV(pScreen))
         return TRUE;
-
     return FALSE;
 }
 
 Bool
+DGAAvailable(int index)
+{
+    ScreenPtr pScreen;
+
+    assert(index < MAXSCREENS);
+    pScreen = screenInfo.screens[index];
+    return DGAScreenAvailable(pScreen);
+}
+
+Bool
 DGAActive(int index)
 {
     DGAScreenPtr pScreenPriv;
diff --git a/hw/xfree86/dixmods/extmod/dgaproc.h b/hw/xfree86/dixmods/extmod/dgaproc.h
index b4e0ddf..2c2fae0 100644
--- a/hw/xfree86/dixmods/extmod/dgaproc.h
+++ b/hw/xfree86/dixmods/extmod/dgaproc.h
@@ -64,6 +64,7 @@ extern _X_EXPORT void
  DGASelectInput(int Index, ClientPtr client, long mask);
 
 extern _X_EXPORT Bool DGAAvailable(int Index);
+extern _X_EXPORT Bool DGAScreenAvailable(ScreenPtr pScreen);
 extern _X_EXPORT Bool DGAActive(int Index);
 extern _X_EXPORT void DGAShutdown(void);
 extern _X_EXPORT void DGAInstallCmap(ColormapPtr cmap);
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
index bb954ac..3f1a330 100644
--- a/hw/xfree86/modes/xf86DiDGA.c
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -178,7 +178,7 @@ _xf86_di_dga_reinit_internal(ScreenPtr pScreen)
     ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
 
-    if (!DGAAvailable(pScreen->myNum))
+    if (!DGAScreenAvailable(pScreen))
         return TRUE;
 
     if (!xf86_dga_get_modes(pScreen))
diff --git a/hw/xfree86/vgahw/vgaCmap.c b/hw/xfree86/vgahw/vgaCmap.c
index a1aa405..e7a0d02 100644
--- a/hw/xfree86/vgahw/vgaCmap.c
+++ b/hw/xfree86/vgahw/vgaCmap.c
@@ -97,7 +97,7 @@ xColorItem *pdefs;
     }
 
     writeColormap = scrninfp->vtSema;
-    if (DGAAvailable(scrnIndex)) {
+    if (DGAScreenAvailable(pmap->pScreen)) {
         writeColormap = writeColormap ||
             (DGAGetDirectMode(scrnIndex) &&
              !(DGAGetFlags(scrnIndex) & XF86DGADirectColormap)) ||
-- 
1.7.10.2



More information about the xorg-devel mailing list