diff options
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 126 |
1 files changed, 69 insertions, 57 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index b84d8ae35e6f..d4ddc22e46bb 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -86,7 +86,17 @@ struct drm_device; | |||
86 | 86 | ||
87 | #include "drm_os_linux.h" | 87 | #include "drm_os_linux.h" |
88 | #include "drm_hashtab.h" | 88 | #include "drm_hashtab.h" |
89 | #include "drm_mm.h" | ||
89 | 90 | ||
91 | #define DRM_UT_CORE 0x01 | ||
92 | #define DRM_UT_DRIVER 0x02 | ||
93 | #define DRM_UT_KMS 0x04 | ||
94 | #define DRM_UT_MODE 0x08 | ||
95 | |||
96 | extern void drm_ut_debug_printk(unsigned int request_level, | ||
97 | const char *prefix, | ||
98 | const char *function_name, | ||
99 | const char *format, ...); | ||
90 | /***********************************************************************/ | 100 | /***********************************************************************/ |
91 | /** \name DRM template customization defaults */ | 101 | /** \name DRM template customization defaults */ |
92 | /*@{*/ | 102 | /*@{*/ |
@@ -186,15 +196,57 @@ struct drm_device; | |||
186 | * \param arg arguments | 196 | * \param arg arguments |
187 | */ | 197 | */ |
188 | #if DRM_DEBUG_CODE | 198 | #if DRM_DEBUG_CODE |
189 | #define DRM_DEBUG(fmt, arg...) \ | 199 | #define DRM_DEBUG(fmt, args...) \ |
200 | do { \ | ||
201 | drm_ut_debug_printk(DRM_UT_CORE, DRM_NAME, \ | ||
202 | __func__, fmt, ##args); \ | ||
203 | } while (0) | ||
204 | |||
205 | #define DRM_DEBUG_DRIVER(prefix, fmt, args...) \ | ||
206 | do { \ | ||
207 | drm_ut_debug_printk(DRM_UT_DRIVER, prefix, \ | ||
208 | __func__, fmt, ##args); \ | ||
209 | } while (0) | ||
210 | #define DRM_DEBUG_KMS(prefix, fmt, args...) \ | ||
211 | do { \ | ||
212 | drm_ut_debug_printk(DRM_UT_KMS, prefix, \ | ||
213 | __func__, fmt, ##args); \ | ||
214 | } while (0) | ||
215 | #define DRM_DEBUG_MODE(prefix, fmt, args...) \ | ||
216 | do { \ | ||
217 | drm_ut_debug_printk(DRM_UT_MODE, prefix, \ | ||
218 | __func__, fmt, ##args); \ | ||
219 | } while (0) | ||
220 | #define DRM_LOG(fmt, args...) \ | ||
221 | do { \ | ||
222 | drm_ut_debug_printk(DRM_UT_CORE, NULL, \ | ||
223 | NULL, fmt, ##args); \ | ||
224 | } while (0) | ||
225 | #define DRM_LOG_KMS(fmt, args...) \ | ||
226 | do { \ | ||
227 | drm_ut_debug_printk(DRM_UT_KMS, NULL, \ | ||
228 | NULL, fmt, ##args); \ | ||
229 | } while (0) | ||
230 | #define DRM_LOG_MODE(fmt, args...) \ | ||
231 | do { \ | ||
232 | drm_ut_debug_printk(DRM_UT_MODE, NULL, \ | ||
233 | NULL, fmt, ##args); \ | ||
234 | } while (0) | ||
235 | #define DRM_LOG_DRIVER(fmt, args...) \ | ||
190 | do { \ | 236 | do { \ |
191 | if ( drm_debug ) \ | 237 | drm_ut_debug_printk(DRM_UT_DRIVER, NULL, \ |
192 | printk(KERN_DEBUG \ | 238 | NULL, fmt, ##args); \ |
193 | "[" DRM_NAME ":%s] " fmt , \ | ||
194 | __func__ , ##arg); \ | ||
195 | } while (0) | 239 | } while (0) |
196 | #else | 240 | #else |
241 | #define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0) | ||
242 | #define DRM_DEBUG_KMS(prefix, fmt, args...) do { } while (0) | ||
243 | #define DRM_DEBUG_MODE(prefix, fmt, args...) do { } while (0) | ||
197 | #define DRM_DEBUG(fmt, arg...) do { } while (0) | 244 | #define DRM_DEBUG(fmt, arg...) do { } while (0) |
245 | #define DRM_LOG(fmt, arg...) do { } while (0) | ||
246 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) | ||
247 | #define DRM_LOG_MODE(fmt, arg...) do { } while (0) | ||
248 | #define DRM_LOG_DRIVER(fmt, arg...) do { } while (0) | ||
249 | |||
198 | #endif | 250 | #endif |
199 | 251 | ||
200 | #define DRM_PROC_LIMIT (PAGE_SIZE-80) | 252 | #define DRM_PROC_LIMIT (PAGE_SIZE-80) |
@@ -237,15 +289,15 @@ struct drm_device; | |||
237 | * \param dev DRM device. | 289 | * \param dev DRM device. |
238 | * \param filp file pointer of the caller. | 290 | * \param filp file pointer of the caller. |
239 | */ | 291 | */ |
240 | #define LOCK_TEST_WITH_RETURN( dev, file_priv ) \ | 292 | #define LOCK_TEST_WITH_RETURN( dev, _file_priv ) \ |
241 | do { \ | 293 | do { \ |
242 | if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock) || \ | 294 | if (!_DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock) || \ |
243 | file_priv->master->lock.file_priv != file_priv) { \ | 295 | _file_priv->master->lock.file_priv != _file_priv) { \ |
244 | DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\ | 296 | DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\ |
245 | __func__, _DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock),\ | 297 | __func__, _DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock),\ |
246 | file_priv->master->lock.file_priv, file_priv); \ | 298 | _file_priv->master->lock.file_priv, _file_priv); \ |
247 | return -EINVAL; \ | 299 | return -EINVAL; \ |
248 | } \ | 300 | } \ |
249 | } while (0) | 301 | } while (0) |
250 | 302 | ||
251 | /** | 303 | /** |
@@ -502,26 +554,6 @@ struct drm_sigdata { | |||
502 | }; | 554 | }; |
503 | 555 | ||
504 | 556 | ||
505 | /* | ||
506 | * Generic memory manager structs | ||
507 | */ | ||
508 | |||
509 | struct drm_mm_node { | ||
510 | struct list_head fl_entry; | ||
511 | struct list_head ml_entry; | ||
512 | int free; | ||
513 | unsigned long start; | ||
514 | unsigned long size; | ||
515 | struct drm_mm *mm; | ||
516 | void *private; | ||
517 | }; | ||
518 | |||
519 | struct drm_mm { | ||
520 | struct list_head fl_entry; | ||
521 | struct list_head ml_entry; | ||
522 | }; | ||
523 | |||
524 | |||
525 | /** | 557 | /** |
526 | * Kernel side of a mapping | 558 | * Kernel side of a mapping |
527 | */ | 559 | */ |
@@ -1385,22 +1417,6 @@ extern char *drm_get_connector_status_name(enum drm_connector_status status); | |||
1385 | extern int drm_sysfs_connector_add(struct drm_connector *connector); | 1417 | extern int drm_sysfs_connector_add(struct drm_connector *connector); |
1386 | extern void drm_sysfs_connector_remove(struct drm_connector *connector); | 1418 | extern void drm_sysfs_connector_remove(struct drm_connector *connector); |
1387 | 1419 | ||
1388 | /* | ||
1389 | * Basic memory manager support (drm_mm.c) | ||
1390 | */ | ||
1391 | extern struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent, | ||
1392 | unsigned long size, | ||
1393 | unsigned alignment); | ||
1394 | extern void drm_mm_put_block(struct drm_mm_node * cur); | ||
1395 | extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, unsigned long size, | ||
1396 | unsigned alignment, int best_match); | ||
1397 | extern int drm_mm_init(struct drm_mm *mm, unsigned long start, unsigned long size); | ||
1398 | extern void drm_mm_takedown(struct drm_mm *mm); | ||
1399 | extern int drm_mm_clean(struct drm_mm *mm); | ||
1400 | extern unsigned long drm_mm_tail_space(struct drm_mm *mm); | ||
1401 | extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size); | ||
1402 | extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size); | ||
1403 | |||
1404 | /* Graphics Execution Manager library functions (drm_gem.c) */ | 1420 | /* Graphics Execution Manager library functions (drm_gem.c) */ |
1405 | int drm_gem_init(struct drm_device *dev); | 1421 | int drm_gem_init(struct drm_device *dev); |
1406 | void drm_gem_destroy(struct drm_device *dev); | 1422 | void drm_gem_destroy(struct drm_device *dev); |
@@ -1522,18 +1538,14 @@ static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area) | |||
1522 | 1538 | ||
1523 | static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) | 1539 | static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) |
1524 | { | 1540 | { |
1525 | u8 *addr; | 1541 | if (size * nmemb <= PAGE_SIZE) |
1526 | |||
1527 | if (size <= PAGE_SIZE) | ||
1528 | return kcalloc(nmemb, size, GFP_KERNEL); | 1542 | return kcalloc(nmemb, size, GFP_KERNEL); |
1529 | 1543 | ||
1530 | addr = vmalloc(nmemb * size); | 1544 | if (size != 0 && nmemb > ULONG_MAX / size) |
1531 | if (!addr) | ||
1532 | return NULL; | 1545 | return NULL; |
1533 | 1546 | ||
1534 | memset(addr, 0, nmemb * size); | 1547 | return __vmalloc(size * nmemb, |
1535 | 1548 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); | |
1536 | return addr; | ||
1537 | } | 1549 | } |
1538 | 1550 | ||
1539 | static __inline void drm_free_large(void *ptr) | 1551 | static __inline void drm_free_large(void *ptr) |