-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdisplay_mode.h
45 lines (34 loc) · 1.63 KB
/
display_mode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Functions to access a database of standard display modes.
#pragma once
#include <optional>
#include <string>
#include <vector>
#include "xy.h"
namespace pivid {
// Description of video mode resolution & timings (like XFree86 Modeline).
// Available modes come from DisplayDriver::scan_screens();
// the desired mode to use is given to DisplayDriver::request_update().
// (A custom/tweaked mode may also be used if you're wild and crazy.)
struct DisplayMode {
XY<int> size; // Displayable pixel size
XY<int> scan_size; // Overall timing size
XY<int> sync_start; // Horiz / vert sync start
XY<int> sync_end; // Horiz / vert sync pulse end
XY<int> sync_polarity; // Horiz / vert sync polarity (+1 / -1)
XY<int> doubling; // Clock doubling / doublescan / interlace (+1 / -1)
XY<int> aspect; // Picture aspect ratio (0/0 if unspecified)
int pixel_khz = 0; // Basic pixel clock
int nominal_hz = 0; // Approx refresh rate (like 30 or 60)
double actual_hz() const; // Computes true refresh frequency
};
// All modes listed in the CTA-861 standard
extern std::vector<DisplayMode> const cta_861_modes;
// Returns all modes listed in the VESA DMT standard
extern std::vector<DisplayMode> const vesa_dmt_modes;
// Computes a mode per the VESA CVT standard, if possible
std::optional<DisplayMode> vesa_cvt_mode(XY<int> size, int hz);
// Computes a mode per VESA CVT with Reduced Blanking v2, if possible
std::optional<DisplayMode> vesa_cvt_rb_mode(XY<int> size, double target_hz);
// Debugging description of DisplayMode.
std::string debug(DisplayMode const&);
} // namespace pivid