All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] virtio-gpu: Provide display position info (x, y) to the Guest
@ 2022-11-18  1:37 Vivek Kasireddy
  2022-11-18  1:37 ` [PATCH v1 1/2] virtio-gpu: Provide " Vivek Kasireddy
  2022-11-18  1:37 ` [PATCH v1 2/2] ui/gtk: Include the position info while setting the ui info Vivek Kasireddy
  0 siblings, 2 replies; 4+ messages in thread
From: Vivek Kasireddy @ 2022-11-18  1:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vivek Kasireddy, Dongwon Kim, Gerd Hoffmann

While filling out the display info such as width, height to
be provided to the Guest, make sure that the position information
(x, y) is also included. This position info corresponds with the
x and y fields mentioned in the spec:
https://github.com/oasis-tcs/virtio-spec/blob/master/virtio-gpu.tex#L343

Cc: Dongwon Kim <dongwon.kim@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Vivek Kasireddy (2):
  virtio-gpu: Provide position info (x, y) to the Guest
  ui/gtk: Include the position info while setting the ui info

 hw/display/virtio-gpu-base.c |  2 ++
 ui/gtk.c                     | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

-- 
2.37.2



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

* [PATCH v1 1/2] virtio-gpu: Provide position info (x, y) to the Guest
  2022-11-18  1:37 [PATCH v1 0/2] virtio-gpu: Provide display position info (x, y) to the Guest Vivek Kasireddy
@ 2022-11-18  1:37 ` Vivek Kasireddy
  2022-11-18  7:11   ` Philippe Mathieu-Daudé
  2022-11-18  1:37 ` [PATCH v1 2/2] ui/gtk: Include the position info while setting the ui info Vivek Kasireddy
  1 sibling, 1 reply; 4+ messages in thread
From: Vivek Kasireddy @ 2022-11-18  1:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vivek Kasireddy, Dongwon Kim, Gerd Hoffmann

While filling out the display info such as width, height to
be provided to the Guest, make sure that the position information
(x, y) is also included. This position info corresponds with the
x and y fields mentioned in the spec:
https://github.com/oasis-tcs/virtio-spec/blob/master/virtio-gpu.tex#L343

Cc: Dongwon Kim <dongwon.kim@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
 hw/display/virtio-gpu-base.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index a29f191aa8..3b6b480131 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -47,6 +47,8 @@ virtio_gpu_base_fill_display_info(VirtIOGPUBase *g,
             dpy_info->pmodes[i].enabled = 1;
             dpy_info->pmodes[i].r.width = cpu_to_le32(g->req_state[i].width);
             dpy_info->pmodes[i].r.height = cpu_to_le32(g->req_state[i].height);
+            dpy_info->pmodes[i].r.x = cpu_to_le32(g->req_state[i].x);
+            dpy_info->pmodes[i].r.y = cpu_to_le32(g->req_state[i].y);
         }
     }
 }
-- 
2.37.2



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

* [PATCH v1 2/2] ui/gtk: Include the position info while setting the ui info
  2022-11-18  1:37 [PATCH v1 0/2] virtio-gpu: Provide display position info (x, y) to the Guest Vivek Kasireddy
  2022-11-18  1:37 ` [PATCH v1 1/2] virtio-gpu: Provide " Vivek Kasireddy
@ 2022-11-18  1:37 ` Vivek Kasireddy
  1 sibling, 0 replies; 4+ messages in thread
From: Vivek Kasireddy @ 2022-11-18  1:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vivek Kasireddy, Dongwon Kim, Gerd Hoffmann

In situtations where the Guest uses multiple displays/outputs, this
position info is useful for aligning the Guest's outputs with that of
the Host's.

Cc: Dongwon Kim <dongwon.kim@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
 ui/gtk.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 92daaa6a6e..12b3bc6481 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -714,12 +714,31 @@ static gboolean gd_window_close(GtkWidget *widget, GdkEvent *event,
     return TRUE;
 }
 
+static void gd_set_ui_window_position(VirtualConsole *vc, QemuUIInfo *info)
+{
+    GdkDisplay *dpy = gtk_widget_get_display(vc->gfx.drawing_area);
+    GdkWindow *window;
+    GdkMonitor *monitor;
+    GdkRectangle geometry;
+
+    if (!gtk_widget_get_realized(vc->gfx.drawing_area)) {
+        return;
+    }
+
+    window = gtk_widget_get_window(vc->gfx.drawing_area);
+    monitor = gdk_display_get_monitor_at_window(dpy, window);
+    gdk_monitor_get_geometry(monitor, &geometry);
+    info->xoff = geometry.x;
+    info->yoff = geometry.y;
+}
+
 static void gd_set_ui_refresh_rate(VirtualConsole *vc, int refresh_rate)
 {
     QemuUIInfo info;
 
     info = *dpy_get_ui_info(vc->gfx.dcl.con);
     info.refresh_rate = refresh_rate;
+    gd_set_ui_window_position(vc, &info);
     dpy_set_ui_info(vc->gfx.dcl.con, &info, true);
 }
 
@@ -730,6 +749,7 @@ static void gd_set_ui_size(VirtualConsole *vc, gint width, gint height)
     info = *dpy_get_ui_info(vc->gfx.dcl.con);
     info.width = width;
     info.height = height;
+    gd_set_ui_window_position(vc, &info);
     dpy_set_ui_info(vc->gfx.dcl.con, &info, true);
 }
 
-- 
2.37.2



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

* Re: [PATCH v1 1/2] virtio-gpu: Provide position info (x, y) to the Guest
  2022-11-18  1:37 ` [PATCH v1 1/2] virtio-gpu: Provide " Vivek Kasireddy
@ 2022-11-18  7:11   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-18  7:11 UTC (permalink / raw)
  To: Vivek Kasireddy, qemu-devel; +Cc: Dongwon Kim, Gerd Hoffmann

On 18/11/22 02:37, Vivek Kasireddy wrote:
> While filling out the display info such as width, height to
> be provided to the Guest, make sure that the position information
> (x, y) is also included. This position info corresponds with the
> x and y fields mentioned in the spec:
> https://github.com/oasis-tcs/virtio-spec/blob/master/virtio-gpu.tex#L343
> 
> Cc: Dongwon Kim <dongwon.kim@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> ---
>   hw/display/virtio-gpu-base.c | 2 ++
>   1 file changed, 2 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

end of thread, other threads:[~2022-11-18  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18  1:37 [PATCH v1 0/2] virtio-gpu: Provide display position info (x, y) to the Guest Vivek Kasireddy
2022-11-18  1:37 ` [PATCH v1 1/2] virtio-gpu: Provide " Vivek Kasireddy
2022-11-18  7:11   ` Philippe Mathieu-Daudé
2022-11-18  1:37 ` [PATCH v1 2/2] ui/gtk: Include the position info while setting the ui info Vivek Kasireddy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.