diff --git a/driver/vidc/src/msm_vidc_driver.c b/driver/vidc/src/msm_vidc_driver.c index 5bb649254c..8f7a28f7bc 100644 --- a/driver/vidc/src/msm_vidc_driver.c +++ b/driver/vidc/src/msm_vidc_driver.c @@ -881,6 +881,8 @@ u32 msm_vidc_get_buffer_region(struct msm_vidc_inst *inst, region = MSM_VIDC_SECURE_PIXEL; break; case MSM_VIDC_BUF_BIN: + region = MSM_VIDC_SECURE_BITSTREAM; + break; case MSM_VIDC_BUF_ARP: case MSM_VIDC_BUF_COMV: case MSM_VIDC_BUF_NON_COMV: diff --git a/driver/vidc/src/msm_vidc_memory.c b/driver/vidc/src/msm_vidc_memory.c index c4fc709fd1..fee620d48a 100644 --- a/driver/vidc/src/msm_vidc_memory.c +++ b/driver/vidc/src/msm_vidc_memory.c @@ -7,8 +7,8 @@ #include #include #include -#include -#include +#include +#include #include "msm_vidc_memory.h" #include "msm_vidc_debug.h" @@ -208,6 +208,9 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem int size = 0; struct dma_heap *heap; char *heap_name = NULL; + struct mem_buf_lend_kernel_arg lend_arg; + int vmids[1]; + int perms[1]; if (!mem) { d_vpr_e("%s: invalid params\n", __func__); @@ -225,6 +228,8 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem heap_name = "qcom,secure-non-pixel"; break; case MSM_VIDC_SECURE_BITSTREAM: + heap_name = "qcom,system"; + break; default: d_vpr_e("invalid secure region : %#x\n", mem->region); return -EINVAL; @@ -242,6 +247,22 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem goto error; } + if (mem->secure && mem->type == MSM_VIDC_BUF_BIN) + { + vmids[0] = VMID_CP_BITSTREAM; + perms[0] = PERM_READ | PERM_WRITE; + + lend_arg.nr_acl_entries = ARRAY_SIZE(vmids); + lend_arg.vmids = vmids; + lend_arg.perms = perms; + + rc = mem_buf_lend(mem->dmabuf, &lend_arg); + if (rc) { + d_vpr_e("%s: BIN dmabuf %pK LEND failed, rc %d heap %s\n", + __func__, mem->dmabuf, rc, heap_name); + } + } + if (mem->map_kernel) { dma_buf_begin_cpu_access(mem->dmabuf, DMA_BIDIRECTIONAL); mem->kvaddr = dma_buf_vmap(mem->dmabuf);