drm/i915: Stop using get_existing_state.
Subsystems (2)
cover drm/i915: Stop using get_existing_state.
drm_atomic_get_existing_state should be removed, so stop using it in i915. Fortunately all places can be converted to use the new state or old state, even removing some dereferncing of obj->state in the process.
i915 no longer depends on plane->fb, so patch 6 removes the assignment.
The first 6 patches should definitely be upstreamed, last 2 are RFC, but probably should be upstreamed. I added them because I'm curious if it fixes FD.org #101597.
Maarten Lankhorst (8):
drm/i915: Change use get_new_plane_state instead of existing plane
state
drm/i915: Change get_existing_crtc_state to old state drm/i915: Use new atomic helpers in intel_plane_atomic_check drm/i915: Use intel_atomic_get_new_crtc_state in intel_fbc.c drm/i915: Remove last references to drm_atomic_get_existing* macros drm/i915: Do not update legacy state any more
drm/i915: Calculate ironlake intermediate watermarks correctly, v2. drm/i915: Calculate vlv/chv intermediate watermarks correctly, v3.
drivers/gpu/drm/i915/intel_atomic.c | 4 +- drivers/gpu/drm/i915/intel_atomic_plane.c | 22 +++++---- drivers/gpu/drm/i915/intel_display.c | 81 +++++++++++-------------------- drivers/gpu/drm/i915/intel_drv.h | 24 +++++++-- drivers/gpu/drm/i915/intel_fbc.c | 5 +- drivers/gpu/drm/i915/intel_pm.c | 34 +++++++++---- 6 files changed, 88 insertions(+), 82 deletions(-)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/8 drm/i915: Change use get_new_plane_state instead of existing plane state
The get_existing macros are deprecated and should be replaced by get_old/new_state for clarity.
--- drivers/gpu/drm/i915/intel_atomic.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/i915/intel_pm.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_atomic.c +2 -2
@@ -301,8 +301,8 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,continue ; } - plane_state =intel_atomic_get_existing_plane_state (drm_state, - intel_plane); + plane_state =intel_atomic_get_new_plane_state (drm_state, + intel_plane); scaler_id = &plane_state->scaler_id; }
drivers/gpu/drm/i915/intel_drv.h +2 -2
@@ -1958,12 +1958,12 @@ intel_atomic_get_existing_crtc_state(struct drm_atomic_state *state, }static inline struct intel_plane_state * -intel_atomic_get_existing_plane_state (struct drm_atomic_state *state, +intel_atomic_get_new_plane_state (struct drm_atomic_state *state,struct intel_plane *plane) {struct drm_plane_state *plane_state; - plane_state =drm_atomic_get_existing_plane_state (state, &plane->base); + plane_state =drm_atomic_get_new_plane_state (state, &plane->base);return to_intel_plane_state (plane_state); }
drivers/gpu/drm/i915/intel_pm.c +2 -3
@@ -3028,8 +3028,7 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)for_each_intel_plane_on_crtc (dev, intel_crtc, intel_plane) {struct intel_plane_state *ps; - ps =intel_atomic_get_existing_plane_state (state, - intel_plane); + ps =intel_atomic_get_new_plane_state (state, intel_plane);if (!ps)continue ;
@@ -4766,7 +4765,7 @@ skl_ddb_add_affected_planes(struct intel_crtc_state *cstate)struct drm_plane *plane;enum pipe pipe = intel_crtc->pipe; -WARN_ON (!drm_atomic_get_existing_crtc_state (state, crtc)); +WARN_ON (!drm_atomic_get_new_crtc_state (state, crtc));drm_for_each_plane_mask (plane, dev, cstate->base.plane_mask) {enum plane_id plane_id =to_intel_plane (plane)->id;
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/8] drm/i915: Change use get_new_plane_state instead of existing plane state
Hi,
Quoted 30 lines · Maarten Lankhorst
The
get_existingmacros are deprecated and should be replaced by get_old/new_state for clarity.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_atomic.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/i915/intel_pm.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_atomic.c +2
-2@@ -301,8 +301,8 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,continue ; } - plane_state =intel_atomic_get_existing_plane_state (drm_state, - intel_plane); + plane_state =intel_atomic_get_new_plane_state (drm_state, + intel_plane); scaler_id = &plane_state->scaler_id; }drivers/gpu/drm/i915/intel_drv.h +0
-0
drivers/gpu/drm/i915/intel_drv.h intel_atomic_get_existing_crtc_state(struct drm_atomic_state *state, · line 1962
Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1@@ -1958,12 +1958,12 @@ intel_atomic_get_existing_crtc_state(struct drm_atomic_state *state, }static inline struct intel_plane_state * -intel_atomic_get_existing_plane_state (struct drm_atomic_state *state, +intel_atomic_get_new_plane_state (struct drm_atomic_state *state,struct intel_plane *plane)
please fix indentation of arguments as well.
Quoted 23 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1{struct drm_plane_state *plane_state; - plane_state =drm_atomic_get_existing_plane_state (state, &plane->base); + plane_state =drm_atomic_get_new_plane_state (state, &plane->base);return to_intel_plane_state (plane_state); }drivers/gpu/drm/i915/intel_pm.c +1
-2@@ -3028,8 +3028,7 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)for_each_intel_plane_on_crtc (dev, intel_crtc, intel_plane) {struct intel_plane_state *ps; - ps =intel_atomic_get_existing_plane_state (state, - intel_plane); + ps =intel_atomic_get_new_plane_state (state, intel_plane);if (!ps)continue ;
drivers/gpu/drm/i915/intel_pm.c skl_ddb_add_affected_planes(struct intel_crtc_state *cstate) · line 4768
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -4766,7 +4765,7 @@ skl_ddb_add_affected_planes(struct intel_crtc_state *cstate)struct drm_plane *plane;enum pipe pipe = intel_crtc->pipe; -WARN_ON (!drm_atomic_get_existing_crtc_state (state, crtc)); +WARN_ON (!drm_atomic_get_new_crtc_state (state, crtc));
Patch talks about changing get_existing_plane_state, but you are changing get_existing_crtc_state here. IMO it should be part of different patch or patch subject should be changed.
-Mahesh
drivers/gpu/drm/i915/intel_pm.c skl_ddb_add_affected_planes(struct intel_crtc_state *cstate) · line 4771
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-0drm_for_each_plane_mask (plane, dev, cstate->base.plane_mask) {enum plane_id plane_id =to_intel_plane (plane)->id;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/8] drm/i915: Change use get_new_plane_state instead of existing plane state
Op 01-08-17 om 08:36 schreef Mahesh Kumar:
Quoted 56 lines
Hi,
Quoted 28 lines · Maarten Lankhorst
The
get_existingmacros are deprecated and should be replaced by get_old/new_state for clarity.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_atomic.c | 4 ++-- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/i915/intel_pm.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_atomic.c +2
-1@@ -301,8 +301,8 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,continue ; } - plane_state =intel_atomic_get_existing_plane_state (drm_state, - intel_plane); + plane_state =intel_atomic_get_new_plane_state (drm_state, + intel_plane); scaler_id = &plane_state->scaler_id; } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.hindex
4f9775a05df7..f59507137347100644drivers/gpu/drm/i915/intel_drv.h intel_atomic_get_existing_crtc_state(struct drm_atomic_state *state, · line 1961
Quoted 5 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1@@ -1958,12 +1958,12 @@ intel_atomic_get_existing_crtc_state(struct drm_atomic_state *state, }static inline struct intel_plane_state * -intel_atomic_get_existing_plane_state (struct drm_atomic_state *state, +intel_atomic_get_new_plane_state (struct drm_atomic_state *state,struct intel_plane *plane)please fix indentation of arguments as well.
Quoted 17 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0{struct drm_plane_state *plane_state; - plane_state =drm_atomic_get_existing_plane_state (state, &plane->base); + plane_state =drm_atomic_get_new_plane_state (state, &plane->base);return to_intel_plane_state (plane_state); }drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -3028,8 +3028,7 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)for_each_intel_plane_on_crtc (dev, intel_crtc, intel_plane) {struct intel_plane_state *ps; - ps =intel_atomic_get_existing_plane_state (state, - intel_plane); + ps = intel_atomic_get_new_plane_state(state, intel_plane);if (!ps)
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c skl_ddb_add_affected_planes(struct intel_crtc_state *cstate) · line 4768
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +1
-0continue ; @@ -4766,7 +4765,7 @@ skl_ddb_add_affected_planes(struct intel_crtc_state *cstate) struct drm_plane *plane;enum pipe pipe = intel_crtc->pipe; -WARN_ON (!drm_atomic_get_existing_crtc_state (state, crtc)); +WARN_ON (!drm_atomic_get_new_crtc_state (state, crtc));Patch talks about changing
get_existing_plane_state, but you are changingget_existing_crtc_statehere. IMO it should be part of different patch or patch subject should be changed.
Yeah ok, this hunk should be separate.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/8 drm/i915: Change get_existing_crtc_state to old state
In reply to Maarten Lankhorstget_existing_crtc_state is currently unused, but the next commit needs to access the old intel state. Rename this and use this as convenience wrapper.
--- drivers/gpu/drm/i915/intel_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +3 -3
@@ -1944,12 +1944,12 @@ intel_atomic_get_crtc_state(struct drm_atomic_state *state, }static inline struct intel_crtc_state * -intel_atomic_get_existing_crtc_state (struct drm_atomic_state *state, -struct intel_crtc *crtc) +intel_atomic_get_old_crtc_state (struct drm_atomic_state *state, +struct intel_crtc *crtc) {struct drm_crtc_state *crtc_state; - crtc_state =drm_atomic_get_existing_crtc_state (state, &crtc->base); + crtc_state =drm_atomic_get_old_crtc_state (state, &crtc->base);if (crtc_state)return to_intel_crtc_state (crtc_state);
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/8] drm/i915: Change get_existing_crtc_state to old state
Hi,
As per my understanding "get_existing_*_state == get_new_*_state"
It looks like you are trying to use currently available unused wrapper for completely different purpose. But IMHO you should create a new wrapper for get_old_state
& this should be renamed to get_new_state. :)
-Mahesh
Quoted 19 lines · Maarten Lankhorst
get_existing_crtc_stateis currently unused, but the next commit needs to access the old intel state. Rename this and use this as convenience wrapper.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_drv.h +0
-2@@ -1944,12 +1944,12 @@ intel_atomic_get_crtc_state(struct drm_atomic_state *state, } static inline struct intel_crtc_state * -intel_atomic_get_existing_crtc_state (struct drm_atomic_state *state, -struct intel_crtc *crtc)
drivers/gpu/drm/i915/intel_drv.h intel_atomic_get_crtc_state(struct drm_atomic_state *state, · line 1955
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +3
-1+intel_atomic_get_old_crtc_state(struct drm_atomic_state *state, + struct intel_crtc *crtc) { struct drm_crtc_state *crtc_state; - crtc_state =drm_atomic_get_existing_crtc_state (state, &crtc->base); + crtc_state =drm_atomic_get_old_crtc_state (state, &crtc->base);if (crtc_state)return to_intel_crtc_state (crtc_state);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/8] drm/i915: Change get_existing_crtc_state to old state
Hey,
Op 01-08-17 om 08:46 schreef Mahesh Kumar:
Quoted 7 lines
Hi,
As per my understanding "get_existing_*_state == get_new_*_state"
It looks like you are trying to use currently available unused wrapper for completely different purpose. But IMHO you should create a new wrapper for
get_old_state& this should be renamed to
get_new_state. :)
This really depends, and is the reason why we have to rename this.
Before commit:get_existing_state == get_new_state
After commit:get_existing_state == get_old_state.
Perhaps I can add both in this patch, I'll clean the series up slightly.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/8] drm/i915: Change get_existing_crtc_state to old state
Quoted 9 lines · Maarten Lankhorst
Hey,
Op 01-08-17 om 08:46 schreef Mahesh Kumar:
Quoted 6 lines
Hi,
As per my understanding "get_existing_*_state == get_new_*_state"
It looks like you are trying to use currently available unused wrapper for completely different purpose. But IMHO you should create a new wrapper for
get_old_state
Quoted 8 lines
Quoted 1 line
& this should be renamed to
get_new_state. :)This really depends, and is the reason why we have to rename this.
Before commit:
get_existing_state==get_new_stateAfter commit:
get_existing_state==get_old_state.
yeah, right :)
Quoted 2 lines
Perhaps I can add both in this patch, I'll clean the series up slightly.
sounds good
-Mahesh
Quoted 1 line
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/8 drm/i915: Use new atomic helpers in intel_plane_atomic_check
In reply to Maarten LankhorstRemove the use of plane->state and drm_atomic_get_existing_state, instead use the new helpers, and also add intel_atomic_get_new_crtc_state as it's needed.
--- drivers/gpu/drm/i915/intel_atomic_plane.c | 22 +++++++++++++--------- drivers/gpu/drm/i915/intel_drv.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_atomic_plane.c +13 -9
@@ -198,12 +198,17 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, }static int intel_plane_atomic_check (struct drm_plane *plane, -struct drm_plane_state *state) +struct drm_plane_state *new_plane_state) { -struct drm_crtc *crtc = state->crtc; -struct drm_crtc_state *drm_crtc_state; +struct drm_atomic_state *state = new_plane_state->state; +struct intel_crtc *crtc; +struct intel_crtc_state *new_crtc_state; +struct drm_plane_state *old_plane_state; +struct intel_plane_state *new_intel_plane_state; - crtc = crtc ? crtc : plane->state->crtc; + old_plane_state =drm_atomic_get_old_plane_state (state, plane); + + crtc =to_intel_crtc (new_plane_state->crtc ?: old_plane_state->crtc);/* * Both crtc and plane->crtc could be NULL if we're updating a
@@ -214,12 +219,11 @@ static int intel_plane_atomic_check(struct drm_plane *plane,if (!crtc)return 0 ; - drm_crtc_state =drm_atomic_get_existing_crtc_state (state->state, crtc); -if (WARN_ON (!drm_crtc_state)) -return -EINVAL ; + new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); + new_intel_plane_state =to_intel_plane_state (new_plane_state); -return intel_plane_atomic_check_with_state (to_intel_crtc_state (drm_crtc_state), -to_intel_plane_state (state)); +return intel_plane_atomic_check_with_state (new_crtc_state, + new_intel_plane_state); } static void intel_plane_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/i915/intel_drv.h +14 -0
@@ -1957,6 +1957,20 @@ intel_atomic_get_old_crtc_state(struct drm_atomic_state *state,return NULL ; } +static inline struct intel_crtc_state * +intel_atomic_get_new_crtc_state (struct drm_atomic_state *state, +struct intel_crtc *crtc) +{ +struct drm_crtc_state *crtc_state; + + crtc_state =drm_atomic_get_new_crtc_state (state, &crtc->base); + +if (crtc_state) +return to_intel_crtc_state (crtc_state); +else +return NULL ; +} +static inline struct intel_plane_state *intel_atomic_get_new_plane_state (struct drm_atomic_state *state,struct intel_plane *plane)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/8] drm/i915: Use new atomic helpers in intel_plane_atomic_check
Hi,
Quoted 26 lines · Maarten Lankhorst
Remove the use of
plane->stateanddrm_atomic_get_existing_state, instead use the new helpers, and also addintel_atomic_get_new_crtc_stateas it's needed.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_atomic_plane.c | 22 +++++++++++++--------- drivers/gpu/drm/i915/intel_drv.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/intel_atomic_plane.c +4
-3@@ -198,12 +198,17 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, }static int intel_plane_atomic_check (struct drm_plane *plane, -struct drm_plane_state *state) +struct drm_plane_state *new_plane_state) { -struct drm_crtc *crtc = state->crtc; -struct drm_crtc_state *drm_crtc_state; +struct drm_atomic_state *state = new_plane_state->state; +struct intel_crtc *crtc; +struct intel_crtc_state *new_crtc_state;
drivers/gpu/drm/i915/intel_atomic_plane.c int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, · line 214
Quoted 10 lines
drivers/gpu/drm/i915/intel_atomic_plane.c +5
-1+struct drm_plane_state *old_plane_state; +struct intel_plane_state *new_intel_plane_state; - crtc = crtc ? crtc : plane->state->crtc; + old_plane_state =drm_atomic_get_old_plane_state (state, plane); + + crtc =to_intel_crtc (new_plane_state->crtc ?: old_plane_state->crtc);/* * Both crtc and plane->crtc could be NULL if we're updating a
you may want to update comment as well for better understanding. :)
Quoted 29 lines
drivers/gpu/drm/i915/intel_atomic_plane.c +4
-5@@ -214,12 +219,11 @@ static int intel_plane_atomic_check(struct drm_plane *plane,if (!crtc)return 0 ; - drm_crtc_state =drm_atomic_get_existing_crtc_state (state->state, crtc); -if (WARN_ON (!drm_crtc_state)) -return -EINVAL ; + new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); + new_intel_plane_state =to_intel_plane_state (new_plane_state); -return intel_plane_atomic_check_with_state (to_intel_crtc_state (drm_crtc_state), -to_intel_plane_state (state)); +return intel_plane_atomic_check_with_state (new_crtc_state, + new_intel_plane_state); } static void intel_plane_atomic_update(struct drm_plane *plane,drivers/gpu/drm/i915/intel_drv.h +4
-0@@ -1957,6 +1957,20 @@ intel_atomic_get_old_crtc_state(struct drm_atomic_state *state,return NULL ; } +static inline struct intel_crtc_state * +intel_atomic_get_new_crtc_state (struct drm_atomic_state *state, +struct intel_crtc *crtc) +{
drivers/gpu/drm/i915/intel_drv.h intel_atomic_get_old_crtc_state(struct drm_atomic_state *state, · line 1973
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +10
-0+struct drm_crtc_state *crtc_state; + + crtc_state =drm_atomic_get_new_crtc_state (state, &crtc->base); + +if (crtc_state) +return to_intel_crtc_state (crtc_state); +else +return NULL ; +} +
With previous patch comment addressed, This wrapper will be already available. otherwise patch looks ok to me.
-Mahesh
drivers/gpu/drm/i915/intel_drv.h intel_atomic_get_old_crtc_state(struct drm_atomic_state *state, · line 1976
Quoted 3 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0static inline struct intel_plane_state *intel_atomic_get_new_plane_state (struct drm_atomic_state *state,struct intel_plane *plane)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/8 drm/i915: Use intel_atomic_get_new_crtc_state in intel_fbc.c
In reply to Maarten LankhorstThe previous commit added intel_atomic_get_new_crtc_state, convert intel_fbc.c to the new helper.
--- drivers/gpu/drm/i915/intel_fbc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_fbc.c +2 -3
@@ -1046,7 +1046,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,/* Does this atomic commit involve the CRTC currently tied to FBC? */ if (fbc->crtc && - !drm_atomic_get_existing_crtc_state (state, &fbc->crtc->base)) + !intel_atomic_get_new_crtc_state (state, fbc->crtc)) goto out;if (!intel_fbc_can_enable (dev_priv))
@@ -1071,8 +1071,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,if (fbc_on_plane_a_only (dev_priv) && crtc->plane !=PLANE_A )continue ; - intel_crtc_state =to_intel_crtc_state ( -drm_atomic_get_existing_crtc_state (state, &crtc->base)); + intel_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); intel_crtc_state->enable_fbc = true; crtc_chosen = true;
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/8] drm/i915: Use intel_atomic_get_new_crtc_state in intel_fbc.c
Hi,
patch looks ok to me.
Quoted 22 lines · Maarten Lankhorst
The previous commit added
intel_atomic_get_new_crtc_state, convertintel_fbc.cto the new helper.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/intel_fbc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_fbc.c +1
-1@@ -1046,7 +1046,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,/* Does this atomic commit involve the CRTC currently tied to FBC? */ if (fbc->crtc && - !drm_atomic_get_existing_crtc_state (state, &fbc->crtc->base)) + !intel_atomic_get_new_crtc_state (state, fbc->crtc)) goto out;if (!intel_fbc_can_enable (dev_priv))
drivers/gpu/drm/i915/intel_fbc.c void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, · line 1077
Quoted 9 lines
drivers/gpu/drm/i915/intel_fbc.c +1
-2@@ -1071,8 +1071,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,if (fbc_on_plane_a_only (dev_priv) && crtc->plane !=PLANE_A )continue ; - intel_crtc_state =to_intel_crtc_state ( -drm_atomic_get_existing_crtc_state (state, &crtc->base)); + intel_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); intel_crtc_state->enable_fbc = true; crtc_chosen = true;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/8 drm/i915: Remove last references to drm_atomic_get_existing* macros
In reply to Maarten LankhorstAll the references to get_existing_state can be converted to get_new_state or get_old_state, which means that i915 is now get_existing_state free.
--- drivers/gpu/drm/i915/intel_display.c | 57 +++++++++++++++++------------------- 1 file changed, 27 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/intel_display.c +27 -30
@@ -4956,27 +4956,25 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state)struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc);struct drm_atomic_state *old_state = old_crtc_state->base.state;struct intel_crtc_state *pipe_config = -to_intel_crtc_state (crtc->base.state); +intel_atomic_get_new_crtc_state (old_state, crtc);struct drm_plane *primary = crtc->base.primary; -struct drm_plane_state *old_pri_state = -drm_atomic_get_existing_plane_state (old_state, primary); +struct drm_plane_state *old_primary_state = +drm_atomic_get_old_plane_state (old_state, primary);intel_frontbuffer_flip (to_i915 (crtc->base.dev), pipe_config->fb_bits);if (pipe_config->update_wm_post && pipe_config->base.active)intel_update_watermarks (crtc); -if (old_pri_state) { -struct intel_plane_state *primary_state = -to_intel_plane_state (primary->state); -struct intel_plane_state *old_primary_state = -to_intel_plane_state (old_pri_state); +if (old_primary_state) { +struct drm_plane_state *new_primary_state = +drm_atomic_get_new_plane_state (old_state, primary);intel_fbc_post_update (crtc); -if (primary_state->base.visible && +if (new_primary_state->visible && (needs_modeset (&pipe_config->base) || - !old_primary_state->base.visible)) + !old_primary_state->visible))intel_post_enable_primary (&crtc->base); } }
@@ -4989,22 +4987,21 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,struct drm_i915_private *dev_priv =to_i915 (dev);struct drm_atomic_state *old_state = old_crtc_state->base.state;struct drm_plane *primary = crtc->base.primary; -struct drm_plane_state *old_pri_state = -drm_atomic_get_existing_plane_state (old_state, primary); +struct drm_plane_state *old_primary_state = +drm_atomic_get_old_plane_state (old_state, primary);bool modeset =needs_modeset (&pipe_config->base);struct intel_atomic_state *old_intel_state =to_intel_atomic_state (old_state); -if (old_pri_state) { -struct intel_plane_state *primary_state = -to_intel_plane_state (primary->state); -struct intel_plane_state *old_primary_state = -to_intel_plane_state (old_pri_state); +if (old_primary_state) { +struct drm_plane_state *new_primary_state = +drm_atomic_get_new_plane_state (old_state, primary); -intel_fbc_pre_update (crtc, pipe_config, primary_state); +intel_fbc_pre_update (crtc, pipe_config, +to_intel_plane_state (new_primary_state)); -if (old_primary_state->base.visible && - (modeset || !primary_state->base.visible)) +if (old_primary_state->visible && + (modeset || !new_primary_state->visible))intel_pre_disable_primary (&crtc->base); }
@@ -10822,7 +10819,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)struct drm_connector_state *connector_state;struct intel_encoder *encoder; - connector_state =drm_atomic_get_existing_connector_state (state, connector); + connector_state =drm_atomic_get_new_connector_state (state, connector);if (!connector_state) connector_state = connector->state;
@@ -11039,15 +11036,15 @@ intel_modeset_update_crtc_state(struct drm_atomic_state *state)/* Double check state. */ for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { +struct drm_plane_state *plane_state;to_intel_crtc (crtc)->config =to_intel_crtc_state (new_crtc_state);/* * Update legacy state to satisfy fbc code. This can * be removed when fbc uses the atomic state. */ -if (drm_atomic_get_existing_plane_state (state, crtc->primary)) { -struct drm_plane_state *plane_state = crtc->primary->state; - + plane_state =drm_atomic_get_new_plane_state (state, crtc->primary); +if (plane_state) { crtc->primary->fb = plane_state->fb; crtc->x = plane_state->src_x >>16 ; crtc->y = plane_state->src_y >>16 ;
@@ -12250,6 +12247,9 @@ static void intel_update_crtc(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_crtc_state *pipe_config =to_intel_crtc_state (new_crtc_state);bool modeset =needs_modeset (new_crtc_state); +struct intel_plane_state *new_plane_state = +intel_atomic_get_new_plane_state (old_crtc_state->state, +to_intel_plane (crtc->primary));if (modeset) {update_scanline_offset (intel_crtc);
@@ -12259,11 +12259,8 @@ static void intel_update_crtc(struct drm_crtc *crtc, pipe_config); } -if (drm_atomic_get_existing_plane_state (state, crtc->primary)) { -intel_fbc_enable ( - intel_crtc, pipe_config, -to_intel_plane_state (crtc->primary->state)); - } +if (new_plane_state) +intel_fbc_enable (intel_crtc, pipe_config, new_plane_state);drm_atomic_helper_commit_planes_on_crtc (old_crtc_state);
@@ -12739,7 +12736,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,if (old_obj) {struct drm_crtc_state *crtc_state = -drm_atomic_get_existing_crtc_state (new_state->state, +drm_atomic_get_new_crtc_state (new_state->state, plane->state->crtc);/* Big Hammer, we also need to ensure that any pending
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/8 drm/i915: Do not update legacy state any more
In reply to Maarten LankhorstFBC has been converted to atomic, so updating
some legacy variables is no longer needed.
drm_atomic_helper_update_legacy_modeset_state does update crtc->x/y anyway, but we shouldn't need it.
--- drivers/gpu/drm/i915/intel_display.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -26
@@ -11027,31 +11027,6 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,return ret; } -static void -intel_modeset_update_crtc_state (struct drm_atomic_state *state) -{ -struct drm_crtc *crtc; -struct drm_crtc_state *new_crtc_state; -int i; - -/* Double check state. */ -for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { -struct drm_plane_state *plane_state; -to_intel_crtc (crtc)->config =to_intel_crtc_state (new_crtc_state); - -/* -* Update legacy state to satisfy fbc code. This can -* be removed when fbc uses the atomic state. -*/ - plane_state =drm_atomic_get_new_plane_state (state, crtc->primary); -if (plane_state) { - crtc->primary->fb = plane_state->fb; - crtc->x = plane_state->src_x >>16 ; - crtc->y = plane_state->src_y >>16 ; - } - } -} -static bool intel_fuzzy_clock_check (int clock1,int clock2) {int diff;
@@ -12438,7 +12413,10 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)/* Only after disabling all output pipelines that will be changed can we * update the the output configuration. */ -intel_modeset_update_crtc_state (state); + +/* Update legacy crtc->config pointer */ +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) +to_intel_crtc (crtc)->config =to_intel_crtc_state (new_crtc_state);if (intel_state->modeset) {drm_atomic_helper_update_legacy_modeset_state (state->dev, state);
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 7/8 drm/i915: Calculate ironlake intermediate watermarks correctly, v2.
In reply to Maarten LankhorstThe watermarks it should calculate against are the old optimal watermarks. The currently active crtc watermarks are pure fiction, and are invalid in case of a nonblocking modeset, page flip enabling/disabling planes or any other reason.
When the crtc is disabled or during a modeset the intermediate watermarks don't need to be programmed separately, and could be directly assigned to the optimal watermarks.
Changes since v1:
- Use intel_atomic_get_old_crtc_state. (ville)
--- drivers/gpu/drm/i915/intel_pm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +6 -1
@@ -3105,7 +3105,9 @@ static int ilk_compute_intermediate_wm(struct drm_device *dev, struct intel_crtc_state *newstate) {struct intel_pipe_wm *a = &newstate->wm.ilk.intermediate; -struct intel_pipe_wm *b = &intel_crtc->wm.active.ilk; +const struct intel_crtc_state *oldstate = +intel_atomic_get_old_crtc_state (newstate->base.state, intel_crtc); +const struct intel_pipe_wm *b = &oldstate->wm.ilk.optimal;int level, max_level =ilk_wm_max_level (to_i915 (dev));/*
@@ -3114,6 +3116,9 @@ static int ilk_compute_intermediate_wm(struct drm_device *dev,* and after the vblank. */ *a = newstate->wm.ilk.optimal; +if (!newstate->base.active ||drm_atomic_crtc_needs_modeset (&newstate->base)) +return 0 ; + a->pipe_enabled |= b->pipe_enabled; a->sprites_enabled |= b->sprites_enabled; a->sprites_scaled |= b->sprites_scaled;
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 8/8 drm/i915: Calculate vlv/chv intermediate watermarks correctly, v3.
In reply to Maarten LankhorstThe watermarks it should calculate against are the old optimal watermarks. The currently active crtc watermarks are pure fiction, and are invalid in case of a nonblocking modeset, page flip enabling/disabling planes or any other reason.
When the crtc is disabled or during a modeset the intermediate watermarks don't need to be programmed separately, and could be directly assigned to the optimal watermarks.
CXSR must always be disabled in the intermediate case for modesets, else we get a WARN for vblank wait timeout.
Also rename crtc_state to new_crtc_state, to distinguish it from the old state.
Changes since v1:
- Use intel_atomic_get_old_crtc_state. (ville)
Changes since v2:
- Always unset cxsr during modeset.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101597
--- drivers/gpu/drm/i915/intel_pm.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +16 -6
@@ -2004,16 +2004,25 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,static int vlv_compute_intermediate_wm (struct drm_device *dev,struct intel_crtc *crtc, -struct intel_crtc_state *crtc_state) +struct intel_crtc_state *new_crtc_state) { -struct vlv_wm_state *intermediate = &crtc_state->wm.vlv.intermediate; -const struct vlv_wm_state *optimal = &crtc_state->wm.vlv.optimal; -const struct vlv_wm_state *active = &crtc->wm.active.vlv; +struct vlv_wm_state *intermediate = &new_crtc_state->wm.vlv.intermediate; +const struct vlv_wm_state *optimal = &new_crtc_state->wm.vlv.optimal; +const struct intel_crtc_state *old_crtc_state = +intel_atomic_get_old_crtc_state (new_crtc_state->base.state, crtc); +const struct vlv_wm_state *active = &old_crtc_state->wm.vlv.optimal;int level; +if (!new_crtc_state->base.active ||drm_atomic_crtc_needs_modeset (&new_crtc_state->base)) { + *intermediate = *optimal; + + intermediate->cxsr = false; + goto out; + } + intermediate->num_levels =min (optimal->num_levels, active->num_levels); intermediate->cxsr = optimal->cxsr && active->cxsr && - !crtc_state->disable_cxsr; + !new_crtc_state->disable_cxsr;for (level =0 ; level < intermediate->num_levels; level++) {enum plane_id plane_id;
@@ -2032,12 +2041,13 @@ static int vlv_compute_intermediate_wm(struct drm_device *dev,vlv_invalidate_wms (crtc, intermediate, level); +out:/* * If our intermediate WM are identical to the final WM, then we can * omit the post-vblank programming; only update if it's different. */ if (memcmp (intermediate, optimal,sizeof (*intermediate)) !=0 ) - crtc_state->wm.need_postvbl_update = true; + new_crtc_state->wm.need_postvbl_update = true;return 0 ; }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 8/8] drm/i915: Calculate vlv/chv intermediate watermarks correctly, v3.
Op 20-07-17 om 15:15 schreef Maarten Lankhorst:
Quoted 42 lines
The watermarks it should calculate against are the old optimal watermarks. The currently active crtc watermarks are pure fiction, and are invalid in case of a nonblocking modeset, page flip enabling/disabling planes or any other reason.
When the crtc is disabled or during a modeset the intermediate watermarks don't need to be programmed separately, and could be directly assigned to the optimal watermarks.
CXSR must always be disabled in the intermediate case for modesets, else we get a WARN for vblank wait timeout.
Also rename
crtc_statetonew_crtc_state, to distinguish it from the old state.Changes since v1:
- Useintel_atomic_get_old_crtc_state. (ville)
Changes since v2:
- Always unset cxsr during modeset.Signed-off-by Maarten Lankhorst <[email protected]>Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101597
--- drivers/gpu/drm/i915/intel_pm.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_pm.c +4
-4@@ -2004,16 +2004,25 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,static int vlv_compute_intermediate_wm (struct drm_device *dev,struct intel_crtc *crtc, -struct intel_crtc_state *crtc_state) +struct intel_crtc_state *new_crtc_state) { -struct vlv_wm_state *intermediate = &crtc_state->wm.vlv.intermediate; -const struct vlv_wm_state *optimal = &crtc_state->wm.vlv.optimal; -const struct vlv_wm_state *active = &crtc->wm.active.vlv; +struct vlv_wm_state *intermediate = &new_crtc_state->wm.vlv.intermediate; +const struct vlv_wm_state *optimal = &new_crtc_state->wm.vlv.optimal; + const struct intel_crtc_state *old_crtc_state =
drivers/gpu/drm/i915/intel_pm.c static void vlv_atomic_update_fifo(struct intel_atomic_state *state, · line 2021
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +8
-0+intel_atomic_get_old_crtc_state (new_crtc_state->base.state, crtc); +const struct vlv_wm_state *active = &old_crtc_state->wm.vlv.optimal;int level; +if (!new_crtc_state->base.active ||drm_atomic_crtc_needs_modeset (&new_crtc_state->base)) { + *intermediate = *optimal; + + intermediate->cxsr = false; + goto out; + }
Derp, can't fix the above bug since it's PNV.. But still needs to be done here.
So I'll have to take out the bugzilla listed above..
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Stop using get_existing_state.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915: Stop using get_existing_state.
URL : https://patchwork.freedesktop.org/series/27640/
State : success
== Summary ==
Series 27640v1 drm/i915: Stop using get_existing_state.
https://patchwork.freedesktop.org/api/1.0/series/27640/revisions/1/mbox/
Test kms_flip:
Subgroup basic-flip-vs-modeset:
pass -> SKIP (fi-skl-x1585l) fdo#101781
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
dmesg-warn -> PASS (fi-pnv-d510) fdo#101597
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> PASS (fi-byt-n2820) fdo#101705fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781
fdo#101597 https://bugs.freedesktop.org/show_bug.cgi?id=101597
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705
fi-bdw-5557u total:279 pass:268 dwarn:0 dfail:0 fail:0 skip:11 time:442s fi-bdw-gvtdvm total:279 pass:265 dwarn:0 dfail:0 fail:0 skip:14 time:429s fi-blb-e6850 total:279 pass:224 dwarn:1 dfail:0 fail:0 skip:54 time:361s fi-bsw-n3050 total:279 pass:243 dwarn:0 dfail:0 fail:0 skip:36 time:539s fi-bxt-j4205 total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:514s fi-byt-j1900 total:279 pass:255 dwarn:0 dfail:0 fail:0 skip:24 time:487s fi-byt-n2820 total:279 pass:251 dwarn:0 dfail:0 fail:0 skip:28 time:487s fi-glk-2a total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:598s fi-hsw-4770 total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:440s fi-hsw-4770r total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:413s fi-ilk-650 total:279 pass:229 dwarn:0 dfail:0 fail:0 skip:50 time:417s fi-ivb-3520m total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:496s fi-ivb-3770 total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:468s fi-kbl-7500u total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:463s fi-kbl-7560u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:577s fi-kbl-r total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:583s fi-pnv-d510 total:279 pass:222 dwarn:2 dfail:0 fail:0 skip:55 time:559s fi-skl-6260u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:482s fi-skl-6700hq total:279 pass:262 dwarn:0 dfail:0 fail:0 skip:17 time:588s fi-skl-6700k total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:472s fi-skl-6770hq total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:486s fi-skl-gvtdvm total:279 pass:266 dwarn:0 dfail:0 fail:0 skip:13 time:435s fi-skl-x1585l total:279 pass:268 dwarn:0 dfail:0 fail:0 skip:11 time:466s fi-snb-2520m total:279 pass:251 dwarn:0 dfail:0 fail:0 skip:28 time:543s fi-snb-2600 total:279 pass:250 dwarn:0 dfail:0 fail:0 skip:29 time:408s
05cf23d5c759917f3b50aea0dcb0df1464366b93 drm-tip: 2017y-07m-20d-14h-24m-27s UTC integration manifest c18c405 drm/i915: Calculate vlv/chv intermediate watermarks correctly, v3.
99976be drm/i915: Calculate ironlake intermediate watermarks correctly, v2.
8e20c12 drm/i915: Do not update legacy state any more5cecb757 drm/i915: Remove last references to drm_atomic_get_existing* macros
23f118a drm/i915: Use intel_atomic_get_new_crtc_state in intel_fbc.c
0fe7279 drm/i915: Use new atomic helpers in intel_plane_atomic_check350aeadd drm/i915: Change get_existing_crtc_state to old state
1633215 drm/i915: Change use get_new_plane_state instead of existing plane state
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5252/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx