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

TOMOYO Linux Cross Reference
Linux/include/drm/drm_atomic.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_atomic.h (Version linux-6.12-rc7) and /include/drm/drm_atomic.h (Version unix-v6-master)


  1 /*                                                  1 
  2  * Copyright (C) 2014 Red Hat                     
  3  * Copyright (C) 2014 Intel Corp.                 
  4  *                                                
  5  * Permission is hereby granted, free of charg    
  6  * copy of this software and associated docume    
  7  * to deal in the Software without restriction    
  8  * the rights to use, copy, modify, merge, pub    
  9  * and/or sell copies of the Software, and to     
 10  * Software is furnished to do so, subject to     
 11  *                                                
 12  * The above copyright notice and this permiss    
 13  * all copies or substantial portions of the S    
 14  *                                                
 15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W    
 16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE W    
 17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINF    
 18  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIA    
 19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CO    
 20  * ARISING FROM, OUT OF OR IN CONNECTION WITH     
 21  * OTHER DEALINGS IN THE SOFTWARE.                
 22  *                                                
 23  * Authors:                                       
 24  * Rob Clark <robdclark@gmail.com>                
 25  * Daniel Vetter <daniel.vetter@ffwll.ch>         
 26  */                                               
 27                                                   
 28 #ifndef DRM_ATOMIC_H_                             
 29 #define DRM_ATOMIC_H_                             
 30                                                   
 31 #include <drm/drm_crtc.h>                         
 32 #include <drm/drm_util.h>                         
 33                                                   
 34 /**                                               
 35  * struct drm_crtc_commit - track modeset comm    
 36  *                                                
 37  * This structure is used to track pending mod    
 38  * a per-CRTC basis. Since updating the list s    
 39  * is reference counted to allow waiters to sa    
 40  * without holding any locks.                     
 41  *                                                
 42  * It has 3 different events in total to allow    
 43  * between outstanding updates::                  
 44  *                                                
 45  *      atomic commit thread                      
 46  *                                                
 47  *      write new state into hardware   ---->     
 48  *      signal hw_done                            
 49  *                                                
 50  *      ...                                       
 51  *                                                
 52  *      wait for buffers to show up               
 53  *                                                
 54  *      ...                                       
 55  *                                                
 56  *      cleanup old buffers                       
 57  *                                                
 58  *      signal cleanup_done                       
 59  *                                                
 60  *      wait for flip_done              <----     
 61  *      clean up atomic state                     
 62  *                                                
 63  * The important bit to know is that &cleanup_    
 64  * ordering between &flip_done and &hw_done is    
 65  * and modeset state change.                      
 66  *                                                
 67  * For an implementation of how to use this lo    
 68  * drm_atomic_helper_setup_commit() from the a    
 69  *                                                
 70  * See also drm_crtc_commit_wait().               
 71  */                                               
 72 struct drm_crtc_commit {                          
 73         /**                                       
 74          * @crtc:                                 
 75          *                                        
 76          * DRM CRTC for this commit.              
 77          */                                       
 78         struct drm_crtc *crtc;                    
 79                                                   
 80         /**                                       
 81          * @ref:                                  
 82          *                                        
 83          * Reference count for this structure.    
 84          * completions without the risk of the    
 85          * meanwhile.                             
 86          */                                       
 87         struct kref ref;                          
 88                                                   
 89         /**                                       
 90          * @flip_done:                            
 91          *                                        
 92          * Will be signaled when the hardware     
 93          * buffers. Signals at the same time a    
 94          * commit is sent to userspace, or whe    
 95          * that for most hardware, in most cas    
 96          * signalled.                             
 97          *                                        
 98          * Completion of this stage is signall    
 99          * drm_crtc_send_vblank_event() on &dr    
100          */                                       
101         struct completion flip_done;              
102                                                   
103         /**                                       
104          * @hw_done:                              
105          *                                        
106          * Will be signalled when all hw regis    
107          * been written out. Especially when d    
108          * later than @flip_done, since that c    
109          * screen goes black, whereas to fully    
110          * I/O is required.                       
111          *                                        
112          * Note that this does not need to inc    
113          * resources like backing storage buff    
114          * management.                            
115          *                                        
116          * Drivers should call drm_atomic_help    
117          * completion of this stage.              
118          */                                       
119         struct completion hw_done;                
120                                                   
121         /**                                       
122          * @cleanup_done:                         
123          *                                        
124          * Will be signalled after old buffers    
125          * drm_atomic_helper_cleanup_planes().    
126          * a vblank wait completed it might be    
127          * useful to throttle updates and avoi    
128          * of the buffer cleanup too much.        
129          *                                        
130          * Drivers should call drm_atomic_help    
131          * completion of this stage.              
132          */                                       
133         struct completion cleanup_done;           
134                                                   
135         /**                                       
136          * @commit_entry:                         
137          *                                        
138          * Entry on the per-CRTC &drm_crtc.com    
139          * $drm_crtc.commit_lock.                 
140          */                                       
141         struct list_head commit_entry;            
142                                                   
143         /**                                       
144          * @event:                                
145          *                                        
146          * &drm_pending_vblank_event pointer t    
147          */                                       
148         struct drm_pending_vblank_event *event    
149                                                   
150         /**                                       
151          * @abort_completion:                     
152          *                                        
153          * A flag that's set after drm_atomic_    
154          * second reference for the completion    
155          * used by the free code to remove the    
156          */                                       
157         bool abort_completion;                    
158 };                                                
159                                                   
160 struct __drm_planes_state {                       
161         struct drm_plane *ptr;                    
162         struct drm_plane_state *state, *old_st    
163 };                                                
164                                                   
165 struct __drm_crtcs_state {                        
166         struct drm_crtc *ptr;                     
167         struct drm_crtc_state *state, *old_sta    
168                                                   
169         /**                                       
170          * @commit:                               
171          *                                        
172          * A reference to the CRTC commit obje    
173          * drm_atomic_helper_wait_for_flip_don    
174          * drm_atomic_helper_commit_hw_done()     
175          * concurrent commit won't free a comm    
176          */                                       
177         struct drm_crtc_commit *commit;           
178                                                   
179         s32 __user *out_fence_ptr;                
180         u64 last_vblank_count;                    
181 };                                                
182                                                   
183 struct __drm_connnectors_state {                  
184         struct drm_connector *ptr;                
185         struct drm_connector_state *state, *ol    
186         /**                                       
187          * @out_fence_ptr:                        
188          *                                        
189          * User-provided pointer which the ker    
190          * file descriptor. Used by writeback     
191          * the writeback.                         
192          */                                       
193         s32 __user *out_fence_ptr;                
194 };                                                
195                                                   
196 struct drm_private_obj;                           
197 struct drm_private_state;                         
198                                                   
199 /**                                               
200  * struct drm_private_state_funcs - atomic sta    
201  *                                                
202  * These hooks are used by atomic helpers to c    
203  * private objects. The structure itself is us    
204  * associated private object type. Each privat    
205  * added to the atomic states is expected to h    
206  * hooks and pass a pointer to its drm_private    
207  * drm_atomic_get_private_obj_state().            
208  */                                               
209 struct drm_private_state_funcs {                  
210         /**                                       
211          * @atomic_duplicate_state:               
212          *                                        
213          * Duplicate the current state of the     
214          * is an error to call this before obj    
215          *                                        
216          * RETURNS:                               
217          *                                        
218          * Duplicated atomic state or NULL whe    
219          * initialized or allocation failed.      
220          */                                       
221         struct drm_private_state *(*atomic_dup    
222                                                   
223         /**                                       
224          * @atomic_destroy_state:                 
225          *                                        
226          * Frees the private object state crea    
227          */                                       
228         void (*atomic_destroy_state)(struct dr    
229                                      struct dr    
230                                                   
231         /**                                       
232          * @atomic_print_state:                   
233          *                                        
234          * If driver subclasses &struct drm_pr    
235          * this optional hook for printing add    
236          *                                        
237          * Do not call this directly, use drm_    
238          * instead.                               
239          */                                       
240         void (*atomic_print_state)(struct drm_    
241                                    const struc    
242 };                                                
243                                                   
244 /**                                               
245  * struct drm_private_obj - base struct for dr    
246  *                                                
247  * A driver private object is initialized by c    
248  * drm_atomic_private_obj_init() and cleaned u    
249  * drm_atomic_private_obj_fini().                 
250  *                                                
251  * Currently only tracks the state update func    
252  * private state itself, but in the future mig    
253  * &drm_modeset_lock is required to duplicate     
254  *                                                
255  * All private objects must be initialized bef    
256  * attached to is registered to the DRM subsys    
257  * and should stay around until this DRM devic    
258  * drm_dev_unregister()). In other words, priv    
259  * to the DRM device lifetime. This implies th    
260  *                                                
261  * 1/ all calls to drm_atomic_private_obj_init    
262  *    drm_dev_register()                          
263  * 2/ all calls to drm_atomic_private_obj_fini    
264  *    drm_dev_unregister()                        
265  *                                                
266  * If that private object is used to store a s    
267  * CRTCs, proper care must be taken to ensure     
268  * properly ordered to avoid a use-after-free     
269  *                                                
270  * Indeed, assuming a sequence of two non-bloc    
271  * different &drm_crtc using different &drm_pl    
272  * resources shared, there's no guarantee on w    
273  * first. However, the second &drm_atomic_comm    
274  * &drm_private_obj its old state, and will be    
275  * the second &drm_atomic_commit is done.         
276  *                                                
277  * If the first &drm_atomic_commit happens aft    
278  * &drm_private_obj the new state and will be     
279  * an access to a freed memory region. Drivers    
280  * to) the &drm_crtc_commit structure in our p    
281  * &drm_mode_config_helper_funcs.atomic_commit    
282  * commit to complete as the first step of        
283  * &drm_mode_config_helper_funcs.atomic_commit    
284  * drm_atomic_helper_wait_for_dependencies().     
285  */                                               
286 struct drm_private_obj {                          
287         /**                                       
288          * @head: List entry used to attach a     
289          * (queued to &drm_mode_config.privobj    
290          */                                       
291         struct list_head head;                    
292                                                   
293         /**                                       
294          * @lock: Modeset lock to protect the     
295          */                                       
296         struct drm_modeset_lock lock;             
297                                                   
298         /**                                       
299          * @state: Current atomic state for th    
300          */                                       
301         struct drm_private_state *state;          
302                                                   
303         /**                                       
304          * @funcs:                                
305          *                                        
306          * Functions to manipulate the state o    
307          * &drm_private_state_funcs.              
308          */                                       
309         const struct drm_private_state_funcs *    
310 };                                                
311                                                   
312 /**                                               
313  * drm_for_each_privobj() - private object ite    
314  *                                                
315  * @privobj: pointer to the current private ob    
316  *           iteration                            
317  * @dev: the DRM device we want get private ob    
318  *                                                
319  * Allows one to iterate over all private obje    
320  */                                               
321 #define drm_for_each_privobj(privobj, dev) \      
322         list_for_each_entry(privobj, &(dev)->m    
323                                                   
324 /**                                               
325  * struct drm_private_state - base struct for     
326  *                                                
327  * Currently only contains a backpointer to th    
328  * and the relevant private object but in the     
329  * synchronization information similar to e.g.    
330  */                                               
331 struct drm_private_state {                        
332         /**                                       
333          * @state: backpointer to global drm_a    
334          */                                       
335         struct drm_atomic_state *state;           
336                                                   
337         /**                                       
338          * @obj: backpointer to the private ob    
339          */                                       
340         struct drm_private_obj *obj;              
341 };                                                
342                                                   
343 struct __drm_private_objs_state {                 
344         struct drm_private_obj *ptr;              
345         struct drm_private_state *state, *old_    
346 };                                                
347                                                   
348 /**                                               
349  * struct drm_atomic_state - Atomic commit str    
350  *                                                
351  * This structure is the kernel counterpart of    
352  * an atomic commit that transitions from an o    
353  * contains all the objects affected by the at    
354  * state structures and pointers to the old st    
355  * these.                                         
356  *                                                
357  * States are added to an atomic update by cal    
358  * drm_atomic_get_plane_state(), drm_atomic_ge    
359  * private state structures, drm_atomic_get_pr    
360  */                                               
361 struct drm_atomic_state {                         
362         /**                                       
363          * @ref:                                  
364          *                                        
365          * Count of all references to this upd    
366          */                                       
367         struct kref ref;                          
368                                                   
369         /**                                       
370          * @dev: Parent DRM Device.               
371          */                                       
372         struct drm_device *dev;                   
373                                                   
374         /**                                       
375          * @allow_modeset:                        
376          *                                        
377          * Allow full modeset. This is used by    
378          * implement the DRM_MODE_ATOMIC_ALLOW    
379          * never consult this flag, instead lo    
380          * drm_atomic_crtc_needs_modeset().       
381          */                                       
382         bool allow_modeset : 1;                   
383         /**                                       
384          * @legacy_cursor_update:                 
385          *                                        
386          * Hint to enforce legacy cursor IOCTL    
387          *                                        
388          * WARNING: This is thoroughly broken     
389          * implement correctly. Drivers must i    
390          * implement &drm_plane_helper_funcs.a    
391          * &drm_plane_helper_funcs.atomic_asyn    
392          * flag are not allowed.                  
393          */                                       
394         bool legacy_cursor_update : 1;            
395                                                   
396         /**                                       
397          * @async_update: hint for asynchronou    
398          */                                       
399         bool async_update : 1;                    
400                                                   
401         /**                                       
402          * @duplicated:                           
403          *                                        
404          * Indicates whether or not this atomi    
405          * drm_atomic_helper_duplicate_state()    
406          * should use this to fixup normal  in    
407          * states.                                
408          */                                       
409         bool duplicated : 1;                      
410                                                   
411         /**                                       
412          * @planes:                               
413          *                                        
414          * Pointer to array of @drm_plane and     
415          * update.                                
416          */                                       
417         struct __drm_planes_state *planes;        
418                                                   
419         /**                                       
420          * @crtcs:                                
421          *                                        
422          * Pointer to array of @drm_crtc and @    
423          * update.                                
424          */                                       
425         struct __drm_crtcs_state *crtcs;          
426                                                   
427         /**                                       
428          * @num_connector: size of the @connec    
429          */                                       
430         int num_connector;                        
431                                                   
432         /**                                       
433          * @connectors:                           
434          *                                        
435          * Pointer to array of @drm_connector     
436          * this update.                           
437          */                                       
438         struct __drm_connnectors_state *connec    
439                                                   
440         /**                                       
441          * @num_private_objs: size of the @pri    
442          */                                       
443         int num_private_objs;                     
444                                                   
445         /**                                       
446          * @private_objs:                         
447          *                                        
448          * Pointer to array of @drm_private_ob    
449          * of this update.                        
450          */                                       
451         struct __drm_private_objs_state *priva    
452                                                   
453         /**                                       
454          * @acquire_ctx: acquire context for t    
455          */                                       
456         struct drm_modeset_acquire_ctx *acquir    
457                                                   
458         /**                                       
459          * @fake_commit:                          
460          *                                        
461          * Used for signaling unbound planes/c    
462          * When a connector or plane is not bo    
463          * to preserve linearity to prevent th    
464          *                                        
465          * This commit (if set) is not bound t    
466          * drm_atomic_helper_commit_hw_done()     
467          */                                       
468         struct drm_crtc_commit *fake_commit;      
469                                                   
470         /**                                       
471          * @commit_work:                          
472          *                                        
473          * Work item which can be used by the     
474          * commit without blocking.               
475          */                                       
476         struct work_struct commit_work;           
477 };                                                
478                                                   
479 void __drm_crtc_commit_free(struct kref *kref)    
480                                                   
481 /**                                               
482  * drm_crtc_commit_get - acquire a reference t    
483  * @commit: CRTC commit                           
484  *                                                
485  * Increases the reference of @commit.            
486  *                                                
487  * Returns:                                       
488  * The pointer to @commit, with reference incr    
489  */                                               
490 static inline struct drm_crtc_commit *drm_crtc    
491 {                                                 
492         kref_get(&commit->ref);                   
493         return commit;                            
494 }                                                 
495                                                   
496 /**                                               
497  * drm_crtc_commit_put - release a reference t    
498  * @commit: CRTC commit                           
499  *                                                
500  * This releases a reference to @commit which     
501  * final reference. No locking required and ca    
502  */                                               
503 static inline void drm_crtc_commit_put(struct     
504 {                                                 
505         kref_put(&commit->ref, __drm_crtc_comm    
506 }                                                 
507                                                   
508 int drm_crtc_commit_wait(struct drm_crtc_commi    
509                                                   
510 struct drm_atomic_state * __must_check            
511 drm_atomic_state_alloc(struct drm_device *dev)    
512 void drm_atomic_state_clear(struct drm_atomic_    
513                                                   
514 /**                                               
515  * drm_atomic_state_get - acquire a reference     
516  * @state: The atomic state                       
517  *                                                
518  * Returns a new reference to the @state          
519  */                                               
520 static inline struct drm_atomic_state *           
521 drm_atomic_state_get(struct drm_atomic_state *    
522 {                                                 
523         kref_get(&state->ref);                    
524         return state;                             
525 }                                                 
526                                                   
527 void __drm_atomic_state_free(struct kref *ref)    
528                                                   
529 /**                                               
530  * drm_atomic_state_put - release a reference     
531  * @state: The atomic state                       
532  *                                                
533  * This releases a reference to @state which i    
534  * final reference. No locking required and ca    
535  */                                               
536 static inline void drm_atomic_state_put(struct    
537 {                                                 
538         kref_put(&state->ref, __drm_atomic_sta    
539 }                                                 
540                                                   
541 int  __must_check                                 
542 drm_atomic_state_init(struct drm_device *dev,     
543 void drm_atomic_state_default_clear(struct drm    
544 void drm_atomic_state_default_release(struct d    
545                                                   
546 struct drm_crtc_state * __must_check              
547 drm_atomic_get_crtc_state(struct drm_atomic_st    
548                           struct drm_crtc *crt    
549 struct drm_plane_state * __must_check             
550 drm_atomic_get_plane_state(struct drm_atomic_s    
551                            struct drm_plane *p    
552 struct drm_connector_state * __must_check         
553 drm_atomic_get_connector_state(struct drm_atom    
554                                struct drm_conn    
555                                                   
556 void drm_atomic_private_obj_init(struct drm_de    
557                                  struct drm_pr    
558                                  struct drm_pr    
559                                  const struct     
560 void drm_atomic_private_obj_fini(struct drm_pr    
561                                                   
562 struct drm_private_state * __must_check           
563 drm_atomic_get_private_obj_state(struct drm_at    
564                                  struct drm_pr    
565 struct drm_private_state *                        
566 drm_atomic_get_old_private_obj_state(const str    
567                                      struct dr    
568 struct drm_private_state *                        
569 drm_atomic_get_new_private_obj_state(const str    
570                                      struct dr    
571                                                   
572 struct drm_connector *                            
573 drm_atomic_get_old_connector_for_encoder(const    
574                                          struc    
575 struct drm_connector *                            
576 drm_atomic_get_new_connector_for_encoder(const    
577                                          struc    
578                                                   
579 struct drm_crtc *                                 
580 drm_atomic_get_old_crtc_for_encoder(struct drm    
581                                          struc    
582 struct drm_crtc *                                 
583 drm_atomic_get_new_crtc_for_encoder(struct drm    
584                                          struc    
585                                                   
586 /**                                               
587  * drm_atomic_get_existing_crtc_state - get CR    
588  * @state: global atomic state object             
589  * @crtc: CRTC to grab                            
590  *                                                
591  * This function returns the CRTC state for th    
592  * if the CRTC is not part of the global atomi    
593  *                                                
594  * This function is deprecated, @drm_atomic_ge    
595  * @drm_atomic_get_new_crtc_state should be us    
596  */                                               
597 static inline struct drm_crtc_state *             
598 drm_atomic_get_existing_crtc_state(const struc    
599                                    struct drm_    
600 {                                                 
601         return state->crtcs[drm_crtc_index(crt    
602 }                                                 
603                                                   
604 /**                                               
605  * drm_atomic_get_old_crtc_state - get old CRT    
606  * @state: global atomic state object             
607  * @crtc: CRTC to grab                            
608  *                                                
609  * This function returns the old CRTC state fo    
610  * NULL if the CRTC is not part of the global     
611  */                                               
612 static inline struct drm_crtc_state *             
613 drm_atomic_get_old_crtc_state(const struct drm    
614                               struct drm_crtc     
615 {                                                 
616         return state->crtcs[drm_crtc_index(crt    
617 }                                                 
618 /**                                               
619  * drm_atomic_get_new_crtc_state - get new CRT    
620  * @state: global atomic state object             
621  * @crtc: CRTC to grab                            
622  *                                                
623  * This function returns the new CRTC state fo    
624  * NULL if the CRTC is not part of the global     
625  */                                               
626 static inline struct drm_crtc_state *             
627 drm_atomic_get_new_crtc_state(const struct drm    
628                               struct drm_crtc     
629 {                                                 
630         return state->crtcs[drm_crtc_index(crt    
631 }                                                 
632                                                   
633 /**                                               
634  * drm_atomic_get_existing_plane_state - get p    
635  * @state: global atomic state object             
636  * @plane: plane to grab                          
637  *                                                
638  * This function returns the plane state for t    
639  * if the plane is not part of the global atom    
640  *                                                
641  * This function is deprecated, @drm_atomic_ge    
642  * @drm_atomic_get_new_plane_state should be u    
643  */                                               
644 static inline struct drm_plane_state *            
645 drm_atomic_get_existing_plane_state(const stru    
646                                     struct drm    
647 {                                                 
648         return state->planes[drm_plane_index(p    
649 }                                                 
650                                                   
651 /**                                               
652  * drm_atomic_get_old_plane_state - get plane     
653  * @state: global atomic state object             
654  * @plane: plane to grab                          
655  *                                                
656  * This function returns the old plane state f    
657  * NULL if the plane is not part of the global    
658  */                                               
659 static inline struct drm_plane_state *            
660 drm_atomic_get_old_plane_state(const struct dr    
661                                struct drm_plan    
662 {                                                 
663         return state->planes[drm_plane_index(p    
664 }                                                 
665                                                   
666 /**                                               
667  * drm_atomic_get_new_plane_state - get plane     
668  * @state: global atomic state object             
669  * @plane: plane to grab                          
670  *                                                
671  * This function returns the new plane state f    
672  * NULL if the plane is not part of the global    
673  */                                               
674 static inline struct drm_plane_state *            
675 drm_atomic_get_new_plane_state(const struct dr    
676                                struct drm_plan    
677 {                                                 
678         return state->planes[drm_plane_index(p    
679 }                                                 
680                                                   
681 /**                                               
682  * drm_atomic_get_existing_connector_state - g    
683  * @state: global atomic state object             
684  * @connector: connector to grab                  
685  *                                                
686  * This function returns the connector state f    
687  * or NULL if the connector is not part of the    
688  *                                                
689  * This function is deprecated, @drm_atomic_ge    
690  * @drm_atomic_get_new_connector_state should     
691  */                                               
692 static inline struct drm_connector_state *        
693 drm_atomic_get_existing_connector_state(const     
694                                         struct    
695 {                                                 
696         int index = drm_connector_index(connec    
697                                                   
698         if (index >= state->num_connector)        
699                 return NULL;                      
700                                                   
701         return state->connectors[index].state;    
702 }                                                 
703                                                   
704 /**                                               
705  * drm_atomic_get_old_connector_state - get co    
706  * @state: global atomic state object             
707  * @connector: connector to grab                  
708  *                                                
709  * This function returns the old connector sta    
710  * or NULL if the connector is not part of the    
711  */                                               
712 static inline struct drm_connector_state *        
713 drm_atomic_get_old_connector_state(const struc    
714                                    struct drm_    
715 {                                                 
716         int index = drm_connector_index(connec    
717                                                   
718         if (index >= state->num_connector)        
719                 return NULL;                      
720                                                   
721         return state->connectors[index].old_st    
722 }                                                 
723                                                   
724 /**                                               
725  * drm_atomic_get_new_connector_state - get co    
726  * @state: global atomic state object             
727  * @connector: connector to grab                  
728  *                                                
729  * This function returns the new connector sta    
730  * or NULL if the connector is not part of the    
731  */                                               
732 static inline struct drm_connector_state *        
733 drm_atomic_get_new_connector_state(const struc    
734                                    struct drm_    
735 {                                                 
736         int index = drm_connector_index(connec    
737                                                   
738         if (index >= state->num_connector)        
739                 return NULL;                      
740                                                   
741         return state->connectors[index].new_st    
742 }                                                 
743                                                   
744 /**                                               
745  * __drm_atomic_get_current_plane_state - get     
746  * @state: global atomic state object             
747  * @plane: plane to grab                          
748  *                                                
749  * This function returns the plane state for t    
750  * @state, or if the plane isn't part of the a    
751  * This is useful in atomic check callbacks, w    
752  * not change, state of other planes, since it    
753  * back up the call chain.                        
754  *                                                
755  * WARNING:                                       
756  *                                                
757  * Note that this function is in general unsaf    
758  * required locking for access state structure    
759  * safe to access the returned state structure    
760  * example is when planes are fixed to a singl    
761  * the CRTC lock is held already. In that case    
762  * read-lock on all planes connected to that C    
763  * reassigned things get more tricky. In that     
764  * drm_atomic_get_plane_state and wire up full    
765  *                                                
766  * Returns:                                       
767  *                                                
768  * Read-only pointer to the current plane stat    
769  */                                               
770 static inline const struct drm_plane_state *      
771 __drm_atomic_get_current_plane_state(const str    
772                                      struct dr    
773 {                                                 
774         if (state->planes[drm_plane_index(plan    
775                 return state->planes[drm_plane    
776                                                   
777         return plane->state;                      
778 }                                                 
779                                                   
780 int __must_check                                  
781 drm_atomic_add_encoder_bridges(struct drm_atom    
782                                struct drm_enco    
783 int __must_check                                  
784 drm_atomic_add_affected_connectors(struct drm_    
785                                    struct drm_    
786 int __must_check                                  
787 drm_atomic_add_affected_planes(struct drm_atom    
788                                struct drm_crtc    
789                                                   
790 int __must_check drm_atomic_check_only(struct     
791 int __must_check drm_atomic_commit(struct drm_    
792 int __must_check drm_atomic_nonblocking_commit    
793                                                   
794 void drm_state_dump(struct drm_device *dev, st    
795                                                   
796 /**                                               
797  * for_each_oldnew_connector_in_state - iterat    
798  * @__state: &struct drm_atomic_state pointer     
799  * @connector: &struct drm_connector iteration    
800  * @old_connector_state: &struct drm_connector    
801  *      old state                                 
802  * @new_connector_state: &struct drm_connector    
803  *      new state                                 
804  * @__i: int iteration cursor, for macro-inter    
805  *                                                
806  * This iterates over all connectors in an ato    
807  * new state. This is useful in places where t    
808  * considered, for example in atomic check fun    
809  */                                               
810 #define for_each_oldnew_connector_in_state(__s    
811         for ((__i) = 0;                           
812              (__i) < (__state)->num_connector;    
813              (__i)++)                             
814                 for_each_if ((__state)->connec    
815                              ((connector) = (_    
816                              (void)(connector)    
817                              (old_connector_st    
818                              (new_connector_st    
819                                                   
820 /**                                               
821  * for_each_old_connector_in_state - iterate o    
822  * @__state: &struct drm_atomic_state pointer     
823  * @connector: &struct drm_connector iteration    
824  * @old_connector_state: &struct drm_connector    
825  *      old state                                 
826  * @__i: int iteration cursor, for macro-inter    
827  *                                                
828  * This iterates over all connectors in an ato    
829  * state. This is useful in disable functions,    
830  * hardware is still in.                          
831  */                                               
832 #define for_each_old_connector_in_state(__stat    
833         for ((__i) = 0;                           
834              (__i) < (__state)->num_connector;    
835              (__i)++)                             
836                 for_each_if ((__state)->connec    
837                              ((connector) = (_    
838                              (void)(connector)    
839                              (old_connector_st    
840                                                   
841 /**                                               
842  * for_each_new_connector_in_state - iterate o    
843  * @__state: &struct drm_atomic_state pointer     
844  * @connector: &struct drm_connector iteration    
845  * @new_connector_state: &struct drm_connector    
846  *      new state                                 
847  * @__i: int iteration cursor, for macro-inter    
848  *                                                
849  * This iterates over all connectors in an ato    
850  * state. This is useful in enable functions,     
851  * hardware should be in when the atomic commi    
852  */                                               
853 #define for_each_new_connector_in_state(__stat    
854         for ((__i) = 0;                           
855              (__i) < (__state)->num_connector;    
856              (__i)++)                             
857                 for_each_if ((__state)->connec    
858                              ((connector) = (_    
859                              (void)(connector)    
860                              (new_connector_st    
861                              (void)(new_connec    
862                                                   
863 /**                                               
864  * for_each_oldnew_crtc_in_state - iterate ove    
865  * @__state: &struct drm_atomic_state pointer     
866  * @crtc: &struct drm_crtc iteration cursor       
867  * @old_crtc_state: &struct drm_crtc_state ite    
868  * @new_crtc_state: &struct drm_crtc_state ite    
869  * @__i: int iteration cursor, for macro-inter    
870  *                                                
871  * This iterates over all CRTCs in an atomic u    
872  * new state. This is useful in places where t    
873  * considered, for example in atomic check fun    
874  */                                               
875 #define for_each_oldnew_crtc_in_state(__state,    
876         for ((__i) = 0;                           
877              (__i) < (__state)->dev->mode_conf    
878              (__i)++)                             
879                 for_each_if ((__state)->crtcs[    
880                              ((crtc) = (__stat    
881                               (void)(crtc) /*     
882                              (old_crtc_state)     
883                              (void)(old_crtc_s    
884                              (new_crtc_state)     
885                              (void)(new_crtc_s    
886                                                   
887 /**                                               
888  * for_each_old_crtc_in_state - iterate over a    
889  * @__state: &struct drm_atomic_state pointer     
890  * @crtc: &struct drm_crtc iteration cursor       
891  * @old_crtc_state: &struct drm_crtc_state ite    
892  * @__i: int iteration cursor, for macro-inter    
893  *                                                
894  * This iterates over all CRTCs in an atomic u    
895  * state. This is useful in disable functions,    
896  * hardware is still in.                          
897  */                                               
898 #define for_each_old_crtc_in_state(__state, cr    
899         for ((__i) = 0;                           
900              (__i) < (__state)->dev->mode_conf    
901              (__i)++)                             
902                 for_each_if ((__state)->crtcs[    
903                              ((crtc) = (__stat    
904                              (void)(crtc) /* O    
905                              (old_crtc_state)     
906                                                   
907 /**                                               
908  * for_each_new_crtc_in_state - iterate over a    
909  * @__state: &struct drm_atomic_state pointer     
910  * @crtc: &struct drm_crtc iteration cursor       
911  * @new_crtc_state: &struct drm_crtc_state ite    
912  * @__i: int iteration cursor, for macro-inter    
913  *                                                
914  * This iterates over all CRTCs in an atomic u    
915  * state. This is useful in enable functions,     
916  * hardware should be in when the atomic commi    
917  */                                               
918 #define for_each_new_crtc_in_state(__state, cr    
919         for ((__i) = 0;                           
920              (__i) < (__state)->dev->mode_conf    
921              (__i)++)                             
922                 for_each_if ((__state)->crtcs[    
923                              ((crtc) = (__stat    
924                              (void)(crtc) /* O    
925                              (new_crtc_state)     
926                              (void)(new_crtc_s    
927                                                   
928 /**                                               
929  * for_each_oldnew_plane_in_state - iterate ov    
930  * @__state: &struct drm_atomic_state pointer     
931  * @plane: &struct drm_plane iteration cursor     
932  * @old_plane_state: &struct drm_plane_state i    
933  * @new_plane_state: &struct drm_plane_state i    
934  * @__i: int iteration cursor, for macro-inter    
935  *                                                
936  * This iterates over all planes in an atomic     
937  * new state. This is useful in places where t    
938  * considered, for example in atomic check fun    
939  */                                               
940 #define for_each_oldnew_plane_in_state(__state    
941         for ((__i) = 0;                           
942              (__i) < (__state)->dev->mode_conf    
943              (__i)++)                             
944                 for_each_if ((__state)->planes    
945                              ((plane) = (__sta    
946                               (void)(plane) /*    
947                               (old_plane_state    
948                               (new_plane_state    
949                                                   
950 /**                                               
951  * for_each_oldnew_plane_in_state_reverse - it    
952  * update in reverse order                        
953  * @__state: &struct drm_atomic_state pointer     
954  * @plane: &struct drm_plane iteration cursor     
955  * @old_plane_state: &struct drm_plane_state i    
956  * @new_plane_state: &struct drm_plane_state i    
957  * @__i: int iteration cursor, for macro-inter    
958  *                                                
959  * This iterates over all planes in an atomic     
960  * tracking both old and  new state. This is u    
961  * state delta needs to be considered, for exa    
962  */                                               
963 #define for_each_oldnew_plane_in_state_reverse    
964         for ((__i) = ((__state)->dev->mode_con    
965              (__i) >= 0;                          
966              (__i)--)                             
967                 for_each_if ((__state)->planes    
968                              ((plane) = (__sta    
969                               (old_plane_state    
970                               (new_plane_state    
971                                                   
972 /**                                               
973  * for_each_new_plane_in_state_reverse - other    
974  * it's the same as for_each_oldnew_plane_in_s    
975  * @__state: &struct drm_atomic_state pointer     
976  * @plane: &struct drm_plane iteration cursor     
977  * @new_plane_state: &struct drm_plane_state i    
978  * @__i: int iteration cursor, for macro-inter    
979  */                                               
980 #define for_each_new_plane_in_state_reverse(__    
981         for ((__i) = ((__state)->dev->mode_con    
982              (__i) >= 0;                          
983              (__i)--)                             
984                 for_each_if ((__state)->planes    
985                              ((plane) = (__sta    
986                               (new_plane_state    
987                                                   
988 /**                                               
989  * for_each_old_plane_in_state - iterate over     
990  * @__state: &struct drm_atomic_state pointer     
991  * @plane: &struct drm_plane iteration cursor     
992  * @old_plane_state: &struct drm_plane_state i    
993  * @__i: int iteration cursor, for macro-inter    
994  *                                                
995  * This iterates over all planes in an atomic     
996  * state. This is useful in disable functions,    
997  * hardware is still in.                          
998  */                                               
999 #define for_each_old_plane_in_state(__state, p    
1000         for ((__i) = 0;                          
1001              (__i) < (__state)->dev->mode_con    
1002              (__i)++)                            
1003                 for_each_if ((__state)->plane    
1004                              ((plane) = (__st    
1005                               (old_plane_stat    
1006 /**                                              
1007  * for_each_new_plane_in_state - iterate over    
1008  * @__state: &struct drm_atomic_state pointer    
1009  * @plane: &struct drm_plane iteration cursor    
1010  * @new_plane_state: &struct drm_plane_state     
1011  * @__i: int iteration cursor, for macro-inte    
1012  *                                               
1013  * This iterates over all planes in an atomic    
1014  * state. This is useful in enable functions,    
1015  * hardware should be in when the atomic comm    
1016  */                                              
1017 #define for_each_new_plane_in_state(__state,     
1018         for ((__i) = 0;                          
1019              (__i) < (__state)->dev->mode_con    
1020              (__i)++)                            
1021                 for_each_if ((__state)->plane    
1022                              ((plane) = (__st    
1023                               (void)(plane) /    
1024                               (new_plane_stat    
1025                               (void)(new_plan    
1026                                                  
1027 /**                                              
1028  * for_each_oldnew_private_obj_in_state - ite    
1029  * @__state: &struct drm_atomic_state pointer    
1030  * @obj: &struct drm_private_obj iteration cu    
1031  * @old_obj_state: &struct drm_private_state     
1032  * @new_obj_state: &struct drm_private_state     
1033  * @__i: int iteration cursor, for macro-inte    
1034  *                                               
1035  * This iterates over all private objects in     
1036  * old and new state. This is useful in place    
1037  * to be considered, for example in atomic ch    
1038  */                                              
1039 #define for_each_oldnew_private_obj_in_state(    
1040         for ((__i) = 0; \                        
1041              (__i) < (__state)->num_private_o    
1042                      ((obj) = (__state)->priv    
1043                       (old_obj_state) = (__st    
1044                       (new_obj_state) = (__st    
1045              (__i)++)                            
1046                                                  
1047 /**                                              
1048  * for_each_old_private_obj_in_state - iterat    
1049  * @__state: &struct drm_atomic_state pointer    
1050  * @obj: &struct drm_private_obj iteration cu    
1051  * @old_obj_state: &struct drm_private_state     
1052  * @__i: int iteration cursor, for macro-inte    
1053  *                                               
1054  * This iterates over all private objects in     
1055  * the old state. This is useful in disable f    
1056  * state the hardware is still in.               
1057  */                                              
1058 #define for_each_old_private_obj_in_state(__s    
1059         for ((__i) = 0; \                        
1060              (__i) < (__state)->num_private_o    
1061                      ((obj) = (__state)->priv    
1062                       (old_obj_state) = (__st    
1063              (__i)++)                            
1064                                                  
1065 /**                                              
1066  * for_each_new_private_obj_in_state - iterat    
1067  * @__state: &struct drm_atomic_state pointer    
1068  * @obj: &struct drm_private_obj iteration cu    
1069  * @new_obj_state: &struct drm_private_state     
1070  * @__i: int iteration cursor, for macro-inte    
1071  *                                               
1072  * This iterates over all private objects in     
1073  * the new state. This is useful in enable fu    
1074  * hardware should be in when the atomic comm    
1075  */                                              
1076 #define for_each_new_private_obj_in_state(__s    
1077         for ((__i) = 0; \                        
1078              (__i) < (__state)->num_private_o    
1079                      ((obj) = (__state)->priv    
1080                       (void)(obj) /* Only to     
1081                       (new_obj_state) = (__st    
1082              (__i)++)                            
1083                                                  
1084 /**                                              
1085  * drm_atomic_crtc_needs_modeset - compute co    
1086  * @state: &drm_crtc_state for the CRTC          
1087  *                                               
1088  * To give drivers flexibility &struct drm_cr    
1089  * whether the state CRTC changed enough to n    
1090  * mode_changed, active_changed and connector    
1091  * combines these three to compute the overal    
1092  *                                               
1093  * The atomic helper code sets these booleans    
1094  * change them appropriately to accurately re    
1095  * really needed. In general, drivers should     
1096  * possible.                                     
1097  *                                               
1098  * For example if the CRTC mode has changed,     
1099  * the requested mode change without going th    
1100  * should clear mode_changed in its &drm_mode    
1101  * implementation.                               
1102  */                                              
1103 static inline bool                               
1104 drm_atomic_crtc_needs_modeset(const struct dr    
1105 {                                                
1106         return state->mode_changed || state->    
1107                state->connectors_changed;        
1108 }                                                
1109                                                  
1110 /**                                              
1111  * drm_atomic_crtc_effectively_active - compu    
1112  * @state: &drm_crtc_state for the CRTC          
1113  *                                               
1114  * When in self refresh mode, the crtc_state-    
1115  * the CRTC is off. However in some cases we'    
1116  * is active, or effectively active (ie: it's    
1117  * In these cases, use this function instead     
1118  */                                              
1119 static inline bool                               
1120 drm_atomic_crtc_effectively_active(const stru    
1121 {                                                
1122         return state->active || state->self_r    
1123 }                                                
1124                                                  
1125 /**                                              
1126  * struct drm_bus_cfg - bus configuration        
1127  *                                               
1128  * This structure stores the configuration of    
1129  * components in an output pipeline, usually     
1130  * and a bridge, or a bridge and a connector.    
1131  *                                               
1132  * The bus configuration is stored in &drm_br    
1133  * input and output buses, as seen from the p    
1134  * bus configuration of a bridge output is us    
1135  * configuration of the next bridge's input,     
1136  * modified between the two bridges, for inst    
1137  * The input and output configurations of a b    
1138  * modifies the signals internally, for insta    
1139  * conversion, or modifying signals polaritie    
1140  */                                              
1141 struct drm_bus_cfg {                             
1142         /**                                      
1143          * @format: format used on this bus (    
1144          *                                       
1145          * This field should not be directly     
1146          * (drm_atomic_bridge_chain_select_bu    
1147          * format negotiation).                  
1148          */                                      
1149         u32 format;                              
1150                                                  
1151         /**                                      
1152          * @flags: DRM_BUS_* flags used on th    
1153          */                                      
1154         u32 flags;                               
1155 };                                               
1156                                                  
1157 /**                                              
1158  * struct drm_bridge_state - Atomic bridge st    
1159  */                                              
1160 struct drm_bridge_state {                        
1161         /**                                      
1162          * @base: inherit from &drm_private_s    
1163          */                                      
1164         struct drm_private_state base;           
1165                                                  
1166         /**                                      
1167          * @bridge: the bridge this state ref    
1168          */                                      
1169         struct drm_bridge *bridge;               
1170                                                  
1171         /**                                      
1172          * @input_bus_cfg: input bus configur    
1173          */                                      
1174         struct drm_bus_cfg input_bus_cfg;        
1175                                                  
1176         /**                                      
1177          * @output_bus_cfg: output bus config    
1178          */                                      
1179         struct drm_bus_cfg output_bus_cfg;       
1180 };                                               
1181                                                  
1182 static inline struct drm_bridge_state *          
1183 drm_priv_to_bridge_state(struct drm_private_s    
1184 {                                                
1185         return container_of(priv, struct drm_    
1186 }                                                
1187                                                  
1188 struct drm_bridge_state *                        
1189 drm_atomic_get_bridge_state(struct drm_atomic    
1190                             struct drm_bridge    
1191 struct drm_bridge_state *                        
1192 drm_atomic_get_old_bridge_state(const struct     
1193                                 struct drm_br    
1194 struct drm_bridge_state *                        
1195 drm_atomic_get_new_bridge_state(const struct     
1196                                 struct drm_br    
1197                                                  
1198 #endif /* DRM_ATOMIC_H_ */                       
1199                                                  

~ [ 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