1 /**************************************************************************
3 * Copyright (c) 2006-2007 Tungsten Graphics, Inc., Cedar Park, TX., USA
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
31 #ifndef _DRM_OBJECTS_H
32 #define _DRM_OBJECTS_H
35 struct drm_bo_mem_reg;
37 /***************************************************
38 * User space objects. (drm_object.c)
41 #define drm_user_object_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
43 enum drm_object_type {
48 * Add other user space object types here.
50 drm_driver_type0 = 256,
58 * A user object is a structure that helps the drm give out user handles
59 * to kernel internal objects and to keep track of these objects so that
60 * they can be destroyed, for example when the user space process exits.
61 * Designed to be accessible using a user space 32-bit handle.
64 struct drm_user_object {
65 struct drm_hash_item hash;
66 struct list_head list;
67 enum drm_object_type type;
70 struct drm_file *owner;
71 void (*ref_struct_locked) (struct drm_file *priv,
72 struct drm_user_object *obj,
73 enum drm_ref_type ref_action);
74 void (*unref) (struct drm_file *priv, struct drm_user_object *obj,
75 enum drm_ref_type unref_action);
76 void (*remove) (struct drm_file *priv, struct drm_user_object *obj);
80 * A ref object is a structure which is used to
81 * keep track of references to user objects and to keep track of these
82 * references so that they can be destroyed for example when the user space
83 * process exits. Designed to be accessible using a pointer to the _user_ object.
86 struct drm_ref_object {
87 struct drm_hash_item hash;
88 struct list_head list;
90 enum drm_ref_type unref_action;
94 * Must be called with the struct_mutex held.
97 extern int drm_add_user_object(struct drm_file *priv, struct drm_user_object *item,
100 * Must be called with the struct_mutex held.
103 extern struct drm_user_object *drm_lookup_user_object(struct drm_file *priv,
107 * Must be called with the struct_mutex held. May temporarily release it.
110 extern int drm_add_ref_object(struct drm_file *priv,
111 struct drm_user_object *referenced_object,
112 enum drm_ref_type ref_action);
115 * Must be called with the struct_mutex held.
118 struct drm_ref_object *drm_lookup_ref_object(struct drm_file *priv,
119 struct drm_user_object *referenced_object,
120 enum drm_ref_type ref_action);
122 * Must be called with the struct_mutex held.
123 * If "item" has been obtained by a call to drm_lookup_ref_object. You may not
124 * release the struct_mutex before calling drm_remove_ref_object.
125 * This function may temporarily release the struct_mutex.
128 extern void drm_remove_ref_object(struct drm_file *priv, struct drm_ref_object *item);
129 extern int drm_user_object_ref(struct drm_file *priv, uint32_t user_token,
130 enum drm_object_type type,
131 struct drm_user_object **object);
132 extern int drm_user_object_unref(struct drm_file *priv, uint32_t user_token,
133 enum drm_object_type type);
135 /***************************************************
136 * Fence objects. (drm_fence.c)
139 struct drm_fence_object {
140 struct drm_user_object base;
141 struct drm_device *dev;
145 * The below three fields are protected by the fence manager spinlock.
148 struct list_head ring;
150 uint32_t native_type;
155 uint32_t submitted_flush;
159 #define _DRM_FENCE_CLASSES 8
160 #define _DRM_FENCE_TYPE_EXE 0x00
162 struct drm_fence_class_manager {
163 struct list_head ring;
164 uint32_t pending_flush;
165 wait_queue_head_t fence_queue;
166 int pending_exe_flush;
167 uint32_t last_exe_flush;
168 uint32_t exe_flush_sequence;
171 struct drm_fence_manager {
174 struct drm_fence_class_manager fence_class[_DRM_FENCE_CLASSES];
175 uint32_t num_classes;
179 struct drm_fence_driver {
180 uint32_t num_classes;
183 uint32_t sequence_mask;
185 int (*has_irq) (struct drm_device *dev, uint32_t fence_class,
187 int (*emit) (struct drm_device *dev, uint32_t fence_class,
188 uint32_t flags, uint32_t *breadcrumb,
189 uint32_t *native_type);
190 void (*poke_flush) (struct drm_device *dev, uint32_t fence_class);
193 extern void drm_fence_handler(struct drm_device *dev, uint32_t fence_class,
194 uint32_t sequence, uint32_t type,
196 extern void drm_fence_manager_init(struct drm_device *dev);
197 extern void drm_fence_manager_takedown(struct drm_device *dev);
198 extern void drm_fence_flush_old(struct drm_device *dev, uint32_t fence_class,
200 extern int drm_fence_object_flush(struct drm_fence_object *fence,
202 extern int drm_fence_object_signaled(struct drm_fence_object *fence,
203 uint32_t type, int flush);
204 extern void drm_fence_usage_deref_locked(struct drm_fence_object **fence);
205 extern void drm_fence_usage_deref_unlocked(struct drm_fence_object **fence);
206 extern struct drm_fence_object *drm_fence_reference_locked(struct drm_fence_object *src);
207 extern void drm_fence_reference_unlocked(struct drm_fence_object **dst,
208 struct drm_fence_object *src);
209 extern int drm_fence_object_wait(struct drm_fence_object *fence,
210 int lazy, int ignore_signals, uint32_t mask);
211 extern int drm_fence_object_create(struct drm_device *dev, uint32_t type,
212 uint32_t fence_flags, uint32_t fence_class,
213 struct drm_fence_object **c_fence);
214 extern int drm_fence_object_emit(struct drm_fence_object *fence,
215 uint32_t fence_flags, uint32_t class,
217 extern void drm_fence_fill_arg(struct drm_fence_object *fence,
218 struct drm_fence_arg *arg);
220 extern int drm_fence_add_user_object(struct drm_file *priv,
221 struct drm_fence_object *fence,
224 extern int drm_fence_create_ioctl(struct drm_device *dev, void *data,
225 struct drm_file *file_priv);
226 extern int drm_fence_destroy_ioctl(struct drm_device *dev, void *data,
227 struct drm_file *file_priv);
228 extern int drm_fence_reference_ioctl(struct drm_device *dev, void *data,
229 struct drm_file *file_priv);
230 extern int drm_fence_unreference_ioctl(struct drm_device *dev, void *data,
231 struct drm_file *file_priv);
232 extern int drm_fence_signaled_ioctl(struct drm_device *dev, void *data,
233 struct drm_file *file_priv);
234 extern int drm_fence_flush_ioctl(struct drm_device *dev, void *data,
235 struct drm_file *file_priv);
236 extern int drm_fence_wait_ioctl(struct drm_device *dev, void *data,
237 struct drm_file *file_priv);
238 extern int drm_fence_emit_ioctl(struct drm_device *dev, void *data,
239 struct drm_file *file_priv);
240 extern int drm_fence_buffers_ioctl(struct drm_device *dev, void *data,
241 struct drm_file *file_priv);
242 /**************************************************
247 * The ttm backend GTT interface. (In our case AGP).
248 * Any similar type of device (PCIE?)
249 * needs only to implement these functions to be usable with the TTM interface.
250 * The AGP backend implementation lives in drm_agpsupport.c
251 * basically maps these calls to available functions in agpgart.
252 * Each drm device driver gets an
253 * additional function pointer that creates these types,
254 * so that the device can choose the correct aperture.
255 * (Multiple AGP apertures, etc.)
256 * Most device drivers will let this point to the standard AGP implementation.
259 #define DRM_BE_FLAG_NEEDS_FREE 0x00000001
260 #define DRM_BE_FLAG_BOUND_CACHED 0x00000002
262 struct drm_ttm_backend;
263 struct drm_ttm_backend_func {
264 int (*needs_ub_cache_adjust) (struct drm_ttm_backend *backend);
265 int (*populate) (struct drm_ttm_backend *backend,
266 unsigned long num_pages, struct page **pages,
267 struct page *dummy_read_page);
268 void (*clear) (struct drm_ttm_backend *backend);
269 int (*bind) (struct drm_ttm_backend *backend,
270 struct drm_bo_mem_reg *bo_mem);
271 int (*unbind) (struct drm_ttm_backend *backend);
272 void (*destroy) (struct drm_ttm_backend *backend);
276 struct drm_ttm_backend {
277 struct drm_device *dev;
279 struct drm_ttm_backend_func *func;
283 struct page *dummy_read_page;
286 unsigned long num_pages;
288 struct drm_device *dev;
290 uint32_t mapping_offset;
291 struct drm_ttm_backend *be;
301 extern struct drm_ttm *drm_ttm_create(struct drm_device *dev, unsigned long size,
303 struct page *dummy_read_page);
304 extern int drm_ttm_bind(struct drm_ttm *ttm, struct drm_bo_mem_reg *bo_mem);
305 extern void drm_ttm_unbind(struct drm_ttm *ttm);
306 extern void drm_ttm_evict(struct drm_ttm *ttm);
307 extern void drm_ttm_fixup_caching(struct drm_ttm *ttm);
308 extern struct page *drm_ttm_get_page(struct drm_ttm *ttm, int index);
309 extern void drm_ttm_cache_flush(void);
310 extern int drm_ttm_populate(struct drm_ttm *ttm);
311 extern int drm_ttm_set_user(struct drm_ttm *ttm,
312 struct task_struct *tsk,
314 unsigned long num_pages);
317 * Destroy a ttm. The user normally calls drmRmMap or a similar IOCTL to do
318 * this which calls this function iff there are no vmas referencing it anymore.
319 * Otherwise it is called when the last vma exits.
322 extern int drm_ttm_destroy(struct drm_ttm *ttm);
324 #define DRM_FLAG_MASKED(_old, _new, _mask) {\
325 (_old) ^= (((_old) ^ (_new)) & (_mask)); \
328 #define DRM_TTM_MASK_FLAGS ((1 << PAGE_SHIFT) - 1)
329 #define DRM_TTM_MASK_PFN (0xFFFFFFFFU - DRM_TTM_MASK_FLAGS)
336 * This ttm should not be cached by the CPU
338 #define DRM_TTM_PAGE_UNCACHED (1 << 0)
340 * This flat is not used at this time; I don't know what the
343 #define DRM_TTM_PAGE_USED (1 << 1)
345 * This flat is not used at this time; I don't know what the
348 #define DRM_TTM_PAGE_BOUND (1 << 2)
350 * This flat is not used at this time; I don't know what the
353 #define DRM_TTM_PAGE_PRESENT (1 << 3)
355 * The array of page pointers was allocated with vmalloc
356 * instead of drm_calloc.
358 #define DRM_TTM_PAGE_VMALLOC (1 << 4)
360 * This ttm is mapped from user space
362 #define DRM_TTM_PAGE_USER (1 << 5)
364 * This ttm will be written to by the GPU
366 #define DRM_TTM_PAGE_WRITE (1 << 6)
368 * This ttm was mapped to the GPU, and so the contents may have
371 #define DRM_TTM_PAGE_USER_DIRTY (1 << 7)
373 * This flag is not used at this time; I don't know what the
376 #define DRM_TTM_PAGE_USER_DMA (1 << 8)
378 /***************************************************
379 * Buffer objects. (drm_bo.c, drm_bo_move.c)
382 struct drm_bo_mem_reg {
383 struct drm_mm_node *mm_node;
385 unsigned long num_pages;
386 uint32_t page_alignment;
389 * Current buffer status flags, indicating
390 * where the buffer is located and which
391 * access modes are in effect
395 * These are the flags proposed for
396 * a validate operation. If the
397 * validate succeeds, they'll get moved
398 * into the flags field
400 uint64_t proposed_flags;
402 uint32_t desired_tile_stride;
403 uint32_t hw_tile_stride;
408 * drm_bo_type_device are 'normal' drm allocations,
409 * pages are allocated from within the kernel automatically
410 * and the objects can be mmap'd from the drm device. Each
411 * drm_bo_type_device object has a unique name which can be
412 * used by other processes to share access to the underlying
417 * drm_bo_type_user are buffers of pages that already exist
418 * in the process address space. They are more limited than
419 * drm_bo_type_device buffers in that they must always
420 * remain cached (as we assume the user pages are mapped cached),
421 * and they are not sharable to other processes through DRM
422 * (although, regular shared memory should still work fine).
426 * drm_bo_type_kernel are buffers that exist solely for use
427 * within the kernel. The pages cannot be mapped into the
428 * process. One obvious use would be for the ring
429 * buffer where user access would not (ideally) be required.
434 struct drm_buffer_object {
435 struct drm_device *dev;
436 struct drm_user_object base;
439 * If there is a possibility that the usage variable is zero,
440 * then dev->struct_mutext should be locked before incrementing it.
444 unsigned long buffer_start;
445 enum drm_bo_type type;
446 unsigned long offset;
448 struct drm_bo_mem_reg mem;
450 struct list_head lru;
451 struct list_head ddestroy;
454 uint32_t fence_class;
455 uint32_t new_fence_type;
456 uint32_t new_fence_class;
457 struct drm_fence_object *fence;
459 wait_queue_head_t event_queue;
461 unsigned long num_pages;
463 /* For pinned buffers */
464 struct drm_mm_node *pinned_node;
465 uint32_t pinned_mem_type;
466 struct list_head pinned_lru;
470 struct drm_map_list map_list;
471 uint32_t memory_type;
472 unsigned long bus_offset;
476 #ifdef DRM_ODD_MM_COMPAT
477 /* dev->struct_mutex only protected. */
478 struct list_head vma_list;
479 struct list_head p_mm_list;
484 #define _DRM_BO_FLAG_UNFENCED 0x00000001
485 #define _DRM_BO_FLAG_EVICTED 0x00000002
487 struct drm_mem_type_manager {
490 struct drm_mm manager;
491 struct list_head lru;
492 struct list_head pinned;
494 uint32_t drm_bus_maptype;
495 unsigned long gpu_offset;
496 unsigned long io_offset;
497 unsigned long io_size;
502 struct drm_user_object base;
503 wait_queue_head_t queue;
504 atomic_t write_lock_pending;
508 #define _DRM_FLAG_MEMTYPE_FIXED 0x00000001 /* Fixed (on-card) PCI memory */
509 #define _DRM_FLAG_MEMTYPE_MAPPABLE 0x00000002 /* Memory mappable */
510 #define _DRM_FLAG_MEMTYPE_CACHED 0x00000004 /* Cached binding */
511 #define _DRM_FLAG_NEEDS_IOREMAP 0x00000008 /* Fixed memory needs ioremap
512 before kernel access. */
513 #define _DRM_FLAG_MEMTYPE_CMA 0x00000010 /* Can't map aperture */
514 #define _DRM_FLAG_MEMTYPE_CSELECT 0x00000020 /* Select caching */
516 struct drm_buffer_manager {
517 struct drm_bo_lock bm_lock;
518 struct mutex evict_mutex;
521 struct drm_file *last_to_validate;
522 struct drm_mem_type_manager man[DRM_BO_MEM_TYPES];
523 struct list_head unfenced;
524 struct list_head ddestroy;
525 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
526 struct work_struct wq;
528 struct delayed_work wq;
531 unsigned long cur_pages;
533 struct page *dummy_read_page;
536 struct drm_bo_driver {
537 const uint32_t *mem_type_prio;
538 const uint32_t *mem_busy_prio;
539 uint32_t num_mem_type_prio;
540 uint32_t num_mem_busy_prio;
541 struct drm_ttm_backend *(*create_ttm_backend_entry)
542 (struct drm_device *dev);
543 int (*fence_type) (struct drm_buffer_object *bo, uint32_t *fclass,
545 int (*invalidate_caches) (struct drm_device *dev, uint64_t flags);
546 int (*init_mem_type) (struct drm_device *dev, uint32_t type,
547 struct drm_mem_type_manager *man);
551 * @bo: the buffer object to be evicted
553 * Return the bo flags for a buffer which is not mapped to the hardware.
554 * These will be placed in proposed_flags so that when the move is
555 * finished, they'll end up in bo->mem.flags
557 uint64_t(*evict_flags) (struct drm_buffer_object *bo);
561 * @bo: the buffer to move
563 * @evict: whether this motion is evicting the buffer from
564 * the graphics address space
566 * @no_wait: whether this should give up and return -EBUSY
567 * if this move would require sleeping
569 * @new_mem: the new memory region receiving the buffer
571 * Move a buffer between two memory regions.
573 int (*move) (struct drm_buffer_object *bo,
574 int evict, int no_wait, struct drm_bo_mem_reg *new_mem);
578 void (*ttm_cache_flush)(struct drm_ttm *ttm);
582 * buffer objects (drm_bo.c)
585 extern int drm_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
586 extern int drm_bo_destroy_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
587 extern int drm_bo_map_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
588 extern int drm_bo_unmap_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
589 extern int drm_bo_reference_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
590 extern int drm_bo_unreference_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
591 extern int drm_bo_wait_idle_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
592 extern int drm_bo_info_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
593 extern int drm_bo_setstatus_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
594 extern int drm_mm_init_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
595 extern int drm_mm_takedown_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
596 extern int drm_mm_lock_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
597 extern int drm_mm_unlock_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
598 extern int drm_bo_version_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
599 extern int drm_bo_driver_finish(struct drm_device *dev);
600 extern int drm_bo_driver_init(struct drm_device *dev);
601 extern int drm_bo_pci_offset(struct drm_device *dev,
602 struct drm_bo_mem_reg *mem,
603 unsigned long *bus_base,
604 unsigned long *bus_offset,
605 unsigned long *bus_size);
606 extern int drm_mem_reg_is_pci(struct drm_device *dev, struct drm_bo_mem_reg *mem);
608 extern void drm_bo_usage_deref_locked(struct drm_buffer_object **bo);
609 extern void drm_bo_usage_deref_unlocked(struct drm_buffer_object **bo);
610 extern void drm_putback_buffer_objects(struct drm_device *dev);
611 extern int drm_fence_buffer_objects(struct drm_device *dev,
612 struct list_head *list,
613 uint32_t fence_flags,
614 struct drm_fence_object *fence,
615 struct drm_fence_object **used_fence);
616 extern void drm_bo_add_to_lru(struct drm_buffer_object *bo);
617 extern int drm_buffer_object_create(struct drm_device *dev, unsigned long size,
618 enum drm_bo_type type, uint64_t flags,
619 uint32_t hint, uint32_t page_alignment,
620 unsigned long buffer_start,
621 struct drm_buffer_object **bo);
622 extern int drm_bo_wait(struct drm_buffer_object *bo, int lazy, int ignore_signals,
624 extern int drm_bo_mem_space(struct drm_buffer_object *bo,
625 struct drm_bo_mem_reg *mem, int no_wait);
626 extern int drm_bo_move_buffer(struct drm_buffer_object *bo,
627 uint64_t new_mem_flags,
628 int no_wait, int move_unfenced);
629 extern int drm_bo_clean_mm(struct drm_device *dev, unsigned mem_type);
630 extern int drm_bo_init_mm(struct drm_device *dev, unsigned type,
631 unsigned long p_offset, unsigned long p_size);
632 extern int drm_bo_handle_validate(struct drm_file *file_priv, uint32_t handle,
633 uint64_t flags, uint64_t mask, uint32_t hint,
634 uint32_t fence_class, int use_old_fence_class,
635 struct drm_bo_info_rep *rep,
636 struct drm_buffer_object **bo_rep);
637 extern struct drm_buffer_object *drm_lookup_buffer_object(struct drm_file *file_priv,
640 extern int drm_bo_do_validate(struct drm_buffer_object *bo,
641 uint64_t flags, uint64_t mask, uint32_t hint,
642 uint32_t fence_class,
643 struct drm_bo_info_rep *rep);
646 * Buffer object memory move- and map helpers.
650 extern int drm_bo_move_ttm(struct drm_buffer_object *bo,
651 int evict, int no_wait,
652 struct drm_bo_mem_reg *new_mem);
653 extern int drm_bo_move_memcpy(struct drm_buffer_object *bo,
655 int no_wait, struct drm_bo_mem_reg *new_mem);
656 extern int drm_bo_move_accel_cleanup(struct drm_buffer_object *bo,
657 int evict, int no_wait,
658 uint32_t fence_class, uint32_t fence_type,
659 uint32_t fence_flags,
660 struct drm_bo_mem_reg *new_mem);
661 extern int drm_bo_same_page(unsigned long offset, unsigned long offset2);
662 extern unsigned long drm_bo_offset_end(unsigned long offset,
665 struct drm_bo_kmap_obj {
676 static inline void *drm_bmo_virtual(struct drm_bo_kmap_obj *map, int *is_iomem)
678 *is_iomem = (map->bo_kmap_type == bo_map_iomap ||
679 map->bo_kmap_type == bo_map_premapped);
682 extern void drm_bo_kunmap(struct drm_bo_kmap_obj *map);
683 extern int drm_bo_kmap(struct drm_buffer_object *bo, unsigned long start_page,
684 unsigned long num_pages, struct drm_bo_kmap_obj *map);
692 struct list_head head;
693 struct drm_fence_object *fence;
695 uint32_t new_fence_type;
698 struct drm_reg_manager {
699 struct list_head free;
700 struct list_head lru;
701 struct list_head unfenced;
703 int (*reg_reusable)(const struct drm_reg *reg, const void *data);
704 void (*reg_destroy)(struct drm_reg *reg);
707 extern int drm_regs_alloc(struct drm_reg_manager *manager,
709 uint32_t fence_class,
713 struct drm_reg **reg);
715 extern void drm_regs_fence(struct drm_reg_manager *regs,
716 struct drm_fence_object *fence);
718 extern void drm_regs_free(struct drm_reg_manager *manager);
719 extern void drm_regs_add(struct drm_reg_manager *manager, struct drm_reg *reg);
720 extern void drm_regs_init(struct drm_reg_manager *manager,
721 int (*reg_reusable)(const struct drm_reg *,
723 void (*reg_destroy)(struct drm_reg *));
727 * Simple replacement for the hardware lock on buffer manager init and clean.
731 extern void drm_bo_init_lock(struct drm_bo_lock *lock);
732 extern void drm_bo_read_unlock(struct drm_bo_lock *lock);
733 extern int drm_bo_read_lock(struct drm_bo_lock *lock);
734 extern int drm_bo_write_lock(struct drm_bo_lock *lock,
735 struct drm_file *file_priv);
737 extern int drm_bo_write_unlock(struct drm_bo_lock *lock,
738 struct drm_file *file_priv);
740 #ifdef CONFIG_DEBUG_MUTEXES
741 #define DRM_ASSERT_LOCKED(_mutex) \
742 BUG_ON(!mutex_is_locked(_mutex) || \
743 ((_mutex)->owner != current_thread_info()))
745 #define DRM_ASSERT_LOCKED(_mutex)