From nobody Tue Feb 10 13:34:02 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678702445; cv=none; d=zohomail.com; s=zohoarc; b=LOfE83m5HLjHJNOiiFif5vPxJS/Ah/gmF0q6eAYWIlnACS/mN+yy/wPXs7DegavmJNAGlPjojb2FAjbxgnQUhCeLP8LBc6KIhxdarUUpg6FEJkgza2m4apetUR24cSietJQm5U/5PPvxp1kSozPsMSI7qPv6Ae8qLORQfAARxdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678702445; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w3LL2Utc8DveH1ja8P2pWS7/E7RdJaNYiBkLmCG8WC4=; b=S70GdhBIaxXPgNLlgt0SCmzWsLPrGyLprOEQMCmPz9eMGtaTGgc1cbwn5EUn85Q3YBpwWlXDfTOlzMHLKlw5sGYgATRsAKJRx3WlVk4zrdB8C7+9NduLg/2VfsfMSpxA08L6TYdtAeIctm5AfBSmscjOuzVZXH/z2zAf0SA2AXQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16787024450881023.3052712959737; Mon, 13 Mar 2023 03:14:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbfBK-00043n-8O; Mon, 13 Mar 2023 06:13:30 -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 1pbfBD-0003Yf-Sf for qemu-devel@nongnu.org; Mon, 13 Mar 2023 06:13:25 -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 1pbfBB-0004P2-IM for qemu-devel@nongnu.org; Mon, 13 Mar 2023 06:13:23 -0400 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-147-HZ6af2faN1mexuWf2PRRVA-1; Mon, 13 Mar 2023 06:13:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2169385D066; Mon, 13 Mar 2023 10:13:17 +0000 (UTC) Received: from localhost (unknown [10.39.208.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 567DB1121315; Mon, 13 Mar 2023 10:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678702400; 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=w3LL2Utc8DveH1ja8P2pWS7/E7RdJaNYiBkLmCG8WC4=; b=XaE+R3eX4JWU5fc0UKHmIZmc2LKUa/om5UwYLhMcQjN1CIMRL9Q3T2QU5wymP0Cy2BnLrD TsVWBBhhKBEItZsIv4O5dptg2f19H9Nvq/onraQlnj7XTviQC2PUhsqRst4O4b0mgD+KuF /hgnYi/UZykGkME7vsy0KS3g2zkrRVY= X-MC-Unique: HZ6af2faN1mexuWf2PRRVA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , Thomas Huth Subject: [PATCH v3 15/18] ui/sdl: try to instantiate the matching opengl renderer Date: Mon, 13 Mar 2023 14:12:04 +0400 Message-Id: <20230313101207.375125-16-marcandre.lureau@redhat.com> In-Reply-To: <20230313101207.375125-1-marcandre.lureau@redhat.com> References: <20230313101207.375125-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.1 on 10.11.54.3 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_H2=-0.001, SPF_HELO_NONE=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 @redhat.com) X-ZM-MESSAGEID: 1678702445807100003 From: Marc-Andr=C3=A9 Lureau -display sdl,gl=3Des didn't actually use OpenGL ES. Using OpenGL ES allows to use ANGLE, which works generally better than Windows/OEM OpenGL driver. (note: users can still bypass the QEMU choice with SDL_RENDER_DRIVER environment variable) (note: for some reason, specifying a driver disables batching and breaks rendering, so enable it explicitly) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/sdl2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 221cdced60..35c58c1104 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -58,6 +58,11 @@ static Notifier mouse_mode_notifier; #define SDL2_MAX_IDLE_COUNT (2 * GUI_REFRESH_INTERVAL_DEFAULT \ / SDL2_REFRESH_INTERVAL_BUSY + 1) =20 +/* introduced in SDL 2.0.10 */ +#ifndef SDL_HINT_RENDER_BATCHING +#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING" +#endif + static void sdl_update_caption(struct sdl2_console *scon); =20 static struct sdl2_console *get_scon_from_window(uint32_t window_id) @@ -99,7 +104,18 @@ void sdl2_window_create(struct sdl2_console *scon) surface_width(scon->surface), surface_height(scon->surface), flags); + if (scon->opengl) { + const char *driver =3D "opengl"; + + if (scon->opts->gl =3D=3D DISPLAYGL_MODE_ES) { + driver =3D "opengles2"; + } + + SDL_SetHint(SDL_HINT_RENDER_DRIVER, driver); + SDL_SetHint(SDL_HINT_RENDER_BATCHING, "1"); + } scon->real_renderer =3D SDL_CreateRenderer(scon->real_window, -1, 0); + if (scon->opengl) { scon->winctx =3D SDL_GL_CreateContext(scon->real_window); } --=20 2.39.2