mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Move DeviceInitData from gfxWindowsPlatform to gfxPlatforn. (bug 1254899 part 5, r=milan)
This commit is contained in:
parent
47e60f5ed3
commit
f894adf887
@ -12,7 +12,7 @@ namespace gfx {
|
||||
|
||||
struct DeviceInitData
|
||||
{
|
||||
bool useAcceleration;
|
||||
bool useHwCompositing;
|
||||
|
||||
// Windows only.
|
||||
bool useD3D11;
|
||||
|
@ -170,6 +170,10 @@ static qcms_transform *gCMSRGBATransform = nullptr;
|
||||
static bool gCMSInitialized = false;
|
||||
static eCMSMode gCMSMode = eCMSMode_Off;
|
||||
|
||||
// Device init data should only be used on child processes, so we protect it
|
||||
// behind a getter here.
|
||||
static DeviceInitData sDeviceInitDataDoNotUseDirectly;
|
||||
|
||||
static void ShutdownCMS();
|
||||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
@ -2236,6 +2240,13 @@ gfxPlatform::GetScaledFontForFontWithCairoSkia(DrawTarget* aTarget, gfxFont* aFo
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* static */ DeviceInitData&
|
||||
gfxPlatform::GetParentDevicePrefs()
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
return sDeviceInitDataDoNotUseDirectly;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
gfxPlatform::UsesOffMainThreadCompositing()
|
||||
{
|
||||
@ -2442,7 +2453,7 @@ void
|
||||
gfxPlatform::GetDeviceInitData(mozilla::gfx::DeviceInitData* aOut)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
aOut->useAcceleration() = gfxConfig::IsEnabled(Feature::HW_COMPOSITING);
|
||||
aOut->useHwCompositing() = gfxConfig::IsEnabled(Feature::HW_COMPOSITING);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2456,7 +2467,7 @@ gfxPlatform::UpdateDeviceInitData()
|
||||
mozilla::gfx::DeviceInitData data;
|
||||
mozilla::dom::ContentChild::GetSingleton()->SendGetGraphicsDeviceInitData(&data);
|
||||
|
||||
SetDeviceInitData(data);
|
||||
sDeviceInitDataDoNotUseDirectly = data;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -693,12 +693,6 @@ protected:
|
||||
*/
|
||||
void BumpDeviceCounter();
|
||||
|
||||
/**
|
||||
* Called when new device preferences are available.
|
||||
*/
|
||||
virtual void SetDeviceInitData(mozilla::gfx::DeviceInitData& aData)
|
||||
{}
|
||||
|
||||
/**
|
||||
* returns the first backend named in the pref gfx.canvas.azure.backends
|
||||
* which is a component of aBackendBitmask, a bitmask of backend types
|
||||
@ -727,6 +721,8 @@ protected:
|
||||
static already_AddRefed<mozilla::gfx::ScaledFont>
|
||||
GetScaledFontForFontWithCairoSkia(mozilla::gfx::DrawTarget* aTarget, gfxFont* aFont);
|
||||
|
||||
static mozilla::gfx::DeviceInitData& GetParentDevicePrefs();
|
||||
|
||||
int8_t mAllowDownloadableFonts;
|
||||
int8_t mGraphiteShapingEnabled;
|
||||
int8_t mOpenTypeSVGEnabled;
|
||||
|
@ -358,16 +358,6 @@ public:
|
||||
|
||||
NS_IMPL_ISUPPORTS(D3D9SharedTextureReporter, nsIMemoryReporter)
|
||||
|
||||
// Device init data should only be used on child processes, so we protect it
|
||||
// behind a getter here.
|
||||
static DeviceInitData sDeviceInitDataDoNotUseDirectly;
|
||||
static inline DeviceInitData&
|
||||
GetParentDevicePrefs()
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
return sDeviceInitDataDoNotUseDirectly;
|
||||
}
|
||||
|
||||
gfxWindowsPlatform::gfxWindowsPlatform()
|
||||
: mRenderMode(RENDER_GDI)
|
||||
, mDeviceLock("gfxWindowsPlatform.mDeviceLock")
|
||||
@ -1927,8 +1917,8 @@ bool DoesD3D11AlphaTextureSharingWork(ID3D11Device *device)
|
||||
return DoesD3D11TextureSharingWorkInternal(device, DXGI_FORMAT_R8_UNORM, D3D11_BIND_SHADER_RESOURCE);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
CanUseWARP()
|
||||
bool
|
||||
gfxWindowsPlatform::CanUseWARP()
|
||||
{
|
||||
if (gfxPrefs::LayersD3D11ForceWARP()) {
|
||||
return true;
|
||||
@ -2265,13 +2255,6 @@ gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation()
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::SetDeviceInitData(mozilla::gfx::DeviceInitData& aData)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
sDeviceInitDataDoNotUseDirectly = aData;
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::InitializeDevices()
|
||||
{
|
||||
@ -2325,7 +2308,7 @@ gfxWindowsPlatform::CheckAccelerationSupport()
|
||||
return mAcceleration;
|
||||
}
|
||||
if (XRE_IsContentProcess()) {
|
||||
return GetParentDevicePrefs().useAcceleration()
|
||||
return GetParentDevicePrefs().useHwCompositing()
|
||||
? FeatureStatus::Available
|
||||
: FeatureStatus::Blocked;
|
||||
}
|
||||
|
@ -270,7 +270,6 @@ protected:
|
||||
}
|
||||
void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends) override;
|
||||
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override;
|
||||
void SetDeviceInitData(mozilla::gfx::DeviceInitData& aData) override;
|
||||
|
||||
protected:
|
||||
RenderMode mRenderMode;
|
||||
@ -313,6 +312,7 @@ private:
|
||||
bool AttemptD3D11ContentDeviceCreationHelper(
|
||||
IDXGIAdapter1* aAdapter, HRESULT& aResOut);
|
||||
|
||||
bool CanUseWARP();
|
||||
bool CanUseD3D11ImageBridge();
|
||||
bool ContentAdapterIsParentAdapter(ID3D11Device* device);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user