[Intel-gfx] [PATCH 14/16] drm/msm: Convert to use new iterator macros, v2.
Archit Taneja
architt at codeaurora.org
Wed Jul 19 09:25:12 UTC 2017
On 07/12/2017 04:15 PM, Maarten Lankhorst wrote:
> Op 12-07-17 om 11:48 schreef Daniel Vetter:
>> On Wed, Jul 12, 2017 at 10:13:42AM +0200, Maarten Lankhorst wrote:
>>> for_each_obj_in_state is about to be removed, so convert
>>> to the new iterator macros.
>>>
>>> Just like in omap, use crtc_state->active instead of
>>> crtc_state->enable when waiting for completion.
Tested-by: Archit Taneja <architt at codeaurora.org>
>>>
>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>>> Cc: Rob Clark <robdclark at gmail.com>
>>> Cc: Archit Taneja <architt at codeaurora.org>
>>> Cc: Vincent Abriou <vincent.abriou at st.com>
>>> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>>> Cc: Russell King <rmk+kernel at armlinux.org.uk>
>>> Cc: Rob Herring <robh at kernel.org>
>>> Cc: Markus Elfring <elfring at users.sourceforge.net>
>>> Cc: Sushmita Susheelendra <ssusheel at codeaurora.org>
>>> Cc: linux-arm-msm at vger.kernel.org
>>> Cc: freedreno at lists.freedesktop.org
>>> ---
>>> drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 4 ++--
>>> drivers/gpu/drm/msm/msm_atomic.c | 16 ++++++++--------
>>> 2 files changed, 10 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>>> index bcd1f5cac72c..f7f087419ed8 100644
>>> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>>> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
>>> @@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
>>> mdp4_enable(mdp4_kms);
>>>
>>> /* see 119ecb7fd */
>>> - for_each_crtc_in_state(state, crtc, crtc_state, i)
>>> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>> drm_crtc_vblank_get(crtc);
>>> }
>>>
>>> @@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
>>> struct drm_crtc_state *crtc_state;
>>>
>>> /* see 119ecb7fd */
>>> - for_each_crtc_in_state(state, crtc, crtc_state, i)
>>> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>> drm_crtc_vblank_put(crtc);
>>>
>>> mdp4_disable(mdp4_kms);
>>> diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
>>> index 9633a68b14d7..9d3cc1f5e31a 100644
>>> --- a/drivers/gpu/drm/msm/msm_atomic.c
>>> +++ b/drivers/gpu/drm/msm/msm_atomic.c
>>> @@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
>>> struct drm_atomic_state *old_state)
>>> {
>>> struct drm_crtc *crtc;
>>> - struct drm_crtc_state *crtc_state;
>>> + struct drm_crtc_state *new_crtc_state;
>>> struct msm_drm_private *priv = old_state->dev->dev_private;
>>> struct msm_kms *kms = priv->kms;
>>> int i;
>>>
>>> - for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
>>> - if (!crtc->state->enable)
>>> + for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
>>> + if (!new_crtc_state->active)
>>> continue;
>>>
>>> kms->funcs->wait_for_crtc_commit_done(kms, crtc);
>>> @@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
>>> struct drm_crtc *crtc;
>>> struct drm_crtc_state *crtc_state;
>>> struct drm_plane *plane;
>>> - struct drm_plane_state *plane_state;
>>> + struct drm_plane_state *old_plane_state, *new_plane_state;
>>> int i, ret;
>>>
>>> ret = drm_atomic_helper_prepare_planes(dev, state);
>>> @@ -211,15 +211,15 @@ int msm_atomic_commit(struct drm_device *dev,
>>> /*
>>> * Figure out what crtcs we have:
>>> */
>>> - for_each_crtc_in_state(state, crtc, crtc_state, i)
>>> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
>>> c->crtc_mask |= drm_crtc_mask(crtc);
>>>
>>> /*
>>> * Figure out what fence to wait for:
>>> */
>>> - for_each_plane_in_state(state, plane, plane_state, i) {
>>> - if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
>>> - struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
>>> + for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
>>> + if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
>>> + struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
>>> struct msm_gem_object *msm_obj = to_msm_bo(obj);
>>> struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);
>> Pretty sure this fails to compile, you've forgotten to do one more
>> s/plane_state/new_plane_state/.
>>
>> With that fixed:
>>
>> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
>
> --->8---
> for_each_obj_in_state is about to be removed, so convert
> to the new iterator macros.
>
> Just like in omap, use crtc_state->active instead of
> crtc_state->enable when waiting for completion.
>
> Changes since v1:
> - Fix compilation.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Rob Clark <robdclark at gmail.com>
> Cc: Archit Taneja <architt at codeaurora.org>
> Cc: Vincent Abriou <vincent.abriou at st.com>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Russell King <rmk+kernel at armlinux.org.uk>
> Cc: Rob Herring <robh at kernel.org>
> Cc: Markus Elfring <elfring at users.sourceforge.net>
> Cc: Sushmita Susheelendra <ssusheel at codeaurora.org>
> Cc: linux-arm-msm at vger.kernel.org
> Cc: freedreno at lists.freedesktop.org
> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 4 ++--
> drivers/gpu/drm/msm/msm_atomic.c | 18 +++++++++---------
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> index bcd1f5cac72c..f7f087419ed8 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> @@ -114,7 +114,7 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
> mdp4_enable(mdp4_kms);
>
> /* see 119ecb7fd */
> - for_each_crtc_in_state(state, crtc, crtc_state, i)
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> drm_crtc_vblank_get(crtc);
> }
>
> @@ -126,7 +126,7 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
> struct drm_crtc_state *crtc_state;
>
> /* see 119ecb7fd */
> - for_each_crtc_in_state(state, crtc, crtc_state, i)
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> drm_crtc_vblank_put(crtc);
>
> mdp4_disable(mdp4_kms);
> diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
> index 9633a68b14d7..2728794a7142 100644
> --- a/drivers/gpu/drm/msm/msm_atomic.c
> +++ b/drivers/gpu/drm/msm/msm_atomic.c
> @@ -84,13 +84,13 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
> struct drm_atomic_state *old_state)
> {
> struct drm_crtc *crtc;
> - struct drm_crtc_state *crtc_state;
> + struct drm_crtc_state *new_crtc_state;
> struct msm_drm_private *priv = old_state->dev->dev_private;
> struct msm_kms *kms = priv->kms;
> int i;
>
> - for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
> - if (!crtc->state->enable)
> + for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
> + if (!new_crtc_state->active)
> continue;
>
> kms->funcs->wait_for_crtc_commit_done(kms, crtc);
> @@ -195,7 +195,7 @@ int msm_atomic_commit(struct drm_device *dev,
> struct drm_crtc *crtc;
> struct drm_crtc_state *crtc_state;
> struct drm_plane *plane;
> - struct drm_plane_state *plane_state;
> + struct drm_plane_state *old_plane_state, *new_plane_state;
> int i, ret;
>
> ret = drm_atomic_helper_prepare_planes(dev, state);
> @@ -211,19 +211,19 @@ int msm_atomic_commit(struct drm_device *dev,
> /*
> * Figure out what crtcs we have:
> */
> - for_each_crtc_in_state(state, crtc, crtc_state, i)
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> c->crtc_mask |= drm_crtc_mask(crtc);
>
> /*
> * Figure out what fence to wait for:
> */
> - for_each_plane_in_state(state, plane, plane_state, i) {
> - if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
> - struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
> + for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
> + if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) {
> + struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0);
> struct msm_gem_object *msm_obj = to_msm_bo(obj);
> struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv);
>
> - drm_atomic_set_fence_for_plane(plane_state, fence);
> + drm_atomic_set_fence_for_plane(new_plane_state, fence);
> }
> }
>
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
More information about the Intel-gfx
mailing list