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

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

drm/i915/tv: Bypass the vertical filter if possible



Let's switch the pipe into interlaced mode and switch off
the TV encoder vertical filter if the pipe vdisplay
matches the TV YSIZE exactly.

While I didn't measure it I presume this might reduce
the power consumption a little bit, and the pixel rate
is halved as the pipe will now fetching in interlaced
mode rather than in progressive mode (effectively the
same difference as between IF-ID vs. PF-ID pfit modes
on more modern hardware) so a bit easier on the memory
bandwidth.

Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190129141913.5515-2-ville.syrjala@linux.intel.com


Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent addc80f0
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -1159,6 +1159,22 @@ intel_tv_get_config(struct intel_encoder *encoder,
			I915_MODE_FLAG_USE_SCANLINE_COUNTER;
}

static bool intel_tv_source_too_wide(struct drm_i915_private *dev_priv,
				     int hdisplay)
{
	return IS_GEN(dev_priv, 3) && hdisplay > 1024;
}

static bool intel_tv_vert_scaling(const struct drm_display_mode *tv_mode,
				  const struct drm_connector_state *conn_state,
				  int vdisplay)
{
	return tv_mode->crtc_vdisplay -
		conn_state->tv.margins.top -
		conn_state->tv.margins.bottom !=
		vdisplay;
}

static int
intel_tv_compute_config(struct intel_encoder *encoder,
			struct intel_crtc_state *pipe_config,
@@ -1189,7 +1205,8 @@ intel_tv_compute_config(struct intel_encoder *encoder,
	intel_tv_mode_to_mode(adjusted_mode, tv_mode);
	drm_mode_set_crtcinfo(adjusted_mode, 0);

	if (IS_GEN(dev_priv, 3) && hdisplay > 1024) {
	if (intel_tv_source_too_wide(dev_priv, hdisplay) ||
	    !intel_tv_vert_scaling(adjusted_mode, conn_state, vdisplay)) {
		int extra, top, bottom;

		extra = adjusted_mode->crtc_vdisplay - vdisplay;