drm/rockchip: gem: Set size of the allocated object when create gem

We may want to know how many size of a gem object is allocated, but
this size in rockchip_gem_object for no-IOMMU devices will not be set.

There are two ways to use rockchip GEMs, one is to create GEMs via DRM,
and the other is to import buffer created by other devices via DMA-BUF
and map it. For no-IOMMU devices, neither of them will set the buffer
size.

Let's set the size in rockchip_gem_object when we create a new rockchip
gem.

Fixes: c1c9524d3f ("drm/rockchip: debugfs: optimize dump buffer file name and size")
Change-Id: I396bf60a0d49d6f703044f9d354aa37312c9cc82
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
This commit is contained in:
Chaoyi Chen
2024-09-25 09:34:14 +08:00
committed by Tao Huang
parent b711dfd7ef
commit 2ba5e1d681

View File

@@ -67,8 +67,6 @@ static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj)
iommu_flush_iotlb_all(private->domain);
rk_obj->size = ret;
return 0;
err_remove_node:
@@ -731,6 +729,7 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv,
return ERR_CAST(rk_obj);
obj = &rk_obj->base;
rk_obj->size = size;
/*
* allocate a id of idr table where the obj is registered
@@ -863,6 +862,7 @@ rockchip_gem_prime_import_sg_table(struct drm_device *drm,
goto err_free_rk_obj;
}
rk_obj->size = attach->dmabuf->size;
rk_obj->num_pages = rk_obj->base.size >> PAGE_SHIFT;
rk_obj->pages = drm_calloc_large(rk_obj->num_pages, sizeof(*rk_obj->pages));
if (!rk_obj->pages) {