-
Notifications
You must be signed in to change notification settings - Fork 0
/
drm-display.h
138 lines (108 loc) · 3.02 KB
/
drm-display.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* Copyright (C) 2019-2020 Paul Kocialkowski <contact@paulk.fr>
* Copyright (C) 2020 Bootlin
*/
#ifndef _DRM_DISPLAY_H_
#define _DRM_DISPLAY_H_
#include <stdbool.h>
#include <stdint.h>
#include <drm_fourcc.h>
#include <xf86drmMode.h>
#include <xf86drm.h>
struct drm_display;
struct drm_display_buffer {
unsigned int width;
unsigned int height;
uint32_t format;
uint32_t fb_id;
uint32_t handles[4];
uint32_t offsets[4];
uint32_t strides[4];
uint32_t sizes[4];
void *data[4];
};
struct drm_display_property {
const char *name;
uint32_t *id;
uint32_t *value;
};
struct drm_display_connector_properties {
uint32_t crtc_id;
};
struct drm_display_crtc_properties {
uint32_t active;
uint32_t mode_id;
};
struct drm_display_plane_properties {
uint32_t type;
uint32_t fb_id;
uint32_t crtc_id;
uint32_t src_w;
uint32_t src_h;
uint32_t src_x;
uint32_t src_y;
uint32_t crtc_w;
uint32_t crtc_h;
uint32_t crtc_x;
uint32_t crtc_y;
};
struct drm_display_plane {
uint32_t id;
uint32_t type;
struct drm_display_plane_properties properties;
};
struct drm_display_plane_setup {
struct drm_display_plane plane;
struct drm_display_buffer *buffer_visible;
unsigned int buffer_width;
unsigned int buffer_height;
uint32_t buffer_format;
unsigned int display_width;
unsigned int display_height;
unsigned int display_x;
unsigned int display_y;
bool configured;
};
struct drm_display_output {
drmModeModeInfo mode;
uint32_t mode_blob_id;
bool mode_set;
uint32_t connector_id;
struct drm_display_connector_properties connector_properties;
uint32_t crtc_id;
struct drm_display_crtc_properties crtc_properties;
};
struct drm_display {
char *drm_path;
int drm_fd;
struct drm_display_output output;
struct drm_display_plane_setup primary_setup;
struct drm_display_buffer primary_buffers[2];
unsigned int primary_buffers_count;
unsigned int primary_buffers_index;
struct drm_display_plane_setup overlay_setup;
struct drm_display_buffer overlay_buffers[2];
unsigned int overlay_buffers_count;
unsigned int overlay_buffers_index;
bool up;
void *private;
};
struct drm_display_buffer *drm_display_primary_buffer_cycle(struct drm_display *display);
struct drm_display_buffer *drm_display_overlay_buffer_cycle(struct drm_display *display);
int drm_display_buffer_dma_buf_export(struct drm_display *display,
struct drm_display_buffer *buffer,
int *fd);
int drm_display_detach(struct drm_display *display,
struct drm_display_plane_setup *plane_setup);
int drm_display_page_flip(struct drm_display *display,
struct drm_display_plane_setup *plane_setup,
struct drm_display_buffer *buffer);
int drm_display_configure(struct drm_display *display,
struct drm_display_plane_setup *plane_setup,
struct drm_display_buffer *buffer);
int drm_display_setup(struct drm_display *display);
int drm_display_teardown(struct drm_display *display);
int drm_display_probe(struct drm_display *display);
int drm_display_open(struct drm_display *display);
void drm_display_close(struct drm_display *display);
#endif