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() {} GetCrtcId()32 uint32_t GetCrtcId() const 33 { 34 return mCrtcId; 35 } SetCrtcId(uint32_t id)36 void SetCrtcId(uint32_t id) 37 { 38 mCrtcId = id; 39 } GetPossibleCrtcs()40 uint32_t GetPossibleCrtcs() const 41 { 42 return mPossibleCrtcs; 43 } 44 int32_t PickIdleCrtcId(IdMapPtr<DrmCrtc> &crtcs, uint32_t &crtcId); GetId()45 uint32_t GetId() const 46 { 47 return mEncoderId; 48 } 49 50 private: 51 uint32_t mEncoderId; 52 uint32_t mCrtcId; 53 uint32_t mPossibleCrtcs; 54 }; 55 } // namespace OHOS 56 } // namespace HDI 57 } // namespace DISPLAY 58 59 #endif // DRM_ENCODER_H