From nobody Sat Apr 11 23:05:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.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; dmarc=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772543396082268.011214531953; Tue, 3 Mar 2026 05:09:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxPVS-0007nj-Vm; Tue, 03 Mar 2026 08:09:47 -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 1vxPV9-0007RH-Nm for qemu-devel@nongnu.org; Tue, 03 Mar 2026 08:09:36 -0500 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxPUz-0000Ni-9J for qemu-devel@nongnu.org; Tue, 03 Mar 2026 08:09:22 -0500 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 623D90Jc018783 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 3 Mar 2026 22:09:11 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=SProQHUBdazPBUcxN+pk1vSRrVcqnXiyNpUMfkAiDRw=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1772543351; v=1; b=qUxjDk/i/psGgQepkrcs0MEUNHFm/OgkvAiYXCplA4BJj7BI+DNOr93085C0Ks76 jTNtJE3sK/Ek3gKY99JYACTkhGhlKYQwGn4jLL2zagqCcYF1QMCRZQY+tJqLBf5K hd+qXvCpHb0FB64uVHI/fptznsjKDyLCH05yWJKhK0ZR3dZJNQe04bkd2HdtDDZS EtDDjScV3gscM57Ysnxf4p3Ebz3ayFfhicVprIbRO+WYTbXXJ6UltliZpoFTrHGB skB+9cdaWOtl/5IWM/6uZ2+bP0ZPudE3PCANwfg6azr9E/CqQpayPfGMTwXA/Wdx 4uwDQnCMdA8ofUSBZBC0VA== From: Akihiko Odaki Date: Tue, 03 Mar 2026 22:08:54 +0900 Subject: [PATCH 1/3] ui/console: Unify pixman-OpenGL format mapping MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260303-gl-v1-1-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> References: <20260303-gl-v1-0-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260303-gl-v1-0-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Akihiko Odaki X-Mailer: b4 0.15-dev-5ab4c 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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-ZM-MESSAGEID: 1772544100167158500 console_gl_check_format() was supposed to check if the pixman format is supported by surface_gl_create_texture(), but it missed PIXMAN_BE_x8r8g8b8 and PIXMAN_BE_a8r8g8b8, which are properly mapped to OpenGL formats by surface_gl_create_texture(). Fix the discrepancy of the two functions by sharing the code to map pixman formats to OpenGL ones. Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau --- ui/console-gl.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/ui/console-gl.c b/ui/console-gl.c index 403fc36fbdf2..22e9787c4156 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -31,19 +31,38 @@ =20 /* ---------------------------------------------------------------------- = */ =20 -bool console_gl_check_format(DisplayChangeListener *dcl, - pixman_format_code_t format) +static bool map_format(pixman_format_code_t format, + GLenum *glformat, GLenum *gltype) { switch (format) { case PIXMAN_BE_b8g8r8x8: case PIXMAN_BE_b8g8r8a8: + *glformat =3D GL_BGRA_EXT; + *gltype =3D GL_UNSIGNED_BYTE; + return true; + case PIXMAN_BE_x8r8g8b8: + case PIXMAN_BE_a8r8g8b8: + *glformat =3D GL_RGBA; + *gltype =3D GL_UNSIGNED_BYTE; + return true; case PIXMAN_r5g6b5: + *glformat =3D GL_RGB; + *gltype =3D GL_UNSIGNED_SHORT_5_6_5; return true; default: return false; } } =20 +bool console_gl_check_format(DisplayChangeListener *dcl, + pixman_format_code_t format) +{ + GLenum glformat; + GLenum gltype; + + return map_format(format, &glformat, &gltype); +} + void surface_gl_create_texture(QemuGLShader *gls, DisplaySurface *surface) { @@ -54,25 +73,7 @@ void surface_gl_create_texture(QemuGLShader *gls, return; } =20 - switch (surface_format(surface)) { - case PIXMAN_BE_b8g8r8x8: - case PIXMAN_BE_b8g8r8a8: - surface->glformat =3D GL_BGRA_EXT; - surface->gltype =3D GL_UNSIGNED_BYTE; - break; - case PIXMAN_BE_x8r8g8b8: - case PIXMAN_BE_a8r8g8b8: - surface->glformat =3D GL_RGBA; - surface->gltype =3D GL_UNSIGNED_BYTE; - break; - case PIXMAN_r5g6b5: - surface->glformat =3D GL_RGB; - surface->gltype =3D GL_UNSIGNED_SHORT_5_6_5; - break; - default: - g_assert_not_reached(); - } - + assert(map_format(surface_format(surface), &surface->glformat, &surfac= e->gltype)); glGenTextures(1, &surface->texture); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, surface->texture); --=20 2.53.0 From nobody Sat Apr 11 23:05:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.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; dmarc=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772543405536448.62345955938645; Tue, 3 Mar 2026 05:10:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxPVT-0007pD-7O; Tue, 03 Mar 2026 08:09:48 -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 1vxPV9-0007RF-NR for qemu-devel@nongnu.org; Tue, 03 Mar 2026 08:09:36 -0500 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxPUz-0000Nj-9J for qemu-devel@nongnu.org; Tue, 03 Mar 2026 08:09:22 -0500 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 623D90Jd018783 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 3 Mar 2026 22:09:11 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=S4C+88C0SUBLbaqYPf8jQpMtM8zDaqeRVmdrCn0YM0E=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1772543351; v=1; b=qGGG8VJIhKGLVzdl+BWacpss+4QJVA00y7F1fL1436l7b76DfnHPBeoeLyacEcqt Ei21zRCCMeiDRpiIGuDscDksAS/+BMdaHn2emFQ/x7noT+MyvijyZuWoesIh6Ft0 i9JzT4wLE7LDnWAgO7kuVx7G0NQPxLL2p9TVtqUi4A2NjwEmNwUFELYjf1/2JW2S PQCqHVaM4x+2JVICMXZPGXNNIFAKi8cfahDhpXJBpfo+Rn95R7sT8tVv60v4Oizx 1h0/tMXKNctSSWpwmYC1HkCpKpiKqqum/PKSJJQnx3aqEr2kzCr0hGi6l6h6F9qG P+ikeCqOMkj/krvE6tfr1g== From: Akihiko Odaki Date: Tue, 03 Mar 2026 22:08:55 +0900 Subject: [PATCH 2/3] ui/console: Remove DisplaySurface::mem_obj MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260303-gl-v1-2-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> References: <20260303-gl-v1-0-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260303-gl-v1-0-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Akihiko Odaki X-Mailer: b4 0.15-dev-5ab4c 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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-ZM-MESSAGEID: 1772543962535139100 Only spice uses it so move it to spice. Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/ui/spice-display.h | 1 + include/ui/surface.h | 1 - ui/console-gl.c | 6 ------ ui/spice-display.c | 9 ++++++++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index 690ece73801e..a382553fa8e3 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -121,6 +121,7 @@ struct SimpleSpiceDisplay { QEMUBH *gl_unblock_bh; QEMUTimer *gl_unblock_timer; QemuGLShader *gls; + GLuint gl_surface_mem_obj; int gl_updates; bool have_scanout; bool have_surface; diff --git a/include/ui/surface.h b/include/ui/surface.h index 006b1986bb95..f16f7be8be81 100644 --- a/include/ui/surface.h +++ b/include/ui/surface.h @@ -22,7 +22,6 @@ typedef struct DisplaySurface { GLenum glformat; GLenum gltype; GLuint texture; - GLuint mem_obj; #endif qemu_pixman_shareable share_handle; uint32_t share_handle_offset; diff --git a/ui/console-gl.c b/ui/console-gl.c index 22e9787c4156..73be35c1fc78 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -185,12 +185,6 @@ void surface_gl_destroy_texture(QemuGLShader *gls, } glDeleteTextures(1, &surface->texture); surface->texture =3D 0; -#ifdef GL_EXT_memory_object_fd - if (surface->mem_obj) { - glDeleteMemoryObjectsEXT(1, &surface->mem_obj); - surface->mem_obj =3D 0; - } -#endif } =20 void surface_gl_setup_viewport(QemuGLShader *gls, diff --git a/ui/spice-display.c b/ui/spice-display.c index 28399f8a8174..789a67010522 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -950,7 +950,14 @@ static bool spice_gl_replace_fd_texture(SimpleSpiceDis= play *ssd, } else { surface_gl_destroy_texture(ssd->gls, ssd->ds); ssd->ds->texture =3D texture; - ssd->ds->mem_obj =3D mem_obj; + +#ifdef GL_EXT_memory_object_fd + if (ssd->gl_surface_mem_obj) { + glDeleteMemoryObjectsEXT(1, &ssd->gl_surface_mem_obj); + } + + ssd->gl_surface_mem_obj =3D mem_obj; +#endif } return ret; } --=20 2.53.0 From nobody Sat Apr 11 23:05:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.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; dmarc=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772543488055319.1682070819613; Tue, 3 Mar 2026 05:11:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxPVV-0007wF-Mv; Tue, 03 Mar 2026 08:09:49 -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 1vxPVA-0007RU-J6 for qemu-devel@nongnu.org; Tue, 03 Mar 2026 08:09:36 -0500 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxPUz-0000Nk-5x for qemu-devel@nongnu.org; Tue, 03 Mar 2026 08:09:22 -0500 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 623D90Je018783 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 3 Mar 2026 22:09:11 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=vKmzwmUyPdcq+hYe6gh7JqKYAafIRCDgFX2ryEYv01E=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1772543351; v=1; b=J2km3fHY+p6LbdhjAGOJhjSXiqx/6PikqAYZUTANdrxuSby3k+WdqQIEBjuQgJLE xYUdl8oHueyaAkrE6Et1gdgEYx9mKANbmjw9BoSXm3gcae/DKq8WeEfXeFYZvfQe luOVAEux8MqYZYHAmPuwOar0ab0k3T6Li2326iN4JfYDbK6pZnpoYkxPKjjIlSwX HBZ2NcIieAUAID6joFIzB6ogtfG6SN2NbLh0Ct2cmgMfn2RV9wOjw9vfJMhJNRB2 yiOgl2s11fBn/4qeB0jP97AjNVIgktd/xEXx4FN2yJ1xNE2n4lWmKRp/+U74g0xR 0cyw7DFtaX93XZSmQoBtcQ== From: Akihiko Odaki Date: Tue, 03 Mar 2026 22:08:56 +0900 Subject: [PATCH 3/3] ui/surface: Avoid including epoxy/gl.h in header files MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260303-gl-v1-3-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> References: <20260303-gl-v1-0-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260303-gl-v1-0-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Akihiko Odaki X-Mailer: b4 0.15-dev-5ab4c 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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-ZM-MESSAGEID: 1772543587910154100 include/ui/shader.h and include/ui/surface.h are included by files that do not depend on Epoxy so they shouldn't include epoxy/gl.h. Otherwise, compilations of these files can fail because the path to the directory containing epoxy/gl.h may not be passed to the compiler. Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 4 ++-- include/ui/shader.h | 2 -- include/ui/surface.h | 5 +---- ui/console-gl.c | 27 ++++++++++++++------------- ui/shader.c | 1 + 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 98feaa58bdd1..9ac1e5b82daa 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -423,8 +423,8 @@ bool console_gl_check_format(DisplayChangeListener *dcl, void surface_gl_create_texture(QemuGLShader *gls, DisplaySurface *surface); bool surface_gl_create_texture_from_fd(DisplaySurface *surface, - int fd, GLuint *texture, - GLuint *mem_obj); + int fd, uint32_t *texture, + uint32_t *mem_obj); void surface_gl_update_texture(QemuGLShader *gls, DisplaySurface *surface, int x, int y, int w, int h); diff --git a/include/ui/shader.h b/include/ui/shader.h index 4c5acb2ce8b2..e82213263c47 100644 --- a/include/ui/shader.h +++ b/include/ui/shader.h @@ -1,8 +1,6 @@ #ifndef QEMU_SHADER_H #define QEMU_SHADER_H =20 -#include - typedef struct QemuGLShader QemuGLShader; =20 void qemu_gl_run_texture_blit(QemuGLShader *gls, bool flip); diff --git a/include/ui/surface.h b/include/ui/surface.h index f16f7be8be81..d2542d3ace5f 100644 --- a/include/ui/surface.h +++ b/include/ui/surface.h @@ -8,7 +8,6 @@ #include "ui/qemu-pixman.h" =20 #ifdef CONFIG_OPENGL -# include # include "ui/shader.h" #endif =20 @@ -19,9 +18,7 @@ typedef struct DisplaySurface { pixman_image_t *image; uint8_t flags; #ifdef CONFIG_OPENGL - GLenum glformat; - GLenum gltype; - GLuint texture; + uint32_t texture; #endif qemu_pixman_shareable share_handle; uint32_t share_handle_offset; diff --git a/ui/console-gl.c b/ui/console-gl.c index 73be35c1fc78..d4b9017b53de 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include #include "qemu/error-report.h" #include "ui/console.h" #include "ui/shader.h" @@ -66,6 +67,9 @@ bool console_gl_check_format(DisplayChangeListener *dcl, void surface_gl_create_texture(QemuGLShader *gls, DisplaySurface *surface) { + GLenum glformat; + GLenum gltype; + assert(gls); assert(QEMU_IS_ALIGNED(surface_stride(surface), surface_bytes_per_pixe= l(surface))); =20 @@ -73,7 +77,7 @@ void surface_gl_create_texture(QemuGLShader *gls, return; } =20 - assert(map_format(surface_format(surface), &surface->glformat, &surfac= e->gltype)); + assert(map_format(surface_format(surface), &glformat, &gltype)); glGenTextures(1, &surface->texture); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, surface->texture); @@ -81,16 +85,12 @@ void surface_gl_create_texture(QemuGLShader *gls, surface_stride(surface) / surface_bytes_per_pixel(surfac= e)); if (epoxy_is_desktop_gl()) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - surface_width(surface), - surface_height(surface), - 0, surface->glformat, surface->gltype, - surface_data(surface)); + surface_width(surface), surface_height(surface), 0, + glformat, gltype, surface_data(surface)); } else { - glTexImage2D(GL_TEXTURE_2D, 0, surface->glformat, - surface_width(surface), - surface_height(surface), - 0, surface->glformat, surface->gltype, - surface_data(surface)); + glTexImage2D(GL_TEXTURE_2D, 0, glformat, + surface_width(surface), surface_height(surface), 0, + glformat, gltype, surface_data(surface)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE); } =20 @@ -150,17 +150,18 @@ void surface_gl_update_texture(QemuGLShader *gls, int x, int y, int w, int h) { uint8_t *data =3D (void *)surface_data(surface); + GLenum glformat; + GLenum gltype; =20 assert(gls); + assert(map_format(surface_format(surface), &glformat, &gltype)); =20 if (surface->texture) { glBindTexture(GL_TEXTURE_2D, surface->texture); glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, surface_stride(surface) / surface_bytes_per_pixel(surface)); - glTexSubImage2D(GL_TEXTURE_2D, 0, - x, y, w, h, - surface->glformat, surface->gltype, + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, glformat, gltype, data + surface_stride(surface) * y + surface_bytes_per_pixel(surface) * x); } diff --git a/ui/shader.c b/ui/shader.c index ab448c41d4c6..76ee4c32785d 100644 --- a/ui/shader.c +++ b/ui/shader.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include #include "ui/shader.h" =20 #include "ui/shader/texture-blit-vert.h" --=20 2.53.0