From nobody Mon Feb 9 16:02:28 2026 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528893308275781.6007698324306; Wed, 13 Jun 2018 05:35:08 -0700 (PDT) Received: from localhost ([::1]:33828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT4zQ-0006AD-5n for importer@patchew.org; Wed, 13 Jun 2018 08:35:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT4uU-0002sn-My for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:29:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fT4uT-00064r-Hq for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:29:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47152 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fT4uP-0005q7-1S; Wed, 13 Jun 2018 08:29:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FB31857A3; Wed, 13 Jun 2018 12:29:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-109.ams2.redhat.com [10.36.116.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35D69201E820; Wed, 13 Jun 2018 12:29:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 16D6524EF18; Wed, 13 Jun 2018 14:29:49 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 13 Jun 2018 14:29:47 +0200 Message-Id: <20180613122948.18149-4-kraxel@redhat.com> In-Reply-To: <20180613122948.18149-1-kraxel@redhat.com> References: <20180613122948.18149-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 13 Jun 2018 12:29:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 13 Jun 2018 12:29:52 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v5 3/4] hw/vfio/display: add ramfb support 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: Peter Maydell , Eduardo Habkost , "Michael S. Tsirkin" , Alex Williamson , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?L=C3=A1szl=C3=B3=20=C3=89rsek?= , Richard Henderson 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" So we have a boot display when using a vgpu as primary display. Use vfio-pci-ramfb instead of vfio-pci to enable it. Signed-off-by: Gerd Hoffmann --- include/hw/vfio/vfio-common.h | 2 ++ hw/vfio/display.c | 12 ++++++++++++ hw/vfio/pci.c | 15 +++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index a9036929b2..a58d7e7e77 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -26,6 +26,7 @@ #include "qemu/queue.h" #include "qemu/notify.h" #include "ui/console.h" +#include "hw/display/ramfb.h" #ifdef CONFIG_LINUX #include #endif @@ -143,6 +144,7 @@ typedef struct VFIODMABuf { =20 typedef struct VFIODisplay { QemuConsole *con; + RAMFBState *ramfb; struct { VFIORegion buffer; DisplaySurface *surface; diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 59c0e5d1d7..3901f580c6 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -124,6 +124,9 @@ static void vfio_display_dmabuf_update(void *opaque) =20 primary =3D vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY); if (primary =3D=3D NULL) { + if (dpy->ramfb) { + ramfb_display_update(dpy->con, dpy->ramfb); + } return; } =20 @@ -181,6 +184,9 @@ static int vfio_display_dmabuf_init(VFIOPCIDevice *vdev= , Error **errp) vdev->dpy->con =3D graphic_console_init(DEVICE(vdev), 0, &vfio_display_dmabuf_ops, vdev); + if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") =3D=3D= 0) { + vdev->dpy->ramfb =3D ramfb_setup(errp); + } return 0; } =20 @@ -228,6 +234,9 @@ static void vfio_display_region_update(void *opaque) return; } if (!plane.drm_format || !plane.size) { + if (dpy->ramfb) { + ramfb_display_update(dpy->con, dpy->ramfb); + } return; } format =3D qemu_drm_format_to_pixman(plane.drm_format); @@ -300,6 +309,9 @@ static int vfio_display_region_init(VFIOPCIDevice *vdev= , Error **errp) vdev->dpy->con =3D graphic_console_init(DEVICE(vdev), 0, &vfio_display_region_ops, vdev); + if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") =3D=3D= 0) { + vdev->dpy->ramfb =3D ramfb_setup(errp); + } return 0; } =20 diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 18c493b49e..6a2b42a595 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3234,9 +3234,24 @@ static const TypeInfo vfio_pci_dev_info =3D { }, }; =20 +static void vfio_pci_ramfb_dev_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->hotpluggable =3D false; +} + +static const TypeInfo vfio_pci_ramfb_dev_info =3D { + .name =3D "vfio-pci-ramfb", + .parent =3D "vfio-pci", + .instance_size =3D sizeof(VFIOPCIDevice), + .class_init =3D vfio_pci_ramfb_dev_class_init, +}; + static void register_vfio_pci_dev_type(void) { type_register_static(&vfio_pci_dev_info); + type_register_static(&vfio_pci_ramfb_dev_info); } =20 type_init(register_vfio_pci_dev_type) --=20 2.9.3