From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- gfx/thebes/DeviceManagerDx.cpp | 70 ++---------------------------------------- 1 file changed, 2 insertions(+), 68 deletions(-) (limited to 'gfx/thebes/DeviceManagerDx.cpp') diff --git a/gfx/thebes/DeviceManagerDx.cpp b/gfx/thebes/DeviceManagerDx.cpp index 3a531e92ae..cfd1169e95 100644 --- a/gfx/thebes/DeviceManagerDx.cpp +++ b/gfx/thebes/DeviceManagerDx.cpp @@ -264,7 +264,7 @@ void DeviceManagerDx::UpdateMonitorInfo() { bool systemHdrEnabled = false; std::set hdrMonitors; - for (const auto& desc : GetOutputDescs()) { + for (const auto desc : EnumerateOutputs()) { if (ColorSpaceIsHDR(desc)) { systemHdrEnabled = true; hdrMonitors.emplace(desc.Monitor); @@ -279,72 +279,6 @@ void DeviceManagerDx::UpdateMonitorInfo() { } } -std::vector DeviceManagerDx::GetOutputDescs() { - std::vector outputDescs; - - nsModuleHandle dxgiModule(LoadLibrarySystem32(L"dxgi.dll")); - decltype(CreateDXGIFactory1)* createDXGIFactory1 = - (decltype(CreateDXGIFactory1)*)GetProcAddress(dxgiModule, - "CreateDXGIFactory1"); - if (!createDXGIFactory1) { - return outputDescs; - } - - RefPtr dxgiFactory; - HRESULT hr = - createDXGIFactory1(__uuidof(IDXGIFactory1), getter_AddRefs(dxgiFactory)); - if (FAILED(hr)) { - gfxCriticalNoteOnce << "Failed to create DXGI factory: " << gfx::hexa(hr); - return outputDescs; - } - - for (UINT adapterIndex = 0;; adapterIndex++) { - RefPtr adapter; - hr = dxgiFactory->EnumAdapters(adapterIndex, getter_AddRefs(adapter)); - if (hr == DXGI_ERROR_NOT_FOUND) { - break; - } - if (FAILED(hr)) { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - gfxCriticalNoteOnce << "Failed to enumerate DXGI adapter: " - << gfx::hexa(hr); - break; - } - - for (UINT outputIndex = 0;; ++outputIndex) { - RefPtr output; - hr = adapter->EnumOutputs(outputIndex, getter_AddRefs(output)); - if (hr == DXGI_ERROR_NOT_FOUND) { - break; - } - if (FAILED(hr)) { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - gfxCriticalNoteOnce << "Failed to enumulate DXGI output: " - << gfx::hexa(hr); - break; - } - - RefPtr output6; - hr = output->QueryInterface(__uuidof(IDXGIOutput6), - getter_AddRefs(output6)); - if (FAILED(hr)) { - continue; - } - - DXGI_OUTPUT_DESC1 desc; - if (FAILED(output6->GetDesc1(&desc))) { - MOZ_ASSERT_UNREACHABLE("unexpected to be called"); - gfxCriticalNoteOnce << "Failed to get DXGI output descriptor"; - continue; - } - - outputDescs.push_back(std::move(desc)); - } - } - - return outputDescs; -} - bool DeviceManagerDx::SystemHDREnabled() { { MutexAutoLock lock(mDeviceLock); @@ -704,7 +638,7 @@ void DeviceManagerDx::CreateContentDevicesLocked() { // We should have been assigned a DeviceStatus from the parent process, // GPU process, or the same process if using in-process compositing. - MOZ_ASSERT(mDeviceStatus); + MOZ_RELEASE_ASSERT(mDeviceStatus); if (CreateContentDevice() == FeatureStatus::CrashedInHandler) { DisableD3D11AfterCrash(); -- cgit v1.2.3