mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
media: iris: Skip destroying internal buffer if not dequeued
Firmware might hold the DPB buffers for reference in case of sequence
change, so skip destroying buffers for which QUEUED flag is not removed.
Cc: stable@vger.kernel.org
Fixes: 73702f45db ("media: iris: allocate, initialize and queue internal buffers")
Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # on sa8775p-ride
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
ee3b94f226
commit
7c452ffda3
|
|
@ -376,7 +376,7 @@ int iris_destroy_internal_buffer(struct iris_inst *inst, struct iris_buffer *buf
|
|||
return 0;
|
||||
}
|
||||
|
||||
int iris_destroy_internal_buffers(struct iris_inst *inst, u32 plane)
|
||||
static int iris_destroy_internal_buffers(struct iris_inst *inst, u32 plane, bool force)
|
||||
{
|
||||
const struct iris_platform_data *platform_data = inst->core->iris_platform_data;
|
||||
struct iris_buffer *buf, *next;
|
||||
|
|
@ -396,6 +396,14 @@ int iris_destroy_internal_buffers(struct iris_inst *inst, u32 plane)
|
|||
for (i = 0; i < len; i++) {
|
||||
buffers = &inst->buffers[internal_buf_type[i]];
|
||||
list_for_each_entry_safe(buf, next, &buffers->list, list) {
|
||||
/*
|
||||
* during stream on, skip destroying internal(DPB) buffer
|
||||
* if firmware did not return it.
|
||||
* during close, destroy all buffers irrespectively.
|
||||
*/
|
||||
if (!force && buf->attr & BUF_ATTR_QUEUED)
|
||||
continue;
|
||||
|
||||
ret = iris_destroy_internal_buffer(inst, buf);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -405,6 +413,16 @@ int iris_destroy_internal_buffers(struct iris_inst *inst, u32 plane)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int iris_destroy_all_internal_buffers(struct iris_inst *inst, u32 plane)
|
||||
{
|
||||
return iris_destroy_internal_buffers(inst, plane, true);
|
||||
}
|
||||
|
||||
int iris_destroy_dequeued_internal_buffers(struct iris_inst *inst, u32 plane)
|
||||
{
|
||||
return iris_destroy_internal_buffers(inst, plane, false);
|
||||
}
|
||||
|
||||
static int iris_release_internal_buffers(struct iris_inst *inst,
|
||||
enum iris_buffer_type buffer_type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ void iris_get_internal_buffers(struct iris_inst *inst, u32 plane);
|
|||
int iris_create_internal_buffers(struct iris_inst *inst, u32 plane);
|
||||
int iris_queue_internal_buffers(struct iris_inst *inst, u32 plane);
|
||||
int iris_destroy_internal_buffer(struct iris_inst *inst, struct iris_buffer *buffer);
|
||||
int iris_destroy_internal_buffers(struct iris_inst *inst, u32 plane);
|
||||
int iris_destroy_all_internal_buffers(struct iris_inst *inst, u32 plane);
|
||||
int iris_destroy_dequeued_internal_buffers(struct iris_inst *inst, u32 plane);
|
||||
int iris_alloc_and_queue_persist_bufs(struct iris_inst *inst);
|
||||
int iris_alloc_and_queue_input_int_bufs(struct iris_inst *inst);
|
||||
int iris_queue_buffer(struct iris_inst *inst, struct iris_buffer *buf);
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ int iris_vdec_streamon_input(struct iris_inst *inst)
|
|||
|
||||
iris_get_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
|
||||
ret = iris_destroy_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
ret = iris_destroy_dequeued_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -496,7 +496,7 @@ int iris_vdec_streamon_output(struct iris_inst *inst)
|
|||
|
||||
iris_get_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
|
||||
ret = iris_destroy_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
ret = iris_destroy_dequeued_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -233,8 +233,8 @@ int iris_close(struct file *filp)
|
|||
iris_session_close(inst);
|
||||
iris_inst_change_state(inst, IRIS_INST_DEINIT);
|
||||
iris_v4l2_fh_deinit(inst);
|
||||
iris_destroy_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
iris_destroy_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
iris_destroy_all_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
|
||||
iris_destroy_all_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
|
||||
iris_remove_session(inst);
|
||||
mutex_unlock(&inst->lock);
|
||||
mutex_destroy(&inst->ctx_q_lock);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user