Bug 1799258 - Do color-management on Windows+DComp via IDCompositionFilterEffects...
commit2a633b25029a8ff9a965db00fa27d3ec6f5a1526
authorKelsey Gilbert <kelsey.gilbert@mozilla.com>
Mon, 13 Mar 2023 21:04:10 +0000 (13 21:04 +0000)
committerKelsey Gilbert <kelsey.gilbert@mozilla.com>
Mon, 13 Mar 2023 21:04:10 +0000 (13 21:04 +0000)
tree0f8eaa776063442d27bd2e7046ea4c9f242d0d3c
parent000ff9b4e52ed9b49b1ab30d588e84fbbb682cab
Bug 1799258 - Do color-management on Windows+DComp via IDCompositionFilterEffects. r=sotaro

+ Add gfx.color_management.rec709_gamma_as_srgb:true. :'(

In particular, rec709(16/255) -> srgb(31/255). Even though it's
technically correct, it's practically-speaking incorrect, since that's
not what Chrome does, nor what the web expected for years and years.

In practice, basically everyone expects gamma to just be completely
ignored.

What people expect:
* Pretend gamut is srgb(==rec709), but stretch this naively for the
  display. If you have a display-p3-gamut display, srgb:0.5 expects to
  be displayed as display:0.5, which will be display-p3:0.5 to the eyes.
* Pretend all content gammas (TFs) are srgb(!=rec790), and then bitcast this
  naively for the display. E.g. rec709(16/255) should
  display the same as srgb(16/255), not srgb(31/255). (Note: display-p3
  uses srgb gamma) But if your display has e.g. gamma=3.0, don't
  convert or compensate.

This is a formalization of what you get when you spend decades ignoring
color management, and people build things based on behavior-in-practice,
not behavior-in-theory.

Also:
+ gfx.color_management.native_srgb:true for Windows, so we don't use the
  display color profile, which no one else does.
+ Add rec2020_gamma_as_rec709, so we have a path towards maybe having
  rec2020 use its correct transfer function, rather than srgb (like
  rec709).

Differential Revision: https://phabricator.services.mozilla.com/D161857
dom/media/test/reftest/color_quads/reftest.list
gfx/thebes/DeviceManagerDx.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxWindowsPlatform.cpp
gfx/thebes/gfxWindowsPlatform.h
gfx/webrender_bindings/DCLayerTree.cpp
gfx/webrender_bindings/DCLayerTree.h
modules/libpref/init/StaticPrefList.yaml
modules/libpref/init/all.js