remove intelScreenPrivate typedef and use cast wrapper function to be like intel_cont...
authorBrian <brian.paul@tungstengraphics.com>
Mon, 5 Nov 2007 18:48:54 +0000 (11:48 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 5 Nov 2007 18:48:54 +0000 (11:48 -0700)
src/mesa/drivers/dri/intel_winsys/intel_context.c
src/mesa/drivers/dri/intel_winsys/intel_context.h
src/mesa/drivers/dri/intel_winsys/intel_lock.c
src/mesa/drivers/dri/intel_winsys/intel_screen.c
src/mesa/drivers/dri/intel_winsys/intel_screen.h
src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c

index 91ac077a4823a9eed58805e9b538c949e901ed00..b7bfc39f89c9ecf5f003fc57eb4cb97321fdfbca 100644 (file)
@@ -83,7 +83,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,
    struct intel_context *intel = CALLOC_STRUCT(intel_context);
 
    __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
-   intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+   struct intel_screen *intelScreen = intel_screen(sPriv);
    drmI830Sarea *saPriv = intelScreen->sarea;
    int fthrottle_mode;
    GLboolean havePools;
index 32fb37dd94d8f32cca8f550d4192cfc7aa9d62a5..9d24ca124af66dff7e0f0b8e7e6235df297fcf0b 100644 (file)
@@ -71,7 +71,7 @@ struct intel_context
 
    __DRIdrawablePrivate *driDrawable;
    __DRIscreenPrivate *driScreen;
-   intelScreenPrivate *intelScreen;
+   struct intel_screen *intelScreen;
    drmI830Sarea *sarea;
 
    GLuint lastStamp;
index 5962b9259d1c1fc80e8ea76012bebbeb46637f9f..74a7a55bd01d02698bdab97233a65eb2b5e7200f 100644 (file)
@@ -45,7 +45,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
 {
    __DRIdrawablePrivate *dPriv = intel->driDrawable;
    __DRIscreenPrivate *sPriv = intel->driScreen;
-   intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+   struct intel_screen *intelScreen = intel_screen(sPriv);
    drmI830Sarea *sarea = intel->sarea;
 
    drmGetLock(intel->driFd, intel->hHWContext, flags);
index 646c4ec911ab8cb36052868b709eccb563afbb4c..feaeb181f438f85678252614383487763315f415 100644 (file)
@@ -64,7 +64,7 @@ PUBLIC const char __driConfigOptions[] =
 
 
 static void
-intelPrintDRIInfo(intelScreenPrivate * intelScreen,
+intelPrintDRIInfo(struct intel_screen * intelScreen,
                   __DRIscreenPrivate * sPriv, I830DRIPtr gDRIPriv)
 {
    fprintf(stderr, "*** Front size:   0x%x  offset: 0x%x  pitch: %d\n",
@@ -110,7 +110,7 @@ intelPrintSAREA(const drmI830Sarea * sarea)
 void
 intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea)
 {
-   intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+   struct intel_screen *intelScreen = intel_screen(sPriv);
 
    if (intelScreen->front.map) {
       drmUnmap(intelScreen->front.map, intelScreen->front.size);
@@ -160,7 +160,7 @@ GLboolean
 intelCreatePools(__DRIscreenPrivate * sPriv)
 {
    unsigned batchPoolSize = 1024*1024;
-   intelScreenPrivate *intelScreen = sPriv->private;
+   struct intel_screen *intelScreen = intel_screen(sPriv);
 
    if (intelScreen->havePools)
       return GL_TRUE;
@@ -198,7 +198,7 @@ intelCreatePools(__DRIscreenPrivate * sPriv)
 static GLboolean
 intelInitDriver(__DRIscreenPrivate * sPriv)
 {
-   intelScreenPrivate *intelScreen;
+   struct intel_screen *intelScreen;
    I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv;
 
    PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
@@ -213,7 +213,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
    }
 
    /* Allocate the private area */
-   intelScreen = (intelScreenPrivate *) CALLOC(sizeof(intelScreenPrivate));
+   intelScreen = CALLOC_STRUCT(intel_screen);
    if (!intelScreen) 
       return GL_FALSE;
 
@@ -252,7 +252,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
 static void
 intelDestroyScreen(__DRIscreenPrivate * sPriv)
 {
-   intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+   struct intel_screen *intelScreen = intel_screen(sPriv);
 
 //   intelUnmapScreenRegions(intelScreen);
 
index aab745ea4d8ea149d6c5d379495ccb7eae275913..b0d1e8e36adf67a7abb5a0e21fbf31edd0aea88f 100644 (file)
@@ -33,6 +33,8 @@
 #include "xmlconfig.h"
 #include "dri_bufpool.h"
 
+#include "pipe/p_compiler.h"
+
 
 struct intel_screen
 {
@@ -70,7 +72,15 @@ struct intel_screen
    struct intel_context *dummyctxptr;
 };
 
-typedef struct intel_screen intelScreenPrivate;
+
+
+/** cast wrapper */
+static INLINE struct intel_screen *
+intel_screen(__DRIscreenPrivate *sPriv)
+{
+   return (struct intel_screen *) sPriv->private;
+}
+
 
 extern void
 intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea);
index 72ddfec40edbf7e91a9eaea22ef1a96ddccb3cd1..f3bbbe874d0bbf89048427530358525c997c7bda 100644 (file)
@@ -41,7 +41,7 @@
 
 /** XXX temporary - want to get rid of this */
 static struct intel_context *
-intelScreenContext(intelScreenPrivate *intelScreen)
+intelScreenContext(struct intel_screen *intelScreen)
 {
   /*
    * This should probably change to have the screen allocate a dummy
@@ -77,8 +77,7 @@ intelDisplaySurface(__DRIdrawablePrivate *dPriv,
                     const drm_clip_rect_t *rect)
 {
    struct intel_context *intel;
-   const intelScreenPrivate *intelScreen
-      = (intelScreenPrivate *) dPriv->driScreenPriv->private;
+   const struct intel_screen *intelScreen = intel_screen(dPriv->driScreenPriv);
 
    DBG(SWAP, "%s\n", __FUNCTION__);