Commit 417cd3b5 authored by Andres Calderon Jaramillo's avatar Andres Calderon Jaramillo Committed by Chromium LUCI CQ

media/VaapiVEA: Remove dependency on GMB factory.

This CL removes the usage of the GpuMemoryBufferFactory from the
VaapiVideoEncodeAccelerator. This is because the GMB factory is not
really needed to allocate buffers and not having it simplifies things.

Note that we must start the |encoder_task_runner_| with base::MayBlock()
because the first encoder to make use of this path will open the render
node.

Bug: b:173167846
Test: video.EncodeAccel.h264_720p_nv12_dmabuf on atlas
Change-Id: Iafa78e7027d65182408416cba2ad6f997b24c299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568549
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835366}
parent e1085618
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "media/base/bind_to_current_loop.h" #include "media/base/bind_to_current_loop.h"
#include "media/base/format_utils.h" #include "media/base/format_utils.h"
#include "media/base/unaligned_shared_memory.h" #include "media/base/unaligned_shared_memory.h"
...@@ -67,12 +66,10 @@ constexpr unsigned int kTargetBitratePercentage = 90; ...@@ -67,12 +66,10 @@ constexpr unsigned int kTargetBitratePercentage = 90;
// requirements. // requirements.
gfx::Size GetInputFrameSize(VideoPixelFormat format, gfx::Size GetInputFrameSize(VideoPixelFormat format,
const gfx::Size& visible_size) { const gfx::Size& visible_size) {
std::unique_ptr<::gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory =
::gpu::GpuMemoryBufferFactory::CreateNativeType(nullptr);
// Get a VideoFrameLayout of a graphic buffer with the same gfx::BufferUsage // Get a VideoFrameLayout of a graphic buffer with the same gfx::BufferUsage
// as camera stack. // as camera stack.
base::Optional<VideoFrameLayout> layout = GetPlatformVideoFrameLayout( base::Optional<VideoFrameLayout> layout = GetPlatformVideoFrameLayout(
gpu_memory_buffer_factory.get(), format, visible_size, /*gpu_memory_buffer_factory=*/nullptr, format, visible_size,
gfx::BufferUsage::SCANOUT_VEA_READ_CAMERA_AND_CPU_READ_WRITE); gfx::BufferUsage::SCANOUT_VEA_READ_CAMERA_AND_CPU_READ_WRITE);
if (!layout || layout->planes().empty()) { if (!layout || layout->planes().empty()) {
VLOGF(1) << "Failed to allocate VideoFrameLayout"; VLOGF(1) << "Failed to allocate VideoFrameLayout";
...@@ -234,7 +231,7 @@ VaapiVideoEncodeAccelerator::VaapiVideoEncodeAccelerator() ...@@ -234,7 +231,7 @@ VaapiVideoEncodeAccelerator::VaapiVideoEncodeAccelerator()
// TODO(akahuang): Change to use SequencedTaskRunner to see if the // TODO(akahuang): Change to use SequencedTaskRunner to see if the
// performance is affected. // performance is affected.
encoder_task_runner_(base::ThreadPool::CreateSingleThreadTaskRunner( encoder_task_runner_(base::ThreadPool::CreateSingleThreadTaskRunner(
{base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, {base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, base::MayBlock()},
base::SingleThreadTaskRunnerThreadMode::DEDICATED)) { base::SingleThreadTaskRunnerThreadMode::DEDICATED)) {
VLOGF(2); VLOGF(2);
DCHECK_CALLED_ON_VALID_SEQUENCE(child_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(child_sequence_checker_);
......
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