[Mesa-dev] [PATCH 17/27] dri: Remove dri2.enabled flag

Kristian Høgsberg krh at bitplanet.net
Fri Oct 28 15:11:47 PDT 2011


DRI2 is always enabled now.
---
 src/mesa/drivers/dri/common/dri_util.c             |    1 -
 src/mesa/drivers/dri/common/dri_util.h             |    1 -
 src/mesa/drivers/dri/radeon/radeon_common.c        |    3 -
 .../drivers/dri/radeon/radeon_common_context.c     |   80 ++-----------------
 src/mesa/drivers/dri/radeon/radeon_dma.c           |    4 +-
 src/mesa/drivers/dri/radeon/radeon_screen.c        |    2 -
 6 files changed, 10 insertions(+), 81 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index e42bc84..aa095d8 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -440,7 +440,6 @@ dri2CreateNewScreen(int scrn, int fd,
     psp->extensions = emptyExtensionList;
     psp->fd = fd;
     psp->myNum = scrn;
-    psp->dri2.enabled = GL_TRUE;
 
     psp->DriverAPI = driDriverAPI;
     psp->api_mask = (1 << __DRI_API_OPENGL);
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index e016a23..ac0cef0 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -305,7 +305,6 @@ struct __DRIscreenRec {
     struct {
 	/* Flag to indicate that this is a DRI2 screen.  Many of the above
 	 * fields will not be valid or initializaed in that case. */
-	int enabled;
 	__DRIdri2LoaderExtension *loader;
 	__DRIimageLookupExtension *image;
 	__DRIuseInvalidateExtension *useInvalidate;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index a628486..f7a704d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -467,9 +467,6 @@ void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GL
 	void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y,
 			     GLsizei w, GLsizei h);
 
-	if (!driContext->driScreenPriv->dri2.enabled)
-		return;
-
 	if (ctx->DrawBuffer->Name == 0) {
 		if (radeon->is_front_buffer_rendering) {
 			ctx->Driver.Flush(ctx);
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index d88f8a7..5c2623b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -159,8 +159,7 @@ static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name)
 				? "" : "NO-");
 		}
 
-		if (radeon->radeonScreen->driScreen->dri2.enabled)
-			strcat(buffer, " DRI2");
+		strcat(buffer, " DRI2");
 
 		return (GLubyte *) buffer;
 	}
@@ -364,63 +363,6 @@ GLboolean radeonUnbindContext(__DRIcontext * driContextPriv)
 }
 
 
-static void
-radeon_make_renderbuffer_current(radeonContextPtr radeon,
-					struct gl_framebuffer *draw)
-{
-	/* if radeon->fake */
-	struct radeon_renderbuffer *rb;
-
-	if ((rb = (void *)draw->Attachment[BUFFER_FRONT_LEFT].Renderbuffer)) {
-		if (!rb->bo) {
-			rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
-						radeon->radeonScreen->frontOffset,
-						0,
-						0,
-						RADEON_GEM_DOMAIN_VRAM,
-						0);
-		}
-		rb->cpp = radeon->radeonScreen->cpp;
-		rb->pitch = radeon->radeonScreen->frontPitch * rb->cpp;
-	}
-	if ((rb = (void *)draw->Attachment[BUFFER_BACK_LEFT].Renderbuffer)) {
-		if (!rb->bo) {
-			rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
-						radeon->radeonScreen->backOffset,
-						0,
-						0,
-						RADEON_GEM_DOMAIN_VRAM,
-						0);
-		}
-		rb->cpp = radeon->radeonScreen->cpp;
-		rb->pitch = radeon->radeonScreen->backPitch * rb->cpp;
-	}
-	if ((rb = (void *)draw->Attachment[BUFFER_DEPTH].Renderbuffer)) {
-		if (!rb->bo) {
-			rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
-						radeon->radeonScreen->depthOffset,
-						0,
-						0,
-						RADEON_GEM_DOMAIN_VRAM,
-						0);
-		}
-		rb->cpp = radeon->radeonScreen->cpp;
-		rb->pitch = radeon->radeonScreen->depthPitch * rb->cpp;
-	}
-	if ((rb = (void *)draw->Attachment[BUFFER_STENCIL].Renderbuffer)) {
-		if (!rb->bo) {
-			rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
-						radeon->radeonScreen->depthOffset,
-						0,
-						0,
-						RADEON_GEM_DOMAIN_VRAM,
-						0);
-		}
-		rb->cpp = radeon->radeonScreen->cpp;
-		rb->pitch = radeon->radeonScreen->depthPitch * rb->cpp;
-	}
-}
-
 static unsigned
 radeon_bits_per_pixel(const struct radeon_renderbuffer *rb)
 {
@@ -714,18 +656,14 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
 		readfb = driReadPriv->driverPrivate;
 	}
 
-	if (driContextPriv->driScreenPriv->dri2.enabled) {
-		if(driDrawPriv)
-			radeon_update_renderbuffers(driContextPriv, driDrawPriv, GL_FALSE);
-		if (driDrawPriv != driReadPriv)
-			radeon_update_renderbuffers(driContextPriv, driReadPriv, GL_FALSE);
-		_mesa_reference_renderbuffer(&radeon->state.color.rb,
-			&(radeon_get_renderbuffer(drfb, BUFFER_BACK_LEFT)->base));
-		_mesa_reference_renderbuffer(&radeon->state.depth.rb,
-			&(radeon_get_renderbuffer(drfb, BUFFER_DEPTH)->base));
-	} else {
-		radeon_make_renderbuffer_current(radeon, drfb);
-	}
+	if(driDrawPriv)
+	   radeon_update_renderbuffers(driContextPriv, driDrawPriv, GL_FALSE);
+	if (driDrawPriv != driReadPriv)
+	   radeon_update_renderbuffers(driContextPriv, driReadPriv, GL_FALSE);
+	_mesa_reference_renderbuffer(&radeon->state.color.rb,
+		&(radeon_get_renderbuffer(drfb, BUFFER_BACK_LEFT)->base));
+	_mesa_reference_renderbuffer(&radeon->state.depth.rb,
+		&(radeon_get_renderbuffer(drfb, BUFFER_DEPTH)->base));
 
 	if (RADEON_DEBUG & RADEON_DRI)
 	     fprintf(stderr, "%s ctx %p dfb %p rfb %p\n", __FUNCTION__, radeon->glCtx, drfb, readfb);
diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c
index 1f87a0f..b49486f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_dma.c
+++ b/src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -346,9 +346,7 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
 		   continue;
 		}
 		if (!radeon_bo_is_idle(dma_bo->bo)) {
-			if (rmesa->radeonScreen->driScreen->dri2.enabled)
-				break;
-			continue;
+			break;
 		}
 		remove_from_list(dma_bo);
 		dma_bo->expire_counter = expire_at;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 928130f..25a7a50 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -1321,8 +1321,6 @@ radeonDestroyScreen( __DRIscreen *sPriv )
 static GLboolean
 radeonInitDriver( __DRIscreen *sPriv )
 {
-   assert(sPriv->dri2.enabled);
-
     sPriv->private = (void *) radeonCreateScreen2( sPriv );
     if ( !sPriv->private ) {
         radeonDestroyScreen( sPriv );
-- 
1.7.7



More information about the mesa-dev mailing list