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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40360>
This commit is contained in:
parent
a90a3341ef
commit
38cf1b3829
1 changed files with 20 additions and 9 deletions
|
|
@ -447,7 +447,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);
|
||||
|
|
@ -466,16 +466,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
Add a link
Reference in a new issue