Mesa (7.8): i915: Fix off-by-one for drawing rectangle.

Chris Wilson ickle at kemper.freedesktop.org
Sun Jun 13 20:36:08 UTC 2010


Module: Mesa
Branch: 7.8
Commit: a48edfad8ab95c331d768ba30a16ea51faec05da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a48edfad8ab95c331d768ba30a16ea51faec05da

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun  5 09:33:58 2010 +0100

i915: Fix off-by-one for drawing rectangle.

The drawing rectangle is given in *inclusive* pixel values, so the range
is only [0,2047]. Hence when rendering to a 2048 wide target, such as an
extended desktop, we would issue an illegal instruction zeroing the draw
area.

Fixes:

  Bug 27408: Primary and Secondary display blanks in extended
             desktop mode with Compiz enabled
  https://bugs.freedesktop.org/show_bug.cgi?id=27408

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
(cherry picked from commit add3260157368458501709d08a3f913ed448234f)
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i915/i915_vtbl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 0a93e64..b7e38bd 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -627,8 +627,8 @@ i915_set_draw_region(struct intel_context *intel,
    state->Buffer[I915_DESTREG_DRAWRECT2] = 0;
    state->Buffer[I915_DESTREG_DRAWRECT3] = (draw_y << 16) | draw_x;
    state->Buffer[I915_DESTREG_DRAWRECT4] =
-      ((ctx->DrawBuffer->Width + draw_x) & 0xffff) |
-      ((ctx->DrawBuffer->Height + draw_y) << 16);
+      ((ctx->DrawBuffer->Width + draw_x - 1) & 0xffff) |
+      ((ctx->DrawBuffer->Height + draw_y - 1) << 16);
    state->Buffer[I915_DESTREG_DRAWRECT5] = (draw_y << 16) | draw_x;
 
    I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);




More information about the mesa-commit mailing list