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 <chad.versace@linux.intel.com>
This commit is contained in:
Chad Versace
2011-11-15 07:10:18 -08:00
parent 1161facaf9
commit dc4c3a31c6
2 changed files with 3 additions and 6 deletions

View File

@@ -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++) {