From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762707011; cv=pass; d=zohomail.com; s=zohoarc; b=glhsrdgln2RccGuJACGi7O/oByy3XKsKDZzYoqqzsXqSzBn4NyZWoPA/Pey7F/0tUbVU+rsyQIfuYp2CM3n1rtpxYSXveJS2LqoXi5PV/fSvt+TD4cqaIq9i0kgEYxqItzVSzRksW62PE1p6CssHojjSEDNZ8KJvbdSYzku3TPo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762707011; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DU/qpWW3zc+Pk1i/1n+v/aKKMoEDNG6IecnX9aAn4pc=; b=lt3JduirwZb0Qix6TbzxYXiyTPvzDHYE+XkuW591ONp5gUjjtz12P5VGI0gshpexw9La/m2L2sWdNMZCO5mICh0L2l6VOmwZgym6ZVuTSdEpK/+1ccc9SeP5oMn5bTH5DvGsOs5RdsvpyoeEEYVFTBC8X1RIMlKbtAXmJSDgmAM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 17627070114670.9237478549044909; Sun, 9 Nov 2025 08:50:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8bA-0001Ju-Ak; Sun, 09 Nov 2025 11:49:04 -0500 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 1vI8b1-0001Go-B1 for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:48:56 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8az-00005v-PE for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:48:55 -0500 Received: by mx.zohomail.com with SMTPS id 1762706915719829.3443093343992; Sun, 9 Nov 2025 08:48:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706916; cv=none; d=zohomail.com; s=zohoarc; b=TvfZo9qv0fgy3avYnkcR38T5M/+1AuB9fAdBCPWMER0l8BLgmN1fkAbTRWPIc/cakyHVYxgZiWoAnK8Sg9YLpLG1E0Y7Tg4WQoHEyJp6W/drUDeG9+qaYvlhHrkirWy2sXNDbr29VQ2p7E7lWQpfIE1HgkTIxrHa/R8A97ldcU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706916; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=DU/qpWW3zc+Pk1i/1n+v/aKKMoEDNG6IecnX9aAn4pc=; b=fVm3gqLVLj32zXe+kd5cpdJTLkj6gBe6hU7JZ2ae/uuKowsfkP5cZEvSptcBO4nv8QgrU0SNsx5CtIk5lwo44hb/DMJ4TfzH0xShgONup6jBq0LCQ2ajtnLChs8Gm1wSmDBCRL1wYR16ylFssP54sKH4zlkMsjNfHKf4hEjIHC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706916; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=DU/qpWW3zc+Pk1i/1n+v/aKKMoEDNG6IecnX9aAn4pc=; b=MyRamubPFjVPYnwNYpkU2Q0fu/uhJSIPh3vcHp+Da6sRewusmGxULiY/VojPYaM9 34+ERU5yY99+m95pwjDWbZpt66XIw396GMVFFEMwiId9bRlM7zUnTP0oMrKvgsMy1Vr V7dKKEbkxTn2hwsXl+htBDaaR96JCNuBedFhlYQg= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 01/10] ui/sdl2: Restore original context after new context creation Date: Sun, 9 Nov 2025 19:47:02 +0300 Message-ID: <20251109164711.686873-2-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762707011836158500 SDL API changes GL context to a newly created GL context, which differs from other GL providers that don't switch context. Change SDL backend to restore the original GL context. This allows Qemu's virtio-gpu to support new virglrenderer async-fencing feature for Virgl contexts, otherwise virglrenderer's vrend creates a fence-sync context on the Qemu's main-loop thread that erroneously stays in-use by the main-loop after creation, not allowing vrend's fence-sync thread switch to this new context that belongs to it. Reviewed-by: Akihiko Odaki Acked-by: Michael S. Tsirkin Tested-by: Alex Benn=C3=A9e Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- ui/sdl2-gl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index 3be17d1079af..ea2301305d3e 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -168,6 +168,9 @@ QEMUGLContext sdl2_gl_create_context(DisplayGLCtx *dgc, SDL_GL_CONTEXT_PROFILE_ES); ctx =3D SDL_GL_CreateContext(scon->real_window); } + + SDL_GL_MakeCurrent(scon->real_window, scon->winctx); + return (QEMUGLContext)ctx; } =20 --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762707007; cv=pass; d=zohomail.com; s=zohoarc; b=ccJ7+jDu3AclFIgC4z729bHygntgiAuSL1R5MBzy0qZN2eb0Q+8I/QrBU8YliiQoQWu/O5HkOas0iWZmgiIU9oI1d4h/0CmWrlILnVSUn3ZxpstpUW3BcTtsrmxKQYYaVS2bsP7CV9HM3jAkCIGQu/xQmeuekN50GNRQT8mL0Ys= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762707007; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hZbjDazL/Tg9uzrNAoKFnidzVwyT+4YRmD1QR7OBW2U=; b=GJbch8RyflYb2w1cidgYvg2BhH9Tn56zKvuSZcneudD56Wkr9jvhjmtdrfEERSh5VlXu39b9RZflSvJdc5Td1i0O7s9W6PaIngBBRnUZJBAzTN9ePpPqjUA+krFE6TX4G3zvfLNkvJxc8Z1eI4jHlvh3/EQ5QwC5N7IQFg4kdRc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 1762707007291951.6612154634327; Sun, 9 Nov 2025 08:50:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8bA-0001L5-RC; Sun, 09 Nov 2025 11:49:04 -0500 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 1vI8b8-0001JE-Q4 for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:02 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8b6-00006r-Ue for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:02 -0500 Received: by mx.zohomail.com with SMTPS id 1762706923290960.6781246378972; Sun, 9 Nov 2025 08:48:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706925; cv=none; d=zohomail.com; s=zohoarc; b=WKkhWjW2edqkWR819IMhbwKuH7niJdyGXbleQNmQHJC1mkEo9zG3EKtcnFdKOQTzFLDDhWNjcXcoNEI5VLVZxOVqtjFP6QfuLl3CZAhzJlQYBsqWuaJiofH7WbHz3N3EE/dILsOexglMUOHyG0V/eClh2tHgO10Ta8uloTKd1jo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706925; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=hZbjDazL/Tg9uzrNAoKFnidzVwyT+4YRmD1QR7OBW2U=; b=JyxlHzclvSr11EY8qASMrGKFssygyKPSSDpClbxafFjPxwseP+KTXG+LeU3UKQjm3WoHv8Cwkd9OAa/yRSTgSex6JHKclSbcERbqOsIQhg0jaMRaIUy7Pnx/I1n8Ihnd78+Qj9d24J2C2m1Xm80Ka1mDr5s0IXzFOtfvQxe3G38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706925; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=hZbjDazL/Tg9uzrNAoKFnidzVwyT+4YRmD1QR7OBW2U=; b=PhK7MQbAuBm/acqML3m8N0AF6gARan4ydPSWNn06uF53UoVnGM+mFt8rUy1ECM2K IgGiAri2tdxA1rpVI3KEBuT3Xb9yfGSMSLC7XcOCEh2+xkF2G5H6npcpw/hUi7I/8lb +swPBeufdvL7OL3jw+RcAeiLD7+spOZm10QA/m4w= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 02/10] ui/sdl2: Implement dpy dmabuf functions Date: Sun, 9 Nov 2025 19:47:03 +0300 Message-ID: <20251109164711.686873-3-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762707008280158500 From: Pierre-Eric Pelloux-Prayer If EGL is used, we can rely on dmabuf to import textures without doing copies. To get this working on X11, we use the existing SDL hint: SDL_HINT_VIDEO_X11_FORCE_EGL (because dmabuf can't be used with GLX). Reviewed-by: Akihiko Odaki Acked-by: Michael S. Tsirkin Tested-by: Alex Benn=C3=A9e Signed-off-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- include/ui/sdl2.h | 7 +++++ meson.build | 6 ++--- ui/sdl2-gl.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++ ui/sdl2.c | 42 ++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 4 deletions(-) diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index dbe6e3d9739b..9daf5ecffae7 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -45,6 +45,7 @@ struct sdl2_console { bool gui_keysym; SDL_GLContext winctx; QKbdState *kbd; + bool has_dmabuf; #ifdef CONFIG_OPENGL QemuGLShader *gls; egl_fb guest_fb; @@ -96,5 +97,11 @@ void sdl2_gl_scanout_texture(DisplayChangeListener *dcl, void *d3d_tex2d); void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void sdl2_gl_scanout_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf); +void sdl2_gl_release_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf); +bool sdl2_gl_has_dmabuf(DisplayChangeListener *dcl); +void sdl2_gl_console_init(struct sdl2_console *scon); =20 #endif /* SDL2_H */ diff --git a/meson.build b/meson.build index 48c1795b0fc8..0ff3db340a20 100644 --- a/meson.build +++ b/meson.build @@ -1968,10 +1968,8 @@ if get_option('gtk') \ endif endif =20 -x11 =3D not_found -if gtkx11.found() - x11 =3D dependency('x11', method: 'pkg-config', required: gtkx11.found()) -endif +x11 =3D dependency('x11', method: 'pkg-config', required: gtkx11.found()) + png =3D not_found if get_option('png').allowed() and have_system png =3D dependency('libpng', version: '>=3D1.6.34', required: get_optio= n('png'), diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index ea2301305d3e..4906f6875046 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -26,6 +26,8 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/main-loop.h" +#include "qemu/error-report.h" #include "ui/console.h" #include "ui/input.h" #include "ui/sdl2.h" @@ -249,3 +251,67 @@ void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, =20 SDL_GL_SwapWindow(scon->real_window); } + +void sdl2_gl_scanout_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf) +{ + struct sdl2_console *scon =3D container_of(dcl, struct sdl2_console, d= cl); + const int *fds; + + assert(scon->opengl); + SDL_GL_MakeCurrent(scon->real_window, scon->winctx); + + egl_dmabuf_import_texture(dmabuf); + if (!qemu_dmabuf_get_texture(dmabuf)) { + fds =3D qemu_dmabuf_get_fds(dmabuf, NULL); + error_report("%s: failed fd=3D%d", __func__, fds ? fds[0] : -1); + return; + } + + sdl2_gl_scanout_texture(dcl, qemu_dmabuf_get_texture(dmabuf), false, + qemu_dmabuf_get_width(dmabuf), + qemu_dmabuf_get_height(dmabuf), + 0, 0, + qemu_dmabuf_get_width(dmabuf), + qemu_dmabuf_get_height(dmabuf), + NULL); + + if (qemu_dmabuf_get_allow_fences(dmabuf)) { + scon->guest_fb.dmabuf =3D dmabuf; + } +} + +void sdl2_gl_release_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf) +{ + egl_dmabuf_release_texture(dmabuf); +} + +bool sdl2_gl_has_dmabuf(DisplayChangeListener *dcl) +{ + struct sdl2_console *scon =3D container_of(dcl, struct sdl2_console, d= cl); + + return scon->has_dmabuf; +} + +void sdl2_gl_console_init(struct sdl2_console *scon) +{ + bool hidden =3D scon->hidden; + + scon->hidden =3D true; + scon->surface =3D qemu_create_displaysurface(1, 1); + sdl2_window_create(scon); + + /* + * QEMU checks whether console supports dma-buf before switching + * to the console. To break this chicken-egg problem we pre-check + * dma-buf availability beforehand using a dummy SDL window. + */ + scon->has_dmabuf =3D qemu_egl_has_dmabuf(); + + sdl2_window_destroy(scon); + qemu_free_displaysurface(scon->surface); + + scon->surface =3D NULL; + scon->hidden =3D hidden; +} diff --git a/ui/sdl2.c b/ui/sdl2.c index 032dc14bc398..3bb2676f847b 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -35,6 +35,10 @@ #include "qemu/log.h" #include "qemu-main.h" =20 +#ifdef CONFIG_X11 +#include +#endif + static int sdl2_num_outputs; static struct sdl2_console *sdl2_console; =20 @@ -120,6 +124,9 @@ void sdl2_window_create(struct sdl2_console *scon) /* The SDL renderer is only used by sdl2-2D, when OpenGL is disabl= ed */ scon->real_renderer =3D SDL_CreateRenderer(scon->real_window, -1, = 0); } + + qemu_egl_display =3D eglGetCurrentDisplay(); + sdl_update_caption(scon); } =20 @@ -808,6 +815,10 @@ static const DisplayChangeListenerOps dcl_gl_ops =3D { .dpy_gl_scanout_disable =3D sdl2_gl_scanout_disable, .dpy_gl_scanout_texture =3D sdl2_gl_scanout_texture, .dpy_gl_update =3D sdl2_gl_scanout_flush, + + .dpy_gl_scanout_dmabuf =3D sdl2_gl_scanout_dmabuf, + .dpy_gl_release_dmabuf =3D sdl2_gl_release_dmabuf, + .dpy_has_dmabuf =3D sdl2_gl_has_dmabuf, }; =20 static bool @@ -835,6 +846,35 @@ static void sdl2_display_early_init(DisplayOptions *o) } } =20 +static void sdl2_set_hint_x11_force_egl(void) +{ +#if defined(SDL_HINT_VIDEO_X11_FORCE_EGL) && defined(CONFIG_OPENGL) && \ + defined(CONFIG_X11) + Display *x_disp =3D XOpenDisplay(NULL); + EGLDisplay egl_display; + + if (!x_disp) { + return; + } + + /* Prefer EGL over GLX to get dma-buf support. */ + egl_display =3D eglGetDisplay((EGLNativeDisplayType)x_disp); + + if (egl_display !=3D EGL_NO_DISPLAY) { + /* + * Setting X11_FORCE_EGL hint doesn't make SDL to prefer X11 over + * Wayland. SDL will use Wayland driver even if XWayland presents. + * It's always safe to set the hint even if X11 is not used by SDL. + * SDL will work regardless of the hint. + */ + SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1"); + eglTerminate(egl_display); + } + + XCloseDisplay(x_disp); +#endif +} + static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) { uint8_t data =3D 0; @@ -862,6 +902,7 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0"); #endif SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1"); + sdl2_set_hint_x11_force_egl(); SDL_EnableScreenSaver(); memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); @@ -908,6 +949,7 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) sdl2_console[i].kbd =3D qkbd_state_init(con); if (display_opengl) { qemu_console_set_display_gl_ctx(con, &sdl2_console[i].dgc); + sdl2_gl_console_init(&sdl2_console[i]); } register_displaychangelistener(&sdl2_console[i].dcl); =20 --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762706986; cv=pass; d=zohomail.com; s=zohoarc; b=OoTtryVCK/4jMXf3+eOv3eJrJ5vlK+Dv+IgFti9I3gT/1tFq/rHronSbS4FNkfxuF241CicDxm+d35cf93hAV0hJNFsSHnn1qDUU5JDszJnCMS66reMcZvsGi7h4Neh9CifrH9yCSHo/qcvLX4iY0XTux17oDonXr6w279RVIm0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706986; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nLTs0bFvzZaFOZD0jvOJ51eBtDkTOFprK6NA/CAmf/o=; b=Dvat+h6XjTu+HDhSfk5yxHQDyvszDrfFRWQJlWterQBA8/ZbPSq58L1ZRUpESnkS54uFqZoQssItM9rCgPDQ+x70IFCaujdKr6VrTJppnf2QW320hUBB8Fo7tZuigg7eyS4nRhabnaFMB93nzQ0Wq8f3W5oh3Y1ZRKlt2UMragM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 1762706986610527.7479440657611; Sun, 9 Nov 2025 08:49:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8bH-0001OO-Tg; Sun, 09 Nov 2025 11:49:12 -0500 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 1vI8bF-0001NR-FN for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:09 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8bD-00007O-RL for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:09 -0500 Received: by mx.zohomail.com with SMTPS id 1762706931380800.6854112370477; Sun, 9 Nov 2025 08:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706932; cv=none; d=zohomail.com; s=zohoarc; b=nx9yybIJsr6ff/tn4nph7CAtngVgIYvlaKUJDKwDeTf7K9YwEvBfdZV9pVr2QlnsGjhLay/JJKlQgMjg/Lw42EIekk7eR6tMVe051C8WVA/LJECQtc8/dh3Dm/NWUYFPElqNjw6fSP5cbbBvqVVx5DVuycwkdno9TPoPh5c1gvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706932; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=nLTs0bFvzZaFOZD0jvOJ51eBtDkTOFprK6NA/CAmf/o=; b=EHBI6HJjKEUQMNkRIAqMa0IkzZafElMSVJSqSz1w57ICU+M3oibXWDMNLcsy16ahds0bRQoOUwVpzFrDup+jPeMvY+lVG5oe4NSqdMSkB/BjFNXFgqTnU1RnUbxOBa2PgNA7v/OKyJD9xQqajZEfv8NxaL/JdVA1dziqNRnFBvY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706932; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=nLTs0bFvzZaFOZD0jvOJ51eBtDkTOFprK6NA/CAmf/o=; b=b7ek3vSHbXMsYWf2cTBTu1R4yMRPs4xHYioiOP/qRNJ7CvqlTNFh4s+Qhf3bdLNO bE1NafAmxq9FWCcmJB4OyoM6SlTd0P6xsmjm1t0um9me7CMWqXHWzQ4Gra5PXcXoEvC Q7AJV2lk+NjslW/2w+TsU1C6y20HO1ETRjAwXSOE= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 03/10] virtio-gpu: Handle virgl fence creation errors Date: Sun, 9 Nov 2025 19:47:04 +0300 Message-ID: <20251109164711.686873-4-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762706987416158500 Print out error messages when virgl fence creation fails to aid debugging of the fence-related bugs. Reviewed-by: Akihiko Odaki Acked-by: Michael S. Tsirkin Tested-by: Alex Benn=C3=A9e Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Tested-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- hw/display/virtio-gpu-virgl.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 07f6355ad62e..d9704e3574a0 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -876,6 +876,7 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { bool cmd_suspended =3D false; + int ret; =20 VIRTIO_GPU_FILL_CMD(cmd->cmd_hdr); =20 @@ -976,14 +977,30 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, trace_virtio_gpu_fence_ctrl(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type); #if VIRGL_VERSION_MAJOR >=3D 1 if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX) { - virgl_renderer_context_create_fence(cmd->cmd_hdr.ctx_id, - VIRGL_RENDERER_FENCE_FLAG_MERG= EABLE, - cmd->cmd_hdr.ring_idx, - cmd->cmd_hdr.fence_id); + const uint32_t flags =3D VIRGL_RENDERER_FENCE_FLAG_MERGEABLE; + + ret =3D virgl_renderer_context_create_fence(cmd->cmd_hdr.ctx_id, f= lags, + cmd->cmd_hdr.ring_idx, + cmd->cmd_hdr.fence_id); + if (ret) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: virgl_renderer_context_create_fence error: = %s", + __func__, strerror(-ret)); + } return; } #endif - virgl_renderer_create_fence(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type); + + /* + * Unlike other virglrenderer functions, this one returns a positive + * error code. + */ + ret =3D virgl_renderer_create_fence(cmd->cmd_hdr.fence_id, 0); + if (ret) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: virgl_renderer_create_fence error: %s", + __func__, strerror(ret)); + } } =20 static void virgl_write_fence(void *opaque, uint32_t fence) --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762707012; cv=pass; d=zohomail.com; s=zohoarc; b=R2ImkGFZycXMa32SaL0AR9LKt2blRDn3mxNFGXXo9oqkgXctArKJhk66TwzyX4BGmbu+DUzV3yQ8U18V2Xm33nSvvkBA8lb0ud+T5YbSlhvLcvQajxHtiuqbu2cJXy39WDSfpVW2OdpFQXFug4rIbKoWF7KwestVkY6oAm96s7U= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762707012; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YS07ams4rQrYr/6W05ggymFkwcT1in2wLD6RxPjz+z4=; b=L2W6TmlcbvmeFHpq5O6lNVrHKThyzH+IWefobytT4LJaI10m0Yhy9ccLO9axC+Snxvdk29pEE1p+RA6xy9rw8amNwL5h/BPQ10kRsXsmdOpw8/DBYBhvqGGq1BnhROucthRHYuCFiAQg9LjPx5g1veI1cpzkVYtMlugSg838+bc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 1762707012622682.3323225297314; Sun, 9 Nov 2025 08:50:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8bQ-0001Qb-4H; Sun, 09 Nov 2025 11:49:20 -0500 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 1vI8bN-0001Q3-SG for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:17 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8bL-000087-R2 for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:17 -0500 Received: by mx.zohomail.com with SMTPS id 17627069382591019.1052199739319; Sun, 9 Nov 2025 08:48:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706941; cv=none; d=zohomail.com; s=zohoarc; b=F87SMZSePe6akdeJ8rxSIkoF8A4YLOsGi2C25/tS3ZEyWUGrXS56NUtulcT9xLgrYHplejux+bO8jfDz+Sf1EibGhdAcA5AeY8FhtT1JONl7KSSsQoJpun1ld/mhTX/S/UZpdquB1cHAzZIhWy4UDY4gmP4k4VnoQhthC/BSwtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706941; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=YS07ams4rQrYr/6W05ggymFkwcT1in2wLD6RxPjz+z4=; b=hjF0fMXFzQID+Rc4VXpqAKHNam7uAsW75tfLLii7gf9nzF2dNJ/dO8fr0pVG2WjOqWR4DfJBczYWhvYpZPKJIFSdZkga0sUIslkzKpvAOGWaHiQ7nowCtWH/Vxr4hBPWVldwbec3WDDq45zhPwo4K2hrMJFUHw2H0pjF9BkgPws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706940; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=YS07ams4rQrYr/6W05ggymFkwcT1in2wLD6RxPjz+z4=; b=dhpSwIskzfaZbNX86VTaEiPXJwTbNlRegWXQLsVQqV69zSFcGr47RD/F/DimqJu8 NAcnYBQft8TwEJrzIZW4ohTwNglkwiq1ty9CKXplXMv3LJTUoZiMr96pE3E6pgXq7jj V1BxJnhstnEkexyXi3mVXWiMTbzHmM14OQEKJIBs= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 04/10] virtio-gpu: Support asynchronous fencing Date: Sun, 9 Nov 2025 19:47:05 +0300 Message-ID: <20251109164711.686873-5-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762707013740158500 Support asynchronous fencing feature of virglrenderer. It allows Qemu to handle fence as soon as it's signalled instead of periodically polling the fence status. This feature is required for enabling DRM context support in Qemu because legacy fencing mode isn't supported for DRM contexts in virglrenderer. Reviewed-by: Akihiko Odaki Acked-by: Michael S. Tsirkin Tested-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Tested-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- hw/display/virtio-gpu-gl.c | 5 ++ hw/display/virtio-gpu-virgl.c | 130 +++++++++++++++++++++++++++++++++ include/hw/virtio/virtio-gpu.h | 11 +++ meson.build | 2 + 4 files changed, 148 insertions(+) diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index c06a078fb36a..1468c6ed1467 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -169,6 +169,11 @@ static void virtio_gpu_gl_device_unrealize(DeviceState= *qdev) if (gl->renderer_state >=3D RS_INITED) { #if VIRGL_VERSION_MAJOR >=3D 1 qemu_bh_delete(gl->cmdq_resume_bh); + + if (gl->async_fence_bh) { + virtio_gpu_virgl_reset_async_fences(g); + qemu_bh_delete(gl->async_fence_bh); + } #endif if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { timer_free(gl->print_stats); diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index d9704e3574a0..09e41ff6aad5 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -24,6 +24,23 @@ =20 #include =20 +/* + * VIRGL_CHECK_VERSION available since libvirglrenderer 1.0.1 and was fixed + * in 1.1.0. Undefine bugged version of the macro and provide our own. + */ +#if defined(VIRGL_CHECK_VERSION) && \ + VIRGL_VERSION_MAJOR =3D=3D 1 && VIRGL_VERSION_MINOR < 1 +#undef VIRGL_CHECK_VERSION +#endif + +#ifndef VIRGL_CHECK_VERSION +#define VIRGL_CHECK_VERSION(major, minor, micro) \ + (VIRGL_VERSION_MAJOR > (major) || \ + VIRGL_VERSION_MAJOR =3D=3D (major) && VIRGL_VERSION_MINOR > (minor) |= | \ + VIRGL_VERSION_MAJOR =3D=3D (major) && VIRGL_VERSION_MINOR =3D=3D (min= or) && \ + VIRGL_VERSION_MICRO >=3D (micro)) +#endif + struct virtio_gpu_virgl_resource { struct virtio_gpu_simple_resource base; MemoryRegion *mr; @@ -1055,6 +1072,106 @@ static void virgl_write_context_fence(void *opaque,= uint32_t ctx_id, } #endif =20 +void virtio_gpu_virgl_reset_async_fences(VirtIOGPU *g) +{ + struct virtio_gpu_virgl_context_fence *f; + VirtIOGPUGL *gl =3D VIRTIO_GPU_GL(g); + + while (!QSLIST_EMPTY(&gl->async_fenceq)) { + f =3D QSLIST_FIRST(&gl->async_fenceq); + + QSLIST_REMOVE_HEAD(&gl->async_fenceq, next); + + g_free(f); + } +} + +#if VIRGL_CHECK_VERSION(1, 1, 2) +static void virtio_gpu_virgl_async_fence_bh(void *opaque) +{ + QSLIST_HEAD(, virtio_gpu_virgl_context_fence) async_fenceq; + struct virtio_gpu_ctrl_command *cmd, *tmp; + struct virtio_gpu_virgl_context_fence *f; + VirtIOGPU *g =3D opaque; + VirtIOGPUGL *gl =3D VIRTIO_GPU_GL(g); + + if (gl->renderer_state !=3D RS_INITED) { + return; + } + + QSLIST_MOVE_ATOMIC(&async_fenceq, &gl->async_fenceq); + + while (!QSLIST_EMPTY(&async_fenceq)) { + f =3D QSLIST_FIRST(&async_fenceq); + + QSLIST_REMOVE_HEAD(&async_fenceq, next); + + QTAILQ_FOREACH_SAFE(cmd, &g->fenceq, next, tmp) { + /* + * the guest can end up emitting fences out of order + * so we should check all fenced cmds not just the first one. + */ + if (cmd->cmd_hdr.fence_id > f->fence_id) { + continue; + } + if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX) { + if (cmd->cmd_hdr.ring_idx !=3D f->ring_idx) { + continue; + } + if (cmd->cmd_hdr.ctx_id !=3D f->ctx_id) { + continue; + } + } else if (f->ring_idx >=3D 0) { + /* ctx0 GL-query fences don't have ring info */ + continue; + } + virtio_gpu_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NOD= ATA); + QTAILQ_REMOVE(&g->fenceq, cmd, next); + g_free(cmd); + } + + trace_virtio_gpu_fence_resp(f->fence_id); + g_free(f); + g->inflight--; + if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { + trace_virtio_gpu_dec_inflight_fences(g->inflight); + } + } +} + +static void +virtio_gpu_virgl_push_async_fence(VirtIOGPU *g, uint32_t ctx_id, + int64_t ring_idx, uint64_t fence_id) +{ + struct virtio_gpu_virgl_context_fence *f; + VirtIOGPUGL *gl =3D VIRTIO_GPU_GL(g); + + f =3D g_new(struct virtio_gpu_virgl_context_fence, 1); + f->ctx_id =3D ctx_id; + f->ring_idx =3D ring_idx; + f->fence_id =3D fence_id; + + QSLIST_INSERT_HEAD_ATOMIC(&gl->async_fenceq, f, next); + + qemu_bh_schedule(gl->async_fence_bh); +} + +static void virgl_write_async_fence(void *opaque, uint32_t fence) +{ + VirtIOGPU *g =3D opaque; + + virtio_gpu_virgl_push_async_fence(g, 0, -1, fence); +} + +static void virgl_write_async_context_fence(void *opaque, uint32_t ctx_id, + uint32_t ring_idx, uint64_t fe= nce) +{ + VirtIOGPU *g =3D opaque; + + virtio_gpu_virgl_push_async_fence(g, ctx_id, ring_idx, fence); +} +#endif + static virgl_renderer_gl_context virgl_create_context(void *opaque, int scanout_idx, struct virgl_renderer_gl_ctx_param *params) @@ -1154,6 +1271,8 @@ void virtio_gpu_virgl_reset_scanout(VirtIOGPU *g) void virtio_gpu_virgl_reset(VirtIOGPU *g) { virgl_renderer_reset(); + + virtio_gpu_virgl_reset_async_fences(g); } =20 int virtio_gpu_virgl_init(VirtIOGPU *g) @@ -1166,6 +1285,12 @@ int virtio_gpu_virgl_init(VirtIOGPU *g) if (qemu_egl_display) { virtio_gpu_3d_cbs.version =3D 4; virtio_gpu_3d_cbs.get_egl_display =3D virgl_get_egl_display; +#if VIRGL_CHECK_VERSION(1, 1, 2) + virtio_gpu_3d_cbs.write_fence =3D virgl_write_async_fence; + virtio_gpu_3d_cbs.write_context_fence =3D virgl_write_async_contex= t_fence; + flags |=3D VIRGL_RENDERER_ASYNC_FENCE_CB; + flags |=3D VIRGL_RENDERER_THREAD_SYNC; +#endif } #endif #ifdef VIRGL_RENDERER_D3D11_SHARE_TEXTURE @@ -1199,6 +1324,11 @@ int virtio_gpu_virgl_init(VirtIOGPU *g) gl->cmdq_resume_bh =3D aio_bh_new(qemu_get_aio_context(), virtio_gpu_virgl_resume_cmdq_bh, g); +#if VIRGL_CHECK_VERSION(1, 1, 2) + gl->async_fence_bh =3D aio_bh_new(qemu_get_aio_context(), + virtio_gpu_virgl_async_fence_bh, + g); +#endif #endif =20 return 0; diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 58e0f91fda65..a0be704bb0ef 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -233,6 +233,13 @@ struct VirtIOGPUClass { Error **errp); }; =20 +struct virtio_gpu_virgl_context_fence { + uint32_t ctx_id; + int64_t ring_idx; + uint64_t fence_id; + QSLIST_ENTRY(virtio_gpu_virgl_context_fence) next; +}; + /* VirtIOGPUGL renderer states */ typedef enum { RS_START, /* starting state */ @@ -250,6 +257,9 @@ struct VirtIOGPUGL { QEMUTimer *print_stats; =20 QEMUBH *cmdq_resume_bh; + + QEMUBH *async_fence_bh; + QSLIST_HEAD(, virtio_gpu_virgl_context_fence) async_fenceq; }; =20 struct VhostUserGPU { @@ -379,5 +389,6 @@ void virtio_gpu_virgl_reset_scanout(VirtIOGPU *g); void virtio_gpu_virgl_reset(VirtIOGPU *g); int virtio_gpu_virgl_init(VirtIOGPU *g); GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g); +void virtio_gpu_virgl_reset_async_fences(VirtIOGPU *g); =20 #endif diff --git a/meson.build b/meson.build index 0ff3db340a20..3538c429c354 100644 --- a/meson.build +++ b/meson.build @@ -2546,6 +2546,8 @@ config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) config_host_data.set('CONFIG_VNC_SASL', sasl.found()) if virgl.found() config_host_data.set('VIRGL_VERSION_MAJOR', virgl.version().split('.')[0= ]) + config_host_data.set('VIRGL_VERSION_MINOR', virgl.version().split('.')[1= ]) + config_host_data.set('VIRGL_VERSION_MICRO', virgl.version().split('.')[2= ]) endif config_host_data.set('CONFIG_VIRTFS', have_virtfs) config_host_data.set('CONFIG_VTE', vte.found()) --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762706992; cv=pass; d=zohomail.com; s=zohoarc; b=iBmQTvKPg1efPwOu97clCn/FgwUQ9YMGNpEJzclrMAZWWETSaHiUpY7UvKPpjfrQZ7BuHnMhLoRDqBCuzTZmAZM7YJhvLBctEmNHnHwkq9sm+HkXio5O4hSSQ86XlXt5DspxIy2yqjbcIuMmlfmYHsvWdpJ645z9RDELgfBQCQ0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706992; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gwEKPGdjvrhpbEyNWHcFyhwt4X2SWfAOljvC/xMTnUs=; b=oBaxRjjjq9NcK6wtpoZtrt2BhwZlG5iiJL2eiC1sQK0jzXYFDlpr/f0vXs76CLFJqJd379RrMc03LBhNXhtzAI3W3PVxBFHoB8tB5zHMY8nRJbHAsx9xmGlFSO6EWhofUXPxihwwrMLxPHhqaetMkaQ48XSYgAyrDaqccfP8MAg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 176270699233166.18657353046024; Sun, 9 Nov 2025 08:49:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8bT-0001SO-VQ; Sun, 09 Nov 2025 11:49:23 -0500 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 1vI8bS-0001S8-UY for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:23 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8bQ-00008Z-V5 for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:22 -0500 Received: by mx.zohomail.com with SMTPS id 1762706945101903.548906605195; Sun, 9 Nov 2025 08:49:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706947; cv=none; d=zohomail.com; s=zohoarc; b=MtLLJT2tGNmVT1CXKMAK4Nqn5GaihncDbSgUuDYZI3pdF/1O4A0aztVMMT/N00ZHjfKgaYPeCCWtbKoqrJrdWfdQhcwlAJd8hDyoEVYXVwXoshWOrCEaqRAGZ7D+ZYdsX/avL/2yTbg7ELAY93NjTK40RBTLB2ZSq//kI9n0O30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706947; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=gwEKPGdjvrhpbEyNWHcFyhwt4X2SWfAOljvC/xMTnUs=; b=f1PHYq3cmteV1GPYF3NCR52tB9OLF6DfChUxc8khhaYPgMd0DixLcU+flx92pJQrF6qCWWYERgA/9JSg9oBaaB9yIdGDBawQhuj+7eyOqqg7SWInMaIL9BC+CSfhWSgtVfOLNKZKVZAoYX07UScM8LvtfFAbHUs3M4QSMT3Moe4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706946; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=gwEKPGdjvrhpbEyNWHcFyhwt4X2SWfAOljvC/xMTnUs=; b=AbXqSfhbWOQLSLV5j32PvelliVhTtgVpA6BCNu0aHxjplR1BSvX+7kZmOUI3S9wt P7PVmB2x/AnPXASRLwQ/TroSDNc8kRKEI+e1kw4AficnbfaQgMPaInPvkwmdnwYDV4+ +z7Hr3LQrusQZjx65aqZY1Lnd0KusJRDYbJa4wso= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 05/10] virtio-gpu: Support DRM native context Date: Sun, 9 Nov 2025 19:47:06 +0300 Message-ID: <20251109164711.686873-6-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762706993504158500 Add support for DRM native contexts to VirtIO-GPU. DRM context is enabled using a new virtio-gpu-gl device option "drm_native_context=3Don". Unlike Virgl and Venus contexts that operate on application API level, DRM native contexts work on a kernel UAPI level. This lower level results in a lightweight context implementations that yield better performance. Reviewed-by: Akihiko Odaki Acked-by: Michael S. Tsirkin Tested-by: Alex Benn=C3=A9e Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Tested-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- docs/system/devices/virtio/virtio-gpu.rst | 11 +++++++++ hw/display/virtio-gpu-gl.c | 2 ++ hw/display/virtio-gpu-virgl.c | 28 +++++++++++++++++++++++ hw/display/virtio-gpu.c | 15 ++++++++++++ include/hw/virtio/virtio-gpu.h | 3 +++ 5 files changed, 59 insertions(+) diff --git a/docs/system/devices/virtio/virtio-gpu.rst b/docs/system/device= s/virtio/virtio-gpu.rst index 0f4bb304a9b8..086e2fcf27b9 100644 --- a/docs/system/devices/virtio/virtio-gpu.rst +++ b/docs/system/devices/virtio/virtio-gpu.rst @@ -84,6 +84,17 @@ of virtio-gpu host memory window. This is typically betw= een 256M and 8G. =20 .. _venus: https://gitlab.freedesktop.org/virgl/venus-protocol/ =20 +DRM native context is supported since release of `virglrenderer`_ v1.0.0 +using `drm`_ protocol. ``DRM`` virtio-gpu capability set ("capset") requi= res +host blob support (``hostmem`` and ``blob`` fields) and should be enabled +using ``drm_native_context`` field. The ``hostmem`` field specifies the s= ize +of virtio-gpu host memory window. This is typically between 256M and 8G. + +.. parsed-literal:: + -device virtio-gpu-gl,hostmem=3D8G,blob=3Don,drm_native_context=3Don + +.. _drm: https://gitlab.freedesktop.org/virgl/virglrenderer/-/tree/main/sr= c/drm + virtio-gpu rutabaga ------------------- =20 diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 1468c6ed1467..b640900fc6f1 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -159,6 +159,8 @@ static const Property virtio_gpu_gl_properties[] =3D { VIRTIO_GPU_FLAG_STATS_ENABLED, false), DEFINE_PROP_BIT("venus", VirtIOGPU, parent_obj.conf.flags, VIRTIO_GPU_FLAG_VENUS_ENABLED, false), + DEFINE_PROP_BIT("drm_native_context", VirtIOGPU, parent_obj.conf.flags, + VIRTIO_GPU_FLAG_DRM_ENABLED, false), }; =20 static void virtio_gpu_gl_device_unrealize(DeviceState *qdev) diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 09e41ff6aad5..5c9a9ee84392 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -1302,6 +1302,25 @@ int virtio_gpu_virgl_init(VirtIOGPU *g) if (virtio_gpu_venus_enabled(g->parent_obj.conf)) { flags |=3D VIRGL_RENDERER_VENUS | VIRGL_RENDERER_RENDER_SERVER; } + if (virtio_gpu_drm_enabled(g->parent_obj.conf)) { + flags |=3D VIRGL_RENDERER_DRM; + + if (!(flags & VIRGL_RENDERER_ASYNC_FENCE_CB)) { + /* + * Virglrenderer skips enabling DRM context support without + * enabled async-fence feature. VirtIO-GPU will initialize + * successfully, but DRM context won't be available in guest. + * + * For vrend async-fencing can be enabled only if EGL display + * is used. Vrend can't be disabled in QEMU, hence DRM implici= tly + * requires EGL too. + * + * Async-fence was bugged in virglrenderer versions <=3D 1.1.1. + */ + error_report("drm requires egl display and virglrenderer >=3D = 1.2.0"); + return -EINVAL; + } + } #endif =20 ret =3D virgl_renderer_init(g, flags, &virtio_gpu_3d_cbs); @@ -1365,5 +1384,14 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g) } } =20 + if (virtio_gpu_drm_enabled(g->parent_obj.conf)) { + virgl_renderer_get_cap_set(VIRTIO_GPU_CAPSET_DRM, + &capset_max_ver, + &capset_max_size); + if (capset_max_size) { + virtio_gpu_virgl_add_capset(capset_ids, VIRTIO_GPU_CAPSET_DRM); + } + } + return capset_ids; } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 43e88a4daffd..672e81d3671e 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1517,6 +1517,21 @@ void virtio_gpu_device_realize(DeviceState *qdev, Er= ror **errp) #endif } =20 + if (virtio_gpu_drm_enabled(g->parent_obj.conf)) { +#ifdef VIRGL_VERSION_MAJOR + #if VIRGL_VERSION_MAJOR >=3D 1 + if (!virtio_gpu_blob_enabled(g->parent_obj.conf) || + !virtio_gpu_hostmem_enabled(g->parent_obj.conf)) { + error_setg(errp, "drm requires enabled blob and hostmem option= s"); + return; + } + #else + error_setg(errp, "old virglrenderer, drm unsupported"); + return; + #endif +#endif + } + if (!virtio_gpu_base_device_realize(qdev, virtio_gpu_handle_ctrl_cb, virtio_gpu_handle_cursor_cb, diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index a0be704bb0ef..172f5ffce3ed 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -100,6 +100,7 @@ enum virtio_gpu_base_conf_flags { VIRTIO_GPU_FLAG_RUTABAGA_ENABLED, VIRTIO_GPU_FLAG_VENUS_ENABLED, VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED, + VIRTIO_GPU_FLAG_DRM_ENABLED, }; =20 #define virtio_gpu_virgl_enabled(_cfg) \ @@ -122,6 +123,8 @@ enum virtio_gpu_base_conf_flags { (_cfg.hostmem > 0) #define virtio_gpu_venus_enabled(_cfg) \ (_cfg.flags & (1 << VIRTIO_GPU_FLAG_VENUS_ENABLED)) +#define virtio_gpu_drm_enabled(_cfg) \ + (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED)) =20 struct virtio_gpu_base_conf { uint32_t max_outputs; --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762706992; cv=pass; d=zohomail.com; s=zohoarc; b=FJJjTVbZrGvuS19yCzGbH3ZHlFcJDDVXJ5tcsOnu1trz24jG76ErffA9mY1uZZFe4J5ts2Zn5m9lk9LXCCrH/iJ3MJhMnro/1LQAmbSjoh6f1F5P7p5kVOu+ELxxB/MOpEy1dVXk8sfyE/V2p3+35EJdpAGdkMVodj2PiCCqzjw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706992; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/7w8ta1DWV3a2bMv4C7H1+A7BzR2CHXgSqChY/0pPxo=; b=So8N1AJAPZJgVRVcyLj59bPZG31wybKqh0hlMa1XK7gJCEqtNdyoDCm0ZpGo05btdIoYoQ+gXWmBp/NxF3rHRmXCoMbW7YDdAm1shFfMEdsM0r2rbU0yzCpzXkSxyRPzhE69plOwE1b7/yzrRpGC7uGVZRjB3885sKpdj10nOXo= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 1762706992386254.12464177412767; Sun, 9 Nov 2025 08:49:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8bb-0001aV-Sq; Sun, 09 Nov 2025 11:49:32 -0500 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 1vI8ba-0001ZF-2Y for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:30 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8bY-00009L-IC for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:29 -0500 Received: by mx.zohomail.com with SMTPS id 1762706953193899.8269825088538; Sun, 9 Nov 2025 08:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706955; cv=none; d=zohomail.com; s=zohoarc; b=ieDZk3vnkblNmA+qvUMr1xtztiKsl3HabV7ouM0tx8UJqW6gem4oQMPpBfARXV8Ujrinmsj2hsOG1oNxgMXzgEouGzZGZJ1XU6V/SPrtXfN2FobPRKjfRLDkPo4UxcjG4ksutjLDDcEBdIt0qrtgTQsm7YiBSwhg5Vmt8nhGVLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706955; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=/7w8ta1DWV3a2bMv4C7H1+A7BzR2CHXgSqChY/0pPxo=; b=CQ1u3l+8Xx/aDkseNkI1vDV7b1quhDr613Cm/d1zoxQkvw1gOGvLmVaYvvcOj8CdHuQk1J5Kq5piEt8zjEOOF59ObgSLPFcdThM2itoN93cBMPlI35OfDjBRLlUSpmS1S0yY/EqaHXf2e2aid0qNczCigmpit0rebVm1MWubnVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706955; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=/7w8ta1DWV3a2bMv4C7H1+A7BzR2CHXgSqChY/0pPxo=; b=ioOZKIbgxAHhLHd0IgSJk4WeCXcFOlaojivX3+einNMR3eLnUbRKkSAN0wZ/0kqm Gm89k+iukGdHPIJ+GMS2BM/1rH4dgL9XLGDWunl+Pw2S8WvcaT0eEWZ1YeiBbyVy+dy Zq9n1JtfTPuBfZbwDTmamV4mc+gEkG9n88AYIe/o= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 06/10] ui/sdl2: Don't disable scanout when display is refreshed Date: Sun, 9 Nov 2025 19:47:07 +0300 Message-ID: <20251109164711.686873-7-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762706993522158500 Display refreshment is invoked by a timer and it erroneously disables the active scanout if it happens to be invoked after scanout has been enabled. This offending scanout-disable race condition with a timer can be easily hit when Qemu runs with a disabled vsync by using SDL or GTK displays (with vblank_mode=3D0 for GTK). Refreshment of display's content shouldn't disable the active display. Fix it by keeping the scanout's state unchanged when display is redrawn. Reviewed-by: Akihiko Odaki Acked-by: Michael S. Tsirkin Tested-by: Alex Benn=C3=A9e Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- ui/sdl2-gl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index 4906f6875046..d8e5e0a3642c 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -53,7 +53,6 @@ static void sdl2_gl_render_surface(struct sdl2_console *s= con) int ww, wh; =20 SDL_GL_MakeCurrent(scon->real_window, scon->winctx); - sdl2_set_scanout_mode(scon, false); =20 SDL_GetWindowSize(scon->real_window, &ww, &wh); surface_gl_setup_viewport(scon->gls, scon->surface, ww, wh); --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762707023; cv=pass; d=zohomail.com; s=zohoarc; b=fFquRq3Ko1BOZdwSjWb2Wiopcbr+QTIJ6T5KtJvwXR4x3YPi7FgBjDR4lBxixfGbPvioNofmr7RFx6QGva+QmCpsyVTEX3hg0B0tY+tyZ4ICyaE7fisfuMc2yMlRjd1NkjjVNiBnltE8Id2W7GET9R0hCksd5cThrqIk5N4oZ9A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762707023; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Kbq5j4g3EVatJbKy3t91p/JVim8cEGBRZ828mqbLAro=; b=SWh47UAjpt8OJe/U4KhveSDBMzYQaaq4SjRBvcDCRUyfDE2zDuYtz8R/Cf9/psWu1F6UiSCi4/05JL/PYzns/xilmW9KnOZkgg1mXauc55ATZsp6Xfdcjf1e/TTsp3HWl8tfLOmtu+xXM+WWM/S0Dl27rxsQkEqRFU2WCTd2JNQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 176270702319517.619592448800063; Sun, 9 Nov 2025 08:50:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8c0-0002A1-FU; Sun, 09 Nov 2025 11:49:56 -0500 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 1vI8bh-0001cA-Ma for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:41 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8bg-00009u-5k for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:37 -0500 Received: by mx.zohomail.com with SMTPS id 1762706960556808.2441987952313; Sun, 9 Nov 2025 08:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706963; cv=none; d=zohomail.com; s=zohoarc; b=Xoc0vdr2vUKXjj7VsWKY4BV2ArFov9l7aAJBsCoAAGsJRJ/yg9rKpFLCUyrBMm9m/Wc1gRBokRdn9mbH5MBgtUVcA6kq2ytZUuTxEpjyzOtC2L0f0jaKS26xsVz7MwUVf3Jv37Qrf8avj8eTd4Q8ZrUeSTsr23GID97UJceYqz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706963; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Kbq5j4g3EVatJbKy3t91p/JVim8cEGBRZ828mqbLAro=; b=lGbJM8XQOS4yRBvtRSSnR/sjnK5zLh+LrhJiZMjC2L85F5YSneL3L1cui3iEcWvoz91BTWZaX9UeuQaJNUbhdoX/efFM6MVPEz0HGHhc5+sNDajHEdRfnVdNxrtqhy2fyzY5k/EjAw/lBgkOoef4BfFswaRLxWg3CjHxZ3kjNwo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706963; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=Kbq5j4g3EVatJbKy3t91p/JVim8cEGBRZ828mqbLAro=; b=VZODouM5W6eT5kILuQ2SE3JcLr7eUFTjFXD0s11d/57E0RsGmA2t6tgsHuCEZPJH vAuVTB0i5FQoRkWKxx47zEJ7emBpAs4GuAoD3S9LYtWWmG5/Y0AIW3OSqfG/rFXy5HN OepVpi4xueHYd1fZ3/3SyrNNiz1cO6s5tXXk5DC4= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 07/10] ui/gtk: Don't disable scanout when display is refreshed Date: Sun, 9 Nov 2025 19:47:08 +0300 Message-ID: <20251109164711.686873-8-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762707023911158500 Display refreshment is invoked by a timer and it erroneously disables the active scanout if it happens to be invoked after scanout has been enabled. This offending scanout-disable race condition with a timer can be easily hit when Qemu runs with a disabled vsync by using SDL or GTK displays (with vblank_mode=3D0 for GTK). Refreshment of display's content shouldn't disable the active display. Fix it by keeping the scanout's state unchanged when display is redrawn. Reviewed-by: Akihiko Odaki Acked-by: Michael S. Tsirkin Tested-by: Alex Benn=C3=A9e Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- ui/gtk-egl.c | 1 - ui/gtk-gl-area.c | 1 - 2 files changed, 2 deletions(-) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index ae9239999cdb..0dbb429958e5 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -180,7 +180,6 @@ void gd_egl_refresh(DisplayChangeListener *dcl) =20 if (vc->gfx.glupdates) { vc->gfx.glupdates =3D 0; - gtk_egl_set_scanout_mode(vc, false); gd_egl_draw(vc); } } diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index cd86022d264a..c709b2ce0f63 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -199,7 +199,6 @@ void gd_gl_area_refresh(DisplayChangeListener *dcl) =20 if (vc->gfx.glupdates) { vc->gfx.glupdates =3D 0; - gtk_gl_area_set_scanout_mode(vc, false); gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); } } --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762707042; cv=pass; d=zohomail.com; s=zohoarc; b=Z0AedE/kshEur/yJLRXB2F10c6gReeXUDiuD3BJ3s968ADUHvyT6R/LBnrzvoQ83MIZsCaEaMQwcNEtp766GnhwUb5mGMgLvl9QzkZyG1Mvp5eTrZWgvxgI2kj8sGE8MZJ8KPiCSoMpzJTr9pJ81KE/Goi5YWDd22W394RRh8Nw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762707042; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=moGEi+GhDC7kxHX63xr3v6wuLxdpQBtNuyukZeS38Pg=; b=nwavo0MuwpG42dRAXseosj/m16s9VN7RbHOzJ9WZ1WSiSNOZaoaqIoheQ1ORJm3IJhN3/qd107WkDCumL8atbbBKaHJPRAG5cQvApFUtOv6IPxsYCWPcz0t24/TdUSGlj6ByObt5i+nqfayh6R5Y6DuCtrp+rNMJC2DfIVVAatA= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 1762707042892811.1807814293176; Sun, 9 Nov 2025 08:50:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8c3-0002Pr-MO; Sun, 09 Nov 2025 11:50:00 -0500 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 1vI8bq-0001iE-Aw for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:51 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8bo-0000Al-FS for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:46 -0500 Received: by mx.zohomail.com with SMTPS id 1762706968042905.5022271619632; Sun, 9 Nov 2025 08:49:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706971; cv=none; d=zohomail.com; s=zohoarc; b=XSRaQqfJkh6XqVKjRo7EfWEMyP8VLBDm7UC0Tz5i/wROtMWBuY1ghRE0tqrzb/LTnS1wU2SNd3QgLRQbjRrM//wUmZ4Mn4OtW1EIIcRMYoSQCz7TDTCdGUMunxKXzkv0kEg45KaDGBZOvjdpwm4RrGh7eR1pfu5rHjUK0K1bFEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706971; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=moGEi+GhDC7kxHX63xr3v6wuLxdpQBtNuyukZeS38Pg=; b=hoJ6+iEZdqyrbY3Sng6bKFNRZCsr2IiJvfQKjO2DPBngwB7axE9+UinJJvU9TXw131HAsNZl3OVjIib3ioab61b/wi33NE5RGK4F0HstgyEJfA4NsBi8YEiaNO/3kHl/8f7t0yKeYp1ZDU8CwIwHcvS/uWpYJ6XobGRpx5+PUTE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706970; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=moGEi+GhDC7kxHX63xr3v6wuLxdpQBtNuyukZeS38Pg=; b=SVfhtFNqtUd+bMGWq6Ytcvp6OecsxfdrNh2wN4tzEU5It4GpSurpwHLhB/oFrqVS IgoISNxEIVnm8M3HZbvZhhdv9fHMCNHQtyDqkr/roaC9RumGLsSZBf2/dPSjptoRmJK BCRW17HMDP+WhAHlxC8KjDeMiU23w870yNyUzQ68= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 08/10] docs/system: virtio-gpu: Add link to Mesa VirGL doc Date: Sun, 9 Nov 2025 19:47:09 +0300 Message-ID: <20251109164711.686873-9-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762707044228158500 Content-Type: text/plain; charset="utf-8" Extend virtio-gpu documentation with a link to the Mesa VirGL documentation. Suggested-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- docs/system/devices/virtio/virtio-gpu.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/system/devices/virtio/virtio-gpu.rst b/docs/system/device= s/virtio/virtio-gpu.rst index 086e2fcf27b9..89153103b9f8 100644 --- a/docs/system/devices/virtio/virtio-gpu.rst +++ b/docs/system/devices/virtio/virtio-gpu.rst @@ -61,7 +61,7 @@ on typical modern Linux distributions. virtio-gpu virglrenderer ------------------------ =20 -When using virgl accelerated graphics mode in the guest, OpenGL API calls +When using `virgl`_ accelerated graphics mode in the guest, OpenGL API cal= ls are translated into an intermediate representation (see `Gallium3D`_). The intermediate representation is communicated to the host and the `virglrenderer`_ library on the host translates the intermediate @@ -70,6 +70,7 @@ representation back to OpenGL API calls. .. parsed-literal:: -device virtio-gpu-gl =20 +.. _virgl: https://docs.mesa3d.org/drivers/virgl.html .. _Gallium3D: https://www.freedesktop.org/wiki/Software/gallium/ .. _virglrenderer: https://gitlab.freedesktop.org/virgl/virglrenderer/ =20 --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762707023; cv=pass; d=zohomail.com; s=zohoarc; b=jhZZOCKLqP+5pP8dR7JGr71C0NPx4lptusIjXOndnzQrZnX563hRGGdgueZX5kDIuTyr8hiT4hsaC4pB7aJJJgwYizKiedv2IGv2LiRw0XAjmM4co6IU3pDja/70bFGmCysig8uOLVW/oLg9IM27fyCCg2vsKLP3z+e2PxCB2GU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762707023; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=guz391IfkciUZStHJ9lbnMWHISEW5aT88BZZlGitg3k=; b=UxNsQshBXWCiV6g4Vn8VNqmpPIdkoZKVptwVQy+rlP5gidEj0+hsNR9bVU1T4kYUyWdiGMR6qcz6PPZihaJehJwj2Ly2gUI2SH2j5F0pcqX7IIQ4Zwnh1mUoKoQwXumMEmg9WJbCN5oc0j103QOHFfLKDPsWLyWD0gaXijI9bS8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 176270702319555.88789915664006; Sun, 9 Nov 2025 08:50:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8c3-0002Pv-MJ; Sun, 09 Nov 2025 11:50:00 -0500 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 1vI8bu-0001iW-Qa for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:52 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8bt-0000B3-64 for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:49:50 -0500 Received: by mx.zohomail.com with SMTPS id 1762706975512992.3252722821992; Sun, 9 Nov 2025 08:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706977; cv=none; d=zohomail.com; s=zohoarc; b=FxYp7d6kvlquRK1Ydnoy6Dmttr1af/B6p5z3kjFqlgh/mmBi/mCysolyrcixBEvL2X0cUgBTKjM7TsoRyiKyffsekX45LO7kYR/aHtXi9ice8MEpPxaQGv8WrAL5sPLidv9uoK/8ZCTed/9fksIcCvWsuUY6wleRqVYWoOYZKaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706977; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=guz391IfkciUZStHJ9lbnMWHISEW5aT88BZZlGitg3k=; b=cpePvU22rc/ub8m3Cc+3U46b/+3OUAM6gsJA4URZozwCa9zJ7puengVLLqyKSa7l9mxBLjYewwRY5xVsk4REuknxhZ7meo5rPGldEVT3vTnZVEG5/Yp5d6A6YCg+VbJpwHLENg+i59ozVpp/JLN2+bWYQc5mMCmAfNEMVkiNTt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706977; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=guz391IfkciUZStHJ9lbnMWHISEW5aT88BZZlGitg3k=; b=U/f7hFeIsJVJ5xG2UXB4Xf2EKkY5/OUMZWEfz2ey61Wtm/BAffDCUu0mRN4YqP17 Aa+BxiBaJ558Dx6P5/W3M8EDIgUIy8gVoq60cOVD9+rzEioa787TO1H0gYQiCnXlVYm D3P2BYBfiQSBKzoYfSzdCQDFe8951nJoR4qS6DB4= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 09/10] docs/system: virtio-gpu: Update Venus link Date: Sun, 9 Nov 2025 19:47:10 +0300 Message-ID: <20251109164711.686873-10-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762707023909158500 Content-Type: text/plain; charset="utf-8" Change virtio-gpu Venus link, pointing it at the Mesa Venus documentation instead of the protocol. The Mesa doc provides more information and also has a link to the protocol. Suggested-by: Akihiko Odaki Reviewed-by: Akihiko Odaki Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko --- docs/system/devices/virtio/virtio-gpu.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/system/devices/virtio/virtio-gpu.rst b/docs/system/device= s/virtio/virtio-gpu.rst index 89153103b9f8..ef5fb0401d5d 100644 --- a/docs/system/devices/virtio/virtio-gpu.rst +++ b/docs/system/devices/virtio/virtio-gpu.rst @@ -83,7 +83,7 @@ of virtio-gpu host memory window. This is typically betwe= en 256M and 8G. .. parsed-literal:: -device virtio-gpu-gl,hostmem=3D8G,blob=3Dtrue,venus=3Dtrue =20 -.. _venus: https://gitlab.freedesktop.org/virgl/venus-protocol/ +.. _venus: https://docs.mesa3d.org/drivers/venus.html =20 DRM native context is supported since release of `virglrenderer`_ v1.0.0 using `drm`_ protocol. ``DRM`` virtio-gpu capability set ("capset") requi= res --=20 2.51.1 From nobody Fri Nov 14 16:47:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); dmarc=pass(p=none dis=none) header.from=collabora.com ARC-Seal: i=2; a=rsa-sha256; t=1762707046; cv=pass; d=zohomail.com; s=zohoarc; b=G4nmSvmt5+XWzhEKZVgqcfukBKpHRAOPE0b6ipBh8HVSqvM/q3r6RwAPDJvBwXAm4H8G1q9B3FZzXUIUJRqfF+837mI+ig7UMxZehYj0UDI6sOUp0nR4iWSNEnKiMcruDmxrSU2PYZ9Zyr3UPmSu6bH5Rm98wHp0455RbjGu94Y= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762707046; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4yStiIrw/Erg38g4/Q3HvaLqXs9jgX/hWgQqgDr2Iu0=; b=a627K0jv47uDjkqvc5YiKPKTsjCXo2I/uPV+3BDvIuMESW89x/9l8texGLm8cUBBNlMaTrt8gAWE/d4BkpIbgv9U6ccv8Gu504xc3tqUyJ+7j/EKiEGR4BuJ86cLJv3NNEWY2kG2KTp03U8v2zKYGmodANbKQo9jD1uy+VtY3MQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dmitry.osipenko@collabora.com; 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; arc=pass (i=1 dmarc=pass fromdomain=collabora.com); 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 1762707045972233.9077492510619; Sun, 9 Nov 2025 08:50:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vI8c8-0002fE-4g; Sun, 09 Nov 2025 11:50:04 -0500 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 1vI8c4-0002VH-UZ for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:50:00 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vI8c2-0000CB-VD for qemu-devel@nongnu.org; Sun, 09 Nov 2025 11:50:00 -0500 Received: by mx.zohomail.com with SMTPS id 1762706982789133.95579743319695; Sun, 9 Nov 2025 08:49:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762706985; cv=none; d=zohomail.com; s=zohoarc; b=jyZtbwklkk3zSVP/zySoh37uBEih6UIK8eLRiUtCSK5yjOEx1H4tPANxn45U3TC9FC8aJIl77pFr1nZjH0QdlqUrO1nZk5jb1bmKb9ZQb1xRtfXHbe7YucVaDQX3L7oagsS2xxDl9hGrgp3I0cPaN8ZArtIMggeTwx49xNtermM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762706985; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=4yStiIrw/Erg38g4/Q3HvaLqXs9jgX/hWgQqgDr2Iu0=; b=i726GbMtFp8PWqX9Ai0L/KswBth0y1Had/cmcF1WvF8FDBRGsDQSPoiGrnlgSpMXdpPHpokvh5GWHhJ8WQNhfojkN2WEeM+XlJcPm0BlnqcEgSXmxd3zMdKHGphWu+c7/Jyzbpm1Z2YCfqciDOVk1PTVYb6BSU47F38feEMYE40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1762706985; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=4yStiIrw/Erg38g4/Q3HvaLqXs9jgX/hWgQqgDr2Iu0=; b=Ixxq2mvVOpHCTb+2dqsQ2BIj1mb3hTyBmSTOxZhfKgXEuUGcttfXPgZvHofXRULe UkS6q94ivbyXiDzjyRtCNEDCoq42Mtu3lI16fZo+h6YEONRZDUEpepzNamB+SlSRD+Z 7B+dZglJfjSA+UhleEM5E3dX63aMLsaQIOoye5UM= From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Yiwei Zhang , Sergio Lopez Pascual Subject: [PATCH v15 10/10] docs/system: virtio-gpu: Document host/guest requirements Date: Sun, 9 Nov 2025 19:47:11 +0300 Message-ID: <20251109164711.686873-11-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251109164711.686873-1-dmitry.osipenko@collabora.com> References: <20251109164711.686873-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.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, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 dmitry.osipenko@collabora.com) X-ZM-MESSAGEID: 1762707048507158500 From: Alex Benn=C3=A9e This attempts to tidy up the VirtIO GPU documentation to make the list of requirements clearer. There are still a lot of moving parts and the distros have some catching up to do before this is all handled automatically. Signed-off-by: Alex Benn=C3=A9e Cc: Sergio Lopez Pascual Reviewed-by: Akihiko Odaki Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Yiwei Zhang Signed-off-by: Dmitry Osipenko [dmitry.osipenko@collabora.com: Extended and corrected doc] --- docs/system/devices/virtio/virtio-gpu.rst | 100 +++++++++++++++++++++- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/docs/system/devices/virtio/virtio-gpu.rst b/docs/system/device= s/virtio/virtio-gpu.rst index ef5fb0401d5d..cdba4669f518 100644 --- a/docs/system/devices/virtio/virtio-gpu.rst +++ b/docs/system/devices/virtio/virtio-gpu.rst @@ -7,14 +7,28 @@ VirtIO GPU =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 This document explains the setup and usage of the virtio-gpu device. -The virtio-gpu device paravirtualizes the GPU and display controller. +The virtio-gpu device provides a GPU and display controller +paravirtualized using VirtIO. It supports a number of different modes +from simple 2D displays to fully accelerated 3D graphics. =20 -Linux kernel support --------------------- +Linux guest kernel support +-------------------------- =20 virtio-gpu requires a guest Linux kernel built with the ``CONFIG_DRM_VIRTIO_GPU`` option. =20 +3D acceleration +--------------- + +3D acceleration of a virtualized GPU is still an evolving field. +Depending on the 3D mode you are running you may need to override +distribution supplied libraries with more recent versions or enable +build options. There are a number of requirements the host must meet +to be able to be able to support guests. QEMU must be able to access the +host's GPU and for the best performance be able to reliably share GPU +memory with the guest. Details of 3D acceleration requirements are +described in a further sections. + QEMU virtio-gpu variants ------------------------ =20 @@ -67,8 +81,14 @@ intermediate representation is communicated to the host = and the `virglrenderer`_ library on the host translates the intermediate representation back to OpenGL API calls. =20 +By default OpenGL version on guest is limited to 4.3. In order to enable +OpenGL 4.6 support, virtio-gpu host blobs feature (``hostmem`` and ``blob= `` +fields) should be enabled. The ``hostmem`` field specifies the size of +virtio-gpu host memory window. This is typically between 256M and 8G. + .. parsed-literal:: -device virtio-gpu-gl + -device virtio-gpu-gl,hostmem=3D8G,blob=3Dtrue =20 .. _virgl: https://docs.mesa3d.org/drivers/virgl.html .. _Gallium3D: https://www.freedesktop.org/wiki/Software/gallium/ @@ -96,6 +116,62 @@ of virtio-gpu host memory window. This is typically bet= ween 256M and 8G. =20 .. _drm: https://gitlab.freedesktop.org/virgl/virglrenderer/-/tree/main/sr= c/drm =20 +.. list-table:: Linux Host Requirements + :header-rows: 1 + + * - Capability + - Kernel Version + - Libvirglrenderer Version + * - OpenGL pass-through + - Any Linux version compatible with QEMU if not using host blobs featu= re, + Linux 6.13+ otherwise + - 0.8.2+ + * - Vulkan pass-through + - Linux 6.13+ + - 1.0.0+ + * - AMDGPU DRM native context + - Linux 6.13+ + - 1.1.0+ + * - Freedreno DRM native context + - Linux 6.4+ + - 1.0.0+ + * - Intel i915 DRM native context + - Linux 6.13+ + - `mr1384`_ + * - Asahi DRM native context + - `Downstream version`_ of Asahi Linux kernel + - 1.2.0+ + +.. _mr1384: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_req= uests/1384 +.. _Downstream version: https://github.com/AsahiLinux/linux + +.. list-table:: Linux Guest Requirements + :header-rows: 1 + + * - Capability + - Kernel Version + - Mesa Version + * - OpenGL pass-through + - Any Linux version supporting virtio-gpu + - 16.0.0+ + * - Vulkan pass-through + - Linux 5.16+ + - 24.2.0+ + * - AMDGPU DRM native context + - Linux 6.14+ + - 25.0.0+ + * - Freedreno DRM native context + - Linux 6.14+ + - 23.1.0+ + * - Intel i915 DRM native context + - Linux 6.14+ + - `mr29870`_ + * - Asahi DRM native context + - Linux 6.14+ + - 24.2.0+ + +.. _mr29870: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/298= 70 + virtio-gpu rutabaga ------------------- =20 @@ -135,3 +211,21 @@ Surfaceless is the default if ``wsi`` is not specified. .. _Wayland display passthrough: https://www.youtube.com/watch?v=3DOZJiHMt= IQ2M .. _gfxstream-enabled rutabaga: https://crosvm.dev/book/appendix/rutabaga_= gfx.html .. _guest Wayland proxy: https://crosvm.dev/book/devices/wayland.html + +.. list-table:: Linux Host Requirements + :header-rows: 1 + + * - Capability + - Kernel Version + * - Vulkan+Wayland pass-through + - Linux 6.13+ + +.. list-table:: Linux Guest Requirements + :header-rows: 1 + + * - Capability + - Kernel Version + - Mesa Version + * - Vulkan+Wayland pass-through + - Linux 5.16+ + - 24.3.0+ --=20 2.51.1