mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 08:04:30 +00:00
dri2: clean up devprivates access macros
* remove unnecessary extra define's * move the accessor into a static inline function Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
3cd1e0865d
commit
bb458432fb
@@ -62,28 +62,20 @@ CARD8 dri2_minor;
|
||||
uint32_t prime_id_allocate_bitmask;
|
||||
|
||||
static DevPrivateKeyRec dri2ScreenPrivateKeyRec;
|
||||
|
||||
#define dri2ScreenPrivateKey (&dri2ScreenPrivateKeyRec)
|
||||
|
||||
static DevPrivateKeyRec dri2WindowPrivateKeyRec;
|
||||
|
||||
#define dri2WindowPrivateKey (&dri2WindowPrivateKeyRec)
|
||||
|
||||
static DevPrivateKeyRec dri2PixmapPrivateKeyRec;
|
||||
|
||||
#define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec)
|
||||
|
||||
static DevPrivateKeyRec dri2ClientPrivateKeyRec;
|
||||
|
||||
#define dri2ClientPrivateKey (&dri2ClientPrivateKeyRec)
|
||||
|
||||
#define dri2ClientPrivate(_pClient) (dixLookupPrivate(&(_pClient)->devPrivates, \
|
||||
dri2ClientPrivateKey))
|
||||
|
||||
typedef struct _DRI2Client {
|
||||
int prime_id;
|
||||
} DRI2ClientRec, *DRI2ClientPtr;
|
||||
|
||||
static inline DRI2ClientPtr dri2ClientPrivate(ClientPtr pClient) {
|
||||
return (DRI2ClientPtr) dixLookupPrivate(
|
||||
&pClient->devPrivates,
|
||||
&dri2ClientPrivateKeyRec);
|
||||
}
|
||||
|
||||
static RESTYPE dri2DrawableRes;
|
||||
|
||||
typedef struct _DRI2Screen *DRI2ScreenPtr;
|
||||
@@ -184,7 +176,7 @@ dri2Sleep(ClientPtr client, DRI2DrawablePtr pPriv, enum DRI2WakeType t)
|
||||
static DRI2ScreenPtr
|
||||
DRI2GetScreen(ScreenPtr pScreen)
|
||||
{
|
||||
return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey);
|
||||
return dixLookupPrivate(&pScreen->devPrivates, &dri2ScreenPrivateKeyRec);
|
||||
}
|
||||
|
||||
static ScreenPtr
|
||||
@@ -223,10 +215,10 @@ DRI2GetDrawable(DrawablePtr pDraw)
|
||||
switch (pDraw->type) {
|
||||
case DRAWABLE_WINDOW:
|
||||
pWin = (WindowPtr) pDraw;
|
||||
return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
|
||||
return dixLookupPrivate(&pWin->devPrivates, &dri2WindowPrivateKeyRec);
|
||||
case DRAWABLE_PIXMAP:
|
||||
pPixmap = (PixmapPtr) pDraw;
|
||||
return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
|
||||
return dixLookupPrivate(&pPixmap->devPrivates, &dri2PixmapPrivateKeyRec);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -268,11 +260,11 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
|
||||
pPriv->prime_secondary_pixmap = NULL;
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr) pDraw;
|
||||
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
|
||||
dixSetPrivate(&pWin->devPrivates, &dri2WindowPrivateKeyRec, pPriv);
|
||||
}
|
||||
else {
|
||||
pPixmap = (PixmapPtr) pDraw;
|
||||
dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
|
||||
dixSetPrivate(&pPixmap->devPrivates, &dri2PixmapPrivateKeyRec, pPriv);
|
||||
}
|
||||
|
||||
return pPriv;
|
||||
@@ -356,11 +348,11 @@ DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id,
|
||||
XID *dri2_id_out)
|
||||
{
|
||||
DRI2DrawablePtr pPriv;
|
||||
DRI2ClientPtr dri2_client;
|
||||
DRI2ClientPtr dri2_client;
|
||||
XID dri2_id;
|
||||
int rc;
|
||||
|
||||
if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey))
|
||||
if (!dixPrivateKeyRegistered(&dri2ScreenPrivateKeyRec))
|
||||
return BadValue;
|
||||
|
||||
dri2_client = dri2ClientPrivate(client);
|
||||
@@ -425,11 +417,11 @@ DRI2DrawableGone(void *p, XID id)
|
||||
pDraw = pPriv->drawable;
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr) pDraw;
|
||||
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
|
||||
dixSetPrivate(&pWin->devPrivates, &dri2WindowPrivateKeyRec, NULL);
|
||||
}
|
||||
else {
|
||||
pPixmap = (PixmapPtr) pDraw;
|
||||
dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
|
||||
dixSetPrivate(&pPixmap->devPrivates, &dri2PixmapPrivateKeyRec, NULL);
|
||||
}
|
||||
|
||||
if (pPriv->prime_secondary_pixmap) {
|
||||
@@ -1272,7 +1264,7 @@ DRI2Connect(ClientPtr client, ScreenPtr pScreen,
|
||||
uint32_t prime_id = DRI2DriverPrimeId(driverType);
|
||||
uint32_t driver_id = driverType & 0xffff;
|
||||
|
||||
if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey))
|
||||
if (!dixPrivateKeyRegistered(&dri2ScreenPrivateKeyRec))
|
||||
return FALSE;
|
||||
|
||||
DRI2ScreenPtr ds = DRI2GetScreenPrime(pScreen, prime_id);
|
||||
@@ -1313,7 +1305,7 @@ DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic)
|
||||
DRI2ClientPtr dri2_client;
|
||||
ScreenPtr primescreen;
|
||||
|
||||
if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey))
|
||||
if (!dixPrivateKeyRegistered(&dri2ScreenPrivateKeyRec))
|
||||
return FALSE;
|
||||
|
||||
dri2_client = dri2ClientPrivate(client);
|
||||
@@ -1571,7 +1563,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
||||
info->numDrivers * sizeof(*ds->driverNames));
|
||||
}
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
|
||||
dixSetPrivate(&pScreen->devPrivates, &dri2ScreenPrivateKeyRec, ds);
|
||||
|
||||
ds->ConfigNotify = pScreen->ConfigNotify;
|
||||
pScreen->ConfigNotify = DRI2ConfigNotify;
|
||||
@@ -1609,7 +1601,7 @@ DRI2CloseScreen(ScreenPtr pScreen)
|
||||
prime_id_allocate_bitmask &= ~(1 << ds->prime_id);
|
||||
free(ds->driverNames);
|
||||
free(ds);
|
||||
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
|
||||
dixSetPrivate(&pScreen->devPrivates, &dri2ScreenPrivateKeyRec, NULL);
|
||||
}
|
||||
|
||||
/* Called by InitExtensions() */
|
||||
|
||||
Reference in New Issue
Block a user