Commit e1837388 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/v4l2: Always adjust EGL size to actual coded width

On some devices (e.g. Cheza), the actual coded width of a buffer
may differ from the macroblock-aligned width the driver works on. This
can lead to the following DCHECK to be raised:

    FATAL:v4l2_video_decode_accelerator.cc(671)] Check failed: egl_image_size_.width() == adjusted_coded_width (320 vs. 384)

Interestingly we already had code that fixed this by setting the EGL
width to the actual buffer's width, but this code was only used in case
an image processor was present. This CL generalizes the code to all
cases.

Bug: b:143049464
Test: video_decode_accelerator_tests passing on Cheza and Hana.

Change-Id: I7c65ca469f637bd360259fb6b3d94a6eba8a73e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1871529
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708070}
parent 64cc93dd
......@@ -654,7 +654,16 @@ void V4L2VideoDecodeAccelerator::ImportBufferForPictureTask(
NOTIFY_ERROR(INVALID_ARGUMENT);
return;
}
int adjusted_coded_width = stride * 8 / plane_horiz_bits_per_pixel;
// If this is the first picture, then adjust the EGL width.
// Otherwise just check that it remains the same.
if (decoder_state_ == kAwaitingPictureBuffers) {
DCHECK_GE(adjusted_coded_width, egl_image_size_.width());
egl_image_size_.set_width(adjusted_coded_width);
}
DCHECK_EQ(egl_image_size_.width(), adjusted_coded_width);
if (image_processor_device_ && !image_processor_) {
DCHECK_EQ(kAwaitingPictureBuffers, decoder_state_);
// This is the first buffer import. Create the image processor and change
......@@ -663,12 +672,9 @@ void V4L2VideoDecodeAccelerator::ImportBufferForPictureTask(
// width to create the image processor.
DVLOGF(3) << "Original egl_image_size=" << egl_image_size_.ToString()
<< ", adjusted coded width=" << adjusted_coded_width;
DCHECK_GE(adjusted_coded_width, egl_image_size_.width());
egl_image_size_.set_width(adjusted_coded_width);
if (!CreateImageProcessor())
return;
}
DCHECK_EQ(egl_image_size_.width(), adjusted_coded_width);
if (reset_pending_) {
FinishReset();
......
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