зеркало из https://github.com/mozilla/gecko-dev.git
Factor out D2D initialization checks. (bug 1183910 part 4, r=mattwoodrow)
This commit is contained in:
Родитель
1155aac2de
Коммит
9d8c16c3d7
|
@ -2180,29 +2180,38 @@ IsD2DBlacklisted()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
// Check whether we can support Direct2D. Although some of these checks will
|
||||||
gfxWindowsPlatform::InitializeD2D()
|
// not change after a TDR (like the OS version), we could find a driver change
|
||||||
|
// that runs us into the blacklist.
|
||||||
|
FeatureStatus
|
||||||
|
gfxWindowsPlatform::CheckD2DSupport()
|
||||||
{
|
{
|
||||||
if (!gfxPrefs::Direct2DForceEnabled()) {
|
if (!gfxPrefs::Direct2DForceEnabled() && IsD2DBlacklisted()) {
|
||||||
if (IsD2DBlacklisted()) {
|
return FeatureStatus::Blacklisted;
|
||||||
mD2DStatus = FeatureStatus::Blacklisted;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not ever try to use D2D if it's explicitly disabled.
|
// Do not ever try to use D2D if it's explicitly disabled.
|
||||||
if (gfxPrefs::Direct2DDisabled()) {
|
if (gfxPrefs::Direct2DDisabled()) {
|
||||||
mD2DStatus = FeatureStatus::Disabled;
|
return FeatureStatus::Disabled;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Direct2D is only Vista or higher, but we require a D3D11 compositor to
|
// Direct2D is only Vista or higher, but we require a D3D11 compositor to
|
||||||
// use it. (This check may be implied by the fact that we do not get here
|
// use it. (This check may be implied by the fact that we do not get here
|
||||||
// without a D3D11 compositor device.)
|
// without a D3D11 compositor device.)
|
||||||
if (!IsVistaOrLater()) {
|
if (!IsVistaOrLater()) {
|
||||||
mD2DStatus = FeatureStatus::Unavailable;
|
return FeatureStatus::Unavailable;
|
||||||
|
}
|
||||||
|
return FeatureStatus::Available;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gfxWindowsPlatform::InitializeD2D()
|
||||||
|
{
|
||||||
|
mD2DStatus = CheckD2DSupport();
|
||||||
|
if (IsFeatureStatusFailure(mD2DStatus)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mDoesD3D11TextureSharingWork) {
|
if (!mDoesD3D11TextureSharingWork) {
|
||||||
mD2DStatus = FeatureStatus::Failed;
|
mD2DStatus = FeatureStatus::Failed;
|
||||||
return;
|
return;
|
||||||
|
@ -2227,35 +2236,40 @@ gfxWindowsPlatform::InitializeD2D()
|
||||||
mD2DStatus = FeatureStatus::Available;
|
mD2DStatus = FeatureStatus::Available;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
FeatureStatus
|
||||||
|
gfxWindowsPlatform::CheckD2D1Support()
|
||||||
|
{
|
||||||
|
if (!Factory::SupportsD2D1()) {
|
||||||
|
return FeatureStatus::Unavailable;
|
||||||
|
}
|
||||||
|
if (!gfxPrefs::Direct2DUse1_1()) {
|
||||||
|
return FeatureStatus::Disabled;
|
||||||
|
}
|
||||||
|
// Normally we don't use D2D content drawing when using WARP. However if
|
||||||
|
// WARP is force-enabled, we will let Direct2D use WARP as well.
|
||||||
|
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
|
||||||
|
return FeatureStatus::Blocked;
|
||||||
|
}
|
||||||
|
return FeatureStatus::Available;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
gfxWindowsPlatform::InitializeD2D1()
|
gfxWindowsPlatform::InitializeD2D1()
|
||||||
{
|
{
|
||||||
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
|
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
|
||||||
|
|
||||||
if (!Factory::SupportsD2D1()) {
|
mD2D1Status = CheckD2D1Support();
|
||||||
mD2D1Status = FeatureStatus::Unavailable;
|
if (IsFeatureStatusFailure(mD2D1Status)) {
|
||||||
return false;
|
return;
|
||||||
}
|
|
||||||
if (!gfxPrefs::Direct2DUse1_1()) {
|
|
||||||
mD2D1Status = FeatureStatus::Disabled;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normally we don't use D2D content drawing when using WARP. However if
|
|
||||||
// WARP is force-enabled, we wlil let Direct2D use WARP as well.
|
|
||||||
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
|
|
||||||
mD2D1Status = FeatureStatus::Blocked;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AttemptD3D11ContentDeviceCreation()) {
|
if (!AttemptD3D11ContentDeviceCreation()) {
|
||||||
mD2D1Status = FeatureStatus::Failed;
|
mD2D1Status = FeatureStatus::Failed;
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mD2D1Status = FeatureStatus::Available;
|
mD2D1Status = FeatureStatus::Available;
|
||||||
d2d1_1.SetSuccessful();
|
d2d1_1.SetSuccessful();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<ID3D11Device>
|
already_AddRefed<ID3D11Device>
|
||||||
|
|
|
@ -302,12 +302,14 @@ private:
|
||||||
void InitializeDevices();
|
void InitializeDevices();
|
||||||
void InitializeD3D11();
|
void InitializeD3D11();
|
||||||
void InitializeD2D();
|
void InitializeD2D();
|
||||||
bool InitializeD2D1();
|
void InitializeD2D1();
|
||||||
bool InitDWriteSupport();
|
bool InitDWriteSupport();
|
||||||
|
|
||||||
void DisableD2D();
|
void DisableD2D();
|
||||||
|
|
||||||
mozilla::gfx::FeatureStatus CheckD3D11Support(bool* aCanUseHardware);
|
mozilla::gfx::FeatureStatus CheckD3D11Support(bool* aCanUseHardware);
|
||||||
|
mozilla::gfx::FeatureStatus CheckD2DSupport();
|
||||||
|
mozilla::gfx::FeatureStatus CheckD2D1Support();
|
||||||
void AttemptD3D11DeviceCreation();
|
void AttemptD3D11DeviceCreation();
|
||||||
void AttemptWARPDeviceCreation();
|
void AttemptWARPDeviceCreation();
|
||||||
void AttemptD3D11ImageBridgeDeviceCreation();
|
void AttemptD3D11ImageBridgeDeviceCreation();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче