From ee643b23ff546492c67d4e2b525ced7329a3c020 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 24 May 2011 12:32:19 -0700 Subject: [PATCH] i965: Switch brw_state_dump to using bitshifting for surface state. Reviewed-by: Ian Romanick --- src/mesa/drivers/dri/i965/brw_defines.h | 4 ++++ src/mesa/drivers/dri/i965/brw_state_dump.c | 22 +++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index d8f4beff1dd..6d41b1e69d3 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -446,6 +446,10 @@ #define BRW_SURFACE_TILED (1 << 1) #define BRW_SURFACE_TILED_Y (1 << 0) +/* Surface state DW4 */ +#define BRW_SURFACE_MIN_LOD_SHIFT 28 +#define BRW_SURFACE_MIN_LOD_MASK INTEL_MASK(31, 28) + /* Surface state DW5 */ #define BRW_SURFACE_X_OFFSET_SHIFT 25 #define BRW_SURFACE_X_OFFSET_MASK INTEL_MASK(31, 25) diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index 3a3aa8c0346..ef58619702d 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -110,7 +110,7 @@ static void dump_wm_surface_state(struct brw_context *brw) for (i = 0; i < brw->wm.nr_surfaces; i++) { unsigned int surfoff; - struct brw_surface_state *surf; + uint32_t *surf; char name[20]; if (brw->wm.surf_offset[i] == 0) { @@ -118,21 +118,25 @@ static void dump_wm_surface_state(struct brw_context *brw) continue; } surfoff = bo->offset + brw->wm.surf_offset[i]; - surf = (struct brw_surface_state *)(base + brw->wm.surf_offset[i]); + surf = (uint32_t *)(base + brw->wm.surf_offset[i]); sprintf(name, "WM SURF%d", i); state_out(name, surf, surfoff, 0, "%s %s\n", - get_965_surfacetype(surf->ss0.surface_type), - get_965_surface_format(surf->ss0.surface_format)); + get_965_surfacetype(GET_FIELD(surf[0], BRW_SURFACE_TYPE)), + get_965_surface_format(GET_FIELD(surf[0], BRW_SURFACE_FORMAT))); state_out(name, surf, surfoff, 1, "offset\n"); state_out(name, surf, surfoff, 2, "%dx%d size, %d mips\n", - surf->ss2.width + 1, surf->ss2.height + 1, surf->ss2.mip_count); - state_out(name, surf, surfoff, 3, "pitch %d, %stiled\n", - surf->ss3.pitch + 1, surf->ss3.tiled_surface ? "" : "not "); + GET_FIELD(surf[2], BRW_SURFACE_WIDTH) + 1, + GET_FIELD(surf[2], BRW_SURFACE_HEIGHT) + 1); + state_out(name, surf, surfoff, 3, "pitch %d, %s tiled\n", + GET_FIELD(surf[3], BRW_SURFACE_PITCH) + 1, + (surf[3] & BRW_SURFACE_TILED) ? + ((surf[3] & BRW_SURFACE_TILED_Y) ? "Y" : "X") : "not"); state_out(name, surf, surfoff, 4, "mip base %d\n", - surf->ss4.min_lod); + GET_FIELD(surf[4], BRW_SURFACE_MIN_LOD)); state_out(name, surf, surfoff, 5, "x,y offset: %d,%d\n", - surf->ss5.x_offset, surf->ss5.y_offset); + GET_FIELD(surf[5], BRW_SURFACE_X_OFFSET), + GET_FIELD(surf[5], BRW_SURFACE_Y_OFFSET)); } drm_intel_bo_unmap(bo); } -- 2.30.2