ui/gtk: Update refresh rate on EGL as well
cover ui/gtk: Update refresh rate on EGL as well
These patches regard the use-case of GPU-passthrough on QEMU for
accelerated graphics.
Usually when people use GPU-passthrough on QEMU, they opt to have a
physical seperate graphics card that gets passed through to QEMU using something called "PCIe passthrough". Since the display output is invisible to QEMU, the people who run these kinds of setups tend to view the display outputs by physically connecting a monitor to the "PCIe passthrough-ed" GPU in question.
However, on the Intel side of GPUs, there exists a technology that
allows a user to pass through a "virtual GPU" using something called GVT-g.
Since virtual GPUs have no outputs, they rely soely on software trickery
to get the image displayed on the host machine. In case of GVT-g it is done by DMA-ing the framebuffer to the GTK UIs display.
However, when using GTK outputs, there was a problem which caused the
image to be updated at only 33Hz (or FPS). These issues were first discussed back in December 2019:
https://lists.nongnu.org/archive/html/qemu-devel/2019-12/msg05514.html
There were a few other issues along the way, but those were fixed as well.
The focus of these patches is that when using GVT-g on QEMU, it must
launch the GTK UI in OpenGL/EGL mode. This causes the code responsible for updating the refresh rate to never get executed. Which is why I added it to gtk-egl.c, to make sure updating the refresh rate works on EGL GTK UIs as well.
These patches were made in response to Volkers patches which dealt with
cleaning up my previous code:
https://www.mail-archive.com/[email protected]/msg766686.html
and thus are meant to be merged after Volker's patches.
Hopefully, this commit message isn't too daunting ;)
EDIT: Sorry about the badly formatted patch emailss, still can't get
a hand of how git send-email works.
Nikola Pavlica (2):
ui/gtk: expose gd_monitor_update_interval
ui/gtk: update monitor interval on egl displays
include/ui/gtk.h | 1 + ui/gtk-egl.c | 3 +++ ui/gtk.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.0
PATCH 1/2 ui/gtk: expose gd_monitor_update_interval
The gd_egl_refresh function, as the name suggests, is responsible for refreshing displays when using EGL graphics with QEMU's GTK UI. This is a perfect candidate for a function to update the refresh rate in.
Since gd_monitor_update_interval is inaccessible from the gd_egl_refresh function, we need to expose/globalize it in the include/ui/gtk.h file.
--- include/ui/gtk.h | 1 + ui/gtk.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/ui/gtk.h +1 -0
@@ -86,6 +86,7 @@ extern bool gtk_use_gl_area;/* ui/gtk.c */ void gd_update_windowsize (VirtualConsole *vc); +int gd_monitor_update_interval (GtkWidget *widget);/* ui/gtk-egl.c */ void gd_egl_init (VirtualConsole *vc);
ui/gtk.c +1 -1
@@ -752,7 +752,7 @@ static void gd_resize_event(GtkGLArea *area,* If available, return the update interval of the monitor in ms, * else return 0 (the default update interval). */ -static int gd_monitor_update_interval (GtkWidget *widget) +int gd_monitor_update_interval (GtkWidget *widget) {#ifdef GDK_VERSION_3_22 GdkWindow *win =gtk_widget_get_window (widget);
Signature · 1 line
2.30.0
PATCH 2/2 ui/gtk: update monitor interval on egl displays
In reply to Nikola PavlicaWhen running QEMU's GTK UI without EGL or OGL, the gd_monitor_update_interval function gets executed and the display refresh rate gets updated accordingly. However, when using EGL or just regular OGL, the function never gets executed.
Which is why I decided that the function should be in gd_egl_refresh where the display output gets updated, in the same vain as how it's done for normal GTK UIs (aka. those without EGL) - in it's display refresh function.
Since the gd_monitor_update_interval function now is exposed, we are going to use it to update the refresh rate.
--- ui/gtk-egl.c | 3 +++ 1 file changed, 3 insertions(+)
ui/gtk-egl.c +3 -0
@@ -113,6 +113,9 @@ void gd_egl_refresh(DisplayChangeListener *dcl) {VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl); + vc->gfx.dcl.update_interval =gd_monitor_update_interval ( + vc->window ? vc->window : vc->gfx.drawing_area); +if (!vc->gfx.esurface) {gd_egl_init (vc);if (!vc->gfx.esurface) {
Signature · 1 line
2.30.0
Hi,
Quoted 9 lines
These patches were made in response to Volkers patches which dealt with
cleaning up my previous code:
https://www.mail-archive.com/[email protected]/msg766686.html
and thus are meant to be merged after Volker's patches.Hopefully, this commit message isn't too daunting ;)
EDIT: Sorry about the badly formatted patch emailss, still can't get
a hand of how git send-email works.
Well, I got three copies of the patch series. Guess that comes from trying to get git send-email going ;)
Good news is the patches (tried the most recent mails) apply just fine on top of Volkers series, so it seems you got it working in the end.
Patches are queued up now,
Gerd