Commit graph

335 commits

Author SHA1 Message Date
Gerd Hoffmann
b1df3a2b24 drm/virtio: add drm_driver.release callback.
Split virtio_gpu_deinit(), move the drm shutdown and release to
virtio_gpu_release().  Drop vqs_ready variable, instead use
drm_dev_{enter,exit,unplug} to avoid touching hardware after
device removal.  Tidy up here and there.

v4: add changelog.
v3: use drm_dev_*().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200211135805.24436-1-kraxel@redhat.com
2020-02-12 10:24:08 +01:00
Gerd Hoffmann
2f2aa13724 drm/virtio: move virtio_gpu_mem_entry initialization to new function
Introduce new virtio_gpu_object_shmem_init() helper function which will
create the virtio_gpu_mem_entry array, containing the backing storage
information for the host.  For the most path this just moves code from
virtio_gpu_object_attach().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-5-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
2020-02-10 12:54:33 +01:00
Gerd Hoffmann
2fe4ca9d0e drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()
Stop sending DETACH_BACKING commands, that will happening anyway when
releasing resources via UNREF.  Handle guest-side cleanup in
virtio_gpu_cleanup_object(), called when the host finished processing
the UNREF command.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-4-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
2020-02-10 12:54:33 +01:00
Gerd Hoffmann
1ed5f698ad drm/virtio: resource teardown tweaks
Add new virtio_gpu_cleanup_object() helper function for object cleanup.
Wire up callback function for resource unref, do cleanup from callback
when we know the host stopped using the resource.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-3-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
2020-02-10 12:54:33 +01:00
Gerd Hoffmann
8235eab012 drm/virtio: simplify virtio_gpu_alloc_cmd
Just call virtio_gpu_alloc_cmd_resp with some fixed args
instead of duplicating most of the function body.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-2-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
2020-02-10 12:54:32 +01:00
Gerd Hoffmann
5edbb56082 drm/virtio: fix ring free check
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 <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207064653.14403-1-kraxel@redhat.com
2020-02-07 09:33:55 +01:00
Chia-I Wu
96b5d1bee2 drm/virtio: move virtqueue_notify into virtio_gpu_queue_ctrl_sgs
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 <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-11-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:58:18 +01:00
Chia-I Wu
c900b2a45c drm/virtio: move the check for vqs_ready earlier
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 <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-9-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:58:18 +01:00
Chia-I Wu
6ebe8661eb drm/virtio: move locking into virtio_gpu_queue_ctrl_sgs
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-8-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:58:18 +01:00
Chia-I Wu
db2e20726c drm/virtio: set up virtqueue sgs before locking
sgs setup does not need to be in the critical section.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-7-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:58:18 +01:00
Chia-I Wu
4d8d486910 drm/virtio: unlock object array on errors
We don't propagate erros to the callers.  We have to unlock object
arrays on errors.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-6-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:58:18 +01:00
Chia-I Wu
e19d341174 drm/virtio: no need to pass virtio_gpu_ctrl_hdr
We can get it from vbuf.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-5-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:58:17 +01:00
Chia-I Wu
145cbefce0 drm/virtio: add virtio_gpu_vbuf_ctrl_hdr
It is a helper to return the virtio_gpu_ctrl_hdr in a vbuf.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-4-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:58:08 +01:00
Chia-I Wu
1425a4ce49 drm/virtio: remove incorrect ENOSPC check
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 32d6c2c5b5 ("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 <olvaffe@gmail.com>
Cc: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-3-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:55:08 +01:00
Chia-I Wu
58547d7d5c drm/virtio: fix a wait_event condition
outcnt may be greater than 1 since commit e1218b8c0c ("drm/virtio:
Use vmalloc for command buffer allocations.").

Fixes: e1218b8c0c ("drm/virtio: Use vmalloc for command buffer allocations.")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Cc: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-2-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-02-06 11:55:08 +01:00
Gerd Hoffmann
e46e31cf53 drm/virtio: ratelimit error logging
Avoid flooding the log in case we screw up badly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205102552.21409-1-kraxel@redhat.com
2020-02-06 11:55:08 +01:00
Gerd Hoffmann
fda1572114 drm/virtio: fix vblank handling
virtio has its own commit fail function.  Add the
drm_atomic_helper_fake_vblank() call there.

Fixes: 2a735ad3d2 ("drm/virtio: Remove sending of vblank event")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205065312.15790-1-kraxel@redhat.com
2020-02-05 11:47:47 +01:00
Thomas Zimmermann
2a735ad3d2 drm/virtio: Remove sending of vblank event
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 <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-15-tzimmermann@suse.de
2020-01-30 09:00:50 +01:00
Gurchetan Singh
570c815698 drm/virtio: move drm_connector_to_virtio_gpu_output to virtgpu_display
That's the only file that uses it.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191219005733.18960-6-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-19 07:13:46 +01:00
Gurchetan Singh
c91a1e2b5a drm/virtio: move to_virtio_fence inside virtgpu_fence
That's the only file that uses it.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191219005733.18960-5-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-19 07:13:46 +01:00
Gurchetan Singh
093bd9cf5e drm/virtio: simplify getting fake offset
This is a little simpler.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191219005733.18960-4-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-19 07:13:45 +01:00
Gurchetan Singh
9e07d4617b drm/virtio: get rid of drm_encoder_to_virtio_gpu_output
Not used anywhere.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191219005733.18960-3-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-19 07:13:45 +01:00
Gurchetan Singh
9567728ae2 drm/virtio: static-ify virtio_gpu_framebuffer_init
Not used anywhere else.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191219005733.18960-2-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-19 07:13:45 +01:00
Gurchetan Singh
974e65e384 drm/virtio: static-ify virtio_fence_signaled
Not used anywhere else.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191219005733.18960-1-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-19 07:13:45 +01:00
Gerd Hoffmann
c096761718 drm/virtio: use damage info for display updates.
v2: remove shift by src_{x,y}, drm_atomic_helper_damage_merged()
    handles that for us (Chia-I Wu).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20191212125346.8334-4-kraxel@redhat.com
2019-12-16 12:39:50 +01:00
Gerd Hoffmann
7082e7a438 drm/virtio: batch display update commands.
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 <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20191212125346.8334-3-kraxel@redhat.com
2019-12-16 12:39:50 +01:00
Gerd Hoffmann
3954ff10e0 drm/virtio: skip set_scanout if framebuffer didn't change
v2: also check src rect (Chia-I Wu).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20191212125346.8334-2-kraxel@redhat.com
2019-12-16 12:39:50 +01:00
Daniel Vetter
4ad7056a40 drm/virtio: plane_state->fb iff plane_state->crtc
Checking both is one too much, so wrap a WARN_ON around it to stope
the copypasta.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20191213172612.1514842-8-daniel.vetter@ffwll.ch
Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-12-16 12:39:50 +01:00
Gerd Hoffmann
544c521d4a drm/virtio: factor out virtio_gpu_update_dumb_bo
No functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191023062539.11728-4-kraxel@redhat.com
2019-11-20 09:22:27 +01:00
Gerd Hoffmann
64440ef603 drm/virtio: Simplify virtio_gpu_primary_plane_update workflow.
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 <kraxel@redhat.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191023062539.11728-3-kraxel@redhat.com
2019-11-20 09:22:27 +01:00
Gerd Hoffmann
1dc3485247 drm/virtio: fix byteorder handling in virtio_gpu_cmd_transfer_{from, 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 <kraxel@redhat.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191023062539.11728-2-kraxel@redhat.com
2019-11-20 09:22:26 +01:00
Chuhong Yuan
c8f95a56b6 drm/virtgpu: fix double unregistration
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 <hslester96@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191109075417.29808-1-hslester96@gmail.com
2019-11-12 19:13:18 +01:00
Gerd Hoffmann
64f1cc99ef drm/virtio: move byteorder handling into virtio_gpu_cmd_transfer_to_host_2d function
Be consistent with the rest of the code base.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191018122352.17019-1-kraxel@redhat.com
2019-10-22 11:34:03 +02:00
Gerd Hoffmann
9e370dfec4 drm/virtio: print a single line with device features
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191018113832.5460-1-kraxel@redhat.com
2019-10-22 11:34:03 +02:00
Gerd Hoffmann
eee9a2e0ad drm/shmem: drop DEFINE_DRM_GEM_SHMEM_FOPS
DEFINE_DRM_GEM_SHMEM_FOPS is identical
to DEFINE_DRM_GEM_FOPS now, drop it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191016115203.20095-6-kraxel@redhat.com
2019-10-17 13:59:16 +02:00
Gerd Hoffmann
0be8958936 drm/shmem: switch shmem helper to &drm_gem_object_funcs.mmap
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 <kraxel@redhat.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191016115203.20095-3-kraxel@redhat.com
2019-10-17 13:59:16 +02:00
David Riley
de2358050a drm/virtio: Fix warning in virtio_gpu_queue_fenced_ctrl_buffer.
Fix warning introduced with commit e1218b8c0c
("drm/virtio: Use vmalloc for command buffer allocations.")
from drm-misc-next.

Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190912160048.212495-1-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-13 09:11:56 +02:00
Gerd Hoffmann
88c5a5a021 drm/virtio: enable prime mmap support
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190912114627.20176-1-kraxel@redhat.com
2019-09-13 09:11:56 +02:00
David Riley
e1218b8c0c drm/virtio: Use vmalloc for command buffer allocations.
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 <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20190911181403.40909-3-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-12 09:49:24 +02:00
David Riley
32d6c2c5b5 drm/virtio: Rewrite virtio_gpu_queue_ctrl_buffer using fenced version.
Factor function in preparation to generating scatterlist prior to locking.

Signed-off-by: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20190911181403.40909-2-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-09-12 09:49:24 +02:00
Gerd Hoffmann
84f6fec42e drm/virtio: fix command submission with objects but without fence.
Only call virtio_gpu_array_add_fence if we actually have a fence.

Fixes: da758d5196 ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904074828.32502-1-kraxel@redhat.com
2019-09-06 07:23:37 +02:00
Gerd Hoffmann
f0c6cef7e7 drm/virtio: add worker for object release
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 <olvaffe@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Tested-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190830060116.10476-1-kraxel@redhat.com
2019-09-04 06:54:12 +02:00
Gerd Hoffmann
12afce08ed drm/virtio: add fence sanity check
Make sure we don't leak half-initialized fences outside the driver.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-19-kraxel@redhat.com
2019-09-04 06:54:12 +02:00
Gerd Hoffmann
6e3372508d drm/virtio: drop virtio_gpu_object_{reserve, unreserve}
No users left.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-18-kraxel@redhat.com
2019-09-04 06:54:12 +02:00
Gerd Hoffmann
fe16537ddb drm/virtio: drop virtio_gpu_object_{ref,unref}
No users left.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-17-kraxel@redhat.com
2019-09-04 06:54:11 +02:00
Gerd Hoffmann
2e0d9ee457 drm/virtio: remove virtio_gpu_alloc_object
Thin wrapper around virtio_gpu_object_create(),
but calling that directly works equally well.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-16-kraxel@redhat.com
2019-09-04 06:54:11 +02:00
Gerd Hoffmann
c66df701e7 drm/virtio: switch from ttm to gem shmem helpers
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 <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-15-kraxel@redhat.com
2019-09-04 06:54:11 +02:00
Gerd Hoffmann
ad75f4f057 drm/virtio: drop virtio_gpu_object_list_validate/virtio_gpu_unref_list
No users left.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-14-kraxel@redhat.com
2019-09-04 06:54:11 +02:00
Gerd Hoffmann
93c38d15ee drm/virtio: rework virtio_gpu_cmd_context_{attach, detach}_resource
Switch to the virtio_gpu_array_* helper workflow.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-13-kraxel@redhat.com
2019-09-04 06:54:10 +02:00
Gerd Hoffmann
3d3bdbc0bd drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing
Switch to the virtio_gpu_array_* helper workflow.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-12-kraxel@redhat.com
2019-09-04 06:54:10 +02:00