Subversion Repositories Kolibri OS

Rev

Rev 4559 | Rev 5270 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1408 serge 1
/*
2
 * Copyright © 2006 Keith Packard
3
 * Copyright © 2007-2008 Dave Airlie
4
 * Copyright © 2007-2008 Intel Corporation
5
 *   Jesse Barnes 
6
 *
7
 * Permission is hereby granted, free of charge, to any person obtaining a
8
 * copy of this software and associated documentation files (the "Software"),
9
 * to deal in the Software without restriction, including without limitation
10
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
 * and/or sell copies of the Software, and to permit persons to whom the
12
 * Software is furnished to do so, subject to the following conditions:
13
 *
14
 * The above copyright notice and this permission notice shall be included in
15
 * all copies or substantial portions of the Software.
16
 *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
 * OTHER DEALINGS IN THE SOFTWARE.
24
 */
25
#ifndef __DRM_CRTC_H__
26
#define __DRM_CRTC_H__
27
 
28
#include 
1630 serge 29
#include 
1408 serge 30
#include 
31
#include 
32
#include 
4559 Serge 33
#include 
3031 serge 34
#include 
2967 Serge 35
#include 
5056 serge 36
#include 
2967 Serge 37
 
1408 serge 38
struct drm_device;
39
struct drm_mode_set;
40
struct drm_framebuffer;
3031 serge 41
struct drm_object_properties;
3391 Serge 42
struct drm_file;
43
struct drm_clip_rect;
5056 serge 44
struct device_node;
1408 serge 45
 
46
#define DRM_MODE_OBJECT_CRTC 0xcccccccc
47
#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
48
#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
49
#define DRM_MODE_OBJECT_MODE 0xdededede
50
#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
51
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
52
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
2967 Serge 53
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
4103 Serge 54
#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd
5056 serge 55
#define DRM_MODE_OBJECT_ANY 0
1408 serge 56
 
57
struct drm_mode_object {
58
	uint32_t id;
59
	uint32_t type;
3031 serge 60
	struct drm_object_properties *properties;
1408 serge 61
};
62
 
3031 serge 63
#define DRM_OBJECT_MAX_PROPERTY 24
64
struct drm_object_properties {
65
	int count;
66
	uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
67
	uint64_t values[DRM_OBJECT_MAX_PROPERTY];
68
};
69
 
5056 serge 70
static inline int64_t U642I64(uint64_t val)
71
{
72
	return (int64_t)*((int64_t *)&val);
73
}
74
static inline uint64_t I642U64(int64_t val)
75
{
76
	return (uint64_t)*((uint64_t *)&val);
77
}
1408 serge 78
 
5056 serge 79
/* rotation property bits */
80
#define DRM_ROTATE_0	0
81
#define DRM_ROTATE_90	1
82
#define DRM_ROTATE_180	2
83
#define DRM_ROTATE_270	3
84
#define DRM_REFLECT_X	4
85
#define DRM_REFLECT_Y	5
1408 serge 86
 
5056 serge 87
enum drm_connector_force {
88
	DRM_FORCE_UNSPECIFIED,
89
	DRM_FORCE_OFF,
90
	DRM_FORCE_ON,         /* force on analog part normally */
91
	DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
1408 serge 92
};
93
 
5056 serge 94
#include 
4559 Serge 95
 
1408 serge 96
enum drm_connector_status {
97
	connector_status_connected = 1,
98
	connector_status_disconnected = 2,
99
	connector_status_unknown = 3,
100
};
101
 
102
enum subpixel_order {
103
	SubPixelUnknown = 0,
104
	SubPixelHorizontalRGB,
105
	SubPixelHorizontalBGR,
106
	SubPixelVerticalRGB,
107
	SubPixelVerticalBGR,
108
	SubPixelNone,
109
};
110
 
1964 serge 111
#define DRM_COLOR_FORMAT_RGB444		(1<<0)
112
#define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
113
#define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
1408 serge 114
/*
115
 * Describes a given display (e.g. CRT or flat panel) and its limitations.
116
 */
117
struct drm_display_info {
118
	char name[DRM_DISPLAY_INFO_LEN];
1964 serge 119
 
1408 serge 120
	/* Physical size */
121
        unsigned int width_mm;
122
	unsigned int height_mm;
123
 
124
	/* Clock limits FIXME: storage format */
125
	unsigned int min_vfreq, max_vfreq;
126
	unsigned int min_hfreq, max_hfreq;
127
	unsigned int pixel_clock;
1964 serge 128
	unsigned int bpc;
1408 serge 129
 
130
	enum subpixel_order subpixel_order;
1964 serge 131
	u32 color_formats;
1408 serge 132
 
5056 serge 133
	/* Mask of supported hdmi deep color modes */
134
	u8 edid_hdmi_dc_modes;
135
 
2161 serge 136
	u8 cea_rev;
1408 serge 137
};
138
 
139
struct drm_framebuffer_funcs {
3031 serge 140
	/* note: use drm_framebuffer_remove() */
1408 serge 141
	void (*destroy)(struct drm_framebuffer *framebuffer);
142
	int (*create_handle)(struct drm_framebuffer *fb,
143
			     struct drm_file *file_priv,
144
			     unsigned int *handle);
145
	/**
146
	 * Optinal callback for the dirty fb ioctl.
147
	 *
148
	 * Userspace can notify the driver via this callback
149
	 * that a area of the framebuffer has changed and should
150
	 * be flushed to the display hardware.
151
	 *
152
	 * See documentation in drm_mode.h for the struct
153
	 * drm_mode_fb_dirty_cmd for more information as all
154
	 * the semantics and arguments have a one to one mapping
155
	 * on this function.
156
	 */
1964 serge 157
	int (*dirty)(struct drm_framebuffer *framebuffer,
158
		     struct drm_file *file_priv, unsigned flags,
1408 serge 159
		     unsigned color, struct drm_clip_rect *clips,
160
		     unsigned num_clips);
161
};
162
 
163
struct drm_framebuffer {
164
	struct drm_device *dev;
3262 Serge 165
	/*
166
	 * Note that the fb is refcounted for the benefit of driver internals,
167
	 * for example some hw, disabling a CRTC/plane is asynchronous, and
168
	 * scanout does not actually complete until the next vblank.  So some
169
	 * cleanup (like releasing the reference(s) on the backing GEM bo(s))
170
	 * should be deferred.  In cases like this, the driver would like to
171
	 * hold a ref to the fb even though it has already been removed from
172
	 * userspace perspective.
173
	 */
174
	struct kref refcount;
3391 Serge 175
	/*
176
	 * Place on the dev->mode_config.fb_list, access protected by
177
	 * dev->mode_config.fb_lock.
178
	 */
1408 serge 179
	struct list_head head;
180
	struct drm_mode_object base;
181
	const struct drm_framebuffer_funcs *funcs;
2967 Serge 182
	unsigned int pitches[4];
183
	unsigned int offsets[4];
1408 serge 184
	unsigned int width;
185
	unsigned int height;
186
	/* depth can be 15 or 16 */
187
	unsigned int depth;
188
	int bits_per_pixel;
189
	int flags;
2967 Serge 190
	uint32_t pixel_format; /* fourcc format */
1408 serge 191
	struct list_head filp_head;
192
	/* if you are using the helper */
193
	void *helper_private;
194
};
195
 
196
struct drm_property_blob {
197
	struct drm_mode_object base;
198
	struct list_head head;
199
	unsigned int length;
3031 serge 200
	unsigned char data[];
1408 serge 201
};
202
 
203
struct drm_property_enum {
204
	uint64_t value;
205
	struct list_head head;
206
	char name[DRM_PROP_NAME_LEN];
207
};
208
 
209
struct drm_property {
210
    struct      list_head head;
211
    struct      drm_mode_object base;
212
    uint32_t    flags;
213
    char        name[DRM_PROP_NAME_LEN];
214
    uint32_t    num_values;
215
    uint64_t    *values;
5056 serge 216
	struct drm_device *dev;
1408 serge 217
 
218
	struct list_head enum_blob_list;
219
};
220
 
5056 serge 221
void drm_modeset_lock_all(struct drm_device *dev);
222
void drm_modeset_unlock_all(struct drm_device *dev);
223
void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
224
 
1408 serge 225
struct drm_crtc;