0

Agtm: Add PNG and canvas metadata plumbing, add feature flag

Add plumbing for Agtm HDR metadata for PNG images using the private (not
standardized) chunk agTm to store the metadata.

Add plumbing for Agtm HDR metadata for canvas by adding it as a
parameter to CanvasHighDynamicRangeOptions. Note that that structure is
entirely behind the CanvasHDR runtime feature (which is experimental).

In order to ensure that Agtm videos, canvases, and image bitmaps don't
get promoted to overlays on any platform (regardless of the platform's
overlay processor), veto in DisplayResourceProvider::IsOverlayCandidate
any resources that have Agtm metadata. Hopefully the overlay processors
will come to share more code in the future.

Add a feature flag controlling whether Agtm metadata is ignored or not.

Bug: 395659818
Change-Id: Ibe08244ffadefcd02102da2705ad5cef3b8281c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6508789
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1455052}
This commit is contained in:
Christopher Cameron
2025-05-02 10:13:24 -07:00
committed by Chromium LUCI CQ
parent d8ae970e52
commit bfc79fcc8f
7 changed files with 49 additions and 3 deletions
cc/paint
components/viz/service/display
third_party/blink/renderer
ui/gfx

@ -7,12 +7,21 @@
#include <iomanip>
#include <sstream>
#include "base/feature_list.h"
#include "skia/ext/skcolorspace_primaries.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkData.h"
namespace gfx {
namespace {
BASE_FEATURE(kAgtmToneMapping,
"AgtmToneMapping",
base::FEATURE_DISABLED_BY_DEFAULT);
}
std::string HdrMetadataCta861_3::ToString() const {
std::stringstream ss;
ss << std::fixed << std::setprecision(4)
@ -65,6 +74,12 @@ HdrMetadataAgtm& HdrMetadataAgtm::operator=(const HdrMetadataAgtm& other) =
HdrMetadataAgtm::~HdrMetadataAgtm() = default;
// static
bool HdrMetadataAgtm::IsEnabled() {
static bool result = base::FeatureList::IsEnabled(kAgtmToneMapping);
return result;
}
std::string HdrMetadataAgtm::ToString() const {
return "agtm placeholder";
}

@ -136,6 +136,8 @@ struct COLOR_SPACE_EXPORT HdrMetadataAgtm {
HdrMetadataAgtm& operator=(const HdrMetadataAgtm& other);
~HdrMetadataAgtm();
// Return whether or not use of AGTM metadata is enabled by default or not.
static bool IsEnabled();
std::string ToString() const;
bool operator==(const HdrMetadataAgtm& rhs) const;