intel: Add and use isl_drm_modifier_get_plane_count
We're going to enable the DG2_RC_CCS modifier in anv. Add and use this function to prepare for the new plane count that comes with that modifier. iris is left alone for now because it supports more modifiers than isl_drm_modifier_get_score is aware of. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24120>
This commit is contained in:
@@ -2305,6 +2305,12 @@ uint32_t
|
||||
isl_drm_modifier_get_score(const struct intel_device_info *devinfo,
|
||||
uint64_t modifier);
|
||||
|
||||
/* Return the number of planes used by an image with the given parameters. */
|
||||
uint32_t
|
||||
isl_drm_modifier_get_plane_count(const struct intel_device_info *devinfo,
|
||||
uint64_t modifier,
|
||||
uint32_t fmt_planes);
|
||||
|
||||
struct isl_extent2d ATTRIBUTE_CONST
|
||||
isl_get_interleaved_msaa_px_size_sa(uint32_t samples);
|
||||
|
||||
|
||||
@@ -221,3 +221,32 @@ isl_drm_modifier_get_score(const struct intel_device_info *devinfo,
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
isl_drm_modifier_get_plane_count(const struct intel_device_info *devinfo,
|
||||
uint64_t modifier,
|
||||
uint32_t fmt_planes)
|
||||
{
|
||||
/* This function could return the wrong value if the modifier is not
|
||||
* supported by the device.
|
||||
*/
|
||||
assert(isl_drm_modifier_get_score(devinfo, modifier) > 0);
|
||||
|
||||
/* Planar images don't support clear color. */
|
||||
if (isl_drm_modifier_get_info(modifier)->supports_clear_color)
|
||||
assert(fmt_planes == 1);
|
||||
|
||||
if (devinfo->has_flat_ccs) {
|
||||
if (isl_drm_modifier_get_info(modifier)->supports_clear_color)
|
||||
return 2 * fmt_planes;
|
||||
else
|
||||
return 1 * fmt_planes;
|
||||
} else {
|
||||
if (isl_drm_modifier_get_info(modifier)->supports_clear_color)
|
||||
return 3 * fmt_planes;
|
||||
else if (isl_drm_modifier_has_aux(modifier))
|
||||
return 2 * fmt_planes;
|
||||
else
|
||||
return 1 * fmt_planes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,9 +895,10 @@ get_drm_format_modifier_properties_list(const struct anv_physical_device *physic
|
||||
if (!features)
|
||||
continue;
|
||||
|
||||
uint32_t planes = anv_format->n_planes;
|
||||
if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE)
|
||||
++planes;
|
||||
const uint32_t planes =
|
||||
isl_drm_modifier_get_plane_count(&physical_device->info,
|
||||
isl_mod_info->modifier,
|
||||
anv_format->n_planes);
|
||||
|
||||
vk_outarray_append_typed(VkDrmFormatModifierPropertiesEXT, &out, out_props) {
|
||||
*out_props = (VkDrmFormatModifierPropertiesEXT) {
|
||||
@@ -928,9 +929,10 @@ get_drm_format_modifier_properties_list_2(const struct anv_physical_device *phys
|
||||
if (!features2)
|
||||
continue;
|
||||
|
||||
uint32_t planes = anv_format->n_planes;
|
||||
if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE)
|
||||
++planes;
|
||||
const uint32_t planes =
|
||||
isl_drm_modifier_get_plane_count(&physical_device->info,
|
||||
isl_mod_info->modifier,
|
||||
anv_format->n_planes);
|
||||
|
||||
vk_outarray_append_typed(VkDrmFormatModifierProperties2EXT, &out, out_props) {
|
||||
*out_props = (VkDrmFormatModifierProperties2EXT) {
|
||||
|
||||
Reference in New Issue
Block a user