[Mesa-dev] [v2 27/39] i965: Refactor miptree to isl converter and adjustment
Topi Pohjolainen
topi.pohjolainen at gmail.com
Wed May 3 09:22:40 UTC 2017
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 69 ++++++++++++++----------
1 file changed, 41 insertions(+), 28 deletions(-)
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 b3d9382..59415e1 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -73,25 +73,23 @@ uint32_t rb_mocs[] = {
};
static void
-brw_emit_surface_state(struct brw_context *brw,
- struct intel_mipmap_tree *mt, uint32_t flags,
- GLenum target, struct isl_view view,
- uint32_t mocs, uint32_t *surf_offset, int surf_index,
- unsigned read_domains, unsigned write_domains)
+get_isl_surf(struct brw_context *brw, struct intel_mipmap_tree *mt,
+ GLenum target, struct isl_view *view,
+ uint32_t *tile_x, uint32_t *tile_y,
+ uint32_t *offset, struct isl_surf *surf)
{
- uint32_t tile_x = mt->level[0].slice[0].x_offset;
- uint32_t tile_y = mt->level[0].slice[0].y_offset;
- uint32_t offset = mt->offset;
+ *tile_x = mt->level[0].slice[0].x_offset;
+ *tile_y = mt->level[0].slice[0].y_offset;
+ *offset = mt->offset;
- struct isl_surf surf;
- intel_miptree_get_isl_surf(brw, mt, &surf);
+ intel_miptree_get_isl_surf(brw, mt, surf);
- surf.dim = get_isl_surf_dim(target);
+ surf->dim = get_isl_surf_dim(target);
const enum isl_dim_layout dim_layout =
get_isl_dim_layout(&brw->screen->devinfo, mt->tiling, target);
- if (surf.dim_layout != dim_layout) {
+ if (surf->dim_layout != dim_layout) {
/* The layout of the specified texture target is not compatible with the
* actual layout of the miptree structure in memory -- You're entering
* dangerous territory, this can only possibly work if you only intended
@@ -102,35 +100,50 @@ brw_emit_surface_state(struct brw_context *brw,
* controls.
*/
assert(brw->has_surface_tile_offset);
- assert(view.levels == 1 && view.array_len == 1);
- assert(tile_x == 0 && tile_y == 0);
+ assert(view->levels == 1 && view->array_len == 1);
+ assert(*tile_x == 0 && *tile_y == 0);
offset += intel_miptree_get_tile_offsets(&brw->isl_dev, mt,
- view.base_level,
- view.base_array_layer,
- &tile_x, &tile_y);
+ view->base_level,
+ view->base_array_layer,
+ tile_x, tile_y);
/* Minify the logical dimensions of the texture. */
- const unsigned l = view.base_level - mt->first_level;
- surf.logical_level0_px.width = minify(surf.logical_level0_px.width, l);
- surf.logical_level0_px.height = surf.dim <= ISL_SURF_DIM_1D ? 1 :
- minify(surf.logical_level0_px.height, l);
- surf.logical_level0_px.depth = surf.dim <= ISL_SURF_DIM_2D ? 1 :
- minify(surf.logical_level0_px.depth, l);
+ const unsigned l = view->base_level - mt->first_level;
+ surf->logical_level0_px.width = minify(surf->logical_level0_px.width, l);
+ surf->logical_level0_px.height = surf->dim <= ISL_SURF_DIM_1D ? 1 :
+ minify(surf->logical_level0_px.height, l);
+ surf->logical_level0_px.depth = surf->dim <= ISL_SURF_DIM_2D ? 1 :
+ minify(surf->logical_level0_px.depth, l);
/* Only the base level and layer can be addressed with the overridden
* layout.
*/
- surf.logical_level0_px.array_len = 1;
- surf.levels = 1;
- surf.dim_layout = dim_layout;
+ surf->logical_level0_px.array_len = 1;
+ surf->levels = 1;
+ surf->dim_layout = dim_layout;
/* The requested slice of the texture is now at the base level and
* layer.
*/
- view.base_level = 0;
- view.base_array_layer = 0;
+ view->base_level = 0;
+ view->base_array_layer = 0;
}
+}
+
+static void
+brw_emit_surface_state(struct brw_context *brw,
+ struct intel_mipmap_tree *mt, uint32_t flags,
+ GLenum target, struct isl_view view,
+ uint32_t mocs, uint32_t *surf_offset, int surf_index,
+ unsigned read_domains, unsigned write_domains)
+{
+ uint32_t tile_x;
+ uint32_t tile_y;
+ uint32_t offset;
+ struct isl_surf surf;
+
+ get_isl_surf(brw, mt, target, &view, &tile_x, &tile_y, &offset, &surf);
union isl_color_value clear_color = { .u32 = { 0, 0, 0, 0 } };
--
2.9.3
More information about the mesa-dev
mailing list