diff options
author | Kristian Høgsberg <[email protected]> | 2007-05-10 15:52:22 -0400 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2007-10-10 15:32:15 -0400 |
commit | aceccda56b08338e217991e54607f1c9f18fc3e6 (patch) | |
tree | c04bb3f85b2684c8fd7c83d54b533a0dd661ae17 /src/glx | |
parent | b42152061c50e870dc2698ea1d860980ce1198b1 (diff) |
Drop __DRInativeDisplay and pass in __DRIscreen pointers instead.
Many DRI entry points took a __DRInativeDisplay pointer and a screen
index as arguments. The only use for the native display pointer was to
pass it back to the loader when looking up the __DRIscreen for the given
screen index.
Instead, let's just pass in the __DRIscreen pointer directly, which
let's drop the __DRInativeDisplay type and the getScreen function.
The assumption is now that the loader will be able to retrieve context
from the __DRIscreen pointer when necessary.
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/x11/XF86dri.c | 9 | ||||
-rw-r--r-- | src/glx/x11/glxclient.h | 28 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 60 | ||||
-rw-r--r-- | src/glx/x11/glxext.c | 155 | ||||
-rw-r--r-- | src/glx/x11/xf86dri.h | 6 |
5 files changed, 156 insertions, 102 deletions
diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c index 721bb3e65ac..b44ebaf3296 100644 --- a/src/glx/x11/XF86dri.c +++ b/src/glx/x11/XF86dri.c @@ -375,10 +375,9 @@ PUBLIC Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext) context, hHWContext ); } -PUBLIC GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, +PUBLIC GLboolean XF86DRIDestroyContext(Display *dpy, int screen, __DRIid context ) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyContextReq *req; @@ -397,10 +396,9 @@ PUBLIC GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, return True; } -PUBLIC GLboolean XF86DRICreateDrawable( __DRInativeDisplay * ndpy, int screen, +PUBLIC GLboolean XF86DRICreateDrawable(Display *dpy, int screen, __DRIid drawable, drm_drawable_t * hHWDrawable ) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRICreateDrawableReply rep; xXF86DRICreateDrawableReq *req; @@ -432,10 +430,9 @@ static int noopErrorHandler(Display *dpy, XErrorEvent *xerr) return 0; } -PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, +PUBLIC GLboolean XF86DRIDestroyDrawable(Display *dpy, int screen, __DRIid drawable ) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyDrawableReq *req; int (*oldXErrorHandler)(Display *, XErrorEvent *); diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 3dbdc306da3..7ed45496581 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -72,7 +72,9 @@ #define __GLX_MAX_TEXTURE_UNITS 32 +typedef struct __GLXscreenConfigsRec __GLXscreenConfigs; typedef struct __GLXcontextRec __GLXcontext; +typedef struct __GLXdrawableRec __GLXdrawable; typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate; typedef struct _glapi_table __GLapi; @@ -80,6 +82,9 @@ typedef struct _glapi_table __GLapi; #ifdef GLX_DIRECT_RENDERING +#define containerOf(ptr, type, member) \ + (type *)( (char *)ptr - offsetof(type,member) ) + #include <GL/internal/dri_interface.h> @@ -240,6 +245,7 @@ struct __GLXcontextRec { * Screen number. */ GLint screen; + __GLXscreenConfigs *psc; /** * \c GL_TRUE if the context was created with ImportContext, which @@ -445,7 +451,7 @@ extern void __glFreeAttributeState(__GLXcontext *); * One of these records exists per screen of the display. It contains * a pointer to the config data for that screen (if the screen supports GL). */ -typedef struct __GLXscreenConfigsRec { +struct __GLXscreenConfigsRec { /** * GLX extension string reported by the X-server. */ @@ -463,6 +469,8 @@ typedef struct __GLXscreenConfigsRec { */ __DRIscreen driScreen; __glxHashTable *drawHash; + Display *dpy; + int scr; #endif /** @@ -482,7 +490,7 @@ typedef struct __GLXscreenConfigsRec { GLboolean ext_list_first_time; /*@}*/ -} __GLXscreenConfigs; +}; /** * Per display private data. One of these records exists for each display @@ -535,6 +543,18 @@ struct __GLXdisplayPrivateRec { #endif }; +#ifdef GLX_DIRECT_RENDERING + +struct __GLXdrawableRec { + XID drawable; + __GLXscreenConfigs *psc; + __DRIdrawable driDrawable; +}; + +#endif + + + void __glXFreeContext(__GLXcontext*); extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*); @@ -694,7 +714,7 @@ extern int __glXGetInternalVersion(void); /* Get the unadjusted system time */ extern int __glXGetUST( int64_t * ust ); -extern Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, - int32_t * numerator, int32_t * denominator); +extern GLboolean __glXGetMscRateOML(__DRIdrawable *draw, + int32_t * numerator, int32_t * denominator); #endif /* !__GLX_client_h__ */ diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 09514937269..45ee93c5c3a 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -105,7 +105,7 @@ static void GarbageCollectDRIDrawables(Display *dpy, int screen) if (!windowExistsFlag) { /* Destroy the local drawable data, if the drawable no longer exists in the Xserver */ - (*pdraw->destroyDrawable)(dpy, pdraw->private); + (*pdraw->destroyDrawable)(pdraw->private); Xfree(pdraw); } } while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1); @@ -127,7 +127,7 @@ static __DRIdrawable * GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num ) { __GLXdisplayPrivate * const priv = __glXInitialize(dpy); - __DRIdrawable * const pdraw; + __GLXdrawable * const pdraw; const unsigned screen_count = ScreenCount(dpy); unsigned i; __GLXscreenConfigs *sc; @@ -140,7 +140,7 @@ GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num ) if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0) { if (scrn_num != NULL) *scrn_num = i; - return pdraw; + return &pdraw->driDrawable; } } @@ -402,12 +402,14 @@ CreateContext(Display *dpy, XVisualInfo *vis, void * const shared = (shareList != NULL) ? shareList->driContext.private : NULL; gc->driContext.private = - (*psc->driScreen.createNewContext)( dpy, mode, renderType, + (*psc->driScreen.createNewContext)( &psc->driScreen, + mode, renderType, shared, &gc->driContext ); if (gc->driContext.private) { gc->isDirect = GL_TRUE; gc->screen = mode->screen; + gc->psc = psc; gc->vid = mode->visualID; gc->fbconfigID = mode->fbconfigID; gc->mode = mode; @@ -520,8 +522,7 @@ DestroyContext(Display *dpy, GLXContext gc) /* Destroy the direct rendering context */ if (gc->isDirect) { if (gc->driContext.private) { - (*gc->driContext.destroyContext)(dpy, gc->screen, - gc->driContext.private); + (*gc->driContext.destroyContext)(gc->driContext.private); gc->driContext.private = NULL; } GarbageCollectDRIDrawables(dpy, gc->screen); @@ -849,7 +850,7 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, NULL ); if ( pdraw != NULL ) { - (*pdraw->swapBuffers)(dpy, pdraw->private); + (*pdraw->swapBuffers)(pdraw->private); return; } #endif @@ -1835,7 +1836,7 @@ static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable) if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking( dpy, pdraw->private, GL_TRUE ); + status = pdraw->frameTracking( pdraw->private, GL_TRUE ); } #else (void) dpy; @@ -1855,7 +1856,7 @@ static GLint __glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable) if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking( dpy, pdraw->private, GL_FALSE ); + status = pdraw->frameTracking( pdraw->private, GL_FALSE ); } #else (void) dpy; @@ -1879,7 +1880,7 @@ static GLint __glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, int64_t sbc, missedFrames; float lastMissedUsage; - status = pdraw->queryFrameTracking( dpy, pdraw->private, &sbc, + status = pdraw->queryFrameTracking( pdraw->private, &sbc, &missedFrames, &lastMissedUsage, usage ); } @@ -1906,7 +1907,7 @@ static GLint __glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { float usage; - status = pdraw->queryFrameTracking( dpy, pdraw->private, sbc, + status = pdraw->queryFrameTracking( pdraw->private, sbc, missedFrames, lastMissedUsage, & usage ); } @@ -1973,7 +1974,7 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count int64_t msc; int64_t sbc; - ret = (*pdraw->waitForMSC)( gc->currentDpy, pdraw->private, + ret = (*pdraw->waitForMSC)( pdraw->private, 0, divisor, remainder, & msc, & sbc ); *count = (unsigned) msc; @@ -2142,7 +2143,7 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, return ( (pdraw && pdraw->getSBC && psc->driScreen.getMSC) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) && ((*psc->driScreen.getMSC)( psc->driScreen.private, msc ) == 0) - && ((*pdraw->getSBC)( dpy, psc->driScreen.private, sbc ) == 0) + && ((*pdraw->getSBC)( psc->driScreen.private, sbc ) == 0) && (__glXGetUST( ust ) == 0) ); } #else @@ -2172,24 +2173,25 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, * when GLX_OML_sync_control appears in the client extension string. */ -Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, - int32_t * numerator, int32_t * denominator) +GLboolean __glXGetMscRateOML(__DRIdrawable *draw, + int32_t * numerator, int32_t * denominator) { #if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE ) + __GLXdrawable *glxDraw = + containerOf(draw, __GLXdrawable, driDrawable); + __GLXscreenConfigs *psc = glxDraw->psc; + Display *dpy = psc->dpy; __GLXdisplayPrivate * const priv = __glXInitialize(dpy); if ( priv != NULL ) { XF86VidModeModeLine mode_line; int dot_clock; - int screen_num; int i; - if (GetDRIDrawable( dpy, drawable, & screen_num) != NULL - && XF86VidModeQueryVersion( dpy, & i, & i ) - && XF86VidModeGetModeLine( dpy, screen_num, & dot_clock, - & mode_line ) ) { + if (XF86VidModeQueryVersion( dpy, & i, & i ) && + XF86VidModeGetModeLine(dpy, psc->scr, &dot_clock, &mode_line) ) { unsigned n = dot_clock * 1000; unsigned d = mode_line.vtotal * mode_line.htotal; @@ -2231,13 +2233,11 @@ Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, *numerator = n; *denominator = d; - (void) drawable; return True; } } #else - (void) dpy; - (void) drawable; + (void) draw; (void) numerator; (void) denominator; #endif @@ -2266,7 +2266,7 @@ static int64_t __glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->swapBuffersMSC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - return (*pdraw->swapBuffersMSC)(dpy, pdraw->private, target_msc, + return (*pdraw->swapBuffersMSC)(pdraw->private, target_msc, divisor, remainder); } #else @@ -2301,7 +2301,7 @@ static Bool __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - ret = (*pdraw->waitForMSC)( dpy, pdraw->private, target_msc, + ret = (*pdraw->waitForMSC)( pdraw->private, target_msc, divisor, remainder, msc, sbc ); /* __glXGetUST returns zero on success and non-zero on failure. @@ -2341,7 +2341,7 @@ static Bool __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->waitForSBC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )) { - ret = (*pdraw->waitForSBC)( dpy, pdraw->private, target_sbc, msc, sbc ); + ret = (*pdraw->waitForSBC)( pdraw->private, target_sbc, msc, sbc ); /* __glXGetUST returns zero on success and non-zero on failure. * This function returns True on success and False on failure. @@ -2374,7 +2374,7 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn, if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { if (psc && psc->driScreen.private && psc->driScreen.allocateMemory) { - return (*psc->driScreen.allocateMemory)( dpy, scrn, size, + return (*psc->driScreen.allocateMemory)( &psc->driScreen, size, readFreq, writeFreq, priority ); } @@ -2399,7 +2399,7 @@ PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { if (psc && psc->driScreen.private && psc->driScreen.freeMemory) { - (*psc->driScreen.freeMemory)( dpy, scrn, pointer ); + (*psc->driScreen.freeMemory)( &psc->driScreen, pointer ); } } #else @@ -2418,7 +2418,7 @@ PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn, if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { if (psc && psc->driScreen.private && psc->driScreen.memoryOffset) { - return (*psc->driScreen.memoryOffset)( dpy, scrn, pointer ); + return (*psc->driScreen.memoryOffset)( &psc->driScreen, pointer ); } } #else @@ -2499,7 +2499,7 @@ static void __glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, if ( pdraw != NULL ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) { - (*pdraw->copySubBuffer)(dpy, pdraw->private, x, y, width, height); + (*pdraw->copySubBuffer)(pdraw->private, x, y, width, height); } return; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 7f0428c0a99..2ff73685e37 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -109,10 +109,6 @@ static int _mesa_sparc_needs_init = 1; #define INIT_MESA_SPARC #endif -#ifdef GLX_DIRECT_RENDERING -static __DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn); -#endif /* GLX_DIRECT_RENDERING */ - static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext gc); @@ -364,8 +360,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) #ifdef GLX_DIRECT_RENDERING /* Free the direct rendering per screen data */ if (psc->driScreen.private) - (*psc->driScreen.destroyScreen)(priv->dpy, i, - psc->driScreen.private); + (*psc->driScreen.destroyScreen)(psc->driScreen.private); psc->driScreen.private = NULL; __glxHashDestroy(psc->drawHash); #endif @@ -710,7 +705,7 @@ static __DRIfuncPtr get_proc_address( const char * proc_name ) } #ifdef XDAMAGE_1_1_INTERFACE -static GLboolean has_damage_post(__DRInativeDisplay *dpy) +static GLboolean has_damage_post(Display *dpy) { static GLboolean inited = GL_FALSE; static GLboolean has_damage; @@ -732,8 +727,7 @@ static GLboolean has_damage_post(__DRInativeDisplay *dpy) } #endif /* XDAMAGE_1_1_INTERFACE */ -static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, - __DRIid drawable, +static void __glXReportDamage(__DRIdrawable *driDraw, int x, int y, drm_clip_rect_t *rects, int num_rects, GLboolean front_buffer) @@ -743,6 +737,11 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, XserverRegion region; int i; int x_off, y_off; + __GLXdrawable *glxDraw = + containerOf(driDraw, __GLXdrawable, driDrawable); + __GLXscreenConfigs *psc = glxDraw->psc; + Display *dpy = psc->dpy; + Drawable drawable; if (!has_damage_post(dpy)) return; @@ -750,10 +749,11 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, if (front_buffer) { x_off = x; y_off = y; - drawable = RootWindow(dpy, screen); + drawable = RootWindow(dpy, psc->scr); } else{ x_off = 0; y_off = 0; + drawable = glxDraw->drawable; } xrects = malloc(sizeof(XRectangle) * num_rects); @@ -773,6 +773,69 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, #endif } +static GLboolean +__glXDRICreateContext(__DRIscreen *screen, int configID, + void *pid, drm_context_t *hHWContext) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRICreateContextWithConfig(dpy, psc->scr, + configID, pid, hHWContext); +} + +static GLboolean +__glXDRIDestroyContext(__DRIscreen *screen, __DRIid context_id) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRIDestroyContext(dpy, psc->scr, context_id); +} + +static GLboolean +__glXDRICreateDrawable( __DRIscreen *screen, + __DRIid drawable, drm_drawable_t *hHWDrawable ) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRICreateDrawable(dpy, psc->scr, drawable, hHWDrawable); +} + +static GLboolean +__glXDRIDestroyDrawable(__DRIscreen *screen, __DRIid drawable) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRIDestroyDrawable(dpy, psc->scr, drawable); +} + +static GLboolean +__glXDRIGetDrawableInfo(__DRIscreen *screen, __DRIid drawable, + unsigned int *index, unsigned int *stamp, + int *X, int *Y, int *W, int *H, + int *numClipRects, drm_clip_rect_t ** pClipRects, + int *backX, int *backY, + int *numBackClipRects, drm_clip_rect_t **pBackClipRects) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRIGetDrawableInfo(dpy, psc->scr, drawable, + index, stamp, X, Y, W, H, + numClipRects, pClipRects, + backX, backY, + numBackClipRects, pBackClipRects); +} + + /** * Table of functions exported by the loader to the driver. */ @@ -782,14 +845,12 @@ static const __DRIinterfaceMethods interface_methods = { _gl_context_modes_create, _gl_context_modes_destroy, - __glXFindDRIScreen, - - XF86DRICreateContextWithConfig, - XF86DRIDestroyContext, + __glXDRICreateContext, + __glXDRIDestroyContext, - XF86DRICreateDrawable, - XF86DRIDestroyDrawable, - XF86DRIGetDrawableInfo, + __glXDRICreateDrawable, + __glXDRIDestroyDrawable, + __glXDRIGetDrawableInfo, __glXGetUST, __glXGetMscRateOML, @@ -941,7 +1002,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, err_msg = "InitDriver"; err_extra = NULL; - psp = (*createNewScreen)(dpy, scrn, + psp = (*createNewScreen)(scrn, &psc->driScreen, psc->configs, & ddx_version, @@ -1169,6 +1230,8 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) UnlockDisplay(dpy); #ifdef GLX_DIRECT_RENDERING + psc->scr = i; + psc->dpy = dpy; /* Create drawable hash */ psc->drawHash = __glxHashCreate(); if ( psc->drawHash == NULL ) { @@ -1514,33 +1577,6 @@ PUBLIC GLXDrawable glXGetCurrentDrawable(void) /************************************************************************/ -#ifdef GLX_DIRECT_RENDERING -/* Return the DRI per screen structure */ -__DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn) -{ - __DRIscreen *pDRIScreen = NULL; - XExtDisplayInfo *info = __glXFindDisplay(dpy); - XExtData **privList, *found; - __GLXdisplayPrivate *dpyPriv; - XEDataObject dataObj; - - __glXLock(); - dataObj.display = dpy; - privList = XEHeadOfExtensionList(dataObj); - found = XFindOnExtensionList(privList, info->codes->extension); - __glXUnlock(); - - if (found) { - dpyPriv = (__GLXdisplayPrivate *)found->private_data; - pDRIScreen = &dpyPriv->screenConfigs[scrn].driScreen; - } - - return pDRIScreen; -} -#endif - -/************************************************************************/ - static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode, GLXContextID gc, GLXContextTag old_gc, GLXDrawable draw, GLXDrawable read, xGLXMakeCurrentReply * reply ); @@ -1629,7 +1665,7 @@ static __DRIdrawable * FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) { __GLXdisplayPrivate * const priv = __glXInitialize(dpy); - __DRIdrawable *pdraw; + __GLXdrawable *pdraw; __GLXscreenConfigs *sc; void *empty_attribute_list = NULL; @@ -1638,34 +1674,37 @@ FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) sc = &priv->screenConfigs[gc->screen]; if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0) - return pdraw; + return &pdraw->driDrawable; /* Allocate a new drawable */ - pdraw = (__DRIdrawable *)Xmalloc(sizeof(__DRIdrawable)); + pdraw = Xmalloc(sizeof(*pdraw)); if (!pdraw) return NULL; + pdraw->drawable = drawable; + pdraw->psc = sc; + /* Create a new drawable */ - pdraw->private = - (*sc->driScreen.createNewDrawable)(dpy, + pdraw->driDrawable.private = + (*sc->driScreen.createNewDrawable)(&sc->driScreen, gc->mode, - drawable, pdraw, + drawable, &pdraw->driDrawable, GLX_WINDOW_BIT, empty_attribute_list); - if (!pdraw->private) { + if (!pdraw->driDrawable.private) { /* ERROR!!! */ Xfree(pdraw); return NULL; } if (__glxHashInsert(sc->drawHash, drawable, pdraw)) { - (*pdraw->destroyDrawable)(dpy, pdraw->private); + (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private); Xfree(pdraw); return NULL; } - return pdraw; + return &pdraw->driDrawable; } static Bool BindContextWrapper( Display *dpy, GLXContext gc, @@ -1674,15 +1713,13 @@ static Bool BindContextWrapper( Display *dpy, GLXContext gc, __DRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc); __DRIdrawable *pread = FetchDRIDrawable(dpy, read, gc); - return (*gc->driContext.bindContext)(dpy, gc->screen, pdraw, pread, - & gc->driContext); + return (*gc->driContext.bindContext)(pdraw, pread, &gc->driContext); } static Bool UnbindContextWrapper( GLXContext gc ) { - return (*gc->driContext.unbindContext)(gc->currentDpy, gc->screen, - &gc->driContext ); + return (*gc->driContext.unbindContext)(&gc->driContext); } #endif /* GLX_DIRECT_RENDERING */ @@ -1794,7 +1831,7 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, if (oldGC->isDirect) { if (oldGC->driContext.private) { (*oldGC->driContext.destroyContext) - (dpy, oldGC->screen, oldGC->driContext.private); + (oldGC->driContext.private); oldGC->driContext.private = NULL; } } diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h index 0a2bb24971d..ddac7db266c 100644 --- a/src/glx/x11/xf86dri.h +++ b/src/glx/x11/xf86dri.h @@ -94,13 +94,13 @@ Bool XF86DRICreateContext( Display *dpy, int screen, Visual *visual, Bool XF86DRICreateContextWithConfig( Display *dpy, int screen, int configID, XID *ptr_to_returned_context_id, drm_context_t *hHWContext ); -extern GLboolean XF86DRIDestroyContext( __DRInativeDisplay *dpy, int screen, +extern GLboolean XF86DRIDestroyContext( Display *dpy, int screen, __DRIid context_id ); -extern GLboolean XF86DRICreateDrawable( __DRInativeDisplay *dpy, int screen, +extern GLboolean XF86DRICreateDrawable( Display *dpy, int screen, __DRIid drawable, drm_drawable_t *hHWDrawable ); -extern GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay *dpy, int screen, +extern GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen, __DRIid drawable); Bool XF86DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable, |