OSDN Git Service

drm_hwcomposer: Fix case on DrmCrtc mode_valid_ member variable
[android-x86/external-drm_hwcomposer.git] / drmcrtc.cpp
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include "drmcrtc.h"
18 #include "drmresources.h"
19
20 #include <stdint.h>
21 #include <xf86drmMode.h>
22
23 namespace android {
24
25 DrmCrtc::DrmCrtc(drmModeCrtcPtr c, unsigned pipe)
26     : id_(c->crtc_id),
27       pipe_(pipe),
28       display_(-1),
29       requires_modeset_(true),
30       x_(c->x),
31       y_(c->y),
32       width_(c->width),
33       height_(c->height),
34       mode_(&c->mode),
35       mode_valid_(c->mode_valid) {
36 }
37
38 DrmCrtc::~DrmCrtc() {
39 }
40
41 uint32_t DrmCrtc::id() const {
42   return id_;
43 }
44
45 unsigned DrmCrtc::pipe() const {
46   return pipe_;
47 }
48
49 bool DrmCrtc::requires_modeset() const {
50   return requires_modeset_;
51 }
52
53 void DrmCrtc::set_requires_modeset(bool requires_modeset) {
54   requires_modeset_ = requires_modeset;
55 }
56
57 int DrmCrtc::display() const {
58   return display_;
59 }
60
61 void DrmCrtc::set_display(int display) {
62   display_ = display;
63   requires_modeset_ = true;
64 }
65
66 bool DrmCrtc::can_bind(int display) const {
67   return display_ == -1 || display_ == display;
68 }
69 }