Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
media: Add DCOMPSurfaceRegistry mojom interface
This interface allows a non-privileged client (in the render process) to register a DCOMP surface handle to be accessed in the GPU process. To do this, we have to route to the browser process. The client is MediaFoundationRendererClient in the render process, and the implementation is the DCOMPSurfaceRegistryBroker in the browser process, which then uses GpuService to call into the GPU process. This CL is based on the prototype CL uploaded by frankli@microsoft.com: https://chromium-review.googlesource.com/c/chromium/src/+/1779403 See design doc at: https://docs.google.com/document/d/1gQz0r3WmQUbXshL_Z9zYEeVjUgvEFhelOpCt3WWmo0o Bug: 999747 Change-Id: If891bc853348df2be1559421ad592d1999320266 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3028644 Commit-Queue: Xiaohan Wang <xhwang@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: John Rummell <jrummell@chromium.org> Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Cr-Commit-Position: refs/heads/master@{#907335}
- Loading branch information
1 parent
9996b4e
commit 4f50dbd
Showing
21 changed files
with
245 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/browser/media/dcomp_surface_registry_broker.h" | ||
|
||
#include "base/logging.h" | ||
#include "content/browser/gpu/gpu_process_host.h" | ||
#include "mojo/public/cpp/bindings/callback_helpers.h" | ||
|
||
namespace content { | ||
|
||
DCOMPSurfaceRegistryBroker::DCOMPSurfaceRegistryBroker() = default; | ||
|
||
DCOMPSurfaceRegistryBroker::~DCOMPSurfaceRegistryBroker() = default; | ||
|
||
void DCOMPSurfaceRegistryBroker::RegisterDCOMPSurfaceHandle( | ||
mojo::PlatformHandle surface_handle, | ||
RegisterDCOMPSurfaceHandleCallback callback) { | ||
DVLOG(1) << __func__; | ||
|
||
auto* gpu_process_host = | ||
GpuProcessHost::Get(GpuProcessKind::GPU_PROCESS_KIND_SANDBOXED, false); | ||
if (!gpu_process_host) { | ||
DLOG(ERROR) << __func__ << ": Failed to get GpuProcessHost!"; | ||
std::move(callback).Run(base::UnguessableToken()); | ||
return; | ||
} | ||
|
||
auto* gpu_service = gpu_process_host->gpu_host()->gpu_service(); | ||
gpu_service->RegisterDCOMPSurfaceHandle( | ||
std::move(surface_handle), | ||
mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback), | ||
base::UnguessableToken())); | ||
} | ||
|
||
} // namespace content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CONTENT_BROWSER_MEDIA_DCOMP_SURFACE_REGISTRY_BROKER_H_ | ||
#define CONTENT_BROWSER_MEDIA_DCOMP_SURFACE_REGISTRY_BROKER_H_ | ||
|
||
#include "media/mojo/mojom/dcomp_surface_registry.mojom.h" | ||
|
||
namespace content { | ||
|
||
// This class is hosted in the browser process and it allows unprivileged | ||
// renderer process clients to register and unregister DCOMP surface handles for | ||
// GPU process access. | ||
// This class is bound and lives on the browser IO thread since GpuProcessHost | ||
// must be called on the IO thread. | ||
class DCOMPSurfaceRegistryBroker : public media::mojom::DCOMPSurfaceRegistry { | ||
public: | ||
DCOMPSurfaceRegistryBroker(); | ||
DCOMPSurfaceRegistryBroker(const DCOMPSurfaceRegistryBroker&) = delete; | ||
DCOMPSurfaceRegistryBroker& operator=(const DCOMPSurfaceRegistryBroker&) = | ||
delete; | ||
~DCOMPSurfaceRegistryBroker() override; | ||
|
||
// media::mojom::DCOMPSurfaceRegistry: | ||
void RegisterDCOMPSurfaceHandle( | ||
mojo::PlatformHandle surface_handle, | ||
RegisterDCOMPSurfaceHandleCallback callback) override; | ||
}; | ||
|
||
} // namespace content | ||
|
||
#endif // CONTENT_BROWSER_MEDIA_DCOMP_SURFACE_REGISTRY_BROKER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.