virtio-gpu: bugfixes, virtio-vga support.
Subsystems (4)
Gerd Hoffmann
maintainerPATCH 1/3 Add virtio-vga bits.
In reply to Gerd Hoffmann--- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 44 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-)
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +24 -20
@@ -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 );
Signature · 1 line
1.8.3.1
Gerd Hoffmann
maintainerPATCH 2/3 drm/virtgpu: initialise fbdev after getting initial display info
In reply to Gerd HoffmannFrom: Dave Airlie <[email protected]>
This should avoid issues with the fbdev path trying to render before we've gotten the display info.
[ kraxel: wait for display-info reply ]
--- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_kms.c | 4 +++- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -0
@@ -171,6 +171,7 @@ struct virtio_gpu_device {wait_queue_head_t resp_wq;/* current display info */ spinlock_t display_info_lock; +bool display_info_pending;struct virtio_gpu_fence_driver fence_drv;
drivers/gpu/drm/virtio/virtgpu_kms.c +3 -1
@@ -137,9 +137,11 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags)virtio_device_ready (vgdev->vdev); vgdev->vqs_ready = true; +virtio_gpu_cmd_get_display_info (vgdev); +wait_event_timeout (vgdev->resp_wq, !vgdev->display_info_pending, +5 *HZ );if (virtio_gpu_fbdev)virtio_gpu_fbdev_init (vgdev); -virtio_gpu_cmd_get_display_info (vgdev);return 0 ;
drivers/gpu/drm/virtio/virtgpu_vq.c +2 -0
@@ -534,6 +534,7 @@ static void virtio_gpu_cmd_get_display_info_cb(struct virtio_gpu_device *vgdev, } } + vgdev->display_info_pending = false;spin_unlock (&vgdev->display_info_lock);wake_up (&vgdev->resp_wq);
@@ -558,6 +559,7 @@ int virtio_gpu_cmd_get_display_info(struct virtio_gpu_device *vgdev) resp_buf);memset (cmd_p,0 ,sizeof (*cmd_p)); + vgdev->display_info_pending = true; cmd_p->type =cpu_to_le32 (VIRTIO_GPU_CMD_GET_DISPLAY_INFO );virtio_gpu_queue_ctrl_buffer (vgdev, vbuf);return 0 ;
Signature · 1 line
1.8.3.1
Gerd Hoffmann
maintainerPATCH 3/3 virtio-gpu: add locking for vbuf pool
In reply to Gerd HoffmannFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_vq.c | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -0
@@ -162,6 +162,7 @@ struct virtio_gpu_device {struct virtio_gpu_queue ctrlq;struct virtio_gpu_queue cursorq;struct list_head free_vbufs; +spinlock_t free_vbufs_lock;void *vbufs;bool vqs_ready;
drivers/gpu/drm/virtio/virtgpu_vq.c +7 -0
@@ -79,6 +79,7 @@ int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev)void *ptr;INIT_LIST_HEAD (&vgdev->free_vbufs); +spin_lock_init (&vgdev->free_vbufs_lock); count +=virtqueue_get_vring_size (vgdev->ctrlq.vq); count +=virtqueue_get_vring_size (vgdev->cursorq.vq); size = count *VBUFFER_SIZE ;
@@ -106,6 +107,7 @@ void virtio_gpu_free_vbufs(struct virtio_gpu_device *vgdev) count +=virtqueue_get_vring_size (vgdev->ctrlq.vq); count +=virtqueue_get_vring_size (vgdev->cursorq.vq); +spin_lock (&vgdev->free_vbufs_lock);for (i =0 ; i < count; i++) {if (WARN_ON (list_empty (&vgdev->free_vbufs)))return ;
@@ -113,6 +115,7 @@ void virtio_gpu_free_vbufs(struct virtio_gpu_device *vgdev) struct virtio_gpu_vbuffer, list);list_del (&vbuf->list); } +spin_unlock (&vgdev->free_vbufs_lock);kfree (vgdev->vbufs); }
@@ -123,10 +126,12 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev, {struct virtio_gpu_vbuffer *vbuf; +spin_lock (&vgdev->free_vbufs_lock);BUG_ON (list_empty (&vgdev->free_vbufs)); vbuf =list_first_entry (&vgdev->free_vbufs, struct virtio_gpu_vbuffer, list);list_del (&vbuf->list); +spin_unlock (&vgdev->free_vbufs_lock);memset (vbuf,0 ,VBUFFER_SIZE );BUG_ON (size >MAX_INLINE_CMD_SIZE );
@@ -201,7 +206,9 @@ static void free_vbuf(struct virtio_gpu_device *vgdev,if (vbuf->resp_size >MAX_INLINE_RESP_SIZE )kfree (vbuf->resp_buf);kfree (vbuf->data_buf); +spin_lock (&vgdev->free_vbufs_lock);list_add (&vbuf->list, &vgdev->free_vbufs); +spin_unlock (&vgdev->free_vbufs_lock); }static void reclaim_vbufs (struct virtqueue *vq,struct list_head *reclaim_list)
Signature · 1 line
1.8.3.1
Gerd Hoffmann
maintainercover virtio-gpu: bugfixes, virtio-vga support.
Hi,
Here comes a bugfix collection for virtio-gpu and support for the virtio-vga device (where we have to take care to kick out vesafb/efifb).
Patches and git branch are for drm-next.
please review & pick up,
Gerd
The following changes since commit 284b2884a967dbd98b4c4cf7a8b583f974affca4:
Merge tag 'omapdrm-4.2-atomic' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next (2015-06-16 11:16:02 +1000)
are available in the git repository at:
git://git.kraxel.org/linux virtio-gpu-drm-next
for you to fetch changes up to d5084f1711c8917d48006e19099060b3b8387bb5:
virtio-gpu: add locking for vbuf pool (2015-06-16 11:22:41 +0200)
----------------------------------------------------------------
Dave Airlie (2):
drm/virtgpu: initialise fbdev after getting initial display info
virtio-gpu: add locking for vbuf pool
Gerd Hoffmann (1):
Add virtio-vga bits.
drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 44 +++++++++++++++++--------------- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_kms.c | 4 ++- drivers/gpu/drm/virtio/virtgpu_vq.c | 9 +++++++ 4 files changed, 38 insertions(+), 21 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH 2/3 drm/virtgpu: initialise fbdev after getting initial display info
From: Dave Airlie <[email protected]>
This should avoid issues with the fbdev path trying to render before we've gotten the display info.
[ kraxel: wait for display-info reply ]
--- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_kms.c | 4 +++- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -0
@@ -171,6 +171,7 @@ struct virtio_gpu_device {wait_queue_head_t resp_wq;/* current display info */ spinlock_t display_info_lock; +bool display_info_pending;struct virtio_gpu_fence_driver fence_drv;
drivers/gpu/drm/virtio/virtgpu_kms.c +3 -1
@@ -137,9 +137,11 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags)virtio_device_ready (vgdev->vdev); vgdev->vqs_ready = true; +virtio_gpu_cmd_get_display_info (vgdev); +wait_event_timeout (vgdev->resp_wq, !vgdev->display_info_pending, +5 *HZ );if (virtio_gpu_fbdev)virtio_gpu_fbdev_init (vgdev); -virtio_gpu_cmd_get_display_info (vgdev);return 0 ;
drivers/gpu/drm/virtio/virtgpu_vq.c +2 -0
@@ -534,6 +534,7 @@ static void virtio_gpu_cmd_get_display_info_cb(struct virtio_gpu_device *vgdev, } } + vgdev->display_info_pending = false;spin_unlock (&vgdev->display_info_lock);wake_up (&vgdev->resp_wq);
@@ -558,6 +559,7 @@ int virtio_gpu_cmd_get_display_info(struct virtio_gpu_device *vgdev) resp_buf);memset (cmd_p,0 ,sizeof (*cmd_p)); + vgdev->display_info_pending = true; cmd_p->type =cpu_to_le32 (VIRTIO_GPU_CMD_GET_DISPLAY_INFO );virtio_gpu_queue_ctrl_buffer (vgdev, vbuf);return 0 ;
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel