diff options
author | Chad Versace <[email protected]> | 2011-11-10 18:39:25 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2011-11-15 06:42:05 -0800 |
commit | 5365ba19db8e9d714604bb63f037800ba2ff2f4d (patch) | |
tree | 504ce67e9a48eb07b59ae88657dc07a79117160c | |
parent | 87d6b359745b6b2c94d1c852ce27e2879d4bec56 (diff) |
intel: Fix software detiling of system stencil buffers
If a window system stencil buffer had a region with odd height, then the
calculated y offset needed for software detiling was off by one. The bug
existed in intel_{map,unmap}_renderbuffer_s8() and in the intel_span.c
accessors.
Fixes the following Piglit tests on gen7:
general/depthstencil-default_fb-readpixels-24_8
general/depthstencil-default_fb-readpixels-FLOAT-and-USHORT
Fixes SIGABRT in the following Piglit tests on gen7:
general/depthstencil-default_fb-blit
general/depthstencil-default_fb-copypixels
general/depthstencil-default_fb-drawpixels-24_8
general/depthstencil-default_fb-drawpixels-FLOAT-and-USHORT
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_span.c | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 8bda7ff7e0e..2a78edfb6be 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -267,8 +267,9 @@ intel_map_renderbuffer_s8(struct gl_context *ctx, irb->map_h = h; /* Flip the Y axis for the default framebuffer. */ + int region_h = irb->region->height; int y_flip = (rb->Name == 0) ? -1 : 1; - int y_bias = (rb->Name == 0) ? (2 * irb->region->height - 1) : 0; + int y_bias = (rb->Name == 0) ? (region_h * 2 + region_h % 2 - 1) : 0; irb->map_buffer = malloc(w * h); untiled_s8_map = irb->map_buffer; @@ -353,8 +354,9 @@ intel_unmap_renderbuffer_s8(struct gl_context *ctx, uint8_t *tiled_s8_map = irb->region->bo->virtual; /* Flip the Y axis for the default framebuffer. */ + int region_h = irb->region->height; int y_flip = (rb->Name == 0) ? -1 : 1; - int y_bias = (rb->Name == 0) ? (2 * irb->region->height - 1) : 0; + int y_bias = (rb->Name == 0) ? (region_h * 2 + region_h % 2 - 1) : 0; for (uint32_t pix_y = 0; pix_y < irb->map_h; pix_y++) { for (uint32_t pix_x = 0; pix_x < irb->map_w; pix_x++) { diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 478aec86a02..271d2e15a83 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -141,10 +141,10 @@ intel_set_span_functions(struct intel_context *intel, struct intel_renderbuffer *irb = intel_renderbuffer(rb); \ uint8_t *buf = irb->region->bo->virtual; \ unsigned stride = irb->region->pitch; \ - unsigned height = 2 * irb->region->height; \ + unsigned height = irb->region->height; \ bool flip = rb->Name == 0; \ int y_scale = flip ? -1 : 1; \ - int y_bias = flip ? (height - 1) : 0; \ + int y_bias = flip ? (height * 2 + height % 2 - 1) : 0; \ #undef Y_FLIP #define Y_FLIP(y) (y_scale * (y) + y_bias) |