summaryrefslogtreecommitdiffstats
path: root/gfx/thebes/gfxWindowsPlatform.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /gfx/thebes/gfxWindowsPlatform.cpp
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/thebes/gfxWindowsPlatform.cpp')
-rw-r--r--gfx/thebes/gfxWindowsPlatform.cpp57
1 files changed, 7 insertions, 50 deletions
diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp
index 93de20f445..4554d487f4 100644
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -82,6 +82,7 @@
#include "mozilla/layers/DeviceAttachmentsD3D11.h"
#include "mozilla/WindowsProcessMitigations.h"
#include "D3D11Checks.h"
+#include "mozilla/ScreenHelperWin.h"
using namespace mozilla;
using namespace mozilla::gfx;
@@ -258,8 +259,7 @@ class D3DSharedTexturesReporter final : public nsIMemoryReporter {
NS_IMPL_ISUPPORTS(D3DSharedTexturesReporter, nsIMemoryReporter)
-gfxWindowsPlatform::gfxWindowsPlatform()
- : mRenderMode(RENDER_GDI), mSupportsHDR(false) {
+gfxWindowsPlatform::gfxWindowsPlatform() : mRenderMode(RENDER_GDI) {
// If win32k is locked down then we can't use COM STA and shouldn't need it.
// Also, we won't be using any GPU memory in this process.
if (!IsWin32kLockedDown()) {
@@ -400,7 +400,11 @@ void gfxWindowsPlatform::InitAcceleration() {
// CanUseHardwareVideoDecoding depends on DeviceManagerDx state,
// so update the cached value now.
UpdateCanUseHardwareVideoDecoding();
- UpdateSupportsHDR();
+
+ // Our ScreenHelperWin also depends on DeviceManagerDx state.
+ if (XRE_IsParentProcess() && !gfxPlatform::IsHeadless()) {
+ ScreenHelperWin::RefreshScreens();
+ }
RecordStartupTelemetry();
}
@@ -531,53 +535,6 @@ void gfxWindowsPlatform::UpdateRenderMode() {
}
}
-void gfxWindowsPlatform::UpdateSupportsHDR() {
- // TODO: This function crashes content processes, for reasons that are not
- // obvious from the crash reports. For now, this function can only be executed
- // by the parent process. Therefore SupportsHDR() will always return false for
- // content processes, as noted in the header.
- if (!XRE_IsParentProcess()) {
- return;
- }
-
- // Set mSupportsHDR to true if any of the DeviceManager outputs have a BT2020
- // colorspace with EOTF2084 gamma curve, this indicates the system is sending
- // an HDR format to at least one monitor. The colorspace returned by DXGI is
- // very vague - we only see DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 for HDR
- // and DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 for SDR modes, even if the
- // monitor is using something like YCbCr444 according to Settings
- // (System -> Display Settings -> Advanced Display). To get more specific
- // info we would need to query the DISPLAYCONFIG values in WinGDI.
- //
- // Note that the bit depth used to be checked here, but as of Windows 11 22H2,
- // HDR is supported with 8bpc for lower bandwidth, where DWM converts to
- // dithered RGB8 rather than RGB10, which doesn't really matter here.
- //
- // This only returns true if there is an HDR display connected at app start,
- // if the user switches to HDR to watch a video, we won't know that here, and
- // if no displays are connected we return false (e.g. if Windows Update
- // restarted a laptop with its lid closed and no external displays, we will
- // see zero outputs here when the app is restarted automatically).
- //
- // It would be better to track if HDR is ever used and report that telemetry
- // so we know if HDR matters, not just when it is detected at app start.
- //
- // Further reading:
- // https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range
- // https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-displayconfig_sdr_white_level
- DeviceManagerDx* dx = DeviceManagerDx::Get();
- nsTArray<DXGI_OUTPUT_DESC1> outputs = dx->EnumerateOutputs();
-
- for (auto& output : outputs) {
- if (output.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) {
- mSupportsHDR = true;
- return;
- }
- }
-
- mSupportsHDR = false;
-}
-
mozilla::gfx::BackendType gfxWindowsPlatform::GetContentBackendFor(
mozilla::layers::LayersBackend aLayers) {
mozilla::gfx::BackendType defaultBackend =