Commit 35632d04 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/v4l2vda: fix EGL image size

The size of the EGL image is supposed to be the visible size, while the
buffer itself shall be imported with its own coded size and stride.

Before crrev.com/c/1982499, we did not pass any size information with
the buffer, so as a workaround the size was set to the coded size and
the buffer imported with its coded size into the GPU or DC, which
resulted in visible green lines on the right or lower end of the image
when coded_size != visible_size.

Now that we are importing the buffer using a NativePixmapHandle, we can
set the EGL image to be the correct visible size.

BUG=b:141579960
TEST=240p h.264 video plays in Youtube web without visible green line on
Hana.

Change-Id: Ia7631998b7e47c5f8d1001b26e5a154fdffebcb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2010588
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733539}
parent 1f7eb063
......@@ -470,7 +470,6 @@ void V4L2VideoDecodeAccelerator::CreateEGLImageFor(
int32_t picture_buffer_id,
gfx::NativePixmapHandle handle,
GLuint texture_id,
const gfx::Size& size,
const Fourcc fourcc) {
DVLOGF(3) << "index=" << buffer_index;
DCHECK(child_task_runner_->BelongsToCurrentThread());
......@@ -494,8 +493,8 @@ void V4L2VideoDecodeAccelerator::CreateEGLImageFor(
V4L2Device* egl_device =
image_processor_device_ ? image_processor_device_.get() : device_.get();
EGLImageKHR egl_image = egl_device->CreateEGLImage(
egl_display_, gl_context->GetHandle(), texture_id, size, buffer_index,
fourcc, std::move(handle));
egl_display_, gl_context->GetHandle(), texture_id, visible_size_,
buffer_index, fourcc, std::move(handle));
if (egl_image == EGL_NO_IMAGE_KHR) {
VLOGF(1) << "could not create EGLImageKHR,"
<< " index=" << buffer_index << " texture_id=" << texture_id;
......@@ -725,7 +724,7 @@ void V4L2VideoDecodeAccelerator::ImportBufferForPictureTask(
FROM_HERE,
base::BindOnce(&V4L2VideoDecodeAccelerator::CreateEGLImageFor,
weak_this_, index, picture_buffer_id,
std::move(handle), iter->texture_id, egl_image_size_,
std::move(handle), iter->texture_id,
*egl_image_format_fourcc_));
// Early return, AssignEGLImage will make the buffer available for
......@@ -2696,8 +2695,7 @@ void V4L2VideoDecodeAccelerator::FrameProcessed(
&V4L2VideoDecodeAccelerator::CreateEGLImageFor, weak_this_,
ip_buffer_index, ip_output_record.picture_id,
CreateGpuMemoryBufferHandle(frame.get()).native_pixmap_handle,
ip_output_record.texture_id, egl_image_size_,
*egl_image_format_fourcc_));
ip_output_record.texture_id, *egl_image_format_fourcc_));
}
// Remove our job from the IP jobs queue
......
......@@ -252,13 +252,12 @@ class MEDIA_GPU_EXPORT V4L2VideoDecodeAccelerator
// Create an EGLImage for the buffer associated with V4L2 |buffer_index| and
// for |picture_buffer_id|, and backed by |handle|.
// The buffer should be bound to |texture_id| and is of |size| and format
// described by |fourcc|.
// The buffer should be bound to |texture_id| and is of format described by
// |fourcc|.
void CreateEGLImageFor(size_t buffer_index,
int32_t picture_buffer_id,
gfx::NativePixmapHandle handle,
GLuint texture_id,
const gfx::Size& size,
const Fourcc fourcc);
// Take the EGLImage |egl_image|, created for |picture_buffer_id|, and use it
......
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