[Intel-gfx] [PATCH v4 4/8] drm: Add driver-private objects to atomic state

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Mar 23 08:54:42 UTC 2017


Op 22-03-17 om 22:05 schreef Pandiyan, Dhinakaran:
> On Wed, 2017-03-22 at 11:00 +0100, Maarten Lankhorst wrote:
>> Op 16-03-17 om 08:10 schreef Dhinakaran Pandiyan:
>>> From: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan at intel.com>
>>>
>>> It is necessary to track states for objects other than connector, crtc
>>> and plane for atomic modesets. But adding objects like DP MST link
>>> bandwidth to drm_atomic_state would mean that a non-core object will be
>>> modified by the core helper functions for swapping and clearing
>>> it's state. So, lets add void * objects and helper functions that operate
>>> on void * types to keep these objects and states private to the core.
>>> Drivers can then implement specific functions to swap and clear states.
>>> The other advantage having just void * for these objects in
>>> drm_atomic_state is that objects of different types can be managed in the
>>> same state array.
>>>
>>> v2: Added docs and new iterator to filter private objects (Daniel)
>>> v3: Macro alignment (Chris)
>>>
>>> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
>>> Cc: Archit Taneja <architt at codeaurora.org>
>>> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>>> Cc: Chris Wilson <chris at chris-wilson.co.uk>
>>> Cc: Harry Wentland <Harry.wentland at amd.com>
>>> Acked-by: Harry Wentland <harry.wentland at amd.com>
>>> Suggested-by: Daniel Vetter <daniel.vetter at ffwll.ch>
>>> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
>> Mostly looks good, but too many null checks. I think it's best to get rid of them all
>> by freeing state->driver_private in default_clear() or setting num_private_objs to 0.
>> It would remove the need for all null checks I think..
>>
>> ~Maarten
>>
> Did you mean the NULL checks in this loop inside
> drm_atomic_get_private_obj_state()
>
> +       for (i = 0; i < state->num_private_objs; i++)
> +               if (obj == state->private_objs[i].obj &&
> +                   state->private_objs[i].obj_state)
> +                       return state->private_objs[i].obj_state;
>
> and the fact that I am not setting num_private_objs = 0 in
> drm_atomic_state_default_clear() ?
All of them, the NULL check in default_clear goes away, same for get_private_obj_state, and __for_each_private_obj


More information about the dri-devel mailing list