Commit 0526850c authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

Implement CreateProtectedBufferAllocator for Viz

VideoProtectedBufferAllocator is a newly introduced mojo interface.
This implements its factory function, CreateProtectedBufferAllocator, for Viz.

BUG=b:72354215
BUG=chromium:804687
TEST=Play Secure video using EXO Player
TEST=CtsMediaTestCases
TEST=GtsMediaTestCases

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I570a9c6778bbaa3447fbf17ed2acbf5ff2b582ee
Reviewed-on: https://chromium-review.googlesource.com/983200
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarDavid Reveman <reveman@chromium.org>
Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547376}
parent 8412836b
......@@ -115,8 +115,8 @@ class VideoAcceleratorFactoryServiceViz
void CreateProtectedBufferAllocator(
mojom::VideoProtectedBufferAllocatorRequest request) override {
// TODO(hiroh): Implement CreateProtectedBufferAllocator path for Viz.
NOTIMPLEMENTED();
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
arc_->CreateVideoProtectedBufferAllocator(std::move(request));
}
private:
......
......@@ -61,16 +61,19 @@ class TestGpuService : public mojom::GpuService {
EstablishGpuChannelCallback callback) override {}
void CloseChannel(int32_t client_id) override {}
#if defined(OS_CHROMEOS)
void CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) override {}
void CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) override {}
void CreateArcVideoProtectedBufferAllocator(
arc::mojom::VideoProtectedBufferAllocatorRequest pba_request) override {}
void CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) override {}
#endif // defined(OS_CHROMEOS)
void CreateJpegDecodeAccelerator(
media::mojom::JpegDecodeAcceleratorRequest jda_request) override {}
......
......@@ -62,6 +62,7 @@
#if defined(OS_CHROMEOS)
#include "components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h"
#include "components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h"
#include "components/arc/video_accelerator/gpu_arc_video_protected_buffer_allocator.h"
#include "components/arc/video_accelerator/protected_buffer_manager.h"
#include "components/arc/video_accelerator/protected_buffer_manager_proxy.h"
#endif // defined(OS_CHROMEOS)
......@@ -293,49 +294,47 @@ void GpuServiceImpl::RecordLogMessage(int severity,
(*gpu_host_)->RecordLogMessage(severity, header, message);
}
#if defined(OS_CHROMEOS)
void GpuServiceImpl::CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) {
#if defined(OS_CHROMEOS)
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoDecodeAcceleratorOnMainThread,
weak_ptr_, std::move(vda_request)));
#else
NOTREACHED();
#endif // defined(OS_CHROMEOS)
}
void GpuServiceImpl::CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) {
#if defined(OS_CHROMEOS)
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoEncodeAcceleratorOnMainThread,
weak_ptr_, std::move(vea_request)));
#else
NOTREACHED();
#endif // defined(OS_CHROMEOS)
}
void GpuServiceImpl::CreateArcVideoProtectedBufferAllocator(
arc::mojom::VideoProtectedBufferAllocatorRequest pba_request) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoProtectedBufferAllocatorOnMainThread,
weak_ptr_, std::move(pba_request)));
}
void GpuServiceImpl::CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) {
#if defined(OS_CHROMEOS)
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcProtectedBufferManagerOnMainThread,
weak_ptr_, std::move(pbm_request)));
#else
NOTREACHED();
#endif // defined(OS)CHROMEOS)
}
#if defined(OS_CHROMEOS)
void GpuServiceImpl::CreateArcVideoDecodeAcceleratorOnMainThread(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) {
DCHECK(main_runner_->BelongsToCurrentThread());
......@@ -352,6 +351,18 @@ void GpuServiceImpl::CreateArcVideoEncodeAcceleratorOnMainThread(
std::move(vea_request));
}
void GpuServiceImpl::CreateArcVideoProtectedBufferAllocatorOnMainThread(
arc::mojom::VideoProtectedBufferAllocatorRequest pba_request) {
DCHECK(main_runner_->BelongsToCurrentThread());
auto gpu_arc_video_protected_buffer_allocator =
arc::GpuArcVideoProtectedBufferAllocator::Create(
protected_buffer_manager_);
if (!gpu_arc_video_protected_buffer_allocator)
return;
mojo::MakeStrongBinding(std::move(gpu_arc_video_protected_buffer_allocator),
std::move(pba_request));
}
void GpuServiceImpl::CreateArcProtectedBufferManagerOnMainThread(
arc::mojom::ProtectedBufferManagerRequest pbm_request) {
DCHECK(main_runner_->BelongsToCurrentThread());
......
......@@ -154,12 +154,16 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
bool is_gpu_host,
EstablishGpuChannelCallback callback) override;
void CloseChannel(int32_t client_id) override;
#if defined(OS_CHROMEOS)
void CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) override;
void CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) override;
void CreateArcVideoProtectedBufferAllocator(
arc::mojom::VideoProtectedBufferAllocatorRequest pba_request) override;
void CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) override;
#endif // defined(OS_CHROMEOS)
void CreateJpegDecodeAccelerator(
media::mojom::JpegDecodeAcceleratorRequest jda_request) override;
void CreateJpegEncodeAccelerator(
......@@ -198,6 +202,8 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
arc::mojom::VideoDecodeAcceleratorRequest vda_request);
void CreateArcVideoEncodeAcceleratorOnMainThread(
arc::mojom::VideoEncodeAcceleratorRequest vea_request);
void CreateArcVideoProtectedBufferAllocatorOnMainThread(
arc::mojom::VideoProtectedBufferAllocatorRequest pba_request);
void CreateArcProtectedBufferManagerOnMainThread(
arc::mojom::ProtectedBufferManagerRequest pbm_request);
#endif // defined(OS_CHROMEOS)
......
......@@ -7,6 +7,7 @@ module ui.mojom;
import "components/arc/common/protected_buffer_manager.mojom";
import "components/arc/common/video_decode_accelerator.mojom";
import "components/arc/common/video_encode_accelerator.mojom";
import "components/arc/common/video_protected_buffer_allocator.mojom";
interface Arc {
// Create a new VideoDecodeAccelerator and binds it to |vda|.
......@@ -15,6 +16,10 @@ interface Arc {
// Create a new VideoEncodeAccelerator and binds it to |vea|.
CreateVideoEncodeAccelerator(arc.mojom.VideoEncodeAccelerator& vea);
// Create a new VideoProtectedBufferAllocator and binds it to |pba|.
CreateVideoProtectedBufferAllocator(
arc.mojom.VideoProtectedBufferAllocator& pba);
// Create a new ProtectedBufferManager and binds it to |pbm|.
CreateProtectedBufferManager(arc.mojom.ProtectedBufferManager& pbm);
};
......@@ -25,6 +25,11 @@ void ArcClient::CreateVideoEncodeAccelerator(
gpu_service_->CreateArcVideoEncodeAccelerator(std::move(vea_request));
}
void ArcClient::CreateVideoProtectedBufferAllocator(
arc::mojom::VideoProtectedBufferAllocatorRequest pba_request) {
gpu_service_->CreateArcVideoProtectedBufferAllocator(std::move(pba_request));
}
void ArcClient::CreateProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) {
gpu_service_->CreateArcProtectedBufferManager(std::move(pbm_request));
......
......@@ -30,6 +30,10 @@ class ArcClient : public mojom::Arc {
void CreateVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) override;
void CreateVideoProtectedBufferAllocator(
arc::mojom::VideoProtectedBufferAllocatorRequest pba_request) override;
void CreateProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) override;
......
......@@ -7,6 +7,7 @@ module viz.mojom;
import "components/arc/common/protected_buffer_manager.mojom";
import "components/arc/common/video_decode_accelerator.mojom";
import "components/arc/common/video_encode_accelerator.mojom";
import "components/arc/common/video_protected_buffer_allocator.mojom";
import "gpu/ipc/common/gpu_info.mojom";
import "gpu/ipc/common/memory_stats.mojom";
import "gpu/ipc/common/surface_handle.mojom";
......@@ -30,12 +31,20 @@ interface GpuService {
CloseChannel(int32 client_id);
// Create a new ARC VideoDecodeAccelerator and binds it to |vda|.
[EnableIf=is_chromeos]
CreateArcVideoDecodeAccelerator(arc.mojom.VideoDecodeAccelerator& vda);
// Create a new ARC VideoEncodeAccelerator and binds it to |vea|.
[EnableIf=is_chromeos]
CreateArcVideoEncodeAccelerator(arc.mojom.VideoEncodeAccelerator& vea);
// Create a new ARC VideoProtectedBufferAllocator and binds it to |pba|.
[EnableIf=is_chromeos]
CreateArcVideoProtectedBufferAllocator(
arc.mojom.VideoProtectedBufferAllocator& pba);
// Create a new ARC ProtectedBufferManager and binds it to |pbm|.
[EnableIf=is_chromeos]
CreateArcProtectedBufferManager(arc.mojom.ProtectedBufferManager& pbm);
// Creates a new JpegDecodeAccelerator and binds it to |jda|.
......
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