Lloyd Pique | 3d0c02e | 2018-10-19 18:38:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <cstdint> |
| 20 | |
| 21 | #include <ui/GraphicTypes.h> |
| 22 | |
| 23 | namespace android { |
| 24 | |
| 25 | class HdrCapabilities; |
| 26 | |
| 27 | namespace compositionengine { |
| 28 | |
| 29 | /** |
| 30 | * Encapsulates all the state and functionality for how colors should be |
| 31 | * transformed for a display |
| 32 | */ |
| 33 | class DisplayColorProfile { |
| 34 | public: |
| 35 | constexpr static float sDefaultMinLumiance = 0.0; |
| 36 | constexpr static float sDefaultMaxLumiance = 500.0; |
| 37 | |
| 38 | virtual ~DisplayColorProfile(); |
| 39 | |
| 40 | // Returns true if the profile is valid. This is meant to be checked post- |
| 41 | // construction and prior to use, as not everything is set up by the |
| 42 | // constructor. |
| 43 | virtual bool isValid() const = 0; |
| 44 | |
| 45 | // Returns true if the profile supports the indicated render intent |
| 46 | virtual bool hasRenderIntent(ui::RenderIntent) const = 0; |
| 47 | |
| 48 | // Returns true if the profile supports the indicated dataspace |
| 49 | virtual bool hasLegacyHdrSupport(ui::Dataspace) const = 0; |
| 50 | |
| 51 | // Obtains the best combination of color mode and render intent for the |
| 52 | // input values |
| 53 | virtual void getBestColorMode(ui::Dataspace dataspace, ui::RenderIntent intent, |
| 54 | ui::Dataspace* outDataspace, ui::ColorMode* outMode, |
| 55 | ui::RenderIntent* outIntent) const = 0; |
| 56 | |
| 57 | // Returns true if the profile supports a wide color gamut |
| 58 | virtual bool hasWideColorGamut() const = 0; |
| 59 | |
| 60 | // Returns the per-frame metadata value for this profile |
| 61 | virtual int32_t getSupportedPerFrameMetadata() const = 0; |
| 62 | |
| 63 | // Returns true if HWC for this profile supports HDR10Plus |
| 64 | virtual bool hasHDR10PlusSupport() const = 0; |
| 65 | |
| 66 | // Returns true if HWC for this profile supports HDR10 |
| 67 | virtual bool hasHDR10Support() const = 0; |
| 68 | |
| 69 | // Returns true if HWC for this profile supports HLG |
| 70 | virtual bool hasHLGSupport() const = 0; |
| 71 | |
| 72 | // Returns true if HWC for this profile supports DolbyVision |
| 73 | virtual bool hasDolbyVisionSupport() const = 0; |
| 74 | |
| 75 | // Gets the supported HDR capabilities for the profile |
| 76 | virtual const HdrCapabilities& getHdrCapabilities() const = 0; |
| 77 | |
| 78 | // Debugging |
| 79 | virtual void dump(std::string&) const = 0; |
| 80 | }; |
| 81 | |
| 82 | } // namespace compositionengine |
| 83 | } // namespace android |