From nobody Wed Feb 11 03:19:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689349273; cv=none; d=zohomail.com; s=zohoarc; b=Q1KuyLMHUNtQ8OLIitm2TfFxzIuSOm16AXcMu4Pd1JVYQQlbw0WHP0lahzWuaWRpXu4c6KDzh5JFGKMi+uIkDyCjAEHjwCP0GwdiEOZxF/po/ylrrXNaLkoWPWNNg/IWsA2Y9Rznyf3cgL4Dnocyqttbc6xpzFHidFjGNFYGi9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689349273; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ELe8CTLKXv2JZeGD366YsuV782BYZwsGhKMgRndrxvg=; b=kNnMYxZANjAQrGKLFgBBYoz3tSY8NDodaTiJOWOc0m6Unz5hFRpujvApuH00DeyICd0YmQXPCRs1ZcstZSM3NKS6+plKMDo+Z3wE9yJXUBqoSZHkjs5ABZZTpWO3yrWcQRTWzsLT+Og51pkqtZ49ATCr8wXzBUko6T7Ybvylrag= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689349273448948.0109543417492; Fri, 14 Jul 2023 08:41:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKKtt-0002xm-Is; Fri, 14 Jul 2023 11:40:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKts-0002xP-HR for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:40:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKtp-000520-UA for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:40:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-168-pMYzHGmXOmuApWvDrwcBPQ-1; Fri, 14 Jul 2023 11:40:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9CE2F800C7F for ; Fri, 14 Jul 2023 15:40:02 +0000 (UTC) Received: from centennial.enunes.eu (unknown [10.43.17.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBB8CC57963; Fri, 14 Jul 2023 15:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689349204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ELe8CTLKXv2JZeGD366YsuV782BYZwsGhKMgRndrxvg=; b=dUTXGoxd53QGI7p1+1ZekssKhce+XKOlbyMRczXaZk69qBOEcaB8cjGFa2VdzP32BNPZ0J uK5amRwHLAjzfRwFWqtfn+8e+Sc9jkqinysuWrdnaVcKP39hGwZDz5yUp+fFedLf8MSGsf 6xRLX5xonHi7cCbH/g/gv4nsMStF9X4= X-MC-Unique: pMYzHGmXOmuApWvDrwcBPQ-1 From: Erico Nunes To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, slp@redhat.com, Erico Nunes Subject: [PATCH 1/3] docs: vhost-user-gpu: add protocol changes for dmabuf modifiers Date: Fri, 14 Jul 2023 17:38:58 +0200 Message-Id: <20230714153900.475857-2-ernunes@redhat.com> In-Reply-To: <20230714153900.475857-1-ernunes@redhat.com> References: <20230714153900.475857-1-ernunes@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=ernunes@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689349274018100002 Content-Type: text/plain; charset="utf-8" VHOST_USER_GPU_DMABUF_SCANOUT2 is defined as a message with all the contents of VHOST_USER_GPU_DMABUF_SCANOUT plus the dmabuf modifiers which were ommitted. The VHOST_USER_GPU_PROTOCOL_F_DMABUF2 protocol feature is defined as a way to check whether this new message is supported or not. Signed-off-by: Erico Nunes Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Sergio Lopez --- docs/interop/vhost-user-gpu.rst | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/interop/vhost-user-gpu.rst b/docs/interop/vhost-user-gpu.= rst index b78806892d..3035822d05 100644 --- a/docs/interop/vhost-user-gpu.rst +++ b/docs/interop/vhost-user-gpu.rst @@ -134,6 +134,19 @@ VhostUserGpuEdidRequest :scanout-id: ``u32``, the scanout to get edid from =20 =20 +VhostUserGpuDMABUFScanout2 +^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++----------------+----------+ +| dmabuf_scanout | modifier | ++----------------+----------+ + +:dmabuf_scanout: ``VhostUserGpuDMABUFScanout``, filled as described in the + VhostUserGpuDMABUFScanout structure. + +:modifier: ``u64``, the DMABUF modifiers + + C structure ----------- =20 @@ -163,7 +176,8 @@ Protocol features =20 .. code:: c =20 - #define VHOST_USER_GPU_PROTOCOL_F_EDID 0 + #define VHOST_USER_GPU_PROTOCOL_F_EDID 0 + #define VHOST_USER_GPU_PROTOCOL_F_DMABUF2 1 =20 New messages and communication changes are negotiated thanks to the ``VHOST_USER_GPU_GET_PROTOCOL_FEATURES`` and @@ -263,3 +277,13 @@ Message types Retrieve the EDID data for a given scanout. This message requires the ``VHOST_USER_GPU_PROTOCOL_F_EDID`` protocol feature to be supported. + +``VHOST_USER_GPU_DMABUF_SCANOUT2`` + :id: 12 + :request payload: ``VhostUserGpuDMABUFScanout2`` + :reply payload: N/A + + Same as VHOST_USER_GPU_DMABUF_SCANOUT, but also sends the dmabuf modifie= rs + appended to the message, which were not provided in the other message. + This message requires the ``VHOST_USER_GPU_PROTOCOL_F_DMABUF2`` protocol + feature to be supported. --=20 2.40.1 From nobody Wed Feb 11 03:19:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689349256; cv=none; d=zohomail.com; s=zohoarc; b=NnZreEGqs4/jg9TzV0E9PBNU4OGfbThWTxxPXJjH7V35knjZ+YueKmYAxJRvOS/P4HF+HFkxFU5NtUep89sl5tR0ZURpRU21W4lRg6bvONc+YudZkiCxMUe3d9BIxzKm/S5vMmFOXRWnxF54tqahkFE7Mw+5y9xMAaPB3TvBiJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689349256; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1sZ9SYBU/ys4QDrRgzOHqn/zPa7s96RHFYrhT9B6AxY=; b=ikjaCzYjIp6KojyMxj+5H1LxiteLJO/3NuYAGyMbjKmeYbETAEVN2d3rHW9VGk1qRognijrC5+35rHeYx3AV31NTdYMuEG1k1qxSEVkjHcknnjUOBUu7KFri0Tuq8rV9RkxIbmzkxy/q8ug82RQSL/1xe5dJBG4Pc+Pf55T1xQY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689349256084654.4481260967414; Fri, 14 Jul 2023 08:40:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKKtu-0002yK-Vr; Fri, 14 Jul 2023 11:40:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKtt-0002xY-0b for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:40:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKtq-00052C-FZ for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:40:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-376-Fstmzs5oMzaBoFvA-t50yQ-1; Fri, 14 Jul 2023 11:40:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD330858290 for ; Fri, 14 Jul 2023 15:40:03 +0000 (UTC) Received: from centennial.enunes.eu (unknown [10.43.17.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id D383AC57964; Fri, 14 Jul 2023 15:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689349205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1sZ9SYBU/ys4QDrRgzOHqn/zPa7s96RHFYrhT9B6AxY=; b=BuchRJFLAnyrp+YQMkG4coNcDUSvPUACpYLuTOS4vBjWgGjf6lgDF2OAIl0nqfCdk0ripS XC5Dhzk1babswx9MEw4851Ua+vG6tu62yn+aoTTr6LGwBkJ9MtQRJ9wjyJoaVqKFIT8Ypp 2Bv5NHR/spsbsVmMU1c0/WBxAos60+s= X-MC-Unique: Fstmzs5oMzaBoFvA-t50yQ-1 From: Erico Nunes To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, slp@redhat.com, Erico Nunes Subject: [PATCH 2/3] contrib/vhost-user-gpu: add support for sending dmabuf modifiers Date: Fri, 14 Jul 2023 17:38:59 +0200 Message-Id: <20230714153900.475857-3-ernunes@redhat.com> In-Reply-To: <20230714153900.475857-1-ernunes@redhat.com> References: <20230714153900.475857-1-ernunes@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=ernunes@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689349257494100001 Content-Type: text/plain; charset="utf-8" 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=C3=A9 Lureau Reviewed-by: Sergio Lopez --- contrib/vhost-user-gpu/vhost-user-gpu.c | 5 ++- contrib/vhost-user-gpu/virgl.c | 51 +++++++++++++++++++++++-- contrib/vhost-user-gpu/vugpu.h | 9 +++++ 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-g= pu/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 =3D (1 << VHOST_USER_GPU_PROTOCOL_F_EDID); + const uint64_t protocol_dmabuf2 =3D (1 << VHOST_USER_GPU_PROTOCOL_F_DM= ABUF2); VuGpu *g =3D user_data; uint64_t protocol_features; VhostUserGpuMsg msg =3D { @@ -1082,7 +1083,7 @@ protocol_features_cb(gint fd, GIOCondition condition,= gpointer user_data) return G_SOURCE_CONTINUE; } =20 - protocol_features &=3D protocol_edid; + protocol_features &=3D (protocol_edid | protocol_dmabuf2); =20 msg =3D (VhostUserGpuMsg) { .request =3D VHOST_USER_GPU_SET_PROTOCOL_FEATURES, @@ -1100,6 +1101,8 @@ protocol_features_cb(gint fd, GIOCondition condition,= gpointer user_data) exit(EXIT_FAILURE); } =20 + g->use_modifiers =3D !!(protocol_features & protocol_dmabuf2); + return G_SOURCE_REMOVE; } =20 diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c index 211aa110a9..1da6cc1588 100644 --- a/contrib/vhost-user-gpu/virgl.c +++ b/contrib/vhost-user-gpu/virgl.c @@ -318,6 +318,37 @@ virgl_resource_detach_backing(VuGpu *g, vg_cleanup_mapping_iov(g, res_iovs, num_iovs); } =20 +static int +virgl_get_resource_info_modifiers(uint32_t resource_id, + struct virgl_renderer_resource_info *inf= o, + uint64_t *modifiers) +{ + int ret; +#ifdef VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION + struct virgl_renderer_resource_info_ext info_ext; + ret =3D virgl_renderer_resource_get_info_ext(resource_id, &info_ext); + if (ret < 0) { + return ret; + } + + *info =3D info_ext.base; + *modifiers =3D info_ext.modifiers; +#else + ret =3D virgl_renderer_resource_get_info(resource_id, info); + if (ret < 0) { + return ret; + } + + /* + * Before virgl_renderer_resource_get_info_ext, + * getting the modifiers was not possible. + */ + *modifiers =3D 0; +#endif + + return 0; +} + static void virgl_cmd_set_scanout(VuGpu *g, struct virtio_gpu_ctrl_command *cmd) @@ -338,7 +369,9 @@ virgl_cmd_set_scanout(VuGpu *g, memset(&info, 0, sizeof(info)); =20 if (ss.resource_id && ss.r.width && ss.r.height) { - ret =3D virgl_renderer_resource_get_info(ss.resource_id, &info); + uint64_t modifiers =3D 0; + ret =3D virgl_get_resource_info_modifiers(ss.resource_id, &info, + &modifiers); if (ret =3D=3D -1) { g_critical("%s: illegal resource specified %d\n", __func__, ss.resource_id); @@ -354,8 +387,6 @@ virgl_cmd_set_scanout(VuGpu *g, } assert(fd >=3D 0); VhostUserGpuMsg msg =3D { - .request =3D VHOST_USER_GPU_DMABUF_SCANOUT, - .size =3D sizeof(VhostUserGpuDMABUFScanout), .payload.dmabuf_scanout.scanout_id =3D ss.scanout_id, .payload.dmabuf_scanout.x =3D ss.r.x, .payload.dmabuf_scanout.y =3D ss.r.y, @@ -367,6 +398,20 @@ virgl_cmd_set_scanout(VuGpu *g, .payload.dmabuf_scanout.fd_flags =3D info.flags, .payload.dmabuf_scanout.fd_drm_fourcc =3D info.drm_fourcc }; + + if (g->use_modifiers) { + /* + * The mesage uses all the fields set in dmabuf_scanout plus + * modifiers which is appended after VhostUserGpuDMABUFScanout. + */ + msg.request =3D VHOST_USER_GPU_DMABUF_SCANOUT2; + msg.size =3D sizeof(VhostUserGpuDMABUFScanout2); + msg.payload.dmabuf_scanout2.modifier =3D modifiers; + } else { + msg.request =3D VHOST_USER_GPU_DMABUF_SCANOUT; + msg.size =3D sizeof(VhostUserGpuDMABUFScanout); + } + vg_send_msg(g, &msg, fd); close(fd); } else { diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h index f0f2069c47..509b679f03 100644 --- a/contrib/vhost-user-gpu/vugpu.h +++ b/contrib/vhost-user-gpu/vugpu.h @@ -37,6 +37,7 @@ typedef enum VhostUserGpuRequest { VHOST_USER_GPU_DMABUF_SCANOUT, VHOST_USER_GPU_DMABUF_UPDATE, VHOST_USER_GPU_GET_EDID, + VHOST_USER_GPU_DMABUF_SCANOUT2, } VhostUserGpuRequest; =20 typedef struct VhostUserGpuDisplayInfoReply { @@ -84,6 +85,11 @@ typedef struct VhostUserGpuDMABUFScanout { int fd_drm_fourcc; } QEMU_PACKED VhostUserGpuDMABUFScanout; =20 +typedef struct VhostUserGpuDMABUFScanout2 { + struct VhostUserGpuDMABUFScanout dmabuf_scanout; + uint64_t modifier; +} QEMU_PACKED VhostUserGpuDMABUFScanout2; + typedef struct VhostUserGpuEdidRequest { uint32_t scanout_id; } QEMU_PACKED VhostUserGpuEdidRequest; @@ -98,6 +104,7 @@ typedef struct VhostUserGpuMsg { VhostUserGpuScanout scanout; VhostUserGpuUpdate update; VhostUserGpuDMABUFScanout dmabuf_scanout; + VhostUserGpuDMABUFScanout2 dmabuf_scanout2; VhostUserGpuEdidRequest edid_req; struct virtio_gpu_resp_edid resp_edid; struct virtio_gpu_resp_display_info display_info; @@ -112,6 +119,7 @@ static VhostUserGpuMsg m __attribute__ ((unused)); #define VHOST_USER_GPU_MSG_FLAG_REPLY 0x4 =20 #define VHOST_USER_GPU_PROTOCOL_F_EDID 0 +#define VHOST_USER_GPU_PROTOCOL_F_DMABUF2 1 =20 struct virtio_gpu_scanout { uint32_t width, height; @@ -132,6 +140,7 @@ typedef struct VuGpu { bool virgl; bool virgl_inited; bool edid_inited; + bool use_modifiers; uint32_t inflight; =20 struct virtio_gpu_scanout scanout[VIRTIO_GPU_MAX_SCANOUTS]; --=20 2.40.1 From nobody Wed Feb 11 03:19:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689349265; cv=none; d=zohomail.com; s=zohoarc; b=Jv9UOSld12Owd6myLi1zUzVW2IaXzUwEgr7YZJsbdmb3Wza3ZBzFoqwWalhhJ/ixAgeEmSnfOvCq+fcXs1mwTCGjpQmaYVcCOwkF9t9Be4VmSMbZGrPlcSV12VIRAZpE8dtA9qMZZq0HfwZgvJZB7OfUeCGweuGMAg7FTnPrb6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689349265; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1auIUix9V7oWJXKfEVvLJahibD87WLUE650+DQy9iPo=; b=f0D087AbvJxFd+sG9C40B6Ha3+/6p8k8e6h1MmGDQnTSFa/6aNyowifsLMulV4V87DRvQdIBCYdLkyxa3imIF5yZJ9MAVEhvQK+D0RWRAcJ9K5J8tE+IQ87O261j6OiAT7JzPq22cm+n6PrZhYtE5mvky1MX5LgKqz7VTEcc9Wc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689349265100956.3202813865223; Fri, 14 Jul 2023 08:41:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKKty-00030u-4X; Fri, 14 Jul 2023 11:40:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKtw-00030E-8s for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:40:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKtu-000534-Mj for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:40:12 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-360-D_NIuk3GPX6QdD0h86zS1g-1; Fri, 14 Jul 2023 11:40:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B43BB3814956 for ; Fri, 14 Jul 2023 15:40:04 +0000 (UTC) Received: from centennial.enunes.eu (unknown [10.43.17.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0001DC57963; Fri, 14 Jul 2023 15:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689349209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1auIUix9V7oWJXKfEVvLJahibD87WLUE650+DQy9iPo=; b=RuHx3ayeXt2gl1tJJp4drlEteghLWQGXVGCqxpuw/1JDdWG6GMQrIc78T6yYJge/1LGupc 6qaTzAa2a4o8ifY9WjOJ1GHgyi5u0hZr7nPAmGLewHsYklQWSPXZrv7pu15HP3IN1RJe9N G9dvwwUhjwLi5Vhaq790zSSo08VRLjA= X-MC-Unique: D_NIuk3GPX6QdD0h86zS1g-1 From: Erico Nunes To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, slp@redhat.com, Erico Nunes Subject: [PATCH 3/3] vhost-user-gpu: support dmabuf modifiers Date: Fri, 14 Jul 2023 17:39:00 +0200 Message-Id: <20230714153900.475857-4-ernunes@redhat.com> In-Reply-To: <20230714153900.475857-1-ernunes@redhat.com> References: <20230714153900.475857-1-ernunes@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=ernunes@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689349266118100001 Content-Type: text/plain; charset="utf-8" When the backend sends VHOST_USER_GPU_DMABUF_SCANOUT2, handle it by getting the modifiers information which is now available. Signed-off-by: Erico Nunes Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Sergio Lopez --- hw/display/vhost-user-gpu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index e8ee03094e..1150521d9d 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -32,6 +32,7 @@ typedef enum VhostUserGpuRequest { VHOST_USER_GPU_DMABUF_SCANOUT, VHOST_USER_GPU_DMABUF_UPDATE, VHOST_USER_GPU_GET_EDID, + VHOST_USER_GPU_DMABUF_SCANOUT2, } VhostUserGpuRequest; =20 typedef struct VhostUserGpuDisplayInfoReply { @@ -79,6 +80,11 @@ typedef struct VhostUserGpuDMABUFScanout { int fd_drm_fourcc; } QEMU_PACKED VhostUserGpuDMABUFScanout; =20 +typedef struct VhostUserGpuDMABUFScanout2 { + struct VhostUserGpuDMABUFScanout dmabuf_scanout; + uint64_t modifier; +} QEMU_PACKED VhostUserGpuDMABUFScanout2; + typedef struct VhostUserGpuEdidRequest { uint32_t scanout_id; } QEMU_PACKED VhostUserGpuEdidRequest; @@ -93,6 +99,7 @@ typedef struct VhostUserGpuMsg { VhostUserGpuScanout scanout; VhostUserGpuUpdate update; VhostUserGpuDMABUFScanout dmabuf_scanout; + VhostUserGpuDMABUFScanout2 dmabuf_scanout2; VhostUserGpuEdidRequest edid_req; struct virtio_gpu_resp_edid resp_edid; struct virtio_gpu_resp_display_info display_info; @@ -107,6 +114,7 @@ static VhostUserGpuMsg m __attribute__ ((unused)); #define VHOST_USER_GPU_MSG_FLAG_REPLY 0x4 =20 #define VHOST_USER_GPU_PROTOCOL_F_EDID 0 +#define VHOST_USER_GPU_PROTOCOL_F_DMABUF2 1 =20 static void vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked); =20 @@ -171,7 +179,8 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUse= rGpuMsg *msg) .flags =3D VHOST_USER_GPU_MSG_FLAG_REPLY, .size =3D sizeof(uint64_t), .payload =3D { - .u64 =3D (1 << VHOST_USER_GPU_PROTOCOL_F_EDID) + .u64 =3D (1 << VHOST_USER_GPU_PROTOCOL_F_EDID) | + (1 << VHOST_USER_GPU_PROTOCOL_F_DMABUF2) } }; =20 @@ -236,6 +245,7 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUse= rGpuMsg *msg) =20 break; } + case VHOST_USER_GPU_DMABUF_SCANOUT2: case VHOST_USER_GPU_DMABUF_SCANOUT: { VhostUserGpuDMABUFScanout *m =3D &msg->payload.dmabuf_scanout; int fd =3D qemu_chr_fe_get_msgfd(&g->vhost_chr); @@ -269,6 +279,11 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUs= erGpuMsg *msg) .fourcc =3D m->fd_drm_fourcc, .y0_top =3D m->fd_flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP, }; + if (msg->request =3D=3D VHOST_USER_GPU_DMABUF_SCANOUT2) { + VhostUserGpuDMABUFScanout2 *m2 =3D &msg->payload.dmabuf_scanou= t2; + dmabuf->modifier =3D m2->modifier; + } + dpy_gl_scanout_dmabuf(con, dmabuf); break; } --=20 2.40.1