diff options
| author | Anup Mahindre <amahindre@nvidia.com> | 2021-03-23 03:07:06 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2021-08-16 23:31:56 -0400 |
| commit | d0cbf337d60aef7a6d96fc8c965e22c987f094a1 (patch) | |
| tree | 50e07895d03e0df02368b072ffe08fd2a024fe5c /drivers | |
| parent | 046cec39ee6bfcf8f8c6e6d64226175082077834 (diff) | |
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
JIRA DLA-4908
Bug 3352716
Change-Id: I662da30cb9c606d2f67b792f09e026af391c89d1
Signed-off-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2503708
(cherry picked from commit a2cc66a3f318394e65f6f126bbb7eaa5ccdae3e2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2572190
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/video/tegra/host/nvdla/nvdla_queue.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/video/tegra/host/nvdla/nvdla_queue.c b/drivers/video/tegra/host/nvdla/nvdla_queue.c index ccb182b24..db669a522 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_queue.c +++ b/drivers/video/tegra/host/nvdla/nvdla_queue.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * NVDLA queue and task management for T194 | 2 | * NVDLA queue and task management for T194 |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2016-2019, NVIDIA Corporation. All rights reserved. | 4 | * Copyright (c) 2016-2021, NVIDIA Corporation. All rights reserved. |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms and conditions of the GNU General Public License, | 7 | * 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) | |||
| 174 | 174 | ||
| 175 | /* unpin address list */ | 175 | /* unpin address list */ |
| 176 | for (ii = 0; ii < task->num_addresses; ii++) { | 176 | for (ii = 0; ii < task->num_addresses; ii++) { |
| 177 | if (task->memory_handles[ii].type == | ||
| 178 | NVDLA_BUFFER_TYPE_INTERNAL) { | ||
| 179 | /* No unpinning required for internal buffers */ | ||
| 180 | continue; | ||
| 181 | } | ||
| 177 | if (task->memory_handles[ii].handle) { | 182 | if (task->memory_handles[ii].handle) { |
| 178 | nvdla_buffer_submit_unpin(task->buffers, | 183 | nvdla_buffer_submit_unpin(task->buffers, |
| 179 | &task->memory_dmabuf[ii], 1); | 184 | &task->memory_dmabuf[ii], 1); |
| @@ -524,15 +529,24 @@ static int nvdla_map_task_memory(struct nvdla_task *task) | |||
| 524 | for (jj = 0; jj < task->num_addresses; jj++) { | 529 | for (jj = 0; jj < task->num_addresses; jj++) { |
| 525 | dma_addr_t dma_addr; | 530 | dma_addr_t dma_addr; |
| 526 | size_t dma_size; | 531 | size_t dma_size; |
| 527 | err = -EFAULT; | ||
| 528 | 532 | ||
| 529 | nvdla_dbg_info(pdev, "count[%d] handle[%u] offset[%u]", | 533 | nvdla_dbg_info(pdev, "count[%d] handle[%u] offset[%u]", |
| 530 | jj, | 534 | jj, |
| 531 | task->memory_handles[jj].handle, | 535 | task->memory_handles[jj].handle, |
| 532 | task->memory_handles[jj].offset); | 536 | task->memory_handles[jj].offset); |
| 533 | 537 | ||
| 534 | if (!task->memory_handles[jj].handle) | 538 | if (task->memory_handles[jj].type == |
| 539 | NVDLA_BUFFER_TYPE_INTERNAL) { | ||
| 540 | /* For internal buffers, offset is the final address */ | ||
| 541 | next = add_address(next, | ||
| 542 | task->memory_handles[jj].offset); | ||
| 543 | continue; | ||
| 544 | } | ||
| 545 | |||
| 546 | if (!task->memory_handles[jj].handle) { | ||
| 547 | err = -EFAULT; | ||
| 535 | goto fail_to_pin_mem; | 548 | goto fail_to_pin_mem; |
| 549 | } | ||
| 536 | 550 | ||
| 537 | task->memory_dmabuf[jj] = | 551 | task->memory_dmabuf[jj] = |
| 538 | dma_buf_get(task->memory_handles[jj].handle); | 552 | dma_buf_get(task->memory_handles[jj].handle); |
