mirror of https://gitee.com/openkylin/linux.git
drm/exynos: 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 exynos. The only exception is gem_prime_mmap, which is non-trivial to convert. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-5-tzimmermann@suse.de
This commit is contained in:
parent
a77306278f
commit
a64325a1d7
|
@ -75,11 +75,6 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
|
|||
file->driver_priv = NULL;
|
||||
}
|
||||
|
||||
static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
|
||||
.open = drm_gem_vm_open,
|
||||
.close = drm_gem_vm_close,
|
||||
};
|
||||
|
||||
static const struct drm_ioctl_desc exynos_ioctls[] = {
|
||||
DRM_IOCTL_DEF_DRV(EXYNOS_GEM_CREATE, exynos_drm_gem_create_ioctl,
|
||||
DRM_RENDER_ALLOW),
|
||||
|
@ -124,16 +119,11 @@ static struct drm_driver exynos_drm_driver = {
|
|||
.open = exynos_drm_open,
|
||||
.lastclose = drm_fb_helper_lastclose,
|
||||
.postclose = exynos_drm_postclose,
|
||||
.gem_free_object_unlocked = exynos_drm_gem_free_object,
|
||||
.gem_vm_ops = &exynos_drm_gem_vm_ops,
|
||||
.dumb_create = exynos_drm_gem_dumb_create,
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_import = exynos_drm_gem_prime_import,
|
||||
.gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table,
|
||||
.gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
|
||||
.gem_prime_vmap = exynos_drm_gem_prime_vmap,
|
||||
.gem_prime_vunmap = exynos_drm_gem_prime_vunmap,
|
||||
.gem_prime_mmap = exynos_drm_gem_prime_mmap,
|
||||
.ioctls = exynos_ioctls,
|
||||
.num_ioctls = ARRAY_SIZE(exynos_ioctls),
|
||||
|
|
|
@ -129,6 +129,19 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem)
|
|||
kfree(exynos_gem);
|
||||
}
|
||||
|
||||
static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
|
||||
.open = drm_gem_vm_open,
|
||||
.close = drm_gem_vm_close,
|
||||
};
|
||||
|
||||
static const struct drm_gem_object_funcs exynos_drm_gem_object_funcs = {
|
||||
.free = exynos_drm_gem_free_object,
|
||||
.get_sg_table = exynos_drm_gem_prime_get_sg_table,
|
||||
.vmap = exynos_drm_gem_prime_vmap,
|
||||
.vunmap = exynos_drm_gem_prime_vunmap,
|
||||
.vm_ops = &exynos_drm_gem_vm_ops,
|
||||
};
|
||||
|
||||
static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
|
||||
unsigned long size)
|
||||
{
|
||||
|
@ -143,6 +156,8 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
|
|||
exynos_gem->size = size;
|
||||
obj = &exynos_gem->base;
|
||||
|
||||
obj->funcs = &exynos_drm_gem_object_funcs;
|
||||
|
||||
ret = drm_gem_object_init(dev, obj, size);
|
||||
if (ret < 0) {
|
||||
DRM_DEV_ERROR(dev->dev, "failed to initialize gem object\n");
|
||||
|
|
Loading…
Reference in New Issue