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

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

drm/i915: Clean up the baseline bpp computation



Pass on the errno all the way from connected_sink_max_bpp(),
and make the base_bpp handling in intel_modeset_pipe_config()
a bit less ugly. We'll also rename connected_sink_max_bpp()
to not give the impression that it return the bpp value,
and we'll pimp up the debug message within to include the
connector name/id.

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


Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
parent d26592c6
Loading
Loading
Loading
Loading
+24 −18
Original line number Diff line number Diff line
@@ -10930,11 +10930,12 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
}

static int
connected_sink_max_bpp(const struct drm_connector_state *conn_state,
compute_sink_pipe_bpp(const struct drm_connector_state *conn_state,
		      struct intel_crtc_state *pipe_config)
{
	struct drm_connector *connector = conn_state->connector;
	const struct drm_display_info *info = &connector->display_info;
	int bpp;
	struct drm_display_info *info = &conn_state->connector->display_info;

	switch (conn_state->max_bpc) {
	case 6 ... 7:
@@ -10954,12 +10955,15 @@ connected_sink_max_bpp(const struct drm_connector_state *conn_state,
	}

	if (bpp < pipe_config->pipe_bpp) {
		DRM_DEBUG_KMS("Limiting display bpp to %d instead of Edid bpp "
			      "%d, requested bpp %d, max platform bpp %d\n", bpp,
			      3 * info->bpc, 3 * conn_state->max_requested_bpc,
		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Limiting display bpp to %d instead of "
			      "EDID bpp %d, requested bpp %d, max platform bpp %d\n",
			      connector->base.id, connector->name,
			      bpp, 3 * info->bpc, 3 * conn_state->max_requested_bpc,
			      pipe_config->pipe_bpp);

		pipe_config->pipe_bpp = bpp;
	}

	return 0;
}

@@ -10968,7 +10972,7 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
			  struct intel_crtc_state *pipe_config)
{
	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
	struct drm_atomic_state *state;
	struct drm_atomic_state *state = pipe_config->base.state;
	struct drm_connector *connector;
	struct drm_connector_state *connector_state;
	int bpp, i;
@@ -10981,21 +10985,21 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
	else
		bpp = 8*3;


	pipe_config->pipe_bpp = bpp;

	state = pipe_config->base.state;

	/* Clamp display bpp to EDID value */
	/* Clamp display bpp to connector max bpp */
	for_each_new_connector_in_state(state, connector, connector_state, i) {
		int ret;

		if (connector_state->crtc != &crtc->base)
			continue;

		if (connected_sink_max_bpp(connector_state, pipe_config) < 0)
			return -EINVAL;
		ret = compute_sink_pipe_bpp(connector_state, pipe_config);
		if (ret)
			return ret;
	}

	return bpp;
	return 0;
}

static void intel_dump_crtc_timings(const struct drm_display_mode *mode)
@@ -11320,10 +11324,12 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
	      (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC)))
		pipe_config->base.adjusted_mode.flags |= DRM_MODE_FLAG_NVSYNC;

	base_bpp = compute_baseline_pipe_bpp(to_intel_crtc(crtc),
	ret = compute_baseline_pipe_bpp(to_intel_crtc(crtc),
					pipe_config);
	if (base_bpp < 0)
		return -EINVAL;
	if (ret)
		return ret;

	base_bpp = pipe_config->pipe_bpp;

	/*
	 * Determine the real pipe dimensions. Note that stereo modes can