aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/virtio
AgeCommit message (Collapse)AuthorFilesLines
2020-02-10drm/virtio: simplify virtio_gpu_alloc_cmdGerd Hoffmann1-17/+9
Just call virtio_gpu_alloc_cmd_resp with some fixed args instead of duplicating most of the function body. Signed-off-by: Gerd Hoffmann <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Chia-I Wu <[email protected]>
2020-02-07drm/virtio: fix ring free checkGerd Hoffmann4-0/+8
If the virtio device supports indirect ring descriptors we need only one ring entry for the whole command. Take that into account when checking whenever the virtqueue has enough free entries for our command. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-06drm/virtio: move virtqueue_notify into virtio_gpu_queue_ctrl_sgsChia-I Wu1-12/+10
It becomes clear that virtio_gpu_queue_fenced_ctrl_buffer should be responsible for setting up sgs and virtio_gpu_queue_ctrl_sgs should be responsible for queuing sgs. Signed-off-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: move the check for vqs_ready earlierChia-I Wu1-5/+8
When vqs_ready is false, vq should be considered invalid and we should not check vq->num_free. After this change, a fenced command queued before the vqs are ready will have fence id 0 and will be considered done. Signed-off-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: move locking into virtio_gpu_queue_ctrl_sgsChia-I Wu1-35/+35
Signed-off-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: set up virtqueue sgs before lockingChia-I Wu1-31/+35
sgs setup does not need to be in the critical section. Signed-off-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: unlock object array on errorsChia-I Wu1-1/+4
We don't propagate erros to the callers. We have to unlock object arrays on errors. Signed-off-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: no need to pass virtio_gpu_ctrl_hdrChia-I Wu1-12/+12
We can get it from vbuf. Signed-off-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: add virtio_gpu_vbuf_ctrl_hdrChia-I Wu1-5/+15
It is a helper to return the virtio_gpu_ctrl_hdr in a vbuf. Signed-off-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: remove incorrect ENOSPC checkChia-I Wu1-13/+6
The handling of virtqueue_add_sgs ENOSPC error is incorrect because it can result in out-of-order virtqueue_add_sgs and break fences. We never get ENOSPC anyway because the caller waits until there is enough space (the other caller that did not wait was removed in commit 32d6c2c5b522 ("drm/virtio: Rewrite virtio_gpu_queue_ctrl_buffer using fenced version.")). Remove the incorrect and unnecessary error path. This also adds a WARN_ON(ret) until we properly handle errors. Signed-off-by: Chia-I Wu <[email protected]> Cc: David Riley <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: fix a wait_event conditionChia-I Wu1-1/+2
outcnt may be greater than 1 since commit e1218b8c0cc1 ("drm/virtio: Use vmalloc for command buffer allocations."). Fixes: e1218b8c0cc1 ("drm/virtio: Use vmalloc for command buffer allocations.") Signed-off-by: Chia-I Wu <[email protected]> Cc: David Riley <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-06drm/virtio: ratelimit error loggingGerd Hoffmann1-3/+3
Avoid flooding the log in case we screw up badly. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-05drm/virtio: fix vblank handlingGerd Hoffmann1-0/+1
virtio has its own commit fail function. Add the drm_atomic_helper_fake_vblank() call there. Fixes: 2a735ad3d211 ("drm/virtio: Remove sending of vblank event") Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Thomas Zimmermann <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-01-30drm/virtio: Remove sending of vblank eventThomas Zimmermann1-8/+0
The atomic helpers automatically send out fake VBLANK events if no vblanking has been initialized. Remove the sending code from the driver. v4: * separate commit from core vblank changes Signed-off-by: Thomas Zimmermann <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-01-20Backmerge v5.5-rc7 into drm-nextDave Airlie1-0/+1
msm needs 5.5-rc4, go to the latest. Signed-off-by: Dave Airlie <[email protected]>
2020-01-13drm/virtio: add missing virtio_gpu_array_lock_resv callGerd Hoffmann1-0/+1
When submitting a fenced command we must lock the object reservations because virtio_gpu_queue_fenced_ctrl_buffer() unlocks after adding the fence. Reported-by: Jann Horn <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Tested-by: Jann Horn <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-12-19drm/virtio: move drm_connector_to_virtio_gpu_output to virtgpu_displayGurchetan Singh2-2/+3
That's the only file that uses it. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-12-19drm/virtio: move to_virtio_fence inside virtgpu_fenceGurchetan Singh2-2/+3
That's the only file that uses it. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-12-19drm/virtio: simplify getting fake offsetGurchetan Singh2-10/+2
This is a little simpler. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-12-19drm/virtio: get rid of drm_encoder_to_virtio_gpu_outputGurchetan Singh1-2/+0
Not used anywhere. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-12-19drm/virtio: static-ify virtio_gpu_framebuffer_initGurchetan Singh2-5/+1
Not used anywhere else. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-12-19drm/virtio: static-ify virtio_fence_signaledGurchetan Singh2-2/+1
Not used anywhere else. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-12-16drm/virtio: use damage info for display updates.Gerd Hoffmann1-17/+24
v2: remove shift by src_{x,y}, drm_atomic_helper_damage_merged() handles that for us (Chia-I Wu). Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-12-16drm/virtio: batch display update commands.Gerd Hoffmann3-2/+31
When the driver submits multiple commands in a row it makes sense to notify the host only after submitting the last one, so the host can process them all at once, with a single vmexit. Add functions to enable/disable notifications to allow that. Use the new functions for primary plane updates. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-12-16drm/virtio: skip set_scanout if framebuffer didn't changeGerd Hoffmann1-14/+21
v2: also check src rect (Chia-I Wu). Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-12-16drm/virtio: plane_state->fb iff plane_state->crtcDaniel Vetter1-1/+1
Checking both is one too much, so wrap a WARN_ON around it to stope the copypasta. Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Cc: David Airlie <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: [email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-11-20drm/virtio: factor out virtio_gpu_update_dumb_boGerd Hoffmann1-15/+21
No functional change. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-11-20drm/virtio: Simplify virtio_gpu_primary_plane_update workflow.Gerd Hoffmann1-30/+34
Return early for the no framebuffer (or disabled output) case. Results in a simpler code flow for the remaining cases. No functional change. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-11-20drm/virtio: fix byteorder handling in virtio_gpu_cmd_transfer_{from, ↵Gerd Hoffmann3-25/+21
to}_host_3d functions Be consistent with the rest of the code base. No functional change. v2: - fix sparse warnings for virtio_gpu_cmd_transfer_to_host_2d call. - move convert_to_hw_box helper function. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-11-12drm/virtgpu: fix double unregistrationChuhong Yuan1-1/+1
drm_put_dev also calls drm_dev_unregister, so dev will be unregistered twice. Replace it with drm_dev_put to fix it. Signed-off-by: Chuhong Yuan <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-10-22drm/virtio: move byteorder handling into virtio_gpu_cmd_transfer_to_host_2d ↵Gerd Hoffmann3-14/+14
function Be consistent with the rest of the code base. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-10-22drm/virtio: print a single line with device featuresGerd Hoffmann1-5/+4
Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-10-17drm/shmem: drop DEFINE_DRM_GEM_SHMEM_FOPSGerd Hoffmann1-1/+1
DEFINE_DRM_GEM_SHMEM_FOPS is identical to DEFINE_DRM_GEM_FOPS now, drop it. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Rob Herring <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-10-17drm/shmem: switch shmem helper to &drm_gem_object_funcs.mmapGerd Hoffmann1-1/+1
Switch gem shmem helper to the new mmap() workflow, from &gem_driver.fops.mmap to &drm_gem_object_funcs.mmap. v2: Fix vm_flags and vm_page_prot handling. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Steven Price <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-13drm/virtio: Fix warning in virtio_gpu_queue_fenced_ctrl_buffer.David Riley1-1/+1
Fix warning introduced with commit e1218b8c0cc1 ("drm/virtio: Use vmalloc for command buffer allocations.") from drm-misc-next. Signed-off-by: David Riley <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-09-13drm/virtio: enable prime mmap supportGerd Hoffmann1-0/+1
Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-12drm/virtio: Use vmalloc for command buffer allocations.David Riley2-10/+72
Userspace requested command buffer allocations could be too large to make as a contiguous allocation. Use vmalloc if necessary to satisfy those allocations. Signed-off-by: David Riley <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-09-12drm/virtio: Rewrite virtio_gpu_queue_ctrl_buffer using fenced version.David Riley1-13/+7
Factor function in preparation to generating scatterlist prior to locking. Signed-off-by: David Riley <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-09-06drm/virtio: fix command submission with objects but without fence.Gerd Hoffmann1-4/+5
Only call virtio_gpu_array_add_fence if we actually have a fence. Fixes: da758d51968a ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing") Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: add worker for object releaseGerd Hoffmann4-1/+42
Move object release into a separate worker. Releasing objects requires sending commands to the host. Doing that in the dequeue worker will cause deadlocks in case the command queue gets filled up, because the dequeue worker is also the one which will free up slots in the command queue. Reported-by: Chia-I Wu <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Tested-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: add fence sanity checkGerd Hoffmann1-0/+4
Make sure we don't leak half-initialized fences outside the driver. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: drop virtio_gpu_object_{reserve, unreserve}Gerd Hoffmann1-21/+0
No users left. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: drop virtio_gpu_object_{ref,unref}Gerd Hoffmann1-15/+0
No users left. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: remove virtio_gpu_alloc_objectGerd Hoffmann3-26/+7
Thin wrapper around virtio_gpu_object_create(), but calling that directly works equally well. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Daniel Vetter <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: switch from ttm to gem shmem helpersGerd Hoffmann11-536/+81
virtio-gpu basically needs a sg_table for the bo, to tell the host where the backing pages for the object are. So the gem shmem helpers are a perfect fit. Some drm_gem_object_funcs need thin wrappers to update the host state, but otherwise the helpers handle everything just fine. Once the fencing was sorted the switch was surprisingly easy and for the most part just removing the ttm code. v4: fix drm_gem_object_funcs name. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Daniel Vetter <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: drop virtio_gpu_object_list_validate/virtio_gpu_unref_listGerd Hoffmann2-42/+0
No users left. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Daniel Vetter <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: rework virtio_gpu_cmd_context_{attach, detach}_resourceGerd Hoffmann3-19/+21
Switch to the virtio_gpu_array_* helper workflow. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencingGerd Hoffmann4-37/+47
Switch to the virtio_gpu_array_* helper workflow. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencingGerd Hoffmann3-28/+23
Switch to the virtio_gpu_array_* helper workflow. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: rework virtio_gpu_object_create fencingGerd Hoffmann3-43/+37
Rework fencing workflow. Stop using ttm helpers, use the virtio_gpu_array_* helpers instead. Due to using the gem reservation object it is initialized and ready for use before calling ttm_bo_init. So we can simply use the standard fencing workflow and drop the tricky logic which checks whenever the command is in flight still. v6: rewrite most of the patch. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]