vulkan/wsi: Add a supports_scanout flag
This flag indicates whether or not the legacy scanout flag is supported. It defaults to true since that has been the default assumption for the WSI code up until now. On NVIDIA hardware, we can't render to linear so, if we don't have modifiers, we want to automatically fall back to the blit path. In theory, we could do this inside the driver but it's a giant pain and much harder to ensure that the blit only happens as part of vkQueuePresent(). Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18826>
This commit is contained in:
committed by
Marge Bot
parent
15fca5ca7e
commit
2044f2910c
@@ -76,6 +76,7 @@ wsi_device_init(struct wsi_device *wsi,
|
||||
|
||||
wsi->instance_alloc = *alloc;
|
||||
wsi->pdevice = pdevice;
|
||||
wsi->supports_scanout = true;
|
||||
wsi->sw = sw_device || (WSI_DEBUG & WSI_DEBUG_SW);
|
||||
wsi->wants_linear = (WSI_DEBUG & WSI_DEBUG_LINEAR) != 0;
|
||||
#define WSI_GET_CB(func) \
|
||||
|
||||
@@ -106,6 +106,11 @@ struct wsi_device {
|
||||
|
||||
bool has_import_memory_host;
|
||||
|
||||
/** Indicates if wsi_image_create_info::scanout is supported
|
||||
*
|
||||
* If false, WSI will always use either modifiers or the prime blit path.
|
||||
*/
|
||||
bool supports_scanout;
|
||||
bool supports_modifiers;
|
||||
uint32_t maxImageDimension2D;
|
||||
uint32_t optimalBufferCopyRowPitchAlignment;
|
||||
|
||||
@@ -601,6 +601,7 @@ static VkResult
|
||||
wsi_configure_prime_image(UNUSED const struct wsi_swapchain *chain,
|
||||
const VkSwapchainCreateInfoKHR *pCreateInfo,
|
||||
bool use_modifier,
|
||||
wsi_memory_type_select_cb select_buffer_memory_type,
|
||||
struct wsi_image_info *info)
|
||||
{
|
||||
VkResult result =
|
||||
@@ -613,7 +614,7 @@ wsi_configure_prime_image(UNUSED const struct wsi_swapchain *chain,
|
||||
info->prime_use_linear_modifier = use_modifier;
|
||||
|
||||
info->create_mem = wsi_create_prime_image_mem;
|
||||
info->select_buffer_memory_type = prime_select_buffer_memory_type;
|
||||
info->select_buffer_memory_type = select_buffer_memory_type;
|
||||
info->select_image_memory_type = wsi_select_device_memory_type;
|
||||
|
||||
return VK_SUCCESS;
|
||||
@@ -623,7 +624,13 @@ bool
|
||||
wsi_drm_image_needs_buffer_blit(const struct wsi_device *wsi,
|
||||
const struct wsi_drm_image_params *params)
|
||||
{
|
||||
return !params->same_gpu;
|
||||
if (!params->same_gpu)
|
||||
return true;
|
||||
|
||||
if (params->num_modifier_lists > 0 || wsi->supports_scanout)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
VkResult
|
||||
@@ -634,9 +641,13 @@ wsi_drm_configure_image(const struct wsi_swapchain *chain,
|
||||
{
|
||||
assert(params->base.image_type == WSI_IMAGE_TYPE_DRM);
|
||||
|
||||
if (!params->same_gpu) {
|
||||
if (chain->use_buffer_blit) {
|
||||
bool use_modifier = params->num_modifier_lists > 0;
|
||||
return wsi_configure_prime_image(chain, pCreateInfo, use_modifier, info);
|
||||
wsi_memory_type_select_cb select_buffer_memory_type =
|
||||
params->same_gpu ? wsi_select_device_memory_type :
|
||||
prime_select_buffer_memory_type;
|
||||
return wsi_configure_prime_image(chain, pCreateInfo, use_modifier,
|
||||
select_buffer_memory_type, info);
|
||||
} else {
|
||||
return wsi_configure_native_image(chain, pCreateInfo,
|
||||
params->num_modifier_lists,
|
||||
|
||||
Reference in New Issue
Block a user