Commit fce448fa authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/v4l2IP: Fix the wrong assignment to plane length in v4l2 DMABUF buffer

V4L2IP sets plane length to the area of coded size and offset.
This is wrong if the width of coded_size is different from the
stride of the underlying buffer. This CL corrects it by setting
to the size of GpuMemoryBufferPlane.

Bug: None
Test: ip_test --gtest_filter=NV12* on kukui
Change-Id: I3e49e6ecd2442e00b8d6705cfb3e333efad0a9f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096427Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749539}
parent a993bf8b
......@@ -55,7 +55,7 @@ base::Optional<gfx::GpuMemoryBufferHandle> CreateHandle(
void FillV4L2BufferByGpuMemoryBufferHandle(
const Fourcc& fourcc,
const gfx::Size& buffer_size,
const gfx::Size& coded_size,
const gfx::GpuMemoryBufferHandle& gmb_handle,
V4L2WritableBufferRef* buffer) {
DCHECK_EQ(buffer->Memory(), V4L2_MEMORY_DMABUF);
......@@ -66,7 +66,7 @@ void FillV4L2BufferByGpuMemoryBufferHandle(
for (size_t i = 0; i < num_planes; ++i) {
const int bytes_used =
VideoFrame::PlaneSize(fourcc.ToVideoPixelFormat(), i, buffer_size)
VideoFrame::PlaneSize(fourcc.ToVideoPixelFormat(), i, coded_size)
.GetArea();
if (fourcc.IsMultiPlanar()) {
......@@ -77,7 +77,7 @@ void FillV4L2BufferByGpuMemoryBufferHandle(
buffer->SetPlaneDataOffset(i, planes[i].offset);
// V4L2 counts data_offset as used bytes
buffer->SetPlaneSize(i, bytes_used + planes[i].offset);
buffer->SetPlaneSize(i, planes[i].size + planes[i].offset);
// Workaround: filling length should not be needed. This is a bug of
// videobuf2 library.
buffer->SetPlaneBytesUsed(i, bytes_used + planes[i].offset);
......
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