X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi810%2Fi810ioctl.c;h=4b004d54c6548bf93853a437daddb6d2eac46364;hb=cd6a31cd4a9ea6deef4778c2eaef2d47240c3a6e;hp=3d1be4c902f57979fefb8901198db43f8e141add;hpb=ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0;p=mesa.git diff --git a/src/mesa/drivers/dri/i810/i810ioctl.c b/src/mesa/drivers/dri/i810/i810ioctl.c index 3d1be4c902f..4b004d54c65 100644 --- a/src/mesa/drivers/dri/i810/i810ioctl.c +++ b/src/mesa/drivers/dri/i810/i810ioctl.c @@ -1,18 +1,17 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.c,v 1.7 2002/10/30 12:51:33 alanh Exp $ */ #include /* for usleep() */ -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" #include "swrast/swrast.h" -#include "mm.h" +#include "main/mm.h" #include "i810screen.h" #include "i810_dri.h" -#include "i810context.h" +#include "main/context.h" #include "i810ioctl.h" #include "i810state.h" @@ -48,14 +47,13 @@ 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( struct gl_context *ctx, GLbitfield mask ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); - __DRIdrawablePrivate *dPriv = imesa->driDrawable; - const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); + __DRIdrawable *dPriv = imesa->driDrawable; + const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask[0]); drmI810Clear clear; - int i; + unsigned int i; clear.flags = 0; clear.clear_color = imesa->ClearColor; @@ -63,25 +61,33 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, I810_FIREVERTICES( imesa ); - if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0) { + if ((mask & BUFFER_BIT_FRONT_LEFT) && colorMask == ~0U) { clear.flags |= I810_FRONT; - mask &= ~DD_FRONT_LEFT_BIT; + mask &= ~BUFFER_BIT_FRONT_LEFT; } - if ((mask & DD_BACK_LEFT_BIT) && colorMask == ~0) { + if ((mask & BUFFER_BIT_BACK_LEFT) && colorMask == ~0U) { clear.flags |= I810_BACK; - mask &= ~DD_BACK_LEFT_BIT; + mask &= ~BUFFER_BIT_BACK_LEFT; } - if (mask & DD_DEPTH_BIT) { + if (mask & BUFFER_BIT_DEPTH) { if (ctx->Depth.Mask) clear.flags |= I810_DEPTH; - mask &= ~DD_DEPTH_BIT; + mask &= ~BUFFER_BIT_DEPTH; } 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; @@ -89,12 +95,13 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, for (i = 0 ; i < imesa->numClipRects ; ) { - int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, imesa->numClipRects); + unsigned int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, imesa->numClipRects); drm_clip_rect_t *box = imesa->pClipRects; - drm_clip_rect_t *b = imesa->sarea->boxes; + 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 +123,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 +140,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 ); } @@ -141,7 +149,7 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, /* * Copy the back buffer to the front buffer. */ -void i810CopyBuffer( const __DRIdrawablePrivate *dPriv ) +void i810CopyBuffer( const __DRIdrawable *dPriv ) { i810ContextPtr imesa; drm_clip_rect_t *pbox; @@ -156,13 +164,13 @@ void i810CopyBuffer( const __DRIdrawablePrivate *dPriv ) I810_FIREVERTICES( imesa ); LOCK_HARDWARE( imesa ); - pbox = dPriv->pClipRects; + pbox = (drm_clip_rect_t *)dPriv->pClipRects; nbox = dPriv->numClipRects; for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, dPriv->numClipRects); - drm_clip_rect_t *b = imesa->sarea->boxes; + drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes; imesa->sarea->nbox = nr - i; @@ -189,7 +197,7 @@ void i810CopyBuffer( const __DRIdrawablePrivate *dPriv ) /* * XXX implement when full-screen extension is done. */ -void i810PageFlip( const __DRIdrawablePrivate *dPriv ) +void i810PageFlip( const __DRIdrawable *dPriv ) { i810ContextPtr imesa; int tmp, ret; @@ -204,8 +212,9 @@ void i810PageFlip( const __DRIdrawablePrivate *dPriv ) LOCK_HARDWARE( imesa ); if (dPriv->pClipRects) { - *imesa->sarea->boxes = dPriv->pClipRects[0]; - imesa->sarea->nbox = 1; + memcpy(&(imesa->sarea->boxes[0]), &(dPriv->pClipRects[0]), + sizeof(drm_clip_rect_t)); + imesa->sarea->nbox = 1; } ret = drmCommandNone(imesa->driFd, DRM_I810_FLIP); if (ret) { @@ -224,7 +233,7 @@ void i810PageFlip( const __DRIdrawablePrivate *dPriv ) } /* i810SetDrawBuffer( imesa->glCtx, imesa->glCtx->Color.DriverDrawBuffer );*/ - i810DrawBuffer( imesa->glCtx, imesa->glCtx->Color.DrawBuffer ); + i810DrawBuffer( imesa->glCtx, imesa->glCtx->Color.DrawBuffer[0] ); imesa->upload_cliprects = GL_TRUE; imesa->lastSwap = tmp; return; @@ -403,7 +412,7 @@ void i810FlushPrimsLocked( i810ContextPtr imesa ) for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, nbox); - drm_clip_rect_t *b = sarea->boxes; + drm_clip_rect_t *b = (drm_clip_rect_t *)sarea->boxes; if (imesa->scissor) { sarea->nbox = 0; @@ -490,13 +499,13 @@ int i810_check_copy(int fd) return(drmCommandNone(fd, DRM_I810_DOCOPY)); } -static void i810Flush( GLcontext *ctx ) +static void i810Flush( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); I810_FIREVERTICES( imesa ); } -static void i810Finish( GLcontext *ctx ) +static void i810Finish( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); i810DmaFinish( imesa );