Add DeviceManagerD3D11 as a wrapper around gfxWindowsPlatform. (bug 1282364 part 1, r=mattwoodrow)

--HG--
extra : rebase_source : 3ea710ffdaabf737374958e80f6235c1c8861237
This commit is contained in:
David Anderson 2016-07-26 12:50:30 -07:00
parent 1a452594b3
commit b7855c4ee9
20 changed files with 241 additions and 66 deletions

View File

@ -10,6 +10,7 @@
#include "ImageContainer.h"
#include "gfxWindowsPlatform.h"
#include "D3D9SurfaceImage.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/layers/D3D11ShareHandleImage.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/Telemetry.h"
@ -632,7 +633,7 @@ D3D11DXVA2Manager::Init(nsACString& aFailureReason)
return E_FAIL;
}
mDevice = gfxWindowsPlatform::GetPlatform()->CreateD3D11DecoderDevice();
mDevice = gfx::DeviceManagerD3D11::Get()->CreateDecoderDevice();
if (!mDevice) {
aFailureReason.AssignLiteral("Failed to create D3D11 device for decoder");
return E_FAIL;

View File

@ -4,8 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDebug.h"
#include "D3D11SurfaceHolder.h"
#include "gfxWindowsPlatform.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/layers/TextureD3D11.h"
#include <d3d11.h>
@ -18,7 +18,7 @@ using namespace mozilla::layers;
D3D11SurfaceHolder::D3D11SurfaceHolder(ID3D11Texture2D* back,
SurfaceFormat format,
const IntSize& size)
: mDevice11(gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice()),
: mDevice11(DeviceManagerD3D11::Get()->GetContentDevice()),
mBack(back),
mFormat(format),
mSize(size)
@ -33,7 +33,7 @@ bool
D3D11SurfaceHolder::IsValid()
{
// If a TDR occurred, platform devices will be recreated.
if (gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice() != mDevice11) {
if (DeviceManagerD3D11::Get()->GetContentDevice() != mDevice11) {
return false;
}
return true;

View File

@ -45,6 +45,7 @@
#include "mozilla/layers/ImageBridgeChild.h"
#if defined(XP_WIN)
# include "mozilla/layers/D3D11ShareHandleImage.h"
# include "mozilla/gfx/DeviceManagerD3D11.h"
# include "mozilla/layers/TextureD3D11.h"
#endif
@ -400,7 +401,7 @@ PluginInstanceParent::AnswerNPN_GetValue_PreferredDXGIAdapter(DxgiAdapterDesc* a
return false;
}
ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice();
RefPtr<ID3D11Device> device = DeviceManagerD3D11::Get()->GetContentDevice();
if (!device) {
return false;
}
@ -681,7 +682,7 @@ PluginInstanceParent::RecvInitDXGISurface(const gfx::SurfaceFormat& format,
return true;
}
RefPtr<ID3D11Device> d3d11 = gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice();
RefPtr<ID3D11Device> d3d11 = DeviceManagerD3D11::Get()->GetContentDevice();
if (!d3d11) {
return true;
}

View File

@ -21,7 +21,7 @@
#ifdef XP_WIN
#include "SharedSurfaceANGLE.h" // for SurfaceFactory_ANGLEShareHandle
#include "SharedSurfaceD3D11Interop.h" // for SurfaceFactory_D3D11Interop
#include "gfxWindowsPlatform.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#endif
#ifdef MOZ_WIDGET_GONK
@ -108,9 +108,10 @@ GLScreenBuffer::CreateFactory(GLContext* gl,
#ifdef XP_WIN
// Enable surface sharing only if ANGLE and compositing devices
// are both WARP or both not WARP
gfx::DeviceManagerD3D11* dm = gfx::DeviceManagerD3D11::Get();
if (gl->IsANGLE() &&
(gl->IsWARP() == gfxWindowsPlatform::GetPlatform()->IsWARP()) &&
gfxWindowsPlatform::GetPlatform()->CompositorD3D11TextureSharingWorks())
(gl->IsWARP() == dm->IsWARP()) &&
dm->TextureSharingWorks())
{
factory = SurfaceFactory_ANGLEShareHandle::Create(gl, caps, allocator, flags);
}

View File

@ -6,9 +6,9 @@
#include "SharedSurfaceANGLE.h"
#include <d3d11.h>
#include "gfxWindowsPlatform.h"
#include "GLContextEGL.h"
#include "GLLibraryEGL.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
namespace mozilla {
@ -196,8 +196,9 @@ public:
}
}
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11DeviceForCurrentThread(&device)) {
RefPtr<ID3D11Device> device =
gfx::DeviceManagerD3D11::Get()->GetDeviceForCurrentThread();
if (!device) {
return;
}
@ -252,8 +253,9 @@ SharedSurface_ANGLEShareHandle::ReadbackBySharedHandle(gfx::DataSourceSurface* o
{
MOZ_ASSERT(out_surface);
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11DeviceForCurrentThread(&device)) {
RefPtr<ID3D11Device> device =
gfx::DeviceManagerD3D11::Get()->GetDeviceForCurrentThread();
if (!device) {
return false;
}

View File

@ -10,6 +10,7 @@
#include "GLContext.h"
#include "WGLLibrary.h"
#include "nsPrintfCString.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
namespace mozilla {
namespace gl {
@ -125,9 +126,8 @@ public:
static already_AddRefed<DXGLDevice> Open(WGLLibrary* wgl)
{
MOZ_ASSERT(wgl->HasDXInterop2());
gfxWindowsPlatform* plat = gfxWindowsPlatform::GetPlatform();
RefPtr<ID3D11Device> d3d = plat->GetD3D11ContentDevice();
RefPtr<ID3D11Device> d3d = gfx::DeviceManagerD3D11::Get()->GetContentDevice();
if (!d3d) {
NS_WARNING("Failed to create D3D11 device.");
return nullptr;

View File

@ -7,6 +7,7 @@
#include "mozilla/layers/TextureD3D11.h"
#include "mozilla/layers/CompositableClient.h"
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/layers/TextureClient.h"
#include "d3d9.h"
@ -224,8 +225,8 @@ IMFYCbCrImage::GetTextureClient(CompositableClient* aClient)
return mTextureClient;
}
RefPtr<ID3D11Device> device;
gfxWindowsPlatform::GetPlatform()->GetD3D11ImageBridgeDevice(&device);
RefPtr<ID3D11Device> device =
gfx::DeviceManagerD3D11::Get()->GetImageBridgeDevice();
LayersBackend backend = aClient->GetForwarder()->GetCompositorBackendType();
if (!device || backend != LayersBackend::LAYERS_D3D11) {

View File

@ -35,7 +35,7 @@
#include "LayerMetricsWrapper.h"
#endif
#ifdef XP_WIN
#include "gfxWindowsPlatform.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#endif
namespace mozilla {
@ -772,7 +772,7 @@ ClientLayerManager::GetBackendName(nsAString& aName)
case LayersBackend::LAYERS_D3D9: aName.AssignLiteral("Direct3D 9"); return;
case LayersBackend::LAYERS_D3D11: {
#ifdef XP_WIN
if (gfxWindowsPlatform::GetPlatform()->IsWARP()) {
if (DeviceManagerD3D11::Get()->IsWARP()) {
aName.AssignLiteral("Direct3D 11 WARP");
} else {
aName.AssignLiteral("Direct3D 11");

View File

@ -34,6 +34,7 @@
#include "mozilla/layers/ShadowLayers.h"
#ifdef XP_WIN
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/layers/TextureD3D9.h"
#include "mozilla/layers/TextureD3D11.h"
#include "mozilla/layers/TextureDIB.h"
@ -1039,7 +1040,7 @@ TextureClient::CreateForDrawing(TextureForwarder* aAllocator,
(moz2DBackend == gfx::BackendType::DIRECT2D ||
moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice())) &&
DeviceManagerD3D11::Get()->GetContentDevice())) &&
aSize.width <= maxTextureSize &&
aSize.height <= maxTextureSize)
{

View File

@ -12,6 +12,7 @@
#include "gfxWindowsPlatform.h"
#include "nsIWidget.h"
#include "nsIGfxInfo.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/layers/ImageHost.h"
#include "mozilla/layers/ContentHost.h"
#include "mozilla/layers/Effects.h"
@ -203,7 +204,8 @@ CompositorD3D11::Initialize(nsCString* const out_failureReason)
HRESULT hr;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11Device(&mDevice)) {
mDevice = DeviceManagerD3D11::Get()->GetCompositorDevice();
if (!mDevice) {
*out_failureReason = "FEATURE_FAILURE_D3D11_NO_DEVICE";
return false;
}
@ -1257,7 +1259,8 @@ CompositorD3D11::EndFrame()
UINT presentInterval = 0;
if (gfxWindowsPlatform::GetPlatform()->IsWARP()) {
bool isWARP = DeviceManagerD3D11::Get()->IsWARP();
if (isWARP) {
// When we're using WARP we cannot present immediately as it causes us
// to tear when rendering. When not using WARP it appears the DWM takes
// care of tearing for us.
@ -1280,8 +1283,7 @@ CompositorD3D11::EndFrame()
nsString vendorID;
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
gfxInfo->GetAdapterVendorID(vendorID);
allowPartialPresent = !vendorID.EqualsLiteral("0x10de") ||
gfxWindowsPlatform::GetPlatform()->IsWARP();
allowPartialPresent = !vendorID.EqualsLiteral("0x10de") || isWARP;
}
if (SUCCEEDED(hr) && chain && allowPartialPresent) {
@ -1505,7 +1507,7 @@ bool
DeviceAttachmentsD3D11::InitSyncObject()
{
// Sync object is not supported on WARP.
if (gfxWindowsPlatform::GetPlatform()->IsWARP()) {
if (DeviceManagerD3D11::Get()->IsWARP()) {
return true;
}
@ -1707,8 +1709,7 @@ CompositorD3D11::HandleError(HRESULT hr, Severity aSeverity)
MOZ_CRASH("GFX: Unrecoverable D3D11 error");
}
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11Device(&device) || device != mDevice) {
if (mDevice && DeviceManagerD3D11::Get()->GetCompositorDevice() != mDevice) {
gfxCriticalError() << "Out of sync D3D11 devices in HandleError, " << (int)mVerifyBuffersFailed;
}

View File

@ -11,6 +11,7 @@
#include "gfx2DGlue.h"
#include "gfxPrefs.h"
#include "ReadbackManagerD3D11.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/gfx/Logging.h"
namespace mozilla {
@ -361,10 +362,11 @@ D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat, TextureAllocation
ID3D11Device* aDevice)
{
RefPtr<ID3D11Device> device = aDevice;
if (!device &&
!gfxWindowsPlatform::GetPlatform()->GetD3D11DeviceForCurrentThread(&device))
{
return nullptr;
if (!device) {
device = DeviceManagerD3D11::Get()->GetDeviceForCurrentThread();
if (!device) {
return nullptr;
}
}
CD3D11_TEXTURE2D_DESC newDesc(DXGI_FORMAT_B8G8R8A8_UNORM,
@ -657,9 +659,7 @@ DXGITextureHostD3D11::GetDevice()
return nullptr;
}
RefPtr<ID3D11Device> device;
gfxWindowsPlatform::GetPlatform()->GetD3D11Device(&device);
return device;
return DeviceManagerD3D11::Get()->GetCompositorDevice();
}
static CompositorD3D11* AssertD3D11Compositor(Compositor* aCompositor)
@ -795,9 +795,7 @@ DXGIYCbCrTextureHostD3D11::GetDevice()
return nullptr;
}
RefPtr<ID3D11Device> device;
gfxWindowsPlatform::GetPlatform()->GetD3D11Device(&device);
return device;
return DeviceManagerD3D11::Get()->GetCompositorDevice();
}
void
@ -1121,7 +1119,7 @@ SyncObjectD3D11::FinalizeFrame()
HRESULT hr;
if (!mD3D11Texture && mD3D11SyncedTextures.size()) {
ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice();
RefPtr<ID3D11Device> device = DeviceManagerD3D11::Get()->GetContentDevice();
hr = device->OpenSharedResource(mHandle, __uuidof(ID3D11Texture2D), (void**)(ID3D11Texture2D**)getter_AddRefs(mD3D11Texture));
@ -1164,8 +1162,7 @@ SyncObjectD3D11::FinalizeFrame()
box.front = box.top = box.left = 0;
box.back = box.bottom = box.right = 1;
ID3D11Device* dev = gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice();
RefPtr<ID3D11Device> dev = DeviceManagerD3D11::Get()->GetContentDevice();
if (!dev) {
if (gfxWindowsPlatform::GetPlatform()->DidRenderingDeviceReset()) {
return;

View File

@ -0,0 +1,87 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "DeviceManagerD3D11.h"
#include "gfxWindowsPlatform.h"
#include <d3d11.h>
namespace mozilla {
namespace gfx {
StaticAutoPtr<DeviceManagerD3D11> DeviceManagerD3D11::sInstance;
/* static */ void
DeviceManagerD3D11::Init()
{
sInstance = new DeviceManagerD3D11();
}
/* static */ void
DeviceManagerD3D11::Shutdown()
{
sInstance = nullptr;
}
RefPtr<ID3D11Device>
DeviceManagerD3D11::GetCompositorDevice()
{
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11Device(&device))
return nullptr;
return device;
}
RefPtr<ID3D11Device>
DeviceManagerD3D11::GetImageBridgeDevice()
{
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11ImageBridgeDevice(&device)) {
return nullptr;
}
return device;
}
RefPtr<ID3D11Device>
DeviceManagerD3D11::GetContentDevice()
{
return gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice();
}
RefPtr<ID3D11Device>
DeviceManagerD3D11::GetDeviceForCurrentThread()
{
RefPtr<ID3D11Device> device;
if (!gfxWindowsPlatform::GetPlatform()->GetD3D11DeviceForCurrentThread(&device)) {
return nullptr;
}
return device;
}
RefPtr<ID3D11Device>
DeviceManagerD3D11::CreateDecoderDevice()
{
return gfxWindowsPlatform::GetPlatform()->CreateD3D11DecoderDevice();
}
unsigned
DeviceManagerD3D11::GetD3D11Version() const
{
return gfxWindowsPlatform::GetPlatform()->GetD3D11Version();
}
bool
DeviceManagerD3D11::TextureSharingWorks() const
{
return gfxWindowsPlatform::GetPlatform()->CompositorD3D11TextureSharingWorks();
}
bool
DeviceManagerD3D11::IsWARP() const
{
return gfxWindowsPlatform::GetPlatform()->IsWARP();
}
} // namespace gfx
} // namespace mozilla

View File

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef mozilla_gfx_thebes_DeviceManagerD3D11_h
#define mozilla_gfx_thebes_DeviceManagerD3D11_h
#include "mozilla/RefPtr.h"
#include "mozilla/StaticPtr.h"
#include <windows.h>
#include <objbase.h>
#include <dxgi.h>
// This header is available in the June 2010 SDK and in the Win8 SDK
#include <d3dcommon.h>
// Win 8.0 SDK types we'll need when building using older sdks.
#if !defined(D3D_FEATURE_LEVEL_11_1) // defined in the 8.0 SDK only
#define D3D_FEATURE_LEVEL_11_1 static_cast<D3D_FEATURE_LEVEL>(0xb100)
#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048
#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
#endif
struct ID3D11Device;
namespace mozilla {
namespace gfx {
class DeviceManagerD3D11 final
{
public:
static void Init();
static void Shutdown();
static DeviceManagerD3D11* Get() {
return sInstance;
}
RefPtr<ID3D11Device> GetCompositorDevice();
RefPtr<ID3D11Device> GetImageBridgeDevice();
RefPtr<ID3D11Device> GetContentDevice();
RefPtr<ID3D11Device> GetDeviceForCurrentThread();
RefPtr<ID3D11Device> CreateDecoderDevice();
unsigned GetD3D11Version() const;
bool TextureSharingWorks() const;
bool IsWARP() const;
private:
static StaticAutoPtr<DeviceManagerD3D11> sInstance;
};
} // namespace gfx
} // namespace mozilla
#endif // mozilla_gfx_thebes_DeviceManagerD3D11_h

View File

@ -26,6 +26,7 @@
#if XP_WIN
#include "gfxWindowsPlatform.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#endif
using namespace mozilla;
@ -1242,7 +1243,8 @@ gfxContext::PushNewDT(gfxContentType content)
if (!newDT) {
if (!gfxPlatform::GetPlatform()->DidRenderingDeviceReset()
#ifdef XP_WIN
&& !(mDT->GetBackendType() == BackendType::DIRECT2D1_1 && !gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice())
&& !(mDT->GetBackendType() == BackendType::DIRECT2D1_1 &&
!DeviceManagerD3D11::Get()->GetContentDevice())
#endif
) {
// If even this fails.. we're most likely just out of memory!

View File

@ -15,6 +15,12 @@
class gfxContext;
struct gfxRect;
namespace mozilla {
namespace gfx {
class DrawTarget;
} // namespace gfx
} // namespace mozilla
/**
* This stores glyph bounds information for a particular gfxFont, at
* a particular appunits-per-dev-pixel ratio (because the compressed glyph
@ -29,6 +35,8 @@ struct gfxRect;
* assumed to be zero.
*/
class gfxGlyphExtents {
typedef mozilla::gfx::DrawTarget DrawTarget;
public:
explicit gfxGlyphExtents(int32_t aAppUnitsPerDevUnit) :
mAppUnitsPerDevUnit(aAppUnitsPerDevUnit) {

View File

@ -74,6 +74,7 @@
#include "VsyncSource.h"
#include "DriverCrashGuard.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
using namespace mozilla;
using namespace mozilla::gfx;
@ -358,6 +359,7 @@ gfxWindowsPlatform::gfxWindowsPlatform()
gfxWindowsPlatform::~gfxWindowsPlatform()
{
DeviceManagerD3D11::Shutdown();
mDeviceManager = nullptr;
mD3D11Device = nullptr;
mD3D11ContentDevice = nullptr;
@ -395,6 +397,8 @@ gfxWindowsPlatform::InitAcceleration()
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_0);
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_9_3);
DeviceManagerD3D11::Init();
InitializeConfig();
InitializeDevices();
UpdateANGLEConfig();

View File

@ -47,6 +47,7 @@ namespace mozilla {
namespace gfx {
class DrawTarget;
class FeatureState;
class DeviceManagerD3D11;
}
namespace layers {
class DeviceManagerD3D9;
@ -97,7 +98,10 @@ struct ClearTypeParameterInfo {
int32_t enhancedContrast;
};
class gfxWindowsPlatform : public gfxPlatform {
class gfxWindowsPlatform : public gfxPlatform
{
friend class mozilla::gfx::DeviceManagerD3D11;
public:
enum TextRenderingMode {
TEXT_RENDERING_NO_CLEARTYPE,
@ -206,21 +210,31 @@ public:
IDWriteRenderingParams *GetRenderingParams(TextRenderingMode aRenderMode)
{ return mRenderingParams[aRenderMode]; }
private:
bool GetD3D11Device(RefPtr<ID3D11Device>* aOutDevice);
bool GetD3D11DeviceForCurrentThread(RefPtr<ID3D11Device>* aOutDevice);
bool GetD3D11ImageBridgeDevice(RefPtr<ID3D11Device>* aOutDevice);
bool GetD3D11DeviceForCurrentThread(RefPtr<ID3D11Device>* aOutDevice);
ID3D11Device *GetD3D11ContentDevice();
already_AddRefed<ID3D11Device> CreateD3D11DecoderDevice();
unsigned GetD3D11Version();
// Create a D3D11 device to be used for DXVA decoding.
bool CreateD3D11DecoderDeviceHelper(
IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aDevice,
HRESULT& aResOut);
// Returns whether the compositor's D3D11 device supports texture sharing.
bool CompositorD3D11TextureSharingWorks() const {
return mCompositorD3D11TextureSharingWorks;
}
bool IsWARP() const { return mIsWARP; }
public:
void OnDeviceManagerDestroy(mozilla::layers::DeviceManagerD3D9* aDeviceManager);
already_AddRefed<mozilla::layers::DeviceManagerD3D9> GetD3D9DeviceManager();
IDirect3DDevice9* GetD3D9Device();
void D3D9DeviceReset();
ID3D11Device *GetD3D11ContentDevice();
// Create a D3D11 device to be used for DXVA decoding.
already_AddRefed<ID3D11Device> CreateD3D11DecoderDevice();
bool CreateD3D11DecoderDeviceHelper(
IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aDevice,
HRESULT& aResOut);
bool DwmCompositionEnabled();
@ -228,13 +242,6 @@ public:
static bool IsOptimus();
bool IsWARP() const { return mIsWARP; }
// Returns whether the compositor's D3D11 device supports texture sharing.
bool CompositorD3D11TextureSharingWorks() const {
return mCompositorD3D11TextureSharingWorks;
}
bool SupportsApzWheelInput() const override {
return true;
}
@ -245,8 +252,6 @@ public:
bool HandleDeviceReset();
void UpdateBackendPrefs();
unsigned GetD3D11Version();
void TestDeviceReset(DeviceResetReason aReason);
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;

View File

@ -51,6 +51,7 @@ EXPORTS += [
]
EXPORTS.mozilla.gfx += [
'DeviceManagerD3D11.h',
'PrintTarget.h',
'PrintTargetThebes.h',
]
@ -232,6 +233,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
UNIFIED_SOURCES += [
'gfxMacPlatformFontList.mm',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
UNIFIED_SOURCES += [
'DeviceManagerD3D11.cpp',
]
# We prefer to use ICU for normalization functions, but currently it is only
# available if we're building with the Intl API enabled:

View File

@ -16,6 +16,7 @@
#include "prprf.h"
#include "GfxDriverInfo.h"
#include "mozilla/Preferences.h"
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/gfx/Logging.h"
#include "nsPrintfCString.h"
#include "jsapi.h"
@ -1321,21 +1322,20 @@ GfxInfo::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
JS::Rooted<JSObject*> obj(aCx);
gfxWindowsPlatform* platform = gfxWindowsPlatform::GetPlatform();
gfx::FeatureStatus d3d11 = gfxConfig::GetValue(Feature::D3D11_COMPOSITING);
if (!InitFeatureObject(aCx, aObj, "d3d11", FEATURE_DIRECT3D_11_ANGLE,
Some(d3d11), &obj)) {
return;
}
if (d3d11 == gfx::FeatureStatus::Available) {
JS::Rooted<JS::Value> val(aCx, JS::Int32Value(platform->GetD3D11Version()));
DeviceManagerD3D11* dm = DeviceManagerD3D11::Get();
JS::Rooted<JS::Value> val(aCx, JS::Int32Value(dm->GetD3D11Version()));
JS_SetProperty(aCx, obj, "version", val);
val = JS::BooleanValue(platform->IsWARP());
val = JS::BooleanValue(dm->IsWARP());
JS_SetProperty(aCx, obj, "warp", val);
val = JS::BooleanValue(platform->CompositorD3D11TextureSharingWorks());
val = JS::BooleanValue(dm->TextureSharingWorks());
JS_SetProperty(aCx, obj, "textureSharing", val);
bool blacklisted = false;

View File

@ -201,6 +201,7 @@
#define WM_DPICHANGED 0x02E0
#endif
#include "mozilla/gfx/DeviceManagerD3D11.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layers/ScrollInputMethods.h"
@ -7819,7 +7820,7 @@ nsWindow::ComputeShouldAccelerate()
// on Windows 7 where presentation fails randomly for windows with drop
// shadows.
if (mTransparencyMode == eTransparencyTransparent ||
(IsPopup() && gfxWindowsPlatform::GetPlatform()->IsWARP()))
(IsPopup() && DeviceManagerD3D11::Get()->IsWARP()))
{
return false;
}