1 /* 2 * Copyright (c) 2021 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 DRM_ENCODER_H 17 #define DRM_ENCODER_H 18 #include <string> 19 #include <memory> 20 #include <xf86drm.h> 21 #include <xf86drmMode.h> 22 #include <display_type.h> 23 #include <drm_crtc.h> 24 25 namespace OHOS { 26 namespace HDI { 27 namespace DISPLAY { 28 class DrmEncoder { 29 public: 30 explicit DrmEncoder(drmModeEncoder e); ~DrmEncoder()31 virtual ~DrmEncoder() 32 { 33 } GetCrtcId()34 uint32_t GetCrtcId() const 35 { 36 return mCrtcId; 37 } SetCrtcId(uint32_t id)38 void SetCrtcId(uint32_t id) 39 { 40 mCrtcId = id; 41 } GetPossibleCrtcs()42 uint32_t GetPossibleCrtcs() const 43 { 44 return mPossibleCrtcs; 45 } 46 int32_t PickIdleCrtcId(IdMapPtr<DrmCrtc> &crtcs, uint32_t &crtcId); GetId()47 uint32_t GetId() const 48 { 49 return mEncoderId; 50 } 51 52 private: 53 uint32_t mEncoderId; 54 uint32_t mCrtcId; 55 uint32_t mPossibleCrtcs; 56 }; 57 } // namespace OHOS 58 } // namespace HDI 59 } // namespace DISPLAY 60 61 #endif // DRM_ENCODER_H