From nobody Wed Nov 5 09:43:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499452684473568.307932235157; Fri, 7 Jul 2017 11:38:04 -0700 (PDT) Received: from localhost ([::1]:58288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTY8h-0008GA-65 for importer@patchew.org; Fri, 07 Jul 2017 14:38:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTY18-000247-4w for qemu-devel@nongnu.org; Fri, 07 Jul 2017 14:30:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTY14-0006lG-Mo for qemu-devel@nongnu.org; Fri, 07 Jul 2017 14:30:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:36964) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTY14-0006kO-EL for qemu-devel@nongnu.org; Fri, 07 Jul 2017 14:30:10 -0400 Received: from localhost.localdomain (162-198-228-33.lightspeed.wlfrct.sbcglobal.net [162.198.228.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 46D8822B50; Fri, 7 Jul 2017 18:30:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46D8822B50 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=sstabellini@kernel.org From: Stefano Stabellini To: peter.maydell@linaro.org, stefanha@gmail.com Date: Fri, 7 Jul 2017 11:30:02 -0700 Message-Id: <1499452204-20769-1-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 198.145.29.99 Subject: [Qemu-devel] [PULL 1/3] xenfb: remove xen_init_display "temporary" hack X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, xen-devel@lists.xenproject.org, sstabellini@kernel.org, qemu-devel@nongnu.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Initialize xenfb properly, as all other backends, from its own "initialise" function. Remove the dependency of vkbd on vfb: use qemu_console_lookup_by_index to find the principal console (to get the size of the screen) instead of relying on a vfb backend to be available (which adds a dependency between the two). Signed-off-by: Stefano Stabellini Reviewed-by: Paul Durrant --- hw/display/xenfb.c | 81 ++++++++++------------------------------= ---- hw/xenpv/xen_machine_pv.c | 3 -- include/hw/xen/xen_backend.h | 2 -- 3 files changed, 18 insertions(+), 68 deletions(-) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index e76c0d8..df8b78f 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -46,7 +46,6 @@ struct common { struct XenDevice xendev; /* must be first */ void *page; - QemuConsole *con; }; =20 struct XenInput { @@ -61,6 +60,7 @@ struct XenInput { =20 struct XenFB { struct common c; + QemuConsole *con; size_t fb_len; int row_stride; int depth; @@ -71,7 +71,6 @@ struct XenFB { int fbpages; int feature_update; int bug_trigger; - int have_console; int do_resize; =20 struct { @@ -80,6 +79,7 @@ struct XenFB { int up_count; int up_fullscreen; }; +static const GraphicHwOps xenfb_ops; =20 /* -------------------------------------------------------------------- */ =20 @@ -306,10 +306,18 @@ static void xenfb_mouse_event(void *opaque, int dx, int dy, int dz, int button_state) { struct XenInput *xenfb =3D opaque; - DisplaySurface *surface =3D qemu_console_surface(xenfb->c.con); - int dw =3D surface_width(surface); - int dh =3D surface_height(surface); - int i; + QemuConsole *con =3D qemu_console_lookup_by_index(0); + DisplaySurface *surface; + int dw, dh, i; + + if (!con) { + xen_pv_printf(&xenfb->c.xendev, 0, "No QEMU console available"); + return; + } + + surface =3D qemu_console_surface(con); + dw =3D surface_width(surface); + dh =3D surface_height(surface); =20 trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state, xenfb->abs_pointer_wanted); @@ -344,11 +352,6 @@ static int input_initialise(struct XenDevice *xendev) struct XenInput *in =3D container_of(xendev, struct XenInput, c.xendev= ); int rc; =20 - if (!in->c.con) { - xen_pv_printf(xendev, 1, "ds not set (yet)\n"); - return -1; - } - rc =3D common_bind(&in->c); if (rc !=3D 0) return rc; @@ -608,7 +611,7 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size= _t fb_len_lim, */ static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int= h) { - DisplaySurface *surface =3D qemu_console_surface(xenfb->c.con); + DisplaySurface *surface =3D qemu_console_surface(xenfb->con); int line, oops =3D 0; int bpp =3D surface_bits_per_pixel(surface); int linesize =3D surface_stride(surface); @@ -642,7 +645,7 @@ static void xenfb_guest_copy(struct XenFB *xenfb, int x= , int y, int w, int h) xen_pv_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp= ?\n", __FUNCTION__, xenfb->depth, bpp); =20 - dpy_gfx_update(xenfb->c.con, x, y, w, h); + dpy_gfx_update(xenfb->con, x, y, w, h); } =20 #ifdef XENFB_TYPE_REFRESH_PERIOD @@ -728,7 +731,7 @@ static void xenfb_update(void *opaque) surface =3D qemu_create_displaysurface(xenfb->width, xenfb->he= ight); break; } - dpy_gfx_replace_surface(xenfb->c.con, surface); + dpy_gfx_replace_surface(xenfb->con, surface); xen_pv_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d @ %d bpp%s\n", xenfb->width, xenfb->height, xenfb->depth, @@ -877,16 +880,7 @@ static int fb_initialise(struct XenDevice *xendev) if (rc !=3D 0) return rc; =20 -#if 0 /* handled in xen_init_display() for now */ - if (!fb->have_console) { - fb->c.ds =3D graphic_console_init(xenfb_update, - xenfb_invalidate, - NULL, - NULL, - fb); - fb->have_console =3D 1; - } -#endif + fb->con =3D graphic_console_init(NULL, 0, &xenfb_ops, fb); =20 if (xenstore_read_fe_int(xendev, "feature-update", &fb->feature_update= ) =3D=3D -1) fb->feature_update =3D 0; @@ -972,42 +966,3 @@ static const GraphicHwOps xenfb_ops =3D { .gfx_update =3D xenfb_update, .update_interval =3D xenfb_update_interval, }; - -/* - * FIXME/TODO: Kill this. - * Temporary needed while DisplayState reorganization is in flight. - */ -void xen_init_display(int domid) -{ - struct XenDevice *xfb, *xin; - struct XenFB *fb; - struct XenInput *in; - int i =3D 0; - -wait_more: - i++; - main_loop_wait(true); - xfb =3D xen_pv_find_xendev("vfb", domid, 0); - xin =3D xen_pv_find_xendev("vkbd", domid, 0); - if (!xfb || !xin) { - if (i < 256) { - usleep(10000); - goto wait_more; - } - xen_pv_printf(NULL, 1, "displaystate setup failed\n"); - return; - } - - /* vfb */ - fb =3D container_of(xfb, struct XenFB, c.xendev); - fb->c.con =3D graphic_console_init(NULL, 0, &xenfb_ops, fb); - fb->have_console =3D 1; - - /* vkbd */ - in =3D container_of(xin, struct XenInput, c.xendev); - in->c.con =3D fb->c.con; - - /* retry ->init() */ - xen_be_check_state(xin); - xen_be_check_state(xfb); -} diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index 79aef4e..31d2f25 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -94,9 +94,6 @@ static void xen_init_pv(MachineState *machine) =20 /* config cleanup hook */ atexit(xen_config_cleanup); - - /* setup framebuffer */ - xen_init_display(xen_domid); } =20 static void xenpv_machine_init(MachineClass *mc) diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index 852c2ea..8a6fbcb 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -55,8 +55,6 @@ extern struct XenDevOps xen_netdev_ops; /* xen_nic.= c */ extern struct XenDevOps xen_usb_ops; /* xen-usb.c */ #endif =20 -void xen_init_display(int domid); - /* configuration (aka xenbus setup) */ void xen_config_cleanup(void); int xen_config_dev_blk(DriveInfo *disk); --=20 1.9.1