Commit bca0bfa3 authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/i915: Use intel_ types in haswell_mode_set_planes_workaround()



Pass around intel_atomic_state rather than drm_atomic_state.
This avoids some extra casts and annoing aliasing variables.

Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190517193132.8140-5-ville.syrjala@linux.intel.com


Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parent c3b1e6c6
Loading
Loading
Loading
Loading
+18 −22
Original line number Original line Diff line number Diff line
@@ -13120,29 +13120,27 @@ static void intel_modeset_clear_plls(struct intel_atomic_state *state)
 * multiple pipes, and planes are enabled after the pipe, we need to wait at
 * multiple pipes, and planes are enabled after the pipe, we need to wait at
 * least 2 vblanks on the first pipe before enabling planes on the second pipe.
 * least 2 vblanks on the first pipe before enabling planes on the second pipe.
 */
 */
static int haswell_mode_set_planes_workaround(struct drm_atomic_state *state)
static int haswell_mode_set_planes_workaround(struct intel_atomic_state *state)
{
{
	struct drm_crtc_state *crtc_state;
	struct intel_crtc_state *crtc_state;
	struct intel_crtc *intel_crtc;
	struct intel_crtc *crtc;
	struct drm_crtc *crtc;
	struct intel_crtc_state *first_crtc_state = NULL;
	struct intel_crtc_state *first_crtc_state = NULL;
	struct intel_crtc_state *other_crtc_state = NULL;
	struct intel_crtc_state *other_crtc_state = NULL;
	enum pipe first_pipe = INVALID_PIPE, enabled_pipe = INVALID_PIPE;
	enum pipe first_pipe = INVALID_PIPE, enabled_pipe = INVALID_PIPE;
	int i;
	int i;


	/* look at all crtc's that are going to be enabled in during modeset */
	/* look at all crtc's that are going to be enabled in during modeset */
	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
	for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
		intel_crtc = to_intel_crtc(crtc);
		if (!crtc_state->base.active ||

		    !needs_modeset(&crtc_state->base))
		if (!crtc_state->active || !needs_modeset(crtc_state))
			continue;
			continue;


		if (first_crtc_state) {
		if (first_crtc_state) {
			other_crtc_state = to_intel_crtc_state(crtc_state);
			other_crtc_state = crtc_state;
			break;
			break;
		} else {
		} else {
			first_crtc_state = to_intel_crtc_state(crtc_state);
			first_crtc_state = crtc_state;
			first_pipe = intel_crtc->pipe;
			first_pipe = crtc->pipe;
		}
		}
	}
	}


@@ -13151,24 +13149,22 @@ static int haswell_mode_set_planes_workaround(struct drm_atomic_state *state)
		return 0;
		return 0;


	/* w/a possibly needed, check how many crtc's are already enabled. */
	/* w/a possibly needed, check how many crtc's are already enabled. */
	for_each_intel_crtc(state->dev, intel_crtc) {
	for_each_intel_crtc(state->base.dev, crtc) {
		struct intel_crtc_state *pipe_config;
		crtc_state = intel_atomic_get_crtc_state(&state->base, crtc);

		if (IS_ERR(crtc_state))
		pipe_config = intel_atomic_get_crtc_state(state, intel_crtc);
			return PTR_ERR(crtc_state);
		if (IS_ERR(pipe_config))
			return PTR_ERR(pipe_config);


		pipe_config->hsw_workaround_pipe = INVALID_PIPE;
		crtc_state->hsw_workaround_pipe = INVALID_PIPE;


		if (!pipe_config->base.active ||
		if (!crtc_state->base.active ||
		    needs_modeset(&pipe_config->base))
		    needs_modeset(&crtc_state->base))
			continue;
			continue;


		/* 2 or more enabled crtcs means no need for w/a */
		/* 2 or more enabled crtcs means no need for w/a */
		if (enabled_pipe != INVALID_PIPE)
		if (enabled_pipe != INVALID_PIPE)
			return 0;
			return 0;


		enabled_pipe = intel_crtc->pipe;
		enabled_pipe = crtc->pipe;
	}
	}


	if (enabled_pipe != INVALID_PIPE)
	if (enabled_pipe != INVALID_PIPE)
@@ -13331,7 +13327,7 @@ static int intel_modeset_checks(struct drm_atomic_state *state)
	intel_modeset_clear_plls(intel_state);
	intel_modeset_clear_plls(intel_state);


	if (IS_HASWELL(dev_priv))
	if (IS_HASWELL(dev_priv))
		return haswell_mode_set_planes_workaround(state);
		return haswell_mode_set_planes_workaround(intel_state);


	return 0;
	return 0;
}
}