Mesa (master): radeon: update flush according to glXMakeCurrent man page

Dave Airlie airlied at kemper.freedesktop.org
Mon Dec 5 19:21:21 UTC 2011


Module: Mesa
Branch: master
Commit: 4ed8a585840865550bb9acac38c5ef26670a1fb8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ed8a585840865550bb9acac38c5ef26670a1fb8

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Nov 11 15:55:30 2011 +0000

radeon: update flush according to glXMakeCurrent man page

This also copies code from intel driver to do this.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 .../drivers/dri/radeon/radeon_common_context.c     |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index bb0168e..ceaefda 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "drivers/common/meta.h"
 #include "main/context.h"
 #include "main/framebuffer.h"
+#include "main/fbobject.h"
 #include "main/renderbuffer.h"
 #include "main/state.h"
 #include "main/simple_list.h"
@@ -564,8 +565,22 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
 			    __DRIdrawable * driReadPriv)
 {
 	radeonContextPtr radeon;
+	GET_CURRENT_CONTEXT(curCtx);
 	struct gl_framebuffer *drfb, *readfb;
 
+	if (driContextPriv)
+		radeon = (radeonContextPtr)driContextPriv->driverPrivate;
+	else
+		radeon = NULL;
+	/* According to the glXMakeCurrent() man page: "Pending commands to
+	 * the previous context, if any, are flushed before it is released."
+	 * But only flush if we're actually changing contexts.
+	 */
+
+	if ((radeonContextPtr)curCtx && (radeonContextPtr)curCtx != radeon) {
+		_mesa_flush(curCtx);
+	}
+
 	if (!driContextPriv) {
 		if (RADEON_DEBUG & RADEON_DRI)
 			fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
@@ -573,8 +588,6 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
 		return GL_TRUE;
 	}
 
-	radeon = (radeonContextPtr) driContextPriv->driverPrivate;
-
 	if(driDrawPriv == NULL && driReadPriv == NULL) {
 		drfb = _mesa_create_framebuffer(&radeon->glCtx->Visual);
 		readfb = drfb;




More information about the mesa-commit mailing list