diff options
author | Jason Ekstrand <[email protected]> | 2017-07-11 14:27:25 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-07-22 21:41:12 -0700 |
commit | 5de4209f91c466af6a28fee9c80c398a8ed9b95d (patch) | |
tree | 169317cfcc43d0694c274530c74ba291d1d16a0a /src/intel/blorp | |
parent | 72bc38cfc592505c207bd5cac54bc8dd8289cf72 (diff) |
intel/isl: Add a helper to get a subimage surface
We already have a helper for doing this in BLORP, this just moves the
logic into ISL where we can share it with other components.
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/blorp')
-rw-r--r-- | src/intel/blorp/blorp_blit.c | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index 91d2a227949..ed005163733 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -1406,42 +1406,24 @@ blorp_surf_convert_to_single_slice(const struct isl_device *isl_dev, layer = info->view.base_array_layer; uint32_t byte_offset; - isl_surf_get_image_offset_B_tile_sa(&info->surf, - info->view.base_level, layer, z, - &byte_offset, - &info->tile_x_sa, &info->tile_y_sa); + isl_surf_get_image_surf(isl_dev, &info->surf, + info->view.base_level, layer, z, + &info->surf, + &byte_offset, &info->tile_x_sa, &info->tile_y_sa); info->addr.offset += byte_offset; - const uint32_t slice_width_px = - minify(info->surf.logical_level0_px.width, info->view.base_level); - const uint32_t slice_height_px = - minify(info->surf.logical_level0_px.height, info->view.base_level); - uint32_t tile_x_px, tile_y_px; surf_get_intratile_offset_px(info, &tile_x_px, &tile_y_px); - /* Even for cube maps there will be only single face, therefore drop the - * corresponding flag if present. + /* Instead of using the X/Y Offset fields in RENDER_SURFACE_STATE, we place + * the image at the tile boundary and offset our sampling or rendering. + * For this reason, we need to grow the image by the offset to ensure that + * the hardware doesn't think we've gone past the edge. */ - const isl_surf_usage_flags_t without_cube_map_flag = - info->surf.usage & (~ISL_SURF_USAGE_CUBE_BIT); - - struct isl_surf_init_info init_info = { - .dim = ISL_SURF_DIM_2D, - .format = info->surf.format, - .width = slice_width_px + tile_x_px, - .height = slice_height_px + tile_y_px, - .depth = 1, - .levels = 1, - .array_len = 1, - .samples = info->surf.samples, - .row_pitch = info->surf.row_pitch, - .usage = without_cube_map_flag, - .tiling_flags = 1 << info->surf.tiling, - }; - - ok = isl_surf_init_s(isl_dev, &info->surf, &init_info); - assert(ok); + info->surf.logical_level0_px.w += tile_x_px; + info->surf.logical_level0_px.h += tile_y_px; + info->surf.phys_level0_sa.w += info->tile_x_sa; + info->surf.phys_level0_sa.h += info->tile_y_sa; /* The view is also different now. */ info->view.base_level = 0; |