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