summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2009-09-08 21:53:49 -0300
committerMartin-Éric Racine <q-funk@iki.fi>2009-09-19 18:47:00 +0300
commit6ff8735b25da03f432b755391000bbfe2253b60c (patch)
tree727678ac1f6bf5656b2cefbbe31d89cabf044226 /src
parent292df8af92d5295c4be1ab0b3ad630a09589eb55 (diff)
GX: refactor code that allow backward compatibility with old video interfaces
Most of dependent code is now located in a single place. The macro has been changed to use a cleaner name to be easier to spot why it is needed. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'src')
-rw-r--r--src/gx_randr.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gx_randr.c b/src/gx_randr.c
index 2669912..91ca43e 100644
--- a/src/gx_randr.c
+++ b/src/gx_randr.c
@@ -56,15 +56,17 @@ typedef struct _GXRandRInfo
Rotation supported_rotations; /* driver supported */
} XF86RandRInfoRec, *XF86RandRInfoPtr;
-#define AMD_OLDPRIV (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4)
-
static int GXRandRIndex;
-#if AMD_OLDPRIV
-#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[GXRandRIndex].ptr)
+#define OLD_VIDEODRV_INTERFACE (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4)
+
+#if OLD_VIDEODRV_INTERFACE
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[GXRandRIndex].ptr)
+#define XF86RANDRSET(p, v) (p)->devPrivates[GXRandRIndex].ptr = v
#else
-#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
- dixLookupPrivate(&(p)->devPrivates, &GXRandRIndex));
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
+ dixLookupPrivate(&(p)->devPrivates, &GXRandRIndex))
+#define XF86RANDRSET(p, v) dixSetPrivate(&(p)->devPrivates, &GXRandRIndex, v)
#endif
static int
@@ -327,7 +329,7 @@ GXRandRInit(ScreenPtr pScreen, int rotation)
if (GXRandRGeneration != serverGeneration) {
GXRandRGeneration = serverGeneration;
}
-#if AMD_OLDPRIV
+#if OLD_VIDEODRV_INTERFACE
GXRandRIndex = AllocateScreenPrivateIndex();
#endif
@@ -354,10 +356,7 @@ GXRandRInit(ScreenPtr pScreen, int rotation)
pRandr->supported_rotations = rotation;
pRandr->maxX = pRandr->maxY = 0;
-#if AMD_OLDPRIV
- pScreen->devPrivates[GXRandRIndex].ptr = pRandr;
-#else
- dixSetPrivate(&pScreen->devPrivates, &GXRandRIndex, pRandr);
-#endif
+ XF86RANDRSET(pScreen, pRandr);
+
return TRUE;
}