From nobody Mon Feb 9 17:37:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1655209003; cv=none; d=zohomail.com; s=zohoarc; b=Bmnbt6WTf5HR+E8mQBC2OH2x6E4ma+ZyOwQPsOUes5PQpeS72/AMqusHHjJacVLk3n6aZ1j84xnT+eCZ56r9IqF6ReXQPMNCJPxPQf87rQ4W06YLyKQyqQFvt7MwgHOITpkDO54B2o+P4VwOmcyrbQt9iucdW136qJJUw6nAjOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655209003; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wx3J1U/WRMVytLzUKnVNwgCHbbzsbHu+DjsV7mqclmI=; b=JPldmSHpQhXyPnKAWZH4NFKMEUShNq6VTebxiFfh40pgDJefs2SVqYFujwSFhNGdnT4kToIILKG/LoCeKXcT7+zMbP13oFBNoKoXGUPGfy6yfZNvYFI5O/pH/qi7uADDaV9Br81v+Xle8Hx39PY6Ty/Wz/4FWz88tSf172NRYAU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 165520900330916.544018840934427; Tue, 14 Jun 2022 05:16:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.348866.575082 (Exim 4.92) (envelope-from ) id 1o15T5-0000bL-WC; Tue, 14 Jun 2022 12:16:24 +0000 Received: by outflank-mailman (output) from mailman id 348866.575082; Tue, 14 Jun 2022 12:16:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o15T5-0000Zv-SQ; Tue, 14 Jun 2022 12:16:23 +0000 Received: by outflank-mailman (input) for mailman id 348866; Tue, 14 Jun 2022 12:16:22 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o15T4-0008Ek-0H for xen-devel@lists.xenproject.org; Tue, 14 Jun 2022 12:16:22 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cc47154d-ebdb-11ec-bd2c-47488cf2e6aa; Tue, 14 Jun 2022 14:16:20 +0200 (CEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-wv2AtMAeNLyZQMhe_ogqMQ-1; Tue, 14 Jun 2022 08:16:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C4E4101E9B9; Tue, 14 Jun 2022 12:16:14 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0FD140CF8E5; Tue, 14 Jun 2022 12:16:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 08BE21800394; Tue, 14 Jun 2022 14:16:11 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cc47154d-ebdb-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655208978; 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=wx3J1U/WRMVytLzUKnVNwgCHbbzsbHu+DjsV7mqclmI=; b=OirqH9wYqTGhJQiCjAbwtwaUkjAo8xKxw8kPD1mzrqlfNMAydjysS+HWU3jO+efIAvFfEz /DySSivZ6/TK8G0n9sftWtfUp+MH3mBrm+9czpuwyt4nda0M/aUVizH3Lq5ckVtD6j8fW2 YVGtXTZWmtG5n63SXsNVI1T5MhejAzk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655208979; 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=wx3J1U/WRMVytLzUKnVNwgCHbbzsbHu+DjsV7mqclmI=; b=P9m/I5ISyZXS9xCLwC6D2Z0CeqwpX22GL6IEkIxouMY7AtlBvSd0H0NA+wdykE3pNrav6W kKkC7+d6U4duaFBKusweOtuf9g1SM45bm3soviRWn4T1IPTGetJd14HhXEOYLX0LyX/JVN Cvdz9zlYuEfySweP/9NY7aY7btTvkE4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655208979; 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=wx3J1U/WRMVytLzUKnVNwgCHbbzsbHu+DjsV7mqclmI=; b=P9m/I5ISyZXS9xCLwC6D2Z0CeqwpX22GL6IEkIxouMY7AtlBvSd0H0NA+wdykE3pNrav6W kKkC7+d6U4duaFBKusweOtuf9g1SM45bm3soviRWn4T1IPTGetJd14HhXEOYLX0LyX/JVN Cvdz9zlYuEfySweP/9NY7aY7btTvkE4= X-MC-Unique: wv2AtMAeNLyZQMhe_ogqMQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Peter Maydell , Alex Williamson , xen-devel@lists.xenproject.org, Paul Durrant , Anthony Perard , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" , "Michael S. Tsirkin" , "Canokeys.org" , Stefano Stabellini , Gerd Hoffmann , =?UTF-8?q?Volker=20R=C3=BCmelin?= Subject: [PULL 02/15] ui/gtk-gl-area: create the requested GL context version Date: Tue, 14 Jun 2022 14:15:57 +0200 Message-Id: <20220614121610.508356-3-kraxel@redhat.com> In-Reply-To: <20220614121610.508356-1-kraxel@redhat.com> References: <20220614121610.508356-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) X-ZM-MESSAGEID: 1655209004204100001 From: Volker R=C3=BCmelin Since about 2018 virglrenderer (commit fa835b0f88 "vrend: don't hardcode context version") tries to open the highest available GL context version. This is done by creating the known GL context versions from the highest to the lowest until (*create_gl_context) returns a context !=3D NULL. This does not work properly with the current QEMU gd_gl_area_create_context() function, because gdk_gl_context_realize() on Wayland creates a version 3.0 legacy context if the requested GL context version can't be created. In order for virglrenderer to find the highest available GL context version, return NULL if the created context version is lower than the requested version. This fixes the following error: QEMU started with -device virtio-vga-gl -display gtk,gl=3Don. Under Wayland, the guest window remains black and the following information can be seen on the host. gl_version 30 - compat profile (qemu:5978): Gdk-WARNING **: 16:19:01.533: gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported. (qemu:5978): Gdk-WARNING **: 16:19:01.537: gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported. (qemu:5978): Gdk-WARNING **: 16:19:01.554: gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported. vrend_renderer_fill_caps: Entering with stale GL error: 1282 To reproduce this error, an OpenGL driver is required on the host that doesn't have the latest OpenGL extensions fully implemented. An example for this is the Intel i965 driver on a Haswell processor. Signed-off-by: Volker R=C3=BCmelin Message-Id: <20220605085131.7711-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- ui/gtk-gl-area.c | 31 ++++++++++++++++++++++++++++++- ui/trace-events | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 0e20ea031d34..2e0129c28cd4 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -170,6 +170,23 @@ void gd_gl_area_switch(DisplayChangeListener *dcl, } } =20 +static int gd_cmp_gl_context_version(int major, int minor, QEMUGLParams *p= arams) +{ + if (major > params->major_ver) { + return 1; + } + if (major < params->major_ver) { + return -1; + } + if (minor > params->minor_ver) { + return 1; + } + if (minor < params->minor_ver) { + return -1; + } + return 0; +} + QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *dgc, QEMUGLParams *params) { @@ -177,8 +194,8 @@ QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *d= gc, GdkWindow *window; GdkGLContext *ctx; GError *err =3D NULL; + int major, minor; =20 - gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); window =3D gtk_widget_get_window(vc->gfx.drawing_area); ctx =3D gdk_window_create_gl_context(window, &err); if (err) { @@ -196,6 +213,18 @@ QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *= dgc, g_clear_object(&ctx); return NULL; } + + gdk_gl_context_make_current(ctx); + gdk_gl_context_get_version(ctx, &major, &minor); + gdk_gl_context_clear_current(); + gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); + + if (gd_cmp_gl_context_version(major, minor, params) =3D=3D -1) { + /* created ctx version < requested version */ + g_clear_object(&ctx); + } + + trace_gd_gl_area_create_context(ctx, params->major_ver, params->minor_= ver); return ctx; } =20 diff --git a/ui/trace-events b/ui/trace-events index 1040ba0f88c7..a922f00e10b4 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -26,6 +26,7 @@ gd_key_event(const char *tab, int gdk_keycode, int qkeyco= de, const char *action) gd_grab(const char *tab, const char *device, const char *reason) "tab=3D%s= , dev=3D%s, reason=3D%s" gd_ungrab(const char *tab, const char *device) "tab=3D%s, dev=3D%s" gd_keymap_windowing(const char *name) "backend=3D%s" +gd_gl_area_create_context(void *ctx, int major, int minor) "ctx=3D%p, majo= r=3D%d, minor=3D%d" gd_gl_area_destroy_context(void *ctx, void *current_ctx) "ctx=3D%p, curren= t_ctx=3D%p" =20 # vnc-auth-sasl.c --=20 2.36.1