diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2007-11-09 18:46:55 +0100 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2007-11-26 16:59:41 +0100 |
commit | 0967e1270d3b3bc0917fb841314ebb8d04766746 (patch) | |
tree | fd27ab019a352292c07638c8935b63593f6cf045 /src | |
parent | a08c02f1a85823d7116758c3c0996776932fc530 (diff) |
i915tex: Some additional blit fixes and assertions.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_blit.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c index a0601515c16..eef94c7fcc4 100644 --- a/src/mesa/drivers/dri/i915tex/intel_blit.c +++ b/src/mesa/drivers/dri/i915tex/intel_blit.c @@ -112,8 +112,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, for (i = 0; i < nbox; i++, pbox++) { drm_clip_rect_t box; - if (pbox->x1 > pbox->x2 || - pbox->y1 > pbox->y2 || + if (pbox->x1 >= pbox->x2 || + pbox->y1 >= pbox->y2 || pbox->x2 > intelScreen->width || pbox->y2 > intelScreen->height) continue; @@ -129,19 +129,22 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, if (rect->y2 < box.y2) box.y2 = rect->y2; - if (box.x1 > box.x2 || box.y1 > box.y2) + if (box.x1 >= box.x2 || box.y1 >= box.y2) continue; } + assert(box.x1 < box.x2); + assert(box.y1 < box.y2); + BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); - OUT_BATCH((pbox->y1 << 16) | pbox->x1); - OUT_BATCH((pbox->y2 << 16) | pbox->x2); + OUT_BATCH((box.y1 << 16) | box.x1); + OUT_BATCH((box.y2 << 16) | box.x2); 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((box.y1 << 16) | box.x1); OUT_BATCH(BR13 & 0xffff); OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0); @@ -152,7 +155,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, if (intel->first_swap_fence) driFenceUnReference(intel->first_swap_fence); intel->first_swap_fence = intel_batchbuffer_flush(intel->batch); - driFenceReference(intel->first_swap_fence); + if (intel->first_swap_fence) + driFenceReference(intel->first_swap_fence); } UNLOCK_HARDWARE(intel); @@ -193,6 +197,8 @@ intelEmitFillBlit(struct intel_context *intel, DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h); + assert(w > 0); + assert(h > 0); BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); @@ -280,10 +286,11 @@ intelEmitCopyBlit(struct intel_context *intel, return; } - if (dst_y2 < dst_y || dst_x2 < dst_x) { + if (dst_y2 <= dst_y || dst_x2 <= dst_x) { return; } + /* Initial y values don't seem to work with negative pitches. If * we adjust the offsets manually (below), it seems to work fine. * @@ -292,6 +299,9 @@ intelEmitCopyBlit(struct intel_context *intel, * the wrong result. */ if (dst_pitch > 0 && src_pitch > 0) { + assert(dst_x < dst_x2); + assert(dst_y < dst_y2); + BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); @@ -306,6 +316,9 @@ intelEmitCopyBlit(struct intel_context *intel, ADVANCE_BATCH(); } else { + assert(dst_x < dst_x2); + assert(h > 0); + BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); @@ -480,6 +493,9 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask) */ intel_wait_flips(intel, INTEL_BATCH_NO_CLIPRECTS); + assert(b.x1 < b.x2); + assert(b.y1 < b.y2); + BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); |