dri: unify __DRIscreenRec

Also drop DriverAPI field, this is a static symbol and I don't see why it
should be accessed through __DRIscreenRec
This commit is contained in:
George Sapountzis 2011-11-03 13:04:57 +02:00
parent 7192c37294
commit 875a757ddd
16 changed files with 55 additions and 67 deletions

View 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)

View 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;
}

View 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 {

View 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)

View 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);

View 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,

View 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

View file

@ -97,7 +97,7 @@ struct __DRIscreenRec {
int fd;
void *private;
void *driverPrivate;
const __DRIextension **extensions;

View 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;

View 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);

View 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;

View 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

View 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;

View 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;

View 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;

View 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;