* [RFC PATCH] ui/gtk: ??? Remove dead code around X11 ???
@ 2024-11-21 13:09 Philippe Mathieu-Daudé
2024-11-21 13:16 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-11-21 13:09 UTC (permalink / raw)
To: qemu-devel
Cc: Volker Rümelin, Phil Dennis-Jordan, Marc-André Lureau,
Daniel P . Berrangé, Akihiko Odaki,
Philippe Mathieu-Daudé
I have no clue about what this code does,
but gtk_widget_set_double_buffered() is deprecated since GTK 3.14
and we require 3.22 since more than 4 years, commit 7b23d121f9
("ui: increase min required GTK version to 3.22.0").
Assert gtk_use_gl_area is set and remove the dead code.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
ui/gtk.c | 46 +++++++++-------------------------------------
1 file changed, 9 insertions(+), 37 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index bf9d3dd679..d968cf3de1 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -809,17 +809,9 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
#if defined(CONFIG_OPENGL)
if (vc->gfx.gls) {
- if (gtk_use_gl_area) {
- /* invoke render callback please */
- return FALSE;
- } else {
-#ifdef CONFIG_X11
- gd_egl_draw(vc);
- return TRUE;
-#else
- abort();
-#endif
- }
+ assert(gtk_use_gl_area);
+ /* invoke render callback please */
+ return FALSE;
}
#endif
@@ -2156,32 +2148,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
#if defined(CONFIG_OPENGL)
if (display_opengl) {
- if (gtk_use_gl_area) {
- vc->gfx.drawing_area = gtk_gl_area_new();
- g_signal_connect(vc->gfx.drawing_area, "realize",
- G_CALLBACK(gl_area_realize), vc);
- vc->gfx.dcl.ops = &dcl_gl_area_ops;
- vc->gfx.dgc.ops = &gl_area_ctx_ops;
- } else {
-#ifdef CONFIG_X11
- vc->gfx.drawing_area = gtk_drawing_area_new();
- /*
- * gtk_widget_set_double_buffered() was deprecated in 3.14.
- * It is required for opengl rendering on X11 though. A
- * proper replacement (native opengl support) is only
- * available in 3.16+. Silence the warning if possible.
- */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE);
-#pragma GCC diagnostic pop
- vc->gfx.dcl.ops = &dcl_egl_ops;
- vc->gfx.dgc.ops = &egl_ctx_ops;
- vc->gfx.has_dmabuf = qemu_egl_has_dmabuf();
-#else
- abort();
-#endif
- }
+ assert(gtk_use_gl_area);
+ vc->gfx.drawing_area = gtk_gl_area_new();
+ g_signal_connect(vc->gfx.drawing_area, "realize",
+ G_CALLBACK(gl_area_realize), vc);
+ vc->gfx.dcl.ops = &dcl_gl_area_ops;
+ vc->gfx.dgc.ops = &gl_area_ctx_ops;
} else
#endif
{
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [RFC PATCH] ui/gtk: ??? Remove dead code around X11 ???
2024-11-21 13:09 [RFC PATCH] ui/gtk: ??? Remove dead code around X11 ??? Philippe Mathieu-Daudé
@ 2024-11-21 13:16 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2024-11-21 13:16 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Volker Rümelin, Phil Dennis-Jordan,
Marc-André Lureau, Akihiko Odaki
On Thu, Nov 21, 2024 at 02:09:39PM +0100, Philippe Mathieu-Daudé wrote:
> I have no clue about what this code does,
> but gtk_widget_set_double_buffered() is deprecated since GTK 3.14
> and we require 3.22 since more than 4 years, commit 7b23d121f9
> ("ui: increase min required GTK version to 3.22.0").
>
> Assert gtk_use_gl_area is set and remove the dead code.
This assertion is dubious.
gtk_use_gl_area is only set when running on Win32, or running
on Wayland. IOW, the assert will fire on X11, which is a
supported platform, and Broadway which is admitedly more of
a curiosity than a serious GTK backend.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> ui/gtk.c | 46 +++++++++-------------------------------------
> 1 file changed, 9 insertions(+), 37 deletions(-)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index bf9d3dd679..d968cf3de1 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -809,17 +809,9 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
>
> #if defined(CONFIG_OPENGL)
> if (vc->gfx.gls) {
> - if (gtk_use_gl_area) {
> - /* invoke render callback please */
> - return FALSE;
> - } else {
> -#ifdef CONFIG_X11
> - gd_egl_draw(vc);
> - return TRUE;
> -#else
> - abort();
> -#endif
> - }
> + assert(gtk_use_gl_area);
> + /* invoke render callback please */
> + return FALSE;
> }
> #endif
>
> @@ -2156,32 +2148,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
>
> #if defined(CONFIG_OPENGL)
> if (display_opengl) {
> - if (gtk_use_gl_area) {
> - vc->gfx.drawing_area = gtk_gl_area_new();
> - g_signal_connect(vc->gfx.drawing_area, "realize",
> - G_CALLBACK(gl_area_realize), vc);
> - vc->gfx.dcl.ops = &dcl_gl_area_ops;
> - vc->gfx.dgc.ops = &gl_area_ctx_ops;
> - } else {
> -#ifdef CONFIG_X11
> - vc->gfx.drawing_area = gtk_drawing_area_new();
> - /*
> - * gtk_widget_set_double_buffered() was deprecated in 3.14.
> - * It is required for opengl rendering on X11 though. A
> - * proper replacement (native opengl support) is only
> - * available in 3.16+. Silence the warning if possible.
> - */
> -#pragma GCC diagnostic push
> -#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
> - gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE);
> -#pragma GCC diagnostic pop
> - vc->gfx.dcl.ops = &dcl_egl_ops;
> - vc->gfx.dgc.ops = &egl_ctx_ops;
> - vc->gfx.has_dmabuf = qemu_egl_has_dmabuf();
> -#else
> - abort();
> -#endif
> - }
> + assert(gtk_use_gl_area);
> + vc->gfx.drawing_area = gtk_gl_area_new();
> + g_signal_connect(vc->gfx.drawing_area, "realize",
> + G_CALLBACK(gl_area_realize), vc);
> + vc->gfx.dcl.ops = &dcl_gl_area_ops;
> + vc->gfx.dgc.ops = &gl_area_ctx_ops;
> } else
> #endif
> {
> --
> 2.45.2
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-21 13:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 13:09 [RFC PATCH] ui/gtk: ??? Remove dead code around X11 ??? Philippe Mathieu-Daudé
2024-11-21 13:16 ` Daniel P. Berrangé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).