зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1865426 - Enable uploading to NV12 ID3D11Texture2D with WebRender(Software D3D11) r=gfx-reviewers,lsalzman
With the change, yuv BufferTexture is uploaded to D3D11 NV12 texture also if webrender supports D3D11 and NV12. Calling GpuProcessD3D11TextureMap::GetTexture() is changed from RenderDXGITextureHost::EnsureD3D11Texture2DWithGL() to RenderDXGITextureHost::EnsureD3D11Texture2D(), since the EnsureD3D11Texture2DWithGL() is not called with WebRender(Software D3D11). Differential Revision: https://phabricator.services.mozilla.com/D194171
This commit is contained in:
Родитель
b3006699b6
Коммит
55a951769f
|
@ -120,10 +120,15 @@ class KnowsCompositor {
|
|||
|
||||
bool SupportsD3D11() const {
|
||||
auto lock = mData.Lock();
|
||||
return lock.ref().mTextureFactoryIdentifier.mParentBackend ==
|
||||
return SupportsD3D11(lock.ref().mTextureFactoryIdentifier);
|
||||
}
|
||||
|
||||
static bool SupportsD3D11(
|
||||
const TextureFactoryIdentifier aTextureFactoryIdentifier) {
|
||||
return aTextureFactoryIdentifier.mParentBackend ==
|
||||
layers::LayersBackend::LAYERS_WR &&
|
||||
(lock.ref().mTextureFactoryIdentifier.mCompositorUseANGLE ||
|
||||
lock.ref().mTextureFactoryIdentifier.mWebRenderCompositor ==
|
||||
(aTextureFactoryIdentifier.mCompositorUseANGLE ||
|
||||
aTextureFactoryIdentifier.mWebRenderCompositor ==
|
||||
layers::WebRenderCompositor::D3D11);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/layers/AsyncImagePipelineManager.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/layers/CompositorVsyncScheduler.h" // for CompositorVsyncScheduler
|
||||
#include "mozilla/layers/KnowsCompositor.h"
|
||||
#include "mozilla/layers/RemoteTextureHostWrapper.h"
|
||||
#include "mozilla/layers/RemoteTextureMap.h"
|
||||
#include "mozilla/layers/WebRenderBridgeParent.h"
|
||||
|
@ -349,7 +350,8 @@ TextureHost* WebRenderImageHost::GetAsTextureHostForComposite(
|
|||
auto identifier = aAsyncImageManager->GetTextureFactoryIdentifier();
|
||||
const bool convertToNV12 =
|
||||
StaticPrefs::gfx_video_convert_yuv_to_nv12_image_host_win() &&
|
||||
identifier.mCompositorUseDComp &&
|
||||
identifier.mSupportsD3D11NV12 &&
|
||||
KnowsCompositor::SupportsD3D11(identifier) &&
|
||||
texture->GetFormat() == gfx::SurfaceFormat::YUV;
|
||||
if (convertToNV12) {
|
||||
if (!mTextureAllocator) {
|
||||
|
|
|
@ -164,21 +164,6 @@ bool RenderDXGITextureHost::EnsureD3D11Texture2DWithGL() {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (mGpuProcessTextureId.isSome()) {
|
||||
auto* textureMap = layers::GpuProcessD3D11TextureMap::Get();
|
||||
if (textureMap) {
|
||||
RefPtr<ID3D11Texture2D> texture;
|
||||
textureMap->WaitTextureReady(mGpuProcessTextureId.ref());
|
||||
mTexture = textureMap->GetTexture(mGpuProcessTextureId.ref());
|
||||
if (mTexture) {
|
||||
return true;
|
||||
} else {
|
||||
gfxCriticalNote << "GpuProcessTextureId is not valid";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& gle = gl::GLContextEGL::Cast(mGL);
|
||||
const auto& egl = gle->mEgl;
|
||||
|
||||
|
@ -210,6 +195,21 @@ bool RenderDXGITextureHost::EnsureD3D11Texture2D(ID3D11Device* aDevice) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (mGpuProcessTextureId.isSome()) {
|
||||
auto* textureMap = layers::GpuProcessD3D11TextureMap::Get();
|
||||
if (textureMap) {
|
||||
RefPtr<ID3D11Texture2D> texture;
|
||||
textureMap->WaitTextureReady(mGpuProcessTextureId.ref());
|
||||
mTexture = textureMap->GetTexture(mGpuProcessTextureId.ref());
|
||||
if (mTexture) {
|
||||
return true;
|
||||
} else {
|
||||
gfxCriticalNote << "GpuProcessTextureId is not valid";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the D3D11 texture from shared handle.
|
||||
HRESULT hr = aDevice->OpenSharedResource(
|
||||
(HANDLE)mHandle, __uuidof(ID3D11Texture2D),
|
||||
|
|
Загрузка…
Ссылка в новой задаче