[Mesa-dev] [PATCH 4/5] i965/blorp: Drop dependency to tile_x and tile_y offsets in BLORP

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Mon Dec 9 08:03:33 PST 2013


GEN6-specific. Using the level and lod fields allows us to resolve directly
to mipmap's level. Remove legacy code to specify the level using the
tile_x and y offsets.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/gen6_blorp.cpp |   25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index ce38b2d..9445900 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -377,8 +377,9 @@ gen6_blorp_emit_surface_state(struct brw_context *brw,
                               uint32_t read_domains, uint32_t write_domain)
 {
    uint32_t wm_surf_offset;
-   uint32_t width = surface->width;
-   uint32_t height = surface->height;
+   uint32_t width = surface->mt->logical_width0;
+   uint32_t height = surface->mt->logical_height0;
+   bool is_source = (surface == &params->src);
    if (surface->num_samples > 1) {
       /* Since gen6 uses INTEL_MSAA_LAYOUT_IMS, width and height are measured
        * in samples.  But SURFACE_STATE wants them in pixels, so we need to
@@ -388,7 +389,6 @@ gen6_blorp_emit_surface_state(struct brw_context *brw,
       height /= 2;
    }
    struct intel_region *region = surface->mt->region;
-   uint32_t tile_x, tile_y;
 
    uint32_t *surf = (uint32_t *)
       brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, 6 * 4, 32,
@@ -400,10 +400,9 @@ gen6_blorp_emit_surface_state(struct brw_context *brw,
               surface->brw_surfaceformat << BRW_SURFACE_FORMAT_SHIFT);
 
    /* reloc */
-   surf[1] = (surface->compute_tile_offsets(&tile_x, &tile_y) +
-              region->bo->offset);
+   surf[1] = region->bo->offset;
 
-   surf[2] = (0 << BRW_SURFACE_LOD_SHIFT |
+   surf[2] = ((is_source ? 0 : surface->level) << BRW_SURFACE_LOD_SHIFT |
               (width - 1) << BRW_SURFACE_WIDTH_SHIFT |
               (height - 1) << BRW_SURFACE_HEIGHT_SHIFT);
 
@@ -417,17 +416,11 @@ gen6_blorp_emit_surface_state(struct brw_context *brw,
               0 << BRW_SURFACE_DEPTH_SHIFT |
               (pitch_bytes - 1) << BRW_SURFACE_PITCH_SHIFT);
 
-   surf[4] = brw_get_surface_num_multisamples(surface->num_samples);
+   surf[4] = brw_get_surface_num_multisamples(surface->num_samples) |
+             SET_FIELD(is_source? surface->level : 0, BRW_SURFACE_MIN_LOD);
 
-   /* Note that the low bits of these fields are missing, so
-    * there's the possibility of getting in trouble.
-    */
-   assert(tile_x % 4 == 0);
-   assert(tile_y % 2 == 0);
-   surf[5] = ((tile_x / 4) << BRW_SURFACE_X_OFFSET_SHIFT |
-              (tile_y / 2) << BRW_SURFACE_Y_OFFSET_SHIFT |
-              (surface->mt->align_h == 4 ?
-               BRW_SURFACE_VERTICAL_ALIGN_ENABLE : 0));
+   surf[5] = (surface->mt->align_h == 4 ?
+              BRW_SURFACE_VERTICAL_ALIGN_ENABLE : 0);
 
    /* Emit relocation to surface contents */
    drm_intel_bo_emit_reloc(brw->batch.bo,
-- 
1.7.9.5



More information about the mesa-dev mailing list