Commit 3a66cf46 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/chromeos/LibyuvIP: Support Input/Output GMB-backed VideoFrame

This adds the GMB-backed VideoFrame support on input and output.
Both input and output VideoFrames are mapped every Process() by
using VideoFrameMapper if their storage types are GPU_MEMORY_BUFFER.

Bug: 1033799
Test: image_processor_test on kevin
Change-Id: Idea3cf4b0fca5e53ed758a5f7a25440933090095
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2021784
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735776}
parent 9e5c3758
......@@ -77,7 +77,8 @@ std::unique_ptr<ImageProcessorBackend> LibYUVImageProcessorBackend::Create(
// input.
VideoFrame::StorageType input_storage_type = VideoFrame::STORAGE_UNKNOWN;
for (auto input_type : input_config.preferred_storage_types) {
if (input_type == VideoFrame::STORAGE_DMABUFS) {
if (input_type == VideoFrame::STORAGE_DMABUFS ||
input_type == VideoFrame::STORAGE_GPU_MEMORY_BUFFER) {
input_frame_mapper = VideoFrameMapperFactory::CreateMapper(
input_config.fourcc.ToVideoPixelFormat(), input_type, true);
if (input_frame_mapper) {
......@@ -99,7 +100,8 @@ std::unique_ptr<ImageProcessorBackend> LibYUVImageProcessorBackend::Create(
std::unique_ptr<VideoFrameMapper> output_frame_mapper;
VideoFrame::StorageType output_storage_type = VideoFrame::STORAGE_UNKNOWN;
for (auto output_type : output_config.preferred_storage_types) {
if (output_type == VideoFrame::STORAGE_DMABUFS) {
if (output_type == VideoFrame::STORAGE_DMABUFS ||
output_type == VideoFrame::STORAGE_GPU_MEMORY_BUFFER) {
output_frame_mapper = VideoFrameMapperFactory::CreateMapper(
output_config.fourcc.ToVideoPixelFormat(), output_type, true);
if (output_frame_mapper) {
......@@ -189,7 +191,8 @@ void LibYUVImageProcessorBackend::Process(
FrameReadyCB cb) {
DCHECK_CALLED_ON_VALID_SEQUENCE(backend_sequence_checker_);
DVLOGF(4);
if (input_frame->storage_type() == VideoFrame::STORAGE_DMABUFS) {
if (input_frame->storage_type() == VideoFrame::STORAGE_DMABUFS ||
input_frame->storage_type() == VideoFrame::STORAGE_GPU_MEMORY_BUFFER) {
DCHECK_NE(input_frame_mapper_.get(), nullptr);
input_frame = input_frame_mapper_->Map(std::move(input_frame));
if (!input_frame) {
......@@ -202,7 +205,8 @@ void LibYUVImageProcessorBackend::Process(
// We don't replace |output_frame| with a mapped frame, because |output_frame|
// is the output of ImageProcessor.
scoped_refptr<VideoFrame> mapped_frame = output_frame;
if (output_frame->storage_type() == VideoFrame::STORAGE_DMABUFS) {
if (output_frame->storage_type() == VideoFrame::STORAGE_DMABUFS ||
output_frame->storage_type() == VideoFrame::STORAGE_GPU_MEMORY_BUFFER) {
DCHECK_NE(output_frame_mapper_.get(), nullptr);
mapped_frame = output_frame_mapper_->Map(output_frame);
if (!mapped_frame) {
......
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