* [Qemu-devel] [PATCH v3] Allow to specify a display device ID and head whith the screendump command
@ 2018-03-05 11:08 Thomas Huth
2018-03-05 12:46 ` Gerd Hoffmann
2018-03-05 15:37 ` Eric Blake
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2018-03-05 11:08 UTC (permalink / raw)
To: qemu-devel, Gerd Hoffmann
Cc: Eric Blake, Markus Armbruster, Dr. David Alan Gilbert,
Daniel P. Berrangé, Jiri Denemark
QEMU's screendump command can only take dumps from the primary display.
When using multiple VGA cards, there is no way to get a dump from a
secondary card or other display heads yet. So let's add an 'device' and
a 'head' parameter to the HMP and QMP commands to be able to specify
alternative devices and heads with the screendump command, too.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
v3:
- Drop redundant qemu_console_lookup_by_index(0);
- Remove trailing "." from error message
hmp-commands.hx | 7 ++++---
hmp.c | 4 +++-
qapi/ui.json | 7 ++++++-
ui/console.c | 24 +++++++++++++++++++-----
4 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index d26eb41..ebb5fe4 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -253,9 +253,10 @@ ETEXI
{
.name = "screendump",
- .args_type = "filename:F",
- .params = "filename",
- .help = "save screen into PPM image 'filename'",
+ .args_type = "filename:F,device:s?,head:i?",
+ .params = "filename [device [head]]",
+ .help = "save screen from head 'head' of display device 'device' "
+ "into PPM image 'filename'",
.cmd = hmp_screendump,
},
diff --git a/hmp.c b/hmp.c
index ae86bfb..7dcf72f 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2132,9 +2132,11 @@ err_out:
void hmp_screendump(Monitor *mon, const QDict *qdict)
{
const char *filename = qdict_get_str(qdict, "filename");
+ const char *id = qdict_get_try_str(qdict, "device");
+ int64_t head = qdict_get_try_int(qdict, "head", 0);
Error *err = NULL;
- qmp_screendump(filename, &err);
+ qmp_screendump(filename, id != NULL, id, id != NULL, head, &err);
hmp_handle_error(mon, &err);
}
diff --git a/qapi/ui.json b/qapi/ui.json
index 3e82f25..e60b323 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -77,6 +77,10 @@
#
# @filename: the path of a new PPM file to store the image
#
+# @device: ID of the display device that should be used (since 2.12)
+#
+# @head: head to use in case the device supports multiple heads (since 2.12)
+#
# Returns: Nothing on success
#
# Since: 0.14.0
@@ -88,7 +92,8 @@
# <- { "return": {} }
#
##
-{ 'command': 'screendump', 'data': {'filename': 'str'} }
+{ 'command': 'screendump',
+ 'data': {'filename': 'str', '*device': 'str', '*head': 'int'} }
##
# == Spice
diff --git a/ui/console.c b/ui/console.c
index e22931a..4e4296d 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -344,14 +344,28 @@ write_err:
goto out;
}
-void qmp_screendump(const char *filename, Error **errp)
+void qmp_screendump(const char *filename, bool has_device, const char *device,
+ bool has_head, int64_t head, Error **errp)
{
- QemuConsole *con = qemu_console_lookup_by_index(0);
+ QemuConsole *con;
DisplaySurface *surface;
- if (con == NULL) {
- error_setg(errp, "There is no QemuConsole I can screendump from.");
- return;
+ if (has_device) {
+ con = qemu_console_lookup_by_device_name(device, has_head ? head : 0,
+ errp);
+ if (!con) {
+ return;
+ }
+ } else {
+ if (has_head) {
+ error_setg(errp, "'head' must be specified together with 'device'");
+ return;
+ }
+ con = qemu_console_lookup_by_index(0);
+ if (!con) {
+ error_setg(errp, "There is no console to take a screendump from");
+ return;
+ }
}
graphic_hw_update(con);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v3] Allow to specify a display device ID and head whith the screendump command
2018-03-05 11:08 [Qemu-devel] [PATCH v3] Allow to specify a display device ID and head whith the screendump command Thomas Huth
@ 2018-03-05 12:46 ` Gerd Hoffmann
2018-03-05 15:37 ` Eric Blake
1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2018-03-05 12:46 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, Eric Blake, Markus Armbruster, Dr. David Alan Gilbert,
Daniel P. Berrangé, Jiri Denemark
On Mon, Mar 05, 2018 at 12:08:25PM +0100, Thomas Huth wrote:
> QEMU's screendump command can only take dumps from the primary display.
> When using multiple VGA cards, there is no way to get a dump from a
> secondary card or other display heads yet. So let's add an 'device' and
> a 'head' parameter to the HMP and QMP commands to be able to specify
> alternative devices and heads with the screendump command, too.
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
cheers,
Gerd
PS: With an ack from qom folks I can take this through the ui patch
queue, alternatively feel free to put this into the qom queue.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v3] Allow to specify a display device ID and head whith the screendump command
2018-03-05 11:08 [Qemu-devel] [PATCH v3] Allow to specify a display device ID and head whith the screendump command Thomas Huth
2018-03-05 12:46 ` Gerd Hoffmann
@ 2018-03-05 15:37 ` Eric Blake
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2018-03-05 15:37 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, Gerd Hoffmann
Cc: Markus Armbruster, Dr. David Alan Gilbert,
Daniel P. Berrangé, Jiri Denemark
On 03/05/2018 05:08 AM, Thomas Huth wrote:
In the subject line: s/whith/with/
Also, it's rather long (over 75 characters, while typical messages are
under 65, since it is nice to still fit in 80 columns even when 'git
log' adds indentation), better might be:
qapi: Add parameters to screendump
then go into details about the parameters in the commit body
> QEMU's screendump command can only take dumps from the primary display.
> When using multiple VGA cards, there is no way to get a dump from a
> secondary card or other display heads yet. So let's add an 'device' and
> a 'head' parameter to the HMP and QMP commands to be able to specify
> alternative devices and heads with the screendump command, too.
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> v3:
> - Drop redundant qemu_console_lookup_by_index(0);
> - Remove trailing "." from error message
>
> +++ b/qapi/ui.json
> @@ -77,6 +77,10 @@
> #
> # @filename: the path of a new PPM file to store the image
> #
> +# @device: ID of the display device that should be used (since 2.12)
Worth mentioning how the default value is computed?
> +#
> +# @head: head to use in case the device supports multiple heads (since 2.12)
> +#
> # Returns: Nothing on success
> #
> # Since: 0.14.0
> @@ -88,7 +92,8 @@
> # <- { "return": {} }
> #
> ##
> -{ 'command': 'screendump', 'data': {'filename': 'str'} }
> +{ 'command': 'screendump',
> + 'data': {'filename': 'str', '*device': 'str', '*head': 'int'} }
>
QAPI changes are reasonable from a UI point of view.
> + } else {
> + if (has_head) {
> + error_setg(errp, "'head' must be specified together with 'device'");
This isn't documented.
> + return;
> + }
> + con = qemu_console_lookup_by_index(0);
> + if (!con) {
> + error_setg(errp, "There is no console to take a screendump from");
> + return;
> + }
> }
>
> graphic_hw_update(con);
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-05 15:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-05 11:08 [Qemu-devel] [PATCH v3] Allow to specify a display device ID and head whith the screendump command Thomas Huth
2018-03-05 12:46 ` Gerd Hoffmann
2018-03-05 15:37 ` Eric Blake
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).