From patchwork Fri Dec 18 10:33:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Swati2" X-Patchwork-Id: 11981629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7FBCC2BBCF for ; Fri, 18 Dec 2020 10:25:52 +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 95B2623A53 for ; Fri, 18 Dec 2020 10:25:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95B2623A53 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=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 33D2F6E08C; Fri, 18 Dec 2020 10:25:52 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id E24B76E0B8 for ; Fri, 18 Dec 2020 10:25:50 +0000 (UTC) IronPort-SDR: uqKIE3SVqSM7J9llbt7yvbmAUIemgUxRg4bRJ5iqPu6N9JLsPUayIU93PVasaS+x6b7d1T4Z62 7/VEvT6bBDlQ== X-IronPort-AV: E=McAfee;i="6000,8403,9838"; a="172848368" X-IronPort-AV: E=Sophos;i="5.78,430,1599548400"; d="scan'208";a="172848368" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2020 02:25:50 -0800 IronPort-SDR: QxCGiL6IA6pz6E5U3yuMiDdc6RFRE3JgMe6FTJhUXtqOXQKCgqRI4/03Mzc5lNmWQkaSVNJflm m0nczHlYdBhw== X-IronPort-AV: E=Sophos;i="5.78,430,1599548400"; d="scan'208";a="340335046" Received: from linux-x299-aorus-gaming-3-pro.iind.intel.com ([10.223.34.130]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2020 02:25:48 -0800 From: Swati Sharma To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Dec 2020 16:03:35 +0530 Message-Id: <20201218103337.31068-2-swati2.sharma@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218103337.31068-1-swati2.sharma@intel.com> References: <20201218103337.31068-1-swati2.sharma@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC][PATCH 1/3] drm/i915: Export intel_hdmi_compute_avi_infoframe() 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: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Instead of re-writing the avi_infoframe_compute func in intel_dp; exporting hdmi_compute_avi_infoframe func so that it can be called directly while encapsulating AVI infoframes in GMP dip. This is required when HDMI 2.1 PCON (dp to hdmi) is used and we need to send AVI infoframes to PCON in source control mode. Signed-off-by: Swati Sharma Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_hdmi.c | 8 ++++---- drivers/gpu/drm/i915/display/intel_hdmi.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 41eb1c175a0e..537739f9f984 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -716,10 +716,9 @@ void intel_read_infoframe(struct intel_encoder *encoder, frame->any.type, type); } -static bool -intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder, - struct intel_crtc_state *crtc_state, - struct drm_connector_state *conn_state) +bool intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder, + struct intel_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct hdmi_avi_infoframe *frame = &crtc_state->infoframes.avi.avi; const struct drm_display_mode *adjusted_mode = @@ -772,6 +771,7 @@ intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder, return true; } +EXPORT_SYMBOL(intel_hdmi_compute_avi_infoframe); static bool intel_hdmi_compute_spd_infoframe(struct intel_encoder *encoder, diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.h b/drivers/gpu/drm/i915/display/intel_hdmi.h index fa1a9b030850..b8e6630d01e3 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.h +++ b/drivers/gpu/drm/i915/display/intel_hdmi.h @@ -57,5 +57,8 @@ int intel_hdmi_dsc_get_num_slices(const struct intel_crtc_state *crtc_state, int src_max_slices, int src_max_slice_width, int hdmi_max_slices, int hdmi_throughput); int intel_hdmi_dsc_get_slice_height(int vactive); +bool intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder, + struct intel_crtc_state *crtc_state, + struct drm_connector_state *conn_state); #endif /* __INTEL_HDMI_H__ */ From patchwork Fri Dec 18 10:33:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Swati2" X-Patchwork-Id: 11981631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D05EC2BBD4 for ; Fri, 18 Dec 2020 10:25:55 +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 3FC0F23A5B for ; Fri, 18 Dec 2020 10:25:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FC0F23A5B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=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 D86A86E0B8; Fri, 18 Dec 2020 10:25:54 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 88F416E0B8 for ; Fri, 18 Dec 2020 10:25:53 +0000 (UTC) IronPort-SDR: anIyBbXJ+du4lJ4FtVGjZzO6J9XH4l09XZnD4wW6kX4+JDYhUScdIYuCT07v8g6lazn72R7P8v Q4QK73ob9r1A== X-IronPort-AV: E=McAfee;i="6000,8403,9838"; a="172848375" X-IronPort-AV: E=Sophos;i="5.78,430,1599548400"; d="scan'208";a="172848375" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2020 02:25:53 -0800 IronPort-SDR: e7pFX9TItxOtLUvO6JHsTXx6lRgiWgwFZxOp/lZlvblXd2xUOwkcRUAdJ4QjhPhZOA9hCmIQYN d+yUgUuNKDnA== X-IronPort-AV: E=Sophos;i="5.78,430,1599548400"; d="scan'208";a="340335061" Received: from linux-x299-aorus-gaming-3-pro.iind.intel.com ([10.223.34.130]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2020 02:25:50 -0800 From: Swati Sharma To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Dec 2020 16:03:36 +0530 Message-Id: <20201218103337.31068-3-swati2.sharma@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218103337.31068-1-swati2.sharma@intel.com> References: <20201218103337.31068-1-swati2.sharma@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC][PATCH 2/3] drm/i915: Sending AVI infoframe through GMP DIP 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: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" DP does not support sending AVI info frame to panel. So we need to send AVI info frame to HDMI through some other DIP. When DP-to-HDMI protocol converter is present GMP DIP will be used to send AVI infoframe instead of static HDR infoframes. While VESA spec indicates support within PCON to built AVI IF, it gives better control with source sending the infoframe by itself as per HDMI/CTA spec. Minimum of version 3 need to be used for VIC >= 128 (i.e. for 8k mode as an example). Signed-off-by: Swati Sharma Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp.c | 135 ++++++++++++++++++------ 1 file changed, 100 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index a776e7f809b4..d96e69dd2197 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -2779,6 +2779,22 @@ intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp, intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA); } +static void +intel_dp_compute_avi_infoframe_sdp(struct intel_encoder *encoder, + struct intel_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); + + if (!intel_hdmi_compute_avi_infoframe(encoder, crtc_state, conn_state)) { + drm_dbg_kms(&dev_priv->drm, "bad AVI infoframe\n"); + return; + } + + crtc_state->infoframes.enable |= + intel_hdmi_infoframe_enable(HDMI_PACKET_TYPE_GAMUT_METADATA); +} + static void intel_dp_drrs_compute_config(struct intel_dp *intel_dp, struct intel_crtc_state *pipe_config, @@ -2807,6 +2823,38 @@ intel_dp_drrs_compute_config(struct intel_dp *intel_dp, constant_n, pipe_config->fec_enable); } +static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp) +{ + struct intel_connector *intel_connector = intel_dp->attached_connector; + struct drm_connector *connector = &intel_connector->base; + int max_frl_rate; + int max_lanes, rate_per_lane; + int max_dsc_lanes, dsc_rate_per_lane; + + max_lanes = connector->display_info.hdmi.max_lanes; + rate_per_lane = connector->display_info.hdmi.max_frl_rate_per_lane; + max_frl_rate = max_lanes * rate_per_lane; + + if (connector->display_info.hdmi.dsc_cap.v_1p2) { + max_dsc_lanes = connector->display_info.hdmi.dsc_cap.max_lanes; + dsc_rate_per_lane = connector->display_info.hdmi.dsc_cap.max_frl_rate_per_lane; + if (max_dsc_lanes && dsc_rate_per_lane) + max_frl_rate = min(max_frl_rate, max_dsc_lanes * dsc_rate_per_lane); + } + + return max_frl_rate; +} + +static bool intel_dp_is_hdmi_2_1_sink(struct intel_dp *intel_dp) +{ + if (drm_dp_is_branch(intel_dp->dpcd) && + intel_dp->has_hdmi_sink && + intel_dp_hdmi_sink_max_frl(intel_dp) > 0) + return true; + + return false; +} + int intel_dp_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config, @@ -2894,7 +2942,13 @@ intel_dp_compute_config(struct intel_encoder *encoder, intel_dp_drrs_compute_config(intel_dp, pipe_config, output_bpp, constant_n); intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state); - intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp, pipe_config, conn_state); + + if (intel_dp_is_hdmi_2_1_sink(intel_dp)) { + pipe_config->has_infoframe = true; + intel_dp_compute_avi_infoframe_sdp(encoder, pipe_config, conn_state); + } else { + intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp, pipe_config, conn_state); + } return 0; } @@ -4043,28 +4097,6 @@ static int intel_dp_pcon_set_frl_mask(int max_frl) return 0; } -static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp) -{ - struct intel_connector *intel_connector = intel_dp->attached_connector; - struct drm_connector *connector = &intel_connector->base; - int max_frl_rate; - int max_lanes, rate_per_lane; - int max_dsc_lanes, dsc_rate_per_lane; - - max_lanes = connector->display_info.hdmi.max_lanes; - rate_per_lane = connector->display_info.hdmi.max_frl_rate_per_lane; - max_frl_rate = max_lanes * rate_per_lane; - - if (connector->display_info.hdmi.dsc_cap.v_1p2) { - max_dsc_lanes = connector->display_info.hdmi.dsc_cap.max_lanes; - dsc_rate_per_lane = connector->display_info.hdmi.dsc_cap.max_frl_rate_per_lane; - if (max_dsc_lanes && dsc_rate_per_lane) - max_frl_rate = min(max_frl_rate, max_dsc_lanes * dsc_rate_per_lane); - } - - return max_frl_rate; -} - static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) { #define PCON_EXTENDED_TRAIN_MODE (1 > 0) @@ -4136,16 +4168,6 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) return 0; } -static bool intel_dp_is_hdmi_2_1_sink(struct intel_dp *intel_dp) -{ - if (drm_dp_is_branch(intel_dp->dpcd) && - intel_dp->has_hdmi_sink && - intel_dp_hdmi_sink_max_frl(intel_dp) > 0) - return true; - - return false; -} - void intel_dp_check_frl_training(struct intel_dp *intel_dp) { struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); @@ -5470,12 +5492,51 @@ intel_dp_hdr_metadata_infoframe_sdp_pack(const struct hdmi_drm_infoframe *drm_in return sizeof(struct dp_sdp_header) + 2 + HDMI_DRM_INFOFRAME_SIZE; } +static ssize_t +intel_dp_avi_infoframe_sdp_pack(const union hdmi_infoframe *frame, + struct dp_sdp *sdp, size_t size) +{ + size_t length = sizeof(struct dp_sdp); + const int infoframe_size = HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE; + unsigned char buf[HDMI_INFOFRAME_HEADER_SIZE + HDMI_DRM_INFOFRAME_SIZE]; + ssize_t len; + + if (size < length) + return -ENOSPC; + + memset(sdp, 0, size); + + len = hdmi_infoframe_pack_only(frame, buf, sizeof(buf)); + if (len < 0) { + DRM_DEBUG_KMS("buffer size is smaller than avi infoframe\n"); + return -ENOSPC; + } + + if (len != infoframe_size) { + DRM_DEBUG_KMS("wrong avi infoframe size\n"); + return -ENOSPC; + } + + sdp->sdp_header.HB0 = 0; + sdp->sdp_header.HB1 = frame->avi.type; + sdp->sdp_header.HB2 = 0x1D; + sdp->sdp_header.HB3 = (0x13 << 2); + sdp->db[0] = frame->avi.version; + sdp->db[1] = frame->avi.length; + + BUILD_BUG_ON(sizeof(sdp->db) < HDMI_DRM_INFOFRAME_SIZE + 2); + memcpy(&sdp->db[2], &buf, HDMI_DRM_INFOFRAME_SIZE); + + return sizeof(struct dp_sdp_header) + 2 + HDMI_DRM_INFOFRAME_SIZE; +} + static void intel_write_dp_sdp(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state, unsigned int type) { struct intel_digital_port *dig_port = enc_to_dig_port(encoder); struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); struct dp_sdp sdp = {}; ssize_t len; @@ -5489,8 +5550,12 @@ static void intel_write_dp_sdp(struct intel_encoder *encoder, sizeof(sdp)); break; case HDMI_PACKET_TYPE_GAMUT_METADATA: - len = intel_dp_hdr_metadata_infoframe_sdp_pack(&crtc_state->infoframes.drm.drm, - &sdp, sizeof(sdp)); + if (intel_dp_is_hdmi_2_1_sink(intel_dp)) + len = intel_dp_avi_infoframe_sdp_pack(&crtc_state->infoframes.avi, &sdp, + sizeof(sdp)); + else + len = intel_dp_hdr_metadata_infoframe_sdp_pack(&crtc_state->infoframes.drm.drm, + &sdp, sizeof(sdp)); break; default: MISSING_CASE(type); From patchwork Fri Dec 18 10:33:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Swati2" X-Patchwork-Id: 11981633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40425C4361B for ; Fri, 18 Dec 2020 10:25:58 +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 EEF4023A53 for ; Fri, 18 Dec 2020 10:25:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEF4023A53 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=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 95C596E0C9; Fri, 18 Dec 2020 10:25:57 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C15E6E0B9 for ; Fri, 18 Dec 2020 10:25:56 +0000 (UTC) IronPort-SDR: 5bEU3HvJO+t7XxcDVkT/1iUaWORmQz+L20n/7xVs7vatdKEcuUh+dF97aeg83riQy9ciNndKuM GfJOXAuzyy3A== X-IronPort-AV: E=McAfee;i="6000,8403,9838"; a="172848379" X-IronPort-AV: E=Sophos;i="5.78,430,1599548400"; d="scan'208";a="172848379" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2020 02:25:56 -0800 IronPort-SDR: h+jbYPIE04OrvWp7o9TwyEZ7p2/WTHA2xFM+QJ0djfYLkXq78Dpvef+CRzVJDnlnidcKh3jFwL Dy3Aa92xeuIA== X-IronPort-AV: E=Sophos;i="5.78,430,1599548400"; d="scan'208";a="340335072" Received: from linux-x299-aorus-gaming-3-pro.iind.intel.com ([10.223.34.130]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2020 02:25:53 -0800 From: Swati Sharma To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Dec 2020 16:03:37 +0530 Message-Id: <20201218103337.31068-4-swati2.sharma@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218103337.31068-1-swati2.sharma@intel.com> References: <20201218103337.31068-1-swati2.sharma@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC][PATCH 3/3] drm/i915: Implement readout for AVI infoframe SDP 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: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" In this patch readout for AVI infoframes enclosed in GMP DIP is implemented. Signed-off-by: Swati Sharma Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp.c | 74 ++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index d96e69dd2197..4821c96991f2 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5738,6 +5738,44 @@ intel_dp_hdr_metadata_infoframe_sdp_unpack(struct hdmi_drm_infoframe *drm_infofr return ret; } +static int +intel_dp_avi_infoframe_sdp_unpack(union hdmi_infoframe *frame, + const void *buffer, size_t size) +{ + int ret; + + const struct dp_sdp *sdp = buffer; + + if (size < sizeof(struct dp_sdp)) + return -EINVAL; + + if (sdp->sdp_header.HB0 != 0) + return -EINVAL; + + if (sdp->sdp_header.HB1 != HDMI_INFOFRAME_TYPE_AVI) + return -EINVAL; + + if (sdp->sdp_header.HB2 != 0x1D) + return -EINVAL; + + if ((sdp->sdp_header.HB3 & 0x3) != 0) + return -EINVAL; + + if (((sdp->sdp_header.HB3 >> 2) & 0x3f) != 0x13) + return -EINVAL; + + if (sdp->db[0] != 2) + return -EINVAL; + + if (sdp->db[1] != HDMI_AVI_INFOFRAME_SIZE) + return -EINVAL; + + ret = hdmi_infoframe_unpack(frame, &sdp->db[2], + HDMI_DRM_INFOFRAME_SIZE); + + return ret; +} + static void intel_read_dp_vsc_sdp(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state, struct drm_dp_vsc_sdp *vsc) @@ -5790,10 +5828,37 @@ static void intel_read_dp_hdr_metadata_infoframe_sdp(struct intel_encoder *encod "Failed to unpack DP HDR Metadata Infoframe SDP\n"); } +static void intel_read_dp_avi_infoframe_sdp(struct intel_encoder *encoder, + struct intel_crtc_state *crtc_state, + union hdmi_infoframe *frame) +{ + struct intel_digital_port *dig_port = enc_to_dig_port(encoder); + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); + unsigned int type = HDMI_PACKET_TYPE_GAMUT_METADATA; + struct dp_sdp sdp = {}; + int ret; + + if ((crtc_state->infoframes.enable & + intel_hdmi_infoframe_enable(type)) == 0) + return; + + dig_port->read_infoframe(encoder, crtc_state, type, &sdp, + sizeof(sdp)); + + ret = intel_dp_avi_infoframe_sdp_unpack(frame, &sdp, + sizeof(sdp)); + + if (ret) + drm_dbg_kms(&dev_priv->drm, + "Failed to unpack DP AVI Infoframe SDP\n"); +} + void intel_read_dp_sdp(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state, unsigned int type) { + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); + if (encoder->type != INTEL_OUTPUT_DDI) return; @@ -5803,8 +5868,13 @@ void intel_read_dp_sdp(struct intel_encoder *encoder, &crtc_state->infoframes.vsc); break; case HDMI_PACKET_TYPE_GAMUT_METADATA: - intel_read_dp_hdr_metadata_infoframe_sdp(encoder, crtc_state, - &crtc_state->infoframes.drm.drm); + if (intel_dp_is_hdmi_2_1_sink(intel_dp)) { + intel_read_dp_avi_infoframe_sdp(encoder, crtc_state, + &crtc_state->infoframes.avi); + } else { + intel_read_dp_hdr_metadata_infoframe_sdp(encoder, crtc_state, + &crtc_state->infoframes.drm.drm); + } break; default: MISSING_CASE(type);