forked from Minki/linux
drm/vc4: Introduce GEM object functions
GEM object functions deprecate several similar callback interfaces in struct drm_driver. This patch replaces the per-driver callbacks with per-instance callbacks in vc4. The only exception is gem_prime_mmap, which is non-trivial to convert. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-17-tzimmermann@suse.de
This commit is contained in:
parent
dd311c6fe8
commit
dd60202237
@ -21,6 +21,8 @@
|
||||
#include "vc4_drv.h"
|
||||
#include "uapi/drm/vc4_drm.h"
|
||||
|
||||
static vm_fault_t vc4_fault(struct vm_fault *vmf);
|
||||
|
||||
static const char * const bo_type_names[] = {
|
||||
"kernel",
|
||||
"V3D",
|
||||
@ -374,6 +376,21 @@ out:
|
||||
return bo;
|
||||
}
|
||||
|
||||
static const struct vm_operations_struct vc4_vm_ops = {
|
||||
.fault = vc4_fault,
|
||||
.open = drm_gem_vm_open,
|
||||
.close = drm_gem_vm_close,
|
||||
};
|
||||
|
||||
static const struct drm_gem_object_funcs vc4_gem_object_funcs = {
|
||||
.free = vc4_free_object,
|
||||
.export = vc4_prime_export,
|
||||
.get_sg_table = drm_gem_cma_prime_get_sg_table,
|
||||
.vmap = vc4_prime_vmap,
|
||||
.vunmap = drm_gem_cma_prime_vunmap,
|
||||
.vm_ops = &vc4_vm_ops,
|
||||
};
|
||||
|
||||
/**
|
||||
* vc4_gem_create_object - Implementation of driver->gem_create_object.
|
||||
* @dev: DRM device
|
||||
@ -400,6 +417,8 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
|
||||
vc4->bo_labels[VC4_BO_TYPE_KERNEL].size_allocated += size;
|
||||
mutex_unlock(&vc4->bo_lock);
|
||||
|
||||
bo->base.base.funcs = &vc4_gem_object_funcs;
|
||||
|
||||
return &bo->base.base;
|
||||
}
|
||||
|
||||
@ -684,7 +703,7 @@ struct dma_buf * vc4_prime_export(struct drm_gem_object *obj, int flags)
|
||||
return dmabuf;
|
||||
}
|
||||
|
||||
vm_fault_t vc4_fault(struct vm_fault *vmf)
|
||||
static vm_fault_t vc4_fault(struct vm_fault *vmf)
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
struct drm_gem_object *obj = vma->vm_private_data;
|
||||
|
@ -140,12 +140,6 @@ static void vc4_close(struct drm_device *dev, struct drm_file *file)
|
||||
kfree(vc4file);
|
||||
}
|
||||
|
||||
static const struct vm_operations_struct vc4_vm_ops = {
|
||||
.fault = vc4_fault,
|
||||
.open = drm_gem_vm_open,
|
||||
.close = drm_gem_vm_close,
|
||||
};
|
||||
|
||||
static const struct file_operations vc4_drm_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
@ -195,16 +189,10 @@ static struct drm_driver vc4_drm_driver = {
|
||||
#endif
|
||||
|
||||
.gem_create_object = vc4_create_object,
|
||||
.gem_free_object_unlocked = vc4_free_object,
|
||||
.gem_vm_ops = &vc4_vm_ops,
|
||||
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_export = vc4_prime_export,
|
||||
.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
|
||||
.gem_prime_import_sg_table = vc4_prime_import_sg_table,
|
||||
.gem_prime_vmap = vc4_prime_vmap,
|
||||
.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
|
||||
.gem_prime_mmap = vc4_prime_mmap,
|
||||
|
||||
.dumb_create = vc4_dumb_create,
|
||||
|
@ -799,7 +799,6 @@ int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
int vc4_label_bo_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
vm_fault_t vc4_fault(struct vm_fault *vmf);
|
||||
int vc4_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
|
||||
struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev,
|
||||
|
Loading…
Reference in New Issue
Block a user