diff options
author | Kenneth Graunke <[email protected]> | 2018-12-09 12:11:17 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:12 -0800 |
commit | bfc76d35250c37f41003f618893eb2fd35097b13 (patch) | |
tree | 9164c4a871676027a040ab82cf3b1e05bd7325ff | |
parent | 56f1fe3eacc95e6ff66fad323448a1189962b97d (diff) |
iris: store modifier info in res
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.h | 7 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index c40b3e6575c..746de83f057 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -476,16 +476,15 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, const struct util_format_description *format_desc = util_format_description(templ->format); const bool has_depth = util_format_has_depth(format_desc); - const struct isl_drm_modifier_info *mod_info = NULL; uint64_t modifier = select_best_modifier(devinfo, modifiers, modifiers_count); isl_tiling_flags_t tiling_flags = ISL_TILING_ANY_MASK; if (modifier != DRM_FORMAT_MOD_INVALID) { - mod_info = isl_drm_modifier_get_info(modifier); + res->mod_info = isl_drm_modifier_get_info(modifier); - tiling_flags = 1 << mod_info->tiling; + tiling_flags = 1 << res->mod_info->tiling; } else { if (modifiers_count > 0) { fprintf(stderr, "Unsupported modifier, resource creation failed.\n"); @@ -551,8 +550,8 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, .tiling_flags = tiling_flags); assert(isl_surf_created_successfully); - if (mod_info) { - res->aux.possible_usages |= 1 << mod_info->aux_usage; + if (res->mod_info) { + res->aux.possible_usages |= 1 << res->mod_info->aux_usage; } else if (has_depth) { res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ; } else if (supports_mcs(&res->surf)) { @@ -683,9 +682,8 @@ iris_resource_from_handle(struct pipe_screen *pscreen, if (modifier == DRM_FORMAT_MOD_INVALID) { modifier = tiling_to_modifier(res->bo->tiling_mode); } - const struct isl_drm_modifier_info *mod_info = - isl_drm_modifier_get_info(modifier); - assert(mod_info); + res->mod_info = isl_drm_modifier_get_info(modifier); + assert(res->mod_info); isl_surf_usage_flags_t isl_usage = pipe_bind_to_isl_usage(templ->bind); @@ -708,7 +706,7 @@ iris_resource_from_handle(struct pipe_screen *pscreen, .min_alignment_B = 0, .row_pitch_B = whandle->stride, .usage = isl_usage, - .tiling_flags = 1 << mod_info->tiling); + .tiling_flags = 1 << res->mod_info->tiling); assert(res->bo->tiling_mode == isl_tiling_to_i915_tiling(res->surf.tiling)); diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h index 8e57b861437..382f1159c5a 100644 --- a/src/gallium/drivers/iris/iris_resource.h +++ b/src/gallium/drivers/iris/iris_resource.h @@ -112,6 +112,13 @@ struct iris_resource { */ enum isl_aux_state **state; } aux; + + /** + * For external surfaces, this is DRM format modifier that was used to + * create or import the surface. For internal surfaces, this will always + * be DRM_FORMAT_MOD_INVALID. + */ + const struct isl_drm_modifier_info *mod_info; }; /** |