GLboolean (* destroyContext)( __DRIscreen *screen, __DRIid context );
/**
- * Create the server-side portion of the drawable.
- */
- GLboolean (*createDrawable)( __DRIscreen *screen,
- __DRIid drawable, drm_drawable_t * hHWDrawable );
-
- /**
- * Destroy the server-side portion of the drawable.
- */
- GLboolean (*destroyDrawable)( __DRIscreen *screen, __DRIid drawable );
-
- /**
* This function is used to get information about the position, size, and
* clip rects of a drawable.
*/
- GLboolean (* getDrawableInfo) ( __DRIscreen *screen, __DRIid drawable,
+ GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
unsigned int * index, unsigned int * stamp,
int * x, int * y, int * width, int * height,
int * numClipRects, drm_clip_rect_t ** pClipRects,
*/
void *(*createNewDrawable)(__DRIscreen *screen,
const __GLcontextModes *modes,
- __DRIid draw, __DRIdrawable *pdraw,
+ __DRIdrawable *pdraw,
+ drm_drawable_t hwDrawable,
int renderType, const int *attrs);
/**
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
__GLXscreenConfigs *sc;
__DRIid draw;
- __DRIdrawable *pdraw;
+ __GLXdrawable *pdraw;
XWindowAttributes xwa;
int (*oldXErrorHandler)(Display *, XErrorEvent *);
if (!windowExistsFlag) {
/* Destroy the local drawable data, if the drawable no
longer exists in the Xserver */
- (*pdraw->destroyDrawable)(pdraw->private);
+ (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private);
+ XF86DRIDestroyDrawable(dpy, sc->scr, draw);
Xfree(pdraw);
}
} while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1);
}
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,
+__glXDRIGetDrawableInfo(__DRIdrawable *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);
+ __GLXdrawable *glxDraw =
+ containerOf(drawable, __GLXdrawable, driDrawable);
+ __GLXscreenConfigs *psc = glxDraw->psc;
Display *dpy = psc->dpy;
- return XF86DRIGetDrawableInfo(dpy, psc->scr, drawable,
+ return XF86DRIGetDrawableInfo(dpy, psc->scr, glxDraw->drawable,
index, stamp, X, Y, W, H,
numClipRects, pClipRects,
backX, backY,
__glXDRICreateContext,
__glXDRIDestroyContext,
- __glXDRICreateDrawable,
- __glXDRIDestroyDrawable,
__glXDRIGetDrawableInfo,
__glXGetUST,
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
__GLXdrawable *pdraw;
__GLXscreenConfigs *sc;
+ drm_drawable_t hwDrawable;
void *empty_attribute_list = NULL;
if (priv == NULL || priv->driDisplay.private == NULL)
pdraw->drawable = drawable;
pdraw->psc = sc;
+ if (!XF86DRICreateDrawable(dpy, sc->scr, drawable, &hwDrawable))
+ return NULL;
+
/* Create a new drawable */
pdraw->driDrawable.private =
(*sc->driScreen.createNewDrawable)(&sc->driScreen,
gc->mode,
- drawable, &pdraw->driDrawable,
+ &pdraw->driDrawable,
+ hwDrawable,
GLX_WINDOW_BIT,
empty_attribute_list);
if (!pdraw->driDrawable.private) {
- /* ERROR!!! */
+ XF86DRIDestroyDrawable(dpy, sc->scr, drawable);
Xfree(pdraw);
return NULL;
}
if (__glxHashInsert(sc->drawHash, drawable, pdraw)) {
(*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private);
+ XF86DRIDestroyDrawable(dpy, sc->scr, drawable);
Xfree(pdraw);
return NULL;
}
static void *driCreateNewDrawable(__DRIscreen *screen,
const __GLcontextModes *modes,
- __DRIid draw, __DRIdrawable *pdraw,
+ __DRIdrawable *pdraw,
+ drm_drawable_t hwDrawable,
int renderType, const int *attrs);
static void driDestroyDrawable(void *drawablePrivate);
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
- if (! (*dri_interface->getDrawableInfo)(pdp->driScreenPriv->psc, pdp->draw,
+ if (! (*dri_interface->getDrawableInfo)(pdp->pdraw,
&pdp->index, &pdp->lastStamp,
&pdp->x, &pdp->y, &pdp->w, &pdp->h,
&pdp->numClipRects, &pdp->pClipRects,
*/
static void *driCreateNewDrawable(__DRIscreen *screen,
const __GLcontextModes *modes,
- __DRIid draw,
__DRIdrawable *pdraw,
+ drm_drawable_t hwDrawable,
int renderType,
const int *attrs)
{
return NULL;
}
- /* Ensure that modes->screen and screen are the same screen? */
-
- if (!(*dri_interface->createDrawable)(screen, draw, &pdp->hHWDrawable)) {
- _mesa_free(pdp);
- return NULL;
- }
-
- pdp->draw = draw;
+ pdp->hHWDrawable = hwDrawable;
pdp->pdraw = pdraw;
pdp->refcount = 0;
pdp->pStamp = NULL;
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes,
renderType == GLX_PIXMAP_BIT)) {
- (void)(*dri_interface->destroyDrawable)(screen, pdp->draw);
_mesa_free(pdp);
return NULL;
}
if (pdp) {
psp = pdp->driScreenPriv;
(*psp->DriverAPI.DestroyBuffer)(pdp);
- (void)(*dri_interface->destroyDrawable)(psp->psc, pdp->draw);
if (pdp->pClipRects) {
_mesa_free(pdp->pClipRects);
pdp->pClipRects = NULL;
/**
* X's drawable ID associated with this private drawable.
*/
- __DRIid draw;
__DRIdrawable *pdraw;
/**
{
__DRIdrawablePrivate *const driDrawable = mmesa->driDrawable;
__DRIdrawablePrivate *const driReadable = mmesa->driReadable;
- drm_mga_sarea_t *sarea = mmesa->sarea;
-
mmesa->dirty_cliprects = 0;
mga_set_cliprects(mmesa);
- sarea->req_drawable = driDrawable->draw;
- sarea->req_draw_buffer = mmesa->draw_buffer;
-
mgaUpdateClipping( mmesa->glCtx );
mgaCalcViewport( mmesa->glCtx );
}