1 /* 2 * Copyright 2018 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 <composer-hal/2.2/ComposerHal.h> 20 21 namespace android { 22 namespace hardware { 23 namespace graphics { 24 namespace composer { 25 namespace V2_3 { 26 namespace hal { 27 28 using common::V1_1::RenderIntent; 29 using common::V1_2::ColorMode; 30 using common::V1_2::Dataspace; 31 using common::V1_2::Hdr; 32 using common::V1_2::PixelFormat; 33 using V2_1::Display; 34 using V2_1::Error; 35 using V2_1::Layer; 36 37 class ComposerHal : public V2_2::hal::ComposerHal { 38 public: getPerFrameMetadataKeys(Display display,std::vector<V2_2::IComposerClient::PerFrameMetadataKey> * outKeys)39 Error getPerFrameMetadataKeys( 40 Display display, std::vector<V2_2::IComposerClient::PerFrameMetadataKey>* outKeys) { 41 return getPerFrameMetadataKeys_2_3( 42 display, reinterpret_cast<std::vector<IComposerClient::PerFrameMetadataKey>*>(outKeys)); 43 } 44 setColorMode_2_2(Display display,common::V1_1::ColorMode mode,RenderIntent intent)45 Error setColorMode_2_2(Display display, common::V1_1::ColorMode mode, 46 RenderIntent intent) override { 47 return setColorMode_2_3(display, static_cast<ColorMode>(mode), intent); 48 } 49 getColorModes_2_2(Display display,hidl_vec<common::V1_1::ColorMode> * outModes)50 Error getColorModes_2_2(Display display, hidl_vec<common::V1_1::ColorMode>* outModes) override { 51 return getColorModes_2_3(display, reinterpret_cast<hidl_vec<ColorMode>*>(outModes)); 52 } 53 getClientTargetSupport_2_2(Display display,uint32_t width,uint32_t height,common::V1_1::PixelFormat format,common::V1_1::Dataspace dataspace)54 Error getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height, 55 common::V1_1::PixelFormat format, 56 common::V1_1::Dataspace dataspace) override { 57 return getClientTargetSupport_2_3(display, width, height, static_cast<PixelFormat>(format), 58 static_cast<Dataspace>(dataspace)); 59 } 60 getReadbackBufferAttributes(Display display,common::V1_1::PixelFormat * outFormat,common::V1_1::Dataspace * outDataspace)61 Error getReadbackBufferAttributes(Display display, common::V1_1::PixelFormat* outFormat, 62 common::V1_1::Dataspace* outDataspace) override { 63 return getReadbackBufferAttributes_2_3(display, reinterpret_cast<PixelFormat*>(outFormat), 64 reinterpret_cast<Dataspace*>(outDataspace)); 65 } 66 getHdrCapabilities(Display display,hidl_vec<common::V1_0::Hdr> * outTypes,float * outMaxLuminance,float * outMaxAverageLuminance,float * outMinLuminance)67 Error getHdrCapabilities(Display display, hidl_vec<common::V1_0::Hdr>* outTypes, 68 float* outMaxLuminance, float* outMaxAverageLuminance, 69 float* outMinLuminance) override { 70 return getHdrCapabilities_2_3(display, reinterpret_cast<hidl_vec<Hdr>*>(outTypes), 71 outMaxLuminance, outMaxAverageLuminance, outMinLuminance); 72 } 73 setLayerPerFrameMetadata(Display display,Layer layer,const std::vector<V2_2::IComposerClient::PerFrameMetadata> & metadata)74 Error setLayerPerFrameMetadata( 75 Display display, Layer layer, 76 const std::vector<V2_2::IComposerClient::PerFrameMetadata>& metadata) override { 77 return setLayerPerFrameMetadata_2_3( 78 display, layer, 79 reinterpret_cast<const std::vector<IComposerClient::PerFrameMetadata>&>(metadata)); 80 } 81 82 virtual Error getPerFrameMetadataKeys_2_3( 83 Display display, std::vector<IComposerClient::PerFrameMetadataKey>* outKeys) = 0; 84 85 virtual Error setColorMode_2_3(Display display, ColorMode mode, RenderIntent intent) = 0; 86 87 virtual Error getRenderIntents_2_3(Display display, ColorMode mode, 88 std::vector<RenderIntent>* outIntents) = 0; 89 90 virtual Error getColorModes_2_3(Display display, hidl_vec<ColorMode>* outModes) = 0; 91 92 virtual Error getClientTargetSupport_2_3(Display display, uint32_t width, uint32_t height, 93 PixelFormat format, Dataspace dataspace) = 0; 94 virtual Error getReadbackBufferAttributes_2_3(Display display, PixelFormat* outFormat, 95 Dataspace* outDataspace) = 0; 96 virtual Error getHdrCapabilities_2_3(Display display, hidl_vec<Hdr>* outTypes, 97 float* outMaxLuminance, float* outMaxAverageLuminance, 98 float* outMinLuminance) = 0; 99 virtual Error setLayerPerFrameMetadata_2_3( 100 Display display, Layer layer, 101 const std::vector<IComposerClient::PerFrameMetadata>& metadata) = 0; 102 virtual Error getDisplayIdentificationData(Display display, uint8_t* outPort, 103 std::vector<uint8_t>* outData) = 0; 104 virtual Error setLayerColorTransform(Display display, Layer layer, const float* matrix) = 0; 105 virtual Error getDisplayedContentSamplingAttributes( 106 uint64_t display, PixelFormat& format, Dataspace& dataspace, 107 hidl_bitfield<IComposerClient::FormatColorComponent>& componentMask) = 0; 108 virtual Error setDisplayedContentSamplingEnabled( 109 uint64_t display, IComposerClient::DisplayedContentSampling enable, 110 hidl_bitfield<IComposerClient::FormatColorComponent> componentMask, uint64_t maxFrames) = 0; 111 virtual Error getDisplayedContentSample(uint64_t display, uint64_t maxFrames, 112 uint64_t timestamp, uint64_t& frameCount, 113 hidl_vec<uint64_t>& sampleComponent0, 114 hidl_vec<uint64_t>& sampleComponent1, 115 hidl_vec<uint64_t>& sampleComponent2, 116 hidl_vec<uint64_t>& sampleComponent3) = 0; 117 virtual Error getDisplayCapabilities( 118 Display display, std::vector<IComposerClient::DisplayCapability>* outCapabilities) = 0; 119 virtual Error setLayerPerFrameMetadataBlobs( 120 Display display, Layer layer, 121 std::vector<IComposerClient::PerFrameMetadataBlob>& blobs) = 0; 122 virtual Error getDisplayBrightnessSupport(Display display, bool* outSupport) = 0; 123 virtual Error setDisplayBrightness(Display display, float brightness) = 0; 124 }; 125 126 } // namespace hal 127 } // namespace V2_3 128 } // namespace composer 129 } // namespace graphics 130 } // namespace hardware 131 } // namespace android 132