Re: [PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state.

2017-02-12 Thread Laurent Pinchart
Hi Maarten,

Do you plan to post a v4 ? I have two drivers that depends on this series for 
fence support, and I'd like to get that merged in v4.12.

On Monday 16 Jan 2017 10:37:37 Maarten Lankhorst wrote:
> Fourth iteration. Instead of trying to convert all drivers straight away,
> implement all macros that are required to get state working.
> 
> Old situation:
> Use obj->state, which can refer to old or new state.
> Use drm_atomic_get_(existing_)obj_state, which can refer to new or old
> state. Use for_each_obj_in_state, which refers to new or old state.
> 
> New situation:
> 
> During atomic check:
> - Use drm_atomic_get_obj_state to add a object to the atomic state,
>   or get the new state.
> - Use drm_atomic_get_(old/new)_obj_state to peek at the new/old state,
>   without adding the object. This will return NULL if the object is
>   not part of the state. For planes and connectors the relevant crtc_state
>   is added, so this will work to get the crtc_state from obj_state->crtc
>   too, this means not having to write some error handling.
> 
> During atomic commit:
> - Do not use drm_atomic_get_obj_state, obj->state or
> drm_atomic_get_(existing_)obj_state any more, replace with
> drm_atomic_get_old/new_obj_state calls as required.
> 
> During both:
> - Use for_each_(new,old,oldnew)_obj_in_state to get the old or new state as
> needed. oldnew will be renamed to for_each_obj_in_state after all callers
> are converted to the new api.
> 
> When not doing atomic updates:
> Look at obj->state for now. I have some patches to fix this but I was asked
> to make it return a const state. This breaks a lot of users though so I
> skipped that patch in this iteration.
> 
> This series will return the correct state regardless of swapping.
> 
> Maarten Lankhorst (7):
>   drm/atomic: Add new iterators over all state, v3.
>   drm/atomic: Make add_affected_connectors look at crtc_state.
>   drm/atomic: Use new atomic iterator macros.
>   drm/atomic: Fix atomic helpers to use the new iterator macros.
>   drm/atomic: Add macros to access existing old/new state
>   drm/atomic: Convert get_existing_state callers to get_old/new_state, v2.
>   drm/blend: Use new atomic iterator macros.
> 
>  drivers/gpu/drm/drm_atomic.c |  39 ++--
>  drivers/gpu/drm/drm_atomic_helper.c  | 377 ++--
>  drivers/gpu/drm/drm_blend.c  |  23 +--
>  drivers/gpu/drm/i915/intel_display.c |  13 +-
>  include/drm/drm_atomic.h | 180 -
>  include/drm/drm_atomic_helper.h  |   2 +
>  6 files changed, 438 insertions(+), 196 deletions(-)

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state.

2017-01-23 Thread Daniel Vetter
On Tue, Jan 17, 2017 at 02:45:32AM +0200, Laurent Pinchart wrote:
> Hi Maarten,
> 
> Thank you for the patches.
> 
> On Monday 16 Jan 2017 10:37:37 Maarten Lankhorst wrote:
> > Fourth iteration. Instead of trying to convert all drivers straight away,
> > implement all macros that are required to get state working.
> > 
> > Old situation:
> > Use obj->state, which can refer to old or new state.
> > Use drm_atomic_get_(existing_)obj_state, which can refer to new or old
> > state. Use for_each_obj_in_state, which refers to new or old state.
> > 
> > New situation:
> > 
> > During atomic check:
> > - Use drm_atomic_get_obj_state to add a object to the atomic state,
> >   or get the new state.
> > - Use drm_atomic_get_(old/new)_obj_state to peek at the new/old state,
> >   without adding the object. This will return NULL if the object is
> >   not part of the state. For planes and connectors the relevant crtc_state
> >   is added, so this will work to get the crtc_state from obj_state->crtc
> >   too, this means not having to write some error handling.
> > 
> > During atomic commit:
> > - Do not use drm_atomic_get_obj_state, obj->state or
> > drm_atomic_get_(existing_)obj_state any more, replace with
> > drm_atomic_get_old/new_obj_state calls as required.
> 
> That will make driver code quite complicated :-/ I wonder if that's really a 
> good solution. Maybe we should maintain obj->state only for the duration of 
> the commit as a way to simplify drivers, and set it to NULL at all other 
> times 
> to avoid misusing it ? I know this contradicts the comment I've made in my 
> review of patch 1/7, you can now choose which one to ignore :-)

We still need a state pointer to track the current logical state all the
time (ignoring nonblocking commits or other async magic). We might do that
in obj->_state or something to discourage use, but it needs to be there.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state.

2017-01-16 Thread Laurent Pinchart
Hi Maarten,

One more thing.

On Monday 16 Jan 2017 10:37:37 Maarten Lankhorst wrote:
> Fourth iteration. Instead of trying to convert all drivers straight away,
> implement all macros that are required to get state working.
> 
> Old situation:
> Use obj->state, which can refer to old or new state.
> Use drm_atomic_get_(existing_)obj_state, which can refer to new or old
> state. Use for_each_obj_in_state, which refers to new or old state.
> 
> New situation:
> 
> During atomic check:
> - Use drm_atomic_get_obj_state to add a object to the atomic state,
>   or get the new state.
> - Use drm_atomic_get_(old/new)_obj_state to peek at the new/old state,
>   without adding the object. This will return NULL if the object is
>   not part of the state. For planes and connectors the relevant crtc_state
>   is added, so this will work to get the crtc_state from obj_state->crtc
>   too, this means not having to write some error handling.
> 
> During atomic commit:
> - Do not use drm_atomic_get_obj_state, obj->state or
> drm_atomic_get_(existing_)obj_state any more, replace with
> drm_atomic_get_old/new_obj_state calls as required.

There are four calls to the drm_atomic_get_existing_*_state() functions left 
in the DRM core after this series. There's also one call to 
drm_atomic_get_plane_state() in drm_blend.c. Could you please fix that ?

> During both:
> - Use for_each_(new,old,oldnew)_obj_in_state to get the old or new state as
> needed. oldnew will be renamed to for_each_obj_in_state after all callers
> are converted to the new api.
> 
> When not doing atomic updates:
> Look at obj->state for now. I have some patches to fix this but I was asked
> to make it return a const state. This breaks a lot of users though so I
> skipped that patch in this iteration.
> 
> This series will return the correct state regardless of swapping.
> 
> Maarten Lankhorst (7):
>   drm/atomic: Add new iterators over all state, v3.
>   drm/atomic: Make add_affected_connectors look at crtc_state.
>   drm/atomic: Use new atomic iterator macros.
>   drm/atomic: Fix atomic helpers to use the new iterator macros.
>   drm/atomic: Add macros to access existing old/new state
>   drm/atomic: Convert get_existing_state callers to get_old/new_state, v2.
>   drm/blend: Use new atomic iterator macros.
> 
>  drivers/gpu/drm/drm_atomic.c |  39 ++--
>  drivers/gpu/drm/drm_atomic_helper.c  | 377 +-
>  drivers/gpu/drm/drm_blend.c  |  23 +--
>  drivers/gpu/drm/i915/intel_display.c |  13 +-
>  include/drm/drm_atomic.h | 180 -
>  include/drm/drm_atomic_helper.h  |   2 +
>  6 files changed, 438 insertions(+), 196 deletions(-)

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state.

2017-01-16 Thread Laurent Pinchart
Hi Maarten,

Thank you for the patches.

On Monday 16 Jan 2017 10:37:37 Maarten Lankhorst wrote:
> Fourth iteration. Instead of trying to convert all drivers straight away,
> implement all macros that are required to get state working.
> 
> Old situation:
> Use obj->state, which can refer to old or new state.
> Use drm_atomic_get_(existing_)obj_state, which can refer to new or old
> state. Use for_each_obj_in_state, which refers to new or old state.
> 
> New situation:
> 
> During atomic check:
> - Use drm_atomic_get_obj_state to add a object to the atomic state,
>   or get the new state.
> - Use drm_atomic_get_(old/new)_obj_state to peek at the new/old state,
>   without adding the object. This will return NULL if the object is
>   not part of the state. For planes and connectors the relevant crtc_state
>   is added, so this will work to get the crtc_state from obj_state->crtc
>   too, this means not having to write some error handling.
> 
> During atomic commit:
> - Do not use drm_atomic_get_obj_state, obj->state or
> drm_atomic_get_(existing_)obj_state any more, replace with
> drm_atomic_get_old/new_obj_state calls as required.

That will make driver code quite complicated :-/ I wonder if that's really a 
good solution. Maybe we should maintain obj->state only for the duration of 
the commit as a way to simplify drivers, and set it to NULL at all other times 
to avoid misusing it ? I know this contradicts the comment I've made in my 
review of patch 1/7, you can now choose which one to ignore :-)

> During both:
> - Use for_each_(new,old,oldnew)_obj_in_state to get the old or new state as
> needed. oldnew will be renamed to for_each_obj_in_state after all callers
> are converted to the new api.
> 
> When not doing atomic updates:
> Look at obj->state for now. I have some patches to fix this but I was asked
> to make it return a const state. This breaks a lot of users though so I
> skipped that patch in this iteration.
> 
> This series will return the correct state regardless of swapping.
> 
> Maarten Lankhorst (7):
>   drm/atomic: Add new iterators over all state, v3.
>   drm/atomic: Make add_affected_connectors look at crtc_state.
>   drm/atomic: Use new atomic iterator macros.
>   drm/atomic: Fix atomic helpers to use the new iterator macros.
>   drm/atomic: Add macros to access existing old/new state
>   drm/atomic: Convert get_existing_state callers to get_old/new_state, v2.
>   drm/blend: Use new atomic iterator macros.
> 
>  drivers/gpu/drm/drm_atomic.c |  39 ++--
>  drivers/gpu/drm/drm_atomic_helper.c  | 377 ++--
>  drivers/gpu/drm/drm_blend.c  |  23 +--
>  drivers/gpu/drm/i915/intel_display.c |  13 +-
>  include/drm/drm_atomic.h | 180 -
>  include/drm/drm_atomic_helper.h  |   2 +
>  6 files changed, 438 insertions(+), 196 deletions(-)

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state.

2017-01-16 Thread Maarten Lankhorst
Fourth iteration. Instead of trying to convert all drivers straight away,
implement all macros that are required to get state working.

Old situation:
Use obj->state, which can refer to old or new state.
Use drm_atomic_get_(existing_)obj_state, which can refer to new or old state.
Use for_each_obj_in_state, which refers to new or old state.

New situation:

During atomic check:
- Use drm_atomic_get_obj_state to add a object to the atomic state,
  or get the new state.
- Use drm_atomic_get_(old/new)_obj_state to peek at the new/old state,
  without adding the object. This will return NULL if the object is
  not part of the state. For planes and connectors the relevant crtc_state
  is added, so this will work to get the crtc_state from obj_state->crtc
  too, this means not having to write some error handling. 

During atomic commit:
- Do not use drm_atomic_get_obj_state, obj->state or 
drm_atomic_get_(existing_)obj_state
  any more, replace with drm_atomic_get_old/new_obj_state calls as required.

During both:
- Use for_each_(new,old,oldnew)_obj_in_state to get the old or new state as 
needed.
  oldnew will be renamed to for_each_obj_in_state after all callers are 
converted
  to the new api.

When not doing atomic updates:
Look at obj->state for now. I have some patches to fix this but I was asked to
make it return a const state. This breaks a lot of users though so I skipped 
that
patch in this iteration.

This series will return the correct state regardless of swapping.

Maarten Lankhorst (7):
  drm/atomic: Add new iterators over all state, v3.
  drm/atomic: Make add_affected_connectors look at crtc_state.
  drm/atomic: Use new atomic iterator macros.
  drm/atomic: Fix atomic helpers to use the new iterator macros.
  drm/atomic: Add macros to access existing old/new state
  drm/atomic: Convert get_existing_state callers to get_old/new_state, v2.
  drm/blend: Use new atomic iterator macros.

 drivers/gpu/drm/drm_atomic.c |  39 ++--
 drivers/gpu/drm/drm_atomic_helper.c  | 377 ---
 drivers/gpu/drm/drm_blend.c  |  23 +--
 drivers/gpu/drm/i915/intel_display.c |  13 +-
 include/drm/drm_atomic.h | 180 -
 include/drm/drm_atomic_helper.h  |   2 +
 6 files changed, 438 insertions(+), 196 deletions(-)

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel