Re: [PATCH] media: venus: queue initial buffers

From: Stanimir Varbanov
Date: Thu Nov 01 2018 - 08:26:09 EST


Hi,

On 10/20/18 10:50 AM, mgottam@xxxxxxxxxxxxxx wrote:
> On 2018-10-09 20:47, Stanimir Varbanov wrote:
>> Hi Malathi,
>>
>> On 10/09/2018 10:50 AM, Malathi Gottam wrote:
>>> Buffers can be queued to driver before the planes are
>>> set to start streaming. Queue those buffers to firmware
>>> once start streaming is called on both the planes.
>>
>> yes and this is done in venus_helper_m2m_device_run mem2mem operation
>> when streamon on both queues is called, thus below function just
>> duplicates .device_run.
>>
>> Do you fix an issue with that patch?
>>
>>>
>>> Signed-off-by: Malathi Gottam <mgottam@xxxxxxxxxxxxxx>
>>> ---
>>> Âdrivers/media/platform/qcom/venus/helpers.c | 22 ++++++++++++++++++++++
>>> Âdrivers/media/platform/qcom/venus/helpers.h |Â 1 +
>>> Âdrivers/media/platform/qcom/venus/venc.cÂÂÂ |Â 5 +++++
>>> Â3 files changed, 28 insertions(+)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/helpers.c
>>> b/drivers/media/platform/qcom/venus/helpers.c
>>> index e436385..2679adb 100644
>>> --- a/drivers/media/platform/qcom/venus/helpers.c
>>> +++ b/drivers/media/platform/qcom/venus/helpers.c
>>> @@ -1041,6 +1041,28 @@ void venus_helper_vb2_stop_streaming(struct
>>> vb2_queue *q)
>>> Â}
>>> ÂEXPORT_SYMBOL_GPL(venus_helper_vb2_stop_streaming);
>>>
>>> +int venus_helper_queue_initial_bufs(struct venus_inst *inst)
>>> +{
>>> +ÂÂÂ struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx;
>>> +ÂÂÂ struct v4l2_m2m_buffer *buf, *n;
>>> +ÂÂÂ int ret;
>>> +
>>> +ÂÂÂ v4l2_m2m_for_each_dst_buf_safe(m2m_ctx, buf, n)ÂÂÂ {
>>> +ÂÂÂÂÂÂÂ ret = session_process_buf(inst, &buf->vb);
>>> +ÂÂÂÂÂÂÂ if (ret)
>>> +ÂÂÂÂÂÂÂÂÂÂÂ return_buf_error(inst, &buf->vb);
>>> +ÂÂÂ }
>>> +
>>> +ÂÂÂ v4l2_m2m_for_each_src_buf_safe(m2m_ctx, buf, n) {
>>> +ÂÂÂÂÂÂÂ ret = session_process_buf(inst, &buf->vb);
>>> +ÂÂÂÂÂÂÂ if (ret)
>>> +ÂÂÂÂÂÂÂÂÂÂÂ return_buf_error(inst, &buf->vb);
>>> +ÂÂÂ }
>>> +
>>> +ÂÂÂ return 0;
>>> +}
>>> +EXPORT_SYMBOL(venus_helper_queue_initial_bufs);
>>> +
>>> Âint venus_helper_vb2_start_streaming(struct venus_inst *inst)
>>> Â{
>>> ÂÂÂÂ struct venus_core *core = inst->core;
>>> diff --git a/drivers/media/platform/qcom/venus/helpers.h
>>> b/drivers/media/platform/qcom/venus/helpers.h
>>> index 2475f284..f4d76ab 100644
>>> --- a/drivers/media/platform/qcom/venus/helpers.h
>>> +++ b/drivers/media/platform/qcom/venus/helpers.h
>>> @@ -31,6 +31,7 @@ void venus_helper_buffers_done(struct venus_inst
>>> *inst,
>>> Âint venus_helper_vb2_start_streaming(struct venus_inst *inst);
>>> Âvoid venus_helper_m2m_device_run(void *priv);
>>> Âvoid venus_helper_m2m_job_abort(void *priv);
>>> +int venus_helper_queue_initial_bufs(struct venus_inst *inst);
>>> Âint venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
>>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ struct hfi_buffer_requirements *req);
>>> Âu32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height);
>>> diff --git a/drivers/media/platform/qcom/venus/venc.c
>>> b/drivers/media/platform/qcom/venus/venc.c
>>> index ce85962..ef11495 100644
>>> --- a/drivers/media/platform/qcom/venus/venc.c
>>> +++ b/drivers/media/platform/qcom/venus/venc.c
>>> @@ -989,6 +989,11 @@ static int venc_start_streaming(struct vb2_queue
>>> *q, unsigned int count)
>>> ÂÂÂÂ if (ret)
>>> ÂÂÂÂÂÂÂÂ goto deinit_sess;
>>>
>>> +ÂÂÂ ret = venus_helper_queue_initial_bufs(inst);
>>> +ÂÂÂ if (ret)
>>> +ÂÂÂÂÂÂÂ goto deinit_sess;
>>> +ÂÂÂ }
>>> +
>>> ÂÂÂÂ mutex_unlock(&inst->lock);
>>>
>>> ÂÂÂÂ return 0;
>>>
> Hi Stan,
>
> As I considered playback sequence as well, this function
> "venus_helper_m2m_device_run" was muted as a part of it. So I had to
> explicitly implement this function for encoder.
>
> For now, we can omit this patch. Once the playback sequence gets merged
> into upstream, we can re-look into this.

Sorry, I didn't look deeply into playback sequence patches yet, but
looks like we have to fix them first. So please drop this patch.

--
regards,
Stan