summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_clear.c45
-rw-r--r--src/mesa/drivers/dri/i810/i810ioctl.c18
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_ioctl.c21
-rw-r--r--src/mesa/drivers/dri/mga/mgaioctl.c17
-rw-r--r--src/mesa/drivers/dri/r128/r128_ioctl.c21
-rw-r--r--src/mesa/drivers/dri/r200/r200_ioctl.c24
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c9
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_ioctl.c20
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_state.c14
-rw-r--r--src/mesa/drivers/dri/savage/savageioctl.c14
-rw-r--r--src/mesa/drivers/dri/sis/sis6326_clear.c26
-rw-r--r--src/mesa/drivers/dri/sis/sis_clear.c30
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_render.c9
-rw-r--r--src/mesa/drivers/dri/trident/trident_state.c11
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c11
15 files changed, 168 insertions, 122 deletions
diff --git a/src/mesa/drivers/dri/ffb/ffb_clear.c b/src/mesa/drivers/dri/ffb/ffb_clear.c
index c63179149a..9cd5a12b7d 100644
--- a/src/mesa/drivers/dri/ffb/ffb_clear.c
+++ b/src/mesa/drivers/dri/ffb/ffb_clear.c
@@ -123,16 +123,22 @@ CreatorComputePageFillFixups(struct ff_fixups *fixups,
}
static void
-ffb_do_clear(ffbContextPtr fmesa, __DRIdrawablePrivate *dPriv,
- GLboolean all, GLint cx, GLint cy, GLint cwidth,
- GLint cheight)
+ffb_do_clear(GLcontext *ctx, __DRIdrawablePrivate *dPriv)
{
+ ffbContextPtr fmesa = FFB_CONTEXT(ctx);
FFBDRIPtr gDRIPriv = (FFBDRIPtr) fmesa->driScreen->pDevPriv;
ffb_fbcPtr ffb = fmesa->regs;
drm_clip_rect_t *box = dPriv->pClipRects;
int nc = dPriv->numClipRects;
+ GLint cx, cy, cw, ch;
+
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
- cy = dPriv->h - cy - cheight;
+ cy = dPriv->h - cy - ch;
cx += dPriv->x;
cy += dPriv->y;
@@ -145,25 +151,6 @@ ffb_do_clear(ffbContextPtr fmesa, __DRIdrawablePrivate *dPriv,
int paligned_h, paligned_w = 0;
int extra_work;
- if (!all) {
- if (x < cx) {
- width -= cx - x;
- x = cx;
- }
- if (y < cy) {
- height -= cy - y;
- y = cy;
- }
- if (x + width > cx + cwidth)
- width = cx + cwidth - x;
- if (y + height > cy + cheight)
- height = cy + cheight - y;
- if (width <= 0)
- continue;
- if (height <= 0)
- continue;
- }
-
if (BOX_AREA(width, height) < gDRIPriv->fastfill_small_area) {
FFBFifo(fmesa, 5);
ffb->drawop = FFB_DRAWOP_RECTANGLE;
@@ -262,17 +249,15 @@ ffb_do_clear(ffbContextPtr fmesa, __DRIdrawablePrivate *dPriv,
}
}
-void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cwidth, GLint cheight)
+void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwidthFoo, GLint cheightFoo)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
unsigned int stcmask = BUFFER_BIT_STENCIL;
#ifdef CLEAR_TRACE
- fprintf(stderr, "ffbDDClear: mask(%08x) all(%d) "
- "[x(%x)y(%x)w(%x)h(%x)]\n",
- mask, (int) all, cx, cy, cwidth, cheight);
+ fprintf(stderr, "ffbDDClear: mask(%08x) \n", mask);
#endif
if (!(fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS))
stcmask = 0;
@@ -328,7 +313,7 @@ void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
if (mask & stcmask)
ffb->consty = fmesa->clear_stencil;
- ffb_do_clear(fmesa, dPriv, all, cx, cy, cwidth, cheight);
+ ffb_do_clear(ctx, dPriv);
FFBFifo(fmesa, 6);
ffb->ppc = fmesa->ppc;
@@ -349,6 +334,6 @@ void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if (mask)
- _swrast_Clear(ctx, mask, all, cx, cy, cwidth, cheight);
+ _swrast_Clear(ctx, mask, 0, 0, 0, 0, 0);
}
diff --git a/src/mesa/drivers/dri/i810/i810ioctl.c b/src/mesa/drivers/dri/i810/i810ioctl.c
index ba651555a6..9e52d80a8b 100644
--- a/src/mesa/drivers/dri/i810/i810ioctl.c
+++ b/src/mesa/drivers/dri/i810/i810ioctl.c
@@ -48,8 +48,8 @@ static drmBufPtr i810_get_buffer_ioctl( i810ContextPtr imesa )
#define DEPTH_SCALE ((1<<16)-1)
-static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
@@ -80,8 +80,16 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if (clear.flags) {
+ GLint cx, cy, cw, ch;
+
LOCK_HARDWARE( imesa );
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
/* flip top to bottom */
cy = dPriv->h-cy-ch;
cx += imesa->drawX;
@@ -94,7 +102,8 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
int n = 0;
- if (!all) {
+ if (cw != dPriv->w || ch != dPriv->h) {
+ /* clear sub region */
for ( ; i < nr ; i++) {
GLint x = box[i].x1;
GLint y = box[i].y1;
@@ -116,6 +125,7 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
n++;
}
} else {
+ /* clear whole buffer */
for ( ; i < nr ; i++) {
*b++ = box[i];
n++;
@@ -132,7 +142,7 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/src/mesa/drivers/dri/mach64/mach64_ioctl.c
index 109da1b582..30a45ad034 100644
--- a/src/mesa/drivers/dri/mach64/mach64_ioctl.c
+++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.c
@@ -665,8 +665,8 @@ void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa )
* Buffer clear
*/
-static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
@@ -674,10 +674,10 @@ static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLuint flags = 0;
GLint i;
GLint ret;
+ GLint cx, cy, cw, ch;
if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s: all=%d %d,%d %dx%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
+ fprintf( stderr, "mach64DDClear\n");
}
#if ENABLE_PERF_BOXES
@@ -713,14 +713,19 @@ static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
if ( !flags )
return;
LOCK_HARDWARE( mmesa );
- /* This needs to be in the locked region, so updated drawable origin is used */
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
/* Flip top to bottom */
cx += mmesa->drawX;
cy = mmesa->drawY + dPriv->h - cy - ch;
@@ -737,7 +742,8 @@ static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_clip_rect_t *b = mmesa->sarea->boxes;
GLint n = 0;
- if ( !all ) {
+ if (cw != dPriv->w || ch != dPriv->h) {
+ /* clear subregion */
for ( ; i < nr ; i++ ) {
GLint x = box[i].x1;
GLint y = box[i].y1;
@@ -759,6 +765,7 @@ static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
n++;
}
} else {
+ /* clear whole window */
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c
index 6e653f8c73..c9fa9d1294 100644
--- a/src/mesa/drivers/dri/mga/mgaioctl.c
+++ b/src/mesa/drivers/dri/mga/mgaioctl.c
@@ -204,8 +204,8 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa )
static void
-mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = mmesa->driDrawable;
@@ -218,6 +218,7 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
int i;
static int nrclears;
drm_mga_clear_t clear;
+ GLint cx, cy, cw, ch;
FLUSH_BATCH( mmesa );
@@ -250,6 +251,12 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if ( flags ) {
LOCK_HARDWARE( mmesa );
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
if ( mmesa->dirty_cliprects )
mgaUpdateRects( mmesa, (MGA_FRONT | MGA_BACK) );
@@ -269,7 +276,8 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_clip_rect_t *b = mmesa->sarea->boxes;
int n = 0;
- if (!all) {
+ if (cw != dPriv->w || ch != dPriv->h) {
+ /* clear subregion */
for ( ; i < nr ; i++) {
GLint x = box[i].x1;
GLint y = box[i].y1;
@@ -291,6 +299,7 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
n++;
}
} else {
+ /* clear whole window */
for ( ; i < nr ; i++) {
*b++ = box[i];
n++;
@@ -325,7 +334,7 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
}
diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c
index 3b34d9fbb2..7dbb5e5dda 100644
--- a/src/mesa/drivers/dri/r128/r128_ioctl.c
+++ b/src/mesa/drivers/dri/r128/r128_ioctl.c
@@ -399,8 +399,8 @@ void r128PageFlip( const __DRIdrawablePrivate *dPriv )
* Buffer clear
*/
-static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->driDrawable;
@@ -409,6 +409,7 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint i;
GLint ret;
GLuint depthmask = 0;
+ GLint cx, cy, cw, ch;
if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
fprintf( stderr, "%s:\n", __FUNCTION__ );
@@ -453,12 +454,18 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if ( flags ) {
+ LOCK_HARDWARE( rmesa );
+
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
/* Flip top to bottom */
cx += dPriv->x;
cy = dPriv->y + dPriv->h - cy - ch;
- LOCK_HARDWARE( rmesa );
-
/* FIXME: Do we actually need this?
*/
if ( rmesa->dirty & ~R128_UPLOAD_CLIPRECTS ) {
@@ -471,7 +478,8 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_clip_rect_t *b = rmesa->sarea->boxes;
GLint n = 0;
- if ( !all ) {
+ if (cw != dPriv->w || ch != dPriv->h) {
+ /* clear subregion */
for ( ; i < nr ; i++ ) {
GLint x = box[i].x1;
GLint y = box[i].y1;
@@ -493,6 +501,7 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
n++;
}
} else {
+ /* clear whole window */
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
@@ -532,7 +541,7 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
}
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c
index 650d7cfdf2..efa0b64ed2 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.c
@@ -605,18 +605,18 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv )
/* ================================================================
* Buffer clear
*/
-static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
GLuint flags = 0;
GLuint color_mask = 0;
GLint ret, i;
+ GLint cx, cy, cw, ch;
if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
+ fprintf( stderr, "r200Clear\n");
}
{
@@ -653,7 +653,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if ( mask ) {
if (R200_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
}
if ( !flags )
@@ -670,12 +670,18 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
}
+ LOCK_HARDWARE( rmesa );
+
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
/* Flip top to bottom */
cx += dPriv->x;
cy = dPriv->y + dPriv->h - cy - ch;
- LOCK_HARDWARE( rmesa );
-
/* Throttle the number of clear ioctls we do.
*/
while ( 1 ) {
@@ -717,7 +723,8 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
GLint n = 0;
- if ( !all ) {
+ if (cw != dPriv->w || ch != dPriv->h) {
+ /* clear subregion */
for ( ; i < nr ; i++ ) {
GLint x = box[i].x1;
GLint y = box[i].y1;
@@ -739,6 +746,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
n++;
}
} else {
+ /* clear whole window */
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
index d0d2def864..7775ca96e4 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -477,8 +477,8 @@ static void r300EmitClearState(GLcontext * ctx)
/**
* Buffer clear
*/
-static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
+static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
@@ -487,8 +487,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
int swapped;
if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch);
+ fprintf(stderr, "r300Clear\n");
{
LOCK_HARDWARE(&r300->radeon);
@@ -521,7 +520,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
if (RADEON_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "%s: swrast clear, mask: %x\n",
__FUNCTION__, mask);
- _swrast_Clear(ctx, mask, all, cx, cy, cw, ch);
+ _swrast_Clear(ctx, mask, 0, 0, 0, 0, 0);
}
swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1);
diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
index aee849e13b..d9eec622f3 100644
--- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
@@ -1021,8 +1021,8 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
*/
#define RADEON_MAX_CLEARS 256
-static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
@@ -1031,10 +1031,10 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLuint flags = 0;
GLuint color_mask = 0;
GLint ret, i;
+ GLint cx, cy, cw, ch;
if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
+ fprintf( stderr, "radeonClear\n");
}
{
@@ -1071,7 +1071,7 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if ( mask ) {
if (RADEON_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
}
if ( !flags )
@@ -1094,6 +1094,12 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
LOCK_HARDWARE( rmesa );
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
/* Throttle the number of clear ioctls we do.
*/
while ( 1 ) {
@@ -1132,7 +1138,8 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
GLint n = 0;
- if ( !all ) {
+ if (cw != dPriv->w || ch != dPriv->h) {
+ /* clear subregion */
for ( ; i < nr ; i++ ) {
GLint x = box[i].x1;
GLint y = box[i].y1;
@@ -1154,6 +1161,7 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
n++;
}
} else {
+ /* clear whole buffer */
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
diff --git a/src/mesa/drivers/dri/s3v/s3v_state.c b/src/mesa/drivers/dri/s3v/s3v_state.c
index e692f20e8a..4f412edf09 100644
--- a/src/mesa/drivers/dri/s3v/s3v_state.c
+++ b/src/mesa/drivers/dri/s3v/s3v_state.c
@@ -73,11 +73,17 @@ static void s3vDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
* Buffer clear
*/
-static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
unsigned int _stride;
+ GLint cx = ctx->DrawBuffer->_Xmin;
+ GLint cy = ctx->DrawBuffer->_Ymin;
+ GLint cw = ctx->DrawBuffer->_Xmax - cx;
+ GLint ch = ctx->DrawBuffer->_Ymax - cy;
+
+ /* XXX FIX ME: the cx,cy,cw,ch vars are currently ignored! */
vmesa->restore_primitive = -1;
@@ -120,7 +126,7 @@ static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if (mask & BUFFER_BIT_DEPTH) { /* depth */
DEBUG(("BUFFER_BIT_DEPTH\n"));
- _stride = ((cw+31)&~31) * 2;
+ _stride = ((cw+31)&~31) * 2; /* XXX cw or Buffer->Width??? */
DMAOUT_CHECK(BITBLT_SRC_BASE, 15);
DMAOUT(0);
@@ -157,7 +163,7 @@ static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if ( mask )
DEBUG(("still masked ;3(\n")); */ /* yes */
#else
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
#endif
}
diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c
index 244959d64f..7513a07e85 100644
--- a/src/mesa/drivers/dri/savage/savageioctl.c
+++ b/src/mesa/drivers/dri/savage/savageioctl.c
@@ -327,11 +327,17 @@ static GLuint savageIntersectClipRects(drm_clip_rect_t *dest,
}
-static void savageDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void savageDDClear( GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo )
{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
+ savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
GLuint colorMask, depthMask, clearColor, clearDepth, flags;
+ GLint cx = ctx->DrawBuffer->_Xmin;
+ GLint cy = ctx->DrawBuffer->_Ymin;
+ GLint cw = ctx->DrawBuffer->_Xmax - cx;
+ GLint ch = ctx->DrawBuffer->_Ymax - cy;
+
+ /* XXX FIX ME: the cx,cy,cw,ch vars are currently ignored! */
if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
fprintf (stderr, "%s\n", __FUNCTION__);
@@ -420,7 +426,7 @@ static void savageDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0 );
}
/*
diff --git a/src/mesa/drivers/dri/sis/sis6326_clear.c b/src/mesa/drivers/dri/sis/sis6326_clear.c
index be5addb7cf..d8f39b31c7 100644
--- a/src/mesa/drivers/dri/sis/sis6326_clear.c
+++ b/src/mesa/drivers/dri/sis/sis6326_clear.c
@@ -69,25 +69,19 @@ sis6326UpdateZPattern(sisContextPtr smesa, GLclampd z)
}
void
-sis6326DDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height)
+sis6326DDClear(GLcontext *ctx, GLbitfield mask, GLboolean allFoo,
+ GLint xFoo, GLint yFoo, GLint widthFoo, GLint heightFoo)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLint x1, y1, width1, height1;
- if (all) {
- GLframebuffer *buffer = ctx->DrawBuffer;
-
- x1 = 0;
- y1 = 0;
- width1 = buffer->Width;
- height1 = buffer->Height;
- } else {
- x1 = x;
- y1 = Y_FLIP(y+height-1);
- width1 = width;
- height1 = height;
- }
+ /* get region after locking: */
+ x1 = ctx->DrawBuffer->_Xmin;
+ y1 = ctx->DrawBuffer->_Ymin;
+ width1 = ctx->DrawBuffer->_Xmax - x1;
+ height1 = ctx->DrawBuffer->_Ymax - y1;
+ y1 = Y_FLIP(y1 + height1 - 1);
+
/* XXX: Scissoring */
fprintf(stderr, "Clear\n");
@@ -116,7 +110,7 @@ sis6326DDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
UNLOCK_HARDWARE();
if (mask != 0)
- _swrast_Clear(ctx, mask, all, x1, y1, width, height);
+ _swrast_Clear(ctx, mask, 0, 0, 0, 0, 0);
}
diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c
index 637d502381..64b6870871 100644
--- a/src/mesa/drivers/dri/sis/sis_clear.c
+++ b/src/mesa/drivers/dri/sis/sis_clear.c
@@ -95,27 +95,19 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil )
}
void
-sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
+sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean allFoo,
+ GLint xFoo, GLint yFoo, GLint widthFoo, GLint heightFoo )
{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- GLint x1, y1, width1, height1;
+ sisContextPtr smesa = SIS_CONTEXT(ctx);
- if (all) {
- GLframebuffer *buffer = ctx->DrawBuffer;
+ GLint x1, y1, width1, height1;
- x1 = 0;
- y1 = 0;
- width1 = buffer->Width;
- height1 = buffer->Height;
- } else {
- x1 = x;
- y1 = Y_FLIP(y+height-1);
- width1 = width;
- height1 = height;
- }
- /* XXX: Scissoring */
+ /* get region after locking: */
+ x1 = ctx->DrawBuffer->_Xmin;
+ y1 = ctx->DrawBuffer->_Ymin;
+ width1 = ctx->DrawBuffer->_Xmax - x1;
+ height1 = ctx->DrawBuffer->_Ymax - y1;
+ y1 = Y_FLIP(y1 + height1 - 1);
/* Mask out any non-existent buffers */
if (ctx->Visual.depthBits == 0 || !ctx->Depth.Mask)
@@ -153,7 +145,7 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all,
UNLOCK_HARDWARE();
if (mask != 0)
- _swrast_Clear( ctx, mask, all, x1, y1, width, height );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0);
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_render.c b/src/mesa/drivers/dri/tdfx/tdfx_render.c
index a30ec78a55..3301d948e1 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_render.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_render.c
@@ -47,8 +47,8 @@
/* Clear the color and/or depth buffers.
*/
static void tdfxClear( GLcontext *ctx,
- GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
+ GLbitfield mask, GLboolean all,
+ GLint xFoo, GLint yFoo, GLint widthFoo, GLint heightFoo)
{
tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
GLbitfield softwareMask = mask & (BUFFER_BIT_ACCUM);
@@ -56,8 +56,7 @@ static void tdfxClear( GLcontext *ctx,
fxMesa->haveHwStencil ? fxMesa->glCtx->Visual.stencilBits : 0;
if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %d, %d, %d, %d )\n",
- __FUNCTION__, (int) x, (int) y, (int) width, (int) height );
+ fprintf( stderr, "tdfxClear(0x%x)\n", mask);
}
/* Need this check to respond to glScissor and clipping updates */
@@ -313,7 +312,7 @@ static void tdfxClear( GLcontext *ctx,
}
if (softwareMask)
- _swrast_Clear( ctx, softwareMask, all, x, y, width, height );
+ _swrast_Clear( ctx, softwareMask, 0, 0, 0, 0, 0);
}
diff --git a/src/mesa/drivers/dri/trident/trident_state.c b/src/mesa/drivers/dri/trident/trident_state.c
index 3f9ad79732..a9be50688b 100644
--- a/src/mesa/drivers/dri/trident/trident_state.c
+++ b/src/mesa/drivers/dri/trident/trident_state.c
@@ -151,13 +151,14 @@ void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv )
static void tridentDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
int busy;
GLuint flags = 0;
GLint i;
+ GLint cx, cy, cw, ch;
#define DRM_TRIDENT_FRONT 0x01
#define DRM_TRIDENT_BACK 0x02
@@ -183,6 +184,12 @@ static void tridentDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
LOCK_HARDWARE(tmesa);
+ /* get region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
if ( flags ) {
cx += tmesa->drawX;
@@ -290,7 +297,7 @@ if (flags & DRM_TRIDENT_FRONT) {
UNLOCK_HARDWARE(tmesa);
if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
+ _swrast_Clear( ctx, mask, 0, 0, 0, 0, 0);
}
static void tridentDDShadeModel( GLcontext *ctx, GLenum mode )
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index c8c6dc0193..86077bc4d4 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -203,7 +203,7 @@ static void viaFillBuffer(struct via_context *vmesa,
static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
+ GLint cxFoo, GLint cyFoo, GLint cwFoo, GLint chFoo)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
@@ -261,9 +261,16 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
if (flag) {
drm_clip_rect_t *boxes, *tmp_boxes = 0;
int nr = 0;
+ GLint cx, cy, cw, ch;
LOCK_HARDWARE(vmesa);
+ /* get region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
/* flip top to bottom */
cy = dPriv->h - cy - ch;
cx += vmesa->drawX + vmesa->drawXoff;
@@ -328,7 +335,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if (mask)
- _swrast_Clear(ctx, mask, all, cx, cy, cw, ch);
+ _swrast_Clear(ctx, mask, 0, 0, 0, 0, 0);
}