glx: Move __DRIdrawable pointers to DRI drawable privates
This commit is contained in:
@@ -101,6 +101,7 @@ struct dri2_context
|
|||||||
struct dri2_drawable
|
struct dri2_drawable
|
||||||
{
|
{
|
||||||
__GLXDRIdrawable base;
|
__GLXDRIdrawable base;
|
||||||
|
__DRIdrawable *driDrawable;
|
||||||
__DRIbuffer buffers[5];
|
__DRIbuffer buffers[5];
|
||||||
int bufferCount;
|
int bufferCount;
|
||||||
int width, height;
|
int width, height;
|
||||||
@@ -127,9 +128,11 @@ dri2BindContext(__GLXDRIcontext *context,
|
|||||||
{
|
{
|
||||||
struct dri2_context *pcp = (struct dri2_context *) context;
|
struct dri2_context *pcp = (struct dri2_context *) context;
|
||||||
struct dri2_screen *psc = (struct dri2_screen *) pcp->psc;
|
struct dri2_screen *psc = (struct dri2_screen *) pcp->psc;
|
||||||
|
struct dri2_drawable *pdr = (struct dri2_drawable *) draw;
|
||||||
|
struct dri2_drawable *prd = (struct dri2_drawable *) read;
|
||||||
|
|
||||||
return (*psc->core->bindContext) (pcp->driContext,
|
return (*psc->core->bindContext) (pcp->driContext,
|
||||||
draw->driDrawable, read->driDrawable);
|
pdr->driDrawable, prd->driDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -179,18 +182,19 @@ dri2CreateContext(__GLXscreenConfigs *base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dri2DestroyDrawable(__GLXDRIdrawable *pdraw)
|
dri2DestroyDrawable(__GLXDRIdrawable *base)
|
||||||
{
|
{
|
||||||
struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc;
|
struct dri2_screen *psc = (struct dri2_screen *) base->psc;
|
||||||
|
struct dri2_drawable *pdraw = (struct dri2_drawable *) base;
|
||||||
__GLXdisplayPrivate *dpyPriv;
|
__GLXdisplayPrivate *dpyPriv;
|
||||||
struct dri2_display *pdp;
|
struct dri2_display *pdp;
|
||||||
|
|
||||||
dpyPriv = __glXInitialize(pdraw->psc->dpy);
|
dpyPriv = __glXInitialize(base->psc->dpy);
|
||||||
pdp = (struct dri2_display *)dpyPriv->dri2Display;
|
pdp = (struct dri2_display *)dpyPriv->dri2Display;
|
||||||
|
|
||||||
__glxHashDelete(pdp->dri2Hash, pdraw->xDrawable);
|
__glxHashDelete(pdp->dri2Hash, pdraw->base.xDrawable);
|
||||||
(*psc->core->destroyDrawable) (pdraw->driDrawable);
|
(*psc->core->destroyDrawable) (pdraw->driDrawable);
|
||||||
DRI2DestroyDrawable(psc->base.dpy, pdraw->xDrawable);
|
DRI2DestroyDrawable(psc->base.dpy, pdraw->base.xDrawable);
|
||||||
Xfree(pdraw);
|
Xfree(pdraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,18 +242,18 @@ dri2CreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
|
|||||||
dpyPriv = __glXInitialize(psc->base.dpy);
|
dpyPriv = __glXInitialize(psc->base.dpy);
|
||||||
pdp = (struct dri2_display *)dpyPriv->dri2Display;;
|
pdp = (struct dri2_display *)dpyPriv->dri2Display;;
|
||||||
/* Create a new drawable */
|
/* Create a new drawable */
|
||||||
pdraw->base.driDrawable =
|
pdraw->driDrawable =
|
||||||
(*psc->dri2->createNewDrawable) (psc->driScreen,
|
(*psc->dri2->createNewDrawable) (psc->driScreen,
|
||||||
config->driConfig, pdraw);
|
config->driConfig, pdraw);
|
||||||
|
|
||||||
if (!pdraw->base.driDrawable) {
|
if (!pdraw->driDrawable) {
|
||||||
DRI2DestroyDrawable(psc->base.dpy, xDrawable);
|
DRI2DestroyDrawable(psc->base.dpy, xDrawable);
|
||||||
Xfree(pdraw);
|
Xfree(pdraw);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__glxHashInsert(pdp->dri2Hash, xDrawable, pdraw)) {
|
if (__glxHashInsert(pdp->dri2Hash, xDrawable, pdraw)) {
|
||||||
(*psc->core->destroyDrawable) (pdraw->base.driDrawable);
|
(*psc->core->destroyDrawable) (pdraw->driDrawable);
|
||||||
DRI2DestroyDrawable(psc->base.dpy, xDrawable);
|
DRI2DestroyDrawable(psc->base.dpy, xDrawable);
|
||||||
Xfree(pdraw);
|
Xfree(pdraw);
|
||||||
return None;
|
return None;
|
||||||
@@ -319,7 +323,7 @@ dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y, int width, int height)
|
|||||||
|
|
||||||
#ifdef __DRI2_FLUSH
|
#ifdef __DRI2_FLUSH
|
||||||
if (psc->f)
|
if (psc->f)
|
||||||
(*psc->f->flush) (pdraw->driDrawable);
|
(*psc->f->flush) (priv->driDrawable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
|
region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
|
||||||
@@ -349,7 +353,7 @@ dri2_copy_drawable(struct dri2_drawable *priv, int dest, int src)
|
|||||||
|
|
||||||
#ifdef __DRI2_FLUSH
|
#ifdef __DRI2_FLUSH
|
||||||
if (psc->f)
|
if (psc->f)
|
||||||
(*psc->f->flush) (priv->base.driDrawable);
|
(*psc->f->flush) (priv->driDrawable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
|
region = XFixesCreateRegion(psc->base.dpy, &xrect, 1);
|
||||||
@@ -451,7 +455,7 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
|||||||
|
|
||||||
#ifdef __DRI2_FLUSH
|
#ifdef __DRI2_FLUSH
|
||||||
if (psc->f)
|
if (psc->f)
|
||||||
(*psc->f->flush)(pdraw->driDrawable);
|
(*psc->f->flush)(priv->driDrawable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Old servers don't send invalidate events */
|
/* Old servers don't send invalidate events */
|
||||||
@@ -586,10 +590,11 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
|
|||||||
__GLXDRIdrawable *pdraw =
|
__GLXDRIdrawable *pdraw =
|
||||||
dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
|
dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
|
||||||
struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc;
|
struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc;
|
||||||
|
struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
|
||||||
|
|
||||||
#if __DRI2_FLUSH_VERSION >= 3
|
#if __DRI2_FLUSH_VERSION >= 3
|
||||||
if (pdraw && psc->f)
|
if (pdraw && psc->f)
|
||||||
psc->f->invalidate(pdraw->driDrawable);
|
psc->f->invalidate(pdp->driDrawable);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,11 +604,12 @@ dri2_bind_tex_image(Display * dpy,
|
|||||||
int buffer, const int *attrib_list)
|
int buffer, const int *attrib_list)
|
||||||
{
|
{
|
||||||
GLXContext gc = __glXGetCurrentContext();
|
GLXContext gc = __glXGetCurrentContext();
|
||||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
|
__GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable, NULL);
|
||||||
__GLXdisplayPrivate *dpyPriv = __glXInitialize(dpy);
|
__GLXdisplayPrivate *dpyPriv = __glXInitialize(dpy);
|
||||||
struct dri2_display *pdp =
|
struct dri2_drawable *pdraw = (struct dri2_drawable *) base;
|
||||||
(struct dri2_display *) dpyPriv->dri2Display;
|
struct dri2_display *pdp =
|
||||||
struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc;
|
(struct dri2_display *) dpyPriv->dri2Display;
|
||||||
|
struct dri2_screen *psc = (struct dri2_screen *) base->psc;
|
||||||
|
|
||||||
if (pdraw != NULL) {
|
if (pdraw != NULL) {
|
||||||
|
|
||||||
@@ -615,13 +621,13 @@ dri2_bind_tex_image(Display * dpy,
|
|||||||
if (psc->texBuffer->base.version >= 2 &&
|
if (psc->texBuffer->base.version >= 2 &&
|
||||||
psc->texBuffer->setTexBuffer2 != NULL) {
|
psc->texBuffer->setTexBuffer2 != NULL) {
|
||||||
(*psc->texBuffer->setTexBuffer2) (gc->__driContext,
|
(*psc->texBuffer->setTexBuffer2) (gc->__driContext,
|
||||||
pdraw->textureTarget,
|
pdraw->base.textureTarget,
|
||||||
pdraw->textureFormat,
|
pdraw->base.textureFormat,
|
||||||
pdraw->driDrawable);
|
pdraw->driDrawable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*psc->texBuffer->setTexBuffer) (gc->__driContext,
|
(*psc->texBuffer->setTexBuffer) (gc->__driContext,
|
||||||
pdraw->textureTarget,
|
pdraw->base.textureTarget,
|
||||||
pdraw->driDrawable);
|
pdraw->driDrawable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -82,6 +82,13 @@ struct dri_context
|
|||||||
__GLXscreenConfigs *psc;
|
__GLXscreenConfigs *psc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct dri_drawable
|
||||||
|
{
|
||||||
|
__GLXDRIdrawable base;
|
||||||
|
|
||||||
|
__DRIdrawable *driDrawable;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Given a display pointer and screen number, determine the name of
|
* Given a display pointer and screen number, determine the name of
|
||||||
* the DRI driver for the screen. (I.e. "r128", "tdfx", etc).
|
* the DRI driver for the screen. (I.e. "r128", "tdfx", etc).
|
||||||
@@ -506,9 +513,11 @@ driBindContext(__GLXDRIcontext *context,
|
|||||||
{
|
{
|
||||||
struct dri_context *pcp = (struct dri_context *) context;
|
struct dri_context *pcp = (struct dri_context *) context;
|
||||||
struct dri_screen *psc = (struct dri_screen *) pcp->psc;
|
struct dri_screen *psc = (struct dri_screen *) pcp->psc;
|
||||||
|
struct dri_drawable *pdr = (struct dri_drawable *) draw;
|
||||||
|
struct dri_drawable *prd = (struct dri_drawable *) read;
|
||||||
|
|
||||||
return (*psc->core->bindContext) (pcp->driContext,
|
return (*psc->core->bindContext) (pcp->driContext,
|
||||||
draw->driDrawable, read->driDrawable);
|
pdr->driDrawable, prd->driDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -572,8 +581,9 @@ static void
|
|||||||
driDestroyDrawable(__GLXDRIdrawable * pdraw)
|
driDestroyDrawable(__GLXDRIdrawable * pdraw)
|
||||||
{
|
{
|
||||||
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
|
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
|
||||||
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
|
|
||||||
(*psc->core->destroyDrawable) (pdraw->driDrawable);
|
(*psc->core->destroyDrawable) (pdp->driDrawable);
|
||||||
XF86DRIDestroyDrawable(psc->base.dpy, psc->base.scr, pdraw->drawable);
|
XF86DRIDestroyDrawable(psc->base.dpy, psc->base.scr, pdraw->drawable);
|
||||||
Xfree(pdraw);
|
Xfree(pdraw);
|
||||||
}
|
}
|
||||||
@@ -583,46 +593,46 @@ driCreateDrawable(__GLXscreenConfigs *base,
|
|||||||
XID xDrawable,
|
XID xDrawable,
|
||||||
GLXDrawable drawable, const __GLcontextModes * modes)
|
GLXDrawable drawable, const __GLcontextModes * modes)
|
||||||
{
|
{
|
||||||
__GLXDRIdrawable *pdraw;
|
|
||||||
drm_drawable_t hwDrawable;
|
drm_drawable_t hwDrawable;
|
||||||
void *empty_attribute_list = NULL;
|
void *empty_attribute_list = NULL;
|
||||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
||||||
struct dri_screen *psc = (struct dri_screen *) base;
|
struct dri_screen *psc = (struct dri_screen *) base;
|
||||||
|
struct dri_drawable *pdp;
|
||||||
|
|
||||||
/* Old dri can't handle GLX 1.3+ drawable constructors. */
|
/* Old dri can't handle GLX 1.3+ drawable constructors. */
|
||||||
if (xDrawable != drawable)
|
if (xDrawable != drawable)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pdraw = Xmalloc(sizeof(*pdraw));
|
pdp = Xmalloc(sizeof *pdp);
|
||||||
if (!pdraw)
|
if (!pdp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pdraw->drawable = drawable;
|
pdp->base.drawable = drawable;
|
||||||
pdraw->psc = &psc->base;
|
pdp->base.psc = &psc->base;
|
||||||
|
|
||||||
if (!XF86DRICreateDrawable(psc->base.dpy, psc->base.scr,
|
if (!XF86DRICreateDrawable(psc->base.dpy, psc->base.scr,
|
||||||
drawable, &hwDrawable)) {
|
drawable, &hwDrawable)) {
|
||||||
Xfree(pdraw);
|
Xfree(pdp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new drawable */
|
/* Create a new drawable */
|
||||||
pdraw->driDrawable =
|
pdp->driDrawable =
|
||||||
(*psc->legacy->createNewDrawable) (psc->driScreen,
|
(*psc->legacy->createNewDrawable) (psc->driScreen,
|
||||||
config->driConfig,
|
config->driConfig,
|
||||||
hwDrawable,
|
hwDrawable,
|
||||||
GLX_WINDOW_BIT,
|
GLX_WINDOW_BIT,
|
||||||
empty_attribute_list, pdraw);
|
empty_attribute_list, pdp);
|
||||||
|
|
||||||
if (!pdraw->driDrawable) {
|
if (!pdp->driDrawable) {
|
||||||
XF86DRIDestroyDrawable(psc->base.dpy, psc->base.scr, drawable);
|
XF86DRIDestroyDrawable(psc->base.dpy, psc->base.scr, drawable);
|
||||||
Xfree(pdraw);
|
Xfree(pdp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdraw->destroyDrawable = driDestroyDrawable;
|
pdp->base.destroyDrawable = driDestroyDrawable;
|
||||||
|
|
||||||
return pdraw;
|
return &pdp->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t
|
static int64_t
|
||||||
@@ -630,8 +640,9 @@ driSwapBuffers(__GLXDRIdrawable * pdraw, int64_t unused1, int64_t unused2,
|
|||||||
int64_t unused3)
|
int64_t unused3)
|
||||||
{
|
{
|
||||||
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
|
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
|
||||||
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
|
|
||||||
(*psc->core->swapBuffers) (pdraw->driDrawable);
|
(*psc->core->swapBuffers) (pdp->driDrawable);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,8 +650,10 @@ static void
|
|||||||
driCopySubBuffer(__GLXDRIdrawable * pdraw,
|
driCopySubBuffer(__GLXDRIdrawable * pdraw,
|
||||||
int x, int y, int width, int height)
|
int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
(*pdraw->psc->driCopySubBuffer->copySubBuffer) (pdraw->driDrawable,
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
x, y, width, height);
|
|
||||||
|
(*pdp->base.psc->driCopySubBuffer->copySubBuffer) (pdp->driDrawable,
|
||||||
|
x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -668,10 +681,11 @@ driDrawableGetMSC(__GLXscreenConfigs *base, __GLXDRIdrawable *pdraw,
|
|||||||
int64_t *ust, int64_t *msc, int64_t *sbc)
|
int64_t *ust, int64_t *msc, int64_t *sbc)
|
||||||
{
|
{
|
||||||
struct dri_screen *psc = (struct dri_screen *) base;
|
struct dri_screen *psc = (struct dri_screen *) base;
|
||||||
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
|
|
||||||
if (pdraw && psc->sbc && psc->msc)
|
if (pdp && psc->sbc && psc->msc)
|
||||||
return ( (*psc->msc->getMSC)(psc->driScreen, msc) == 0 &&
|
return ( (*psc->msc->getMSC)(psc->driScreen, msc) == 0 &&
|
||||||
(*psc->sbc->getSBC)(pdraw->driDrawable, sbc) == 0 &&
|
(*psc->sbc->getSBC)(pdp->driDrawable, sbc) == 0 &&
|
||||||
__glXGetUST(ust) == 0 );
|
__glXGetUST(ust) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,9 +694,10 @@ driWaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
|||||||
int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
|
int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
|
||||||
{
|
{
|
||||||
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
|
struct dri_screen *psc = (struct dri_screen *) pdraw->psc;
|
||||||
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
|
|
||||||
if (pdraw != NULL && psc->msc != NULL) {
|
if (pdp != NULL && psc->msc != NULL) {
|
||||||
ret = (*psc->msc->waitForMSC) (pdraw->driDrawable, target_msc,
|
ret = (*psc->msc->waitForMSC) (pdp->driDrawable, target_msc,
|
||||||
divisor, remainder, msc, sbc);
|
divisor, remainder, msc, sbc);
|
||||||
|
|
||||||
/* __glXGetUST returns zero on success and non-zero on failure.
|
/* __glXGetUST returns zero on success and non-zero on failure.
|
||||||
@@ -696,9 +711,11 @@ static int
|
|||||||
driWaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
|
driWaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
|
||||||
int64_t *msc, int64_t *sbc)
|
int64_t *msc, int64_t *sbc)
|
||||||
{
|
{
|
||||||
if (pdraw != NULL && psc->sbc != NULL) {
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
|
|
||||||
|
if (pdp != NULL && psc->sbc != NULL) {
|
||||||
ret =
|
ret =
|
||||||
(*psc->sbc->waitForSBC) (pdraw->driDrawable, target_sbc, msc, sbc);
|
(*psc->sbc->waitForSBC) (pdp->driDrawable, target_sbc, msc, sbc);
|
||||||
|
|
||||||
/* __glXGetUST returns zero on success and non-zero on failure.
|
/* __glXGetUST returns zero on success and non-zero on failure.
|
||||||
* This function returns True on success and False on failure.
|
* This function returns True on success and False on failure.
|
||||||
@@ -706,8 +723,8 @@ driWaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
|
|||||||
return ((ret == 0) && (__glXGetUST(ust) == 0));
|
return ((ret == 0) && (__glXGetUST(ust) == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return DRI2WaitSBC(pdraw->psc->dpy, pdraw->xDrawable, target_sbc, ust, msc,
|
return DRI2WaitSBC(pdp->base.psc->dpy,
|
||||||
sbc);
|
pdp->base.xDrawable, target_sbc, ust, msc, sbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -716,13 +733,14 @@ static int
|
|||||||
driSetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
|
driSetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
|
||||||
{
|
{
|
||||||
GLXContext gc = __glXGetCurrentContext();
|
GLXContext gc = __glXGetCurrentContext();
|
||||||
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
struct dri_screen *psc;
|
struct dri_screen *psc;
|
||||||
|
|
||||||
if (gc->driContext) {
|
if (gc->driContext) {
|
||||||
psc = (struct dri_screen *) pdraw->psc;
|
psc = (struct dri_screen *) pdraw->psc;
|
||||||
|
|
||||||
if (psc->swapControl != NULL && pdraw != NULL) {
|
if (psc->swapControl != NULL && pdraw != NULL) {
|
||||||
psc->swapControl->setSwapInterval(pdraw->driDrawable, interval);
|
psc->swapControl->setSwapInterval(pdp->driDrawable, interval);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -734,13 +752,14 @@ static int
|
|||||||
driGetSwapInterval(__GLXDRIdrawable *pdraw)
|
driGetSwapInterval(__GLXDRIdrawable *pdraw)
|
||||||
{
|
{
|
||||||
GLXContext gc = __glXGetCurrentContext();
|
GLXContext gc = __glXGetCurrentContext();
|
||||||
|
struct dri_drawable *pdp = (struct dri_drawable *) pdraw;
|
||||||
struct dri_screen *psc;
|
struct dri_screen *psc;
|
||||||
|
|
||||||
if (gc != NULL && gc->driContext) {
|
if (gc != NULL && gc->driContext) {
|
||||||
psc = (struct dri_screen *) pdraw->psc;
|
psc = (struct dri_screen *) pdraw->psc;
|
||||||
|
|
||||||
if (psc->swapControl != NULL && pdraw != NULL) {
|
if (psc->swapControl != NULL && pdraw != NULL) {
|
||||||
return psc->swapControl->getSwapInterval(pdraw->driDrawable);
|
return psc->swapControl->getSwapInterval(pdp->driDrawable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -58,6 +58,7 @@ struct drisw_drawable
|
|||||||
GC gc;
|
GC gc;
|
||||||
GC swapgc;
|
GC swapgc;
|
||||||
|
|
||||||
|
__DRIdrawable *driDrawable;
|
||||||
XVisualInfo *visinfo;
|
XVisualInfo *visinfo;
|
||||||
XImage *ximage;
|
XImage *ximage;
|
||||||
};
|
};
|
||||||
@@ -253,9 +254,11 @@ driBindContext(__GLXDRIcontext * context,
|
|||||||
{
|
{
|
||||||
struct drisw_context *pcp = (struct drisw_context *) context;
|
struct drisw_context *pcp = (struct drisw_context *) context;
|
||||||
struct drisw_screen *psc = (struct drisw_screen *) pcp->psc;
|
struct drisw_screen *psc = (struct drisw_screen *) pcp->psc;
|
||||||
|
struct drisw_drawable *pdr = (struct drisw_drawable *) draw;
|
||||||
|
struct drisw_drawable *prd = (struct drisw_drawable *) read;
|
||||||
|
|
||||||
return (*psc->core->bindContext) (pcp->driContext,
|
return (*psc->core->bindContext) (pcp->driContext,
|
||||||
draw->driDrawable, read->driDrawable);
|
pdr->driDrawable, prd->driDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -311,7 +314,7 @@ driDestroyDrawable(__GLXDRIdrawable * pdraw)
|
|||||||
struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
|
struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
|
||||||
struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc;
|
struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc;
|
||||||
|
|
||||||
(*psc->core->destroyDrawable) (pdraw->driDrawable);
|
(*psc->core->destroyDrawable) (pdp->driDrawable);
|
||||||
|
|
||||||
XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
|
XDestroyDrawable(pdp, pdraw->psc->dpy, pdraw->drawable);
|
||||||
Xfree(pdp);
|
Xfree(pdp);
|
||||||
@@ -321,7 +324,6 @@ static __GLXDRIdrawable *
|
|||||||
driCreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
|
driCreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
|
||||||
GLXDrawable drawable, const __GLcontextModes * modes)
|
GLXDrawable drawable, const __GLcontextModes * modes)
|
||||||
{
|
{
|
||||||
__GLXDRIdrawable *pdraw;
|
|
||||||
struct drisw_drawable *pdp;
|
struct drisw_drawable *pdp;
|
||||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
||||||
struct drisw_screen *psc = (struct drisw_screen *) base;
|
struct drisw_screen *psc = (struct drisw_screen *) base;
|
||||||
@@ -336,27 +338,25 @@ driCreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
|
|||||||
if (!pdp)
|
if (!pdp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pdraw = &(pdp->base);
|
pdp->base.xDrawable = xDrawable;
|
||||||
pdraw->xDrawable = xDrawable;
|
pdp->base.drawable = drawable;
|
||||||
pdraw->drawable = drawable;
|
pdp->base.psc = &psc->base;
|
||||||
pdraw->psc = &psc->base;
|
|
||||||
|
|
||||||
XCreateDrawable(pdp, psc->base.dpy, xDrawable, modes->visualID);
|
XCreateDrawable(pdp, psc->base.dpy, xDrawable, modes->visualID);
|
||||||
|
|
||||||
/* Create a new drawable */
|
/* Create a new drawable */
|
||||||
pdraw->driDrawable =
|
pdp->driDrawable =
|
||||||
(*swrast->createNewDrawable) (psc->driScreen,
|
(*swrast->createNewDrawable) (psc->driScreen, config->driConfig, pdp);
|
||||||
config->driConfig, pdp);
|
|
||||||
|
|
||||||
if (!pdraw->driDrawable) {
|
if (!pdp->driDrawable) {
|
||||||
XDestroyDrawable(pdp, psc->base.dpy, xDrawable);
|
XDestroyDrawable(pdp, psc->base.dpy, xDrawable);
|
||||||
Xfree(pdp);
|
Xfree(pdp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdraw->destroyDrawable = driDestroyDrawable;
|
pdp->base.destroyDrawable = driDestroyDrawable;
|
||||||
|
|
||||||
return pdraw;
|
return &pdp->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t
|
static int64_t
|
||||||
@@ -370,7 +370,7 @@ driSwapBuffers(__GLXDRIdrawable * pdraw,
|
|||||||
(void) divisor;
|
(void) divisor;
|
||||||
(void) remainder;
|
(void) remainder;
|
||||||
|
|
||||||
(*psc->core->swapBuffers) (pdraw->driDrawable);
|
(*psc->core->swapBuffers) (pdp->driDrawable);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -173,7 +173,6 @@ struct __GLXDRIdrawableRec
|
|||||||
XID drawable;
|
XID drawable;
|
||||||
__GLXscreenConfigs *psc;
|
__GLXscreenConfigs *psc;
|
||||||
GLenum textureTarget;
|
GLenum textureTarget;
|
||||||
__DRIdrawable *driDrawable;
|
|
||||||
GLenum textureFormat; /* EXT_texture_from_pixmap support */
|
GLenum textureFormat; /* EXT_texture_from_pixmap support */
|
||||||
unsigned long eventMask;
|
unsigned long eventMask;
|
||||||
};
|
};
|
||||||
|
@@ -2481,7 +2481,7 @@ __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
|
|||||||
if (draw == NULL)
|
if (draw == NULL)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
return __driGetMscRateOML(draw->driDrawable, numerator, denominator, draw);
|
return __driGetMscRateOML(NULL, numerator, denominator, draw);
|
||||||
#else
|
#else
|
||||||
(void) dpy;
|
(void) dpy;
|
||||||
(void) drawable;
|
(void) drawable;
|
||||||
|
Reference in New Issue
Block a user