Commit da56a41a authored by Francois Buergisser's avatar Francois Buergisser Committed by Commit Bot

media/gpu/v4l2svda: Set picture size to OUTPUT buffer

Currently, the picture size is set to the CAPTURE buffer but CAPTURE buffer
references the picture size of the OUTPUT buffer.
If the picture size if set to CAPTURE, Hantro will ignore it and use the
OUTPUT picture size which is not set, therefore using the minimum size
available (48x48).
This patch sets the picture size to the OUTPUT buffer instead of the
CAPTURE buffer following the initialization specification for m2m stateless
video decoder [1].

[1] https://hverkuil.home.xs4all.nl/codec-api/uapi/v4l/dev-stateless-decoder.html#initialization

BUG=chromium:1009935
TEST=ran video_decode_accelerator_tests with test-25fps.h264 and test-25fps.vp8 on
veyron_minnie-kernelnext.
Signed-off-by: default avatarFrancois Buergisser <fbuergisser@chromium.org>
Change-Id: Ib343d8a0b177470aa39018141170212c1f524979
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832851Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703231}
parent 181fcf74
......@@ -387,6 +387,13 @@ void V4L2SliceVideoDecoder::InitializeTask(const VideoDecoderConfig& config,
return;
}
if (!SetCodedSizeOnInputQueue(config.coded_size())) {
VLOGF(1) << "Failed to set coded size on input queue";
client_task_runner_->PostTask(FROM_HERE,
base::BindOnce(std::move(init_cb), false));
return;
}
// Setup output format.
if (!SetupOutputFormat(config.coded_size(), config.visible_rect())) {
VLOGF(1) << "Failed to setup output format.";
......@@ -504,6 +511,27 @@ bool V4L2SliceVideoDecoder::SetupInputFormat(uint32_t input_format_fourcc) {
return true;
}
bool V4L2SliceVideoDecoder::SetCodedSizeOnInputQueue(
const gfx::Size& coded_size) {
struct v4l2_format format = {};
format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
if (device_->Ioctl(VIDIOC_G_FMT, &format) != 0) {
VPLOGF(1) << "Failed getting OUTPUT format";
return false;
}
format.fmt.pix_mp.width = coded_size.width();
format.fmt.pix_mp.height = coded_size.height();
if (device_->Ioctl(VIDIOC_S_FMT, &format) != 0) {
VPLOGF(1) << "Failed setting OUTPUT format";
return false;
}
return true;
}
base::Optional<VideoFrameLayout> V4L2SliceVideoDecoder::SetupOutputFormat(
const gfx::Size& size,
const gfx::Rect& visible_rect) {
......@@ -809,6 +837,12 @@ bool V4L2SliceVideoDecoder::ChangeResolution() {
DCHECK(!pic_size.IsEmpty());
DVLOGF(3) << "Change resolution to " << pic_size.width() << "x"
<< pic_size.height();
if (!SetCodedSizeOnInputQueue(pic_size)) {
VLOGF(1) << "Failed to set coded size on input queue";
return false;
}
auto frame_layout = SetupOutputFormat(pic_size, avd_->GetVisibleRect());
if (!frame_layout) {
VLOGF(1) << "No format is available with thew new resolution";
......
......@@ -161,6 +161,10 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecoder : public VideoDecoder,
// Setup format for input queue.
bool SetupInputFormat(uint32_t input_format_fourcc);
// Set the coded size on the input queue.
// Return true if the successful, false otherwise.
bool SetCodedSizeOnInputQueue(const gfx::Size& size);
// Setup format for output queue. This function sets output format on output
// queue that is supported by a v4l2 driver, can be allocatable by
// VideoFramePool and can be composited by chrome. This also updates format
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment