• Christopher Cameron's avatar
    Add support for HDR displays on macOS 10.15 · 111548d2
    Christopher Cameron authored
    Detect HDR support using the -[NSScreen
    maximumPotentialExtendedDynamicRangeColorComponentValue] API introduced
    in 10.15. Use the hard-coded kDefaultBitsPerPixel/Component constants
    instead of reading from the NSScreen. Move the constants to a common
    location.
    
    We can only promote an IOSurface to an overlay if we can set the
    color space on the IOSurface in a way that will make CoreAnimation
    draw it the same way that GLRenderer would.
    
    Merge the various checks for color space compatibility into an
    IOSurfaceCanSetColorSpace function, and call this from the SDR
    and HDR paths.
    
    Update IOSurfaceSetColorSpace to use the new constants
    kCGColorSpaceITUR_2020_PQ_EOTF and kCGColorSpaceITUR_2020_HLG
    introduced in 10.15.
    
    Note that this will not trigger HDR mode. Doing so requires making
    visible a CAMetalLayer with wantsExtendedDynamicRangeContent set.
    The next patch in this sequence will do that.
    
    Bug: 976426
    Change-Id: Ic93302aa895f182713658f1eaea89c0e91953857
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863449
    Commit-Queue: ccameron <ccameron@chromium.org>
    Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
    Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#707125}
    111548d2
screen_mac.mm 14.2 KB