diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-09-12 15:20:26 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-09-18 12:14:24 -0700 |
commit | 400ffa748ec95bc8733f92084818cd073193669a (patch) | |
tree | a0399f7d4e2a789e5105743c211315475dd29010 | |
parent | f3f42fd867c7b2844378118db08a8095593d81a2 (diff) |
intel/isl: Add a drm_modifier_get_default_aux_state helper
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
-rw-r--r-- | src/intel/isl/isl.h | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 3 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h index ca4556ffcf..df275f85c4 100644 --- a/src/intel/isl/isl.h +++ b/src/intel/isl/isl.h @@ -1558,6 +1558,26 @@ isl_drm_modifier_has_aux(uint64_t modifier) return isl_drm_modifier_get_info(modifier)->aux_usage != ISL_AUX_USAGE_NONE; } +/** Returns the default isl_aux_state for the given modifier. + * + * All modified images are required to be kept out of the AUX_INVALID state + * but they may or may not actually be compressed and may or may not have + * clear color. This function returns the worst case aux_state that we need + * to assume when getting a surface from another process or API. + */ +static inline enum isl_aux_state +isl_drm_modifier_get_default_aux_state(uint64_t modifier) +{ + const struct isl_drm_modifier_info *mod_info = + isl_drm_modifier_get_info(modifier); + + if (!mod_info || mod_info->aux_usage == ISL_AUX_USAGE_NONE) + return ISL_AUX_STATE_AUX_INVALID; + + return mod_info->supports_clear_color ? ISL_AUX_STATE_COMPRESSED_CLEAR : + ISL_AUX_STATE_COMPRESSED_NO_CLEAR; +} + struct isl_extent2d ATTRIBUTE_CONST isl_get_interleaved_msaa_px_size_sa(uint32_t samples); diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 253d3a13f9..5b7cde82f6 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -1075,8 +1075,7 @@ intel_miptree_create_for_dri_image(struct brw_context *brw, * a worst case of compression. */ enum isl_aux_state initial_state = - mod_info->supports_clear_color ? ISL_AUX_STATE_COMPRESSED_CLEAR : - ISL_AUX_STATE_COMPRESSED_NO_CLEAR; + isl_drm_modifier_get_default_aux_state(image->modifier); if (!create_ccs_buf_for_image(brw, image, mt, initial_state)) { intel_miptree_release(&mt); |