Re: [PATCH 5/6] coda: coda_buffer_meta housekeeping fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2020-10-06 at 07:44 -0300, Ezequiel Garcia wrote:
> It's possible that the VPU was initialized using just one buffer,
> containing only codec headers.
> 
> In this case, right after the initialization and after updating
> the FIFO read pointer, we need to iterate through all the coda_buffer_meta
> and release any metas that have been already used by the VPU.
> 
> This issue is affecting indirectly the bitstream buffer fill
> threshold, which depends on the meta end position of the first
> queued meta, which is passed to coda_bitstream_can_fetch_past().
> 
> Without this fix, it's possible that for certain videos, the
> bitstream buffer level is not filled properly, resulting in a PIC_RUN
> timeout.
> 
> Reported-by: Benjamin Bara <benjamin.bara@xxxxxxxxxxx>
> Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx>
> ---
>  drivers/media/platform/coda/coda-bit.c | 42 +++++++++++++++++++++++---
>  drivers/media/platform/coda/coda.h     |  1 +
>  2 files changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
> index 659fcf77b0ed..928a640b0056 100644
> --- a/drivers/media/platform/coda/coda-bit.c
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -1836,6 +1836,29 @@ static bool coda_reorder_enable(struct coda_ctx *ctx)
>  	return profile > V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE;
>  }
>  
> +static void __coda_decoder_drop_used_metas(struct coda_ctx *ctx)

Let's just call this coda_decoder_drop_used_metas.
Otherwise this looks fine,

Reviewed-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>

> +{
> +	struct coda_buffer_meta *meta, *tmp;
> +
> +	/*
> +	 * All metas that end at or before the RD pointer (fifo out),
> +	 * are now consumed by the VPU and should be released.
> +	 */
> +	spin_lock(&ctx->buffer_meta_lock);
> +	list_for_each_entry_safe(meta, tmp, &ctx->buffer_meta_list, list) {
> +		if (ctx->bitstream_fifo.kfifo.out >= meta->end) {
> +			coda_dbg(2, ctx, "releasing meta: seq=%d start=%d end=%d\n",
> +				 meta->sequence, meta->start, meta->end);
> +
> +			list_del(&meta->list);
> +			ctx->num_metas--;
> +			ctx->first_frame_sequence++;
> +			kfree(meta);
> +		}

Here it should also be possible to

		  else {
			break;
		}

as meta->end ever increases.

regards
Philipp



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux