blob: c6ddc63e7cc3876477cd90ea2ca2931b4aba5dc1 [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
Roman Stratiienkobde95662022-12-10 20:27:58 +020017#pragma once
Sean Paul6a55e9f2015-04-30 15:31:06 -040018
Sean Paul6a55e9f2015-04-30 15:31:06 -040019#include <xf86drmMode.h>
Roman Stratiienkoaa3cd542020-08-29 11:26:16 +030020
Roman Stratiienkoa148f212021-11-16 18:23:18 +020021#include <cstdint>
Roman Stratiienkoe78235c2021-12-23 17:36:12 +020022#include <cstdio>
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;
Roman Stratiienkoe78235c2021-12-23 17:36:12 +020034 explicit 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
Sean Paul6a55e9f2015-04-30 15:31:06 -040038 uint32_t clock() const;
39
Roman Stratiienko40b374b2021-10-22 18:13:09 +030040 uint16_t h_display() const;
41 uint16_t h_sync_start() const;
42 uint16_t h_sync_end() const;
43 uint16_t h_total() const;
44 uint16_t h_skew() const;
Sean Paul6a55e9f2015-04-30 15:31:06 -040045
Roman Stratiienko40b374b2021-10-22 18:13:09 +030046 uint16_t v_display() const;
47 uint16_t v_sync_start() const;
48 uint16_t v_sync_end() const;
49 uint16_t v_total() const;
50 uint16_t v_scan() const;
Stéphane Marchesinb74e08c2015-07-05 02:00:08 -070051 float v_refresh() const;
Sean Paul6a55e9f2015-04-30 15:31:06 -040052
53 uint32_t flags() const;
54 uint32_t type() const;
55
56 std::string name() const;
57
Roman Stratiienko40b374b2021-10-22 18:13:09 +030058 auto CreateModeBlob(const DrmDevice &drm) -> DrmModeUserPropertyBlobUnique;
59
Sean Paul6a55e9f2015-04-30 15:31:06 -040060 private:
Zach Reiznerff30b522015-10-28 19:08:45 -070061 uint32_t clock_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040062
Roman Stratiienko40b374b2021-10-22 18:13:09 +030063 uint16_t h_display_ = 0;
64 uint16_t h_sync_start_ = 0;
65 uint16_t h_sync_end_ = 0;
66 uint16_t h_total_ = 0;
67 uint16_t h_skew_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040068
Roman Stratiienko40b374b2021-10-22 18:13:09 +030069 uint16_t v_display_ = 0;
70 uint16_t v_sync_start_ = 0;
71 uint16_t v_sync_end_ = 0;
72 uint16_t v_total_ = 0;
73 uint16_t v_scan_ = 0;
74 uint16_t v_refresh_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040075
Zach Reiznerff30b522015-10-28 19:08:45 -070076 uint32_t flags_ = 0;
77 uint32_t type_ = 0;
Sean Paul6a55e9f2015-04-30 15:31:06 -040078
79 std::string name_;
80};
Sean Paulf72cccd2018-08-27 13:59:08 -040081} // namespace android