Commit 9f743f8c authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/v4l2VEA: Create ImageProcessor with GMB output and IMPORT mode

The ImageProcessor option in V4L2VEA is formerly both
STORAGE_GPU_MEMORY_BUFFER and STORAGE_OWNED_MEMORY for output
buffer storage type and both IMPORT and ALLOCATE for output mode.
The v4l2 encoder driver should be able to consume GpuMemoryBuffer
today, and all the existing ImageProcessor support
GpuMemoryBuffer. Therefore, the option of STORAGE_OWNED_MEMORY and
ALLOCATE is no longer needed.

Bug: 1033799
Test: appr.tc on kukui
Change-Id: I4274bba117cb16195e0a92c9448acc55cc353d88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2104727
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751229}
parent 1b77e70c
...@@ -374,15 +374,12 @@ bool V4L2VideoEncodeAccelerator::CreateImageProcessor( ...@@ -374,15 +374,12 @@ bool V4L2VideoEncodeAccelerator::CreateImageProcessor(
return false; return false;
auto output_config = auto output_config =
VideoFrameLayoutToPortConfig(output_layout, output_visible_rect, VideoFrameLayoutToPortConfig(output_layout, output_visible_rect,
{VideoFrame::STORAGE_GPU_MEMORY_BUFFER, {VideoFrame::STORAGE_GPU_MEMORY_BUFFER});
VideoFrame::STORAGE_OWNED_MEMORY});
if (!output_config) if (!output_config)
return false; return false;
image_processor_ = ImageProcessorFactory::Create( image_processor_ = ImageProcessorFactory::Create(
*input_config, *output_config, *input_config, *output_config, {ImageProcessor::OutputMode::IMPORT},
{ImageProcessor::OutputMode::IMPORT,
ImageProcessor::OutputMode::ALLOCATE},
kImageProcBufferCount, encoder_task_runner_, kImageProcBufferCount, encoder_task_runner_,
base::BindRepeating(&V4L2VideoEncodeAccelerator::ImageProcessorError, base::BindRepeating(&V4L2VideoEncodeAccelerator::ImageProcessorError,
weak_this_)); weak_this_));
...@@ -416,15 +413,9 @@ bool V4L2VideoEncodeAccelerator::AllocateImageProcessorOutputBuffers( ...@@ -416,15 +413,9 @@ bool V4L2VideoEncodeAccelerator::AllocateImageProcessorOutputBuffers(
size_t count) { size_t count) {
DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_);
DCHECK(image_processor_); DCHECK(image_processor_);
// Allocate VideoFrames for image processor output if its mode is IMPORT. DCHECK_EQ(image_processor_->output_mode(),
if (image_processor_->output_mode() != ImageProcessor::OutputMode::IMPORT) { ImageProcessor::OutputMode::IMPORT);
return true; if (!image_processor_gmb_factory_) {
}
const ImageProcessor::PortConfig& output_config =
image_processor_->output_config();
if (output_config.storage_type() == VideoFrame::STORAGE_GPU_MEMORY_BUFFER &&
!image_processor_gmb_factory_) {
image_processor_gmb_factory_ = image_processor_gmb_factory_ =
gpu::GpuMemoryBufferFactory::CreateNativeType(nullptr); gpu::GpuMemoryBufferFactory::CreateNativeType(nullptr);
if (!image_processor_gmb_factory_) { if (!image_processor_gmb_factory_) {
...@@ -434,13 +425,10 @@ bool V4L2VideoEncodeAccelerator::AllocateImageProcessorOutputBuffers( ...@@ -434,13 +425,10 @@ bool V4L2VideoEncodeAccelerator::AllocateImageProcessorOutputBuffers(
} }
image_processor_output_buffers_.resize(count); image_processor_output_buffers_.resize(count);
const ImageProcessor::PortConfig& output_config =
image_processor_->output_config();
for (size_t i = 0; i < count; i++) { for (size_t i = 0; i < count; i++) {
switch (output_config.storage_type()) { switch (output_config.storage_type()) {
case VideoFrame::STORAGE_OWNED_MEMORY:
image_processor_output_buffers_[i] = VideoFrame::CreateFrameWithLayout(
*device_input_layout_, output_config.visible_rect,
output_config.visible_rect.size(), base::TimeDelta(), true);
break;
case VideoFrame::STORAGE_GPU_MEMORY_BUFFER: case VideoFrame::STORAGE_GPU_MEMORY_BUFFER:
image_processor_output_buffers_[i] = CreateGpuMemoryBufferVideoFrame( image_processor_output_buffers_[i] = CreateGpuMemoryBufferVideoFrame(
image_processor_gmb_factory_.get(), image_processor_gmb_factory_.get(),
......
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