|
|
383d26 |
From 24fd80b15ac39339607e43f9dca80f645b436557 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
383d26 |
Date: Tue, 14 Mar 2017 13:21:06 +0100
|
|
|
383d26 |
Subject: add qxl_screendump monitor command
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
383d26 |
Message-id: <1375866764-17766-2-git-send-email-kraxel@redhat.com>
|
|
|
383d26 |
Patchwork-id: 53033
|
|
|
383d26 |
O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] add qxl_screendump monitor command
|
|
|
383d26 |
Bugzilla: 903910
|
|
|
383d26 |
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
This patch ports the rhel-6 specific qxl_screendump command to rhel-7.
|
|
|
383d26 |
qxl_screendump takes the device id as additional argument and thus can
|
|
|
383d26 |
be used to take screenshots from non-primary displays.
|
|
|
383d26 |
|
|
|
383d26 |
The plan to get that functionality upstream in time failed, so we go for
|
|
|
383d26 |
plan b and carry forward the rhel-6 specific qxl_screendump command.
|
|
|
383d26 |
Thanks to the major console subsystem cleanups which made it upstream
|
|
|
383d26 |
the implementation is (a) alot less hackier than the rhel-6 one and (b)
|
|
|
383d26 |
not qxl-specific any more. Given that qxl is the only graphic device
|
|
|
383d26 |
which can work as secondary vga card the later is only a theoretical
|
|
|
383d26 |
benefit though ;)
|
|
|
383d26 |
|
|
|
383d26 |
RHEL-6 commit: 1c6074d107dff93c7c7b0edfb5da871504802946
|
|
|
383d26 |
|
|
|
383d26 |
bugzilla: #903910 - RHEL7 does not have equivalent functionality for
|
|
|
383d26 |
__com.redhat_qxl_screendump
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 211321c693f46d283205830c6c49b54d7250e98c)
|
|
|
383d26 |
|
|
|
383d26 |
Rebase notes (2.12.0):
|
|
|
383d26 |
- added prototype before definition
|
|
|
383d26 |
|
|
|
383d26 |
Rebase notes (2.9.0):
|
|
|
383d26 |
- documentation moved to qapi schema
|
|
|
383d26 |
|
|
|
383d26 |
Rebase notes (2.8.0):
|
|
|
383d26 |
- qmp-commands.hx replaced by docs/qmp-commands.txt (commit bd6092e)
|
|
|
383d26 |
- mhandler.cmd attribute renamed to cmd (commit 2b9e357)
|
|
|
383d26 |
|
|
|
383d26 |
Rebase notes (2.4.0):
|
|
|
383d26 |
- replace QERR_DEVICE_NOT_FOUND with ERROR_CLASS_DEVICE_NOT_FOUND
|
|
|
383d26 |
|
|
|
383d26 |
Merged patches (2.9.0):
|
|
|
383d26 |
- a3b59c0 HMP: Fix user manual typo of __com.redhat_qxl_screendump
|
|
|
383d26 |
|
|
|
383d26 |
Merged patches (2.6.0):
|
|
|
383d26 |
- f12846f __com.redhat_qxl_screendump: add docs
|
|
|
383d26 |
|
|
|
383d26 |
(cherry picked from commit 9ff701a5129653d6bd27c0b3cc249691cb6ce6a7)
|
|
|
383d26 |
(cherry picked from commit fd2ce5e462ee97f4538981f50e9bebc222fbe157)
|
|
|
383d26 |
(cherry picked from commit da2738aa88ba79de34abf9ce7de88920d0089fb3)
|
|
|
383d26 |
(cherry picked from commit 61fc62e6b6f217da00376b486c8927a5586c27b8)
|
|
|
383d26 |
(cherry picked from commit 4092812ff2d7a7dc7f2f62d49fa3a568ba78781f)
|
|
|
383d26 |
---
|
|
|
383d26 |
hmp-commands.hx | 14 ++++++++++++++
|
|
|
383d26 |
hmp.c | 10 ++++++++++
|
|
|
383d26 |
hmp.h | 1 +
|
|
|
383d26 |
qapi/misc.json | 22 ++++++++++++++++++++++
|
|
|
383d26 |
ui/console.c | 25 +++++++++++++++++++++++++
|
|
|
383d26 |
5 files changed, 72 insertions(+)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
|
|
383d26 |
index 3918831..01dcbb2 100644
|
|
|
383d26 |
--- a/hmp-commands.hx
|
|
|
383d26 |
+++ b/hmp-commands.hx
|
|
|
383d26 |
@@ -272,6 +272,20 @@ Save screen into PPM image @var{filename}.
|
|
|
383d26 |
ETEXI
|
|
|
383d26 |
|
|
|
383d26 |
{
|
|
|
383d26 |
+ .name = "__com.redhat_qxl_screendump",
|
|
|
383d26 |
+ .args_type = "id:s,filename:F",
|
|
|
383d26 |
+ .params = "id filename",
|
|
|
383d26 |
+ .help = "save screen from qxl device 'id' into PPM image 'filename'",
|
|
|
383d26 |
+ .cmd = hmp___com_redhat_qxl_screen_dump,
|
|
|
383d26 |
+ },
|
|
|
383d26 |
+
|
|
|
383d26 |
+STEXI
|
|
|
383d26 |
+@item __com.redhat_qxl_screendump @var{id} @var{filename}
|
|
|
383d26 |
+@findex __com.redhat_qxl_screendump
|
|
|
383d26 |
+Save screen from qxl device @var{id} into PPM image @var{filename}.
|
|
|
383d26 |
+ETEXI
|
|
|
383d26 |
+
|
|
|
383d26 |
+ {
|
|
|
383d26 |
.name = "logfile",
|
|
|
383d26 |
.args_type = "filename:F",
|
|
|
383d26 |
.params = "filename",
|
|
|
383d26 |
diff --git a/hmp.c b/hmp.c
|
|
|
383d26 |
index 6c92198..7a53e63 100644
|
|
|
383d26 |
--- a/hmp.c
|
|
|
383d26 |
+++ b/hmp.c
|
|
|
383d26 |
@@ -2160,6 +2160,16 @@ void hmp_screendump(Monitor *mon, const QDict *qdict)
|
|
|
383d26 |
hmp_handle_error(mon, &err;;
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
+void hmp___com_redhat_qxl_screen_dump(Monitor *mon, const QDict *qdict)
|
|
|
383d26 |
+{
|
|
|
383d26 |
+ const char *id = qdict_get_str(qdict, "id");
|
|
|
383d26 |
+ const char *filename = qdict_get_str(qdict, "filename");
|
|
|
383d26 |
+ Error *err = NULL;
|
|
|
383d26 |
+
|
|
|
383d26 |
+ qmp___com_redhat_qxl_screendump(id, filename, &err;;
|
|
|
383d26 |
+ hmp_handle_error(mon, &err;;
|
|
|
383d26 |
+}
|
|
|
383d26 |
+
|
|
|
383d26 |
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
|
|
|
383d26 |
{
|
|
|
383d26 |
const char *uri = qdict_get_str(qdict, "uri");
|
|
|
383d26 |
diff --git a/hmp.h b/hmp.h
|
|
|
383d26 |
index 4e2ec37..f85318c 100644
|
|
|
383d26 |
--- a/hmp.h
|
|
|
383d26 |
+++ b/hmp.h
|
|
|
383d26 |
@@ -97,6 +97,7 @@ void hmp_getfd(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
void hmp_closefd(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
void hmp_sendkey(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
void hmp_screendump(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
+void hmp___com_redhat_qxl_screen_dump(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
void hmp_nbd_server_remove(Monitor *mon, const QDict *qdict);
|
|
|
383d26 |
diff --git a/qapi/misc.json b/qapi/misc.json
|
|
|
383d26 |
index 5636f4a..045eb7c 100644
|
|
|
383d26 |
--- a/qapi/misc.json
|
|
|
383d26 |
+++ b/qapi/misc.json
|
|
|
383d26 |
@@ -2445,6 +2445,28 @@
|
|
|
383d26 |
{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
|
|
|
383d26 |
|
|
|
383d26 |
##
|
|
|
383d26 |
+# @__com.redhat_qxl_screendump:
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# Write a PPM of secondary qxl devices to a file.
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# @id: qxl device id
|
|
|
383d26 |
+# @filename: the path of a new PPM file to store the image
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# Returns: Nothing on success
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# Since: never (rhel-only, not upstream)
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# Example:
|
|
|
383d26 |
+#
|
|
|
383d26 |
+# -> { "execute": "__com.redhat_qxl_screendump",
|
|
|
383d26 |
+# "arguments": { "id": video1", "filename": "v1.ppm" } }
|
|
|
383d26 |
+# <- { "return": {} }
|
|
|
383d26 |
+#
|
|
|
383d26 |
+##
|
|
|
383d26 |
+{ 'command': '__com.redhat_qxl_screendump', 'data': { 'id' : 'str',
|
|
|
383d26 |
+ 'filename': 'str' } }
|
|
|
383d26 |
+
|
|
|
383d26 |
+##
|
|
|
383d26 |
# @TargetInfo:
|
|
|
383d26 |
#
|
|
|
383d26 |
# Information describing the QEMU target.
|
|
|
383d26 |
diff --git a/ui/console.c b/ui/console.c
|
|
|
383d26 |
index 3fb2f4e..73b2d3c 100644
|
|
|
383d26 |
--- a/ui/console.c
|
|
|
383d26 |
+++ b/ui/console.c
|
|
|
383d26 |
@@ -373,6 +373,31 @@ void qmp_screendump(const char *filename, bool has_device, const char *device,
|
|
|
383d26 |
ppm_save(filename, surface, errp);
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
+void qmp___com_redhat_qxl_screendump(const char *id, const char *filename, Error **errp);
|
|
|
383d26 |
+void qmp___com_redhat_qxl_screendump(const char *id, const char *filename, Error **errp)
|
|
|
383d26 |
+{
|
|
|
383d26 |
+ DeviceState *dev;
|
|
|
383d26 |
+ QemuConsole *con;
|
|
|
383d26 |
+ DisplaySurface *surface;
|
|
|
383d26 |
+
|
|
|
383d26 |
+ dev = qdev_find_recursive(sysbus_get_default(), id);
|
|
|
383d26 |
+ if (NULL == dev) {
|
|
|
383d26 |
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
|
|
383d26 |
+ "Device '%s' not found", id);
|
|
|
383d26 |
+ return;
|
|
|
383d26 |
+ }
|
|
|
383d26 |
+
|
|
|
383d26 |
+ con = qemu_console_lookup_by_device(dev, 0);
|
|
|
383d26 |
+ if (con == NULL) {
|
|
|
383d26 |
+ error_setg(errp, "Device %s has no QemuConsole attached to it.", id);
|
|
|
383d26 |
+ return;
|
|
|
383d26 |
+ }
|
|
|
383d26 |
+
|
|
|
383d26 |
+ graphic_hw_update(con);
|
|
|
383d26 |
+ surface = qemu_console_surface(con);
|
|
|
383d26 |
+ ppm_save(filename, surface, errp);
|
|
|
383d26 |
+}
|
|
|
383d26 |
+
|
|
|
383d26 |
void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata)
|
|
|
383d26 |
{
|
|
|
383d26 |
if (!con) {
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|