Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e3c9717 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Daniel Vetter
Browse files

drm/i915: Make intel_crtc->config a pointer



To match the semantics of drm_crtc->state, which this will eventually
become. The allocation of the memory for config will be fixed in a
followup patch. By adding the extra _config field to intel_crtc it was
possible to generate this entire patch with the cocci script below.

@@ @@
struct intel_crtc {
...
-struct intel_crtc_state config;
+struct intel_crtc_state _config;
+struct intel_crtc_state *config;
...
}
@@ struct intel_crtc *crtc; @@
-memset(&crtc->config, 0, sizeof(crtc->config));
+memset(crtc->config, 0, sizeof(*crtc->config));
@@ @@
__intel_set_mode(...) {
<...
-to_intel_crtc(crtc)->config = *pipe_config;
+(*(to_intel_crtc(crtc)->config)) = *pipe_config;
...>
}
@@ @@
intel_crtc_init(...) {
...
WARN_ON(drm_crtc_index(&intel_crtc->base) != intel_crtc->pipe);
+intel_crtc->config = &intel_crtc->_config;
return;
...
}
@@ struct intel_crtc *crtc; @@
-&crtc->config
+crtc->config
@@ struct intel_crtc *crtc; identifier member; @@
-crtc->config.member
+crtc->config->member
@@ expression E; @@
-&(to_intel_crtc(E)->config)
+to_intel_crtc(E)->config
@@ expression E; identifier member; @@
-to_intel_crtc(E)->config.member
+to_intel_crtc(E)->config->member

v2: Clarify manual changes by splitting them into another patch. (Matt)
    Improve cocci script to generate even more of the changes. (Ander)

Signed-off-by: default avatarAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 681a8504
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -2628,7 +2628,8 @@ static int i915_display_info(struct seq_file *m, void *unused)

		seq_printf(m, "CRTC %d: pipe: %c, active=%s (size=%dx%d)\n",
			   crtc->base.base.id, pipe_name(crtc->pipe),
			   yesno(crtc->active), crtc->config.pipe_src_w, crtc->config.pipe_src_h);
			   yesno(crtc->active), crtc->config->pipe_src_w,
			   crtc->config->pipe_src_h);
		if (crtc->active) {
			intel_crtc_info(m, crtc);

@@ -3362,9 +3363,9 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
	 * relevant on hsw with pipe A when using the always-on power well
	 * routing.
	 */
	if (crtc->config.cpu_transcoder == TRANSCODER_EDP &&
	    !crtc->config.pch_pfit.enabled) {
		crtc->config.pch_pfit.force_thru = true;
	if (crtc->config->cpu_transcoder == TRANSCODER_EDP &&
	    !crtc->config->pch_pfit.enabled) {
		crtc->config->pch_pfit.force_thru = true;

		intel_display_power_get(dev_priv,
					POWER_DOMAIN_PIPE_PANEL_FITTER(PIPE_A));
@@ -3388,8 +3389,8 @@ static void hsw_undo_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
	 * relevant on hsw with pipe A when using the always-on power well
	 * routing.
	 */
	if (crtc->config.pch_pfit.force_thru) {
		crtc->config.pch_pfit.force_thru = false;
	if (crtc->config->pch_pfit.force_thru) {
		crtc->config->pch_pfit.force_thru = false;

		dev_priv->display.crtc_disable(&crtc->base);
		dev_priv->display.crtc_enable(&crtc->base);
+4 −4
Original line number Diff line number Diff line
@@ -593,7 +593,7 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
		struct intel_crtc *intel_crtc =
			to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
		const struct drm_display_mode *mode =
			&intel_crtc->config.base.adjusted_mode;
			&intel_crtc->config->base.adjusted_mode;

		htotal = mode->crtc_htotal;
		hsync_start = mode->crtc_hsync_start;
@@ -664,7 +664,7 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
{
	struct drm_device *dev = crtc->base.dev;
	struct drm_i915_private *dev_priv = dev->dev_private;
	const struct drm_display_mode *mode = &crtc->config.base.adjusted_mode;
	const struct drm_display_mode *mode = &crtc->config->base.adjusted_mode;
	enum pipe pipe = crtc->pipe;
	int position, vtotal;

@@ -691,7 +691,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
	struct drm_i915_private *dev_priv = dev->dev_private;
	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
	const struct drm_display_mode *mode = &intel_crtc->config.base.adjusted_mode;
	const struct drm_display_mode *mode = &intel_crtc->config->base.adjusted_mode;
	int position;
	int vbl_start, vbl_end, hsync_start, htotal, vtotal;
	bool in_vbl = true;
@@ -849,7 +849,7 @@ static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe,
	return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
						     vblank_time, flags,
						     crtc,
						     &to_intel_crtc(crtc)->config.base.adjusted_mode);
						     &to_intel_crtc(crtc)->config->base.adjusted_mode);
}

static bool intel_hpd_irq_event(struct drm_device *dev,
+2 −2
Original line number Diff line number Diff line
@@ -108,9 +108,9 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
	intel_state->clip.x1 = 0;
	intel_state->clip.y1 = 0;
	intel_state->clip.x2 =
		intel_crtc->active ? intel_crtc->config.pipe_src_w : 0;
		intel_crtc->active ? intel_crtc->config->pipe_src_w : 0;
	intel_state->clip.y2 =
		intel_crtc->active ? intel_crtc->config.pipe_src_h : 0;
		intel_crtc->active ? intel_crtc->config->pipe_src_h : 0;

	/*
	 * Disabling a plane is always okay; we just need to update
+1 −1
Original line number Diff line number Diff line
@@ -400,7 +400,7 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
{
	struct drm_encoder *encoder = &intel_encoder->base;
	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
	struct drm_display_mode *mode = &crtc->config.base.adjusted_mode;
	struct drm_display_mode *mode = &crtc->config->base.adjusted_mode;
	struct drm_connector *connector;
	struct drm_device *dev = encoder->dev;
	struct drm_i915_private *dev_priv = dev->dev_private;
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
	struct drm_i915_private *dev_priv = dev->dev_private;
	struct intel_crt *crt = intel_encoder_to_crt(encoder);
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
	struct drm_display_mode *adjusted_mode = &crtc->config.base.adjusted_mode;
	struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
	u32 adpa;

	if (INTEL_INFO(dev)->gen >= 5)
Loading