diff --git a/msm/vidc/msm_vidc_common.c b/msm/vidc/msm_vidc_common.c index 7cb8a1ef7792..aa0c47d323cd 100644 --- a/msm/vidc/msm_vidc_common.c +++ b/msm/vidc/msm_vidc_common.c @@ -6307,40 +6307,33 @@ int msm_comm_qbuf_cache_operations(struct msm_vidc_inst *inst, unsigned long offset, size; enum smem_cache_ops cache_op; - skip = true; + offset = vb->planes[i].data_offset; + size = vb->planes[i].length - offset; + cache_op = SMEM_CACHE_INVALIDATE; + skip = false; + if (inst->session_type == MSM_VIDC_DECODER) { if (vb->type == INPUT_MPLANE) { if (!i) { /* bitstream */ - skip = false; - offset = vb->planes[i].data_offset; size = vb->planes[i].bytesused; cache_op = SMEM_CACHE_CLEAN_INVALIDATE; } } else if (vb->type == OUTPUT_MPLANE) { if (!i) { /* yuv */ - skip = false; - offset = 0; - size = vb->planes[i].length; - cache_op = SMEM_CACHE_INVALIDATE; + /* all values are correct */ } } } else if (inst->session_type == MSM_VIDC_ENCODER) { if (vb->type == INPUT_MPLANE) { if (!i) { /* yuv */ - skip = false; - offset = vb->planes[i].data_offset; size = vb->planes[i].bytesused; cache_op = SMEM_CACHE_CLEAN_INVALIDATE; + } else { /* extradata */ + cache_op = SMEM_CACHE_CLEAN_INVALIDATE; } } else if (vb->type == OUTPUT_MPLANE) { - if (!i) { /* bitstream */ - skip = false; - offset = 0; - size = vb->planes[i].length; - if (inst->max_filled_len) - size = inst->max_filled_len; - cache_op = SMEM_CACHE_INVALIDATE; - } + if (!i && inst->max_filled_len) + size = inst->max_filled_len; } } @@ -6375,26 +6368,26 @@ int msm_comm_dqbuf_cache_operations(struct msm_vidc_inst *inst, unsigned long offset, size; enum smem_cache_ops cache_op; - skip = true; + offset = vb->planes[i].data_offset; + size = vb->planes[i].length - offset; + cache_op = SMEM_CACHE_INVALIDATE; + skip = false; + if (inst->session_type == MSM_VIDC_DECODER) { if (vb->type == INPUT_MPLANE) { - /* bitstream and extradata */ - /* we do not need cache operations */ + if (!i) /* bitstream */ + skip = true; } else if (vb->type == OUTPUT_MPLANE) { if (!i) { /* yuv */ - skip = false; - offset = vb->planes[i].data_offset; - size = vb->planes[i].bytesused; - cache_op = SMEM_CACHE_INVALIDATE; + /* All values are correct */ } } } else if (inst->session_type == MSM_VIDC_ENCODER) { if (vb->type == INPUT_MPLANE) { /* yuv and extradata */ - /* we do not need cache operations */ + skip = true; } else if (vb->type == OUTPUT_MPLANE) { if (!i) { /* bitstream */ - skip = false; /* * Include vp8e header bytes as well * by making offset equal to zero @@ -6402,7 +6395,6 @@ int msm_comm_dqbuf_cache_operations(struct msm_vidc_inst *inst, offset = 0; size = vb->planes[i].bytesused + vb->planes[i].data_offset; - cache_op = SMEM_CACHE_INVALIDATE; } } }