Commit 7b510451 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Eliminate obj->state usage in g4x/vlv/chv wm computation

Use explicit old/new states instead of relying on obj->state.
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170823152226.22938-4-ville.syrjala@linux.intel.com
parent d3a8fb32
...@@ -578,6 +578,15 @@ struct i915_hotplug { ...@@ -578,6 +578,15 @@ struct i915_hotplug {
for_each_if (crtc) for_each_if (crtc)
#define for_each_oldnew_intel_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \
for ((__i) = 0; \
(__i) < (__state)->base.dev->mode_config.num_total_plane && \
((plane) = to_intel_plane((__state)->base.planes[__i].ptr), \
(old_plane_state) = to_intel_plane_state((__state)->base.planes[__i].old_state), \
(new_plane_state) = to_intel_plane_state((__state)->base.planes[__i].new_state), 1); \
(__i)++) \
for_each_if (plane)
struct drm_i915_private; struct drm_i915_private;
struct i915_mm_struct; struct i915_mm_struct;
struct i915_mmu_object; struct i915_mmu_object;
......
...@@ -1192,6 +1192,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi) ...@@ -1192,6 +1192,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
return container_of(intel_hdmi, struct intel_digital_port, hdmi); return container_of(intel_hdmi, struct intel_digital_port, hdmi);
} }
static inline struct intel_crtc_state *
intel_atomic_get_old_crtc_state(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{
return to_intel_crtc_state(drm_atomic_get_old_crtc_state(&state->base,
&crtc->base));
}
static inline struct intel_crtc_state * static inline struct intel_crtc_state *
intel_atomic_get_new_crtc_state(struct intel_atomic_state *state, intel_atomic_get_new_crtc_state(struct intel_atomic_state *state,
struct intel_crtc *crtc) struct intel_crtc *crtc)
......
...@@ -1322,21 +1322,21 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state) ...@@ -1322,21 +1322,21 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
int num_active_planes = hweight32(crtc_state->active_planes & int num_active_planes = hweight32(crtc_state->active_planes &
~BIT(PLANE_CURSOR)); ~BIT(PLANE_CURSOR));
const struct g4x_pipe_wm *raw; const struct g4x_pipe_wm *raw;
struct intel_plane_state *plane_state; const struct intel_plane_state *old_plane_state;
const struct intel_plane_state *new_plane_state;
struct intel_plane *plane; struct intel_plane *plane;
enum plane_id plane_id; enum plane_id plane_id;
int i, level; int i, level;
unsigned int dirty = 0; unsigned int dirty = 0;
for_each_intel_plane_in_state(state, plane, plane_state, i) { for_each_oldnew_intel_plane_in_state(state, plane,
const struct intel_plane_state *old_plane_state = old_plane_state,
to_intel_plane_state(plane->base.state); new_plane_state, i) {
if (new_plane_state->base.crtc != &crtc->base &&
if (plane_state->base.crtc != &crtc->base &&
old_plane_state->base.crtc != &crtc->base) old_plane_state->base.crtc != &crtc->base)
continue; continue;
if (g4x_raw_plane_wm_compute(crtc_state, plane_state)) if (g4x_raw_plane_wm_compute(crtc_state, new_plane_state))
dirty |= BIT(plane->id); dirty |= BIT(plane->id);
} }
...@@ -1831,21 +1831,21 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state) ...@@ -1831,21 +1831,21 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
int num_active_planes = hweight32(crtc_state->active_planes & int num_active_planes = hweight32(crtc_state->active_planes &
~BIT(PLANE_CURSOR)); ~BIT(PLANE_CURSOR));
bool needs_modeset = drm_atomic_crtc_needs_modeset(&crtc_state->base); bool needs_modeset = drm_atomic_crtc_needs_modeset(&crtc_state->base);
struct intel_plane_state *plane_state; const struct intel_plane_state *old_plane_state;
const struct intel_plane_state *new_plane_state;
struct intel_plane *plane; struct intel_plane *plane;
enum plane_id plane_id; enum plane_id plane_id;
int level, ret, i; int level, ret, i;
unsigned int dirty = 0; unsigned int dirty = 0;
for_each_intel_plane_in_state(state, plane, plane_state, i) { for_each_oldnew_intel_plane_in_state(state, plane,
const struct intel_plane_state *old_plane_state = old_plane_state,
to_intel_plane_state(plane->base.state); new_plane_state, i) {
if (new_plane_state->base.crtc != &crtc->base &&
if (plane_state->base.crtc != &crtc->base &&
old_plane_state->base.crtc != &crtc->base) old_plane_state->base.crtc != &crtc->base)
continue; continue;
if (vlv_raw_plane_wm_compute(crtc_state, plane_state)) if (vlv_raw_plane_wm_compute(crtc_state, new_plane_state))
dirty |= BIT(plane->id); dirty |= BIT(plane->id);
} }
...@@ -1864,7 +1864,7 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state) ...@@ -1864,7 +1864,7 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
/* cursor changes don't warrant a FIFO recompute */ /* cursor changes don't warrant a FIFO recompute */
if (dirty & ~BIT(PLANE_CURSOR)) { if (dirty & ~BIT(PLANE_CURSOR)) {
const struct intel_crtc_state *old_crtc_state = const struct intel_crtc_state *old_crtc_state =
to_intel_crtc_state(crtc->base.state); intel_atomic_get_old_crtc_state(state, crtc);
const struct vlv_fifo_state *old_fifo_state = const struct vlv_fifo_state *old_fifo_state =
&old_crtc_state->wm.vlv.fifo_state; &old_crtc_state->wm.vlv.fifo_state;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment