mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
panvk: advertise support for AFBC WSI behind a debug flag
Adds opt-in support for AFBC WSI swapchain image creation by adding the supported modifiers to the lists expected by mesa WSI. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37771>
This commit is contained in:
parent
db2f02dcc2
commit
52c6f404ed
3 changed files with 31 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ static const struct debug_control panvk_debug_options[] = {
|
|||
{"force_simultaneous", PANVK_DEBUG_FORCE_SIMULTANEOUS},
|
||||
{"implicit_others_inv", PANVK_DEBUG_IMPLICIT_OTHERS_INV},
|
||||
{"force_blackhole", PANVK_DEBUG_FORCE_BLACKHOLE},
|
||||
{"wsi_afbc", PANVK_DEBUG_WSI_AFBC},
|
||||
{NULL, 0}};
|
||||
|
||||
uint64_t panvk_debug;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ enum panvk_debug_flags {
|
|||
PANVK_DEBUG_FORCE_SIMULTANEOUS = 1 << 10,
|
||||
PANVK_DEBUG_IMPLICIT_OTHERS_INV = 1 << 11,
|
||||
PANVK_DEBUG_FORCE_BLACKHOLE = 1 << 12,
|
||||
PANVK_DEBUG_WSI_AFBC = 1 << 13,
|
||||
};
|
||||
|
||||
extern uint64_t panvk_debug;
|
||||
|
|
|
|||
|
|
@ -759,6 +759,7 @@ panvk_GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice,
|
|||
VkFormatProperties2 *pFormatProperties)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_physical_device, physical_device, physicalDevice);
|
||||
const unsigned arch = pan_arch(physical_device->kmod.props.gpu_id);
|
||||
|
||||
VkFormatFeatureFlags2 tex =
|
||||
get_image_format_features(physical_device, format);
|
||||
|
|
@ -785,6 +786,24 @@ panvk_GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice,
|
|||
VK_OUTARRAY_MAKE_TYPED(VkDrmFormatModifierPropertiesEXT, out,
|
||||
list->pDrmFormatModifierProperties,
|
||||
&list->drmFormatModifierCount);
|
||||
if (pFormatProperties->formatProperties.optimalTilingFeatures &&
|
||||
PANVK_DEBUG(WSI_AFBC))
|
||||
{
|
||||
PAN_SUPPORTED_MODIFIERS(supported);
|
||||
for (int mi = 0; mi < ARRAY_SIZE(supported); mi++) {
|
||||
if (drm_is_afbc(supported[mi]) &&
|
||||
pan_afbc_supports_format(arch, vk_format_to_pipe_format(format)))
|
||||
{
|
||||
vk_outarray_append_typed(VkDrmFormatModifierPropertiesEXT, &out, mod_props)
|
||||
{
|
||||
mod_props->drmFormatModifier = supported[mi];
|
||||
mod_props->drmFormatModifierPlaneCount = 1;
|
||||
mod_props->drmFormatModifierTilingFeatures =
|
||||
pFormatProperties->formatProperties.optimalTilingFeatures;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pFormatProperties->formatProperties.linearTilingFeatures) {
|
||||
vk_outarray_append_typed(VkDrmFormatModifierPropertiesEXT, &out,
|
||||
|
|
@ -878,7 +897,16 @@ get_image_format_properties(struct panvk_physical_device *physical_device,
|
|||
const VkPhysicalDeviceImageDrmFormatModifierInfoEXT *mod_info =
|
||||
vk_find_struct_const(
|
||||
info->pNext, PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT);
|
||||
if (mod_info->drmFormatModifier != DRM_FORMAT_MOD_LINEAR)
|
||||
|
||||
/* TODO: switch to using a more generic function for checking mod support here
|
||||
* when adding new modifiers, so that this case doesn't become too big. */
|
||||
const bool can_use_afbc =
|
||||
PANVK_DEBUG(WSI_AFBC) &&
|
||||
panvk_image_can_use_afbc(physical_device, info->format, info->usage,
|
||||
info->type, info->tiling, 0);
|
||||
const bool supported = (drm_is_afbc(mod_info->drmFormatModifier) && can_use_afbc) ||
|
||||
mod_info->drmFormatModifier == DRM_FORMAT_MOD_LINEAR;
|
||||
if (!supported)
|
||||
goto unsupported;
|
||||
|
||||
/* The only difference between optimal and linear is currently whether
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue