Skip to content

Commit 6142b1b

Browse files
committed
drm/todo: Plumb drm_atomic_state all over
Add a TODO for plumbing drm_atomic_state all over to ease the hurdles of accessing additional object states. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> #irc Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200717135439.5996-1-ville.syrjala@linux.intel.com
1 parent 4031ead commit 6142b1b

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎Documentation/gpu/todo.rst‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,52 @@ Contact: Emil Velikov, respective driver maintainers
403403

404404
Level: Intermediate
405405

406+
Plumb drm_atomic_state all over
407+
-------------------------------
408+
409+
Currently various atomic functions take just a single or a handful of
410+
object states (eg. plane state). While that single object state can
411+
suffice for some simple cases, we often have to dig out additional
412+
object states for dealing with various dependencies between the individual
413+
objects or the hardware they represent. The process of digging out the
414+
additional states is rather non-intuitive and error prone.
415+
416+
To fix that most functions should rather take the overall
417+
drm_atomic_state as one of their parameters. The other parameters
418+
would generally be the object(s) we mainly want to interact with.
419+
420+
For example, instead of
421+
422+
.. code-block:: c
423+
424+
int (*atomic_check)(struct drm_plane *plane, struct drm_plane_state *state);
425+
426+
we would have something like
427+
428+
.. code-block:: c
429+
430+
int (*atomic_check)(struct drm_plane *plane, struct drm_atomic_state *state);
431+
432+
The implementation can then trivially gain access to any required object
433+
state(s) via drm_atomic_get_plane_state(), drm_atomic_get_new_plane_state(),
434+
drm_atomic_get_old_plane_state(), and their equivalents for
435+
other object types.
436+
437+
Additionally many drivers currently access the object->state pointer
438+
directly in their commit functions. That is not going to work if we
439+
eg. want to allow deeper commit pipelines as those pointers could
440+
then point to the states corresponding to a future commit instead of
441+
the current commit we're trying to process. Also non-blocking commits
442+
execute locklessly so there are serious concerns with dereferencing
443+
the object->state pointers without holding the locks that protect them.
444+
Use of drm_atomic_get_new_plane_state(), drm_atomic_get_old_plane_state(),
445+
etc. avoids these problems as well since they relate to a specific
446+
commit via the passed in drm_atomic_state.
447+
448+
Contact: Ville Syrjälä, Daniel Vetter
449+
450+
Level: Intermediate
451+
406452

407453
Core refactorings
408454
=================

0 commit comments

Comments
 (0)