~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/drm_exec.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/drm/drm_exec.h (Version linux-6.12-rc7) and /include/drm/drm_exec.h (Version linux-6.9.12)


  1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */       1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
  2                                                     2 
  3 #ifndef __DRM_EXEC_H__                              3 #ifndef __DRM_EXEC_H__
  4 #define __DRM_EXEC_H__                              4 #define __DRM_EXEC_H__
  5                                                     5 
  6 #include <linux/compiler.h>                         6 #include <linux/compiler.h>
  7 #include <linux/ww_mutex.h>                         7 #include <linux/ww_mutex.h>
  8                                                     8 
  9 #define DRM_EXEC_INTERRUPTIBLE_WAIT     BIT(0)      9 #define DRM_EXEC_INTERRUPTIBLE_WAIT     BIT(0)
 10 #define DRM_EXEC_IGNORE_DUPLICATES      BIT(1)     10 #define DRM_EXEC_IGNORE_DUPLICATES      BIT(1)
 11                                                    11 
 12 struct drm_gem_object;                             12 struct drm_gem_object;
 13                                                    13 
 14 /**                                                14 /**
 15  * struct drm_exec - Execution context             15  * struct drm_exec - Execution context
 16  */                                                16  */
 17 struct drm_exec {                                  17 struct drm_exec {
 18         /**                                        18         /**
 19          * @flags: Flags to control locking be     19          * @flags: Flags to control locking behavior
 20          */                                        20          */
 21         u32                     flags;             21         u32                     flags;
 22                                                    22 
 23         /**                                        23         /**
 24          * @ticket: WW ticket used for acquiri     24          * @ticket: WW ticket used for acquiring locks
 25          */                                        25          */
 26         struct ww_acquire_ctx   ticket;            26         struct ww_acquire_ctx   ticket;
 27                                                    27 
 28         /**                                        28         /**
 29          * @num_objects: number of objects loc     29          * @num_objects: number of objects locked
 30          */                                        30          */
 31         unsigned int            num_objects;       31         unsigned int            num_objects;
 32                                                    32 
 33         /**                                        33         /**
 34          * @max_objects: maximum objects in ar     34          * @max_objects: maximum objects in array
 35          */                                        35          */
 36         unsigned int            max_objects;       36         unsigned int            max_objects;
 37                                                    37 
 38         /**                                        38         /**
 39          * @objects: array of the locked objec     39          * @objects: array of the locked objects
 40          */                                        40          */
 41         struct drm_gem_object   **objects;         41         struct drm_gem_object   **objects;
 42                                                    42 
 43         /**                                        43         /**
 44          * @contended: contended GEM object we     44          * @contended: contended GEM object we backed off for
 45          */                                        45          */
 46         struct drm_gem_object   *contended;        46         struct drm_gem_object   *contended;
 47                                                    47 
 48         /**                                        48         /**
 49          * @prelocked: already locked GEM obje     49          * @prelocked: already locked GEM object due to contention
 50          */                                        50          */
 51         struct drm_gem_object *prelocked;          51         struct drm_gem_object *prelocked;
 52 };                                                 52 };
 53                                                    53 
 54 /**                                                54 /**
 55  * drm_exec_obj() - Return the object for a gi     55  * drm_exec_obj() - Return the object for a give drm_exec index
 56  * @exec: Pointer to the drm_exec context          56  * @exec: Pointer to the drm_exec context
 57  * @index: The index.                              57  * @index: The index.
 58  *                                                 58  *
 59  * Return: Pointer to the locked object corres     59  * Return: Pointer to the locked object corresponding to @index if
 60  * index is within the number of locked object     60  * index is within the number of locked objects. NULL otherwise.
 61  */                                                61  */
 62 static inline struct drm_gem_object *              62 static inline struct drm_gem_object *
 63 drm_exec_obj(struct drm_exec *exec, unsigned l     63 drm_exec_obj(struct drm_exec *exec, unsigned long index)
 64 {                                                  64 {
 65         return index < exec->num_objects ? exe     65         return index < exec->num_objects ? exec->objects[index] : NULL;
 66 }                                                  66 }
 67                                                    67 
 68 /**                                                68 /**
 69  * drm_exec_for_each_locked_object - iterate o     69  * drm_exec_for_each_locked_object - iterate over all the locked objects
 70  * @exec: drm_exec object                          70  * @exec: drm_exec object
 71  * @index: unsigned long index for the iterati     71  * @index: unsigned long index for the iteration
 72  * @obj: the current GEM object                    72  * @obj: the current GEM object
 73  *                                                 73  *
 74  * Iterate over all the locked GEM objects ins     74  * Iterate over all the locked GEM objects inside the drm_exec object.
 75  */                                                75  */
 76 #define drm_exec_for_each_locked_object(exec,      76 #define drm_exec_for_each_locked_object(exec, index, obj)               \
 77         for ((index) = 0; ((obj) = drm_exec_ob     77         for ((index) = 0; ((obj) = drm_exec_obj(exec, index)); ++(index))
 78                                                    78 
 79 /**                                                79 /**
 80  * drm_exec_for_each_locked_object_reverse - i     80  * drm_exec_for_each_locked_object_reverse - iterate over all the locked
 81  * objects in reverse locking order                81  * objects in reverse locking order
 82  * @exec: drm_exec object                          82  * @exec: drm_exec object
 83  * @index: unsigned long index for the iterati     83  * @index: unsigned long index for the iteration
 84  * @obj: the current GEM object                    84  * @obj: the current GEM object
 85  *                                                 85  *
 86  * Iterate over all the locked GEM objects ins     86  * Iterate over all the locked GEM objects inside the drm_exec object in
 87  * reverse locking order. Note that @index may     87  * reverse locking order. Note that @index may go below zero and wrap,
 88  * but that will be caught by drm_exec_obj(),      88  * but that will be caught by drm_exec_obj(), returning a NULL object.
 89  */                                                89  */
 90 #define drm_exec_for_each_locked_object_revers     90 #define drm_exec_for_each_locked_object_reverse(exec, index, obj)       \
 91         for ((index) = (exec)->num_objects - 1     91         for ((index) = (exec)->num_objects - 1;                         \
 92              ((obj) = drm_exec_obj(exec, index     92              ((obj) = drm_exec_obj(exec, index)); --(index))
 93                                                    93 
 94 /**                                                94 /**
 95  * drm_exec_until_all_locked - loop until all      95  * drm_exec_until_all_locked - loop until all GEM objects are locked
 96  * @exec: drm_exec object                          96  * @exec: drm_exec object
 97  *                                                 97  *
 98  * Core functionality of the drm_exec object.      98  * Core functionality of the drm_exec object. Loops until all GEM objects are
 99  * locked and no more contention exists. At th     99  * locked and no more contention exists. At the beginning of the loop it is
100  * guaranteed that no GEM object is locked.       100  * guaranteed that no GEM object is locked.
101  *                                                101  *
102  * Since labels can't be defined local to the     102  * Since labels can't be defined local to the loops body we use a jump pointer
103  * to make sure that the retry is only used fr    103  * to make sure that the retry is only used from within the loops body.
104  */                                               104  */
105 #define drm_exec_until_all_locked(exec)           105 #define drm_exec_until_all_locked(exec)                                 \
106 __PASTE(__drm_exec_, __LINE__):                   106 __PASTE(__drm_exec_, __LINE__):                                         \
107         for (void *__drm_exec_retry_ptr; ({       107         for (void *__drm_exec_retry_ptr; ({                             \
108                 __drm_exec_retry_ptr = &&__PAS    108                 __drm_exec_retry_ptr = &&__PASTE(__drm_exec_, __LINE__);\
109                 (void)__drm_exec_retry_ptr;       109                 (void)__drm_exec_retry_ptr;                             \
110                 drm_exec_cleanup(exec);           110                 drm_exec_cleanup(exec);                                 \
111         });)                                      111         });)
112                                                   112 
113 /**                                               113 /**
114  * drm_exec_retry_on_contention - restart the     114  * drm_exec_retry_on_contention - restart the loop to grap all locks
115  * @exec: drm_exec object                         115  * @exec: drm_exec object
116  *                                                116  *
117  * Control flow helper to continue when a cont    117  * Control flow helper to continue when a contention was detected and we need to
118  * clean up and re-start the loop to prepare a    118  * clean up and re-start the loop to prepare all GEM objects.
119  */                                               119  */
120 #define drm_exec_retry_on_contention(exec)        120 #define drm_exec_retry_on_contention(exec)                      \
121         do {                                      121         do {                                                    \
122                 if (unlikely(drm_exec_is_conte    122                 if (unlikely(drm_exec_is_contended(exec)))      \
123                         goto *__drm_exec_retry    123                         goto *__drm_exec_retry_ptr;             \
124         } while (0)                               124         } while (0)
125                                                   125 
126 /**                                               126 /**
127  * drm_exec_is_contended - check for contentio    127  * drm_exec_is_contended - check for contention
128  * @exec: drm_exec object                         128  * @exec: drm_exec object
129  *                                                129  *
130  * Returns true if the drm_exec object has run    130  * Returns true if the drm_exec object has run into some contention while
131  * locking a GEM object and needs to clean up.    131  * locking a GEM object and needs to clean up.
132  */                                               132  */
133 static inline bool drm_exec_is_contended(struc    133 static inline bool drm_exec_is_contended(struct drm_exec *exec)
134 {                                                 134 {
135         return !!exec->contended;                 135         return !!exec->contended;
136 }                                                 136 }
137                                                   137 
138 void drm_exec_init(struct drm_exec *exec, u32     138 void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr);
139 void drm_exec_fini(struct drm_exec *exec);        139 void drm_exec_fini(struct drm_exec *exec);
140 bool drm_exec_cleanup(struct drm_exec *exec);     140 bool drm_exec_cleanup(struct drm_exec *exec);
141 int drm_exec_lock_obj(struct drm_exec *exec, s    141 int drm_exec_lock_obj(struct drm_exec *exec, struct drm_gem_object *obj);
142 void drm_exec_unlock_obj(struct drm_exec *exec    142 void drm_exec_unlock_obj(struct drm_exec *exec, struct drm_gem_object *obj);
143 int drm_exec_prepare_obj(struct drm_exec *exec    143 int drm_exec_prepare_obj(struct drm_exec *exec, struct drm_gem_object *obj,
144                          unsigned int num_fenc    144                          unsigned int num_fences);
145 int drm_exec_prepare_array(struct drm_exec *ex    145 int drm_exec_prepare_array(struct drm_exec *exec,
146                            struct drm_gem_obje    146                            struct drm_gem_object **objects,
147                            unsigned int num_ob    147                            unsigned int num_objects,
148                            unsigned int num_fe    148                            unsigned int num_fences);
149                                                   149 
150 #endif                                            150 #endif
151                                                   151 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php