mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
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
This commit is contained in:
parent
ad75f4f057
commit
c66df701e7
11 changed files with 80 additions and 535 deletions
|
@ -28,14 +28,6 @@
|
|||
|
||||
#include "virtgpu_drv.h"
|
||||
|
||||
void virtio_gpu_gem_free_object(struct drm_gem_object *gem_obj)
|
||||
{
|
||||
struct virtio_gpu_object *obj = gem_to_virtio_gpu_obj(gem_obj);
|
||||
|
||||
if (obj)
|
||||
virtio_gpu_object_unref(&obj);
|
||||
}
|
||||
|
||||
struct virtio_gpu_object*
|
||||
virtio_gpu_alloc_object(struct drm_device *dev,
|
||||
struct virtio_gpu_object_params *params,
|
||||
|
@ -66,16 +58,16 @@ int virtio_gpu_gem_create(struct drm_file *file,
|
|||
if (IS_ERR(obj))
|
||||
return PTR_ERR(obj);
|
||||
|
||||
ret = drm_gem_handle_create(file, &obj->gem_base, &handle);
|
||||
ret = drm_gem_handle_create(file, &obj->base.base, &handle);
|
||||
if (ret) {
|
||||
drm_gem_object_release(&obj->gem_base);
|
||||
drm_gem_object_release(&obj->base.base);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*obj_p = &obj->gem_base;
|
||||
*obj_p = &obj->base.base;
|
||||
|
||||
/* drop reference from allocate - handle holds it now */
|
||||
drm_gem_object_put_unlocked(&obj->gem_base);
|
||||
drm_gem_object_put_unlocked(&obj->base.base);
|
||||
|
||||
*handle_p = handle;
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue