From e3c82fe04f31b8d6c17b0a17a179f1bbb8454aa1 Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Fri, 14 Jul 2023 17:38:59 +0200 Subject: contrib/vhost-user-gpu: add support for sending dmabuf modifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit virglrenderer recently added virgl_renderer_resource_get_info_ext as a new api, which gets resource information, including dmabuf modifiers. We have to support dmabuf modifiers since the driver may choose to allocate buffers with these modifiers for efficiency, and importing buffers without modifiers information may result in completely broken rendering. Signed-off-by: Erico Nunes Reviewed-by: Marc-André Lureau Reviewed-by: Sergio Lopez Message-Id: <20230714153900.475857-3-ernunes@redhat.com> --- contrib/vhost-user-gpu/vhost-user-gpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'contrib/vhost-user-gpu/vhost-user-gpu.c') diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c index 2e7815a7a3..aa304475a0 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -1071,6 +1071,7 @@ static gboolean protocol_features_cb(gint fd, GIOCondition condition, gpointer user_data) { const uint64_t protocol_edid = (1 << VHOST_USER_GPU_PROTOCOL_F_EDID); + const uint64_t protocol_dmabuf2 = (1 << VHOST_USER_GPU_PROTOCOL_F_DMABUF2); VuGpu *g = user_data; uint64_t protocol_features; VhostUserGpuMsg msg = { @@ -1082,7 +1083,7 @@ protocol_features_cb(gint fd, GIOCondition condition, gpointer user_data) return G_SOURCE_CONTINUE; } - protocol_features &= protocol_edid; + protocol_features &= (protocol_edid | protocol_dmabuf2); msg = (VhostUserGpuMsg) { .request = VHOST_USER_GPU_SET_PROTOCOL_FEATURES, @@ -1100,6 +1101,8 @@ protocol_features_cb(gint fd, GIOCondition condition, gpointer user_data) exit(EXIT_FAILURE); } + g->use_modifiers = !!(protocol_features & protocol_dmabuf2); + return G_SOURCE_REMOVE; } -- cgit 1.4.1