[Mesa-dev] [PATCH 14/27] dri: Remove cliprect information from __DRIdrawable

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


---
 src/gallium/state_trackers/dri/drm/dri2.c          |   19 +------------
 src/mesa/drivers/dri/common/dri_util.c             |   17 ------------
 src/mesa/drivers/dri/common/dri_util.h             |   28 +-------------------
 src/mesa/drivers/dri/common/spantmp_common.h       |   11 +++-----
 src/mesa/drivers/dri/intel/intel_context.c         |   15 ----------
 src/mesa/drivers/dri/r200/r200_state.c             |   12 ++++----
 src/mesa/drivers/dri/r200/r200_swtcl.c             |    3 +-
 .../drivers/dri/radeon/radeon_common_context.c     |   15 ----------
 src/mesa/drivers/dri/radeon/radeon_state.c         |   12 ++++----
 9 files changed, 19 insertions(+), 113 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 64c4cde..710a61a 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -158,25 +158,8 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
             &num_buffers, dri_drawable->loaderPrivate);
    }
 
-   if (buffers) {
-      /* set one cliprect to cover the whole dri_drawable */
-      dri_drawable->x = 0;
-      dri_drawable->y = 0;
-      dri_drawable->backX = 0;
-      dri_drawable->backY = 0;
-      dri_drawable->numClipRects = 1;
-      dri_drawable->pClipRects[0].x1 = 0;
-      dri_drawable->pClipRects[0].y1 = 0;
-      dri_drawable->pClipRects[0].x2 = dri_drawable->w;
-      dri_drawable->pClipRects[0].y2 = dri_drawable->h;
-      dri_drawable->numBackClipRects = 1;
-      dri_drawable->pBackClipRects[0].x1 = 0;
-      dri_drawable->pBackClipRects[0].y1 = 0;
-      dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
-      dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
-
+   if (buffers)
       *count = num_buffers;
-   }
 
    return buffers;
 }
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 945c85c..6d78f82 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -175,14 +175,8 @@ dri2CreateNewDrawable(__DRIscreen *screen,
     pdraw->pStamp = NULL;
     pdraw->lastStamp = 0;
     pdraw->index = 0;
-    pdraw->x = 0;
-    pdraw->y = 0;
     pdraw->w = 0;
     pdraw->h = 0;
-    pdraw->numClipRects = 0;
-    pdraw->numBackClipRects = 0;
-    pdraw->pClipRects = NULL;
-    pdraw->pBackClipRects = NULL;
     pdraw->vblSeq = 0;
     pdraw->vblFlags = 0;
 
@@ -201,9 +195,6 @@ dri2CreateNewDrawable(__DRIscreen *screen,
      */
     pdraw->swap_interval = (unsigned)-1;
 
-    pdraw->pClipRects = &pdraw->dri2.clipRect;
-    pdraw->pBackClipRects = &pdraw->dri2.clipRect;
-
     pdraw->pStamp = &pdraw->dri2.stamp;
     *pdraw->pStamp = pdraw->lastStamp + 1;
 
@@ -277,14 +268,6 @@ static void dri_put_drawable(__DRIdrawable *pdp)
 
 	psp = pdp->driScreenPriv;
         (*psp->DriverAPI.DestroyBuffer)(pdp);
-	if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
-	    free(pdp->pClipRects);
-	    pdp->pClipRects = NULL;
-	}
-	if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
-	    free(pdp->pBackClipRects);
-	    pdp->pBackClipRects = NULL;
-	}
 	free(pdp);
     }
 }
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 817d77d..e4dc623 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -218,32 +218,7 @@ struct __DRIdrawableRec {
      */
     unsigned int lastStamp;
 
-    /**
-     * \name Drawable 
-     *
-     * Drawable information used in software fallbacks.
-     */
-    /*@{*/
-    int x;
-    int y;
-    int w;
-    int h;
-    int numClipRects;
-    drm_clip_rect_t *pClipRects;
-    /*@}*/
-
-    /**
-     * \name Back and depthbuffer
-     *
-     * Information about the back and depthbuffer where different from above.
-     */
-    /*@{*/
-    int backX;
-    int backY;
-    int backClipRectType;
-    int numBackClipRects;
-    drm_clip_rect_t *pBackClipRects;
-    /*@}*/
+    int w, h;
 
     /**
      * \name Vertical blank tracking information
@@ -289,7 +264,6 @@ struct __DRIdrawableRec {
 
     struct {
 	unsigned int stamp;
-	drm_clip_rect_t clipRect;
     } dri2;
 };
 
diff --git a/src/mesa/drivers/dri/common/spantmp_common.h b/src/mesa/drivers/dri/common/spantmp_common.h
index a4509a5..8916e7b 100644
--- a/src/mesa/drivers/dri/common/spantmp_common.h
+++ b/src/mesa/drivers/dri/common/spantmp_common.h
@@ -49,17 +49,14 @@
 #ifndef HW_CLIPLOOP
 #define HW_CLIPLOOP()							\
    do {									\
-      int _nc = dPriv->numClipRects;					\
-      while ( _nc-- ) {							\
-	 int minx = dPriv->pClipRects[_nc].x1 - dPriv->x;		\
-	 int miny = dPriv->pClipRects[_nc].y1 - dPriv->y;		\
-	 int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x;		\
-	 int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
+      int minx = 0;							\
+      int miny = 0;							\
+      int maxx = dPriv->w;						\
+      int maxy = dPriv->h;
 #endif
 
 #ifndef HW_ENDCLIPLOOP
 #define HW_ENDCLIPLOOP()						\
-      }									\
    } while (0)
 #endif
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 501b00d..6190396 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -311,21 +311,6 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
    if (buffers == NULL)
       return;
 
-   drawable->x = 0;
-   drawable->y = 0;
-   drawable->backX = 0;
-   drawable->backY = 0;
-   drawable->numClipRects = 1;
-   drawable->pClipRects[0].x1 = 0;
-   drawable->pClipRects[0].y1 = 0;
-   drawable->pClipRects[0].x2 = drawable->w;
-   drawable->pClipRects[0].y2 = drawable->h;
-   drawable->numBackClipRects = 1;
-   drawable->pBackClipRects[0].x1 = 0;
-   drawable->pBackClipRects[0].y1 = 0;
-   drawable->pBackClipRects[0].x2 = drawable->w;
-   drawable->pBackClipRects[0].y2 = drawable->h;
-
    for (i = 0; i < count; i++) {
        switch (buffers[i].attachment) {
        case __DRI_BUFFER_FRONT_LEFT:
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 9ec51c7..6b0a10a 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1592,8 +1592,8 @@ void r200UpdateWindow( struct gl_context *ctx )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
-   GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0;
-   GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0;
+   GLfloat xoffset = 0;
+   GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0;
    const GLfloat *v = ctx->Viewport._WindowMap.m;
    const GLboolean render_to_fbo = (ctx->DrawBuffer ? (ctx->DrawBuffer->Name != 0) : 0);
    const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
@@ -1672,8 +1672,8 @@ void r200UpdateViewportOffset( struct gl_context *ctx )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
-   GLfloat xoffset = (GLfloat)dPriv->x;
-   GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
+   GLfloat xoffset = (GLfloat)0;
+   GLfloat yoffset = (GLfloat)dPriv->h;
    const GLfloat *v = ctx->Viewport._WindowMap.m;
 
    float_ui32_type tx;
@@ -1701,8 +1701,8 @@ void r200UpdateViewportOffset( struct gl_context *ctx )
                 R200_STIPPLE_Y_OFFSET_MASK);
 
          /* add magic offsets, then invert */
-         stx = 31 - ((dPriv->x - 1) & R200_STIPPLE_COORD_MASK);
-         sty = 31 - ((dPriv->y + dPriv->h - 1)
+         stx = 31 - ((-1) & R200_STIPPLE_COORD_MASK);
+         sty = 31 - ((dPriv->h - 1)
                      & R200_STIPPLE_COORD_MASK);
 
          m |= ((stx << R200_STIPPLE_X_OFFSET_SHIFT) |
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index dad2bc7..67f5961 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -851,8 +851,7 @@ r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py,
 
    /* Update window height
     */
-   h = radeon_get_drawable(&rmesa->radeon)->h + radeon_get_drawable(&rmesa->radeon)->y;
-   px += radeon_get_drawable(&rmesa->radeon)->x;
+   h = radeon_get_drawable(&rmesa->radeon)->h;
 
    /* Clipping handled by existing mechansims in r200_ioctl.c?
     */
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index dbd0ed2..77cfc93 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -570,21 +570,6 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
 	if (buffers == NULL)
 		return;
 
-	/* set one cliprect to cover the whole drawable */
-	drawable->x = 0;
-	drawable->y = 0;
-	drawable->backX = 0;
-	drawable->backY = 0;
-	drawable->numClipRects = 1;
-	drawable->pClipRects[0].x1 = 0;
-	drawable->pClipRects[0].y1 = 0;
-	drawable->pClipRects[0].x2 = drawable->w;
-	drawable->pClipRects[0].y2 = drawable->h;
-	drawable->numBackClipRects = 1;
-	drawable->pBackClipRects[0].x1 = 0;
-	drawable->pBackClipRects[0].y1 = 0;
-	drawable->pBackClipRects[0].x2 = drawable->w;
-	drawable->pBackClipRects[0].y2 = drawable->h;
 	for (i = 0; i < count; i++) {
 		switch (buffers[i].attachment) {
 		case __DRI_BUFFER_FRONT_LEFT:
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index a025a8d..a207940 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1376,8 +1376,8 @@ void radeonUpdateWindow( struct gl_context *ctx )
 {
    r100ContextPtr rmesa = R100_CONTEXT(ctx);
    __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
-   GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0;
-   GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0;
+   GLfloat xoffset = 0.0;
+   GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0;
    const GLfloat *v = ctx->Viewport._WindowMap.m;
    const GLboolean render_to_fbo = (ctx->DrawBuffer ? (ctx->DrawBuffer->Name != 0) : 0);
    const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
@@ -1431,8 +1431,8 @@ void radeonUpdateViewportOffset( struct gl_context *ctx )
 {
    r100ContextPtr rmesa = R100_CONTEXT(ctx);
    __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
-   GLfloat xoffset = (GLfloat)dPriv->x;
-   GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
+   GLfloat xoffset = 0.0;
+   GLfloat yoffset = (GLfloat)dPriv->h;
    const GLfloat *v = ctx->Viewport._WindowMap.m;
 
    float_ui32_type tx;
@@ -1460,8 +1460,8 @@ void radeonUpdateViewportOffset( struct gl_context *ctx )
                 RADEON_STIPPLE_Y_OFFSET_MASK);
 
          /* add magic offsets, then invert */
-         stx = 31 - ((dPriv->x - 1) & RADEON_STIPPLE_COORD_MASK);
-         sty = 31 - ((dPriv->y + dPriv->h - 1)
+         stx = 31 - ((-1) & RADEON_STIPPLE_COORD_MASK);
+         sty = 31 - ((dPriv->h - 1)
                      & RADEON_STIPPLE_COORD_MASK);
 
          m |= ((stx << RADEON_STIPPLE_X_OFFSET_SHIFT) |
-- 
1.7.7



More information about the mesa-dev mailing list