forked from mirrors/gecko-dev
Bug 1787561 Part 1: Make GPUVideoImage track color depth, and make RemoteImageHolder pass it through. r=media-playback-reviewers,gfx-reviewers,alwu,aosmond
This ensures that the Image that the client receives has the color depth information that was sent to the GPU, even though the client can't query the GPU directly. Differential Revision: https://phabricator.services.mozilla.com/D155902
This commit is contained in:
parent
f0e33014a0
commit
ddc104b332
4 changed files with 24 additions and 12 deletions
|
|
@ -22,11 +22,17 @@ RemoteImageHolder::RemoteImageHolder() = default;
|
|||
RemoteImageHolder::RemoteImageHolder(layers::IGPUVideoSurfaceManager* aManager,
|
||||
layers::VideoBridgeSource aSource,
|
||||
const gfx::IntSize& aSize,
|
||||
const gfx::ColorDepth& aColorDepth,
|
||||
const layers::SurfaceDescriptor& aSD)
|
||||
: mSource(aSource), mSize(aSize), mSD(Some(aSD)), mManager(aManager) {}
|
||||
: mSource(aSource),
|
||||
mSize(aSize),
|
||||
mColorDepth(aColorDepth),
|
||||
mSD(Some(aSD)),
|
||||
mManager(aManager) {}
|
||||
RemoteImageHolder::RemoteImageHolder(RemoteImageHolder&& aOther)
|
||||
: mSource(aOther.mSource),
|
||||
mSize(aOther.mSize),
|
||||
mColorDepth(aOther.mColorDepth),
|
||||
mSD(std::move(aOther.mSD)),
|
||||
mManager(aOther.mManager) {
|
||||
aOther.mSD = Nothing();
|
||||
|
|
@ -113,7 +119,7 @@ already_AddRefed<layers::Image> RemoteImageHolder::TransferToImage(
|
|||
SurfaceDescriptorRemoteDecoder remoteSD =
|
||||
static_cast<const SurfaceDescriptorGPUVideo&>(*mSD);
|
||||
remoteSD.source() = Some(mSource);
|
||||
image = new GPUVideoImage(mManager, remoteSD, mSize);
|
||||
image = new GPUVideoImage(mManager, remoteSD, mSize, mColorDepth);
|
||||
}
|
||||
mSD = Nothing();
|
||||
mManager = nullptr;
|
||||
|
|
@ -139,6 +145,7 @@ RemoteImageHolder::~RemoteImageHolder() {
|
|||
RemoteImageHolder&& aParam) {
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSource);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSize);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mColorDepth);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSD);
|
||||
// Empty this holder.
|
||||
aParam.mSD = Nothing();
|
||||
|
|
@ -150,6 +157,7 @@ RemoteImageHolder::~RemoteImageHolder() {
|
|||
RemoteImageHolder* aResult) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mSource) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mSize) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mColorDepth) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mSD)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class RemoteImageHolder final {
|
|||
RemoteImageHolder(layers::IGPUVideoSurfaceManager* aManager,
|
||||
layers::VideoBridgeSource aSource,
|
||||
const gfx::IntSize& aSize,
|
||||
const gfx::ColorDepth& aColorDepth,
|
||||
const layers::SurfaceDescriptor& aSD);
|
||||
RemoteImageHolder(RemoteImageHolder&& aOther);
|
||||
// Ensure we never copy this object.
|
||||
|
|
@ -47,6 +48,7 @@ class RemoteImageHolder final {
|
|||
// We need a default for the default constructor, never used in practice.
|
||||
layers::VideoBridgeSource mSource = layers::VideoBridgeSource::GpuProcess;
|
||||
gfx::IntSize mSize;
|
||||
gfx::ColorDepth mColorDepth;
|
||||
Maybe<layers::SurfaceDescriptor> mSD;
|
||||
RefPtr<layers::IGPUVideoSurfaceManager> mManager;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -274,14 +274,10 @@ MediaResult RemoteVideoDecoderParent::ProcessDecodedData(
|
|||
MediaDataIPDL(data->mOffset, data->mTime, data->mTimecode,
|
||||
data->mDuration, data->mKeyframe),
|
||||
video->mDisplay,
|
||||
RemoteImageHolder(
|
||||
mParent,
|
||||
XRE_IsGPUProcess()
|
||||
? VideoBridgeSource::GpuProcess
|
||||
: (XRE_IsRDDProcess()
|
||||
? VideoBridgeSource::RddProcess
|
||||
: VideoBridgeSource::MFMediaEngineCDMProcess),
|
||||
size, sd),
|
||||
RemoteImageHolder(mParent,
|
||||
XRE_IsGPUProcess() ? VideoBridgeSource::GpuProcess
|
||||
: VideoBridgeSource::RddProcess,
|
||||
size, video->mImage->GetColorDepth(), sd),
|
||||
video->mFrameID);
|
||||
|
||||
array.AppendElement(std::move(output));
|
||||
|
|
|
|||
|
|
@ -38,8 +38,11 @@ class GPUVideoImage final : public Image {
|
|||
|
||||
public:
|
||||
GPUVideoImage(IGPUVideoSurfaceManager* aManager,
|
||||
const SurfaceDescriptorGPUVideo& aSD, const gfx::IntSize& aSize)
|
||||
: Image(nullptr, ImageFormat::GPU_VIDEO), mSize(aSize) {
|
||||
const SurfaceDescriptorGPUVideo& aSD, const gfx::IntSize& aSize,
|
||||
const gfx::ColorDepth& aColorDepth)
|
||||
: Image(nullptr, ImageFormat::GPU_VIDEO),
|
||||
mSize(aSize),
|
||||
mColorDepth(aColorDepth) {
|
||||
// Create the TextureClient immediately since the GPUVideoTextureData
|
||||
// is responsible for deallocating the SurfaceDescriptor.
|
||||
//
|
||||
|
|
@ -56,6 +59,8 @@ class GPUVideoImage final : public Image {
|
|||
|
||||
gfx::IntSize GetSize() const override { return mSize; }
|
||||
|
||||
gfx::ColorDepth GetColorDepth() const override { return mColorDepth; }
|
||||
|
||||
Maybe<SurfaceDescriptor> GetDesc() override {
|
||||
return GetDescFromTexClient(mTextureClient);
|
||||
}
|
||||
|
|
@ -89,6 +94,7 @@ class GPUVideoImage final : public Image {
|
|||
|
||||
private:
|
||||
gfx::IntSize mSize;
|
||||
gfx::ColorDepth mColorDepth;
|
||||
RefPtr<TextureClient> mTextureClient;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue