blob: 0974b5a695cf5c934e1c5fc960d3cdb956db6456 [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#ifndef ANDROID_DRM_MODE_H_
18#define ANDROID_DRM_MODE_H_
19
20#include <stdint.h>
Sean Paul6a55e9f2015-04-30 15:31:06 -040021#include <xf86drmMode.h>
Roman Stratiienkoaa3cd542020-08-29 11:26:16 +030022
Sean Paulf72cccd2018-08-27 13:59:08 -040023#include <string>
Sean Paul6a55e9f2015-04-30 15:31:06 -040024
Roman Stratiienko40b374b2021-10-22 18:13:09 +030025#include "DrmUnique.h"
26
Sean Paul6a55e9f2015-04-30 15:31:06 -040027namespace android {
28
Roman Stratiienko40b374b2021-10-22 18:13:09 +030029class DrmDevice;
30
Sean Paul6a55e9f2015-04-30 15:31:06 -040031class DrmMode {
32 public:
Zach Reiznerff30b522015-10-28 19:08:45 -070033 DrmMode() = default;
Sean Paul6a55e9f2015-04-30 15:31:06 -040034 DrmMode(drmModeModeInfoPtr m);
Sean Paul6a55e9f2015-04-30 15:31:06 -040035
36 bool operator==(const drmModeModeInfo &m) const;
Sean Paul6a55e9f2015-04-30 15:31:06 -040037
38 uint32_t id() const;
39 void set_id(uint32_t id);
40
41 uint32_t clock() const;
42
Roman Stratiienko40b374b2021-10-22 18:13:09 +030043 uint16_t h_display() const;
44 uint16_t h_sync_start() const;
45 uint16_t h_sync_end() const;
46 uint16_t h_total() const;
47 uint16_t h_skew() const;
Sean Paul6a55e9f2015-04-30 15:31:06 -040048
Roman Stratiienko40b374b2021-10-22 18:13:09 +030049 uint16_t v_display() const;
50 uint16_t v_sync_start() const;
51 uint16_t v_sync_end() const;
52 uint16_t v_total() const;
53 uint16_t v_scan() const;
Stéphane Marchesinb74e08c2015-07-05 02:00:08 -070054 float v_refresh() const;
Sean Paul6a55e9f2015-04-30 15:31:06 -040055
56 uint32_t flags() const;
57 uint32_t type() const;
58
59 std::string name() const;
60
Roman Stratiienko40b374b2021-10-22 18:13:09 +030061 auto CreateModeBlob(const DrmDevice &drm) -> DrmModeUserPropertyBlobUnique;
62
Sean Paul6a55e9f2015-04-30 15:31:06 -040063 private:
Zach Reiznerff30b522015-10-28 19:08:45 -070064 uint32_t id_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040065
Zach Reiznerff30b522015-10-28 19:08:45 -070066 uint32_t clock_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040067
Roman Stratiienko40b374b2021-10-22 18:13:09 +030068 uint16_t h_display_ = 0;
69 uint16_t h_sync_start_ = 0;
70 uint16_t h_sync_end_ = 0;
71 uint16_t h_total_ = 0;
72 uint16_t h_skew_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040073
Roman Stratiienko40b374b2021-10-22 18:13:09 +030074 uint16_t v_display_ = 0;
75 uint16_t v_sync_start_ = 0;
76 uint16_t v_sync_end_ = 0;
77 uint16_t v_total_ = 0;
78 uint16_t v_scan_ = 0;
79 uint16_t v_refresh_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040080
Zach Reiznerff30b522015-10-28 19:08:45 -070081 uint32_t flags_ = 0;
82 uint32_t type_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040083
84 std::string name_;
85};
Sean Paulf72cccd2018-08-27 13:59:08 -040086} // namespace android
Sean Paul6a55e9f2015-04-30 15:31:06 -040087
88#endif // ANDROID_DRM_MODE_H_