Bug 1097321 - Add layers.amd-switchable-gfx.enabled pref. r=jrmuizel

This commit is contained in:
Benoit Girard 2015-10-20 12:58:11 -07:00
parent 386c2aaff6
commit b55677f2a1
3 changed files with 11 additions and 4 deletions

View File

@ -294,6 +294,7 @@ private:
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false);
DECL_GFX_PREF(Live, "layers.bench.enabled", LayersBenchEnabled, bool, false);

View File

@ -1858,6 +1858,9 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma
gfxInfo->GetAdapterVendorID(vendorID);
gfxInfo->GetAdapterVendorID2(vendorID2);
if (vendorID.EqualsLiteral("0x8086") && vendorID2.IsEmpty()) {
if (!gfxPrefs::LayersAMDSwitchableGfxEnabled()) {
return false;
}
gfxCriticalError(CriticalLog::DefaultOptions(false)) << "PossiblyBrokenSurfaceSharing_UnexpectedAMDGPU";
}
}
@ -1887,7 +1890,7 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma
data.pSysMem = color;
data.SysMemPitch = texture_size * 4;
data.SysMemSlicePitch = 0;
if (FAILED(device->CreateTexture2D(&desc, &data, byRef(texture)))) {
if (FAILED(device->CreateTexture2D(&desc, &data, getter_AddRefs(texture)))) {
return false;
}
@ -1924,12 +1927,12 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
desc.MiscFlags = 0;
desc.BindFlags = 0;
if (FAILED(device->CreateTexture2D(&desc, nullptr, byRef(cpuTexture)))) {
if (FAILED(device->CreateTexture2D(&desc, nullptr, getter_AddRefs(cpuTexture)))) {
return false;
}
nsRefPtr<IDXGIKeyedMutex> sharedMutex;
nsRefPtr<ID3D11DeviceContext> deviceContext;
RefPtr<IDXGIKeyedMutex> sharedMutex;
RefPtr<ID3D11DeviceContext> deviceContext;
sharedResource->QueryInterface(__uuidof(IDXGIKeyedMutex), (void**)getter_AddRefs(sharedMutex));
device->GetImmediateContext(getter_AddRefs(deviceContext));
if (FAILED(sharedMutex->AcquireSync(0, 30*1000))) {

View File

@ -524,6 +524,9 @@ pref("media.video-queue.send-to-compositor-size", 9999);
// Whether to disable the video stats to prevent fingerprinting
pref("media.video_stats.enabled", true);
// Weather we allow AMD switchable graphics
pref("layers.amd-switchable-gfx.enabled", true);
// Whether to use async panning and zooming
pref("layers.async-pan-zoom.enabled", false);