summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@tungstengraphics.com>2007-07-10 19:56:44 +0200
committerRoland Scheidegger <sroland@tungstengraphics.com>2007-07-10 19:56:44 +0200
commit1278514ff48b262ee0a4f2ac698c6df648b326a0 (patch)
tree758210acaaf69c196c8fb11794c3c9f942e5df60
parentd348a48ac353d7c646a0c4f976f23a764990e779 (diff)
copybuffer/cliprect fixups
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.c6
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffers.c40
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.h1
3 files changed, 44 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c
index 5dcb0ddebb..b4fc1691e6 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.c
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.c
@@ -115,6 +115,7 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
for (i = 0; i < nbox; i++, pbox++) {
drm_clip_rect_t box;
+ drm_clip_rect_t sbox;
if (pbox->x1 > pbox->x2 ||
pbox->y1 > pbox->y2 ||
@@ -137,6 +138,9 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
continue;
}
+ sbox.x1 = box.x1 - dPriv->x;
+ sbox.y1 = box.y1 - dPriv->y;
+
BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
OUT_BATCH(CMD);
OUT_BATCH(BR13);
@@ -145,7 +149,7 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
- OUT_BATCH((pbox->y1 << 16) | pbox->x1);
+ OUT_BATCH((sbox.y1 << 16) | sbox.x1);
OUT_BATCH((srcpitch * cpp) & 0xffff);
OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c
index 62ff54b007..e8dd7cd524 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c
@@ -146,6 +146,27 @@ intelSetRenderbufferClipRects(struct intel_context *intel)
intel->drawY = 0;
}
+/**
+ * As above, but for rendering private front/back buffer of a window.
+ * \sa intelSetPrivbufClipRects
+ */
+
+static void
+intelSetPrivbufClipRects(struct intel_context *intel)
+{
+ __DRIdrawablePrivate *dPriv = intel->driDrawable;
+ if (!dPriv)
+ return;
+
+ intel->fakeClipRect.x1 = 0;
+ intel->fakeClipRect.y1 = 0;
+ intel->fakeClipRect.x2 = dPriv->w;
+ intel->fakeClipRect.y2 = dPriv->h;
+ intel->pClipRects = &intel->fakeClipRect;
+ intel->numClipRects = 1;
+ intel->drawX = 0;
+ intel->drawY = 0;
+}
/**
* As above, but for rendering to front buffer of a window.
@@ -212,7 +233,7 @@ intelWindowMoved(struct intel_context *intel)
/* when would this happen? -BP */
intelSetFrontClipRects(intel);
}
- else if (intel->ctx.DrawBuffer->Name != 0) {
+ else if (1 || intel->ctx.DrawBuffer->Name != 0) {
/* drawing to user-created FBO - do nothing */
/* Cliprects would be set from intelDrawBuffer() */
}
@@ -953,10 +974,17 @@ intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
if (ctx->Visual.doubleBufferMode) {
drm_clip_rect_t rect;
+#if 1
rect.x1 = x + dPriv->x;
rect.y1 = (dPriv->h - y - h) + dPriv->y;
rect.x2 = rect.x1 + w;
rect.y2 = rect.y1 + h;
+#else
+ rect.x1 = x;
+ rect.y1 = dPriv->h - y;
+ rect.x2 = rect.x1 + w;
+ rect.y2 = rect.y1 + h;
+#endif
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
intelCopyBuffer(dPriv, &rect);
}
@@ -991,7 +1019,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
return;
}
- /* Do this here, note core Mesa, since this function is called from
+ /* Do this here, not core Mesa, since this function is called from
* many places within the driver.
*/
if (ctx->NewState & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) {
@@ -1042,11 +1070,19 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
if (fb->Name == 0) {
/* drawing to window system buffer */
if (front) {
+#if 0
intelSetFrontClipRects(intel);
+#else
+ intelSetPrivbufClipRects(intel);
+#endif
colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
}
else {
+#if 0
intelSetBackClipRects(intel);
+#else
+ intelSetPrivbufClipRects(intel);
+#endif
colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
}
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h
index 7a9af1b5fd..d05b20abbd 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.h
+++ b/src/mesa/drivers/dri/i915tex/intel_context.h
@@ -254,6 +254,7 @@ struct intel_context
GLuint numClipRects; /**< cliprects for drawing */
drm_clip_rect_t *pClipRects;
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
+ drm_clip_rect_t fakeClipRect; /**< cliprect for priv back/fake front buffers rendering */
int perf_boxes;