mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
vulkan/wsi/headless: allow explicit modifiers
When wsi device has modifier support, simply allow all driver supported
modifiers for the requested format.
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12534
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13636
Reviewed-by: Janne Grunau <j@jannau.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36658>
(cherry picked from commit 24cb071d47)
This commit is contained in:
parent
7812b11f9b
commit
8a0f75c2ca
2 changed files with 34 additions and 1 deletions
|
|
@ -5334,7 +5334,7 @@
|
|||
"description": "vulkan/wsi/headless: allow explicit modifiers",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -451,13 +451,46 @@ wsi_headless_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
if (chain == NULL)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
VkDrmFormatModifierPropertiesListEXT mod_list = {
|
||||
.sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT,
|
||||
};
|
||||
VkFormatProperties2 props = {
|
||||
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
||||
.pNext = &mod_list,
|
||||
};
|
||||
if (wsi_device->supports_modifiers) {
|
||||
wsi_device->GetPhysicalDeviceFormatProperties2(
|
||||
wsi_device->pdevice, pCreateInfo->imageFormat, &props);
|
||||
assert(mod_list.drmFormatModifierCount > 0);
|
||||
}
|
||||
|
||||
STACK_ARRAY(VkDrmFormatModifierPropertiesEXT, mod_props,
|
||||
mod_list.drmFormatModifierCount);
|
||||
STACK_ARRAY(uint64_t, mods, mod_list.drmFormatModifierCount);
|
||||
|
||||
if (mod_list.drmFormatModifierCount > 0) {
|
||||
mod_list.pDrmFormatModifierProperties = mod_props;
|
||||
wsi_device->GetPhysicalDeviceFormatProperties2(
|
||||
wsi_device->pdevice, pCreateInfo->imageFormat, &props);
|
||||
|
||||
for (uint32_t i = 0; i < mod_list.drmFormatModifierCount; i++)
|
||||
mods[i] = mod_props[i].drmFormatModifier;
|
||||
}
|
||||
|
||||
struct wsi_drm_image_params drm_params = {
|
||||
.base.image_type = WSI_IMAGE_TYPE_DRM,
|
||||
.same_gpu = true,
|
||||
.num_modifier_lists = mod_list.drmFormatModifierCount > 0 ? 1 : 0,
|
||||
.num_modifiers = &mod_list.drmFormatModifierCount,
|
||||
.modifiers = (const uint64_t **)&mods,
|
||||
};
|
||||
|
||||
result = wsi_swapchain_init(wsi_device, &chain->base, device,
|
||||
pCreateInfo, &drm_params.base, pAllocator);
|
||||
|
||||
STACK_ARRAY_FINISH(mods);
|
||||
STACK_ARRAY_FINISH(mod_props);
|
||||
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_free(pAllocator, chain);
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue