qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ui/gtk: run gd_monitor_update_interval on EGL as well
@ 2021-01-14 13:45 Nikola Pavlica
  2021-01-14 13:45 ` [PATCH 1/2] ui/gtk: expose gd_monitor_update_interval Nikola Pavlica
  2021-01-14 13:45 ` [PATCH 2/2] ui/gtk: update monitor interval on egl displays Nikola Pavlica
  0 siblings, 2 replies; 5+ messages in thread
From: Nikola Pavlica @ 2021-01-14 13:45 UTC (permalink / raw)
  To: qemu-devel, qemu-devel; +Cc: r_qemu, philmd, kraxel, Nikola Pavlica

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/qemu-devel@nongnu.org/msg766686.html
 and thus are meant to be merged after Volker's patches.

Hopefully, this commit message isn't too daunting ;)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ui/gtk: expose gd_monitor_update_interval
  2021-01-14 13:45 [PATCH 0/2] ui/gtk: run gd_monitor_update_interval on EGL as well Nikola Pavlica
@ 2021-01-14 13:45 ` Nikola Pavlica
  2021-01-14 13:45 ` [PATCH 2/2] ui/gtk: update monitor interval on egl displays Nikola Pavlica
  1 sibling, 0 replies; 5+ messages in thread
From: Nikola Pavlica @ 2021-01-14 13:45 UTC (permalink / raw)
  To: qemu-devel, qemu-devel; +Cc: r_qemu, philmd, kraxel, Nikola Pavlica

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.

Signed-off-by: Nikola Pavlica <pavlica.nikola@gmail.com>
---
 include/ui/gtk.h | 1 +
 ui/gtk.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/ui/gtk.h b/include/ui/gtk.h
index 80851fb4c7..3f395d7f94 100644
--- a/include/ui/gtk.h
+++ b/include/ui/gtk.h
@@ -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);
diff --git a/ui/gtk.c b/ui/gtk.c
index d2004a4dc1..26665cd2e6 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -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);
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ui/gtk: update monitor interval on egl displays
  2021-01-14 13:45 [PATCH 0/2] ui/gtk: run gd_monitor_update_interval on EGL as well Nikola Pavlica
  2021-01-14 13:45 ` [PATCH 1/2] ui/gtk: expose gd_monitor_update_interval Nikola Pavlica
@ 2021-01-14 13:45 ` Nikola Pavlica
  1 sibling, 0 replies; 5+ messages in thread
From: Nikola Pavlica @ 2021-01-14 13:45 UTC (permalink / raw)
  To: qemu-devel, qemu-devel; +Cc: r_qemu, philmd, kraxel, Nikola Pavlica

When 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.

Signed-off-by: Nikola Pavlica <pavlica.nikola@gmail.com>
---
 ui/gtk-egl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 99231a3597..71c3d698b4 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -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) {
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ui/gtk: update monitor interval on egl displays
  2021-01-14 14:01 [PATCH 0/2] ui/gtk: Update refresh rate on EGL as well Nikola Pavlica
@ 2021-01-14 14:01 ` Nikola Pavlica
  0 siblings, 0 replies; 5+ messages in thread
From: Nikola Pavlica @ 2021-01-14 14:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: r_qemu, philmd, kraxel, Nikola Pavlica

When 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.

Signed-off-by: Nikola Pavlica <pavlica.nikola@gmail.com>
---
 ui/gtk-egl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 99231a3597..71c3d698b4 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -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) {
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ui/gtk: update monitor interval on egl displays
  2021-01-14 13:48 [PATCH 0/2] ui/gtk: run gd_monitor_update_interval on EGL as well Nikola Pavlica
@ 2021-01-14 13:48 ` Nikola Pavlica
  0 siblings, 0 replies; 5+ messages in thread
From: Nikola Pavlica @ 2021-01-14 13:48 UTC (permalink / raw)
  To: qemu-devel, qemu-devel; +Cc: r_qemu, philmd, kraxel, Nikola Pavlica

When 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.

Signed-off-by: Nikola Pavlica <pavlica.nikola@gmail.com>
---
 ui/gtk-egl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 99231a3597..71c3d698b4 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -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) {
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-14 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 13:45 [PATCH 0/2] ui/gtk: run gd_monitor_update_interval on EGL as well Nikola Pavlica
2021-01-14 13:45 ` [PATCH 1/2] ui/gtk: expose gd_monitor_update_interval Nikola Pavlica
2021-01-14 13:45 ` [PATCH 2/2] ui/gtk: update monitor interval on egl displays Nikola Pavlica
2021-01-14 13:48 [PATCH 0/2] ui/gtk: run gd_monitor_update_interval on EGL as well Nikola Pavlica
2021-01-14 13:48 ` [PATCH 2/2] ui/gtk: update monitor interval on egl displays Nikola Pavlica
2021-01-14 14:01 [PATCH 0/2] ui/gtk: Update refresh rate on EGL as well Nikola Pavlica
2021-01-14 14:01 ` [PATCH 2/2] ui/gtk: update monitor interval on egl displays Nikola Pavlica

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).