From nobody Wed Nov 5 18:35:55 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; 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 1536561981258727.274850317644; Sun, 9 Sep 2018 23:46:21 -0700 (PDT) Received: from localhost ([::1]:50036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzFxk-0004gV-6E for importer@patchew.org; Mon, 10 Sep 2018 02:46:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzFvu-0003fP-9I for qemu-devel@nongnu.org; Mon, 10 Sep 2018 02:44:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzFvI-0006E6-44 for qemu-devel@nongnu.org; Mon, 10 Sep 2018 02:43:51 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38536 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 1fzFvH-0006D8-SX for qemu-devel@nongnu.org; Mon, 10 Sep 2018 02:43:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02E2E40216EA for ; Mon, 10 Sep 2018 06:43:46 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDF3F63F41; Mon, 10 Sep 2018 06:43:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 28F2D4FD7D; Mon, 10 Sep 2018 08:43:40 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 10 Sep 2018 08:43:40 +0200 Message-Id: <20180910064340.30745-3-kraxel@redhat.com> In-Reply-To: <20180910064340.30745-1-kraxel@redhat.com> References: <20180910064340.30745-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 10 Sep 2018 06:43:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 10 Sep 2018 06:43:46 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/2] 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: Paolo Bonzini , Alex Williamson , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 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 821def0565..0d85a0a6f8 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 @@ -146,6 +147,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 866f0deeb7..7c0628756e 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3258,9 +3258,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