diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 0bf735c..f3eb74b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -523,6 +523,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, GLboolean color_blend; uint32_t tiling; uint32_t draw_offset; + uint32_t x_offset, y_offset; } key; memset(&key, 0, sizeof(key)); @@ -561,6 +562,9 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.pitch = region->pitch; key.cpp = region->cpp; key.draw_offset = region->draw_offset; /* cur 3d or cube face offset */ + key.x_offset = region->draw_x; + key.y_offset = region->draw_y; + _mesa_debug(ctx, "%s draw_offset %d\n", __FUNCTION__, key.draw_offset); } else { key.surface_type = BRW_SURFACE_NULL; key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; @@ -596,6 +600,9 @@ brw_update_renderbuffer_surface(struct brw_context *brw, uint32_t tile_offset = key.draw_offset % 4096; surf.ss1.base_addr = key.draw_offset - tile_offset; + surf.ss1.base_addr = key.draw_offset; + + _mesa_debug(ctx, "%s: draw_offset 0x%x tile_offset %d base_addr %d\n", __FUNCTION__, key.draw_offset, tile_offset, surf.ss1.base_addr); assert(BRW_IS_G4X(brw) || tile_offset == 0); if (BRW_IS_G4X(brw)) { @@ -603,8 +610,13 @@ brw_update_renderbuffer_surface(struct brw_context *brw, /* Note that the low bits of these fields are missing, so * there's the possibility of getting in trouble. */ +#if 0 /* original code */ surf.ss5.x_offset = (tile_offset % 512) / key.cpp / 4; surf.ss5.y_offset = tile_offset / 512 / 2; +#else + surf.ss5.x_offset = key.x_offset / key.cpp; + surf.ss5.y_offset = key.y_offset / key.cpp; +#endif } else { surf.ss5.x_offset = (tile_offset % 128) / key.cpp / 4; surf.ss5.y_offset = tile_offset / 128 / 2; @@ -619,6 +631,11 @@ brw_update_renderbuffer_surface(struct brw_context *brw, brw_set_surface_tiling(&surf, key.tiling); surf.ss3.pitch = (key.pitch * key.cpp) - 1; + _mesa_debug(ctx, "ss1.base_addr = %d ss5.xoffset %d yoffset %d width %d height %d pitch %d\n\n", + surf.ss1.base_addr, + surf.ss5.x_offset, surf.ss5.y_offset, + surf.ss2.width, surf.ss2.height, surf.ss3.pitch); + /* _NEW_COLOR */ surf.ss0.color_blend = key.color_blend; surf.ss0.writedisable_red = !key.color_mask[0];