Subversion Repositories Kolibri OS

Rev

Rev 4393 | Rev 5056 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4393 Rev 4559
1
/**
1
/**
2
 * \file drmP.h
2
 * \file drmP.h
3
 * Private header for Direct Rendering Manager
3
 * Private header for Direct Rendering Manager
4
 *
4
 *
5
 * \author Rickard E. (Rik) Faith 
5
 * \author Rickard E. (Rik) Faith 
6
 * \author Gareth Hughes 
6
 * \author Gareth Hughes 
7
 */
7
 */
8
 
8
 
9
/*
9
/*
10
 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
10
 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11
 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
11
 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12
 * Copyright (c) 2009-2010, Code Aurora Forum.
12
 * Copyright (c) 2009-2010, Code Aurora Forum.
13
 * All rights reserved.
13
 * All rights reserved.
14
 *
14
 *
15
 * Permission is hereby granted, free of charge, to any person obtaining a
15
 * Permission is hereby granted, free of charge, to any person obtaining a
16
 * copy of this software and associated documentation files (the "Software"),
16
 * copy of this software and associated documentation files (the "Software"),
17
 * to deal in the Software without restriction, including without limitation
17
 * to deal in the Software without restriction, including without limitation
18
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
19
 * and/or sell copies of the Software, and to permit persons to whom the
19
 * and/or sell copies of the Software, and to permit persons to whom the
20
 * Software is furnished to do so, subject to the following conditions:
20
 * Software is furnished to do so, subject to the following conditions:
21
 *
21
 *
22
 * The above copyright notice and this permission notice (including the next
22
 * The above copyright notice and this permission notice (including the next
23
 * paragraph) shall be included in all copies or substantial portions of the
23
 * paragraph) shall be included in all copies or substantial portions of the
24
 * Software.
24
 * Software.
25
 *
25
 *
26
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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,
27
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
28
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
29
 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
29
 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
30
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32
 * OTHER DEALINGS IN THE SOFTWARE.
32
 * OTHER DEALINGS IN THE SOFTWARE.
33
 */
33
 */
34
 
34
 
35
#ifndef _DRM_P_H_
35
#ifndef _DRM_P_H_
36
#define _DRM_P_H_
36
#define _DRM_P_H_
37
 
37
 
38
#define iowrite32(v, addr)      writel((v), (addr))
38
#define iowrite32(v, addr)      writel((v), (addr))
39
 
39
 
40
#ifdef __KERNEL__
40
#ifdef __KERNEL__
41
#ifdef __alpha__
41
#ifdef __alpha__
42
/* add include of current.h so that "current" is defined
42
/* add include of current.h so that "current" is defined
43
 * before static inline funcs in wait.h. Doing this so we
43
 * before static inline funcs in wait.h. Doing this so we
44
 * can build the DRM (part of PI DRI). 4/21/2000 S + B */
44
 * can build the DRM (part of PI DRI). 4/21/2000 S + B */
45
#include 
45
#include 
46
#endif				/* __alpha__ */
46
#endif				/* __alpha__ */
47
 
47
 
48
#include 
48
#include 
49
 
49
 
50
#include 
50
#include 
51
#include 
51
#include 
52
#include 
52
#include 
53
#include 
53
#include 
54
#include 
54
#include 
55
#include 
55
#include 
56
#include 
56
#include 
57
#include 
57
#include 
58
 
58
 
59
#include 
59
#include 
60
#include 
60
#include 
61
 
61
 
62
//#include 
-
 
63
//#include 
62
#include 
64
//#include 
63
//#include 
65
//#include 
64
#include 
66
#include 
65
#include 
67
#include 
66
#include 
68
#include 
67
#include 
69
//#include     /* For (un)lock_kernel */
68
//#include     /* For (un)lock_kernel */
70
//#include 
69
//#include 
71
//#include 
-
 
72
//#include 
-
 
73
#include 
70
#include 
74
//#include 
71
//#include 
75
//#include 
72
//#include 
76
//#include 
73
//#include 
77
//#include 
74
//#include 
78
//#include 
75
//#include 
79
//#include 
76
//#include 
80
 
77
 
81
#include 
78
#include 
82
 
79
 
83
 
80
 
84
#include 
81
#include 
85
#include 
82
#include 
86
 
83
 
87
#include 
84
#include 
88
 
85
 
89
#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
86
#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
90
 
87
 
91
struct module;
88
struct module;
92
 
89
 
93
struct drm_file;
90
struct drm_file;
94
struct drm_device;
91
struct drm_device;
95
 
92
 
96
struct device_node;
93
struct device_node;
97
struct videomode;
94
struct videomode;
98
 
95
 
99
struct inode;
96
struct inode;
100
struct poll_table_struct;
97
struct poll_table_struct;
101
struct drm_lock_data;
98
struct drm_lock_data;
102
 
99
 
103
struct sg_table;
100
struct sg_table;
104
struct dma_buf;
101
struct dma_buf;
105
 
102
 
106
//#include 
103
//#include 
107
#include 
104
#include 
108
#include 
105
#include 
109
 
106
 
110
#define KHZ2PICOS(a) (1000000000UL/(a))
107
#define KHZ2PICOS(a) (1000000000UL/(a))
-
 
108
 
-
 
109
/* Flags and return codes for get_vblank_timestamp() driver function. */
-
 
110
#define DRM_CALLED_FROM_VBLIRQ 1
-
 
111
#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
-
 
112
#define DRM_VBLANKTIME_INVBL             (1 << 1)
-
 
113
 
111
 
114
 
112
/* get_scanout_position() return flags */
115
/* get_scanout_position() return flags */
113
#define DRM_SCANOUTPOS_VALID        (1 << 0)
116
#define DRM_SCANOUTPOS_VALID        (1 << 0)
114
#define DRM_SCANOUTPOS_INVBL        (1 << 1)
117
#define DRM_SCANOUTPOS_INVBL        (1 << 1)
115
#define DRM_SCANOUTPOS_ACCURATE     (1 << 2)
118
#define DRM_SCANOUTPOS_ACCURATE     (1 << 2)
116
 
119
 
117
 
120
 
118
 
121
 
119
#define DRM_UT_CORE 		0x01
122
#define DRM_UT_CORE 		0x01
120
#define DRM_UT_DRIVER		0x02
123
#define DRM_UT_DRIVER		0x02
121
#define DRM_UT_KMS          0x04
124
#define DRM_UT_KMS          0x04
122
#define DRM_UT_PRIME		0x08
125
#define DRM_UT_PRIME		0x08
123
/*
126
/*
124
 * Three debug levels are defined.
127
 * Three debug levels are defined.
125
 * drm_core, drm_driver, drm_kms
128
 * drm_core, drm_driver, drm_kms
126
 * drm_core level can be used in the generic drm code. For example:
129
 * drm_core level can be used in the generic drm code. For example:
127
 * 	drm_ioctl, drm_mm, drm_memory
130
 * 	drm_ioctl, drm_mm, drm_memory
128
 * The macro definition of DRM_DEBUG is used.
131
 * The macro definition of DRM_DEBUG is used.
129
 * 	DRM_DEBUG(fmt, args...)
132
 * 	DRM_DEBUG(fmt, args...)
130
 * 	The debug info by using the DRM_DEBUG can be obtained by adding
133
 * 	The debug info by using the DRM_DEBUG can be obtained by adding
131
 * 	the boot option of "drm.debug=1".
134
 * 	the boot option of "drm.debug=1".
132
 *
135
 *
133
 * drm_driver level can be used in the specific drm driver. It is used
136
 * drm_driver level can be used in the specific drm driver. It is used
134
 * to add the debug info related with the drm driver. For example:
137
 * to add the debug info related with the drm driver. For example:
135
 * i915_drv, i915_dma, i915_gem, radeon_drv,
138
 * i915_drv, i915_dma, i915_gem, radeon_drv,
136
 * 	The macro definition of DRM_DEBUG_DRIVER can be used.
139
 * 	The macro definition of DRM_DEBUG_DRIVER can be used.
137
 * 	DRM_DEBUG_DRIVER(fmt, args...)
140
 * 	DRM_DEBUG_DRIVER(fmt, args...)
138
 * 	The debug info by using the DRM_DEBUG_DRIVER can be obtained by
141
 * 	The debug info by using the DRM_DEBUG_DRIVER can be obtained by
139
 * 	adding the boot option of "drm.debug=0x02"
142
 * 	adding the boot option of "drm.debug=0x02"
140
 *
143
 *
141
 * drm_kms level can be used in the KMS code related with specific drm driver.
144
 * drm_kms level can be used in the KMS code related with specific drm driver.
142
 * It is used to add the debug info related with KMS mode. For example:
145
 * It is used to add the debug info related with KMS mode. For example:
143
 * the connector/crtc ,
146
 * the connector/crtc ,
144
 * 	The macro definition of DRM_DEBUG_KMS can be used.
147
 * 	The macro definition of DRM_DEBUG_KMS can be used.
145
 * 	DRM_DEBUG_KMS(fmt, args...)
148
 * 	DRM_DEBUG_KMS(fmt, args...)
146
 * 	The debug info by using the DRM_DEBUG_KMS can be obtained by
149
 * 	The debug info by using the DRM_DEBUG_KMS can be obtained by
147
 * 	adding the boot option of "drm.debug=0x04"
150
 * 	adding the boot option of "drm.debug=0x04"
148
 *
151
 *
149
 * If we add the boot option of "drm.debug=0x06", we can get the debug info by
152
 * If we add the boot option of "drm.debug=0x06", we can get the debug info by
150
 * using the DRM_DEBUG_KMS and DRM_DEBUG_DRIVER.
153
 * using the DRM_DEBUG_KMS and DRM_DEBUG_DRIVER.
151
 * If we add the boot option of "drm.debug=0x05", we can get the debug info by
154
 * If we add the boot option of "drm.debug=0x05", we can get the debug info by
152
 * using the DRM_DEBUG_KMS and DRM_DEBUG.
155
 * using the DRM_DEBUG_KMS and DRM_DEBUG.
153
 */
156
 */
154
 
157
 
155
extern __printf(4, 5)
158
extern __printf(4, 5)
156
void drm_ut_debug_printk(unsigned int request_level,
159
void drm_ut_debug_printk(unsigned int request_level,
157
				const char *prefix,
160
				const char *prefix,
158
				const char *function_name,
161
				const char *function_name,
159
				const char *format, ...);
162
				const char *format, ...);
160
extern __printf(2, 3)
163
extern __printf(2, 3)
161
int drm_err(const char *func, const char *format, ...);
164
int drm_err(const char *func, const char *format, ...);
162
 
165
 
163
/***********************************************************************/
166
/***********************************************************************/
164
/** \name DRM template customization defaults */
167
/** \name DRM template customization defaults */
165
/*@{*/
168
/*@{*/
166
 
169
 
167
/* driver capabilities and requirements mask */
170
/* driver capabilities and requirements mask */
168
#define DRIVER_USE_AGP     0x1
171
#define DRIVER_USE_AGP     0x1
169
#define DRIVER_REQUIRE_AGP 0x2
-
 
170
#define DRIVER_PCI_DMA     0x8
172
#define DRIVER_PCI_DMA     0x8
171
#define DRIVER_SG          0x10
173
#define DRIVER_SG          0x10
172
#define DRIVER_HAVE_DMA    0x20
174
#define DRIVER_HAVE_DMA    0x20
173
#define DRIVER_HAVE_IRQ    0x40
175
#define DRIVER_HAVE_IRQ    0x40
174
#define DRIVER_IRQ_SHARED  0x80
176
#define DRIVER_IRQ_SHARED  0x80
175
#define DRIVER_GEM         0x1000
177
#define DRIVER_GEM         0x1000
176
#define DRIVER_MODESET     0x2000
178
#define DRIVER_MODESET     0x2000
177
#define DRIVER_PRIME       0x4000
179
#define DRIVER_PRIME       0x4000
178
#define DRIVER_RENDER      0x8000
180
#define DRIVER_RENDER      0x8000
179
 
181
 
180
#define DRIVER_BUS_PCI 0x1
182
#define DRIVER_BUS_PCI 0x1
181
#define DRIVER_BUS_PLATFORM 0x2
183
#define DRIVER_BUS_PLATFORM 0x2
182
#define DRIVER_BUS_USB 0x3
184
#define DRIVER_BUS_USB 0x3
-
 
185
#define DRIVER_BUS_HOST1X 0x4
183
 
186
 
184
/***********************************************************************/
187
/***********************************************************************/
185
/** \name Begin the DRM... */
188
/** \name Begin the DRM... */
186
/*@{*/
189
/*@{*/
187
 
190
 
188
#define DRM_DEBUG_CODE 0     /**< Include debugging code if > 1, then
191
#define DRM_DEBUG_CODE 2	  /**< Include debugging code if > 1, then
189
				     also include looping detection. */
192
				     also include looping detection. */
190
 
193
 
191
#define DRM_MAGIC_HASH_ORDER  4  /**< Size of key hash table. Must be power of 2. */
194
#define DRM_MAGIC_HASH_ORDER  4  /**< Size of key hash table. Must be power of 2. */
192
#define DRM_KERNEL_CONTEXT    0	 /**< Change drm_resctx if changed */
195
#define DRM_KERNEL_CONTEXT    0	 /**< Change drm_resctx if changed */
193
#define DRM_RESERVED_CONTEXTS 1	 /**< Change drm_resctx if changed */
196
#define DRM_RESERVED_CONTEXTS 1	 /**< Change drm_resctx if changed */
194
#define DRM_LOOPING_LIMIT     5000000
-
 
195
#define DRM_TIME_SLICE	      (HZ/20)  /**< Time slice for GLXContexts */
-
 
196
#define DRM_LOCK_SLICE	      1	/**< Time slice for lock, in jiffies */
-
 
197
 
-