blob: a32902f73289368b9e2215a368c5a878e054f7af [file] [log] [blame]
Jesse Barnes731cd552008-12-17 10:09:49 -08001/*
2 * \file xf86drmMode.h
3 * Header for DRM modesetting interface.
4 *
5 * \author Jakob Bornecrantz <wallbraker@gmail.com>
6 *
7 * \par Acknowledgements:
8 * Feb 2007, Dave Airlie <airlied@linux.ie>
9 */
10
11/*
12 * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
13 * Copyright (c) 2007-2008 Dave Airlie <airlied@linux.ie>
14 * Copyright (c) 2007-2008 Jakob Bornecrantz <wallbraker@gmail.com>
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining a
17 * copy of this software and associated documentation files (the "Software"),
18 * to deal in the Software without restriction, including without limitation
19 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 * and/or sell copies of the Software, and to permit persons to whom the
21 * Software is furnished to do so, subject to the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be included in
24 * all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
32 * IN THE SOFTWARE.
33 *
34 */
35
David Herrmanfd39e612012-03-09 13:40:14 -050036#ifndef _XF86DRMMODE_H_
37#define _XF86DRMMODE_H_
38
Tapani Pälli1c205742015-08-07 10:37:56 +030039#if defined(__cplusplus)
Tapani Pällicfee5212011-09-23 14:17:42 +030040extern "C" {
41#endif
42
Jesse Barnes731cd552008-12-17 10:09:49 -080043#include <drm.h>
44
45/*
46 * This is the interface for modesetting for drm.
47 *
48 * In order to use this interface you must include either <stdint.h> or another
49 * header defining uint32_t, int32_t and uint16_t.
50 *
51 * It aims to provide a randr1.2 compatible interface for modesettings in the
Eric Engestrom360292c2018-12-19 14:55:45 +000052 * kernel, the interface is also meant to be used by libraries like EGL.
Jesse Barnes731cd552008-12-17 10:09:49 -080053 *
54 * More information can be found in randrproto.txt which can be found here:
55 * http://gitweb.freedesktop.org/?p=xorg/proto/randrproto.git
56 *
Eric Engestrom360292c2018-12-19 14:55:45 +000057 * There are some major differences to be noted. Unlike the randr1.2 proto you
Jesse Barnes731cd552008-12-17 10:09:49 -080058 * need to create the memory object of the framebuffer yourself with the ttm
59 * buffer object interface. This object needs to be pinned.
60 */
61
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +010062/*
63 * If we pickup an old version of drm.h which doesn't include drm_mode.h
64 * we should redefine defines. This is so that builds doesn't breaks with
65 * new libdrm on old kernels.
66 */
67#ifndef _DRM_MODE_H
68
69#define DRM_DISPLAY_INFO_LEN 32
70#define DRM_CONNECTOR_NAME_LEN 32
71#define DRM_DISPLAY_MODE_LEN 32
72#define DRM_PROP_NAME_LEN 32
73
74#define DRM_MODE_TYPE_BUILTIN (1<<0)
75#define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN)
76#define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN)
77#define DRM_MODE_TYPE_PREFERRED (1<<3)
78#define DRM_MODE_TYPE_DEFAULT (1<<4)
79#define DRM_MODE_TYPE_USERDEF (1<<5)
80#define DRM_MODE_TYPE_DRIVER (1<<6)
81
82/* Video mode flags */
83/* bit compatible with the xorg definitions. */
Damien Lespiauedf5c7c2013-08-23 15:57:40 +010084#define DRM_MODE_FLAG_PHSYNC (1<<0)
85#define DRM_MODE_FLAG_NHSYNC (1<<1)
86#define DRM_MODE_FLAG_PVSYNC (1<<2)
87#define DRM_MODE_FLAG_NVSYNC (1<<3)
88#define DRM_MODE_FLAG_INTERLACE (1<<4)
89#define DRM_MODE_FLAG_DBLSCAN (1<<5)
90#define DRM_MODE_FLAG_CSYNC (1<<6)
91#define DRM_MODE_FLAG_PCSYNC (1<<7)
92#define DRM_MODE_FLAG_NCSYNC (1<<8)
93#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
94#define DRM_MODE_FLAG_BCAST (1<<10)
95#define DRM_MODE_FLAG_PIXMUX (1<<11)
96#define DRM_MODE_FLAG_DBLCLK (1<<12)
97#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
98#define DRM_MODE_FLAG_3D_MASK (0x1f<<14)
99#define DRM_MODE_FLAG_3D_NONE (0<<14)
100#define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14)
101#define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14)
102#define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14)
103#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14)
104#define DRM_MODE_FLAG_3D_L_DEPTH (5<<14)
105#define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14)
106#define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14)
107#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14)
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100108
109/* DPMS flags */
110/* bit compatible with the xorg definitions. */
111#define DRM_MODE_DPMS_ON 0
112#define DRM_MODE_DPMS_STANDBY 1
113#define DRM_MODE_DPMS_SUSPEND 2
114#define DRM_MODE_DPMS_OFF 3
115
116/* Scaling mode options */
117#define DRM_MODE_SCALE_NON_GPU 0
118#define DRM_MODE_SCALE_FULLSCREEN 1
119#define DRM_MODE_SCALE_NO_SCALE 2
120#define DRM_MODE_SCALE_ASPECT 3
121
122/* Dithering mode options */
123#define DRM_MODE_DITHERING_OFF 0
124#define DRM_MODE_DITHERING_ON 1
125
Thierry Redingab50ffb2014-12-17 11:52:40 +0100126#define DRM_MODE_ENCODER_NONE 0
127#define DRM_MODE_ENCODER_DAC 1
128#define DRM_MODE_ENCODER_TMDS 2
129#define DRM_MODE_ENCODER_LVDS 3
130#define DRM_MODE_ENCODER_TVDAC 4
Thomas Hellstromc6014442013-11-19 07:50:11 +0100131#define DRM_MODE_ENCODER_VIRTUAL 5
Thierry Redingab50ffb2014-12-17 11:52:40 +0100132#define DRM_MODE_ENCODER_DSI 6
Thierry Reding4bfbe4c2014-12-17 11:53:31 +0100133#define DRM_MODE_ENCODER_DPMST 7
134#define DRM_MODE_ENCODER_DPI 8
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100135
136#define DRM_MODE_SUBCONNECTOR_Automatic 0
137#define DRM_MODE_SUBCONNECTOR_Unknown 0
138#define DRM_MODE_SUBCONNECTOR_DVID 3
139#define DRM_MODE_SUBCONNECTOR_DVIA 4
140#define DRM_MODE_SUBCONNECTOR_Composite 5
141#define DRM_MODE_SUBCONNECTOR_SVIDEO 6
142#define DRM_MODE_SUBCONNECTOR_Component 8
Thomas Hellstromc6014442013-11-19 07:50:11 +0100143#define DRM_MODE_SUBCONNECTOR_SCART 9
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100144
145#define DRM_MODE_CONNECTOR_Unknown 0
146#define DRM_MODE_CONNECTOR_VGA 1
147#define DRM_MODE_CONNECTOR_DVII 2
148#define DRM_MODE_CONNECTOR_DVID 3
149#define DRM_MODE_CONNECTOR_DVIA 4
150#define DRM_MODE_CONNECTOR_Composite 5
151#define DRM_MODE_CONNECTOR_SVIDEO 6
152#define DRM_MODE_CONNECTOR_LVDS 7
153#define DRM_MODE_CONNECTOR_Component 8
154#define DRM_MODE_CONNECTOR_9PinDIN 9
155#define DRM_MODE_CONNECTOR_DisplayPort 10
156#define DRM_MODE_CONNECTOR_HDMIA 11
157#define DRM_MODE_CONNECTOR_HDMIB 12
Thierry Redingab50ffb2014-12-17 11:52:40 +0100158#define DRM_MODE_CONNECTOR_TV 13
159#define DRM_MODE_CONNECTOR_eDP 14
Thomas Hellstromc6014442013-11-19 07:50:11 +0100160#define DRM_MODE_CONNECTOR_VIRTUAL 15
161#define DRM_MODE_CONNECTOR_DSI 16
Thierry Reding4bfbe4c2014-12-17 11:53:31 +0100162#define DRM_MODE_CONNECTOR_DPI 17
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100163
164#define DRM_MODE_PROP_PENDING (1<<0)
165#define DRM_MODE_PROP_RANGE (1<<1)
166#define DRM_MODE_PROP_IMMUTABLE (1<<2)
167#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
168#define DRM_MODE_PROP_BLOB (1<<4)
169
170#define DRM_MODE_CURSOR_BO (1<<0)
171#define DRM_MODE_CURSOR_MOVE (1<<1)
172
173#endif /* _DRM_MODE_H */
174
Jakob Bornecrantz3e486132009-11-24 18:00:12 +0100175
176/*
177 * Feature defines
178 *
179 * Just because these are defined doesn't mean that the kernel
180 * can do that feature, its just for new code vs old libdrm.
181 */
182#define DRM_MODE_FEATURE_KMS 1
183#define DRM_MODE_FEATURE_DIRTYFB 1
184
185
Jesse Barnes731cd552008-12-17 10:09:49 -0800186typedef struct _drmModeRes {
187
188 int count_fbs;
189 uint32_t *fbs;
190
191 int count_crtcs;
192 uint32_t *crtcs;
193
194 int count_connectors;
195 uint32_t *connectors;
196
197 int count_encoders;
198 uint32_t *encoders;
199
200 uint32_t min_width, max_width;
201 uint32_t min_height, max_height;
202} drmModeRes, *drmModeResPtr;
203
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100204typedef struct _drmModeModeInfo {
205 uint32_t clock;
206 uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew;
207 uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan;
208
Marcin Kościelnicki694ef592010-02-27 15:04:42 +0000209 uint32_t vrefresh;
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100210
211 uint32_t flags;
212 uint32_t type;
213 char name[DRM_DISPLAY_MODE_LEN];
214} drmModeModeInfo, *drmModeModeInfoPtr;
215
216typedef struct _drmModeFB {
217 uint32_t fb_id;
218 uint32_t width, height;
219 uint32_t pitch;
220 uint32_t bpp;
221 uint32_t depth;
222 /* driver specific handle */
223 uint32_t handle;
224} drmModeFB, *drmModeFBPtr;
Jesse Barnes731cd552008-12-17 10:09:49 -0800225
Jakob Bornecrantz3e486132009-11-24 18:00:12 +0100226typedef struct drm_clip_rect drmModeClip, *drmModeClipPtr;
227
Jesse Barnes731cd552008-12-17 10:09:49 -0800228typedef struct _drmModePropertyBlob {
229 uint32_t id;
230 uint32_t length;
231 void *data;
232} drmModePropertyBlobRes, *drmModePropertyBlobPtr;
233
234typedef struct _drmModeProperty {
235 uint32_t prop_id;
236 uint32_t flags;
237 char name[DRM_PROP_NAME_LEN];
238 int count_values;
Daniel Kurtz0f4452b2013-08-26 23:39:16 +0800239 uint64_t *values; /* store the blob lengths */
Jesse Barnes731cd552008-12-17 10:09:49 -0800240 int count_enums;
241 struct drm_mode_property_enum *enums;
242 int count_blobs;
Daniel Kurtz0f4452b2013-08-26 23:39:16 +0800243 uint32_t *blob_ids; /* store the blob IDs */
Jesse Barnes731cd552008-12-17 10:09:49 -0800244} drmModePropertyRes, *drmModePropertyPtr;
245
Daniel Kurtzd20314d2015-03-24 18:01:02 -0700246static __inline int drm_property_type_is(drmModePropertyPtr property,
Rob Clarkfb417702013-10-12 12:16:44 -0400247 uint32_t type)
248{
249 /* instanceof for props.. handles extended type vs original types: */
250 if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
251 return (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type;
252 return property->flags & type;
253}
254
Jesse Barnes731cd552008-12-17 10:09:49 -0800255typedef struct _drmModeCrtc {
256 uint32_t crtc_id;
257 uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */
258
259 uint32_t x, y; /**< Position on the framebuffer */
260 uint32_t width, height;
261 int mode_valid;
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100262 drmModeModeInfo mode;
Jesse Barnes731cd552008-12-17 10:09:49 -0800263
264 int gamma_size; /**< Number of gamma stops */
265
266} drmModeCrtc, *drmModeCrtcPtr;
267
268typedef struct _drmModeEncoder {
269 uint32_t encoder_id;
270 uint32_t encoder_type;
271 uint32_t crtc_id;
272 uint32_t possible_crtcs;
273 uint32_t possible_clones;
274} drmModeEncoder, *drmModeEncoderPtr;
275
276typedef enum {
277 DRM_MODE_CONNECTED = 1,
278 DRM_MODE_DISCONNECTED = 2,
279 DRM_MODE_UNKNOWNCONNECTION = 3
280} drmModeConnection;
281
282typedef enum {
283 DRM_MODE_SUBPIXEL_UNKNOWN = 1,
284 DRM_MODE_SUBPIXEL_HORIZONTAL_RGB = 2,
285 DRM_MODE_SUBPIXEL_HORIZONTAL_BGR = 3,
286 DRM_MODE_SUBPIXEL_VERTICAL_RGB = 4,
287 DRM_MODE_SUBPIXEL_VERTICAL_BGR = 5,
288 DRM_MODE_SUBPIXEL_NONE = 6
289} drmModeSubPixel;
290
291typedef struct _drmModeConnector {
292 uint32_t connector_id;
293 uint32_t encoder_id; /**< Encoder currently connected to */
294 uint32_t connector_type;
295 uint32_t connector_type_id;
296 drmModeConnection connection;
297 uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
298 drmModeSubPixel subpixel;
299
300 int count_modes;
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100301 drmModeModeInfoPtr modes;
Jesse Barnes731cd552008-12-17 10:09:49 -0800302
303 int count_props;
304 uint32_t *props; /**< List of property ids */
305 uint64_t *prop_values; /**< List of property values */
306
307 int count_encoders;
308 uint32_t *encoders; /**< List of encoder ids */
309} drmModeConnector, *drmModeConnectorPtr;
310
Matt Roper8fc62ca2014-04-10 14:23:12 -0700311#define DRM_PLANE_TYPE_OVERLAY 0
312#define DRM_PLANE_TYPE_PRIMARY 1
313#define DRM_PLANE_TYPE_CURSOR 2
314
Paulo Zanoni8c757032012-05-15 18:38:28 -0300315typedef struct _drmModeObjectProperties {
316 uint32_t count_props;
317 uint32_t *props;
318 uint64_t *prop_values;
319} drmModeObjectProperties, *drmModeObjectPropertiesPtr;
320
Jesse Barnesac168bf2011-04-29 08:53:53 -0700321typedef struct _drmModePlane {
322 uint32_t count_formats;
323 uint32_t *formats;
324 uint32_t plane_id;
Jesse Barnes731cd552008-12-17 10:09:49 -0800325
Jesse Barnesac168bf2011-04-29 08:53:53 -0700326 uint32_t crtc_id;
327 uint32_t fb_id;
328
329 uint32_t crtc_x, crtc_y;
330 uint32_t x, y;
331
332 uint32_t possible_crtcs;
333 uint32_t gamma_size;
334} drmModePlane, *drmModePlanePtr;
335
336typedef struct _drmModePlaneRes {
337 uint32_t count_planes;
338 uint32_t *planes;
339} drmModePlaneRes, *drmModePlaneResPtr;
Jesse Barnes731cd552008-12-17 10:09:49 -0800340
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100341extern void drmModeFreeModeInfo( drmModeModeInfoPtr ptr );
Jesse Barnes731cd552008-12-17 10:09:49 -0800342extern void drmModeFreeResources( drmModeResPtr ptr );
343extern void drmModeFreeFB( drmModeFBPtr ptr );
344extern void drmModeFreeCrtc( drmModeCrtcPtr ptr );
345extern void drmModeFreeConnector( drmModeConnectorPtr ptr );
346extern void drmModeFreeEncoder( drmModeEncoderPtr ptr );
Jesse Barnesac168bf2011-04-29 08:53:53 -0700347extern void drmModeFreePlane( drmModePlanePtr ptr );
Ville Syrjäläa14c3dd2012-02-02 14:53:41 -0500348extern void drmModeFreePlaneResources(drmModePlaneResPtr ptr);
Jesse Barnes731cd552008-12-17 10:09:49 -0800349
350/**
Eric Engestrom360292c2018-12-19 14:55:45 +0000351 * Retrieves all of the resources associated with a card.
Jesse Barnes731cd552008-12-17 10:09:49 -0800352 */
353extern drmModeResPtr drmModeGetResources(int fd);
354
355/*
356 * FrameBuffer manipulation.
357 */
358
359/**
Eric Engestrom360292c2018-12-19 14:55:45 +0000360 * Retrieve information about framebuffer bufferId
Jesse Barnes731cd552008-12-17 10:09:49 -0800361 */
362extern drmModeFBPtr drmModeGetFB(int fd, uint32_t bufferId);
363
364/**
365 * Creates a new framebuffer with an buffer object as its scanout buffer.
366 */
367extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
368 uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
369 uint32_t *buf_id);
Jesse Barnesac168bf2011-04-29 08:53:53 -0700370/* ...with a specific pixel format */
371extern int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
Tobias Jakobi09be5412017-10-10 12:12:52 +0200372 uint32_t pixel_format, const uint32_t bo_handles[4],
373 const uint32_t pitches[4], const uint32_t offsets[4],
Jesse Barnesac168bf2011-04-29 08:53:53 -0700374 uint32_t *buf_id, uint32_t flags);
Kristian H. Kristensenabfa6802016-09-08 13:08:59 -0700375
376/* ...with format modifiers */
377int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
Tobias Jakobi09be5412017-10-10 12:12:52 +0200378 uint32_t pixel_format, const uint32_t bo_handles[4],
379 const uint32_t pitches[4], const uint32_t offsets[4],
380 const uint64_t modifier[4], uint32_t *buf_id,
381 uint32_t flags);
Kristian H. Kristensenabfa6802016-09-08 13:08:59 -0700382
Jesse Barnes731cd552008-12-17 10:09:49 -0800383/**
384 * Destroies the given framebuffer.
385 */
386extern int drmModeRmFB(int fd, uint32_t bufferId);
387
Jakob Bornecrantz3e486132009-11-24 18:00:12 +0100388/**
389 * Mark a region of a framebuffer as dirty.
390 */
391extern int drmModeDirtyFB(int fd, uint32_t bufferId,
392 drmModeClipPtr clips, uint32_t num_clips);
393
394
Jesse Barnes731cd552008-12-17 10:09:49 -0800395/*
396 * Crtc functions
397 */
398
399/**
Eric Engestrom360292c2018-12-19 14:55:45 +0000400 * Retrieve information about the ctrt crtcId
Jesse Barnes731cd552008-12-17 10:09:49 -0800401 */
402extern drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId);
403
404/**
405 * Set the mode on a crtc crtcId with the given mode modeId.
406 */
407int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
408 uint32_t x, uint32_t y, uint32_t *connectors, int count,
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100409 drmModeModeInfoPtr mode);
Jesse Barnes731cd552008-12-17 10:09:49 -0800410
411/*
412 * Cursor functions
413 */
414
415/**
416 * Set the cursor on crtc
417 */
418int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height);
419
Dave Airlie2e0ab622013-07-02 09:21:06 +0100420int drmModeSetCursor2(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height, int32_t hot_x, int32_t hot_y);
Jesse Barnes731cd552008-12-17 10:09:49 -0800421/**
422 * Move the cursor on crtc
423 */
424int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y);
425
426/**
427 * Encoder functions
428 */
429drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id);
430
431/*
432 * Connector manipulation
433 */
434
435/**
Chris Wilson5ed5fa12015-03-04 10:07:19 +0000436 * Retrieve all information about the connector connectorId. This will do a
437 * forced probe on the connector to retrieve remote information such as EDIDs
438 * from the display device.
Jesse Barnes731cd552008-12-17 10:09:49 -0800439 */
440extern drmModeConnectorPtr drmModeGetConnector(int fd,
Chris Wilson5ed5fa12015-03-04 10:07:19 +0000441 uint32_t connectorId);
442
443/**
444 * Retrieve current information, i.e the currently active mode and encoder,
445 * about the connector connectorId. This will not do any probing on the
446 * connector or remote device, and only reports what is currently known.
447 * For the complete set of modes and encoders associated with the connector
448 * use drmModeGetConnector() which will do a probe to determine any display
449 * link changes first.
450 */
451extern drmModeConnectorPtr drmModeGetConnectorCurrent(int fd,
452 uint32_t connector_id);
Jesse Barnes731cd552008-12-17 10:09:49 -0800453
454/**
455 * Attaches the given mode to an connector.
456 */
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100457extern int drmModeAttachMode(int fd, uint32_t connectorId, drmModeModeInfoPtr mode_info);
Jesse Barnes731cd552008-12-17 10:09:49 -0800458
459/**
460 * Detaches a mode from the connector
461 * must be unused, by the given mode.
462 */
Jakob Bornecrantzeb78c532009-02-11 16:43:20 +0100463extern int drmModeDetachMode(int fd, uint32_t connectorId, drmModeModeInfoPtr mode_info);
Jesse Barnes731cd552008-12-17 10:09:49 -0800464
465extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId);
466extern void drmModeFreeProperty(drmModePropertyPtr ptr);
467
468extern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id);
469extern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr);
470extern int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id,
471 uint64_t value);
472extern int drmCheckModesettingSupported(const char *busid);
473
474extern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
475 uint16_t *red, uint16_t *green, uint16_t *blue);
476extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
477 uint16_t *red, uint16_t *green, uint16_t *blue);
Kristian Høgsbergb80bcff2009-11-12 14:06:45 -0500478extern int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
479 uint32_t flags, void *user_data);
Michel Dänzer7dd28472016-06-29 18:07:25 +0900480extern int drmModePageFlipTarget(int fd, uint32_t crtc_id, uint32_t fb_id,
481 uint32_t flags, void *user_data,
482 uint32_t target_vblank);
Tapani Pällicfee5212011-09-23 14:17:42 +0300483
Jesse Barnesac168bf2011-04-29 08:53:53 -0700484extern drmModePlaneResPtr drmModeGetPlaneResources(int fd);
485extern drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id);
486extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
487 uint32_t fb_id, uint32_t flags,
Daniel Kurtz828c3e82014-05-01 19:56:43 +0800488 int32_t crtc_x, int32_t crtc_y,
Jesse Barnesac168bf2011-04-29 08:53:53 -0700489 uint32_t crtc_w, uint32_t crtc_h,
490 uint32_t src_x, uint32_t src_y,
491 uint32_t src_w, uint32_t src_h);
492
Paulo Zanoni8c757032012-05-15 18:38:28 -0300493extern drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,
494 uint32_t object_id,
495 uint32_t object_type);
496extern void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr);
497extern int drmModeObjectSetProperty(int fd, uint32_t object_id,
498 uint32_t object_type, uint32_t property_id,
499 uint64_t value);
500
Ville Syrjäläed44e0b2015-06-22 17:26:02 +0100501
502typedef struct _drmModeAtomicReq drmModeAtomicReq, *drmModeAtomicReqPtr;
503
504extern drmModeAtomicReqPtr drmModeAtomicAlloc(void);
505extern drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr req);
506extern int drmModeAtomicMerge(drmModeAtomicReqPtr base,
507 drmModeAtomicReqPtr augment);
508extern void drmModeAtomicFree(drmModeAtomicReqPtr req);
509extern int drmModeAtomicGetCursor(drmModeAtomicReqPtr req);
510extern void drmModeAtomicSetCursor(drmModeAtomicReqPtr req, int cursor);
511extern int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
512 uint32_t object_id,
513 uint32_t property_id,
514 uint64_t value);
515extern int drmModeAtomicCommit(int fd,
516 drmModeAtomicReqPtr req,
517 uint32_t flags,
518 void *user_data);
519
Daniel Stone32471b22015-06-22 17:26:03 +0100520extern int drmModeCreatePropertyBlob(int fd, const void *data, size_t size,
521 uint32_t *id);
522extern int drmModeDestroyPropertyBlob(int fd, uint32_t id);
523
Keith Packardc4171532017-03-16 18:11:05 -0700524/*
525 * DRM mode lease APIs. These create and manage new drm_masters with
526 * access to a subset of the available DRM resources
527 */
528
529extern int drmModeCreateLease(int fd, const uint32_t *objects, int num_objects, int flags, uint32_t *lessee_id);
530
531typedef struct drmModeLesseeList {
532 uint32_t count;
533 uint32_t lessees[0];
534} drmModeLesseeListRes, *drmModeLesseeListPtr;
535
536extern drmModeLesseeListPtr drmModeListLessees(int fd);
537
538typedef struct drmModeObjectList {
539 uint32_t count;
540 uint32_t objects[0];
541} drmModeObjectListRes, *drmModeObjectListPtr;
542
543extern drmModeObjectListPtr drmModeGetLease(int fd);
544
545extern int drmModeRevokeLease(int fd, uint32_t lessee_id);
Daniel Stone32471b22015-06-22 17:26:03 +0100546
Tapani Pälli1c205742015-08-07 10:37:56 +0300547#if defined(__cplusplus)
Tapani Pällicfee5212011-09-23 14:17:42 +0300548}
549#endif
David Herrmanfd39e612012-03-09 13:40:14 -0500550
551#endif