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

drm/i915: Stop using drm_atomic_helper_check_planes()



We need to insert stuff between the plane and crtc .atomic_check()
drm_atomic_helper_check_planes() doesn't allow us to do that so
stop using it and hand roll the loops instead.

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


Reviewed-by: default avatarStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
parent 3e706dff
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -195,14 +195,11 @@ get_crtc_from_states(const struct intel_plane_state *old_plane_state,
	return NULL;
}

static int intel_plane_atomic_check(struct drm_plane *_plane,
				    struct drm_plane_state *_new_plane_state)
int intel_plane_atomic_check(struct intel_atomic_state *state,
			     struct intel_plane *plane)
{
	struct intel_plane *plane = to_intel_plane(_plane);
	struct intel_atomic_state *state =
		to_intel_atomic_state(_new_plane_state->state);
	struct intel_plane_state *new_plane_state =
		to_intel_plane_state(_new_plane_state);
		intel_atomic_get_new_plane_state(state, plane);
	const struct intel_plane_state *old_plane_state =
		intel_atomic_get_old_plane_state(state, plane);
	struct intel_crtc *crtc =
@@ -369,5 +366,4 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
	.prepare_fb = intel_prepare_plane_fb,
	.cleanup_fb = intel_cleanup_plane_fb,
	.atomic_check = intel_plane_atomic_check,
};
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
					struct intel_crtc_state *crtc_state,
					const struct intel_plane_state *old_plane_state,
					struct intel_plane_state *intel_state);
int intel_plane_atomic_check(struct intel_atomic_state *state,
			     struct intel_plane *plane);
int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state,
				    struct intel_crtc_state *crtc_state,
				    const struct intel_plane_state *old_plane_state,
+45 −12
Original line number Diff line number Diff line
@@ -11783,15 +11783,14 @@ static bool c8_planes_changed(const struct intel_crtc_state *new_crtc_state)
	return !old_crtc_state->c8_planes != !new_crtc_state->c8_planes;
}

static int intel_crtc_atomic_check(struct drm_crtc *_crtc,
				   struct drm_crtc_state *_crtc_state)
static int intel_crtc_atomic_check(struct intel_atomic_state *state,
				   struct intel_crtc *crtc)
{
	struct intel_crtc *crtc = to_intel_crtc(_crtc);
	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
	struct intel_crtc_state *crtc_state =
		to_intel_crtc_state(_crtc_state);
	int ret;
		intel_atomic_get_new_crtc_state(state, crtc);
	bool mode_changed = needs_modeset(crtc_state);
	int ret;

	if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv) &&
	    mode_changed && !crtc_state->base.active)
@@ -11863,10 +11862,6 @@ static int intel_crtc_atomic_check(struct drm_crtc *_crtc,
	return ret;
}

static const struct drm_crtc_helper_funcs intel_helper_funcs = {
	.atomic_check = intel_crtc_atomic_check,
};

static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
{
	struct intel_connector *connector;
@@ -13541,6 +13536,42 @@ static void intel_crtc_check_fastset(const struct intel_crtc_state *old_crtc_sta
	new_crtc_state->has_drrs = old_crtc_state->has_drrs;
}

static int intel_atomic_check_planes(struct intel_atomic_state *state)
{
	struct intel_plane_state *plane_state;
	struct intel_plane *plane;
	int i, ret;

	for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
		ret = intel_plane_atomic_check(state, plane);
		if (ret) {
			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic driver check failed\n",
					 plane->base.base.id, plane->base.name);
			return ret;
		}
	}

	return 0;
}

static int intel_atomic_check_crtcs(struct intel_atomic_state *state)
{
	struct intel_crtc_state *crtc_state;
	struct intel_crtc *crtc;
	int i;

	for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
		int ret = intel_crtc_atomic_check(state, crtc);
		if (ret) {
			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic driver check failed\n",
					 crtc->base.base.id, crtc->base.name);
			return ret;
		}
	}

	return 0;
}

/**
 * intel_atomic_check - validate state object
 * @dev: drm device
@@ -13604,7 +13635,11 @@ static int intel_atomic_check(struct drm_device *dev,
	if (ret)
		goto fail;

	ret = drm_atomic_helper_check_planes(dev, &state->base);
	ret = intel_atomic_check_planes(state);
	if (ret)
		goto fail;

	ret = intel_atomic_check_crtcs(state);
	if (ret)
		goto fail;

@@ -15175,8 +15210,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
		dev_priv->plane_to_crtc_mapping[i9xx_plane] = intel_crtc;
	}

	drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs);

	intel_color_init(intel_crtc);

	WARN_ON(drm_crtc_index(&intel_crtc->base) != intel_crtc->pipe);