From patchwork Thu Jan 31 21:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwan-gyeong Mun X-Patchwork-Id: 10791517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14D6B922 for ; Thu, 31 Jan 2019 21:11:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D49A319C9 for ; Thu, 31 Jan 2019 21:11:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01B813198E; Thu, 31 Jan 2019 21:11:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A969F31967 for ; Thu, 31 Jan 2019 21:11:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 903A66E1B9; Thu, 31 Jan 2019 21:10:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 228056E1B3 for ; Thu, 31 Jan 2019 21:10:57 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2019 13:10:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,546,1539673200"; d="scan'208";a="112739137" Received: from helsinki.fi.intel.com ([10.237.66.145]) by orsmga006.jf.intel.com with ESMTP; 31 Jan 2019 13:10:55 -0800 From: Gwan-gyeong Mun To: intel-gfx@lists.freedesktop.org Date: Thu, 31 Jan 2019 23:10:46 +0200 Message-Id: <20190131211046.18603-7-gwan-gyeong.mun@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190131211046.18603-1-gwan-gyeong.mun@intel.com> References: <20190131211046.18603-1-gwan-gyeong.mun@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC 6/6] drm/i915/dp: Update pipe_bpp for DP YCbCr4:2:0 outputs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP pipe_bpp value was assumed RGB therefore it was multiplied with 3. But YCbCr 4:2:0 requires multiplier value to 1.5 therefore it divides pipe_bpp to 2. - RGB bpp = bpc x 3 - YCbCr 4:2:0 bpp = bpc x 1.5 Signed-off-by: Gwan-gyeong Mun Reviewed-by: Maarten Lankhorst --- drivers/gpu/drm/i915/intel_ddi.c | 7 +++++- drivers/gpu/drm/i915/intel_dp.c | 41 ++++++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index c6aed2b06a59..7f56aa7842c1 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1696,6 +1696,7 @@ void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state) struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; u32 temp; + int bpp; if (!intel_crtc_has_dp_encoder(crtc_state)) return; @@ -1707,7 +1708,11 @@ void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state) if (crtc_state->limited_color_range) temp |= TRANS_MSA_CEA_RANGE; - switch (crtc_state->pipe_bpp) { + bpp = crtc_state->pipe_bpp; + if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) + bpp *= 2; + + switch (bpp) { case 18: temp |= TRANS_MSA_6_BPC; break; diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 3a9a5a3c33a9..734c5743e03f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1761,12 +1761,13 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp, struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); struct intel_connector *intel_connector = intel_dp->attached_connector; int bpp, bpc; + int bpp_divider = pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ? 2 : 1; bpp = pipe_config->pipe_bpp; bpc = drm_dp_downstream_max_bpc(intel_dp->dpcd, intel_dp->downstream_ports); if (bpc > 0) - bpp = min(bpp, 3*bpc); + bpp = min(bpp, 3*bpc/bpp_divider); if (intel_dp_is_edp(intel_dp)) { /* Get bpp from vbt only for panels that dont have bpp in edid */ @@ -1787,12 +1788,14 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp, struct intel_crtc_state *pipe_config, struct link_config_limits *limits) { + int bpp_divider = pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ? 2 : 1; + /* For DP Compliance we override the computed bpp for the pipe */ if (intel_dp->compliance.test_data.bpc != 0) { - int bpp = 3 * intel_dp->compliance.test_data.bpc; + int bpp = 3 * intel_dp->compliance.test_data.bpc / bpp_divider; limits->min_bpp = limits->max_bpp = bpp; - pipe_config->dither_force_disable = bpp == 6 * 3; + pipe_config->dither_force_disable = bpp == 6 * 3 / bpp_divider; DRM_DEBUG_KMS("Setting pipe_bpp to %d\n", bpp); } @@ -1826,8 +1829,9 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; int bpp, clock, lane_count; int mode_rate, link_clock, link_avail; + int bpp_divider = pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ? 2 : 1; - for (bpp = limits->max_bpp; bpp >= limits->min_bpp; bpp -= 2 * 3) { + for (bpp = limits->max_bpp; bpp >= limits->min_bpp; bpp -= 2 * 3 / bpp_divider) { mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, bpp); @@ -1862,8 +1866,9 @@ intel_dp_compute_link_config_fast(struct intel_dp *intel_dp, struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; int bpp, clock, lane_count; int mode_rate, link_clock, link_avail; + int bpp_divider = pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ? 2 : 1; - for (bpp = limits->max_bpp; bpp >= limits->min_bpp; bpp -= 2 * 3) { + for (bpp = limits->max_bpp; bpp >= limits->min_bpp; bpp -= 2 * 3 / bpp_divider) { mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, bpp); @@ -2009,6 +2014,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, struct link_config_limits limits; int common_len; int ret; + int bpp_divider = pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ? 2 : 1; common_len = intel_dp_common_len_rate_limit(intel_dp, intel_dp->max_link_rate); @@ -2022,7 +2028,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, limits.min_lane_count = 1; limits.max_lane_count = intel_dp_max_lane_count(intel_dp); - limits.min_bpp = 6 * 3; + limits.min_bpp = 6 * 3 / bpp_divider; limits.max_bpp = intel_dp_compute_bpp(intel_dp, pipe_config); if (intel_dp_is_edp(intel_dp) && intel_dp->edp_dpcd[0] < DP_EDP_14) { @@ -2110,6 +2116,11 @@ intel_dp_ycbcr420_config(struct drm_connector *connector, } config->output_format = INTEL_OUTPUT_FORMAT_YCBCR420; + /* pipe_bpp value was assumed RGB therefore it was multiplied + * with 3. But YCbCr 4:2:0 requires multiplier value to 1.5 + * therefore it divides pipe_bpp to 2. + */ + config->pipe_bpp /= 2; /* YCBCR 420 output conversion needs a scaler */ if (skl_update_scaler_crtc(config)) { @@ -4446,7 +4457,23 @@ intel_pixel_encoding_setup_vsc(struct intel_dp *intel_dp, * 011b = 12bpc. * 100b = 16bpc. */ - vsc_sdp.DB17 = 0x1; + switch (crtc_state->pipe_bpp) { + case 12: /* 8bpc */ + vsc_sdp.DB17 = 0x1; + break; + case 15: /* 10bpc */ + vsc_sdp.DB17 = 0x2; + break; + case 18: /* 12bpc */ + vsc_sdp.DB17 = 0x3; + break; + case 24: /* 16bpc */ + vsc_sdp.DB17 = 0x4; + break; + default: + DRM_DEBUG_KMS("Invalid bpp value '%d'\n", crtc_state->pipe_bpp); + break; + } /* * Content Type (Bits 2:0)