diff options
author | Qiang Yu <yuq825@gmail.com> | 2019-10-10 22:01:50 +0800 |
---|---|---|
committer | Qiang Yu <yuq825@gmail.com> | 2019-10-17 23:41:03 +0800 |
commit | d61dd248ddadf85b3222b3f63c3d268fcc24beb4 (patch) | |
tree | 86b66859da2e01641750d01351302addee258397 /drivers/gpu/drm/lima/lima_gem.h | |
parent | ce6eb0253cbacdf250cf894e34ca405d8c9e79da (diff) | |
download | linux-d61dd248ddadf85b3222b3f63c3d268fcc24beb4.tar.gz linux-d61dd248ddadf85b3222b3f63c3d268fcc24beb4.tar.bz2 linux-d61dd248ddadf85b3222b3f63c3d268fcc24beb4.zip |
drm/lima: use drm_gem_shmem_helpers
Do not need to maintain our own shmem memory management
code as drm_gem_shmem_helpers provides it. And we can
also benifit from the work of others with shared code.
This is also a preparation for implementing buffer madv.
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191010140152.17747-2-yuq825@gmail.com
Diffstat (limited to 'drivers/gpu/drm/lima/lima_gem.h')
-rw-r--r-- | drivers/gpu/drm/lima/lima_gem.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/drivers/gpu/drm/lima/lima_gem.h b/drivers/gpu/drm/lima/lima_gem.h index 556111a01135..1800feb3e47f 100644 --- a/drivers/gpu/drm/lima/lima_gem.h +++ b/drivers/gpu/drm/lima/lima_gem.h @@ -4,19 +4,37 @@ #ifndef __LIMA_GEM_H__ #define __LIMA_GEM_H__ -struct lima_bo; +#include <drm/drm_gem_shmem_helper.h> + struct lima_submit; -extern const struct vm_operations_struct lima_gem_vm_ops; +struct lima_bo { + struct drm_gem_shmem_object base; + + struct mutex lock; + struct list_head va; +}; + +static inline struct lima_bo * +to_lima_bo(struct drm_gem_object *obj) +{ + return container_of(to_drm_gem_shmem_obj(obj), struct lima_bo, base); +} + +static inline size_t lima_bo_size(struct lima_bo *bo) +{ + return bo->base.base.size; +} + +static inline struct dma_resv *lima_bo_resv(struct lima_bo *bo) +{ + return bo->base.base.resv; +} -struct lima_bo *lima_gem_create_bo(struct drm_device *dev, u32 size, u32 flags); +struct drm_gem_object *lima_gem_create_object(struct drm_device *dev, size_t size); int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, u32 size, u32 flags, u32 *handle); -void lima_gem_free_object(struct drm_gem_object *obj); -int lima_gem_object_open(struct drm_gem_object *obj, struct drm_file *file); -void lima_gem_object_close(struct drm_gem_object *obj, struct drm_file *file); int lima_gem_get_info(struct drm_file *file, u32 handle, u32 *va, u64 *offset); -int lima_gem_mmap(struct file *filp, struct vm_area_struct *vma); int lima_gem_submit(struct drm_file *file, struct lima_submit *submit); int lima_gem_wait(struct drm_file *file, u32 handle, u32 op, s64 timeout_ns); |