From 0f0aa8f942d9c1b99ea42329d27088e3b50c46a9 Mon Sep 17 00:00:00 2001 From: Shridhar Rasal Date: Tue, 20 Dec 2016 17:09:24 +0530 Subject: [PATCH] video: tegra: host: dla: add semaphore support for prefences - this adds semaphore/memsignal support in prefences - while updating task descriptor, does pinning of UMD semaphore handle and received dma_addr added as preaction Jira DLA-161 Change-Id: If3695b0cca29d485c04b93a83848d50ad81dd9fd Signed-off-by: Shridhar Rasal Reviewed-on: http://git-master/r/1274302 Reviewed-by: Prashant Gaikwad GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/host/nvdla/nvdla_queue.c | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/video/tegra/host/nvdla/nvdla_queue.c b/drivers/video/tegra/host/nvdla/nvdla_queue.c index 6f6bc750..97311194 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_queue.c +++ b/drivers/video/tegra/host/nvdla/nvdla_queue.c @@ -119,6 +119,7 @@ void nvdla_task_get(struct nvdla_task *task) static void nvdla_task_free_locked(struct nvdla_task *task) { + int i; struct nvhost_queue *queue = task->queue; struct platform_device *pdev = queue->pool->pdev; @@ -134,6 +135,14 @@ static void nvdla_task_free_locked(struct nvdla_task *task) nvhost_buffer_submit_unpin(task->buffers, task->memory_handles, task->num_handles); + for (i = 0; i < task->num_prefences; i++) { + if (task->prefences[i].type == NVDLA_FENCE_TYPE_SEMAPHORE && + task->prefences[i].sem_handle) { + nvhost_buffer_submit_unpin(task->buffers, + &task->prefences[i].sem_handle, 1); + } + } + /* update takslist */ list_del(&task->list); @@ -393,6 +402,7 @@ static int nvdla_fill_postactions(struct nvdla_task *task) static int nvdla_fill_preactions(struct nvdla_task *task) { struct dla_task_descriptor *task_desc = task->task_desc; + struct nvhost_buffers *buffers = task->buffers; struct nvhost_queue *queue = task->queue; struct platform_device *pdev = queue->pool->pdev; struct nvhost_master *host = nvhost_get_host(pdev); @@ -489,6 +499,26 @@ static int nvdla_fill_preactions(struct nvdla_task *task) task->prefences[i].syncpoint_value); break; } + case NVDLA_FENCE_TYPE_SEMAPHORE: { + dma_addr_t dma_addr; + size_t dma_size; + + nvdla_dbg_info(pdev, "i[%d] semh[%u] semo[%u] val[%d]", + i, + task->prefences[i].sem_handle, + task->prefences[i].sem_offset, + task->prefences[i].sem_val); + + if (nvhost_buffer_submit_pin(buffers, + &task->prefences[i].sem_handle, + 1, &dma_addr, &dma_size)) + break; + + UPDATE_PREACTION(pre_cnt++, PREACTION_SEM_GE, + dma_addr + task->prefences[i].sem_offset, + task->prefences[i].sem_val); + break; + } default: nvdla_dbg_err(pdev, "Invalid sync_type[%d]", task->prefences[i].type);