blob: a7b17c4c4ede0c74fe6ce4cd49f6a5fca9c87822 [file] [log] [blame]
Sean Paul6a55e9f2015-04-30 15:31:06 -04001/*
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
23namespace android {
24
25DrmCrtc::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 modeValid_(c->mode_valid) {
36}
37
38DrmCrtc::~DrmCrtc() {
39}
40
41uint32_t DrmCrtc::id() const {
42 return id_;
43}
44
45unsigned DrmCrtc::pipe() const {
46 return pipe_;
47}
48
49bool DrmCrtc::requires_modeset() const {
50 return requires_modeset_;
51}
52
53void DrmCrtc::set_requires_modeset(bool requires_modeset) {
54 requires_modeset_ = requires_modeset;
55}
56
57int DrmCrtc::display() const {
58 return display_;
59}
60
61void DrmCrtc::set_display(int display) {
62 display_ = display;
63 requires_modeset_ = true;
64}
65
66bool DrmCrtc::can_bind(int display) const {
67 return display_ == -1 || display_ == display;
68}
69}