Module: Mesa Branch: main Commit: 4a19ebfafcb350b236ee5f1e823048911666ae8c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a19ebfafcb350b236ee5f1e823048911666ae8c
Author: Mike Blumenkrantz <[email protected]> Date: Fri Apr 29 11:01:49 2022 -0400 zink: add a LINEAR drm modifier if rebinding to add dmabuf export this needs to have some kind of modifier, so be conservative here Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16252> --- src/gallium/drivers/zink/zink_resource.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 0c3c67870c4..a31173a3ea0 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1027,6 +1027,11 @@ add_resource_bind(struct zink_context *ctx, struct zink_resource *res, unsigned zink_resource_image_barrier(ctx, res, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, 0, 0); res->base.b.bind |= bind; struct zink_resource_object *old_obj = res->obj; + if (bind & ZINK_BIND_DMABUF && !res->modifiers_count) { + res->modifiers_count = 1; + res->modifiers = malloc(res->modifiers_count * sizeof(uint64_t)); + res->modifiers[0] = DRM_FORMAT_MOD_LINEAR; + } struct zink_resource_object *new_obj = resource_object_create(screen, &res->base.b, NULL, &res->optimal_tiling, res->modifiers, res->modifiers_count, NULL); if (!new_obj) { debug_printf("new backing resource alloc failed!");
