mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-23 01:31:30 +03:00
drm/tegra: uapi: Allocate gather data using DMA API
This needs to be DMA-able data because it's eventually passed to the host1x CDMA. Bug 200768479 Signed-off-by: Thierry Reding <treding@nvidia.com> Change-Id: Ia209c9fac79e3edf3590288fc0739bc803609bc2 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596396 (cherry picked from commit 4e064281d0bc8371e228b03386c128661a1a52a9) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620150 Tested-by: Jonathan Hunter <jonathanh@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Laxman Dewangan
parent
f1ec6fabaf
commit
abbda4e63b
@@ -19,7 +19,8 @@ static void gather_bo_release(struct kref *ref)
|
|||||||
{
|
{
|
||||||
struct gather_bo *bo = container_of(ref, struct gather_bo, ref);
|
struct gather_bo *bo = container_of(ref, struct gather_bo, ref);
|
||||||
|
|
||||||
kfree(bo->gather_data);
|
dma_free_attrs(bo->dev, bo->gather_data_words * 4, bo->gather_data, bo->gather_data_dma,
|
||||||
|
0);
|
||||||
kfree(bo);
|
kfree(bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ struct gather_bo {
|
|||||||
|
|
||||||
struct kref ref;
|
struct kref ref;
|
||||||
|
|
||||||
|
struct device *dev;
|
||||||
u32 *gather_data;
|
u32 *gather_data;
|
||||||
|
dma_addr_t gather_data_dma;
|
||||||
size_t gather_data_words;
|
size_t gather_data_words;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -82,8 +82,10 @@ static int submit_copy_gather_data(struct drm_device *drm,
|
|||||||
|
|
||||||
kref_init(&bo->ref);
|
kref_init(&bo->ref);
|
||||||
host1x_bo_init(&bo->base, &gather_bo_ops);
|
host1x_bo_init(&bo->base, &gather_bo_ops);
|
||||||
|
bo->dev = drm->dev;
|
||||||
|
|
||||||
bo->gather_data = kmalloc(copy_len, GFP_KERNEL | __GFP_NOWARN);
|
bo->gather_data = dma_alloc_attrs(bo->dev, copy_len, &bo->gather_data_dma,
|
||||||
|
GFP_KERNEL | __GFP_NOWARN, 0);
|
||||||
if (!bo->gather_data) {
|
if (!bo->gather_data) {
|
||||||
kfree(bo);
|
kfree(bo);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -93,6 +95,7 @@ static int submit_copy_gather_data(struct drm_device *drm,
|
|||||||
u64_to_user_ptr(args->gather_data_ptr),
|
u64_to_user_ptr(args->gather_data_ptr),
|
||||||
copy_len);
|
copy_len);
|
||||||
if (copy_err) {
|
if (copy_err) {
|
||||||
|
dma_free_attrs(drm->dev, copy_len, bo->gather_data, bo->gather_data_dma, 0);
|
||||||
kfree(bo->gather_data);
|
kfree(bo->gather_data);
|
||||||
kfree(bo);
|
kfree(bo);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|||||||
Reference in New Issue
Block a user