ae23c9
From 056ced52b46ff725b79c04813467ce0643c1b878 Mon Sep 17 00:00:00 2001
ae23c9
From: Gerd Hoffmann <kraxel@redhat.com>
ae23c9
Date: Fri, 14 Dec 2018 08:26:42 +0000
ae23c9
Subject: [PATCH 5/5] qapi: add query-display-options command
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
ae23c9
Message-id: <20181214082642.21878-6-kraxel@redhat.com>
ae23c9
Patchwork-id: 83503
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 5/5] qapi: add query-display-options command
ae23c9
Bugzilla: 1652871
ae23c9
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ae23c9
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
ae23c9
RH-Acked-by: Erik Skultety <eskultet@redhat.com>
ae23c9
ae23c9
Add query-display-options command, which allows querying the qemu
ae23c9
display configuration.  This isn't particularly useful, except it
ae23c9
exposes QAPI type DisplayOptions in query-qmp-schema, so that libvirt
ae23c9
can discover recently added -display parameter rendernode (commit
ae23c9
d4dc4ab133b).  Works around lack of sufficiently powerful command line
ae23c9
introspection.
ae23c9
ae23c9
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
Tested-by: Eric Blake <eblake@redhat.com>
ae23c9
Tested-by: Erik Skultety <eskultet@redhat.com>
ae23c9
Message-id: 20181122071613.2889-1-kraxel@redhat.com
ae23c9
ae23c9
[ kraxel: reworded commit message as suggested by armbru ]
ae23c9
ae23c9
(cherry picked from commit e1ca8f7e1915496148f6e0ce1f7c2309af013312)
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
ae23c9
Conflicts:
ae23c9
	qapi/ui.json
ae23c9
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 qapi/ui.json | 13 +++++++++++++
ae23c9
 vl.c         |  6 ++++++
ae23c9
 2 files changed, 19 insertions(+)
ae23c9
ae23c9
diff --git a/qapi/ui.json b/qapi/ui.json
ae23c9
index 3e8aeee..1475867 100644
ae23c9
--- a/qapi/ui.json
ae23c9
+++ b/qapi/ui.json
ae23c9
@@ -1071,3 +1071,16 @@
ae23c9
                 'egl-headless'   : 'DisplayEGLHeadless',
ae23c9
                 'curses'         : 'DisplayNoOpts',
ae23c9
                 'cocoa'          : 'DisplayNoOpts' } }
ae23c9
+
ae23c9
+##
ae23c9
+# @query-display-options:
ae23c9
+#
ae23c9
+# Returns information about display configuration
ae23c9
+#
ae23c9
+# Returns: @DisplayOptions
ae23c9
+#
ae23c9
+# Since: 3.1
ae23c9
+#
ae23c9
+##
ae23c9
+{ 'command': 'query-display-options',
ae23c9
+  'returns': 'DisplayOptions' }
ae23c9
diff --git a/vl.c b/vl.c
ae23c9
index a4d1e3f..9d32921 100644
ae23c9
--- a/vl.c
ae23c9
+++ b/vl.c
ae23c9
@@ -131,6 +131,7 @@ int main(int argc, char **argv)
ae23c9
 #include "qapi/qapi-commands-block-core.h"
ae23c9
 #include "qapi/qapi-commands-misc.h"
ae23c9
 #include "qapi/qapi-commands-run-state.h"
ae23c9
+#include "qapi/qapi-commands-ui.h"
ae23c9
 #include "qapi/qmp/qerror.h"
ae23c9
 #include "sysemu/iothread.h"
ae23c9
 
ae23c9
@@ -2138,6 +2139,11 @@ static void parse_display_qapi(const char *optarg)
ae23c9
     visit_free(v);
ae23c9
 }
ae23c9
 
ae23c9
+DisplayOptions *qmp_query_display_options(Error **errp)
ae23c9
+{
ae23c9
+    return QAPI_CLONE(DisplayOptions, &dpy);
ae23c9
+}
ae23c9
+
ae23c9
 static void parse_display(const char *p)
ae23c9
 {
ae23c9
     const char *opts;
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9