Skip to content

Commit

Permalink
Bug 1555891 - Merge PVideoDecoderManager into PRemoteDecoderManager. …
Browse files Browse the repository at this point in the history
…r=jya,jld

Differential Revision: https://phabricator.services.mozilla.com/D33586
  • Loading branch information
mattwoodrow committed Jun 11, 2019
1 parent 39cc368 commit 71fc4d5
Show file tree
Hide file tree
Showing 35 changed files with 494 additions and 844 deletions.
12 changes: 6 additions & 6 deletions dom/ipc/ContentChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "mozilla/Unused.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/TelemetryIPC.h"
#include "mozilla/VideoDecoderManagerChild.h"
#include "mozilla/RemoteDecoderManagerChild.h"
#include "mozilla/devtools/HeapSnapshotTempFileHelperChild.h"
#include "mozilla/docshell/OfflineCacheUpdateChild.h"
#include "mozilla/dom/BrowsingContext.h"
Expand Down Expand Up @@ -1215,7 +1215,7 @@ void ContentChild::LaunchRDDProcess() {
Endpoint<PRemoteDecoderManagerChild> endpoint;
Unused << SendLaunchRDDProcess(&rv, &endpoint);
if (rv == NS_OK) {
RemoteDecoderManagerChild::InitForContent(std::move(endpoint));
RemoteDecoderManagerChild::InitForRDDProcess(std::move(endpoint));
}
}));
task.Wait();
Expand Down Expand Up @@ -1472,7 +1472,7 @@ mozilla::ipc::IPCResult ContentChild::RecvInitRendering(
Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
Endpoint<PRemoteDecoderManagerChild>&& aVideoManager,
nsTArray<uint32_t>&& namespaces) {
MOZ_ASSERT(namespaces.Length() == 3);

Expand All @@ -1496,7 +1496,7 @@ mozilla::ipc::IPCResult ContentChild::RecvInitRendering(
if (!gfx::VRManagerChild::InitForContent(std::move(aVRBridge))) {
return GetResultForRenderingInitFailure(aVRBridge.OtherPid());
}
VideoDecoderManagerChild::InitForContent(std::move(aVideoManager));
RemoteDecoderManagerChild::InitForGPUProcess(std::move(aVideoManager));

#if defined(XP_MACOSX) && !defined(MOZ_SANDBOX)
// Close all current connections to the WindowServer. This ensures that the
Expand All @@ -1514,7 +1514,7 @@ mozilla::ipc::IPCResult ContentChild::RecvReinitRendering(
Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
Endpoint<PRemoteDecoderManagerChild>&& aVideoManager,
nsTArray<uint32_t>&& namespaces) {
MOZ_ASSERT(namespaces.Length() == 3);
nsTArray<RefPtr<BrowserChild>> tabs = BrowserChild::GetAll();
Expand Down Expand Up @@ -1549,7 +1549,7 @@ mozilla::ipc::IPCResult ContentChild::RecvReinitRendering(
}
}

VideoDecoderManagerChild::InitForContent(std::move(aVideoManager));
RemoteDecoderManagerChild::InitForGPUProcess(std::move(aVideoManager));
return IPC_OK();
}

Expand Down
4 changes: 2 additions & 2 deletions dom/ipc/ContentChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ContentChild final : public PContentChild,
Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
Endpoint<PRemoteDecoderManagerChild>&& aVideoManager,
nsTArray<uint32_t>&& namespaces);

mozilla::ipc::IPCResult RecvRequestPerformanceMetrics(const nsID& aID);
Expand All @@ -192,7 +192,7 @@ class ContentChild final : public PContentChild,
Endpoint<PCompositorManagerChild>&& aCompositor,
Endpoint<PImageBridgeChild>&& aImageBridge,
Endpoint<PVRManagerChild>&& aVRBridge,
Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
Endpoint<PRemoteDecoderManagerChild>&& aVideoManager,
nsTArray<uint32_t>&& namespaces);

mozilla::ipc::IPCResult RecvAudioDefaultDeviceChange();
Expand Down
4 changes: 2 additions & 2 deletions dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2516,7 +2516,7 @@ void ContentParent::InitInternal(ProcessPriority aInitialPriority) {
Endpoint<PCompositorManagerChild> compositor;
Endpoint<PImageBridgeChild> imageBridge;
Endpoint<PVRManagerChild> vrBridge;
Endpoint<PVideoDecoderManagerChild> videoManager;
Endpoint<PRemoteDecoderManagerChild> videoManager;
AutoTArray<uint32_t, 3> namespaces;

DebugOnly<bool> opened =
Expand Down Expand Up @@ -2682,7 +2682,7 @@ void ContentParent::OnCompositorUnexpectedShutdown() {
Endpoint<PCompositorManagerChild> compositor;
Endpoint<PImageBridgeChild> imageBridge;
Endpoint<PVRManagerChild> vrBridge;
Endpoint<PVideoDecoderManagerChild> videoManager;
Endpoint<PRemoteDecoderManagerChild> videoManager;
AutoTArray<uint32_t, 3> namespaces;

DebugOnly<bool> opened =
Expand Down
5 changes: 2 additions & 3 deletions dom/ipc/PContent.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ include protocol PPresentation;
include protocol PURLClassifier;
include protocol PURLClassifierLocal;
include protocol PVRManager;
include protocol PVideoDecoderManager;
include protocol PRemoteDecoderManager;
include protocol PProfiler;
include protocol PScriptCache;
Expand Down Expand Up @@ -415,7 +414,7 @@ child:
Endpoint<PCompositorManagerChild> compositor,
Endpoint<PImageBridgeChild> imageBridge,
Endpoint<PVRManagerChild> vr,
Endpoint<PVideoDecoderManagerChild> video,
Endpoint<PRemoteDecoderManagerChild> video,
uint32_t[] namespaces);

// Re-create the rendering stack using the given endpoints. This is sent
Expand All @@ -425,7 +424,7 @@ child:
Endpoint<PCompositorManagerChild> compositor,
Endpoint<PImageBridgeChild> bridge,
Endpoint<PVRManagerChild> vr,
Endpoint<PVideoDecoderManagerChild> video,
Endpoint<PRemoteDecoderManagerChild> video,
uint32_t[] namespaces);

async AudioDefaultDeviceChange();
Expand Down
10 changes: 5 additions & 5 deletions dom/media/ipc/GpuDecoderModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "mozilla/layers/SynchronousTask.h"
#include "mozilla/StaticPrefs.h"
#include "VideoDecoderChild.h"
#include "VideoDecoderManagerChild.h"
#include "RemoteDecoderManagerChild.h"

#include "RemoteMediaDataDecoder.h"

Expand All @@ -21,7 +21,7 @@ using namespace layers;
using namespace gfx;

nsresult GpuDecoderModule::Startup() {
if (!VideoDecoderManagerChild::GetManagerThread()) {
if (!RemoteDecoderManagerChild::GetManagerThread()) {
return NS_ERROR_FAILURE;
}
return mWrapped->Startup();
Expand Down Expand Up @@ -53,7 +53,7 @@ already_AddRefed<MediaDataDecoder> GpuDecoderModule::CreateVideoDecoder(
RefPtr<VideoDecoderChild> child = new VideoDecoderChild();
SynchronousTask task("InitIPDL");
MediaResult result(NS_OK);
VideoDecoderManagerChild::GetManagerThread()->Dispatch(
RemoteDecoderManagerChild::GetManagerThread()->Dispatch(
NS_NewRunnableFunction(
"dom::GpuDecoderModule::CreateVideoDecoder",
[&, child]() {
Expand All @@ -73,8 +73,8 @@ already_AddRefed<MediaDataDecoder> GpuDecoderModule::CreateVideoDecoder(
}

RefPtr<RemoteMediaDataDecoder> object = new RemoteMediaDataDecoder(
child, VideoDecoderManagerChild::GetManagerThread(),
VideoDecoderManagerChild::GetManagerAbstractThread());
child, RemoteDecoderManagerChild::GetManagerThread(),
RemoteDecoderManagerChild::GetManagerAbstractThread());

return object.forget();
}
Expand Down
21 changes: 21 additions & 0 deletions dom/media/ipc/PRemoteDecoderManager.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include protocol PTexture;
include protocol PVideoDecoder;
include protocol PRemoteDecoder;
include LayersSurfaces;
include "mozilla/dom/MediaIPCUtils.h";

using VideoInfo from "MediaInfo.h";
using AudioInfo from "MediaInfo.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::CreateDecoderParams::OptionSet from "PlatformDecoderModule.h";

namespace mozilla {
Expand All @@ -27,12 +31,29 @@ union RemoteDecoderInfoIPDL
sync protocol PRemoteDecoderManager
{
manages PRemoteDecoder;
manages PVideoDecoder;

parent:
sync PRemoteDecoder(RemoteDecoderInfoIPDL info,
OptionSet options)
returns (bool success,
nsCString aErrorDescription);

// aBlacklistedD3D11Driver and aBlacklistedD3D9Driver are used to read back the blacklisted driver information
// from GPU process to content process.
// We should have added a new sync method to read back this information but, in that way, we also introduce one
// more sync IPC call.
// Considering that this information is only used for telemetry usage in bug 1393392 and should be removed once
// we have collected enough data, we add these two return values here for convenience.
sync PVideoDecoder(VideoInfo info, float framerate, OptionSet options, TextureFactoryIdentifier identifier)
returns (bool success,
nsCString aBlacklistedD3D11Driver,
nsCString aBlacklistedD3D9Driver,
nsCString aErrorDescription);

sync Readback(SurfaceDescriptorGPUVideo sd) returns (SurfaceDescriptor aResult);

async DeallocateSurfaceDescriptorGPUVideo(SurfaceDescriptorGPUVideo sd);
};

} // namespace mozilla
4 changes: 2 additions & 2 deletions dom/media/ipc/PVideoDecoder.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include protocol PVideoDecoderManager;
include protocol PRemoteDecoderManager;
include PMediaDecoderParams;
include LayersSurfaces;
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
Expand All @@ -26,7 +26,7 @@ struct VideoDataIPDL
// GPU process. We run a separate IPDL thread for both sides.
async protocol PVideoDecoder
{
manager PVideoDecoderManager;
manager PRemoteDecoderManager;
parent:
async Init();

Expand Down
38 changes: 0 additions & 38 deletions dom/media/ipc/PVideoDecoderManager.ipdl

This file was deleted.

2 changes: 1 addition & 1 deletion dom/media/ipc/RemoteAudioDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MediaResult RemoteAudioDecoderChild::InitIPDL(
const AudioInfo& aAudioInfo,
const CreateDecoderParams::OptionSet& aOptions) {
RefPtr<RemoteDecoderManagerChild> manager =
RemoteDecoderManagerChild::GetSingleton();
RemoteDecoderManagerChild::GetRDDProcessSingleton();

// The manager isn't available because RemoteDecoderManagerChild has been
// initialized with null end points and we don't want to decode video on RDD
Expand Down
Loading

0 comments on commit 71fc4d5

Please sign in to comment.