msm: vidc: Perform cache operations on all planes

Perform cache operations on all planes including buffer extradata
planes, since userspace may set cache flag on all planes.

Change-Id: I9cc6060ec7fb2626b4885c7df7592abae99fb955
Signed-off-by: Mihir Ganu <mganu@codeaurora.org>
This commit is contained in:
Mihir Ganu 2020-03-11 17:38:20 -07:00
parent 1af989dbb8
commit 20ebbed266

View File

@ -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;
}
}
}