diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2015-03-26 16:29:29 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2015-06-16 11:22:40 +0200 |
commit | 50cb941a26b9311c39ba59567fcfad48f5eab4a3 (patch) | |
tree | 7eff16b504b69567862faf1cc0b7144cf6763998 /drivers | |
parent | 284b2884a967dbd98b4c4cf7a8b583f974affca4 (diff) |
Add virtio-vga bits.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c index f4ec816e9468..88a39165edd5 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c +++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c @@ -37,6 +37,26 @@ int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master) return 0; } +static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) +{ + struct apertures_struct *ap; + bool primary; + + ap = alloc_apertures(1); + if (!ap) + return; + + ap->ranges[0].base = pci_resource_start(pci_dev, 0); + ap->ranges[0].size = pci_resource_len(pci_dev, 0); + + primary = pci_dev->resource[PCI_ROM_RESOURCE].flags + & IORESOURCE_ROM_SHADOW; + + remove_conflicting_framebuffers(ap, "virtiodrmfb", primary); + + kfree(ap); +} + int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev) { struct drm_device *dev; @@ -52,27 +72,11 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev) struct pci_dev *pdev = to_pci_dev(vdev->dev.parent); bool vga = (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA; - if (vga) { - /* - * Need to make sure we don't have two drivers - * for the same hardware here. Some day we - * will simply kick out the firmware - * (vesa/efi) framebuffer. - * - * Virtual hardware specs for virtio-vga are - * not finalized yet, therefore we can't add - * code for that yet. - * - * So ignore the device for the time being, - * and suggest to the user use the device - * variant without vga compatibility mode. - */ - DRM_ERROR("virtio-vga not (yet) supported\n"); - DRM_ERROR("please use virtio-gpu-pci instead\n"); - ret = -ENODEV; - goto err_free; - } + DRM_INFO("pci: %s detected\n", + vga ? "virtio-vga" : "virtio-gpu-pci"); dev->pdev = pdev; + if (vga) + virtio_pci_kick_out_firmware_fb(pdev); } ret = drm_dev_register(dev, 0); |