From nobody Thu May 2 08:54:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543495584999786.9552201696788; Thu, 29 Nov 2018 04:46:24 -0800 (PST) Received: from localhost ([::1]:53818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSLi4-0001nF-0K for importer@patchew.org; Thu, 29 Nov 2018 07:46:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSLfn-0000PO-OK for qemu-devel@nongnu.org; Thu, 29 Nov 2018 07:44:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSLXD-0004Sy-8Q for qemu-devel@nongnu.org; Thu, 29 Nov 2018 07:35:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSLXD-0004Sn-2R for qemu-devel@nongnu.org; Thu, 29 Nov 2018 07:35:11 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EA843001FE7 for ; Thu, 29 Nov 2018 12:35:10 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A7B018037; Thu, 29 Nov 2018 12:35:05 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8674A1FCD8; Thu, 29 Nov 2018 13:35:03 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 29 Nov 2018 13:35:02 +0100 Message-Id: <20181129123502.30129-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 29 Nov 2018 12:35:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] egl-headless: add egl_create_context X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We must set the correct context (via eglMakeCurrent) before calling qemu_egl_create_context, so we need a thin wrapper and can't hook qemu_egl_create_context directly as ->dpy_gl_ctx_create callback. Reported-by: Frederik Carlier Signed-off-by: Gerd Hoffmann --- ui/egl-headless.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 4cf3bbc0e4..519e7bad32 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -38,6 +38,14 @@ static void egl_gfx_switch(DisplayChangeListener *dcl, edpy->ds =3D new_surface; } =20 +static QEMUGLContext egl_create_context(DisplayChangeListener *dcl, + QEMUGLParams *params) +{ + eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, + qemu_egl_rn_ctx); + return qemu_egl_create_context(dcl, params); +} + static void egl_scanout_disable(DisplayChangeListener *dcl) { egl_dpy *edpy =3D container_of(dcl, egl_dpy, dcl); @@ -150,7 +158,7 @@ static const DisplayChangeListenerOps egl_ops =3D { .dpy_gfx_update =3D egl_gfx_update, .dpy_gfx_switch =3D egl_gfx_switch, =20 - .dpy_gl_ctx_create =3D qemu_egl_create_context, + .dpy_gl_ctx_create =3D egl_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D qemu_egl_make_context_current, .dpy_gl_ctx_get_current =3D qemu_egl_get_current_context, --=20 2.9.3