~emersion/go-drm

ref: a2cc587ebd1214167b744050287a35a1d75887fc go-drm/const.go -rw-r--r-- 6.1 KiB
a2cc587eSimon Ser go fmt 2 years ago
                                                                                
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
package drm

type NodeType int

const (
	NodePrimary NodeType = 0
	NodeControl NodeType = 1
	NodeRender  NodeType = 2
)

func (t NodeType) String() string {
	switch t {
	case NodePrimary:
		return "primary"
	case NodeControl:
		return "control"
	case NodeRender:
		return "render"
	default:
		return "unknown"
	}
}

type BusType int

const (
	BusPCI      BusType = 0
	BusUSB      BusType = 1
	BusPlatform BusType = 2
	BusHost1x   BusType = 3
)

func (t BusType) String() string {
	switch t {
	case BusPCI:
		return "PCI"
	case BusUSB:
		return "USB"
	case BusPlatform:
		return "platform"
	case BusHost1x:
		return "host1x"
	default:
		return "unknown"
	}
}

type Cap uint64

const (
	CapDumbBuffer          Cap = 0x1
	CapVblankHighCRTC      Cap = 0x2
	CapDumbPreferredDepth  Cap = 0x3
	CapDumbPreferredShadow Cap = 0x4
	CapPrime               Cap = 0x5
	CapTimestampMonotonic  Cap = 0x6
	CapAsyncPageFlip       Cap = 0x7
	CapCursorWidth         Cap = 0x8
	CapCursorHeight        Cap = 0x9
	CapAddFB2Modifiers     Cap = 0x10
	CapPageFlipTarget      Cap = 0x11
	CapCRTCInVBlankEvent   Cap = 0x12
	CapSyncObj             Cap = 0x13
	CapSyncObjTimeline     Cap = 0x14
)

func (c Cap) String() string {
	switch c {
	case CapDumbBuffer:
		return "DUMB_BUFFER"
	case CapVblankHighCRTC:
		return "VBLANK_HIGH_CRTC"
	case CapDumbPreferredDepth:
		return "DUMB_PREFERRED_DEPTH"
	case CapDumbPreferredShadow:
		return "DUMB_PREFER_SHADOW"
	case CapPrime:
		return "PRIME"
	case CapTimestampMonotonic:
		return "TIMESTAMP_MONOTONIC"
	case CapAsyncPageFlip:
		return "ASYNC_PAGE_FLIP"
	case CapCursorWidth:
		return "CURSOR_WIDTH"
	case CapCursorHeight:
		return "CURSOR_HEIGHT"
	case CapAddFB2Modifiers:
		return "ADDFB2_MODIFIERS"
	case CapPageFlipTarget:
		return "PAGE_FLIP_TARGET"
	case CapCRTCInVBlankEvent:
		return "CRTC_IN_VBLANK_EVENT"
	case CapSyncObj:
		return "SYNCOBJ"
	case CapSyncObjTimeline:
		return "SYNCOBJ_TIMELINE"
	}
	return "unknown"
}

type ClientCap uint64

const (
	ClientCapStereo3D            ClientCap = 1
	ClientCapUniversalPlanes     ClientCap = 2
	ClientCapAtomic              ClientCap = 3
	ClientCapAspectRatio         ClientCap = 4
	ClientCapWritebackConnectors ClientCap = 5
)

func (c ClientCap) String() string {
	switch c {
	case ClientCapStereo3D:
		return "STEREO_3D"
	case ClientCapUniversalPlanes:
		return "UNIVERSAL_PLANES"
	case ClientCapAtomic:
		return "ATOMIC"
	case ClientCapAspectRatio:
		return "APSECT_RATIO"
	case ClientCapWritebackConnectors:
		return "WRITEBACK_CONNECTORS"
	}
	return "unknown"
}

const (
	CapPrimeImport = 0x1
	CapPrimeExport = 0x2
)

type ConnectorType uint32

const (
	ConnectorUnknown     ConnectorType = 0
	ConnectorVGA         ConnectorType = 1
	ConnectorDVII        ConnectorType = 2
	ConnectorDVID        ConnectorType = 3
	ConnectorDVIA        ConnectorType = 4
	ConnectorComposite   ConnectorType = 5
	ConnectorSVideo      ConnectorType = 6
	ConnectorLVDS        ConnectorType = 7
	ConnectorComponent   ConnectorType = 8
	Connector9PinDIN     ConnectorType = 9
	ConnectorDisplayPort ConnectorType = 10
	ConnectorHDMIA       ConnectorType = 11
	ConnectorHDMIB       ConnectorType = 12
	ConnectorTV          ConnectorType = 13
	ConnectorEDP         ConnectorType = 14
	ConnectorVirtual     ConnectorType = 15
	ConnectorDSI         ConnectorType = 16
	ConnectorDPI         ConnectorType = 17
	ConnectorWriteback   ConnectorType = 18
)

func (t ConnectorType) String() string {
	switch t {
	case ConnectorVGA:
		return "VGA"
	case ConnectorDVII:
		return "DVI-I"
	case ConnectorDVID:
		return "DVI-D"
	case ConnectorDVIA:
		return "DVI-A"
	case ConnectorComposite:
		return "composite"
	case ConnectorSVideo:
		return "S-Video"
	case ConnectorLVDS:
		return "LVDS"
	case ConnectorComponent:
		return "component"
	case Connector9PinDIN:
		return "9PinDIN"
	case ConnectorDisplayPort:
		return "DisplayPort"
	case ConnectorHDMIA:
		return "HDMI-A"
	case ConnectorHDMIB:
		return "HDMI-B"
	case ConnectorTV:
		return "TV"
	case ConnectorEDP:
		return "eDP"
	case ConnectorVirtual:
		return "virtual"
	case ConnectorDSI:
		return "DSI"
	case ConnectorDPI:
		return "DPI"
	case ConnectorWriteback:
		return "writeback"
	default:
		return "unknown"
	}
}

type EncoderType uint32

const (
	EncoderNone    EncoderType = 0
	EncoderDAC     EncoderType = 1
	EncoderTDMS    EncoderType = 2
	EncoderLVDS    EncoderType = 3
	EncoderTVDAC   EncoderType = 4
	EncoderVirtual EncoderType = 5
	EncoderDSI     EncoderType = 6
	EncoderDPMST   EncoderType = 7
	EncoderDPI     EncoderType = 8
)

func (t EncoderType) String() string {
	switch t {
	case EncoderNone:
		return "none"
	case EncoderDAC:
		return "DAC"
	case EncoderTDMS:
		return "TDMS"
	case EncoderLVDS:
		return "LVDS"
	case EncoderTVDAC:
		return "TV DAC"
	case EncoderVirtual:
		return "virtual"
	case EncoderDSI:
		return "DSI"
	case EncoderDPMST:
		return "DP MST"
	case EncoderDPI:
		return "DPI"
	default:
		return "unknown"
	}
}

type ConnectorStatus uint32

const (
	ConnectorStatusConnected    ConnectorStatus = 1
	ConnectorStatusDisconnected ConnectorStatus = 2
	ConnectorStatusUnknown      ConnectorStatus = 3
)

func (s ConnectorStatus) String() string {
	switch s {
	case ConnectorStatusConnected:
		return "connected"
	case ConnectorStatusDisconnected:
		return "disconnected"
	default:
		return "unknown"
	}
}

type Subpixel uint32

const (
	SubpixelUnknown       Subpixel = 0
	SubpixelHorizontalRGB Subpixel = 1
	SubpixelHorizontalBGR Subpixel = 3
	SubpixelVerticalRGB   Subpixel = 4
	SubpixelVerticalBGR   Subpixel = 5
	SubpixelNone          Subpixel = 6
)

func (s Subpixel) String() string {
	switch s {
	case SubpixelHorizontalRGB:
		return "horizontal RGB"
	case SubpixelHorizontalBGR:
		return "horizontal BGR"
	case SubpixelVerticalRGB:
		return "vertical RGB"
	case SubpixelVerticalBGR:
		return "vertical BGR"
	case SubpixelNone:
		return "none"
	default:
		return "unknown"
	}
}

type PlaneType uint32

const (
	PlaneOverlay PlaneType = 0
	PlanePrimary PlaneType = 1
	PlaneCursor  PlaneType = 2
)

func (t PlaneType) String() string {
	switch t {
	case PlaneOverlay:
		return "overlay"
	case PlanePrimary:
		return "primary"
	case PlaneCursor:
		return "cursor"
	default:
		return "unknown"
	}
}