Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / hidds / nouveau / drm / libdrm / arosdrmmode.h
blob1e6c9ba3e322c43f656a3078a740106082b3bd62
1 /*
2 * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
3 * Copyright (c) 2007-2008 Dave Airlie <airlied@linux.ie>
4 * Copyright (c) 2007-2008 Jakob Bornecrantz <wallbraker@gmail.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
26 #include <drm.h>
28 typedef struct _drmModeRes {
30 int count_fbs;
31 uint32_t *fbs;
33 int count_crtcs;
34 uint32_t *crtcs;
36 int count_connectors;
37 uint32_t *connectors;
39 int count_encoders;
40 uint32_t *encoders;
42 uint32_t min_width, max_width;
43 uint32_t min_height, max_height;
44 } drmModeRes, *drmModeResPtr;
46 typedef struct _drmModeModeInfo {
47 uint32_t clock;
48 uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew;
49 uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan;
51 uint32_t vrefresh; /* vertical refresh * 1000 */
53 uint32_t flags;
54 uint32_t type;
55 char name[DRM_DISPLAY_MODE_LEN];
56 } drmModeModeInfo, *drmModeModeInfoPtr;
58 typedef struct _drmModeEncoder {
59 uint32_t encoder_id;
60 uint32_t encoder_type;
61 uint32_t crtc_id;
62 uint32_t possible_crtcs;
63 uint32_t possible_clones;
64 } drmModeEncoder, *drmModeEncoderPtr;
66 typedef enum {
67 DRM_MODE_CONNECTED = 1,
68 DRM_MODE_DISCONNECTED = 2,
69 DRM_MODE_UNKNOWNCONNECTION = 3
70 } drmModeConnection;
72 typedef enum {
73 DRM_MODE_SUBPIXEL_UNKNOWN = 1,
74 DRM_MODE_SUBPIXEL_HORIZONTAL_RGB = 2,
75 DRM_MODE_SUBPIXEL_HORIZONTAL_BGR = 3,
76 DRM_MODE_SUBPIXEL_VERTICAL_RGB = 4,
77 DRM_MODE_SUBPIXEL_VERTICAL_BGR = 5,
78 DRM_MODE_SUBPIXEL_NONE = 6
79 } drmModeSubPixel;
81 typedef struct _drmModeConnector {
82 uint32_t connector_id;
83 uint32_t encoder_id; /**< Encoder currently connected to */
84 uint32_t connector_type;
85 uint32_t connector_type_id;
86 drmModeConnection connection;
87 uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
88 drmModeSubPixel subpixel;
90 int count_modes;
91 drmModeModeInfoPtr modes;
93 int count_props;
94 uint32_t *props; /**< List of property ids */
95 uint64_t *prop_values; /**< List of property values */
97 int count_encoders;
98 uint32_t *encoders; /**< List of encoder ids */
99 } drmModeConnector, *drmModeConnectorPtr;
101 typedef struct _drmModeCrtc {
102 uint32_t crtc_id;
103 uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */
105 uint32_t x, y; /**< Position on the framebuffer */
106 uint32_t width, height;
107 int mode_valid;
108 drmModeModeInfo mode;
110 int gamma_size; /**< Number of gamma stops */
112 } drmModeCrtc, *drmModeCrtcPtr;
114 /* Add passed bo (handle) to list of frame buffers */
115 extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
116 uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
117 uint32_t *buf_id);
118 extern int drmModeRmFB(int fd, uint32_t bufferId);
120 /* Gets information about all resources of card:
121 framebuffers
122 crtcs
123 connectors
124 encoders */
125 extern drmModeResPtr drmModeGetResources(int fd);
126 extern void drmModeFreeResources(drmModeResPtr ptr);
128 /* Connector support */
129 extern drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connectorId);
130 extern void drmModeFreeConnector(drmModeConnectorPtr ptr);
132 /* CRTC support */ /* bufferId == id of nouveau_bo registered using drmModeAddFB */
133 extern int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
134 uint32_t x, uint32_t y, uint32_t *connectors, int count,
135 drmModeModeInfoPtr mode);
136 extern drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId);
137 extern void drmModeFreeCrtc( drmModeCrtcPtr ptr );
139 /* Encoder support */
140 extern drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id);
141 extern void drmModeFreeEncoder(drmModeEncoderPtr ptr);
143 /* Cursor support */
144 extern int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle,
145 uint32_t width, uint32_t height);
146 extern int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y);