mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
video: tegra: host: nvdla: Add support for internal buffers
- Add buffer type field to nvdla_mem_handle - For internal buffers, skip pin and unpin operations and pass the offset as final adress - Also update error handling in nvdla_map_task_memory to match with convention Jira DLA-4376 Change-Id: I662da30cb9c606d2f67b792f09e026af391c89d1 Signed-off-by: Anup Mahindre <amahindre@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2503708 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Praveen K <kpraveen@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Laxman Dewangan
parent
65f1839c50
commit
6242fdd281
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* NVDLA queue and task management for T194
|
* NVDLA queue and task management for T194
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2020, NVIDIA Corporation. All rights reserved.
|
* Copyright (c) 2016-2021, NVIDIA Corporation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -174,6 +174,11 @@ static int nvdla_unmap_task_memory(struct nvdla_task *task)
|
|||||||
|
|
||||||
/* unpin address list */
|
/* unpin address list */
|
||||||
for (ii = 0; ii < task->num_addresses; ii++) {
|
for (ii = 0; ii < task->num_addresses; ii++) {
|
||||||
|
if (task->memory_handles[ii].type ==
|
||||||
|
NVDLA_BUFFER_TYPE_INTERNAL) {
|
||||||
|
/* No unpinning required for internal buffers */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (task->memory_handles[ii].handle) {
|
if (task->memory_handles[ii].handle) {
|
||||||
nvdla_buffer_submit_unpin(task->buffers,
|
nvdla_buffer_submit_unpin(task->buffers,
|
||||||
&task->memory_dmabuf[ii], 1);
|
&task->memory_dmabuf[ii], 1);
|
||||||
@@ -590,15 +595,24 @@ static int nvdla_map_task_memory(struct nvdla_task *task)
|
|||||||
for (jj = 0; jj < task->num_addresses; jj++) {
|
for (jj = 0; jj < task->num_addresses; jj++) {
|
||||||
dma_addr_t dma_addr;
|
dma_addr_t dma_addr;
|
||||||
size_t dma_size;
|
size_t dma_size;
|
||||||
err = -EFAULT;
|
|
||||||
|
|
||||||
nvdla_dbg_info(pdev, "count[%d] handle[%u] offset[%u]",
|
nvdla_dbg_info(pdev, "count[%d] handle[%u] offset[%u]",
|
||||||
jj,
|
jj,
|
||||||
task->memory_handles[jj].handle,
|
task->memory_handles[jj].handle,
|
||||||
task->memory_handles[jj].offset);
|
task->memory_handles[jj].offset);
|
||||||
|
|
||||||
if (!task->memory_handles[jj].handle)
|
if (task->memory_handles[jj].type ==
|
||||||
|
NVDLA_BUFFER_TYPE_INTERNAL) {
|
||||||
|
/* For internal buffers, offset is the final address */
|
||||||
|
next = add_address(next,
|
||||||
|
task->memory_handles[jj].offset);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!task->memory_handles[jj].handle) {
|
||||||
|
err = -EFAULT;
|
||||||
goto fail_to_pin_mem;
|
goto fail_to_pin_mem;
|
||||||
|
}
|
||||||
|
|
||||||
task->memory_dmabuf[jj] =
|
task->memory_dmabuf[jj] =
|
||||||
dma_buf_get(task->memory_handles[jj].handle);
|
dma_buf_get(task->memory_handles[jj].handle);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Tegra NvDLA Driver
|
* Tegra NvDLA Driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -127,11 +127,18 @@ struct nvdla_get_q_status_args {
|
|||||||
*
|
*
|
||||||
* @handle handle to buffer allocated in userspace
|
* @handle handle to buffer allocated in userspace
|
||||||
* @offset offset in buffer
|
* @offset offset in buffer
|
||||||
|
* @type buffer heap type
|
||||||
|
* @reserved reserved for future use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct nvdla_mem_handle {
|
struct nvdla_mem_handle {
|
||||||
__u32 handle;
|
__u32 handle;
|
||||||
__u32 offset;
|
__u32 offset;
|
||||||
|
#define NVDLA_BUFFER_TYPE_MC 0U
|
||||||
|
#define NVDLA_BUFFER_TYPE_CV 1U
|
||||||
|
#define NVDLA_BUFFER_TYPE_INTERNAL 2U
|
||||||
|
__u8 type;
|
||||||
|
__u8 reserved[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user