1*0a9764feSAndroid Build Coastguard Worker /* 2*0a9764feSAndroid Build Coastguard Worker * Copyright (C) 2015 The Android Open Source Project 3*0a9764feSAndroid Build Coastguard Worker * 4*0a9764feSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*0a9764feSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*0a9764feSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*0a9764feSAndroid Build Coastguard Worker * 8*0a9764feSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*0a9764feSAndroid Build Coastguard Worker * 10*0a9764feSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*0a9764feSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*0a9764feSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*0a9764feSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*0a9764feSAndroid Build Coastguard Worker * limitations under the License. 15*0a9764feSAndroid Build Coastguard Worker */ 16*0a9764feSAndroid Build Coastguard Worker 17*0a9764feSAndroid Build Coastguard Worker #pragma once 18*0a9764feSAndroid Build Coastguard Worker 19*0a9764feSAndroid Build Coastguard Worker #include <xf86drmMode.h> 20*0a9764feSAndroid Build Coastguard Worker 21*0a9764feSAndroid Build Coastguard Worker #include <cstdint> 22*0a9764feSAndroid Build Coastguard Worker 23*0a9764feSAndroid Build Coastguard Worker #include "DrmDisplayPipeline.h" 24*0a9764feSAndroid Build Coastguard Worker #include "DrmMode.h" 25*0a9764feSAndroid Build Coastguard Worker #include "DrmProperty.h" 26*0a9764feSAndroid Build Coastguard Worker #include "DrmUnique.h" 27*0a9764feSAndroid Build Coastguard Worker 28*0a9764feSAndroid Build Coastguard Worker namespace android { 29*0a9764feSAndroid Build Coastguard Worker 30*0a9764feSAndroid Build Coastguard Worker class DrmDevice; 31*0a9764feSAndroid Build Coastguard Worker 32*0a9764feSAndroid Build Coastguard Worker class DrmCrtc : public PipelineBindable<DrmCrtc> { 33*0a9764feSAndroid Build Coastguard Worker public: 34*0a9764feSAndroid Build Coastguard Worker static auto CreateInstance(DrmDevice &dev, uint32_t crtc_id, uint32_t index) 35*0a9764feSAndroid Build Coastguard Worker -> std::unique_ptr<DrmCrtc>; 36*0a9764feSAndroid Build Coastguard Worker 37*0a9764feSAndroid Build Coastguard Worker DrmCrtc() = delete; 38*0a9764feSAndroid Build Coastguard Worker DrmCrtc(const DrmCrtc &) = delete; 39*0a9764feSAndroid Build Coastguard Worker DrmCrtc &operator=(const DrmCrtc &) = delete; 40*0a9764feSAndroid Build Coastguard Worker GetId()41*0a9764feSAndroid Build Coastguard Worker auto GetId() const { 42*0a9764feSAndroid Build Coastguard Worker return crtc_->crtc_id; 43*0a9764feSAndroid Build Coastguard Worker } 44*0a9764feSAndroid Build Coastguard Worker GetIndexInResArray()45*0a9764feSAndroid Build Coastguard Worker auto GetIndexInResArray() const { 46*0a9764feSAndroid Build Coastguard Worker return index_in_res_array_; 47*0a9764feSAndroid Build Coastguard Worker } 48*0a9764feSAndroid Build Coastguard Worker GetActiveProperty()49*0a9764feSAndroid Build Coastguard Worker auto &GetActiveProperty() const { 50*0a9764feSAndroid Build Coastguard Worker return active_property_; 51*0a9764feSAndroid Build Coastguard Worker } 52*0a9764feSAndroid Build Coastguard Worker GetModeProperty()53*0a9764feSAndroid Build Coastguard Worker auto &GetModeProperty() const { 54*0a9764feSAndroid Build Coastguard Worker return mode_property_; 55*0a9764feSAndroid Build Coastguard Worker } 56*0a9764feSAndroid Build Coastguard Worker GetOutFencePtrProperty()57*0a9764feSAndroid Build Coastguard Worker auto &GetOutFencePtrProperty() const { 58*0a9764feSAndroid Build Coastguard Worker return out_fence_ptr_property_; 59*0a9764feSAndroid Build Coastguard Worker } 60*0a9764feSAndroid Build Coastguard Worker GetCtmProperty()61*0a9764feSAndroid Build Coastguard Worker auto &GetCtmProperty() const { 62*0a9764feSAndroid Build Coastguard Worker return ctm_property_; 63*0a9764feSAndroid Build Coastguard Worker } 64*0a9764feSAndroid Build Coastguard Worker 65*0a9764feSAndroid Build Coastguard Worker private: DrmCrtc(DrmModeCrtcUnique crtc,uint32_t index)66*0a9764feSAndroid Build Coastguard Worker DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index) 67*0a9764feSAndroid Build Coastguard Worker : crtc_(std::move(crtc)), index_in_res_array_(index){}; 68*0a9764feSAndroid Build Coastguard Worker 69*0a9764feSAndroid Build Coastguard Worker DrmModeCrtcUnique crtc_; 70*0a9764feSAndroid Build Coastguard Worker 71*0a9764feSAndroid Build Coastguard Worker const uint32_t index_in_res_array_; 72*0a9764feSAndroid Build Coastguard Worker 73*0a9764feSAndroid Build Coastguard Worker DrmProperty ctm_property_; 74*0a9764feSAndroid Build Coastguard Worker 75*0a9764feSAndroid Build Coastguard Worker DrmProperty active_property_; 76*0a9764feSAndroid Build Coastguard Worker DrmProperty mode_property_; 77*0a9764feSAndroid Build Coastguard Worker DrmProperty out_fence_ptr_property_; 78*0a9764feSAndroid Build Coastguard Worker }; 79*0a9764feSAndroid Build Coastguard Worker } // namespace android 80