Bug 1799258 - Do color-management on Windows+DComp via IDCompositionFilterEffects...
commit9e2d016bd4cf543f5473df8d3e5ca9aa4538e631
authorKelsey Gilbert <kelsey.gilbert@mozilla.com>
Mon, 23 Jan 2023 22:13:17 +0000 (23 22:13 +0000)
committerKelsey Gilbert <kelsey.gilbert@mozilla.com>
Mon, 23 Jan 2023 22:13:17 +0000 (23 22:13 +0000)
treecd84524d86c37c349cc915f66c9f4cc55295b5b9
parent70f8fd53cce1964061b85c637eafe1fee7eb8da0
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