Commit 363196e1 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/test/VaapiDmabufVFMapper: Don't perform format conversion in VFMapper

VaapiDmabufVideoFrameMapper does format conversion to I420.
This is not good from design perspective as VFMapper should map a buffer as it
is. This eliminates the format conversion from VaapiDmabufVFMapper.

BUG=chromium:856562
TEST=VDA unittest --test_import --frame_validator

Change-Id: Ic5e12e7875a9bb91ca2e21fc50c2de3a1d913199
Reviewed-on: https://chromium-review.googlesource.com/c/1312440Reviewed-by: default avatarPawel Osciak <posciak@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604859}
parent 9619c710
......@@ -22,7 +22,8 @@ namespace {
constexpr uint32_t kDummyPictureBufferId = 0;
// This is equal to GBM_FORMAT_MOD_NONE.
constexpr uint64_t kDummyGbmModifier = 0;
constexpr VAImageFormat kImageFormatI420{.fourcc = VA_FOURCC_I420,
constexpr VAImageFormat kImageFormatNV12{.fourcc = VA_FOURCC_NV12,
.byte_order = VA_LSB_FIRST,
.bits_per_pixel = 12};
......@@ -123,6 +124,11 @@ scoped_refptr<VideoFrame> VaapiDmaBufVideoFrameMapper::Map(
if (!video_frame->HasDmaBufs()) {
return nullptr;
}
if (video_frame->format() != PIXEL_FORMAT_NV12) {
NOTIMPLEMENTED() << " Unsupported PixelFormat: " << video_frame->format();
return nullptr;
}
const gfx::Size& coded_size = video_frame->coded_size();
// Passing empty callbacks is ok, because given PictureBuffer doesn't have
......@@ -147,9 +153,10 @@ scoped_refptr<VideoFrame> VaapiDmaBufVideoFrameMapper::Map(
return nullptr;
}
// Map and Convert tiled buffer into I420 format buffer.
constexpr VideoPixelFormat kConvertedFormat = PIXEL_FORMAT_I420;
VAImageFormat va_image_format = kImageFormatI420;
// Map tiled NV12 buffer by CreateVaImage so that mapped buffers can be
// accessed as non-tiled NV12 buffer.
constexpr VideoPixelFormat kConvertedFormat = PIXEL_FORMAT_NV12;
VAImageFormat va_image_format = kImageFormatNV12;
auto va_image = vaapi_wrapper_->CreateVaImage(
va_picture->va_surface_id(), &va_image_format, video_frame->coded_size());
if (!va_image || !va_image->IsValid()) {
......
......@@ -126,7 +126,6 @@ scoped_refptr<VideoFrame> VideoFrameValidator::CreateI420Frame(
width, height);
break;
case PIXEL_FORMAT_YV12:
case PIXEL_FORMAT_I420:
libyuv::I420Copy(src_frame->data(VideoFrame::kYPlane),
src_frame->stride(VideoFrame::kYPlane),
src_frame->data(VideoFrame::kUPlane),
......
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