From patchwork Thu Sep 24 18:41:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 11798079 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D7A7112E for ; Thu, 24 Sep 2020 18:42:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7BCAF2311E for ; Thu, 24 Sep 2020 18:42:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BCAF2311E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C45F56EB45; Thu, 24 Sep 2020 18:42:27 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A1596E491 for ; Thu, 24 Sep 2020 18:42:26 +0000 (UTC) IronPort-SDR: DFseA8IPf9WOud5ACT4lwWRP9QqooFAcaS3fR5PFYDNOYOqACqHDiy/ttX+u9abjEBLp1LomA3 UGh7dnXWl1Cw== X-IronPort-AV: E=McAfee;i="6000,8403,9754"; a="148957343" X-IronPort-AV: E=Sophos;i="5.77,298,1596524400"; d="scan'208";a="148957343" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2020 11:42:25 -0700 IronPort-SDR: zyfm7Nq1pTJW14wIJB1Nzs/Otk+YtViq9nDdifLJl7EKM5SbeBC1a0hKY5F5YcyVDxUwPdGBvU V/CiiSLIUm6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,298,1596524400"; d="scan'208";a="339164564" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga008.jf.intel.com with SMTP; 24 Sep 2020 11:42:23 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 24 Sep 2020 21:42:22 +0300 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Date: Thu, 24 Sep 2020 21:41:56 +0300 Message-Id: <20200924184156.24491-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924184156.24491-1-ville.syrjala@linux.intel.com> References: <20200924184156.24491-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/3] drm/i915: Inline intel_dp_ycbcr420_config() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" From: Ville Syrjälä intel_dp_ycbcr420_config() is rather pointless. Just inline it directly into intel_dp_compute_config(). This gets rid of the ugly double assignment of output_format. Not really sure what the best policy would be when the user supplies a mode classiefied by the display as "YCbCr 4:2:0 only", but we know that we can't do YCbCr 4:2:0 output. For now keep the current behaviour of just silently upgrade it to RGB 4:4:4. Signed-off-by: Ville Syrjälä Reviewed-by: Uma Shankar --- drivers/gpu/drm/i915/display/intel_dp.c | 33 +++++++------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index f58df4994d92..a50e502dedf8 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -599,7 +599,8 @@ intel_dp_output_format(struct drm_connector *connector, struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector)); const struct drm_display_info *info = &connector->display_info; - if (!drm_mode_is_420_only(info, mode)) + if (!connector->ycbcr_420_allowed || + !drm_mode_is_420_only(info, mode)) return INTEL_OUTPUT_FORMAT_RGB; if (intel_dp->dfp.ycbcr_444_to_420) @@ -2456,25 +2457,6 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, return 0; } -static int -intel_dp_ycbcr420_config(struct intel_crtc_state *crtc_state, - const struct drm_connector_state *conn_state) -{ - struct drm_connector *connector = conn_state->connector; - const struct drm_display_mode *adjusted_mode = - &crtc_state->hw.adjusted_mode; - - if (!connector->ycbcr_420_allowed) - return 0; - - crtc_state->output_format = intel_dp_output_format(connector, adjusted_mode); - - if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_YCBCR420) - return 0; - - return intel_pch_panel_fitting(crtc_state, conn_state); -} - bool intel_dp_limited_color_range(const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state) { @@ -2724,11 +2706,14 @@ intel_dp_compute_config(struct intel_encoder *encoder, if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A) pipe_config->has_pch_encoder = true; - pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; + pipe_config->output_format = intel_dp_output_format(&intel_connector->base, + adjusted_mode); - ret = intel_dp_ycbcr420_config(pipe_config, conn_state); - if (ret) - return ret; + if (pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) { + ret = intel_pch_panel_fitting(pipe_config, conn_state); + if (ret) + return ret; + } if (!intel_dp_port_has_audio(dev_priv, port)) pipe_config->has_audio = false;