summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-11-15 07:10:18 -0800
committerChad Versace <[email protected]>2011-11-15 08:00:29 -0800
commitdc4c3a31c64aae2c3d76ccbd5bf54d04a1d5d041 (patch)
tree7222d7f08def7d8b309f97c9332778a04f968d87 /src
parent1161facaf9bb14086807714c72a7554ed229a52f (diff)
intel: Simplify stencil detiling arithmetic
When calculating the y offset needed for detiling window system stencil buffers, replace the term region->height * 2 + region->height % 2 - 1 with rb->Height - 1 . The two terms are incidentally equivalent due to some out-of-date, incorrect code in the Intel DRI2 glue for DDX. (See intel_process_dri2_buffer_with_separate_stencil(), line ``buffer_height /= 2;``). Note: This is a candidate for the 7.11 branch (only the intel_span.c hunk). Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c3
2 files changed, 3 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index dbd5163b5f1..a724f1d97b3 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -267,9 +267,8 @@ 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) ? (region_h * 2 + region_h % 2 - 1) : 0;
+ int y_bias = (rb->Name == 0) ? (rb->Height - 1) : 0;
irb->map_buffer = malloc(w * h);
untiled_s8_map = irb->map_buffer;
@@ -442,9 +441,8 @@ 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) ? (region_h * 2 + region_h % 2 - 1) : 0;
+ int y_bias = (rb->Name == 0) ? (rb->Height - 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 271d2e15a83..31f2828c395 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -141,10 +141,9 @@ 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 = irb->region->height; \
bool flip = rb->Name == 0; \
int y_scale = flip ? -1 : 1; \
- int y_bias = flip ? (height * 2 + height % 2 - 1) : 0; \
+ int y_bias = flip ? (rb->Height - 1) : 0; \
#undef Y_FLIP
#define Y_FLIP(y) (y_scale * (y) + y_bias)