* [PATCH 0/2] handling guest multiple displays @ 2022-05-31 20:23 Dongwon Kim 2022-05-31 20:23 ` [PATCH 1/2] ui/gtk: detach VCS for additional guest displays Dongwon Kim 2022-05-31 20:23 ` [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays Dongwon Kim 0 siblings, 2 replies; 9+ messages in thread From: Dongwon Kim @ 2022-05-31 20:23 UTC (permalink / raw) To: qemu-devel; +Cc: Dongwon Kim This patch seires is for adding some useful features for the guest os with multi-displays. First patch is to make all of guest displays visible when guest os is launched using "detach". Second patch is for providing a method to assign each guest display to specific physical monitor, which would be useful if someone wants to directly full-screen individual guest scanouts to host's physical displays. Dongwon Kim (2): ui/gtk: detach VCS for additional guest displays ui/gtk: a new array param monitor to specify the target displays qapi/ui.json | 7 ++++++- qemu-options.hx | 2 +- ui/gtk.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 4 deletions(-) -- 2.30.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ui/gtk: detach VCS for additional guest displays 2022-05-31 20:23 [PATCH 0/2] handling guest multiple displays Dongwon Kim @ 2022-05-31 20:23 ` Dongwon Kim 2022-06-09 9:29 ` Daniel P. Berrangé 2022-06-10 6:05 ` Gerd Hoffmann 2022-05-31 20:23 ` [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays Dongwon Kim 1 sibling, 2 replies; 9+ messages in thread From: Dongwon Kim @ 2022-05-31 20:23 UTC (permalink / raw) To: qemu-devel Cc: Dongwon Kim, Daniel P . Berrangé, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Gerd Hoffmann, Vivek Kasireddy Detaching any addtional guest displays in case there are multiple displays assigned to the guest OS (e.g. max_outputs=n) so that all of them are visible upon lauching. Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> --- ui/gtk.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index c57c36749e..abfcf48547 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2304,6 +2304,8 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) GtkDisplayState *s = g_malloc0(sizeof(*s)); GdkDisplay *window_display; GtkIconTheme *theme; + int n_gfx_vcs = 0; + int i; char *dir; if (!gtkinit) { @@ -2374,7 +2376,14 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) gtk_widget_set_sensitive(s->copy_item, vc && vc->type == GD_VC_VTE); #endif - + for (i = 0; i < s->nb_vcs; i++) { + if (qemu_console_is_graphic(s->vc[i].gfx.dcl.con)) { + if (n_gfx_vcs > 0) { + gtk_menu_item_activate(GTK_MENU_ITEM(s->untabify_item)); + } + n_gfx_vcs++; + } + } if (opts->has_full_screen && opts->full_screen) { gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); -- 2.30.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ui/gtk: detach VCS for additional guest displays 2022-05-31 20:23 ` [PATCH 1/2] ui/gtk: detach VCS for additional guest displays Dongwon Kim @ 2022-06-09 9:29 ` Daniel P. Berrangé 2022-06-10 6:05 ` Gerd Hoffmann 1 sibling, 0 replies; 9+ messages in thread From: Daniel P. Berrangé @ 2022-06-09 9:29 UTC (permalink / raw) To: Dongwon Kim Cc: qemu-devel, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Gerd Hoffmann, Vivek Kasireddy On Tue, May 31, 2022 at 01:23:26PM -0700, Dongwon Kim wrote: > Detaching any addtional guest displays in case there are multiple > displays assigned to the guest OS (e.g. max_outputs=n) so that > all of them are visible upon lauching. > > Cc: Daniel P. Berrangé <berrange@redhat.com> > Cc: Markus Armbruster <armbru@redhat.com> > Cc: Philippe Mathieu-Daudé <philmd@redhat.com> > Cc: Paolo Bonzini <pbonzini@redhat.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> > Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> > --- > ui/gtk.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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] 9+ messages in thread
* Re: [PATCH 1/2] ui/gtk: detach VCS for additional guest displays 2022-05-31 20:23 ` [PATCH 1/2] ui/gtk: detach VCS for additional guest displays Dongwon Kim 2022-06-09 9:29 ` Daniel P. Berrangé @ 2022-06-10 6:05 ` Gerd Hoffmann 1 sibling, 0 replies; 9+ messages in thread From: Gerd Hoffmann @ 2022-06-10 6:05 UTC (permalink / raw) To: Dongwon Kim Cc: qemu-devel, Daniel P . Berrangé, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Vivek Kasireddy On Tue, May 31, 2022 at 01:23:26PM -0700, Dongwon Kim wrote: > Detaching any addtional guest displays in case there are multiple > displays assigned to the guest OS (e.g. max_outputs=n) so that > all of them are visible upon lauching. > > Cc: Daniel P. Berrangé <berrange@redhat.com> > Cc: Markus Armbruster <armbru@redhat.com> > Cc: Philippe Mathieu-Daudé <philmd@redhat.com> > Cc: Paolo Bonzini <pbonzini@redhat.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> > Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> > --- > ui/gtk.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/ui/gtk.c b/ui/gtk.c > index c57c36749e..abfcf48547 100644 > --- a/ui/gtk.c > +++ b/ui/gtk.c > @@ -2304,6 +2304,8 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) > GtkDisplayState *s = g_malloc0(sizeof(*s)); > GdkDisplay *window_display; > GtkIconTheme *theme; > + int n_gfx_vcs = 0; > + int i; > char *dir; > > if (!gtkinit) { > @@ -2374,7 +2376,14 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) > gtk_widget_set_sensitive(s->copy_item, > vc && vc->type == GD_VC_VTE); > #endif > - > + for (i = 0; i < s->nb_vcs; i++) { > + if (qemu_console_is_graphic(s->vc[i].gfx.dcl.con)) { Accessing vc[i].gfx without checking vc[i].type beforehand is wrong. Also note that graphical consoles are sorted to the head of the list. n_gfx_vcs should not be needed because the primary gfx display has index 0 no matter what. take care, Gerd ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays 2022-05-31 20:23 [PATCH 0/2] handling guest multiple displays Dongwon Kim 2022-05-31 20:23 ` [PATCH 1/2] ui/gtk: detach VCS for additional guest displays Dongwon Kim @ 2022-05-31 20:23 ` Dongwon Kim 2022-06-09 9:23 ` Gerd Hoffmann ` (2 more replies) 1 sibling, 3 replies; 9+ messages in thread From: Dongwon Kim @ 2022-05-31 20:23 UTC (permalink / raw) To: qemu-devel Cc: Dongwon Kim, Daniel P . Berrangé, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Gerd Hoffmann, Vivek Kasireddy New integer array parameter, 'monitor' is for specifying the target displays where individual QEMU windows are placed upon launching. The array contains a series of numbers representing the monitor where QEMU windows are placed. Numbers in the array are mapped to QEMU windows like, [1st detached window, 2nd detached window,.... Main window] Usage example: -display gtk,monitor.0=0,monitor.1=1..... Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> --- qapi/ui.json | 7 ++++++- qemu-options.hx | 2 +- ui/gtk.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index 11a827d10f..94546cfe84 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1195,12 +1195,17 @@ # assuming the guest will resize the display to match # the window size then. Otherwise it defaults to "off". # Since 3.1 +# @monitor: Array of numbers, each of which represents physical +# monitor where individual QEMU window is placed in case +# there are multiple of them +# since 7.1 # # Since: 2.12 ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', - '*zoom-to-fit' : 'bool' } } + '*zoom-to-fit' : 'bool', + '*monitor' : ['uint16'] } } ## # @DisplayEGLHeadless: diff --git a/qemu-options.hx b/qemu-options.hx index a664baaa18..c2523ae0da 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1943,7 +1943,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, #endif #if defined(CONFIG_GTK) "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n" - " [,show-cursor=on|off][,window-close=on|off]\n" + " [,monitor.<order>=<value>][,show-cursor=on|off][,window-close=on|off]\n" #endif #if defined(CONFIG_VNC) "-display vnc=<display>[,<optargs>]\n" diff --git a/ui/gtk.c b/ui/gtk.c index abfcf48547..fcd0e08c16 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2304,6 +2304,10 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) GtkDisplayState *s = g_malloc0(sizeof(*s)); GdkDisplay *window_display; GtkIconTheme *theme; + GtkWidget *win; + GdkRectangle dest; + uint16List *mon; + int n_mon; int n_gfx_vcs = 0; int i; char *dir; @@ -2384,7 +2388,33 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) n_gfx_vcs++; } } - if (opts->has_full_screen && + if (opts->u.gtk.has_monitor) { + i = 0; + n_mon = gdk_display_get_n_monitors(window_display); + for (mon = opts->u.gtk.monitor; mon; mon = mon->next) { + if (mon->value < n_mon) { + for (; i < s->nb_vcs; i++) { + win = s->vc[i].window ? s->vc[i].window : s->window; + if (opts->has_full_screen && opts->full_screen) { + gtk_window_fullscreen_on_monitor( + GTK_WINDOW(win), + gdk_display_get_default_screen(window_display), + mon->value); + } else { + gdk_monitor_get_geometry( + gdk_display_get_monitor(window_display, mon->value), + &dest); + gtk_window_move(GTK_WINDOW(win), + dest.x, dest.y); + } + i++; + break; + } + } + } + } + if (!opts->u.gtk.has_monitor && + opts->has_full_screen && opts->full_screen) { gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); } -- 2.30.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays 2022-05-31 20:23 ` [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays Dongwon Kim @ 2022-06-09 9:23 ` Gerd Hoffmann 2022-06-09 9:38 ` Daniel P. Berrangé 2022-06-10 6:11 ` Gerd Hoffmann 2 siblings, 0 replies; 9+ messages in thread From: Gerd Hoffmann @ 2022-06-09 9:23 UTC (permalink / raw) To: Dongwon Kim Cc: qemu-devel, Daniel P . Berrangé, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Vivek Kasireddy On Tue, May 31, 2022 at 01:23:27PM -0700, Dongwon Kim wrote: > New integer array parameter, 'monitor' is for specifying the target > displays where individual QEMU windows are placed upon launching. > > The array contains a series of numbers representing the monitor where > QEMU windows are placed. > > Numbers in the array are mapped to QEMU windows like, > > [1st detached window, 2nd detached window,.... Main window] > > Usage example: -display gtk,monitor.0=0,monitor.1=1..... Both patches look good to me. > +# @monitor: Array of numbers, each of which represents physical > +# monitor where individual QEMU window is placed in case > +# there are multiple of them > +# since 7.1 > # > # Since: 2.12 > ## > { 'struct' : 'DisplayGTK', > 'data' : { '*grab-on-hover' : 'bool', > - '*zoom-to-fit' : 'bool' } } > + '*zoom-to-fit' : 'bool', > + '*monitor' : ['uint16'] } } This is what we've agreed to, so I guess this is fine with the QAPI maintainers too? Can I have an ack then? thanks, Gerd ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays 2022-05-31 20:23 ` [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays Dongwon Kim 2022-06-09 9:23 ` Gerd Hoffmann @ 2022-06-09 9:38 ` Daniel P. Berrangé 2022-06-09 10:34 ` Gerd Hoffmann 2022-06-10 6:11 ` Gerd Hoffmann 2 siblings, 1 reply; 9+ messages in thread From: Daniel P. Berrangé @ 2022-06-09 9:38 UTC (permalink / raw) To: Dongwon Kim Cc: qemu-devel, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Gerd Hoffmann, Vivek Kasireddy On Tue, May 31, 2022 at 01:23:27PM -0700, Dongwon Kim wrote: > New integer array parameter, 'monitor' is for specifying the target > displays where individual QEMU windows are placed upon launching. > > The array contains a series of numbers representing the monitor where > QEMU windows are placed. > > Numbers in the array are mapped to QEMU windows like, > > [1st detached window, 2nd detached window,.... Main window] > > Usage example: -display gtk,monitor.0=0,monitor.1=1..... > > Cc: Daniel P. Berrangé <berrange@redhat.com> > Cc: Markus Armbruster <armbru@redhat.com> > Cc: Philippe Mathieu-Daudé <philmd@redhat.com> > Cc: Paolo Bonzini <pbonzini@redhat.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> > Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> > --- > qapi/ui.json | 7 ++++++- > qemu-options.hx | 2 +- > ui/gtk.c | 32 +++++++++++++++++++++++++++++++- > 3 files changed, 38 insertions(+), 3 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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] 9+ messages in thread
* Re: [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays 2022-06-09 9:38 ` Daniel P. Berrangé @ 2022-06-09 10:34 ` Gerd Hoffmann 0 siblings, 0 replies; 9+ messages in thread From: Gerd Hoffmann @ 2022-06-09 10:34 UTC (permalink / raw) To: Daniel P. Berrangé Cc: Dongwon Kim, qemu-devel, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Vivek Kasireddy On Thu, Jun 09, 2022 at 10:38:53AM +0100, Daniel P. Berrangé wrote: > On Tue, May 31, 2022 at 01:23:27PM -0700, Dongwon Kim wrote: > > New integer array parameter, 'monitor' is for specifying the target > > displays where individual QEMU windows are placed upon launching. > > > > The array contains a series of numbers representing the monitor where > > QEMU windows are placed. > > > > Numbers in the array are mapped to QEMU windows like, > > > > [1st detached window, 2nd detached window,.... Main window] > > > > Usage example: -display gtk,monitor.0=0,monitor.1=1..... > > > > Cc: Daniel P. Berrangé <berrange@redhat.com> > > Cc: Markus Armbruster <armbru@redhat.com> > > Cc: Philippe Mathieu-Daudé <philmd@redhat.com> > > Cc: Paolo Bonzini <pbonzini@redhat.com> > > Cc: Gerd Hoffmann <kraxel@redhat.com> > > Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> > > Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> > > --- > > qapi/ui.json | 7 ++++++- > > qemu-options.hx | 2 +- > > ui/gtk.c | 32 +++++++++++++++++++++++++++++++- > > 3 files changed, 38 insertions(+), 3 deletions(-) > > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Thanks, queued up series. take care, Gerd ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays 2022-05-31 20:23 ` [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays Dongwon Kim 2022-06-09 9:23 ` Gerd Hoffmann 2022-06-09 9:38 ` Daniel P. Berrangé @ 2022-06-10 6:11 ` Gerd Hoffmann 2 siblings, 0 replies; 9+ messages in thread From: Gerd Hoffmann @ 2022-06-10 6:11 UTC (permalink / raw) To: Dongwon Kim Cc: qemu-devel, Daniel P . Berrangé, Markus Armbruster, Philippe Mathieu-Daudé, Paolo Bonzini, Vivek Kasireddy On Tue, May 31, 2022 at 01:23:27PM -0700, Dongwon Kim wrote: > New integer array parameter, 'monitor' is for specifying the target > displays where individual QEMU windows are placed upon launching. > > The array contains a series of numbers representing the monitor where > QEMU windows are placed. > > Numbers in the array are mapped to QEMU windows like, > > [1st detached window, 2nd detached window,.... Main window] > > Usage example: -display gtk,monitor.0=0,monitor.1=1..... Depends on patch #1, so dropped both. Please fix patch #1, rebase & resend. thanks, Gerd ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-06-10 6:21 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-05-31 20:23 [PATCH 0/2] handling guest multiple displays Dongwon Kim 2022-05-31 20:23 ` [PATCH 1/2] ui/gtk: detach VCS for additional guest displays Dongwon Kim 2022-06-09 9:29 ` Daniel P. Berrangé 2022-06-10 6:05 ` Gerd Hoffmann 2022-05-31 20:23 ` [PATCH 2/2] ui/gtk: a new array param monitor to specify the target displays Dongwon Kim 2022-06-09 9:23 ` Gerd Hoffmann 2022-06-09 9:38 ` Daniel P. Berrangé 2022-06-09 10:34 ` Gerd Hoffmann 2022-06-10 6:11 ` Gerd Hoffmann
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).