summaryrefslogtreecommitdiff
path: root/xc/lib/GL/mesa/src/drv/r128/r128_swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/r128/r128_swap.c')
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_swap.c55
1 files changed, 39 insertions, 16 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_swap.c b/xc/lib/GL/mesa/src/drv/r128/r128_swap.c
index 2f561a74d..27150d510 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_swap.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_swap.c
@@ -39,12 +39,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_lock.h"
#include "r128_reg.h"
#include "r128_cce.h"
+#include "r128_vb.h"
#include "r128_swap.h"
+/* Copy the back color buffer to the front color buffer */
void r128SwapBuffers(r128ContextPtr r128ctx)
{
- unsigned char *R128MMIO = r128ctx->r128Screen->mmio;
- int dst_bpp;
+ unsigned char *R128MMIO = r128ctx->r128Screen->mmio;
+ __DRIdrawablePrivate *dPriv = r128ctx->driDrawable;
+ int nc = dPriv->numClipRects;
+ XF86DRIClipRectPtr c = dPriv->pClipRects;
+ int dst_bpp;
switch (r128ctx->r128Screen->bpp) {
case 8:
@@ -63,21 +68,39 @@ void r128SwapBuffers(r128ContextPtr r128ctx)
break;
}
- R128CCE_BEGIN(5);
+ /* Flush any outstanding vertex buffers */
+ R128_FLUSH_VB(r128ctx);
- R128CCE3(R128_CCE_PACKET3_CNTL_BITBLT_MULTI, 3);
- R128CCE(R128_GMC_BRUSH_NONE
- | R128_GMC_SRC_DATATYPE_COLOR
- | R128_DP_SRC_SOURCE_MEMORY
- | dst_bpp
- | R128_ROP3_S);
- R128CCE(((r128ctx->driDrawable->x + r128ctx->r128Screen->backX)<< 16)
- | (r128ctx->driDrawable->y + r128ctx->r128Screen->backY));
- R128CCE((r128ctx->driDrawable->x << 16) | r128ctx->driDrawable->y);
- R128CCE((r128ctx->driDrawable->w << 16) | r128ctx->driDrawable->h);
+ LOCK_HARDWARE(r128ctx);
- r128ctx->dirty = R128_UPDATE_CONTEXT;
- /* r128UpdateState(r128ctx); */
+ /* Cycle through the clip rects */
+ while (nc--) {
+ int fx = c[nc].x1;
+ int fy = c[nc].y1;
+ int fw = c[nc].x2 - fx;
+ int fh = c[nc].y2 - fy;
+ int bx = fx + r128ctx->r128Screen->backX;
+ int by = fy + r128ctx->r128Screen->backY;
- R128CCE_END();
+ fx += r128ctx->r128Screen->fbX;
+ fy += r128ctx->r128Screen->fbY;
+
+ R128CCE_WAIT_LOCKED(5);
+ R128CCE3(R128_CCE_PACKET3_CNTL_BITBLT_MULTI, 3);
+ R128CCE(R128_GMC_BRUSH_NONE
+ | R128_GMC_SRC_DATATYPE_COLOR
+ | R128_DP_SRC_SOURCE_MEMORY
+ | dst_bpp
+ | R128_ROP3_S);
+ R128CCE((bx << 16) | by);
+ R128CCE((fx << 16) | fy);
+ R128CCE((fw << 16) | fh);
+ }
+
+ r128ctx->dirty |= R128_UPDATE_CONTEXT;
+ r128ctx->dirty_context |= R128_CTX_ALL_DIRTY;
+
+ R128CCE_END_LOCKED();
+
+ UNLOCK_HARDWARE(r128ctx);
}