mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-25 18:00:52 +01:00
lavapipe: check drm modifier info during image create
not doing anything except validation Co-authored-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27805>
This commit is contained in:
parent
97331d1ed4
commit
bd4f69a0fe
1 changed files with 22 additions and 0 deletions
|
|
@ -38,6 +38,28 @@ lvp_image_create(VkDevice _device,
|
|||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
|
||||
|
||||
#ifdef HAVE_LIBDRM
|
||||
unsigned num_layouts = 1;
|
||||
const VkSubresourceLayout *layouts = NULL;
|
||||
enum pipe_format pipe_format = lvp_vk_format_to_pipe_format(pCreateInfo->format);
|
||||
const VkImageDrmFormatModifierExplicitCreateInfoEXT *modinfo = (void*)vk_find_struct_const(pCreateInfo->pNext,
|
||||
IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT);
|
||||
|
||||
if (modinfo && pCreateInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
|
||||
assert(modinfo->drmFormatModifier == DRM_FORMAT_MOD_LINEAR);
|
||||
assert(modinfo->drmFormatModifierPlaneCount == util_format_get_num_planes(pipe_format));
|
||||
num_layouts = modinfo->drmFormatModifierPlaneCount;
|
||||
layouts = modinfo->pPlaneLayouts;
|
||||
}
|
||||
|
||||
/* planar not supported yet */
|
||||
assert(num_layouts == 1);
|
||||
if (num_layouts > 1) {
|
||||
mesa_loge("lavapipe: planar drm formats are not supported");
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
#endif
|
||||
|
||||
image = vk_image_create(&device->vk, pCreateInfo, alloc, sizeof(*image));
|
||||
if (image == NULL)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue