From nobody Sun Dec 7 00:31:00 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@getutm.app; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=getutm.app ARC-Seal: i=1; a=rsa-sha256; t=1764734975; cv=none; d=zohomail.com; s=zohoarc; b=DXpzNwPrX5HfqtRK4RFDcrYZ29+8utp9t/rfQXl8/R7cEUCc3ycUHedh97xuUxN/b+e8CD15Lct/4CODD8rYjXUe5A3vMApMJpQEr4e0FRqvROJ69QfCt2kSDYPHyvahromqoJBLcUUUztXYcpYd7c2QXtLBVEjoR5t/cWxdJ6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764734975; 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=t2hSA2aZm2p5K2v/2+0k+47nX6YefsgPefSG/xZ7xYQ=; b=SqbLePqqps7NhThwAk1yo05O3LNQhfCxBHBOyaJYTz9F5mCrz1AeApWcs3qTz6nfUbu8tlew/MQIk/EWFYzHgYag1/taiPI+NMYtBAHF+Ubl6XiNDVuKyQfZe2WjDKioI3+Y6N48bt0uinIWdHkGAoGwehXprYIupkol9aVmnx0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@getutm.app; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1764734975932576.2339550240156; Tue, 2 Dec 2025 20:09:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vQeAK-0002Gw-Dw; Tue, 02 Dec 2025 23:08: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 1vQeAI-0002FK-2v for qemu-devel@nongnu.org; Tue, 02 Dec 2025 23:08:30 -0500 Received: from a4i956.smtp2go.com ([158.120.83.188]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vQeAG-0000Tm-7R for qemu-devel@nongnu.org; Tue, 02 Dec 2025 23:08:29 -0500 Received: from [10.159.238.187] (helo=localhost.localdomain) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA512__CHACHA20_POLY1305:256) (Exim 4.98.1-S2G) (envelope-from ) id 1vQe9w-FnQW0hPv7oK-VRbB; Wed, 03 Dec 2025 04:08:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getutm.app; i=@getutm.app; q=dns/txt; s=s483429; t=1764734897; h=from : subject : to : message-id : date; bh=t2hSA2aZm2p5K2v/2+0k+47nX6YefsgPefSG/xZ7xYQ=; b=IkDr0+AZSLWFzHu4fhcNqcbxqtM+XWloNtwBIf6y9tHT4TCzuUW/VNND6AWbqEj5G/8F0 ysr9ZBKoiMzkD3Jv/UgTsxu9duDkuljXP8AxosLrpbqIGuYaZFYOF466Xf/8GBEw/XsQTaA Dt3LEa2Uhy4fRCrGkMEE9qT1oxvssKoLCMP2O9sfShtlssejtVdLk3paGoE/VewZrRHScP7 fvVooJpiBwRBk2ocTR8+te0zjJclEX+pQO1rrKoDn2B1xA1sosQzuesGJQZC6aO/E0avq7r I7LFbHdV5H6gg+xNgWU0ZxE/Y0/QIFF/KejsrQws8GDlNTQgRji+LiVfElfQ== From: Joelle van Dyne To: qemu-devel@nongnu.org Cc: Joelle van Dyne , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Akihiko Odaki , Dmitry Osipenko , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH RFC 3/7] console: rename `d3d_tex2d` to `native` Date: Tue, 2 Dec 2025 20:07:50 -0800 Message-ID: <20251203040754.94487-4-j@getutm.app> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20251203040754.94487-1-j@getutm.app> References: <20251203040754.94487-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please forward a copy of this message, including all headers, to Feedback-ID: 483429m:483429abrvJvs:483429spaCCUDkCQ X-smtpcorp-track: iJ4-QIeWLwFb.WD-PV-WpqZNw.70BfGwS9teO 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=158.120.83.188; envelope-from=bounce.s384pp0ozqvjgd6=vdkusp7nqj4f=i31w8pilfqsxvs@em483429.getutm.app; helo=a4i956.smtp2go.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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 @getutm.app) X-ZM-MESSAGEID: 1764734977363019200 Content-Type: text/plain; charset="utf-8" In order to support native texture scanout beyond D3D, we make this more generic allowing for multiple native texture handle types. Signed-off-by: Joelle van Dyne --- include/ui/console.h | 22 +++++++++++++++++++--- include/ui/gtk.h | 4 ++-- include/ui/sdl2.h | 2 +- hw/display/virtio-gpu-virgl.c | 10 +++++++--- ui/console.c | 8 ++++---- ui/dbus-console.c | 2 +- ui/dbus-listener.c | 8 ++++---- ui/egl-headless.c | 2 +- ui/gtk-egl.c | 2 +- ui/gtk-gl-area.c | 2 +- ui/sdl2-gl.c | 2 +- ui/spice-display.c | 2 +- 12 files changed, 43 insertions(+), 23 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 98feaa58bd..25e45295d4 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -131,6 +131,22 @@ struct QemuConsoleClass { ObjectClass parent_class; }; =20 +typedef enum ScanoutTextureNativeType { + SCANOUT_TEXTURE_NATIVE_TYPE_NONE, + SCANOUT_TEXTURE_NATIVE_TYPE_D3D, +} ScanoutTextureNativeType; + +typedef struct ScanoutTextureNative { + ScanoutTextureNativeType type; + union { + void *d3d_tex2d; + } u; +} ScanoutTextureNative; + +#define NO_NATIVE_TEXTURE ((ScanoutTextureNative){ \ + .type =3D SCANOUT_TEXTURE_NATIVE_TYPE_NONE \ +}) + typedef struct ScanoutTexture { uint32_t backing_id; bool backing_y_0_top; @@ -140,7 +156,7 @@ typedef struct ScanoutTexture { uint32_t y; uint32_t width; uint32_t height; - void *d3d_tex2d; + ScanoutTextureNative native; } ScanoutTexture; =20 typedef struct QemuUIInfo { @@ -245,7 +261,7 @@ typedef struct DisplayChangeListenerOps { uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d); + ScanoutTextureNative native); /* optional (default to true if has dpy_gl_scanout_dmabuf) */ bool (*dpy_has_dmabuf)(DisplayChangeListener *dcl); /* optional */ @@ -329,7 +345,7 @@ void dpy_gl_scanout_texture(QemuConsole *con, uint32_t backing_id, bool backing_y_0_top, uint32_t backing_width, uint32_t backing_heigh= t, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d); + ScanoutTextureNative native); void dpy_gl_scanout_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf); void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf, diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 3e6ce3cb48..f88e2b281d 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -178,7 +178,7 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d); + ScanoutTextureNative native); void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf); void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl, @@ -215,7 +215,7 @@ void gd_gl_area_scanout_texture(DisplayChangeListener *= dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d); + ScanoutTextureNative native); void gd_gl_area_scanout_disable(DisplayChangeListener *dcl); void gd_gl_area_scanout_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t= h); diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index dbe6e3d973..fdefb88229 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -93,7 +93,7 @@ void sdl2_gl_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d); + ScanoutTextureNative native); void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); =20 diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index adf02ac22b..d0e6ad4b17 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -434,14 +434,18 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g, =20 if (ss.resource_id && ss.r.width && ss.r.height) { struct virgl_renderer_resource_info info; - void *d3d_tex2d =3D NULL; + ScanoutTextureNative native =3D { .type =3D SCANOUT_TEXTURE_NATIVE= _TYPE_NONE }; =20 #if VIRGL_VERSION_MAJOR >=3D 1 struct virgl_renderer_resource_info_ext ext; memset(&ext, 0, sizeof(ext)); ret =3D virgl_renderer_resource_get_info_ext(ss.resource_id, &ext); info =3D ext.base; - d3d_tex2d =3D ext.d3d_tex2d; + native =3D (ScanoutTextureNative){ + .type =3D ext.d3d_tex2d ? SCANOUT_TEXTURE_NATIVE_TYPE_D3D : + SCANOUT_TEXTURE_NATIVE_TYPE_NONE, + .u.d3d_tex2d =3D ext.d3d_tex2d, + }; #else memset(&info, 0, sizeof(info)); ret =3D virgl_renderer_resource_get_info(ss.resource_id, &info); @@ -461,7 +465,7 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g, info.flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP, info.width, info.height, ss.r.x, ss.r.y, ss.r.width, ss.r.height, - d3d_tex2d); + native); } else { dpy_gfx_replace_surface( g->parent_obj.scanout[ss.scanout_id].con, NULL); diff --git a/ui/console.c b/ui/console.c index 2d00828c53..9378afd53d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -295,7 +295,7 @@ static void displaychangelistener_display_console(Displ= ayChangeListener *dcl, con->scanout.texture.y, con->scanout.texture.width, con->scanout.texture.height, - con->scanout.texture.d3d_tex2d); + con->scanout.texture.native); } } =20 @@ -1023,7 +1023,7 @@ void dpy_gl_scanout_texture(QemuConsole *con, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t width, uint32_t height, - void *d3d_tex2d) + ScanoutTextureNative native) { DisplayState *s =3D con->ds; DisplayChangeListener *dcl; @@ -1031,7 +1031,7 @@ void dpy_gl_scanout_texture(QemuConsole *con, con->scanout.kind =3D SCANOUT_TEXTURE; con->scanout.texture =3D (ScanoutTexture) { backing_id, backing_y_0_top, backing_width, backing_height, - x, y, width, height, d3d_tex2d, + x, y, width, height, native, }; QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D dcl->con) { @@ -1042,7 +1042,7 @@ void dpy_gl_scanout_texture(QemuConsole *con, backing_y_0_top, backing_width, backing_height, x, y, width, height, - d3d_tex2d); + native); } } } diff --git a/ui/dbus-console.c b/ui/dbus-console.c index 85e215ef23..651f0daeaf 100644 --- a/ui/dbus-console.c +++ b/ui/dbus-console.c @@ -99,7 +99,7 @@ dbus_gl_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d) + ScanoutTextureNative native) { DBusDisplayConsole *ddc =3D container_of(dcl, DBusDisplayConsole, dcl); =20 diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 52e041edb0..a737752996 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -587,7 +587,7 @@ static void dbus_scanout_texture(DisplayChangeListener = *dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d) + ScanoutTextureNative native) { trace_dbus_scanout_texture(tex_id, backing_y_0_top, backing_width, backing_height, x, y, w, h); @@ -618,8 +618,8 @@ static void dbus_scanout_texture(DisplayChangeListener = *dcl, assert(surface_width(ddl->ds) =3D=3D w); assert(surface_height(ddl->ds) =3D=3D h); =20 - if (d3d_tex2d) { - dbus_scanout_share_d3d_texture(ddl, d3d_tex2d, backing_y_0_top, + if (native.type =3D=3D SCANOUT_TEXTURE_NATIVE_TYPE_D3d) { + dbus_scanout_share_d3d_texture(ddl, native.u.d3d_tex2d, backing_y_= 0_top, backing_width, backing_height, x, y= , w, h); } else { dbus_scanout_map(ddl); @@ -868,7 +868,7 @@ static void dbus_gl_gfx_switch(DisplayChangeListener *d= cl, =20 /* TODO: lazy send dmabuf (there are unnecessary sent otherwise) */ dbus_scanout_texture(&ddl->dcl, ddl->ds->texture, false, - width, height, 0, 0, width, height, NULL); + width, height, 0, 0, width, height, NO_NATIVE= _TEXTURE); } } #endif diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 1f6b845500..e36778bd48 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -62,7 +62,7 @@ static void egl_scanout_texture(DisplayChangeListener *dc= l, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d) + ScanoutTextureNative native) { egl_dpy *edpy =3D container_of(dcl, egl_dpy, dcl); =20 diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index ae9239999c..7933237d45 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -239,7 +239,7 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_width, uint32_t backing_heigh= t, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d) + ScanoutTextureNative native) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index cd86022d26..f2ed543d6a 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -306,7 +306,7 @@ void gd_gl_area_scanout_texture(DisplayChangeListener *= dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d) + ScanoutTextureNative native) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index 3be17d1079..b15db86f24 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -206,7 +206,7 @@ void sdl2_gl_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d) + ScanoutTextureNative native) { struct sdl2_console *scon =3D container_of(dcl, struct sdl2_console, d= cl); =20 diff --git a/ui/spice-display.c b/ui/spice-display.c index db71e866f8..2a2285cb1f 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1084,7 +1084,7 @@ static void qemu_spice_gl_scanout_texture(DisplayChan= geListener *dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h, - void *d3d_tex2d) + ScanoutTextureNative native) { SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); EGLint offset[DMABUF_MAX_PLANES], stride[DMABUF_MAX_PLANES], fourcc = =3D 0; --=20 2.41.0