2 * Copyright (C) 2015 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define LOG_TAG "hwc-drm-crtc"
20 #include "drmresources.h"
23 #include <xf86drmMode.h>
25 #include <cutils/log.h>
29 DrmCrtc::DrmCrtc(DrmResources *drm, drmModeCrtcPtr c, unsigned pipe)
38 int ret = drm_->GetCrtcProperty(*this, "ACTIVE", &active_property_);
40 ALOGE("Failed to get ACTIVE property");
44 ret = drm_->GetCrtcProperty(*this, "MODE_ID", &mode_property_);
46 ALOGE("Failed to get MODE_ID property");
50 ret = drm_->GetCrtcProperty(*this, "OUT_FENCE_PTR", &out_fence_ptr_property_);
52 ALOGE("Failed to get OUT_FENCE_PTR property");
58 uint32_t DrmCrtc::id() const {
62 unsigned DrmCrtc::pipe() const {
66 int DrmCrtc::display() const {
70 void DrmCrtc::set_display(int display) {
74 bool DrmCrtc::can_bind(int display) const {
75 return display_ == -1 || display_ == display;
78 const DrmProperty &DrmCrtc::active_property() const {
79 return active_property_;
82 const DrmProperty &DrmCrtc::mode_property() const {
83 return mode_property_;
86 const DrmProperty &DrmCrtc::out_fence_ptr_property() const {
87 return out_fence_ptr_property_;