mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
drm/v3d: Enable BO mapping
For the indirect CSD CPU job, we will need to access the internal contents of the BO with the dispatch parameters. Therefore, create methods to allow the mapping and unmapping of the BO. Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231130164420.932823-13-mcanal@igalia.com
This commit is contained in:
parent
369b059617
commit
7c13132c40
@ -33,6 +33,9 @@ void v3d_free_object(struct drm_gem_object *obj)
|
||||
struct v3d_dev *v3d = to_v3d_dev(obj->dev);
|
||||
struct v3d_bo *bo = to_v3d_bo(obj);
|
||||
|
||||
if (bo->vaddr)
|
||||
v3d_put_bo_vaddr(bo);
|
||||
|
||||
v3d_mmu_remove_ptes(bo);
|
||||
|
||||
mutex_lock(&v3d->bo_lock);
|
||||
@ -134,6 +137,7 @@ struct v3d_bo *v3d_bo_create(struct drm_device *dev, struct drm_file *file_priv,
|
||||
if (IS_ERR(shmem_obj))
|
||||
return ERR_CAST(shmem_obj);
|
||||
bo = to_v3d_bo(&shmem_obj->base);
|
||||
bo->vaddr = NULL;
|
||||
|
||||
ret = v3d_bo_create_finish(&shmem_obj->base);
|
||||
if (ret)
|
||||
@ -167,6 +171,20 @@ v3d_prime_import_sg_table(struct drm_device *dev,
|
||||
return obj;
|
||||
}
|
||||
|
||||
void v3d_get_bo_vaddr(struct v3d_bo *bo)
|
||||
{
|
||||
struct drm_gem_shmem_object *obj = &bo->base;
|
||||
|
||||
bo->vaddr = vmap(obj->pages, obj->base.size >> PAGE_SHIFT, VM_MAP,
|
||||
pgprot_writecombine(PAGE_KERNEL));
|
||||
}
|
||||
|
||||
void v3d_put_bo_vaddr(struct v3d_bo *bo)
|
||||
{
|
||||
vunmap(bo->vaddr);
|
||||
bo->vaddr = NULL;
|
||||
}
|
||||
|
||||
int v3d_create_bo_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv)
|
||||
{
|
||||
|
@ -202,6 +202,8 @@ struct v3d_bo {
|
||||
* v3d_render_job->unref_list
|
||||
*/
|
||||
struct list_head unref_head;
|
||||
|
||||
void *vaddr;
|
||||
};
|
||||
|
||||
static inline struct v3d_bo *
|
||||
@ -391,6 +393,8 @@ struct drm_gem_object *v3d_create_object(struct drm_device *dev, size_t size);
|
||||
void v3d_free_object(struct drm_gem_object *gem_obj);
|
||||
struct v3d_bo *v3d_bo_create(struct drm_device *dev, struct drm_file *file_priv,
|
||||
size_t size);
|
||||
void v3d_get_bo_vaddr(struct v3d_bo *bo);
|
||||
void v3d_put_bo_vaddr(struct v3d_bo *bo);
|
||||
int v3d_create_bo_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
int v3d_mmap_bo_ioctl(struct drm_device *dev, void *data,
|
||||
|
Loading…
Reference in New Issue
Block a user