Loading drivers/media/platform/msm/vidc/msm_smem.c +0 −48 Original line number Diff line number Diff line Loading @@ -479,54 +479,6 @@ static int free_dma_mem(struct msm_smem *mem) return rc; } int msm_smem_cache_operations(struct dma_buf *dbuf, unsigned long offset, unsigned long size, enum smem_cache_ops cache_op) { int rc = 0; unsigned long flags = 0; int msm_cache_ops = 0; if (!dbuf) { dprintk(VIDC_ERR, "%s: NULL dma_buf\n", __func__); return -EINVAL; } /* Identify the get flags & offset based cache operation */ rc = dma_buf_get_flags(dbuf, &flags); if (rc) { dprintk(VIDC_ERR, "Failed to get dma buf flags: %d\n", rc); goto exit; } if (!(flags & ION_FLAG_CACHED)) goto exit; /* Partial clean of dma buf api is in progress */ switch (cache_op) { case SMEM_CACHE_CLEAN: case SMEM_CACHE_INVALIDATE: case SMEM_CACHE_CLEAN_INVALIDATE: dma_buf_begin_cpu_access(dbuf, DMA_BIDIRECTIONAL); dma_buf_end_cpu_access(dbuf, DMA_BIDIRECTIONAL); break; default: dprintk(VIDC_ERR, "%s: cache (%d) operation not supported\n", __func__, cache_op); rc = -EINVAL; goto exit; } if (rc) { dprintk(VIDC_ERR, "%s: cache operation failed dma_buf %pK, %d, offset %lu, size %lu, msm_cache_ops %u\n", __func__, rc, dbuf, offset, size, msm_cache_ops); goto exit; } exit: return rc; } int msm_smem_alloc(size_t size, u32 align, u32 flags, enum hal_buffer buffer_type, int map_kernel, void *res, u32 session_type, struct msm_smem *smem) Loading drivers/media/platform/msm/vidc/msm_vidc.c +0 −3 Original line number Diff line number Diff line Loading @@ -509,8 +509,6 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b) b->m.planes[i].data_offset = b->m.planes[i].reserved[1]; } msm_comm_qbuf_cache_operations(inst, b); /* Compression ratio is valid only for Encoder YUV buffers. */ if (inst->session_type == MSM_VIDC_ENCODER && b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { Loading Loading @@ -570,7 +568,6 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b) return rc; } msm_comm_dqbuf_cache_operations(inst, b); for (i = 0; i < b->length; i++) { b->m.planes[i].reserved[0] = b->m.planes[i].m.fd; b->m.planes[i].reserved[1] = b->m.planes[i].data_offset; Loading drivers/media/platform/msm/vidc/msm_vidc_common.c +0 −155 Original line number Diff line number Diff line Loading @@ -3434,12 +3434,6 @@ static int set_output_buffers(struct msm_vidc_inst *inst, "Failed to allocate output memory\n"); goto err_no_mem; } rc = msm_comm_smem_cache_operations(inst, &binfo->smem, SMEM_CACHE_CLEAN); if (rc) { dprintk(VIDC_WARN, "Failed to clean cache may cause undefined behavior\n"); } binfo->buffer_type = buffer_type; binfo->buffer_ownership = DRIVER; dprintk(VIDC_DBG, "Output buffer address: %#x\n", Loading Loading @@ -3518,13 +3512,6 @@ static int set_internal_buf_on_fw(struct msm_vidc_inst *inst, hdev = inst->core->device; rc = msm_comm_smem_cache_operations(inst, handle, SMEM_CACHE_CLEAN); if (rc) { dprintk(VIDC_WARN, "Failed to clean cache. Undefined behavior\n"); } buffer_info.buffer_size = handle->size; buffer_info.buffer_type = buffer_type; buffer_info.num_buffers = 1; Loading Loading @@ -5407,148 +5394,6 @@ void msm_comm_smem_free(struct msm_vidc_inst *inst, struct msm_smem *mem) msm_smem_free(mem); } int msm_comm_smem_cache_operations(struct msm_vidc_inst *inst, struct msm_smem *mem, enum smem_cache_ops cache_ops) { if (!inst || !mem) { dprintk(VIDC_ERR, "%s: invalid params: %pK %pK\n", __func__, inst, mem); return -EINVAL; } return msm_smem_cache_operations(mem->dma_buf, mem->offset, mem->size, cache_ops); } int msm_comm_qbuf_cache_operations(struct msm_vidc_inst *inst, struct v4l2_buffer *b) { int rc = 0, i; bool skip; if (!inst || !b) { dprintk(VIDC_ERR, "%s: invalid params %pK %pK\n", __func__, inst, b); return -EINVAL; } for (i = 0; i < b->length; i++) { unsigned long offset, size; enum smem_cache_ops cache_ops; struct dma_buf *dbuf; dbuf = msm_smem_get_dma_buf(b->m.planes[i].m.fd); offset = b->m.planes[i].data_offset; size = b->m.planes[i].length - offset; cache_ops = SMEM_CACHE_INVALIDATE; skip = false; if (inst->session_type == MSM_VIDC_DECODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (!i) { /* bitstream */ size = b->m.planes[i].bytesused; cache_ops = SMEM_CACHE_CLEAN_INVALIDATE; } } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* yuv */ /* all values are correct */ } } } else if (inst->session_type == MSM_VIDC_ENCODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (!i) { /* yuv */ size = b->m.planes[i].bytesused; cache_ops = SMEM_CACHE_CLEAN_INVALIDATE; } else { /* extradata */ cache_ops = SMEM_CACHE_CLEAN_INVALIDATE; } } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* bitstream */ /* all values are correct */ } } } if (!skip) { rc = msm_smem_cache_operations(dbuf, offset, size, cache_ops); if (rc) print_v4l2_buffer(VIDC_ERR, "qbuf cache ops failed", inst, b); } msm_smem_put_dma_buf(dbuf); } return rc; } int msm_comm_dqbuf_cache_operations(struct msm_vidc_inst *inst, struct v4l2_buffer *b) { int rc = 0, i; struct dma_buf *dma_buf; bool skip; if (!inst || !b) { dprintk(VIDC_ERR, "%s: invalid params %pK %pK\n", __func__, inst, b); return -EINVAL; } for (i = 0; i < b->length; i++) { unsigned long offset, size; enum smem_cache_ops cache_ops; dma_buf = msm_smem_get_dma_buf(b->m.planes[i].m.fd); offset = b->m.planes[i].data_offset; size = b->m.planes[i].length - offset; cache_ops = SMEM_CACHE_INVALIDATE; skip = false; if (inst->session_type == MSM_VIDC_DECODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (!i) /* bitstream */ skip = true; } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* yuv */ /* all values are correct */ } } } else if (inst->session_type == MSM_VIDC_ENCODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { /* yuv and extradata */ skip = true; } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* bitstream */ /* * Include vp8e header bytes as well * by making offset equal to zero */ offset = 0; size = b->m.planes[i].bytesused + b->m.planes[i].data_offset; } } } if (!skip) { rc = msm_smem_cache_operations(dma_buf, offset, size, cache_ops); if (rc) print_v4l2_buffer(VIDC_ERR, "dqbuf cache ops failed", inst, b); } msm_smem_put_dma_buf(dma_buf); } return rc; } void msm_vidc_fw_unload_handler(struct work_struct *work) { struct msm_vidc_core *core = NULL; Loading drivers/media/platform/msm/vidc/msm_vidc_internal.h +0 −3 Original line number Diff line number Diff line Loading @@ -471,9 +471,6 @@ int msm_smem_alloc(size_t size, u32 align, u32 flags, enum hal_buffer buffer_type, int map_kernel, void *res, u32 session_type, struct msm_smem *smem); int msm_smem_free(struct msm_smem *smem); int msm_smem_cache_operations(struct dma_buf *dbuf, unsigned long offset, unsigned long size, enum smem_cache_ops cache_op); struct context_bank_info *msm_smem_get_context_bank(u32 session_type, bool is_secure, struct msm_vidc_platform_resources *res, Loading drivers/media/platform/msm/vidc/venus_hfi.c +0 −4 Original line number Diff line number Diff line Loading @@ -609,10 +609,6 @@ static int __smem_alloc(struct venus_hfi_device *dev, dprintk(VIDC_DBG, "%s: ptr = %pK, size = %d\n", __func__, alloc->kvaddr, size); rc = msm_smem_cache_operations(alloc->dma_buf, 0, alloc->size, SMEM_CACHE_CLEAN); if (rc) dprintk(VIDC_WARN, "Failed to clean cache\n"); mem->mem_size = alloc->size; mem->align_virtual_addr = alloc->kvaddr; Loading Loading
drivers/media/platform/msm/vidc/msm_smem.c +0 −48 Original line number Diff line number Diff line Loading @@ -479,54 +479,6 @@ static int free_dma_mem(struct msm_smem *mem) return rc; } int msm_smem_cache_operations(struct dma_buf *dbuf, unsigned long offset, unsigned long size, enum smem_cache_ops cache_op) { int rc = 0; unsigned long flags = 0; int msm_cache_ops = 0; if (!dbuf) { dprintk(VIDC_ERR, "%s: NULL dma_buf\n", __func__); return -EINVAL; } /* Identify the get flags & offset based cache operation */ rc = dma_buf_get_flags(dbuf, &flags); if (rc) { dprintk(VIDC_ERR, "Failed to get dma buf flags: %d\n", rc); goto exit; } if (!(flags & ION_FLAG_CACHED)) goto exit; /* Partial clean of dma buf api is in progress */ switch (cache_op) { case SMEM_CACHE_CLEAN: case SMEM_CACHE_INVALIDATE: case SMEM_CACHE_CLEAN_INVALIDATE: dma_buf_begin_cpu_access(dbuf, DMA_BIDIRECTIONAL); dma_buf_end_cpu_access(dbuf, DMA_BIDIRECTIONAL); break; default: dprintk(VIDC_ERR, "%s: cache (%d) operation not supported\n", __func__, cache_op); rc = -EINVAL; goto exit; } if (rc) { dprintk(VIDC_ERR, "%s: cache operation failed dma_buf %pK, %d, offset %lu, size %lu, msm_cache_ops %u\n", __func__, rc, dbuf, offset, size, msm_cache_ops); goto exit; } exit: return rc; } int msm_smem_alloc(size_t size, u32 align, u32 flags, enum hal_buffer buffer_type, int map_kernel, void *res, u32 session_type, struct msm_smem *smem) Loading
drivers/media/platform/msm/vidc/msm_vidc.c +0 −3 Original line number Diff line number Diff line Loading @@ -509,8 +509,6 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b) b->m.planes[i].data_offset = b->m.planes[i].reserved[1]; } msm_comm_qbuf_cache_operations(inst, b); /* Compression ratio is valid only for Encoder YUV buffers. */ if (inst->session_type == MSM_VIDC_ENCODER && b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { Loading Loading @@ -570,7 +568,6 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b) return rc; } msm_comm_dqbuf_cache_operations(inst, b); for (i = 0; i < b->length; i++) { b->m.planes[i].reserved[0] = b->m.planes[i].m.fd; b->m.planes[i].reserved[1] = b->m.planes[i].data_offset; Loading
drivers/media/platform/msm/vidc/msm_vidc_common.c +0 −155 Original line number Diff line number Diff line Loading @@ -3434,12 +3434,6 @@ static int set_output_buffers(struct msm_vidc_inst *inst, "Failed to allocate output memory\n"); goto err_no_mem; } rc = msm_comm_smem_cache_operations(inst, &binfo->smem, SMEM_CACHE_CLEAN); if (rc) { dprintk(VIDC_WARN, "Failed to clean cache may cause undefined behavior\n"); } binfo->buffer_type = buffer_type; binfo->buffer_ownership = DRIVER; dprintk(VIDC_DBG, "Output buffer address: %#x\n", Loading Loading @@ -3518,13 +3512,6 @@ static int set_internal_buf_on_fw(struct msm_vidc_inst *inst, hdev = inst->core->device; rc = msm_comm_smem_cache_operations(inst, handle, SMEM_CACHE_CLEAN); if (rc) { dprintk(VIDC_WARN, "Failed to clean cache. Undefined behavior\n"); } buffer_info.buffer_size = handle->size; buffer_info.buffer_type = buffer_type; buffer_info.num_buffers = 1; Loading Loading @@ -5407,148 +5394,6 @@ void msm_comm_smem_free(struct msm_vidc_inst *inst, struct msm_smem *mem) msm_smem_free(mem); } int msm_comm_smem_cache_operations(struct msm_vidc_inst *inst, struct msm_smem *mem, enum smem_cache_ops cache_ops) { if (!inst || !mem) { dprintk(VIDC_ERR, "%s: invalid params: %pK %pK\n", __func__, inst, mem); return -EINVAL; } return msm_smem_cache_operations(mem->dma_buf, mem->offset, mem->size, cache_ops); } int msm_comm_qbuf_cache_operations(struct msm_vidc_inst *inst, struct v4l2_buffer *b) { int rc = 0, i; bool skip; if (!inst || !b) { dprintk(VIDC_ERR, "%s: invalid params %pK %pK\n", __func__, inst, b); return -EINVAL; } for (i = 0; i < b->length; i++) { unsigned long offset, size; enum smem_cache_ops cache_ops; struct dma_buf *dbuf; dbuf = msm_smem_get_dma_buf(b->m.planes[i].m.fd); offset = b->m.planes[i].data_offset; size = b->m.planes[i].length - offset; cache_ops = SMEM_CACHE_INVALIDATE; skip = false; if (inst->session_type == MSM_VIDC_DECODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (!i) { /* bitstream */ size = b->m.planes[i].bytesused; cache_ops = SMEM_CACHE_CLEAN_INVALIDATE; } } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* yuv */ /* all values are correct */ } } } else if (inst->session_type == MSM_VIDC_ENCODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (!i) { /* yuv */ size = b->m.planes[i].bytesused; cache_ops = SMEM_CACHE_CLEAN_INVALIDATE; } else { /* extradata */ cache_ops = SMEM_CACHE_CLEAN_INVALIDATE; } } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* bitstream */ /* all values are correct */ } } } if (!skip) { rc = msm_smem_cache_operations(dbuf, offset, size, cache_ops); if (rc) print_v4l2_buffer(VIDC_ERR, "qbuf cache ops failed", inst, b); } msm_smem_put_dma_buf(dbuf); } return rc; } int msm_comm_dqbuf_cache_operations(struct msm_vidc_inst *inst, struct v4l2_buffer *b) { int rc = 0, i; struct dma_buf *dma_buf; bool skip; if (!inst || !b) { dprintk(VIDC_ERR, "%s: invalid params %pK %pK\n", __func__, inst, b); return -EINVAL; } for (i = 0; i < b->length; i++) { unsigned long offset, size; enum smem_cache_ops cache_ops; dma_buf = msm_smem_get_dma_buf(b->m.planes[i].m.fd); offset = b->m.planes[i].data_offset; size = b->m.planes[i].length - offset; cache_ops = SMEM_CACHE_INVALIDATE; skip = false; if (inst->session_type == MSM_VIDC_DECODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (!i) /* bitstream */ skip = true; } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* yuv */ /* all values are correct */ } } } else if (inst->session_type == MSM_VIDC_ENCODER) { if (b->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { /* yuv and extradata */ skip = true; } else if (b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (!i) { /* bitstream */ /* * Include vp8e header bytes as well * by making offset equal to zero */ offset = 0; size = b->m.planes[i].bytesused + b->m.planes[i].data_offset; } } } if (!skip) { rc = msm_smem_cache_operations(dma_buf, offset, size, cache_ops); if (rc) print_v4l2_buffer(VIDC_ERR, "dqbuf cache ops failed", inst, b); } msm_smem_put_dma_buf(dma_buf); } return rc; } void msm_vidc_fw_unload_handler(struct work_struct *work) { struct msm_vidc_core *core = NULL; Loading
drivers/media/platform/msm/vidc/msm_vidc_internal.h +0 −3 Original line number Diff line number Diff line Loading @@ -471,9 +471,6 @@ int msm_smem_alloc(size_t size, u32 align, u32 flags, enum hal_buffer buffer_type, int map_kernel, void *res, u32 session_type, struct msm_smem *smem); int msm_smem_free(struct msm_smem *smem); int msm_smem_cache_operations(struct dma_buf *dbuf, unsigned long offset, unsigned long size, enum smem_cache_ops cache_op); struct context_bank_info *msm_smem_get_context_bank(u32 session_type, bool is_secure, struct msm_vidc_platform_resources *res, Loading
drivers/media/platform/msm/vidc/venus_hfi.c +0 −4 Original line number Diff line number Diff line Loading @@ -609,10 +609,6 @@ static int __smem_alloc(struct venus_hfi_device *dev, dprintk(VIDC_DBG, "%s: ptr = %pK, size = %d\n", __func__, alloc->kvaddr, size); rc = msm_smem_cache_operations(alloc->dma_buf, 0, alloc->size, SMEM_CACHE_CLEAN); if (rc) dprintk(VIDC_WARN, "Failed to clean cache\n"); mem->mem_size = alloc->size; mem->align_virtual_addr = alloc->kvaddr; Loading