[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/14] qapi: Add device ID and head parameters to scr
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 14/14] qapi: Add device ID and head parameters to screendump |
Date: |
Mon, 12 Mar 2018 10:14:05 +0100 |
From: Thomas Huth <address@hidden>
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 a '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é <address@hidden>
Acked-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hmp.c | 4 +++-
ui/console.c | 24 +++++++++++++++++++-----
hmp-commands.hx | 7 ++++---
qapi/ui.json | 10 +++++++++-
4 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/hmp.c b/hmp.c
index 016cb5c4f1..ba9e299ee2 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2140,9 +2140,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/ui/console.c b/ui/console.c
index 348610dd43..a8868fc04f 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);
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 964eb515cf..1723cbe1df 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/qapi/ui.json b/qapi/ui.json
index 3e82f25ac5..5d01ad4304 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -77,6 +77,13 @@
#
# @filename: the path of a new PPM file to store the image
#
+# @device: ID of the display device that should be dumped. If this parameter
+# is missing, the primary display will be used. (Since 2.12)
+#
+# @head: head to use in case the device supports multiple heads. If this
+# parameter is missing, head #0 will be used. Also note that the head
+# can only be specified in conjunction with the device ID. (Since 2.12)
+#
# Returns: Nothing on success
#
# Since: 0.14.0
@@ -88,7 +95,8 @@
# <- { "return": {} }
#
##
-{ 'command': 'screendump', 'data': {'filename': 'str'} }
+{ 'command': 'screendump',
+ 'data': {'filename': 'str', '*device': 'str', '*head': 'int'} }
##
# == Spice
--
2.9.3
- [Qemu-devel] [PULL 00/14] Ui 20180312 patches, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 02/14] make: switch language file build to be gtk module aware, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 03/14] sdl: workaround bug in sdl 2.0.8 headers, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 01/14] build: try improve handling of clang warnings, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 09/14] ui/gtk-egl: add cursor_dmabuf support, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 10/14] vnc: deal with surface NULL pointers, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 07/14] ui/gtk: use GtkGlArea on wayland only, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 05/14] ui/gtk: group gtk.mo declarations in Makefile, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 14/14] qapi: Add device ID and head parameters to screendump,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 06/14] ui/opengl: Makefile cleanup, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 08/14] ui/gtk-egl: add scanout_dmabuf support, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 11/14] spice: drop dprint() debug logging, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 12/14] spice: add scanout_dmabuf support, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 04/14] ui/gtk: make GtkGlArea usage a runtime option, Gerd Hoffmann, 2018/03/12
- [Qemu-devel] [PULL 13/14] spice: add cursor_dmabuf support, Gerd Hoffmann, 2018/03/12
- Re: [Qemu-devel] [PULL 00/14] Ui 20180312 patches, Peter Maydell, 2018/03/12