summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2006-10-16 20:59:53 +0000
committerIan Romanick <[email protected]>2006-10-16 20:59:53 +0000
commit7b1ff326071658d5bd6e7feb2ad78d0e0209211d (patch)
tree01c436fc25784e12e7f342cfcf176f1bcd6ed22b /src/mesa/drivers
parent8c5ae809163c49cf3785edaee9af0f5b6cfe5f4b (diff)
Track the currently bound read drawable and make sure its info is up
to date.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c10
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h7
2 files changed, 15 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index b5c20a066a5..1ca2756e012 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -323,6 +323,7 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy,
/* Bind the drawable to the context */
pcp->driDrawablePriv = pdp;
+ pcp->driReadablePriv = prp;
pdp->driContextPriv = pcp;
pdp->refcount++;
if ( pdp != prp ) {
@@ -339,6 +340,12 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy,
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
}
+ if ((pdp != prp) && (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp)) {
+ DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
+ __driUtilUpdateDrawableInfo(prp);
+ DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
+ }
+
/* Call device-specific MakeCurrent */
(*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
@@ -402,7 +409,8 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
__DRIscreenPrivate *psp;
__DRIcontextPrivate *pcp = pdp->driContextPriv;
- if (!pcp || (pdp != pcp->driDrawablePriv)) {
+ if (!pcp
+ || ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) {
/* ERROR!!! */
return;
}
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 14c24a0efaa..885d5899e0f 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -355,11 +355,16 @@ struct __DRIcontextPrivateRec {
__DRInativeDisplay *display;
/**
- * Pointer to drawable currently bound to this context.
+ * Pointer to drawable currently bound to this context for drawing.
*/
__DRIdrawablePrivate *driDrawablePriv;
/**
+ * Pointer to drawable currently bound to this context for reading.
+ */
+ __DRIdrawablePrivate *driReadablePriv;
+
+ /**
* Pointer to screen on which this context was created.
*/
__DRIscreenPrivate *driScreenPriv;