From patchwork Mon Sep 10 06:43:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 10593605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A660B14E5 for ; Mon, 10 Sep 2018 06:45:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96DFA28DD4 for ; Mon, 10 Sep 2018 06:45:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B71D28DEE; Mon, 10 Sep 2018 06:45:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 31DFB28DD4 for ; Mon, 10 Sep 2018 06:45:45 +0000 (UTC) Received: from localhost ([::1]:50036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzFxA-0004gV-Ef for patchwork-qemu-devel@patchwork.kernel.org; Mon, 10 Sep 2018 02:45:44 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 { 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) primary = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY); if (primary == NULL) { + if (dpy->ramfb) { + ramfb_display_update(dpy->con, dpy->ramfb); + } return; } @@ -181,6 +184,9 @@ static int vfio_display_dmabuf_init(VFIOPCIDevice *vdev, Error **errp) vdev->dpy->con = graphic_console_init(DEVICE(vdev), 0, &vfio_display_dmabuf_ops, vdev); + if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0) { + vdev->dpy->ramfb = ramfb_setup(errp); + } return 0; } @@ -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 = 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 = graphic_console_init(DEVICE(vdev), 0, &vfio_display_region_ops, vdev); + if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0) { + vdev->dpy->ramfb = ramfb_setup(errp); + } return 0; } 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 = { }, }; +static void vfio_pci_ramfb_dev_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->hotpluggable = false; +} + +static const TypeInfo vfio_pci_ramfb_dev_info = { + .name = "vfio-pci-ramfb", + .parent = "vfio-pci", + .instance_size = sizeof(VFIOPCIDevice), + .class_init = 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); } type_init(register_vfio_pci_dev_type)