summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-06-14 15:03:02 +0100
committerDave Airlie <airlied@redhat.com>2012-07-05 20:28:48 +0100
commit505523bb8e50ab7814a4853c837cb1c3359d9336 (patch)
treeacb47a4324323857c783caf71dcd5ce7c9f8db50
parent6996fb0ec1b2b4a2ceb5d345ff95239a0eb31605 (diff)
xf86dga: handle DGAAvailable for gpu screens. (v2)
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@redhat.com>
-rw-r--r--hw/xfree86/common/xf86DGA.c15
-rw-r--r--hw/xfree86/dixmods/extmod/dgaproc.h1
-rw-r--r--hw/xfree86/modes/xf86DiDGA.c2
-rw-r--r--hw/xfree86/vgahw/vgaCmap.c2
4 files changed, 15 insertions, 5 deletions
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 64163721f..61612c32f 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 b4e0ddfea..2c2fae097 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 bb954ac4b..3f1a3309f 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 a1aa405a8..e7a0d023e 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)) ||