зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1771374 - Disable color management based on pref in DCLayerTree. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D150276
This commit is contained in:
Родитель
c4f86e2e33
Коммит
24fcc06910
|
@ -23,6 +23,7 @@
|
|||
#include "mozilla/gfx/CanvasManagerChild.h"
|
||||
#include "mozilla/gfx/CanvasManagerParent.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/EnumTypeTraits.h"
|
||||
#include "mozilla/StaticPrefs_accessibility.h"
|
||||
#include "mozilla/StaticPrefs_apz.h"
|
||||
#include "mozilla/StaticPrefs_bidi.h"
|
||||
|
@ -2014,6 +2015,14 @@ const mozilla::gfx::ContentDeviceData* gfxPlatform::GetInitContentDeviceData() {
|
|||
return gContentDeviceInitData;
|
||||
}
|
||||
|
||||
CMSMode GfxColorManagementMode() {
|
||||
const auto mode = StaticPrefs::gfx_color_management_mode();
|
||||
if (mode >= 0 && mode < UnderlyingValue(CMSMode::AllCount)) {
|
||||
return CMSMode(mode);
|
||||
}
|
||||
return CMSMode::Off;
|
||||
}
|
||||
|
||||
void gfxPlatform::InitializeCMS() {
|
||||
if (gCMSInitialized) {
|
||||
return;
|
||||
|
@ -2032,12 +2041,7 @@ void gfxPlatform::InitializeCMS() {
|
|||
return;
|
||||
}
|
||||
|
||||
{
|
||||
int32_t mode = StaticPrefs::gfx_color_management_mode();
|
||||
if (mode >= 0 && mode < int32_t(CMSMode::AllCount)) {
|
||||
gCMSMode = CMSMode(mode);
|
||||
}
|
||||
}
|
||||
gCMSMode = GfxColorManagementMode();
|
||||
|
||||
gCMSsRGBProfile = qcms_profile_sRGB();
|
||||
|
||||
|
|
|
@ -1027,4 +1027,6 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
|
|||
const gfxSkipChars kEmptySkipChars;
|
||||
};
|
||||
|
||||
CMSMode GfxColorManagementMode();
|
||||
|
||||
#endif /* GFX_PLATFORM_H */
|
||||
|
|
|
@ -1043,7 +1043,9 @@ static CspaceTransformPlan ChooseCspaceTransformPlan(
|
|||
// transform mis-translates colors if you ask VideoProcessor to resize.
|
||||
// (jgilbert's RTX 3070 machine "osiris")
|
||||
// Absent more investigation, let's avoid VP with non-YUV sources for now.
|
||||
if (srcSpace.yuvRange) {
|
||||
const auto cmsMode = GfxColorManagementMode();
|
||||
const bool doColorManagement = cmsMode != CMSMode::Off;
|
||||
if (srcSpace.yuvRange && doColorManagement) {
|
||||
const auto exactDxgiSpace = ExactDXGIColorSpace(srcSpace);
|
||||
if (exactDxgiSpace) {
|
||||
auto plan = CspaceTransformPlan::WithVideoProcessor{};
|
||||
|
@ -1098,6 +1100,10 @@ static CspaceTransformPlan ChooseCspaceTransformPlan(
|
|||
};
|
||||
break;
|
||||
}
|
||||
if (!doColorManagement) {
|
||||
plan.dstSpace = plan.srcSpace;
|
||||
plan.dstSpace.yuv = {};
|
||||
}
|
||||
|
||||
return {{}, Some(plan)};
|
||||
}
|
||||
|
@ -1329,10 +1335,14 @@ static Maybe<DCSurfaceSwapChain::Dest> CreateSwapChain(
|
|||
return {};
|
||||
}
|
||||
|
||||
hr = swapChain.swapChain->SetColorSpace1(aColorSpace);
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalNote << "SetColorSpace1 failed: " << gfx::hexa(hr);
|
||||
return {};
|
||||
const auto cmsMode = GfxColorManagementMode();
|
||||
const bool doColorManagement = cmsMode != CMSMode::Off;
|
||||
if (doColorManagement) {
|
||||
hr = swapChain.swapChain->SetColorSpace1(aColorSpace);
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalNote << "SetColorSpace1 failed: " << gfx::hexa(hr);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче