1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#ifndef OHOS_HDI_DISPLAY_COMPOSER_V1_1_IDISPLAYCOMPOSER_H 17#define OHOS_HDI_DISPLAY_COMPOSER_V1_1_IDISPLAYCOMPOSER_H 18 19#include <stdint.h> 20#include <string> 21#include <vector> 22#include <hdf_base.h> 23#include <hdi_base.h> 24#include "display/composer/v1_0/display_composer_type.h" 25#include "display/composer/v1_0/idisplay_composer.h" 26#include "display/composer/v1_0/irefresh_callback.h" 27#include "display/composer/v1_1/display_composer_type.h" 28#include "display/composer/v1_1/imode_callback.h" 29#include "display/composer/v1_1/iseamless_change_callback.h" 30 31#ifndef HDI_BUFF_MAX_SIZE 32#define HDI_BUFF_MAX_SIZE (1024 * 200) 33#endif 34 35#ifndef HDI_CHECK_VALUE_RETURN 36#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ 37 if ((lv) compare (rv)) { \ 38 return ret; \ 39 } \ 40} while (false) 41#endif 42 43#ifndef HDI_CHECK_VALUE_RET_GOTO 44#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ 45 if ((lv) compare (rv)) { \ 46 ret = value; \ 47 goto table; \ 48 } \ 49} while (false) 50#endif 51 52namespace OHOS { 53namespace HDI { 54namespace Display { 55namespace Composer { 56namespace V1_1 { 57using namespace OHOS; 58using namespace OHOS::HDI; 59using namespace OHOS::HDI::Display::Composer::V1_0; 60 61enum { 62 CMD_DISPLAY_COMPOSER_REG_SEAMLESS_CHANGE_CALLBACK = 25, 63 CMD_DISPLAY_COMPOSER_GET_DISPLAY_SUPPORTED_MODES_EXT = 26, 64 CMD_DISPLAY_COMPOSER_SET_DISPLAY_MODE_ASYNC = 27, 65 CMD_DISPLAY_COMPOSER_GET_DISPLAY_V_BLANK_PERIOD = 28, 66 CMD_DISPLAY_COMPOSER_SET_LAYER_PER_FRAME_PARAMETER = 29, 67 CMD_DISPLAY_COMPOSER_GET_SUPPORTED_LAYER_PER_FRAME_PARAMETER_KEY = 30, 68 CMD_DISPLAY_COMPOSER_SET_DISPLAY_OVERLAY_RESOLUTION = 31, 69 CMD_DISPLAY_COMPOSER_REG_REFRESH_CALLBACK = 32, 70 CMD_DISPLAY_COMPOSER_GET_DISPLAY_SUPPORTED_COLOR_GAMUTS = 33, 71 CMD_DISPLAY_COMPOSER_GET_H_D_R_CAPABILITY_INFOS = 34, 72}; 73 74class IDisplayComposer : public OHOS::HDI::Display::Composer::V1_0::IDisplayComposer { 75public: 76 DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.display.composer.v1_1.IDisplayComposer"); 77 78 virtual ~IDisplayComposer() = default; 79 80 static sptr<OHOS::HDI::Display::Composer::V1_1::IDisplayComposer> Get(bool isStub = false); 81 static sptr<OHOS::HDI::Display::Composer::V1_1::IDisplayComposer> Get(const std::string &serviceName, bool isStub = false); 82 83 static sptr<OHOS::HDI::Display::Composer::V1_1::IDisplayComposer> CastFrom(const sptr<OHOS::HDI::Display::Composer::V1_0::IDisplayComposer> &parent); 84 85 virtual int32_t RegSeamlessChangeCallback(const sptr<OHOS::HDI::Display::Composer::V1_1::ISeamlessChangeCallback>& cb) = 0; 86 87 virtual int32_t GetDisplaySupportedModesExt(uint32_t devId, 88 std::vector<OHOS::HDI::Display::Composer::V1_1::DisplayModeInfoExt>& modes) = 0; 89 90 virtual int32_t SetDisplayModeAsync(uint32_t devId, uint32_t modeId, 91 const sptr<OHOS::HDI::Display::Composer::V1_1::IModeCallback>& cb) = 0; 92 93 virtual int32_t GetDisplayVBlankPeriod(uint32_t devId, uint64_t& period) = 0; 94 95 virtual int32_t SetLayerPerFrameParameter(uint32_t devId, uint32_t layerId, const std::string& key, 96 const std::vector<int8_t>& value) = 0; 97 98 virtual int32_t GetSupportedLayerPerFrameParameterKey(std::vector<std::string>& keys) = 0; 99 100 virtual int32_t SetDisplayOverlayResolution(uint32_t devId, uint32_t width, uint32_t height) = 0; 101 102 virtual int32_t RegRefreshCallback(const sptr<OHOS::HDI::Display::Composer::V1_0::IRefreshCallback>& cb) = 0; 103 104 virtual int32_t GetDisplaySupportedColorGamuts(uint32_t devId, 105 std::vector<OHOS::HDI::Display::Composer::V1_0::ColorGamut>& gamuts) = 0; 106 107 virtual int32_t GetHDRCapabilityInfos(uint32_t devId, OHOS::HDI::Display::Composer::V1_0::HDRCapability& info) = 0; 108 109 int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) override 110 { 111 majorVer = 1; 112 minorVer = 1; 113 return HDF_SUCCESS; 114 } 115 116 const std::u16string GetDesc() override 117 { 118 return metaDescriptor_; 119 } 120}; 121} // V1_1 122} // Composer 123} // Display 124} // HDI 125} // OHOS 126 127#endif // OHOS_HDI_DISPLAY_COMPOSER_V1_1_IDISPLAYCOMPOSER_H 128 129