Skip to content

Commit dd57602

Browse files
committed
drm/i915: Switch fbc over to for_each_new_intel_plane_in_state()
Stop using the old for_each_intel_plane_in_state() type iteration macro and replace it with for_each_new_intel_plane_in_state(). And similarly replace drm_atomic_get_existing_crtc_state() with intel_atomic_get_new_crtc_state(). Switch over to intel_ types as well to make the code less cluttered. v2: s/plane/i9xx_plane/ etc. (James) Cc: James Ausmus <james.ausmus@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20171117191917.11506-8-ville.syrjala@linux.intel.com Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
1 parent 81894b2 commit dd57602

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,13 @@ struct i915_hotplug {
560560
for_each_power_well_rev(__dev_priv, __power_well) \
561561
for_each_if ((__power_well)->domains & (__domain_mask))
562562

563-
#define for_each_intel_plane_in_state(__state, plane, plane_state, __i) \
563+
#define for_each_new_intel_plane_in_state(__state, plane, new_plane_state, __i) \
564564
for ((__i) = 0; \
565565
(__i) < (__state)->base.dev->mode_config.num_total_plane && \
566566
((plane) = to_intel_plane((__state)->base.planes[__i].ptr), \
567-
(plane_state) = to_intel_plane_state((__state)->base.planes[__i].state), 1); \
567+
(new_plane_state) = to_intel_plane_state((__state)->base.planes[__i].new_state), 1); \
568568
(__i)++) \
569-
for_each_if (plane_state)
569+
for_each_if (plane)
570570

571571
#define for_each_new_intel_crtc_in_state(__state, crtc, new_crtc_state, __i) \
572572
for ((__i) = 0; \
@@ -576,7 +576,6 @@ struct i915_hotplug {
576576
(__i)++) \
577577
for_each_if (crtc)
578578

579-
580579
#define for_each_oldnew_intel_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \
581580
for ((__i) = 0; \
582581
(__i) < (__state)->base.dev->mode_config.num_total_plane && \

drivers/gpu/drm/i915/intel_display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12080,7 +12080,7 @@ static int intel_atomic_check(struct drm_device *dev,
1208012080
if (ret)
1208112081
return ret;
1208212082

12083-
intel_fbc_choose_crtc(dev_priv, state);
12083+
intel_fbc_choose_crtc(dev_priv, intel_state);
1208412084
return calc_watermark_data(state);
1208512085
}
1208612086

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev)
16521652

16531653
/* intel_fbc.c */
16541654
void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
1655-
struct drm_atomic_state *state);
1655+
struct intel_atomic_state *state);
16561656
bool intel_fbc_is_active(struct drm_i915_private *dev_priv);
16571657
void intel_fbc_pre_update(struct intel_crtc *crtc,
16581658
struct intel_crtc_state *crtc_state,

drivers/gpu/drm/i915/intel_fbc.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,19 +1054,19 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv,
10541054
* enable FBC for the chosen CRTC. If it does, it will set dev_priv->fbc.crtc.
10551055
*/
10561056
void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
1057-
struct drm_atomic_state *state)
1057+
struct intel_atomic_state *state)
10581058
{
10591059
struct intel_fbc *fbc = &dev_priv->fbc;
1060-
struct drm_plane *plane;
1061-
struct drm_plane_state *plane_state;
1060+
struct intel_plane *plane;
1061+
struct intel_plane_state *plane_state;
10621062
bool crtc_chosen = false;
10631063
int i;
10641064

10651065
mutex_lock(&fbc->lock);
10661066

10671067
/* Does this atomic commit involve the CRTC currently tied to FBC? */
10681068
if (fbc->crtc &&
1069-
!drm_atomic_get_existing_crtc_state(state, &fbc->crtc->base))
1069+
!intel_atomic_get_new_crtc_state(state, fbc->crtc))
10701070
goto out;
10711071

10721072
if (!intel_fbc_can_enable(dev_priv))
@@ -1076,13 +1076,11 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
10761076
* plane. We could go for fancier schemes such as checking the plane
10771077
* size, but this would just affect the few platforms that don't tie FBC
10781078
* to pipe or plane A. */
1079-
for_each_new_plane_in_state(state, plane, plane_state, i) {
1080-
struct intel_plane_state *intel_plane_state =
1081-
to_intel_plane_state(plane_state);
1082-
struct intel_crtc_state *intel_crtc_state;
1083-
struct intel_crtc *crtc = to_intel_crtc(plane_state->crtc);
1079+
for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
1080+
struct intel_crtc_state *crtc_state;
1081+
struct intel_crtc *crtc = to_intel_crtc(plane_state->base.crtc);
10841082

1085-
if (!intel_plane_state->base.visible)
1083+
if (!plane_state->base.visible)
10861084
continue;
10871085

10881086
if (fbc_on_pipe_a_only(dev_priv) && crtc->pipe != PIPE_A)
@@ -1091,10 +1089,9 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
10911089
if (fbc_on_plane_a_only(dev_priv) && crtc->i9xx_plane != PLANE_A)
10921090
continue;
10931091

1094-
intel_crtc_state = to_intel_crtc_state(
1095-
drm_atomic_get_existing_crtc_state(state, &crtc->base));
1092+
crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
10961093

1097-
intel_crtc_state->enable_fbc = true;
1094+
crtc_state->enable_fbc = true;
10981095
crtc_chosen = true;
10991096
break;
11001097
}

0 commit comments

Comments
 (0)