zink: handle image creation for dmabufs
these use PREINIT layout Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11967>
This commit is contained in:
committed by
Marge Bot
parent
2a63f38cb1
commit
5b827b0a39
@@ -300,11 +300,11 @@ get_image_usage(struct zink_screen *screen, VkImageCreateInfo *ici, const struct
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe_resource *templ, unsigned bind, unsigned modifiers_count, const uint64_t *modifiers, bool *success)
|
||||
create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe_resource *templ, bool dmabuf, unsigned bind, unsigned modifiers_count, const uint64_t *modifiers, bool *success)
|
||||
{
|
||||
ici->sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
ici->pNext = NULL;
|
||||
ici->flags = bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DEPTH_STENCIL) ? 0 : VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
|
||||
ici->flags = modifiers_count || dmabuf || bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DEPTH_STENCIL) ? 0 : VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
|
||||
ici->usage = 0;
|
||||
|
||||
switch (templ->target) {
|
||||
@@ -350,7 +350,7 @@ create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe
|
||||
ici->samples = templ->nr_samples ? templ->nr_samples : VK_SAMPLE_COUNT_1_BIT;
|
||||
ici->tiling = modifiers_count ? VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT : bind & PIPE_BIND_LINEAR ? VK_IMAGE_TILING_LINEAR : VK_IMAGE_TILING_OPTIMAL;
|
||||
ici->sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
ici->initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
ici->initialLayout = dmabuf ? VK_IMAGE_LAYOUT_PREINITIALIZED : VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
if (templ->target == PIPE_TEXTURE_CUBE ||
|
||||
templ->target == PIPE_TEXTURE_CUBE_ARRAY ||
|
||||
@@ -469,7 +469,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
|
||||
unsigned ici_modifier_count = winsys_modifier ? 1 : modifiers_count;
|
||||
bool success = false;
|
||||
VkImageCreateInfo ici;
|
||||
uint64_t mod = create_ici(screen, &ici, templ, templ->bind, ici_modifier_count, ici_modifiers, &success);
|
||||
uint64_t mod = create_ici(screen, &ici, templ, !!external, templ->bind, ici_modifier_count, ici_modifiers, &success);
|
||||
VkExternalMemoryImageCreateInfo emici;
|
||||
VkImageDrmFormatModifierExplicitCreateInfoEXT idfmeci;
|
||||
VkImageDrmFormatModifierListCreateInfoEXT idfmlci;
|
||||
@@ -749,7 +749,7 @@ resource_create(struct pipe_screen *pscreen,
|
||||
} else {
|
||||
res->format = zink_get_format(screen, templ->format);
|
||||
res->dmabuf_acquire = whandle && whandle->type == WINSYS_HANDLE_TYPE_FD;
|
||||
res->layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
res->layout = res->dmabuf_acquire ? VK_IMAGE_LAYOUT_PREINITIALIZED : VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
res->optimal_tiling = optimal_tiling;
|
||||
res->aspect = aspect_from_format(templ->format);
|
||||
if (scanout_flags && optimal_tiling) {
|
||||
|
||||
Reference in New Issue
Block a user