1 /* 2 * Copyright (c) 2021-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 RS_SCREEN_CAPABILITY 17 #define RS_SCREEN_CAPABILITY 18 19 #include <cstdint> 20 #include <parcel.h> 21 #include <refbase.h> 22 #include <string> 23 #include <vector> 24 25 #include "common/rs_macros.h" 26 #include "screen_manager/rs_screen_props.h" 27 #include "screen_manager/screen_types.h" 28 29 namespace OHOS { 30 namespace Rosen { 31 class RSB_EXPORT RSScreenCapability : public Parcelable { 32 public: 33 RSScreenCapability() = default; 34 RSScreenCapability(std::string name, ScreenInterfaceType type, uint32_t phyWidth, 35 uint32_t phyHeight, uint32_t supportLayers, uint32_t virtualDispCount, 36 bool supportWriteBack, const std::vector<RSScreenProps>& props); 37 ~RSScreenCapability() = default; 38 [[nodiscard]] static RSScreenCapability* Unmarshalling(Parcel &parcel); 39 bool Marshalling(Parcel &parcel) const override; 40 41 void SetName(const std::string& name); 42 void SetType(ScreenInterfaceType type); 43 void SetPhyWidth(uint32_t phyWidth); 44 void SetPhyHeight(uint32_t phyHeight); 45 void SetSupportLayers(uint32_t supportLayers); 46 void SetVirtualDispCount(uint32_t virtualDispCount); 47 void SetSupportWriteBack(bool supportWriteBack); 48 void SetProps(const std::vector<RSScreenProps>& props); 49 50 const std::string& GetName() const; 51 ScreenInterfaceType GetType() const; 52 uint32_t GetPhyWidth() const; 53 uint32_t GetPhyHeight() const; 54 uint32_t GetSupportLayers() const; 55 uint32_t GetVirtualDispCount() const; 56 bool GetSupportWriteBack() const; 57 const std::vector<RSScreenProps>& GetProps() const; 58 59 private: 60 bool WriteVector(const std::vector<RSScreenProps>& props, Parcel &parcel) const; 61 static bool ReadVector(std::vector<RSScreenProps>& unmarProps, uint32_t unmarPropCount, Parcel &parcel); 62 std::string name_; 63 ScreenInterfaceType type_ = DISP_INVALID; 64 uint32_t phyWidth_ = 0; 65 uint32_t phyHeight_ = 0; 66 uint32_t supportLayers_ = 0; 67 uint32_t virtualDispCount_ = 0; 68 bool supportWriteBack_ = false; 69 std::vector<RSScreenProps> props_; 70 }; 71 } // namespace Rosen 72 } // namespace OHOS 73 74 #endif // RS_SCREEN_CAPABILITY