dri: unify __DRIscreenRec
authorGeorge Sapountzis <gsapountzis@gmail.com>
Thu, 3 Nov 2011 11:04:57 +0000 (13:04 +0200)
committerGeorge Sapountzis <gsapountzis@gmail.com>
Fri, 4 Nov 2011 21:33:04 +0000 (23:33 +0200)
Also drop DriverAPI field, this is a static symbol and I don't see why it
should be accessed through __DRIscreenRec

16 files changed:
src/gallium/state_trackers/dri/common/dri_drawable.c
src/gallium/state_trackers/dri/common/dri_screen.c
src/gallium/state_trackers/dri/common/dri_screen.h
src/gallium/state_trackers/dri/drm/dri2.c
src/gallium/state_trackers/dri/sw/drisw.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/common/drisw_util.h
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/nouveau/nouveau_context.c
src/mesa/drivers/dri/nouveau/nouveau_screen.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/radeon/radeon_common_context.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_screen.c

index d8db69e7f042884ab88e8ee0d6c6a8ecbf5f337e..65b3d04be7b9117f82a34a071f8c455845a9c760 100644 (file)
@@ -116,7 +116,7 @@ dri_create_buffer(__DRIscreen * sPriv,
                  __DRIdrawable * dPriv,
                  const struct gl_config * visual, boolean isPixmap)
 {
-   struct dri_screen *screen = sPriv->private;
+   struct dri_screen *screen = sPriv->driverPrivate;
    struct dri_drawable *drawable = NULL;
 
    if (isPixmap)
index 8568eaea6741fdd314f401916674ab03d36c9dbf..24efbde2017b50dcb6b7f6e32e6a654b90798dc8 100644 (file)
@@ -372,7 +372,7 @@ dri_destroy_screen(__DRIscreen * sPriv)
    dri_destroy_screen_helper(screen);
 
    FREE(screen);
-   sPriv->private = NULL;
+   sPriv->driverPrivate = NULL;
    sPriv->extensions = NULL;
 }
 
index 66f7400a30a9637daed9ae6577fb9617e73d3bdf..c7985e18f0218ca2de724849c9a7cc477804fbed 100644 (file)
@@ -78,7 +78,7 @@ struct dri_screen
 static INLINE struct dri_screen *
 dri_screen(__DRIscreen * sPriv)
 {
-   return (struct dri_screen *)sPriv->private;
+   return (struct dri_screen *)sPriv->driverPrivate;
 }
 
 struct __DRIimageRec {
index f45a95a67f9840c40d061484bffaa0e7cecc5c22..a6bf3c1e10fbafe927fc0fba5bc66a01117274d5 100644 (file)
@@ -639,7 +639,7 @@ dri2_init_screen(__DRIscreen * sPriv)
    screen->sPriv = sPriv;
    screen->fd = sPriv->fd;
 
-   sPriv->private = (void *)screen;
+   sPriv->driverPrivate = (void *)screen;
 
    pscreen = driver_descriptor.create_screen(screen->fd);
    if (driver_descriptor.configuration)
index 2c650cfd3aeaa95ec8e44ed0650b9ab317a630be..f5d1555b01d3585ed86bb712ef3236d51f8a12a7 100644 (file)
@@ -307,7 +307,7 @@ drisw_init_screen(__DRIscreen * sPriv)
 
    swrast_no_present = debug_get_option_swrast_no_present();
 
-   sPriv->private = (void *)screen;
+   sPriv->driverPrivate = (void *)screen;
    sPriv->extensions = drisw_screen_extensions;
 
    pscreen = drisw_create_screen(&drisw_lf);
index 1775a43fc3ee5c795566a901f0946dc777a587bc..13ba061c1dc9ff7ffddcd1b0a91c579a24eb5203 100644 (file)
@@ -67,7 +67,6 @@ static void dri_put_drawable(__DRIdrawable *pdp);
  */
 static int driUnbindContext(__DRIcontext *pcp)
 {
-    __DRIscreen *psp;
     __DRIdrawable *pdp;
     __DRIdrawable *prp;
 
@@ -79,7 +78,6 @@ static int driUnbindContext(__DRIcontext *pcp)
     if (pcp == NULL)
         return GL_FALSE;
 
-    psp = pcp->driScreenPriv;
     pdp = pcp->driDrawablePriv;
     prp = pcp->driReadablePriv;
 
@@ -87,7 +85,7 @@ static int driUnbindContext(__DRIcontext *pcp)
     if (!pdp && !prp)
       return GL_TRUE;
     /* Let driver unbind drawable from context */
-    (*psp->DriverAPI.UnbindContext)(pcp);
+    driDriverAPI.UnbindContext(pcp);
 
     assert(pdp);
     if (pdp->refcount == 0) {
@@ -125,8 +123,6 @@ static int driBindContext(__DRIcontext *pcp,
                          __DRIdrawable *pdp,
                          __DRIdrawable *prp)
 {
-    __DRIscreen *psp = NULL;
-
     /*
     ** Assume error checking is done properly in glXMakeCurrent before
     ** calling driUnbindContext.
@@ -136,7 +132,6 @@ static int driBindContext(__DRIcontext *pcp,
        return GL_FALSE;
 
     /* Bind the drawable to the context */
-    psp = pcp->driScreenPriv;
     pcp->driDrawablePriv = pdp;
     pcp->driReadablePriv = prp;
     if (pdp) {
@@ -148,7 +143,7 @@ static int driBindContext(__DRIcontext *pcp,
     }
 
     /* Call device-specific MakeCurrent */
-    return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
+    return driDriverAPI.MakeCurrent(pcp, pdp, prp);
 }
 
 static __DRIdrawable *
@@ -170,7 +165,7 @@ dri2CreateNewDrawable(__DRIscreen *screen,
     pdraw->h = 0;
     pdraw->driScreenPriv = screen;
 
-    if (!(*screen->DriverAPI.CreateBuffer)(screen, pdraw, &config->modes, 0)) {
+    if (!driDriverAPI.CreateBuffer(screen, pdraw, &config->modes, 0)) {
        free(pdraw);
        return NULL;
     }
@@ -185,14 +180,14 @@ dri2AllocateBuffer(__DRIscreen *screen,
                   unsigned int attachment, unsigned int format,
                   int width, int height)
 {
-    return (*screen->DriverAPI.AllocateBuffer)(screen, attachment, format,
-                                              width, height);
+    return driDriverAPI.AllocateBuffer(screen, attachment, format,
+                                      width, height);
 }
 
 static void
 dri2ReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
 {
-   (*screen->DriverAPI.ReleaseBuffer)(screen, buffer);
+   driDriverAPI.ReleaseBuffer(screen, buffer);
 }
 
 
@@ -246,7 +241,7 @@ static void dri_put_drawable(__DRIdrawable *pdp)
            return;
 
        psp = pdp->driScreenPriv;
-        (*psp->DriverAPI.DestroyBuffer)(pdp);
+        driDriverAPI.DestroyBuffer(pdp);
        free(pdp);
     }
 }
@@ -276,7 +271,7 @@ static void
 driDestroyContext(__DRIcontext *pcp)
 {
     if (pcp) {
-       (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
+       driDriverAPI.DestroyContext(pcp);
        free(pcp);
     }
 }
@@ -322,8 +317,8 @@ dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
     context->driDrawablePriv = NULL;
     context->loaderPrivate = data;
     
-    if (!(*screen->DriverAPI.CreateContext)(mesa_api, modes,
-                                           context, shareCtx) ) {
+    if (!driDriverAPI.CreateContext(mesa_api, modes,
+                                   context, shareCtx) ) {
         free(context);
         return NULL;
     }
@@ -374,8 +369,8 @@ static void driDestroyScreen(__DRIscreen *psp)
 
        _mesa_destroy_shader_compiler();
 
-       if (psp->DriverAPI.DestroyScreen)
-           (*psp->DriverAPI.DestroyScreen)(psp);
+       if (driDriverAPI.DestroyScreen)
+           driDriverAPI.DestroyScreen(psp);
 
        driDestroyOptionCache(&psp->optionCache);
        driDestroyOptionInfo(&psp->optionInfo);
@@ -430,7 +425,6 @@ dri2CreateNewScreen(int scrn, int fd,
     psp->fd = fd;
     psp->myNum = scrn;
 
-    psp->DriverAPI = driDriverAPI;
     psp->api_mask = (1 << __DRI_API_OPENGL);
     *driver_configs = driDriverAPI.InitScreen(psp);
     if (*driver_configs == NULL) {
@@ -438,7 +432,6 @@ dri2CreateNewScreen(int scrn, int fd,
        return NULL;
     }
 
-    psp->DriverAPI = driDriverAPI;
     psp->loaderPrivate = data;
 
     driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
index b4f17d139df4674b4cc515b3eaf6adca92f5b9d7..af012f150103ef2fbfb3f6d3c3bbe6ec762b3208 100644 (file)
@@ -208,18 +208,6 @@ struct __DRIscreenRec {
      */
     int myNum;
 
-    /**
-     * Callback functions into the hardware-specific DRI driver code.
-     */
-    struct __DriverAPIRec DriverAPI;
-
-    const __DRIextension **extensions;
-
-    /**
-     * DRM (kernel module) version information.
-     */
-    __DRIversion drm_version;
-
     /**
      * File descriptor returned when the kernel device driver is opened.
      * 
@@ -230,16 +218,23 @@ struct __DRIscreenRec {
      */
     int fd;
 
+    /**
+     * DRM (kernel module) version information.
+     */
+    __DRIversion drm_version;
+
     /**
      * Device-dependent private information (not stored in the SAREA).
      * 
      * This pointer is never touched by the DRI layer.
      */
-#ifdef __cplusplus
-    void *priv;
-#else
-    void *private;
-#endif
+    void *driverPrivate;
+
+    void *loaderPrivate;
+
+    const __DRIextension **extensions;
+
+    const __DRIswrastLoaderExtension *swrast_loader;
 
     struct {
        /* Flag to indicate that this is a DRI2 screen.  Many of the above
@@ -251,8 +246,8 @@ struct __DRIscreenRec {
 
     driOptionCache optionInfo;
     driOptionCache optionCache;
-   unsigned int api_mask;
-   void *loaderPrivate;
+
+    unsigned int api_mask;
 };
 
 extern void
index 1d3b14c6f5223535553e5d9aaa0c4e222d2a15d3..6b3f46b545f692f9212cc6d3d920a36e56b80901 100644 (file)
@@ -97,7 +97,7 @@ struct __DRIscreenRec {
 
     int fd;
 
-    void *private;
+    void *driverPrivate;
 
     const __DRIextension **extensions;
 
index 801b747a92667f47b7ceb9c5811635ebe7854b28..8e8ab730a16ea894103760839c4b55ce78d88d28 100644 (file)
@@ -573,7 +573,7 @@ intelInitContext(struct intel_context *intel,
    struct gl_context *ctx = &intel->ctx;
    struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate;
    __DRIscreen *sPriv = driContextPriv->driScreenPriv;
-   struct intel_screen *intelScreen = sPriv->private;
+   struct intel_screen *intelScreen = sPriv->driverPrivate;
    int bo_reuse_mode;
    struct gl_config visual;
 
index 19dbc9fe140a7ef2a8ae4f62bad92c5c69003c54..ae55700dace282d574d9371a689c3690d46c29af 100644 (file)
@@ -128,7 +128,7 @@ intel_create_image_from_name(__DRIscreen *screen,
                             int width, int height, int format,
                             int name, int pitch, void *loaderPrivate)
 {
-    struct intel_screen *intelScreen = screen->private;
+    struct intel_screen *intelScreen = screen->driverPrivate;
     __DRIimage *image;
     int cpp;
 
@@ -220,7 +220,7 @@ intel_create_image(__DRIscreen *screen,
                   void *loaderPrivate)
 {
    __DRIimage *image;
-   struct intel_screen *intelScreen = screen->private;
+   struct intel_screen *intelScreen = screen->driverPrivate;
    uint32_t tiling;
    int cpp;
 
@@ -367,7 +367,7 @@ nop_callback(GLuint key, void *data, void *userData)
 static void
 intelDestroyScreen(__DRIscreen * sPriv)
 {
-   struct intel_screen *intelScreen = sPriv->private;
+   struct intel_screen *intelScreen = sPriv->driverPrivate;
 
    dri_bufmgr_destroy(intelScreen->bufmgr);
    driDestroyOptionInfo(&intelScreen->optionCache);
@@ -379,7 +379,7 @@ intelDestroyScreen(__DRIscreen * sPriv)
    _mesa_DeleteHashTable(intelScreen->named_regions);
 
    FREE(intelScreen);
-   sPriv->private = NULL;
+   sPriv->driverPrivate = NULL;
 }
 
 
@@ -392,7 +392,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
                   const struct gl_config * mesaVis, GLboolean isPixmap)
 {
    struct intel_renderbuffer *rb;
-   struct intel_screen *screen = (struct intel_screen*) driScrnPriv->private;
+   struct intel_screen *screen = (struct intel_screen*) driScrnPriv->driverPrivate;
 
    if (isPixmap) {
       return false;          /* not implemented */
@@ -513,7 +513,7 @@ intelCreateContext(gl_api api,
                    void *sharedContextPrivate)
 {
    __DRIscreen *sPriv = driContextPriv->driScreenPriv;
-   struct intel_screen *intelScreen = sPriv->private;
+   struct intel_screen *intelScreen = sPriv->driverPrivate;
 
 #ifdef I915
    if (IS_9XX(intelScreen->deviceID)) {
@@ -648,7 +648,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
                       __driConfigOptions, __driNConfigOptions);
 
    intelScreen->driScrnPriv = psp;
-   psp->private = (void *) intelScreen;
+   psp->driverPrivate = (void *) intelScreen;
 
    /* Determine chipset ID */
    if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
@@ -802,7 +802,7 @@ intelAllocateBuffer(__DRIscreen *screen,
                    int width, int height)
 {
    struct intel_buffer *intelBuffer;
-   struct intel_screen *intelScreen = screen->private;
+   struct intel_screen *intelScreen = screen->driverPrivate;
    uint32_t tiling;
 
    intelBuffer = CALLOC(sizeof *intelBuffer);
index 2b9507c6a81f24f8a551cc5ac599c1cba782ba8f..0e3321e96f4e48fb2a14ab88bf8e47d83c8176e5 100644 (file)
@@ -58,7 +58,7 @@ nouveau_context_create(gl_api api,
                       void *share_ctx)
 {
        __DRIscreen *dri_screen = dri_ctx->driScreenPriv;
-       struct nouveau_screen *screen = dri_screen->private;
+       struct nouveau_screen *screen = dri_screen->driverPrivate;
        struct nouveau_context *nctx;
        struct gl_context *ctx;
 
index 2ce07647317eaf4dcfdf8a4e77c365c973df60d0..c845280f3601c1f7adbfd0665d923ff102837882 100644 (file)
@@ -97,7 +97,7 @@ nouveau_init_screen2(__DRIscreen *dri_screen)
        if (!screen)
                return NULL;
 
-       dri_screen->private = screen;
+       dri_screen->driverPrivate = screen;
        dri_screen->extensions = nouveau_screen_extensions;
        screen->dri_screen = dri_screen;
 
@@ -138,7 +138,7 @@ fail:
 static void
 nouveau_destroy_screen(__DRIscreen *dri_screen)
 {
-       struct nouveau_screen *screen = dri_screen->private;
+       struct nouveau_screen *screen = dri_screen->driverPrivate;
 
        if (!screen)
                return;
@@ -147,7 +147,7 @@ nouveau_destroy_screen(__DRIscreen *dri_screen)
                nouveau_device_close(&screen->device);
 
        FREE(screen);
-       dri_screen->private = NULL;
+       dri_screen->driverPrivate = NULL;
 }
 
 static GLboolean
index b33fc2a47442d8daa0810b83a974006137cb79ba..90cccf5611904ca2778bcad15f3302b0a037fc1b 100644 (file)
@@ -199,7 +199,7 @@ GLboolean r200CreateContext( gl_api api,
                             void *sharedContextPrivate)
 {
    __DRIscreen *sPriv = driContextPriv->driScreenPriv;
-   radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
+   radeonScreenPtr screen = (radeonScreenPtr)(sPriv->driverPrivate);
    struct dd_function_table functions;
    r200ContextPtr rmesa;
    struct gl_context *ctx;
index e6c7f94af06a590af4eb2807b8ce940546f8633a..87f4776ccf52836a2168fa7c2731a8773d6e99a7 100644 (file)
@@ -169,7 +169,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
                            void *sharedContextPrivate)
 {
        __DRIscreen *sPriv = driContextPriv->driScreenPriv;
-       radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
+       radeonScreenPtr screen = (radeonScreenPtr) (sPriv->driverPrivate);
        struct gl_context* ctx;
        struct gl_context* shareCtx;
        int fthrottle_mode;
index 46dcafa68766dadb2fbfb2a3859b978daa07e140..e7d461f8d060e19f8cbd83789bf5cb52ad460ff9 100644 (file)
@@ -165,7 +165,7 @@ r100CreateContext( gl_api api,
                   void *sharedContextPrivate)
 {
    __DRIscreen *sPriv = driContextPriv->driScreenPriv;
-   radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
+   radeonScreenPtr screen = (radeonScreenPtr)(sPriv->driverPrivate);
    struct dd_function_table functions;
    r100ContextPtr rmesa;
    struct gl_context *ctx;
index 84b0b5a20e3ddac950e382e973a4cc976226f075..cd85595ebfea429b5e86d876b272bd5f347e141e 100644 (file)
@@ -208,7 +208,7 @@ radeon_create_image_from_name(__DRIscreen *screen,
                               int name, int pitch, void *loaderPrivate)
 {
    __DRIimage *image;
-   radeonScreenPtr radeonScreen = screen->private;
+   radeonScreenPtr radeonScreen = screen->driverPrivate;
 
    if (name == 0)
       return NULL;
@@ -309,7 +309,7 @@ radeon_create_image(__DRIscreen *screen,
                     void *loaderPrivate)
 {
    __DRIimage *image;
-   radeonScreenPtr radeonScreen = screen->private;
+   radeonScreenPtr radeonScreen = screen->driverPrivate;
 
    image = CALLOC(sizeof *image);
    if (image == NULL)
@@ -1126,7 +1126,7 @@ radeonCreateScreen2(__DRIscreen *sPriv)
 static void
 radeonDestroyScreen( __DRIscreen *sPriv )
 {
-    radeonScreenPtr screen = (radeonScreenPtr)sPriv->private;
+    radeonScreenPtr screen = (radeonScreenPtr)sPriv->driverPrivate;
 
     if (!screen)
         return;
@@ -1140,7 +1140,7 @@ radeonDestroyScreen( __DRIscreen *sPriv )
     driDestroyOptionInfo (&screen->optionCache);
 
     FREE( screen );
-    sPriv->private = NULL;
+    sPriv->driverPrivate = NULL;
 }
 
 
@@ -1149,8 +1149,8 @@ radeonDestroyScreen( __DRIscreen *sPriv )
 static GLboolean
 radeonInitDriver( __DRIscreen *sPriv )
 {
-    sPriv->private = (void *) radeonCreateScreen2( sPriv );
-    if ( !sPriv->private ) {
+    sPriv->driverPrivate = (void *) radeonCreateScreen2( sPriv );
+    if ( !sPriv->driverPrivate ) {
         radeonDestroyScreen( sPriv );
         return GL_FALSE;
     }
@@ -1172,7 +1172,7 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
                     const struct gl_config *mesaVis,
                     GLboolean isPixmap )
 {
-    radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->private;
+    radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->driverPrivate;
 
     const GLboolean swDepth = GL_FALSE;
     const GLboolean swAlpha = GL_FALSE;