From 875a757ddd103722cfe9a2b21035024aa5a23d32 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Thu, 3 Nov 2011 13:04:57 +0200 Subject: [PATCH] dri: unify __DRIscreenRec Also drop DriverAPI field, this is a static symbol and I don't see why it should be accessed through __DRIscreenRec --- .../state_trackers/dri/common/dri_drawable.c | 2 +- .../state_trackers/dri/common/dri_screen.c | 2 +- .../state_trackers/dri/common/dri_screen.h | 2 +- src/gallium/state_trackers/dri/drm/dri2.c | 2 +- src/gallium/state_trackers/dri/sw/drisw.c | 2 +- src/mesa/drivers/dri/common/dri_util.c | 31 +++++++---------- src/mesa/drivers/dri/common/dri_util.h | 33 ++++++++----------- src/mesa/drivers/dri/common/drisw_util.h | 2 +- src/mesa/drivers/dri/intel/intel_context.c | 2 +- src/mesa/drivers/dri/intel/intel_screen.c | 16 ++++----- .../drivers/dri/nouveau/nouveau_context.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 6 ++-- src/mesa/drivers/dri/r200/r200_context.c | 2 +- .../dri/radeon/radeon_common_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 14 ++++---- 16 files changed, 55 insertions(+), 67 deletions(-) diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c index d8db69e7f04..65b3d04be7b 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.c +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c @@ -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) diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 8568eaea674..24efbde2017 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -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; } diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h index 66f7400a30a..c7985e18f02 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/src/gallium/state_trackers/dri/common/dri_screen.h @@ -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 { diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index f45a95a67f9..a6bf3c1e10f 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -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) diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 2c650cfd3ae..f5d1555b01d 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -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); diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 1775a43fc3e..13ba061c1dc 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -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, diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index b4f17d139df..af012f15010 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -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 diff --git a/src/mesa/drivers/dri/common/drisw_util.h b/src/mesa/drivers/dri/common/drisw_util.h index 1d3b14c6f52..6b3f46b545f 100644 --- a/src/mesa/drivers/dri/common/drisw_util.h +++ b/src/mesa/drivers/dri/common/drisw_util.h @@ -97,7 +97,7 @@ struct __DRIscreenRec { int fd; - void *private; + void *driverPrivate; const __DRIextension **extensions; diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 801b747a926..8e8ab730a16 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -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; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 19dbc9fe140..ae55700dace 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -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); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 2b9507c6a81..0e3321e96f4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -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; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 2ce07647317..c845280f360 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -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 diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index b33fc2a4744..90cccf56119 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -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; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index e6c7f94af06..87f4776ccf5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -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; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 46dcafa6876..e7d461f8d06 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -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; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 84b0b5a20e3..cd85595ebfe 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -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; -- 2.30.2