From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEIFw-0007Ow-MK for qemu-devel@nongnu.org; Wed, 19 Sep 2012 07:15:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEIFu-0001RU-WE for qemu-devel@nongnu.org; Wed, 19 Sep 2012 07:15:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEIFu-0001Qp-MO for qemu-devel@nongnu.org; Wed, 19 Sep 2012 07:15:46 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8JBFkU7002315 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 19 Sep 2012 07:15:46 -0400 From: Gerd Hoffmann Date: Wed, 19 Sep 2012 13:15:37 +0200 Message-Id: <1348053341-29212-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1348053341-29212-1-git-send-email-kraxel@redhat.com> References: <1348053341-29212-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 5/9] fbdev: add monitor command to enable/disable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann This patch adds a fbdev monitor command to enable/disable the fbdev display at runtime to both qmp and hmp. qmp: framebuffer-display enable=on|off hmp: framebuffer-display on|off Signed-off-by: Gerd Hoffmann --- hmp-commands.hx | 15 +++++++++++++++ hmp.c | 9 +++++++++ hmp.h | 1 + qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 6 ++++++ qmp.c | 19 +++++++++++++++++++ 6 files changed, 63 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index ed67e99..93e75ab 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1377,6 +1377,21 @@ passed since 1970, i.e. unix epoch. ETEXI { + .name = "framebuffer-display", + .args_type = "enable:b", + .params = "on|off", + .help = "enable/disable linux console framebuffer display", + .mhandler.cmd = hmp_framebuffer_display, + }, + +STEXI +@item framebuffer-display on | off +@findex framebuffer-display + +enable/disable linux console framebuffer display. +ETEXI + + { .name = "info", .args_type = "item:s?", .params = "[subcommand]", diff --git a/hmp.c b/hmp.c index ba6fbd3..9677ef6 100644 --- a/hmp.c +++ b/hmp.c @@ -1168,3 +1168,12 @@ void hmp_screen_dump(Monitor *mon, const QDict *qdict) qmp_screendump(filename, &err); hmp_handle_error(mon, &err); } + +void hmp_framebuffer_display(Monitor *mon, const QDict *qdict) +{ + int enable = qdict_get_bool(qdict, "enable"); + Error *errp = NULL; + + qmp_framebuffer_display(enable, &errp); + hmp_handle_error(mon, &errp); +} diff --git a/hmp.h b/hmp.h index 48b9c59..20aa08c 100644 --- a/hmp.h +++ b/hmp.h @@ -73,5 +73,6 @@ void hmp_getfd(Monitor *mon, const QDict *qdict); void hmp_closefd(Monitor *mon, const QDict *qdict); void hmp_send_key(Monitor *mon, const QDict *qdict); void hmp_screen_dump(Monitor *mon, const QDict *qdict); +void hmp_framebuffer_display(Monitor *mon, const QDict *qdict); #endif diff --git a/qapi-schema.json b/qapi-schema.json index 14e4419..87c77f7 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -2619,3 +2619,16 @@ # Since: 0.14.0 ## { 'command': 'screendump', 'data': {'filename': 'str'} } + +# @framebuffer-display: +# +# Enable/disable linux console framebuffer display. +# +# @enable: whenever the framebuffer display should be enabled or disabled. +# +# Returns: Nothing. +# +# Since: 1.3 +# +## +{ 'command': 'framebuffer-display', 'data': {'enable': 'bool'} } diff --git a/qmp-commands.hx b/qmp-commands.hx index 6e21ddb..e0a747a 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2539,3 +2539,9 @@ EQMP .args_type = "", .mhandler.cmd_new = qmp_marshal_input_query_target, }, + + { + .name = "framebuffer-display", + .args_type = "enable:b", + .mhandler.cmd_new = qmp_marshal_input_framebuffer_display, + }, diff --git a/qmp.c b/qmp.c index 8463922..56e007f 100644 --- a/qmp.c +++ b/qmp.c @@ -391,6 +391,25 @@ void qmp_change(const char *device, const char *target, } } +void qmp_framebuffer_display(bool enable, Error **errp) +{ +#if defined(CONFIG_LINUX) + DisplayState *ds = get_displaystate(); + + if (enable) { + if (fbdev_display_init(ds, NULL, errp) != 0) { + if (!error_is_set(errp)) { + error_setg(errp, "fbdev initialization failed"); + } + } + } else { + fbdev_display_uninit(ds); + } +#else + error_setg(errp, "fbdev support disabled at compile time"); +#endif +} + static void qom_list_types_tramp(ObjectClass *klass, void *data) { ObjectTypeInfoList *e, **pret = data; -- 1.7.1