From patchwork Thu Sep 13 09:19:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 183574 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 29D872C008D for ; Thu, 13 Sep 2012 19:30:22 +1000 (EST) Received: from localhost ([::1]:36372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC5ka-00085k-7P for incoming@patchwork.ozlabs.org; Thu, 13 Sep 2012 05:30:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC5ab-0003sZ-Mj for qemu-devel@nongnu.org; Thu, 13 Sep 2012 05:20:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TC5aU-0004iD-Gh for qemu-devel@nongnu.org; Thu, 13 Sep 2012 05:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC5aU-0004i0-8B for qemu-devel@nongnu.org; Thu, 13 Sep 2012 05:19:54 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8D9JrtE005379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Sep 2012 05:19:53 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-20.ams2.redhat.com [10.36.116.20]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8D9JpTC006371; Thu, 13 Sep 2012 05:19:53 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 20FBB40C7E; Thu, 13 Sep 2012 11:19:49 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 13 Sep 2012 11:19:45 +0200 Message-Id: <1347527989-3986-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1347527989-3986-1-git-send-email-kraxel@redhat.com> References: <1347527989-3986-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH v2 5/9] fbdev: add monitor command to enable/disable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds a fbdev monitor command to enable/disable the fbdev display at runtime to both qmp and hmp. qmp: fbdev enable=on|off hmp: fbdev on|off Signed-off-by: Gerd Hoffmann --- hmp-commands.hx | 15 +++++++++++++++ hmp.c | 9 +++++++++ hmp.h | 1 + qapi-schema.json | 14 ++++++++++++++ qmp-commands.hx | 6 ++++++ qmp.c | 17 +++++++++++++++++ 6 files changed, 62 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index ed67e99..366a92b 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1377,6 +1377,21 @@ passed since 1970, i.e. unix epoch. ETEXI { + .name = "fbdev", + .args_type = "enable:b", + .params = "on|off", + .help = "enable/disable fbdev", + .mhandler.cmd = hmp_fbdev, + }, + +STEXI +@item fbdev on | off +@findex fbdev + +enable/disable fbdev +ETEXI + + { .name = "info", .args_type = "item:s?", .params = "[subcommand]", diff --git a/hmp.c b/hmp.c index ba6fbd3..a7feec5 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_fbdev(Monitor *mon, const QDict *qdict) +{ + int enable = qdict_get_bool(qdict, "enable"); + Error *errp = NULL; + + qmp_fbdev(enable, &errp); + hmp_handle_error(mon, &errp); +} diff --git a/hmp.h b/hmp.h index 48b9c59..9c3d315 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_fbdev(Monitor *mon, const QDict *qdict); #endif diff --git a/qapi-schema.json b/qapi-schema.json index a9f465a..ea8c3c5 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -2555,3 +2555,17 @@ # Since: 0.14.0 ## { 'command': 'screendump', 'data': {'filename': 'str'} } + +# @fbdev: +# +# Enable/disable fbdev. +# +# @enable: true to set the link status to be up +# +# Returns: Nothing on success +# GenericError on failure. +# +# Since: 1.3 +# +## +{ 'command': 'fbdev', 'data': {'enable': 'bool'} } diff --git a/qmp-commands.hx b/qmp-commands.hx index 6e21ddb..4b95fd0 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 = "fbdev", + .args_type = "enable:b", + .mhandler.cmd_new = qmp_marshal_input_fbdev, + }, diff --git a/qmp.c b/qmp.c index 8463922..7f6cc0b 100644 --- a/qmp.c +++ b/qmp.c @@ -391,6 +391,23 @@ void qmp_change(const char *device, const char *target, } } +void qmp_fbdev(bool enable, Error **errp) +{ +#if defined(CONFIG_LINUX) + DisplayState *ds = get_displaystate(); + + if (enable) { + if (fbdev_display_init(ds, NULL) != 0) { + error_setg(errp, "fbdev initialization failed"); + } + } else { + fbdev_display_uninit(ds); + } +#else + error_set(errp, QERR_FEATURE_DISABLED, "fbdev"); +#endif +} + static void qom_list_types_tramp(ObjectClass *klass, void *data) { ObjectTypeInfoList *e, **pret = data;