From nobody Tue Apr 7 00:01:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773768072; cv=none; d=zohomail.com; s=zohoarc; b=Hc1QMDeWujicmrqOV1CY1tPDo7iEHp3Tmxti+X2VcUPPXqvLWH8oYnrwGqAELSBAJy13y4t90Q5eYdXYjKRSrba5czlBV52wiDWtPBCF9DBrWIMQcClS+xf6tfBNTZ1gxKuVRkHXfN+84/mUyyf16IpxOIbGWN1TsCmeyIOJeLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773768072; 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=7QOJFna4uS6y0l2Y//8zT9IKmV+9rc6k0M7hg1PiLWI=; b=gUEsk+pN3GvOgTeQuTZlSSqcFh1Brxg10lUK5mIChGNL239a/Qb/PElh4pHQ6+EaXRLzPXz29sq/rD2vvH7b1TkB5lRQrqDnWjod6Rs7DVp85gJaIea9+myK1TJuJ+gigY/QXriRVImNC+wVX1g6aCLh9cDsJMaYTPmtXvGxqiA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773768072051844.0877417622429; Tue, 17 Mar 2026 10:21:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Y6F-0002d2-5N; Tue, 17 Mar 2026 13:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5z-0002RP-UN for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Y5y-0005cM-4a for qemu-devel@nongnu.org; Tue, 17 Mar 2026 13:20:43 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-377-uXL8NLHVNOaj0PsClM_3kA-1; Tue, 17 Mar 2026 13:20:30 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9456B19560B5; Tue, 17 Mar 2026 17:20:28 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 922F430001A1; Tue, 17 Mar 2026 17:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773768033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7QOJFna4uS6y0l2Y//8zT9IKmV+9rc6k0M7hg1PiLWI=; b=CNJbTVQMeDxh5Q7WC7tGnKdu/1uRXSdSwVPg6sBWFKnZUqz9Y3gorE7lCsCUINSEpuoxMn b7h0RLTh0h8wXVdE9vUbRvPOyTcAysDMYG5xVBd8+hK+RpGfb42s2NGeOojBGyiml44dwo VWkHaJLWMMe/tzyW29XK8qLCTiFVcyM= X-MC-Unique: uXL8NLHVNOaj0PsClM_3kA-1 X-Mimecast-MFC-AGG-ID: uXL8NLHVNOaj0PsClM_3kA_1773768028 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Christian Schoenebeck , Ani Sinha , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Zhao Liu , Marcel Apfelbaum , Yanan Wang , Akihiko Odaki Subject: [PULL 10/16] ui/console: Unify pixman-OpenGL format mapping Date: Tue, 17 Mar 2026 21:19:10 +0400 Message-ID: <20260317171916.438575-11-marcandre.lureau@redhat.com> In-Reply-To: <20260317171916.438575-1-marcandre.lureau@redhat.com> References: <20260317171916.438575-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773768074423154100 From: Akihiko Odaki 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 Message-Id: <20260303-gl-v1-1-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp> --- 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 403fc36fbdf..22e9787c415 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