mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1247775 - Part 2: Remove Direct2D 1.0 code from Thebes. r=dvander
MozReview-Commit-ID: EC8yhkvvood
This commit is contained in:
parent
e760a0577f
commit
5cdd856dfa
@ -19,7 +19,6 @@ struct DeviceInitData
|
|||||||
bool useD3D11WARP;
|
bool useD3D11WARP;
|
||||||
bool useD3D11ImageBridge;
|
bool useD3D11ImageBridge;
|
||||||
bool d3d11TextureSharingWorks;
|
bool d3d11TextureSharingWorks;
|
||||||
bool useD2D;
|
|
||||||
bool useD2D1;
|
bool useD2D1;
|
||||||
DxgiAdapterDesc adapter;
|
DxgiAdapterDesc adapter;
|
||||||
};
|
};
|
||||||
|
@ -594,7 +594,7 @@ RepeatOrStretchSurface(DrawTarget& aDT, SourceSurface* aSurface,
|
|||||||
|
|
||||||
if ((!aDT.GetTransform().IsRectilinear() &&
|
if ((!aDT.GetTransform().IsRectilinear() &&
|
||||||
aDT.GetBackendType() != BackendType::CAIRO) ||
|
aDT.GetBackendType() != BackendType::CAIRO) ||
|
||||||
(aDT.GetBackendType() == BackendType::DIRECT2D)) {
|
(aDT.GetBackendType() == BackendType::DIRECT2D1_1)) {
|
||||||
// Use stretching if possible, since it leads to less seams when the
|
// Use stretching if possible, since it leads to less seams when the
|
||||||
// destination is transformed. However, don't do this if we're using cairo,
|
// destination is transformed. However, don't do this if we're using cairo,
|
||||||
// because if cairo is using pixman it won't render anything for large
|
// because if cairo is using pixman it won't render anything for large
|
||||||
|
@ -242,8 +242,6 @@ private:
|
|||||||
|
|
||||||
DECL_GFX_PREF(Once, "gfx.direct2d.disabled", Direct2DDisabled, bool, false);
|
DECL_GFX_PREF(Once, "gfx.direct2d.disabled", Direct2DDisabled, bool, false);
|
||||||
DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
|
DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
|
||||||
DECL_GFX_PREF(Live, "gfx.direct2d.use1_1", Direct2DUse1_1, bool, false);
|
|
||||||
DECL_GFX_PREF(Live, "gfx.direct2d.allow1_0", Direct2DAllow1_0, bool, false);
|
|
||||||
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
|
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
|
||||||
DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);
|
DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);
|
||||||
DECL_GFX_PREF(Once, "gfx.font_rendering.directwrite.force-enabled", DirectWriteFontRenderingForceEnabled, bool, false);
|
DECL_GFX_PREF(Once, "gfx.font_rendering.directwrite.force-enabled", DirectWriteFontRenderingForceEnabled, bool, false);
|
||||||
|
@ -422,8 +422,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
|
|||||||
js::ProfileEntry::Category::GRAPHICS);
|
js::ProfileEntry::Category::GRAPHICS);
|
||||||
|
|
||||||
DrawTarget* destDrawTarget = aContext->GetDrawTarget();
|
DrawTarget* destDrawTarget = aContext->GetDrawTarget();
|
||||||
if ((destDrawTarget->GetBackendType() == BackendType::DIRECT2D1_1) ||
|
if (destDrawTarget->GetBackendType() == BackendType::DIRECT2D1_1) {
|
||||||
(destDrawTarget->GetBackendType() == BackendType::DIRECT2D)) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +43,10 @@
|
|||||||
|
|
||||||
#include "WinUtils.h"
|
#include "WinUtils.h"
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
|
||||||
#include "gfxDWriteFontList.h"
|
#include "gfxDWriteFontList.h"
|
||||||
#include "gfxDWriteFonts.h"
|
#include "gfxDWriteFonts.h"
|
||||||
#include "gfxDWriteCommon.h"
|
#include "gfxDWriteCommon.h"
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gfxTextRun.h"
|
#include "gfxTextRun.h"
|
||||||
#include "gfxUserFontSet.h"
|
#include "gfxUserFontSet.h"
|
||||||
@ -57,13 +55,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
||||||
#include <d3d10_1.h>
|
#include <d3d10_1.h>
|
||||||
|
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
|
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
|
|
||||||
@ -114,14 +110,11 @@ DCFromDrawTarget::DCFromDrawTarget(DrawTarget& aDrawTarget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
||||||
|
|
||||||
static const char *kFeatureLevelPref =
|
static const char *kFeatureLevelPref =
|
||||||
"gfx.direct3d.last_used_feature_level_idx";
|
"gfx.direct3d.last_used_feature_level_idx";
|
||||||
static const int kSupportedFeatureLevels[] =
|
static const int kSupportedFeatureLevels[] =
|
||||||
{ D3D10_FEATURE_LEVEL_10_1, D3D10_FEATURE_LEVEL_10_0 };
|
{ D3D10_FEATURE_LEVEL_10_1, D3D10_FEATURE_LEVEL_10_0 };
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class GfxD2DVramReporter final : public nsIMemoryReporter
|
class GfxD2DVramReporter final : public nsIMemoryReporter
|
||||||
{
|
{
|
||||||
@ -166,16 +159,16 @@ NS_IMPL_ISUPPORTS(GfxD2DVramReporter, nsIMemoryReporter)
|
|||||||
class GPUAdapterReporter final : public nsIMemoryReporter
|
class GPUAdapterReporter final : public nsIMemoryReporter
|
||||||
{
|
{
|
||||||
// Callers must Release the DXGIAdapter after use or risk mem-leak
|
// Callers must Release the DXGIAdapter after use or risk mem-leak
|
||||||
static bool GetDXGIAdapter(IDXGIAdapter **DXGIAdapter)
|
static bool GetDXGIAdapter(IDXGIAdapter **aDXGIAdapter)
|
||||||
{
|
{
|
||||||
ID3D10Device1 *D2D10Device;
|
ID3D11Device *d3d11Device;
|
||||||
IDXGIDevice *DXGIDevice;
|
IDXGIDevice *dxgiDevice;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if ((D2D10Device = mozilla::gfx::Factory::GetDirect3D10Device())) {
|
if ((d3d11Device = mozilla::gfx::Factory::GetDirect3D11Device())) {
|
||||||
if (D2D10Device->QueryInterface(__uuidof(IDXGIDevice), (void **)&DXGIDevice) == S_OK) {
|
if (d3d11Device->QueryInterface(__uuidof(IDXGIDevice), (void **)&dxgiDevice) == S_OK) {
|
||||||
result = (DXGIDevice->GetAdapter(DXGIAdapter) == S_OK);
|
result = (dxgiDevice->GetAdapter(aDXGIAdapter) == S_OK);
|
||||||
DXGIDevice->Release();
|
dxgiDevice->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +369,6 @@ gfxWindowsPlatform::gfxWindowsPlatform()
|
|||||||
, mCompositorD3D11TextureSharingWorks(false)
|
, mCompositorD3D11TextureSharingWorks(false)
|
||||||
, mAcceleration(FeatureStatus::Unused)
|
, mAcceleration(FeatureStatus::Unused)
|
||||||
, mD3D11Status(FeatureStatus::Unused)
|
, mD3D11Status(FeatureStatus::Unused)
|
||||||
, mD2DStatus(FeatureStatus::Unused)
|
|
||||||
, mD2D1Status(FeatureStatus::Unused)
|
, mD2D1Status(FeatureStatus::Unused)
|
||||||
{
|
{
|
||||||
mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
|
mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
|
||||||
@ -411,7 +403,6 @@ gfxWindowsPlatform::gfxWindowsPlatform()
|
|||||||
gfxWindowsPlatform::~gfxWindowsPlatform()
|
gfxWindowsPlatform::~gfxWindowsPlatform()
|
||||||
{
|
{
|
||||||
mDeviceManager = nullptr;
|
mDeviceManager = nullptr;
|
||||||
mD3D10Device = nullptr;
|
|
||||||
mD3D11Device = nullptr;
|
mD3D11Device = nullptr;
|
||||||
mD3D11ContentDevice = nullptr;
|
mD3D11ContentDevice = nullptr;
|
||||||
mD3D11ImageBridgeDevice = nullptr;
|
mD3D11ImageBridgeDevice = nullptr;
|
||||||
@ -489,9 +480,7 @@ gfxWindowsPlatform::HandleDeviceReset()
|
|||||||
|
|
||||||
// Remove devices and adapters.
|
// Remove devices and adapters.
|
||||||
ResetD3D11Devices();
|
ResetD3D11Devices();
|
||||||
mD3D10Device = nullptr;
|
|
||||||
mAdapter = nullptr;
|
mAdapter = nullptr;
|
||||||
Factory::SetDirect3D10Device(nullptr);
|
|
||||||
|
|
||||||
// Reset local state. Note: we leave feature status variables as-is. They
|
// Reset local state. Note: we leave feature status variables as-is. They
|
||||||
// will be recomputed by InitializeDevices().
|
// will be recomputed by InitializeDevices().
|
||||||
@ -519,17 +508,11 @@ gfxWindowsPlatform::UpdateBackendPrefs()
|
|||||||
uint32_t canvasMask = BackendTypeBit(SOFTWARE_BACKEND);
|
uint32_t canvasMask = BackendTypeBit(SOFTWARE_BACKEND);
|
||||||
uint32_t contentMask = BackendTypeBit(SOFTWARE_BACKEND);
|
uint32_t contentMask = BackendTypeBit(SOFTWARE_BACKEND);
|
||||||
BackendType defaultBackend = SOFTWARE_BACKEND;
|
BackendType defaultBackend = SOFTWARE_BACKEND;
|
||||||
if (GetD2DStatus() == FeatureStatus::Available) {
|
if (GetD2D1Status() == FeatureStatus::Available) {
|
||||||
mRenderMode = RENDER_DIRECT2D;
|
mRenderMode = RENDER_DIRECT2D;
|
||||||
canvasMask |= BackendTypeBit(BackendType::DIRECT2D);
|
contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
|
||||||
contentMask |= BackendTypeBit(BackendType::DIRECT2D);
|
canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
|
||||||
if (GetD2D1Status() == FeatureStatus::Available) {
|
defaultBackend = BackendType::DIRECT2D1_1;
|
||||||
contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
|
|
||||||
canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
|
|
||||||
defaultBackend = BackendType::DIRECT2D1_1;
|
|
||||||
} else {
|
|
||||||
defaultBackend = BackendType::DIRECT2D;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mRenderMode = RENDER_GDI;
|
mRenderMode = RENDER_GDI;
|
||||||
canvasMask |= BackendTypeBit(BackendType::SKIA);
|
canvasMask |= BackendTypeBit(BackendType::SKIA);
|
||||||
@ -571,129 +554,11 @@ gfxWindowsPlatform::GetContentBackendFor(mozilla::layers::LayersBackend aLayers)
|
|||||||
return SOFTWARE_BACKEND;
|
return SOFTWARE_BACKEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
||||||
HRESULT
|
|
||||||
gfxWindowsPlatform::CreateDevice(RefPtr<IDXGIAdapter1> &adapter1,
|
|
||||||
int featureLevelIndex)
|
|
||||||
{
|
|
||||||
nsModuleHandle d3d10module(LoadLibrarySystem32(L"d3d10_1.dll"));
|
|
||||||
if (!d3d10module)
|
|
||||||
return E_FAIL;
|
|
||||||
decltype(D3D10CreateDevice1)* createD3DDevice =
|
|
||||||
(decltype(D3D10CreateDevice1)*) GetProcAddress(d3d10module, "D3D10CreateDevice1");
|
|
||||||
if (!createD3DDevice)
|
|
||||||
return E_FAIL;
|
|
||||||
|
|
||||||
ID3D10Device1* device = nullptr;
|
|
||||||
HRESULT hr =
|
|
||||||
createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
|
|
||||||
#ifdef DEBUG
|
|
||||||
// This isn't set because of bug 1078411
|
|
||||||
// D3D10_CREATE_DEVICE_DEBUG |
|
|
||||||
#endif
|
|
||||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
|
||||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
|
||||||
static_cast<D3D10_FEATURE_LEVEL1>(kSupportedFeatureLevels[featureLevelIndex]),
|
|
||||||
D3D10_1_SDK_VERSION, &device);
|
|
||||||
|
|
||||||
// If we fail here, the DirectX version or video card probably
|
|
||||||
// changed. We previously could use 10.1 but now we can't
|
|
||||||
// anymore. Revert back to doing a 10.0 check first before
|
|
||||||
// the 10.1 check.
|
|
||||||
if (device) {
|
|
||||||
mD3D10Device = device;
|
|
||||||
|
|
||||||
// Leak the module while the D3D 10 device is being used.
|
|
||||||
d3d10module.disown();
|
|
||||||
|
|
||||||
// Setup a pref for future launch optimizaitons when in main process.
|
|
||||||
if (XRE_IsParentProcess()) {
|
|
||||||
Preferences::SetInt(kFeatureLevelPref, featureLevelIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return device ? S_OK : hr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
|
|
||||||
{
|
|
||||||
if ((!Factory::SupportsD2D1() || !gfxPrefs::Direct2DUse1_1()) && !gfxPrefs::Direct2DAllow1_0()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
||||||
if (mD3D10Device) {
|
|
||||||
if (SUCCEEDED(mD3D10Device->GetDeviceRemovedReason())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mD3D10Device = nullptr;
|
|
||||||
|
|
||||||
// Surface cache needs to be invalidated since it may contain vector
|
|
||||||
// images rendered with our old, broken D2D device.
|
|
||||||
SurfaceCache::DiscardAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
mozilla::ScopedGfxFeatureReporter reporter("D2D", aAttemptForce);
|
|
||||||
|
|
||||||
int supportedFeatureLevelsCount = ArrayLength(kSupportedFeatureLevels);
|
|
||||||
|
|
||||||
RefPtr<IDXGIAdapter1> adapter1 = GetDXGIAdapter();
|
|
||||||
|
|
||||||
if (!adapter1) {
|
|
||||||
// Unable to create adapter, abort acceleration.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// It takes a lot of time (5-10% of startup time or ~100ms) to do both
|
|
||||||
// a createD3DDevice on D3D10_FEATURE_LEVEL_10_0. We therefore store
|
|
||||||
// the last used feature level to go direct to that.
|
|
||||||
int featureLevelIndex = Preferences::GetInt(kFeatureLevelPref, 0);
|
|
||||||
if (featureLevelIndex >= supportedFeatureLevelsCount || featureLevelIndex < 0)
|
|
||||||
featureLevelIndex = 0;
|
|
||||||
|
|
||||||
// Start with the last used feature level, and move to lower DX versions
|
|
||||||
// until we find one that works.
|
|
||||||
HRESULT hr = E_FAIL;
|
|
||||||
for (int i = featureLevelIndex; i < supportedFeatureLevelsCount; i++) {
|
|
||||||
hr = CreateDevice(adapter1, i);
|
|
||||||
// If it succeeded we found the first available feature level
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we succeeded in creating a device, try for a newer device
|
|
||||||
// that we haven't tried yet.
|
|
||||||
if (SUCCEEDED(hr)) {
|
|
||||||
for (int i = featureLevelIndex - 1; i >= 0; i--) {
|
|
||||||
hr = CreateDevice(adapter1, i);
|
|
||||||
// If it failed then we don't have new hardware
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mD3D10Device) {
|
|
||||||
reporter.SetSuccessful();
|
|
||||||
mozilla::gfx::Factory::SetDirect3D10Device(mD3D10Device);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedGfxFeatureReporter reporter1_1("D2D1.1V");
|
|
||||||
|
|
||||||
if (Factory::SupportsD2D1()) {
|
|
||||||
reporter1_1.SetSuccessful();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
gfxPlatformFontList*
|
gfxPlatformFontList*
|
||||||
gfxWindowsPlatform::CreatePlatformFontList()
|
gfxWindowsPlatform::CreatePlatformFontList()
|
||||||
{
|
{
|
||||||
gfxPlatformFontList *pfl;
|
gfxPlatformFontList *pfl;
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
|
||||||
// bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
|
// bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
|
||||||
// crashers so blacklist them altogether
|
// crashers so blacklist them altogether
|
||||||
if (IsNotWin7PreRTM() && GetDWriteFactory()) {
|
if (IsNotWin7PreRTM() && GetDWriteFactory()) {
|
||||||
@ -707,7 +572,7 @@ gfxWindowsPlatform::CreatePlatformFontList()
|
|||||||
gfxPlatformFontList::Shutdown();
|
gfxPlatformFontList::Shutdown();
|
||||||
DisableD2D();
|
DisableD2D();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
pfl = new gfxGDIFontList();
|
pfl = new gfxGDIFontList();
|
||||||
|
|
||||||
if (NS_SUCCEEDED(pfl->InitFontList())) {
|
if (NS_SUCCEEDED(pfl->InitFontList())) {
|
||||||
@ -727,10 +592,8 @@ gfxWindowsPlatform::CreatePlatformFontList()
|
|||||||
void
|
void
|
||||||
gfxWindowsPlatform::DisableD2D()
|
gfxWindowsPlatform::DisableD2D()
|
||||||
{
|
{
|
||||||
mD2DStatus = FeatureStatus::Failed;
|
|
||||||
mD2D1Status = FeatureStatus::Failed;
|
mD2D1Status = FeatureStatus::Failed;
|
||||||
Factory::SetDirect3D11Device(nullptr);
|
Factory::SetDirect3D11Device(nullptr);
|
||||||
Factory::SetDirect3D10Device(nullptr);
|
|
||||||
UpdateBackendPrefs();
|
UpdateBackendPrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1178,12 +1041,6 @@ gfxWindowsPlatform::DidRenderingDeviceReset(DeviceResetReason* aResetReason)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetD3D10Device()) {
|
|
||||||
HRESULT hr = GetD3D10Device()->GetDeviceRemovedReason();
|
|
||||||
if (IsDeviceReset(hr, aResetReason)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (XRE_IsParentProcess() && gfxPrefs::DeviceResetForTesting()) {
|
if (XRE_IsParentProcess() && gfxPrefs::DeviceResetForTesting()) {
|
||||||
TestDeviceReset((DeviceResetReason)gfxPrefs::DeviceResetForTesting());
|
TestDeviceReset((DeviceResetReason)gfxPrefs::DeviceResetForTesting());
|
||||||
if (aResetReason) {
|
if (aResetReason) {
|
||||||
@ -1447,7 +1304,6 @@ gfxWindowsPlatform::FontsPrefsChanged(const char *aPref)
|
|||||||
void
|
void
|
||||||
gfxWindowsPlatform::SetupClearTypeParams()
|
gfxWindowsPlatform::SetupClearTypeParams()
|
||||||
{
|
{
|
||||||
#if CAIRO_HAS_DWRITE_FONT
|
|
||||||
if (GetDWriteFactory()) {
|
if (GetDWriteFactory()) {
|
||||||
// any missing prefs will default to invalid (-1) and be ignored;
|
// any missing prefs will default to invalid (-1) and be ignored;
|
||||||
// out-of-range values will also be ignored
|
// out-of-range values will also be ignored
|
||||||
@ -1555,7 +1411,6 @@ gfxWindowsPlatform::SetupClearTypeParams()
|
|||||||
dwriteGeometry, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
|
dwriteGeometry, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
|
||||||
getter_AddRefs(mRenderingParams[TEXT_RENDERING_GDI_CLASSIC]));
|
getter_AddRefs(mRenderingParams[TEXT_RENDERING_GDI_CLASSIC]));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2417,7 +2272,7 @@ gfxWindowsPlatform::InitializeDevices()
|
|||||||
// Usually we want D2D in order to use DWrite, but if the users have it
|
// Usually we want D2D in order to use DWrite, but if the users have it
|
||||||
// forced, we'll let them have it, as unsupported configuration.
|
// forced, we'll let them have it, as unsupported configuration.
|
||||||
if (gfxPrefs::DirectWriteFontRenderingForceEnabled() &&
|
if (gfxPrefs::DirectWriteFontRenderingForceEnabled() &&
|
||||||
IsFeatureStatusFailure(mD2DStatus) &&
|
IsFeatureStatusFailure(mD2D1Status) &&
|
||||||
!mDWriteFactory) {
|
!mDWriteFactory) {
|
||||||
gfxCriticalNote << "Attempting DWrite without D2D support";
|
gfxCriticalNote << "Attempting DWrite without D2D support";
|
||||||
InitDWriteSupport();
|
InitDWriteSupport();
|
||||||
@ -2583,17 +2438,11 @@ IsD2DBlacklisted()
|
|||||||
// not change after a TDR (like the OS version), we could find a driver change
|
// not change after a TDR (like the OS version), we could find a driver change
|
||||||
// that runs us into the blacklist.
|
// that runs us into the blacklist.
|
||||||
FeatureStatus
|
FeatureStatus
|
||||||
gfxWindowsPlatform::CheckD2DSupport()
|
gfxWindowsPlatform::CheckD2D1Support()
|
||||||
{
|
{
|
||||||
// Don't revive D2D support after a failure.
|
// Don't revive D2D1 support after a failure.
|
||||||
if (IsFeatureStatusFailure(mD2DStatus)) {
|
if (IsFeatureStatusFailure(mD2D1Status)) {
|
||||||
return mD2DStatus;
|
return mD2D1Status;
|
||||||
}
|
|
||||||
|
|
||||||
if (XRE_IsContentProcess()) {
|
|
||||||
return GetParentDevicePrefs().useD2D()
|
|
||||||
? FeatureStatus::Available
|
|
||||||
: FeatureStatus::Blocked;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gfxPrefs::Direct2DForceEnabled() && IsD2DBlacklisted()) {
|
if (!gfxPrefs::Direct2DForceEnabled() && IsD2DBlacklisted()) {
|
||||||
@ -2617,70 +2466,38 @@ gfxWindowsPlatform::CheckD2DSupport()
|
|||||||
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
|
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
|
||||||
return FeatureStatus::Blocked;
|
return FeatureStatus::Blocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Factory::SupportsD2D1()) {
|
||||||
|
return FeatureStatus::Unavailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (XRE_IsContentProcess()) {
|
||||||
|
return GetParentDevicePrefs().useD2D1()
|
||||||
|
? FeatureStatus::Available
|
||||||
|
: FeatureStatus::Blocked;
|
||||||
|
}
|
||||||
|
|
||||||
return FeatureStatus::Available;
|
return FeatureStatus::Available;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gfxWindowsPlatform::InitializeD2D()
|
gfxWindowsPlatform::InitializeD2D()
|
||||||
{
|
{
|
||||||
mD2DStatus = CheckD2DSupport();
|
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
|
||||||
if (IsFeatureStatusFailure(mD2DStatus)) {
|
|
||||||
|
mD2D1Status = CheckD2D1Support();
|
||||||
|
if (IsFeatureStatusFailure(mD2D1Status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mCompositorD3D11TextureSharingWorks) {
|
if (!mCompositorD3D11TextureSharingWorks) {
|
||||||
mD2DStatus = FeatureStatus::Failed;
|
mD2D1Status = FeatureStatus::Failed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using Direct2D depends on DWrite support.
|
// Using Direct2D depends on DWrite support.
|
||||||
if (!mDWriteFactory && !InitDWriteSupport()) {
|
if (!mDWriteFactory && !InitDWriteSupport()) {
|
||||||
mD2DStatus = FeatureStatus::Failed;
|
mD2D1Status = FeatureStatus::Failed;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize D2D 1.1.
|
|
||||||
InitializeD2D1();
|
|
||||||
|
|
||||||
// Initialize D2D 1.0.
|
|
||||||
VerifyD2DDevice(gfxPrefs::Direct2DForceEnabled());
|
|
||||||
if (!mD3D10Device) {
|
|
||||||
mDWriteFactory = nullptr;
|
|
||||||
mD2DStatus = FeatureStatus::Failed;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mD2DStatus = FeatureStatus::Available;
|
|
||||||
}
|
|
||||||
|
|
||||||
FeatureStatus
|
|
||||||
gfxWindowsPlatform::CheckD2D1Support()
|
|
||||||
{
|
|
||||||
// Don't revive D2D1 support after a failure.
|
|
||||||
if (IsFeatureStatusFailure(mD2D1Status)) {
|
|
||||||
return mD2D1Status;
|
|
||||||
}
|
|
||||||
if (!Factory::SupportsD2D1()) {
|
|
||||||
return FeatureStatus::Unavailable;
|
|
||||||
}
|
|
||||||
if (XRE_IsContentProcess()) {
|
|
||||||
return GetParentDevicePrefs().useD2D1()
|
|
||||||
? FeatureStatus::Available
|
|
||||||
: FeatureStatus::Blocked;
|
|
||||||
}
|
|
||||||
if (!gfxPrefs::Direct2DUse1_1()) {
|
|
||||||
return FeatureStatus::Disabled;
|
|
||||||
}
|
|
||||||
return FeatureStatus::Available;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gfxWindowsPlatform::InitializeD2D1()
|
|
||||||
{
|
|
||||||
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
|
|
||||||
|
|
||||||
mD2D1Status = CheckD2D1Support();
|
|
||||||
if (IsFeatureStatusFailure(mD2D1Status)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2693,6 +2510,8 @@ gfxWindowsPlatform::InitializeD2D1()
|
|||||||
Factory::SetDirect3D11Device(mD3D11ContentDevice);
|
Factory::SetDirect3D11Device(mD3D11ContentDevice);
|
||||||
|
|
||||||
d2d1_1.SetSuccessful();
|
d2d1_1.SetSuccessful();
|
||||||
|
|
||||||
|
mD2D1Status = FeatureStatus::Available;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -3051,15 +2870,6 @@ gfxWindowsPlatform::GetD3D11Status() const
|
|||||||
return mD3D11Status;
|
return mD3D11Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
FeatureStatus
|
|
||||||
gfxWindowsPlatform::GetD2DStatus() const
|
|
||||||
{
|
|
||||||
if (GetD3D11Status() != FeatureStatus::Available) {
|
|
||||||
return FeatureStatus::Unavailable;
|
|
||||||
}
|
|
||||||
return mD2DStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
FeatureStatus
|
FeatureStatus
|
||||||
gfxWindowsPlatform::GetD2D1Status() const
|
gfxWindowsPlatform::GetD2D1Status() const
|
||||||
{
|
{
|
||||||
@ -3096,7 +2906,6 @@ gfxWindowsPlatform::GetDeviceInitData(DeviceInitData* aOut)
|
|||||||
aOut->useD3D11ImageBridge() = !!mD3D11ImageBridgeDevice;
|
aOut->useD3D11ImageBridge() = !!mD3D11ImageBridgeDevice;
|
||||||
aOut->d3d11TextureSharingWorks() = mCompositorD3D11TextureSharingWorks;
|
aOut->d3d11TextureSharingWorks() = mCompositorD3D11TextureSharingWorks;
|
||||||
aOut->useD3D11WARP() = mIsWARP;
|
aOut->useD3D11WARP() = mIsWARP;
|
||||||
aOut->useD2D() = (GetD2DStatus() == FeatureStatus::Available);
|
|
||||||
aOut->useD2D1() = (GetD2D1Status() == FeatureStatus::Available);
|
aOut->useD2D1() = (GetD2D1Status() == FeatureStatus::Available);
|
||||||
|
|
||||||
if (mD3D11Device) {
|
if (mD3D11Device) {
|
||||||
|
@ -17,9 +17,7 @@
|
|||||||
#include "gfxFontUtils.h"
|
#include "gfxFontUtils.h"
|
||||||
#include "gfxWindowsSurface.h"
|
#include "gfxWindowsSurface.h"
|
||||||
#include "gfxFont.h"
|
#include "gfxFont.h"
|
||||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
|
||||||
#include "gfxDWriteFonts.h"
|
#include "gfxDWriteFonts.h"
|
||||||
#endif
|
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
#include "gfxTelemetry.h"
|
#include "gfxTelemetry.h"
|
||||||
#include "gfxTypes.h"
|
#include "gfxTypes.h"
|
||||||
@ -33,9 +31,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
||||||
#include <dxgi.h>
|
#include <dxgi.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
// This header is available in the June 2010 SDK and in the Win8 SDK
|
// This header is available in the June 2010 SDK and in the Win8 SDK
|
||||||
#include <d3dcommon.h>
|
#include <d3dcommon.h>
|
||||||
@ -163,10 +159,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void VerifyD2DDevice(bool aAttemptForce);
|
void VerifyD2DDevice(bool aAttemptForce);
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
||||||
HRESULT CreateDevice(RefPtr<IDXGIAdapter1> &adapter1, int featureLevelIndex);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nsresult GetFontList(nsIAtom *aLangGroup,
|
nsresult GetFontList(nsIAtom *aLangGroup,
|
||||||
const nsACString& aGenericFamily,
|
const nsACString& aGenericFamily,
|
||||||
nsTArray<nsString>& aListOfFonts) override;
|
nsTArray<nsString>& aListOfFonts) override;
|
||||||
@ -230,20 +222,16 @@ public:
|
|||||||
|
|
||||||
void SetupClearTypeParams();
|
void SetupClearTypeParams();
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
|
||||||
IDWriteFactory *GetDWriteFactory() { return mDWriteFactory; }
|
IDWriteFactory *GetDWriteFactory() { return mDWriteFactory; }
|
||||||
inline bool DWriteEnabled() { return !!mDWriteFactory; }
|
inline bool DWriteEnabled() { return !!mDWriteFactory; }
|
||||||
inline DWRITE_MEASURING_MODE DWriteMeasuringMode() { return mMeasuringMode; }
|
inline DWRITE_MEASURING_MODE DWriteMeasuringMode() { return mMeasuringMode; }
|
||||||
|
|
||||||
IDWriteRenderingParams *GetRenderingParams(TextRenderingMode aRenderMode)
|
IDWriteRenderingParams *GetRenderingParams(TextRenderingMode aRenderMode)
|
||||||
{ return mRenderingParams[aRenderMode]; }
|
{ return mRenderingParams[aRenderMode]; }
|
||||||
#else
|
|
||||||
inline bool DWriteEnabled() { return false; }
|
|
||||||
#endif
|
|
||||||
void OnDeviceManagerDestroy(mozilla::layers::DeviceManagerD3D9* aDeviceManager);
|
void OnDeviceManagerDestroy(mozilla::layers::DeviceManagerD3D9* aDeviceManager);
|
||||||
mozilla::layers::DeviceManagerD3D9* GetD3D9DeviceManager();
|
mozilla::layers::DeviceManagerD3D9* GetD3D9DeviceManager();
|
||||||
IDirect3DDevice9* GetD3D9Device();
|
IDirect3DDevice9* GetD3D9Device();
|
||||||
ID3D10Device1 *GetD3D10Device() { return mD3D10Device; }
|
|
||||||
ID3D11Device *GetD3D11Device();
|
ID3D11Device *GetD3D11Device();
|
||||||
ID3D11Device *GetD3D11ContentDevice();
|
ID3D11Device *GetD3D11ContentDevice();
|
||||||
ID3D11Device* GetD3D11DeviceForCurrentThread();
|
ID3D11Device* GetD3D11DeviceForCurrentThread();
|
||||||
@ -281,7 +269,6 @@ public:
|
|||||||
// initialization has not been attempted, this returns
|
// initialization has not been attempted, this returns
|
||||||
// FeatureStatus::Unused.
|
// FeatureStatus::Unused.
|
||||||
mozilla::gfx::FeatureStatus GetD3D11Status() const;
|
mozilla::gfx::FeatureStatus GetD3D11Status() const;
|
||||||
mozilla::gfx::FeatureStatus GetD2DStatus() const;
|
|
||||||
mozilla::gfx::FeatureStatus GetD2D1Status() const;
|
mozilla::gfx::FeatureStatus GetD2D1Status() const;
|
||||||
unsigned GetD3D11Version();
|
unsigned GetD3D11Version();
|
||||||
|
|
||||||
@ -319,14 +306,12 @@ private:
|
|||||||
void InitializeDevices();
|
void InitializeDevices();
|
||||||
void InitializeD3D11();
|
void InitializeD3D11();
|
||||||
void InitializeD2D();
|
void InitializeD2D();
|
||||||
void InitializeD2D1();
|
|
||||||
bool InitDWriteSupport();
|
bool InitDWriteSupport();
|
||||||
|
|
||||||
void DisableD2D();
|
void DisableD2D();
|
||||||
|
|
||||||
mozilla::gfx::FeatureStatus CheckAccelerationSupport();
|
mozilla::gfx::FeatureStatus CheckAccelerationSupport();
|
||||||
mozilla::gfx::FeatureStatus CheckD3D11Support(bool* aCanUseHardware);
|
mozilla::gfx::FeatureStatus CheckD3D11Support(bool* aCanUseHardware);
|
||||||
mozilla::gfx::FeatureStatus CheckD2DSupport();
|
|
||||||
mozilla::gfx::FeatureStatus CheckD2D1Support();
|
mozilla::gfx::FeatureStatus CheckD2D1Support();
|
||||||
|
|
||||||
mozilla::gfx::FeatureStatus AttemptD3D11DeviceCreation();
|
mozilla::gfx::FeatureStatus AttemptD3D11DeviceCreation();
|
||||||
@ -352,14 +337,12 @@ private:
|
|||||||
IDXGIAdapter1 *GetDXGIAdapter();
|
IDXGIAdapter1 *GetDXGIAdapter();
|
||||||
bool IsDeviceReset(HRESULT hr, DeviceResetReason* aReason);
|
bool IsDeviceReset(HRESULT hr, DeviceResetReason* aReason);
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
|
||||||
RefPtr<IDWriteFactory> mDWriteFactory;
|
RefPtr<IDWriteFactory> mDWriteFactory;
|
||||||
RefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
|
RefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
|
||||||
DWRITE_MEASURING_MODE mMeasuringMode;
|
DWRITE_MEASURING_MODE mMeasuringMode;
|
||||||
#endif
|
|
||||||
RefPtr<IDXGIAdapter1> mAdapter;
|
RefPtr<IDXGIAdapter1> mAdapter;
|
||||||
RefPtr<mozilla::layers::DeviceManagerD3D9> mDeviceManager;
|
RefPtr<mozilla::layers::DeviceManagerD3D9> mDeviceManager;
|
||||||
RefPtr<ID3D10Device1> mD3D10Device;
|
|
||||||
RefPtr<ID3D11Device> mD3D11Device;
|
RefPtr<ID3D11Device> mD3D11Device;
|
||||||
RefPtr<ID3D11Device> mD3D11ContentDevice;
|
RefPtr<ID3D11Device> mD3D11ContentDevice;
|
||||||
RefPtr<ID3D11Device> mD3D11ImageBridgeDevice;
|
RefPtr<ID3D11Device> mD3D11ImageBridgeDevice;
|
||||||
@ -374,7 +357,6 @@ private:
|
|||||||
// accessors instead.
|
// accessors instead.
|
||||||
mozilla::gfx::FeatureStatus mAcceleration;
|
mozilla::gfx::FeatureStatus mAcceleration;
|
||||||
mozilla::gfx::FeatureStatus mD3D11Status;
|
mozilla::gfx::FeatureStatus mD3D11Status;
|
||||||
mozilla::gfx::FeatureStatus mD2DStatus;
|
|
||||||
mozilla::gfx::FeatureStatus mD2D1Status;
|
mozilla::gfx::FeatureStatus mD2D1Status;
|
||||||
|
|
||||||
nsTArray<D3D_FEATURE_LEVEL> mFeatureLevels;
|
nsTArray<D3D_FEATURE_LEVEL> mFeatureLevels;
|
||||||
|
@ -713,8 +713,8 @@ pref("gfx.font_rendering.opentype_svg.enabled", true);
|
|||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
// comma separated list of backends to use in order of preference
|
// comma separated list of backends to use in order of preference
|
||||||
// e.g., pref("gfx.canvas.azure.backends", "direct2d,skia,cairo");
|
// e.g., pref("gfx.canvas.azure.backends", "direct2d,skia,cairo");
|
||||||
pref("gfx.canvas.azure.backends", "direct2d1.1,direct2d,skia,cairo");
|
pref("gfx.canvas.azure.backends", "direct2d1.1,skia,cairo");
|
||||||
pref("gfx.content.azure.backends", "direct2d1.1,direct2d,cairo");
|
pref("gfx.content.azure.backends", "direct2d1.1,cairo");
|
||||||
#else
|
#else
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
pref("gfx.content.azure.backends", "cg");
|
pref("gfx.content.azure.backends", "cg");
|
||||||
@ -4447,7 +4447,6 @@ pref("gfx.content.use-native-pushlayer", true);
|
|||||||
|
|
||||||
// Whether to disable the automatic detection and use of direct2d.
|
// Whether to disable the automatic detection and use of direct2d.
|
||||||
pref("gfx.direct2d.disabled", false);
|
pref("gfx.direct2d.disabled", false);
|
||||||
pref("gfx.direct2d.use1_1", true);
|
|
||||||
|
|
||||||
// Whether to attempt to enable Direct2D regardless of automatic detection or
|
// Whether to attempt to enable Direct2D regardless of automatic detection or
|
||||||
// blacklisting
|
// blacklisting
|
||||||
|
@ -1272,14 +1272,12 @@ GfxInfo::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
|
|||||||
JS_SetProperty(aCx, obj, "blacklisted", val);
|
JS_SetProperty(aCx, obj, "blacklisted", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::FeatureStatus d2d = platform->GetD2DStatus();
|
gfx::FeatureStatus d2d = platform->GetD2D1Status();
|
||||||
if (!InitFeatureObject(aCx, aObj, "d2d", d2d, &obj)) {
|
if (!InitFeatureObject(aCx, aObj, "d2d", d2d, &obj)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const char* version = "1.0";
|
const char* version = "1.1";
|
||||||
if (platform->GetD2D1Status() == gfx::FeatureStatus::Available)
|
|
||||||
version = "1.1";
|
|
||||||
JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, version));
|
JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, version));
|
||||||
JS::Rooted<JS::Value> val(aCx, JS::StringValue(str));
|
JS::Rooted<JS::Value> val(aCx, JS::StringValue(str));
|
||||||
JS_SetProperty(aCx, obj, "version", val);
|
JS_SetProperty(aCx, obj, "version", val);
|
||||||
|
Loading…
Reference in New Issue
Block a user