media: coda: limit queueing into internal bitstream buffer
authorLucas Stach <l.stach@pengutronix.de>
Mon, 5 Nov 2018 15:25:02 +0000 (10:25 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 23 Nov 2018 10:27:05 +0000 (05:27 -0500)
commitc3d996fb03c6539771ad778cd66ff5595bfc263a
tree3d15ea8e7b53f5ab7b7b658a569711e4c2c5bc81
parent51407c2da0b7baac581d0d9fbfc297d10b7d0424
media: coda: limit queueing into internal bitstream buffer

The ringbuffer used to hold the bitstream is very conservatively sized,
as keyframes can get very large and still need to fit into this buffer.
This means that the buffer is way oversized for the average stream to
the extend that it will hold a few hundred frames when the video data
is compressing well.

The current strategy of queueing as much bitstream data as possible
leads to large delays when draining the decoder. In order to keep the
drain latency to a reasonable bound, try to only queue a full reorder
window of buffers. We can't always hit this low target for very well
compressible video data, as we might end up with less than the minimum
amount of data that needs to be available to the bitstream prefetcher,
so we must take this into account and allow more buffers to be queued
in this case.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/coda/coda-bit.c