summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-11-01 18:51:43 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-11-01 18:51:43 +0000
commit9669804fe476f3497ac7e76e1e7b3e62d547fb6e (patch)
tree638d095038ec9b51891dd756b694a2456f2d1d8d /src/mesa/drivers
parent26b5904d7080618718f9ac112bf3d9135366c4e5 (diff)
Don't use the x/y/width/height params passed to Clear(). Get them
after locking. Next: remove the params altogether.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i915/i830_metaops.c14
-rw-r--r--src/mesa/drivers/dri/i915/i915_metaops.c22
-rw-r--r--src/mesa/drivers/dri/i915/intel_batchbuffer.c41
-rw-r--r--src/mesa/drivers/dri/i915/intel_ioctl.c10
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.c25
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffers.c28
6 files changed, 80 insertions, 60 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_metaops.c b/src/mesa/drivers/dri/i915/i830_metaops.c
index 17fde2f480..dbf5f04349 100644
--- a/src/mesa/drivers/dri/i915/i830_metaops.c
+++ b/src/mesa/drivers/dri/i915/i830_metaops.c
@@ -395,13 +395,15 @@ static void draw_poly(i830ContextPtr i830,
void
i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
+ GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
i830ContextPtr i830 = I830_CONTEXT( intel );
__DRIdrawablePrivate *dPriv = intel->driDrawable;
intelScreenPrivate *screen = intel->intelScreen;
int x0, y0, x1, y1;
+ GLint cx, cy, cw, ch;
+ GLboolean all;
INTEL_FIREVERTICES(intel);
SET_STATE( i830, meta );
@@ -411,6 +413,14 @@ i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
LOCK_HARDWARE(intel);
+ /* get clear bounds after locking */
+ cx = intel->ctx.DrawBuffer->_Xmin;
+ cy = intel->ctx.DrawBuffer->_Ymin;
+ cw = intel->ctx.DrawBuffer->_Xmax - cx;
+ ch = intel->ctx.DrawBuffer->_Ymax - cy;
+ all = (cw == intel->ctx.DrawBuffer->Width &&
+ ch == intel->ctx.DrawBuffer->Height);
+
if(!all) {
x0 = cx;
y0 = cy;
diff --git a/src/mesa/drivers/dri/i915/i915_metaops.c b/src/mesa/drivers/dri/i915/i915_metaops.c
index 3ab5dbfd68..1be7ac4c48 100644
--- a/src/mesa/drivers/dri/i915/i915_metaops.c
+++ b/src/mesa/drivers/dri/i915/i915_metaops.c
@@ -493,14 +493,16 @@ static void draw_poly(i915ContextPtr i915,
void
-i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
+i915ClearWithTris(intelContextPtr intel, GLbitfield buffers,
+ GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
i915ContextPtr i915 = I915_CONTEXT( intel );
__DRIdrawablePrivate *dPriv = intel->driDrawable;
intelScreenPrivate *screen = intel->intelScreen;
int x0, y0, x1, y1;
+ GLint cx, cy, cw, ch;
+ GLboolean all;
SET_STATE( i915, meta );
set_initial_state( i915 );
@@ -509,6 +511,14 @@ i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
LOCK_HARDWARE(intel);
+ /* get clear bounds after locking */
+ cx = intel->ctx.DrawBuffer->_Xmin;
+ cy = intel->ctx.DrawBuffer->_Ymin;
+ cw = intel->ctx.DrawBuffer->_Xmax - cx;
+ ch = intel->ctx.DrawBuffer->_Ymax - cy;
+ all = (cw == intel->ctx.DrawBuffer->Width &&
+ ch == intel->ctx.DrawBuffer->Height);
+
if (!all) {
x0 = cx;
y0 = cy;
@@ -525,7 +535,7 @@ i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
* The active cliprects will be applied as for any other geometry.
*/
- if (mask & BUFFER_BIT_FRONT_LEFT) {
+ if (buffers & BUFFER_BIT_FRONT_LEFT) {
set_no_depth_stencil_write( i915 );
set_color_mask( i915, GL_TRUE );
set_draw_region( i915, &screen->front );
@@ -536,7 +546,7 @@ i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
0, 0, 0, 0);
}
- if (mask & BUFFER_BIT_BACK_LEFT) {
+ if (buffers & BUFFER_BIT_BACK_LEFT) {
set_no_depth_stencil_write( i915 );
set_color_mask( i915, GL_TRUE );
set_draw_region( i915, &screen->back );
@@ -547,7 +557,7 @@ i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
0, 0, 0, 0);
}
- if (mask & BUFFER_BIT_STENCIL) {
+ if (buffers & BUFFER_BIT_STENCIL) {
set_stencil_replace( i915,
intel->ctx.Stencil.WriteMask[0],
intel->ctx.Stencil.Clear);
diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.c b/src/mesa/drivers/dri/i915/intel_batchbuffer.c
index 865f15e79f..803b41b256 100644
--- a/src/mesa/drivers/dri/i915/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.c
@@ -621,13 +621,14 @@ void intelEmitCopyBlitLocked( intelContextPtr intel,
-void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
- GLint cx1, GLint cy1, GLint cw, GLint ch)
+void intelClearWithBlit(GLcontext *ctx, GLbitfield buffers, GLboolean allFoo,
+ GLint cx1Foo, GLint cy1Foo, GLint cwFoo, GLint chFoo)
{
intelContextPtr intel = INTEL_CONTEXT( ctx );
intelScreenPrivate *intelScreen = intel->intelScreen;
GLuint clear_depth, clear_color;
- GLint cx, cy;
+ GLint cx, cy, cw, ch;
+ GLboolean all;
GLint pitch;
GLint cpp = intelScreen->cpp;
GLint i;
@@ -637,16 +638,24 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
intelFlush( &intel->ctx );
LOCK_HARDWARE( intel );
+ /* get clear bounds after locking */
+ cx = intel->ctx.DrawBuffer->_Xmin;
+ cy = intel->ctx.DrawBuffer->_Ymin;
+ cw = intel->ctx.DrawBuffer->_Xmax - cx;
+ ch = intel->ctx.DrawBuffer->_Ymax - cy;
+ all = (cw == intel->ctx.DrawBuffer->Width &&
+ ch == intel->ctx.DrawBuffer->Height);
+
pitch = intelScreen->front.pitch;
clear_color = intel->ClearColor;
clear_depth = 0;
- if (flags & BUFFER_BIT_DEPTH) {
+ if (buffers & BUFFER_BIT_DEPTH) {
clear_depth = (GLuint)(ctx->Depth.Clear * intel->ClearDepth);
}
- if (flags & BUFFER_BIT_STENCIL) {
+ if (buffers & BUFFER_BIT_STENCIL) {
clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
}
@@ -661,8 +670,8 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
XY_COLOR_BLT_WRITE_ALPHA |
XY_COLOR_BLT_WRITE_RGB);
D_CMD = XY_COLOR_BLT_CMD;
- if (flags & BUFFER_BIT_DEPTH) D_CMD |= XY_COLOR_BLT_WRITE_RGB;
- if (flags & BUFFER_BIT_STENCIL) D_CMD |= XY_COLOR_BLT_WRITE_ALPHA;
+ if (buffers & BUFFER_BIT_DEPTH) D_CMD |= XY_COLOR_BLT_WRITE_RGB;
+ if (buffers & BUFFER_BIT_STENCIL) D_CMD |= XY_COLOR_BLT_WRITE_ALPHA;
break;
default:
BR13 = (0xF0 << 16) | (pitch) | (1<<24);
@@ -672,17 +681,17 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
{
/* flip top to bottom */
- cy = intel->driDrawable->h-cy1-ch;
- cx = cx1 + intel->drawX;
+ cy = intel->driDrawable->h - cy - ch;
+ cx = cx + intel->drawX;
cy += intel->drawY;
/* adjust for page flipping */
if ( intel->sarea->pf_current_page == 1 ) {
- GLuint tmp = flags;
+ GLuint tmp = buffers;
- flags &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
- if ( tmp & BUFFER_BIT_FRONT_LEFT ) flags |= BUFFER_BIT_BACK_LEFT;
- if ( tmp & BUFFER_BIT_BACK_LEFT ) flags |= BUFFER_BIT_FRONT_LEFT;
+ buffers &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
+ if ( tmp & BUFFER_BIT_FRONT_LEFT ) buffers |= BUFFER_BIT_BACK_LEFT;
+ if ( tmp & BUFFER_BIT_BACK_LEFT ) buffers |= BUFFER_BIT_FRONT_LEFT;
}
for (i = 0 ; i < intel->numClipRects ; i++)
@@ -718,7 +727,7 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
b.y2 > intelScreen->height)
continue;
- if ( flags & BUFFER_BIT_FRONT_LEFT ) {
+ if ( buffers & BUFFER_BIT_FRONT_LEFT ) {
BEGIN_BATCH( 6);
OUT_BATCH( CMD );
OUT_BATCH( BR13 );
@@ -729,7 +738,7 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
ADVANCE_BATCH();
}
- if ( flags & BUFFER_BIT_BACK_LEFT ) {
+ if ( buffers & BUFFER_BIT_BACK_LEFT ) {
BEGIN_BATCH( 6);
OUT_BATCH( CMD );
OUT_BATCH( BR13 );
@@ -740,7 +749,7 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
ADVANCE_BATCH();
}
- if ( flags & (BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH) ) {
+ if ( buffers & (BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH) ) {
BEGIN_BATCH( 6);
OUT_BATCH( D_CMD );
OUT_BATCH( BR13 );
diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c
index d853036766..fa02a17da1 100644
--- a/src/mesa/drivers/dri/i915/intel_ioctl.c
+++ b/src/mesa/drivers/dri/i915/intel_ioctl.c
@@ -375,8 +375,8 @@ void intelFinish( GLcontext *ctx )
}
-void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
+void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
intelContextPtr intel = INTEL_CONTEXT( ctx );
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
@@ -429,13 +429,13 @@ void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
swrast_mask |= (mask & BUFFER_BIT_ACCUM);
if (blit_mask)
- intelClearWithBlit( ctx, blit_mask, all, cx, cy, cw, ch );
+ intelClearWithBlit( ctx, blit_mask, 0, 0, 0, 0, 0);
if (tri_mask)
- intel->vtbl.clear_with_tris( intel, tri_mask, all, cx, cy, cw, ch);
+ intel->vtbl.clear_with_tris( intel, tri_mask, 0, 0, 0, 0, 0);
if (swrast_mask)
- _swrast_Clear( ctx, swrast_mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, swrast_mask, 0, 0, 0, 0, 0);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c
index cbf993fc0e..1781fef569 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.c
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.c
@@ -376,8 +376,8 @@ intelEmitCopyBlit(struct intel_context *intel,
* \param mask bitmask of BUFFER_BIT_* values indicating buffers to clear
*/
void
-intelClearWithBlit(GLcontext * ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
+intelClearWithBlit(GLcontext * ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
struct intel_context *intel = intel_context(ctx);
GLuint clear_depth;
@@ -409,20 +409,15 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask, GLboolean all,
LOCK_HARDWARE(intel);
if (intel->numClipRects) {
+ GLint cx, cy, cw, ch;
drm_clip_rect_t clear;
int i;
- /* Refresh the cx/y/w/h values as they may have been invalidated
- * by a new window position or size picked up when we did
- * LOCK_HARDWARE above. The values passed by mesa are not
- * reliable.
- */
- {
- cx = ctx->DrawBuffer->_Xmin;
- cy = ctx->DrawBuffer->_Ymin;
- ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
- cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
- }
+ /* Get clear bounds after locking */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+ ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
if (intel->ctx.DrawBuffer->Name == 0) {
/* clearing a window */
@@ -458,7 +453,9 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask, GLboolean all,
const drm_clip_rect_t *box = &intel->pClipRects[i];
drm_clip_rect_t b;
GLuint buf;
- GLuint clearMask = mask; /* use copy, since we modify it below */
+ GLuint clearMask = mask; /* use copy, since we modify it below */
+ GLboolean all = (cw == ctx->DrawBuffer->Width &&
+ ch == ctx->DrawBuffer->Height);
if (!all) {
intel_intersect_cliprects(&b, &clear, box);
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c
index fe7ef7ec36..3da1420cdd 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c
@@ -281,7 +281,7 @@ intelWindowMoved(struct intel_context *intel)
static void
intelClearWithTris(struct intel_context *intel,
GLbitfield mask,
- GLboolean all, GLint cx, GLint cy, GLint cw, GLint ch)
+ GLboolean allFoo, GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
GLcontext *ctx = &intel->ctx;
drm_clip_rect_t clear;
@@ -293,22 +293,16 @@ intelClearWithTris(struct intel_context *intel,
/* XXX FBO: was: intel->driDrawable->numClipRects */
if (intel->numClipRects) {
+ GLint cx, cy, cw, ch;
GLuint buf;
intel->vtbl.install_meta_state(intel);
-
- /* Refresh the cx/y/w/h values as they may have been invalidated
- * by a new window position or size picked up when we did
- * LOCK_HARDWARE above. The values passed by mesa are not
- * reliable.
- */
- {
- cx = ctx->DrawBuffer->_Xmin;
- cy = ctx->DrawBuffer->_Ymin;
- ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
- cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
- }
+ /* Get clear bounds after locking */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
/* note: regardless of 'all', cx, cy, cw, ch are now correct */
clear.x1 = cx;
@@ -542,7 +536,7 @@ intelRotateWindow(struct intel_context *intel,
static void
intelClear(GLcontext * ctx,
GLbitfield mask,
- GLboolean all, GLint cx, GLint cy, GLint cw, GLint ch)
+ GLboolean allFoo, GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
struct intel_context *intel = intel_context(ctx);
const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask);
@@ -609,13 +603,13 @@ intelClear(GLcontext * ctx,
intelFlush(ctx); /* XXX intelClearWithBlit also does this */
if (blit_mask)
- intelClearWithBlit(ctx, blit_mask, all, cx, cy, cw, ch);
+ intelClearWithBlit(ctx, blit_mask, 0, 0, 0, 0, 0);
if (tri_mask)
- intelClearWithTris(intel, tri_mask, all, cx, cy, cw, ch);
+ intelClearWithTris(intel, tri_mask, 0, 0, 0, 0, 0);
if (swrast_mask)
- _swrast_Clear(ctx, swrast_mask, all, cx, cy, cw, ch);
+ _swrast_Clear(ctx, swrast_mask, 0, 0, 0, 0, 0);
}