mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
vulkan/wsi/headless: properly use CPU images for CPU devices
Currently the headless WSI unconditionally uses DRM images as WSI images, which isn't proper behavior for working with lavapipe driver, and leads to either error or crash (depending on whether udmabuf is available). Properly setup CPU images instead of DRM images for software-rendering WSI devices. This fixes (at least) `dEQP-VK.wsi.headless.swapchain.render.*` on lavapipe. Fixes:90caf9bdbd("vulkan/wsi/headless: drop the wsi_create_null_image_mem override") Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (cherry picked from commit38cf1b3829) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
parent
59f2c9502d
commit
18606773fe
2 changed files with 21 additions and 10 deletions
|
|
@ -6414,7 +6414,7 @@
|
|||
"description": "vulkan/wsi/headless: properly use CPU images for CPU devices",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "90caf9bdbd2425f61b0b28483c9d940854d67541",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ wsi_headless_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
|
||||
.pNext = &mod_list,
|
||||
};
|
||||
if (wsi_device->supports_modifiers) {
|
||||
if (!wsi_device->sw && wsi_device->supports_modifiers) {
|
||||
wsi_device->GetPhysicalDeviceFormatProperties2(
|
||||
wsi_device->pdevice, pCreateInfo->imageFormat, &props);
|
||||
assert(mod_list.drmFormatModifierCount > 0);
|
||||
|
|
@ -424,16 +424,27 @@ wsi_headless_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
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,
|
||||
};
|
||||
struct wsi_base_image_params *image_params = NULL;
|
||||
struct wsi_cpu_image_params cpu_params;
|
||||
struct wsi_drm_image_params drm_params;
|
||||
if (wsi_device->sw) {
|
||||
cpu_params = (struct wsi_cpu_image_params) {
|
||||
.base.image_type = WSI_IMAGE_TYPE_CPU,
|
||||
};
|
||||
image_params = &cpu_params.base;
|
||||
} else {
|
||||
drm_params = (struct wsi_drm_image_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,
|
||||
};
|
||||
image_params = &drm_params.base;
|
||||
}
|
||||
|
||||
result = wsi_swapchain_init(wsi_device, &chain->base, device,
|
||||
pCreateInfo, &drm_params.base, pAllocator);
|
||||
pCreateInfo, image_params, pAllocator);
|
||||
|
||||
STACK_ARRAY_FINISH(mods);
|
||||
STACK_ARRAY_FINISH(mod_props);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue