Offload single-plane OETF to the CRTC post-blend gamma LUT
Summary
When a single fullscreen layer is directly scanned out, its color pipeline often ends with an inverse transfer function (OETF encoding). On many platforms, the plane gamma LUT does not provide sufficient precision to accurately represent this stage, causing the plane color pipeline to be rejected and forcing a fallback to shader composition.
This MR offloads the trailing inverse transfer function to the CRTC post-blend gamma LUT whenever it is safe to do so. Since the CRTC gamma stage is applied after blending, this optimization is only used for direct scanout with a single enabled fullscreen layer.
To preserve precision, the input normalization is moved to the plane CTM, allowing the CRTC gamma LUT to perform only the non-linear encoding. The CRTC CTM remains bypassed, avoiding the precision loss that would result from scaling in its fixed-point domain.
The direct scanout eligibility checks (earlyScanoutChecks) are updated accordingly via DrmPipeline::canRepresentColorPipeline(), ensuring scanout is permitted only when this offload can be represented by the hardware color pipeline.
Benefits
- Enables direct scanout in scenarios that would otherwise fall back to shader composition.
- Reduces color banding by avoiding OETF encoding in low-precision plane gamma LUTs.
- Improves utilization of the DRM/KMS hardware color pipeline.
Validation
The implementation has been validated with the following configurations:
- BT.709 → BT.709 with HDR disabled
- sRGB/BT.709 → BT.2020 with HDR enabled
- BT.2020 → BT.2020 with HDR enabled
All tested scenarios produce the expected results.
Notes
This is a draft MR intended to discuss the overall approach. The implementation is functional, but further refinements and improvements can be incorporated based on review and feedback.
BUG: 15969