From patchwork Sun Oct 27 07:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamsi Krishna Brahmajosyula X-Patchwork-Id: 13852427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EC7CDD10BFE for ; Sun, 27 Oct 2024 07:51:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5512F10E199; Sun, 27 Oct 2024 07:51:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LHK9Y45A"; dkim-atps=neutral Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4186E10E199 for ; Sun, 27 Oct 2024 07:51:20 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7ea9739647bso2297803a12.0 for ; Sun, 27 Oct 2024 00:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730015480; x=1730620280; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UmZ562TWvSEYWHmls9zLStGOVmuvMcWc95tM3sj3JQY=; b=LHK9Y45AyryAPTIk/XMG+uVSMztOX/zS1IAz1Uwb379BVS9SeYXKnJZ2dXRF09iJtr KTrEqqFvGD5alGciquinI5Uyz9ylYCFNJvX616k8VGaTMWJ5HO/vbR6K0sTNPC2xe4Xj gHpi3N8cX25eXEk0QbAADDF14pQq7AdwTj0Yav9CFUKfrZbkOhioTfsYACrgfp3UkhkD RWZnQjRsiS+eH/JdW/2Xti3KuBcfEeRWxXF87xDEVBl0/O7wbkzEl6WIqxlgPguDhikf CpavZYjZrsKihRcKrFw5ZiLP+fFDz+Ixph3nUoA7+hJ3KkHzglGJBv4NDp7cEAKi156Z 9Spg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730015480; x=1730620280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UmZ562TWvSEYWHmls9zLStGOVmuvMcWc95tM3sj3JQY=; b=QiA9xshCCGZprhJcSr+6iObrXwP40fjFFsKtRSvAvRk9aSZuoNWOxrkjlfDZM2V+9Y Z6X6UWwoosAv+0xuez+aldp7Ker8rs/klSsdC64UDGJfuPWGT4rZ9ScGixB0LULEvfQE vQeYkpVhJsLfP1OO3DIdtitBYz3zy8CqjY4CkIYV090sRG00GyFRRQtDuSUSkzy3CsUx Y6QhlzNzIgWCsOxI9/u9hFZiB2tc6JbSXXI4ClGh4RU+dgVtVUY6UHBWAv77OnfA5m/0 47OcFb1ByF2vAcq8t/9gOHSulWZh81odlrCs4slBfJCBDXSgFeyyr5WPspbsY3KbWBIK c+Ug== X-Forwarded-Encrypted: i=1; AJvYcCVL7gqYHamSC6Y/lRVLWp5gc3THICIKkQ77uODBDPEjHrvi8/t4nLb+6QUsTlKB/GWJ3eeR7MKnyxs=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzRQso9PwUXE0cpMKZFWgnYO80bDQUF091TE/2tv8UhRlIgPHYm x+BCRNI8bLtZGPZ9c2WQRUNacPK0TgsZiWCvf4M6qM/VIg4dMyms X-Google-Smtp-Source: AGHT+IGQOtCWxcizTXgrVFo4n+U3UJmE7USmLMCsyGi09knUS1pUdt+OcSuQZ9umOqmOBlQN2YlcjQ== X-Received: by 2002:a05:6a20:4c9b:b0:1d9:3b81:cdd3 with SMTP id adf61e73a8af0-1d9a83ab2d9mr5780061637.1.1730015479652; Sun, 27 Oct 2024 00:51:19 -0700 (PDT) Received: from fedora.. ([2405:201:d007:50c2:b7e7:6df3:9958:a45d]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7205794f9a1sm3785551b3a.90.2024.10.27.00.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 00:51:19 -0700 (PDT) From: Vamsi Krishna Brahmajosyula To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, jani.nikula@linux.intel.com Cc: skhan@linuxfoundation.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] drm/edid: convert drm_parse_hdmi_vsdb_video to use struct cea_db * Date: Sun, 27 Oct 2024 13:21:04 +0530 Message-ID: <20241027075108.14273-2-vamsikrishna.brahmajosyula@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> References: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Address the following FIXME: convert parsers to use struct cea_db in the parser drm_parse_hdmi_vsdb_video cea_db contains len and then data. Appropriately change the indices when referring to individual elements (db[n] becomes data[n-1]). Signed-off-by: Vamsi Krishna Brahmajosyula --- drivers/gpu/drm/drm_edid.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 855beafb76ff..e07e39c0caa0 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -6259,32 +6259,33 @@ static void drm_parse_hdmi_forum_scds(struct drm_connector *connector, } static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, - const u8 *hdmi) + const struct cea_db *db) { struct drm_display_info *info = &connector->display_info; unsigned int dc_bpc = 0; + const u8 *hdmi = cea_db_data(db); /* HDMI supports at least 8 bpc */ info->bpc = 8; - if (cea_db_payload_len(hdmi) < 6) + if (cea_db_payload_len(db) < 6) return; - if (hdmi[6] & DRM_EDID_HDMI_DC_30) { + if (hdmi[5] & DRM_EDID_HDMI_DC_30) { dc_bpc = 10; info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_30; drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 30.\n", connector->base.id, connector->name); } - if (hdmi[6] & DRM_EDID_HDMI_DC_36) { + if (hdmi[5] & DRM_EDID_HDMI_DC_36) { dc_bpc = 12; info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_36; drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 36.\n", connector->base.id, connector->name); } - if (hdmi[6] & DRM_EDID_HDMI_DC_48) { + if (hdmi[5] & DRM_EDID_HDMI_DC_48) { dc_bpc = 16; info->edid_hdmi_rgb444_dc_modes |= DRM_EDID_HDMI_DC_48; drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does deep color 48.\n", @@ -6302,7 +6303,7 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, info->bpc = dc_bpc; /* YCRCB444 is optional according to spec. */ - if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) { + if (hdmi[5] & DRM_EDID_HDMI_DC_Y444) { info->edid_hdmi_ycbcr444_dc_modes = info->edid_hdmi_rgb444_dc_modes; drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink does YCRCB444 in deep color.\n", connector->base.id, connector->name); @@ -6312,7 +6313,7 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, * Spec says that if any deep color mode is supported at all, * then deep color 36 bit must be supported. */ - if (!(hdmi[6] & DRM_EDID_HDMI_DC_36)) { + if (!(hdmi[5] & DRM_EDID_HDMI_DC_36)) { drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI sink should do DC_36, but does not!\n", connector->base.id, connector->name); } @@ -6320,19 +6321,20 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, /* HDMI Vendor-Specific Data Block (HDMI VSDB, H14b-VSDB) */ static void -drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db) +drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const struct cea_db *db) { struct drm_display_info *info = &connector->display_info; u8 len = cea_db_payload_len(db); + const u8 *data = cea_db_data(db); info->is_hdmi = true; - info->source_physical_address = (db[4] << 8) | db[5]; + info->source_physical_address = (data[3] << 8) | data[4]; if (len >= 6) - info->dvi_dual = db[6] & 1; + info->dvi_dual = data[5] & 1; if (len >= 7) - info->max_tmds_clock = db[7] * 5000; + info->max_tmds_clock = data[6] * 5000; /* * Try to infer whether the sink supports HDMI infoframes. @@ -6340,7 +6342,7 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db) * HDMI infoframe support was first added in HDMI 1.4. Assume the sink * supports infoframes if HDMI_Video_present is set. */ - if (len >= 8 && db[8] & BIT(5)) + if (len >= 8 && data[7] & BIT(5)) info->has_hdmi_infoframe = true; drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI: DVI dual %d, max TMDS clock %d kHz\n", @@ -6412,7 +6414,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector, const u8 *data = (const u8 *)db; if (cea_db_is_hdmi_vsdb(db)) - drm_parse_hdmi_vsdb_video(connector, data); + drm_parse_hdmi_vsdb_video(connector, db); else if (cea_db_is_hdmi_forum_vsdb(db) || cea_db_is_hdmi_forum_scdb(db)) drm_parse_hdmi_forum_scds(connector, data); From patchwork Sun Oct 27 07:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamsi Krishna Brahmajosyula X-Patchwork-Id: 13852428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5F3C1D10BFE for ; Sun, 27 Oct 2024 07:51:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D56A710E1A7; Sun, 27 Oct 2024 07:51:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Rec5AdiS"; dkim-atps=neutral Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2FEF810E1A7 for ; Sun, 27 Oct 2024 07:51:24 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-71e592d7f6eso2234801b3a.3 for ; Sun, 27 Oct 2024 00:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730015484; x=1730620284; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZG1M3TOUyG+goANQU6k5RDo7M15PqSr1tl6HcqlXoB0=; b=Rec5AdiSDJKQgCJGYEe78HHqwHnEPnkzXDHDIdNOqQnGg8spQjcoWr1e1cYRNvfnCC owuEoTcX/UiBwrvXCIitWgEass3YLmYGy1emfmeYO+nbsGw3Xi1KldGpaaf+PMBsDlPx DgqJdylzZ6puEbFJhLoKCwxOyOgLOrjCKu6Y1EPNfxVOU2nZptEylfFHqgHeHU8mTqur wFaIvkyUbFctf+IjzOxdq6d/YfFsQHzzfCrIV7LWJJNI35C3brxFMiNRePIbiaaFrLvv cWGaCQgCCwWUBUGnWQH5BjIKxq4ojaXgpPD4x/j0acdZIj1XWwjwyShWljmt4WtEnF90 OgYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730015484; x=1730620284; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZG1M3TOUyG+goANQU6k5RDo7M15PqSr1tl6HcqlXoB0=; b=OPNdreUfizKtbbhphtSDLkgwSNAqMH5Ob1og3SiJluuzMD0dZqsAqSqQb0UeRqbbgi V2gmW52RLncAluVn7ePdw1Y+aCbbexAIs3t///mvtvZLe6vGmG/5t5YJqZslKKXkqi5c ER7gYXuYEdELptIoWPNm4fWvCexWPxDBch1+XElCuZRkq8DxMOkRQSrPEabvB7e6bhEA WtSDaPuKytIUEM5E/z8S7IkDfAwbX/uOJtf0xLuv0NXQ6fbUkpJ41g+OvYOWrGtAozTu uwX2G+w3Cjo3GLUjWG9lq1Kch8tseJOnPtJR0lJ0RJF2zGwnpKuA1MIYrjX9rnrVOXM3 tg8g== X-Forwarded-Encrypted: i=1; AJvYcCV1XecTMAGCYvuTmXECHJICMI0lLiVRKiGlPaafRyf3wFEmcajJgGM7IE3/XlxvX+RslwwmOavXu9c=@lists.freedesktop.org X-Gm-Message-State: AOJu0YwXB/w/lKyzVrDcm4mjpffBXuH/JmxNBSuacZ5eXartMfOHHu70 6Enpr5oDGEU/8gOPOs3iYseyBMmEIIyykW7CP0LPo9U9YhHr7qeq X-Google-Smtp-Source: AGHT+IHIMFVfUloVq/h0b+q0MYGiJAE0Rd6mTPhC9+G2coAhYQIVYiwDm9CC3QiVWcu7OqTvAjY4fA== X-Received: by 2002:a05:6a00:c85:b0:71e:f4:dbc with SMTP id d2e1a72fcca58-7206309375fmr7351107b3a.25.1730015483426; Sun, 27 Oct 2024 00:51:23 -0700 (PDT) Received: from fedora.. ([2405:201:d007:50c2:b7e7:6df3:9958:a45d]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7205794f9a1sm3785551b3a.90.2024.10.27.00.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 00:51:22 -0700 (PDT) From: Vamsi Krishna Brahmajosyula To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, jani.nikula@linux.intel.com Cc: skhan@linuxfoundation.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] drm/edid: convert drm_parse_hdmi_forum_scds to use struct cea_db * Date: Sun, 27 Oct 2024 13:21:05 +0530 Message-ID: <20241027075108.14273-3-vamsikrishna.brahmajosyula@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> References: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Address the following FIXME: convert parsers to use struct cea_db in the parser drm_parse_hdmi_forum_scds and related methods cea_db contains len and then data. Appropriately change the indices when referring to individual elements (db[n] becomes data[n-1]). Signed-off-by: Vamsi Krishna Brahmajosyula --- drivers/gpu/drm/drm_edid.c | 56 ++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index e07e39c0caa0..f79d8fbdb62b 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -6112,45 +6112,48 @@ void drm_get_max_frl_rate(int max_frl_rate, u8 *max_lanes, u8 *max_rate_per_lane } static void drm_parse_ycbcr420_deep_color_info(struct drm_connector *connector, - const u8 *db) + const struct cea_db *db) { u8 dc_mask; struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; + const u8 *data = cea_db_data(db); - dc_mask = db[7] & DRM_EDID_YCBCR420_DC_MASK; + dc_mask = data[6] & DRM_EDID_YCBCR420_DC_MASK; hdmi->y420_dc_modes = dc_mask; } static void drm_parse_dsc_info(struct drm_hdmi_dsc_cap *hdmi_dsc, - const u8 *hf_scds) + const struct cea_db *db) { - hdmi_dsc->v_1p2 = hf_scds[11] & DRM_EDID_DSC_1P2; + const u8 *hf_scds = cea_db_data(db); + + hdmi_dsc->v_1p2 = hf_scds[10] & DRM_EDID_DSC_1P2; if (!hdmi_dsc->v_1p2) return; - hdmi_dsc->native_420 = hf_scds[11] & DRM_EDID_DSC_NATIVE_420; - hdmi_dsc->all_bpp = hf_scds[11] & DRM_EDID_DSC_ALL_BPP; + hdmi_dsc->native_420 = hf_scds[10] & DRM_EDID_DSC_NATIVE_420; + hdmi_dsc->all_bpp = hf_scds[10] & DRM_EDID_DSC_ALL_BPP; - if (hf_scds[11] & DRM_EDID_DSC_16BPC) + if (hf_scds[10] & DRM_EDID_DSC_16BPC) hdmi_dsc->bpc_supported = 16; - else if (hf_scds[11] & DRM_EDID_DSC_12BPC) + else if (hf_scds[10] & DRM_EDID_DSC_12BPC) hdmi_dsc->bpc_supported = 12; - else if (hf_scds[11] & DRM_EDID_DSC_10BPC) + else if (hf_scds[10] & DRM_EDID_DSC_10BPC) hdmi_dsc->bpc_supported = 10; else /* Supports min 8 BPC if DSC 1.2 is supported*/ hdmi_dsc->bpc_supported = 8; - if (cea_db_payload_len(hf_scds) >= 12 && hf_scds[12]) { + if (cea_db_payload_len(db) >= 12 && hf_scds[11]) { u8 dsc_max_slices; u8 dsc_max_frl_rate; - dsc_max_frl_rate = (hf_scds[12] & DRM_EDID_DSC_MAX_FRL_RATE_MASK) >> 4; + dsc_max_frl_rate = (hf_scds[11] & DRM_EDID_DSC_MAX_FRL_RATE_MASK) >> 4; drm_get_max_frl_rate(dsc_max_frl_rate, &hdmi_dsc->max_lanes, &hdmi_dsc->max_frl_rate_per_lane); - dsc_max_slices = hf_scds[12] & DRM_EDID_DSC_MAX_SLICES; + dsc_max_slices = hf_scds[11] & DRM_EDID_DSC_MAX_SLICES; switch (dsc_max_slices) { case 1: @@ -6188,26 +6191,27 @@ static void drm_parse_dsc_info(struct drm_hdmi_dsc_cap *hdmi_dsc, } } - if (cea_db_payload_len(hf_scds) >= 13 && hf_scds[13]) - hdmi_dsc->total_chunk_kbytes = hf_scds[13] & DRM_EDID_DSC_TOTAL_CHUNK_KBYTES; + if (cea_db_payload_len(db) >= 13 && hf_scds[12]) + hdmi_dsc->total_chunk_kbytes = hf_scds[12] & DRM_EDID_DSC_TOTAL_CHUNK_KBYTES; } /* Sink Capability Data Structure */ static void drm_parse_hdmi_forum_scds(struct drm_connector *connector, - const u8 *hf_scds) + const struct cea_db *db) { struct drm_display_info *info = &connector->display_info; struct drm_hdmi_info *hdmi = &info->hdmi; struct drm_hdmi_dsc_cap *hdmi_dsc = &hdmi->dsc_cap; + const u8 *hf_scds = cea_db_data(db); int max_tmds_clock = 0; u8 max_frl_rate = 0; bool dsc_support = false; info->has_hdmi_infoframe = true; - if (hf_scds[6] & 0x80) { + if (hf_scds[5] & 0x80) { hdmi->scdc.supported = true; - if (hf_scds[6] & 0x40) + if (hf_scds[5] & 0x40) hdmi->scdc.read_request = true; } @@ -6220,11 +6224,11 @@ static void drm_parse_hdmi_forum_scds(struct drm_connector *connector, * Lets check it out. */ - if (hf_scds[5]) { + if (hf_scds[4]) { struct drm_scdc *scdc = &hdmi->scdc; /* max clock is 5000 KHz times block value */ - max_tmds_clock = hf_scds[5] * 5000; + max_tmds_clock = hf_scds[4] * 5000; if (max_tmds_clock > 340000) { info->max_tmds_clock = max_tmds_clock; @@ -6234,21 +6238,21 @@ static void drm_parse_hdmi_forum_scds(struct drm_connector *connector, scdc->scrambling.supported = true; /* Few sinks support scrambling for clocks < 340M */ - if ((hf_scds[6] & 0x8)) + if ((hf_scds[5] & 0x8)) scdc->scrambling.low_rates = true; } } - if (hf_scds[7]) { - max_frl_rate = (hf_scds[7] & DRM_EDID_MAX_FRL_RATE_MASK) >> 4; + if (hf_scds[6]) { + max_frl_rate = (hf_scds[6] & DRM_EDID_MAX_FRL_RATE_MASK) >> 4; drm_get_max_frl_rate(max_frl_rate, &hdmi->max_lanes, &hdmi->max_frl_rate_per_lane); } - drm_parse_ycbcr420_deep_color_info(connector, hf_scds); + drm_parse_ycbcr420_deep_color_info(connector, db); - if (cea_db_payload_len(hf_scds) >= 11 && hf_scds[11]) { - drm_parse_dsc_info(hdmi_dsc, hf_scds); + if (cea_db_payload_len(db) >= 11 && hf_scds[10]) { + drm_parse_dsc_info(hdmi_dsc, db); dsc_support = true; } @@ -6417,7 +6421,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector, drm_parse_hdmi_vsdb_video(connector, db); else if (cea_db_is_hdmi_forum_vsdb(db) || cea_db_is_hdmi_forum_scdb(db)) - drm_parse_hdmi_forum_scds(connector, data); + drm_parse_hdmi_forum_scds(connector, db); else if (cea_db_is_microsoft_vsdb(db)) drm_parse_microsoft_vsdb(connector, data); else if (cea_db_is_y420cmdb(db)) From patchwork Sun Oct 27 07:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamsi Krishna Brahmajosyula X-Patchwork-Id: 13852429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DE03BD10BFE for ; Sun, 27 Oct 2024 07:51:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69AF510E1DA; Sun, 27 Oct 2024 07:51:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HsMDsWu6"; dkim-atps=neutral Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id DBB5D10E1DA for ; Sun, 27 Oct 2024 07:51:27 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7ed9f1bcb6bso2156947a12.1 for ; Sun, 27 Oct 2024 00:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730015487; x=1730620287; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nzgoY73OAH7IN4I8JIVtQ+45LcH7GhgBHjlXlGpHvfY=; b=HsMDsWu6CRVA5hBeBXnlJDO+foTR1deZlcnlt0JzCHW6823hHUX34IED6vAYlhudnd vYw8SgUNhU2c3+X7DpoIsQRMFT2QsllncV+NRK9TGc6CqH48ORNkVjgCKe0vjcn6mfhv BHgJfbhzMU3/+EdVchhktNuTt4Ew1GycGdHhY6D4dnif6GXrIXZPfpOaWNMCXbdfWAeT teLtkmel4Q4CL6bTKGG014hRoncf1PHKqyiPStNyQFpbfTTgAD1z51WkgK4RYZOnqBxh CyDriZk55bPtcNDQ9HUVa+ibi4BLLjTqyLNDZlB5h6rEghZ90AcHfwf7SXRbIQtIvHNE mUbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730015487; x=1730620287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nzgoY73OAH7IN4I8JIVtQ+45LcH7GhgBHjlXlGpHvfY=; b=Wb9sdgWUQrzI5/jdMT6mojdB6nDyndrdUgv0Yz7V7uthlxtMHzLroXZqie19sdCFuC SLO5kaOd4hqk561VEv+/DCyuwEg4ZMudUX2QOikwFP+FdJO59xam/VAhOC9nauYa82Fk kTHgzSfbiFaibMDRJ3G+TVrnj2jPnyyeJqTh2zA4VYRnkg7wnf3n9zeavF45x/Kfg+MI nVYvmkaId16aj2xEMPSnQEV3IV9M4KgQsQDjBJfGmyglbsJxaYrkIO0i0epsVhv+GqGC ON2Dau0nmyNEpBndWhhDJzJ1eJFLEg5hDNTIn5vAb9llvNCjPIcqLZgM3LR5TqFaAHLj d3Ug== X-Forwarded-Encrypted: i=1; AJvYcCUm3SFkC79m/UxGTDn+lrhSJJmKZJlZyGw0x/vDQUZO3t1V7nn4q/+JCvc3luTLTS9dSReqmnn0qw4=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxixYFQaEPfNDdPHnLZAsv4RJ50SPvKAkJ1kq4Z9whvPEcLAuo4 mFLews9NwEF64K8zMabxYR2g48naweeQwbE/KuHDi60Vv+gq0bHV X-Google-Smtp-Source: AGHT+IFIvv3jnR4vgZY784qrPZUlPI3xPYuwCE5+QmhB3umvWUCbhT9ijcuc5ukibYVcOx+Qde/7kQ== X-Received: by 2002:a05:6a21:1193:b0:1d9:61:e779 with SMTP id adf61e73a8af0-1d9a83ab127mr6572670637.4.1730015487264; Sun, 27 Oct 2024 00:51:27 -0700 (PDT) Received: from fedora.. ([2405:201:d007:50c2:b7e7:6df3:9958:a45d]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7205794f9a1sm3785551b3a.90.2024.10.27.00.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 00:51:26 -0700 (PDT) From: Vamsi Krishna Brahmajosyula To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, jani.nikula@linux.intel.com Cc: skhan@linuxfoundation.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] drm/edid: convert drm_parse_microsoft_vsdb to use struct cea_db * Date: Sun, 27 Oct 2024 13:21:06 +0530 Message-ID: <20241027075108.14273-4-vamsikrishna.brahmajosyula@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> References: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Address the following FIXME: convert parsers to use struct cea_db in the parser drm_parse_microsoft_vsdb cea_db contains len and then data. Appropriately change the indices when referring to individual elements (db[n] becomes data[n-1]). Signed-off-by: Vamsi Krishna Brahmajosyula --- drivers/gpu/drm/drm_edid.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index f79d8fbdb62b..e2ef07d00aaf 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -6361,11 +6361,12 @@ drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const struct cea_db * * https://docs.microsoft.com/en-us/windows-hardware/drivers/display/specialized-monitors-edid-extension */ static void drm_parse_microsoft_vsdb(struct drm_connector *connector, - const u8 *db) + const struct cea_db *db) { struct drm_display_info *info = &connector->display_info; - u8 version = db[4]; - bool desktop_usage = db[5] & BIT(6); + const u8 *data = cea_db_data(db); + u8 version = data[3]; + bool desktop_usage = data[4] & BIT(6); /* Version 1 and 2 for HMDs, version 3 flags desktop usage explicitly */ if (version == 1 || version == 2 || (version == 3 && !desktop_usage)) @@ -6373,7 +6374,7 @@ static void drm_parse_microsoft_vsdb(struct drm_connector *connector, drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HMD or specialized display VSDB version %u: 0x%02x\n", - connector->base.id, connector->name, version, db[5]); + connector->base.id, connector->name, version, data[4]); } static void drm_parse_cea_ext(struct drm_connector *connector, @@ -6423,7 +6424,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector, cea_db_is_hdmi_forum_scdb(db)) drm_parse_hdmi_forum_scds(connector, db); else if (cea_db_is_microsoft_vsdb(db)) - drm_parse_microsoft_vsdb(connector, data); + drm_parse_microsoft_vsdb(connector, db); else if (cea_db_is_y420cmdb(db)) parse_cta_y420cmdb(connector, db, &y420cmdb_map); else if (cea_db_is_y420vdb(db)) From patchwork Sun Oct 27 07:51:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamsi Krishna Brahmajosyula X-Patchwork-Id: 13852430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4FFC5D10C08 for ; Sun, 27 Oct 2024 07:51:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C500510E21D; Sun, 27 Oct 2024 07:51:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nImrdwPQ"; dkim-atps=neutral Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by gabe.freedesktop.org (Postfix) with ESMTPS id D477F10E21D for ; Sun, 27 Oct 2024 07:51:31 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20cf3e36a76so32561105ad.0 for ; Sun, 27 Oct 2024 00:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730015491; x=1730620291; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=95caNnI7hgOLxEqas86hhjYPjq4p60okYGlZe1W9+VQ=; b=nImrdwPQeB9bL2sbAoAicchtSWb+JJZ81Qeqwr+TkoCI2o66Sufif7i8FqS9T/oLf+ 9XGoZ8sKyYdh4K/91UdhEULcMyf5jjPIBKDF/A/ih188a1lzZ/B0dc3ZknKcmxS6i0HR 5bH2CvNxNeDa6SXIJTA+yYM5RcdF/ExxDivcRAi0x/R5jap5J5GV9sPNpLI9GANhG0oY PFyD99Xlx/rTnO/EhFduJvfIg7caCOnoCpHzaJ+7UP/rpFCWgEstP9XHOGP3M/D2dP0V NBGaOgVUeV/4B/8KBtnV5yR+QBhoPJpJF5EjdJuR9dCxFF9M/Xvabq7deR5C7HUkLDPD kz6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730015491; x=1730620291; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=95caNnI7hgOLxEqas86hhjYPjq4p60okYGlZe1W9+VQ=; b=AgpVbYwevMHFGrO272RubqsmgkCWnzC9pyIj3dq8f1WidQfG30a1QIweW4bSeY3jsA j3fq5iH+dxYpLahqnG84WsKME0mxNuxzhSLNY27YJYwZIAonyGLurHx5Vm6yyzFU16zl /FANhuSDBCiwYGp0TYew84QWt65aRET3TmjGdaWeiyohEVv3nDOCDtdJf8dE2qGhz9TY YWyQtQKLW4KAYuUdAbMqv2vvPHuMQIb825jtOSIPP+VgsNmxT0EZ1j0tJf6rYJuERT11 aANdIsaPf3d1ou9wRY1/dq6BXq6WUUb5QOe+xUvXNDaoH2BZ30BdE9p1f/LpxhGYk7gv Q0Ew== X-Forwarded-Encrypted: i=1; AJvYcCWb1vw8fRi3yuXEcLmiwgqMcd/ZJSXvqFp/TbHxjzaiWfw3V49ULctfe7VdxJIv89Lz6JYsc1eiDIU=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yy7aPTW+ap4cDmaYmhUnuOVypZdJwTVT9F+W/ZaKiN6hjvfxiR2 oKysaXcOJRBlqrvhXIlcnuBPatWFm85s+Cke2ZOZL2NR8GpP9rk/ X-Google-Smtp-Source: AGHT+IH7qS5niQmAAfTA2UGQJF1s0kcotIcMoHkxWCvAmGRljhi8/z+HxbR/00ppveIZ8SYyL8JZRA== X-Received: by 2002:a05:6a21:6282:b0:1cc:9f25:54d4 with SMTP id adf61e73a8af0-1d9a84d9ddfmr6268806637.38.1730015491155; Sun, 27 Oct 2024 00:51:31 -0700 (PDT) Received: from fedora.. ([2405:201:d007:50c2:b7e7:6df3:9958:a45d]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7205794f9a1sm3785551b3a.90.2024.10.27.00.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 00:51:30 -0700 (PDT) From: Vamsi Krishna Brahmajosyula To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, jani.nikula@linux.intel.com Cc: skhan@linuxfoundation.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] drm/edid: convert drm_parse_vcdb to use struct cea_db * Date: Sun, 27 Oct 2024 13:21:07 +0530 Message-ID: <20241027075108.14273-5-vamsikrishna.brahmajosyula@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> References: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Address the following FIXME: convert parsers to use struct cea_db in the parser drm_parse_vcdb cea_db contains len and then data. Appropriately change the indices when referring to individual elements (db[n] becomes data[n-1]). Signed-off-by: Vamsi Krishna Brahmajosyula --- drivers/gpu/drm/drm_edid.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index e2ef07d00aaf..d9fa994a3acc 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -6065,14 +6065,15 @@ static void parse_cta_y420vdb(struct drm_connector *connector, } } -static void drm_parse_vcdb(struct drm_connector *connector, const u8 *db) +static void drm_parse_vcdb(struct drm_connector *connector, const struct cea_db *db) { struct drm_display_info *info = &connector->display_info; + const u8 *data = cea_db_data(db); drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] CEA VCDB 0x%02x\n", - connector->base.id, connector->name, db[2]); + connector->base.id, connector->name, data[1]); - if (db[2] & EDID_CEA_VCDB_QS) + if (data[1] & EDID_CEA_VCDB_QS) info->rgb_quant_range_selectable = true; } @@ -6430,7 +6431,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector, else if (cea_db_is_y420vdb(db)) parse_cta_y420vdb(connector, db); else if (cea_db_is_vcdb(db)) - drm_parse_vcdb(connector, data); + drm_parse_vcdb(connector, db); else if (cea_db_is_hdmi_hdr_metadata_block(db)) drm_parse_hdr_metadata_block(connector, data); else if (cea_db_tag(db) == CTA_DB_VIDEO) From patchwork Sun Oct 27 07:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamsi Krishna Brahmajosyula X-Patchwork-Id: 13852431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C4804D10C08 for ; Sun, 27 Oct 2024 07:51:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 49DE610E23E; Sun, 27 Oct 2024 07:51:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fuIXm/3v"; dkim-atps=neutral Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7877A10E23E for ; Sun, 27 Oct 2024 07:51:35 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71ea2643545so2683410b3a.3 for ; Sun, 27 Oct 2024 00:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730015495; x=1730620295; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zOn93d9tLichC+5tHiWOkakuU/3lAA1dF93RrhXoO/E=; b=fuIXm/3vl4qzUw0wL76tytZledvi5/STniodkyayLib5b94Mc0S1Cl0XBkNfipxRuC bleYAktajGHDDbf03zcXqSHu6g9gKjn7qWr8EECZzIn2kPRMaUHc+2X8x6TOk67MiyV7 VMsvq0VqlJgylCNv8pTn5Q+wMgBKwlDPLPMOWduEdO4EXTMbNKvJ62cU4OsY4g6QcNxb stFGhjO+2a8WgRvWFvvEm2QEy0YO2SzuRJRLG1HQb0sZxU0gyNv/zwKzS2sQwpESbhM9 RkyGyMqw4odBLLCxlX9dLmmCPUbIMGNOoSNXTTszDSUMYOYW7PIwhZos8CpbKNAd55Ax nYpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730015495; x=1730620295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zOn93d9tLichC+5tHiWOkakuU/3lAA1dF93RrhXoO/E=; b=VcY/qLi2uxz6pH6lf8OFAIFYBrgCdw+IFXFKvg0w7k+bfP2zJW7QVqNVT0pTdDCoFU JFPFNJAXZLvlvc16yl8H4dUI0IJvlheyBiaXM/0lkMQPi9VgnfCE7uQu8nBFkkssyZZZ Qpt4nHfYNHOkQR1vObgBriHrVLx1nFRXDO1c+uUH3x1DztKD6P6fjAfwjwVA1lViBizi mj+IPQMvkAYXi9GdMzVMVY8x9pKUZJARa3GvOrsZNL/UsqW0u7d43lklfv0Hh0qWmjD6 +0vdg2LB9Ftq9b4Sv2DBpn59WpIqosKX4B8yCiddJTxeG4VU5X0qseOHvVxty4kmyvmL qIFw== X-Forwarded-Encrypted: i=1; AJvYcCX5vygVnp7HIInqLAlXe8XIgCpWp/sMItzRqVvAwtB7sng2bQPxkGtTEIpt+UGFrsY0bImC7Kahekk=@lists.freedesktop.org X-Gm-Message-State: AOJu0YwXpFN6dWzN6o5MjadcgJrqhyO5n8AXEDJfCHj9qJGiqnXe0YGC 3qe/EY7iMnU6wWXSQu6xmAP5z1AWnStn+2zxsLVFwE0NQFWqjDWZ X-Google-Smtp-Source: AGHT+IHuwf5v8s7V3KbWx323aO0dVtPL/Va9rCXnkmlyIBRqfcRtNaZ7kC0WQpGCrrX/ks4HwY371A== X-Received: by 2002:a05:6a00:b55:b0:71e:744a:3fbd with SMTP id d2e1a72fcca58-7206306df29mr7284417b3a.20.1730015494847; Sun, 27 Oct 2024 00:51:34 -0700 (PDT) Received: from fedora.. ([2405:201:d007:50c2:b7e7:6df3:9958:a45d]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7205794f9a1sm3785551b3a.90.2024.10.27.00.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2024 00:51:34 -0700 (PDT) From: Vamsi Krishna Brahmajosyula To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, jani.nikula@linux.intel.com Cc: skhan@linuxfoundation.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] drm/edid: convert drm_parse_hdr_metadata_block to use struct cea_db * Date: Sun, 27 Oct 2024 13:21:08 +0530 Message-ID: <20241027075108.14273-6-vamsikrishna.brahmajosyula@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> References: <20241027075108.14273-1-vamsikrishna.brahmajosyula@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Address the following FIXME: convert parsers to use struct cea_db in the parser drm_parse_hdr_metadata_block cea_db contains len and then data. Appropriately change the indices when referring to individual elements (db[n] becomes data[n-1]). Signed-off-by: Vamsi Krishna Brahmajosyula --- drivers/gpu/drm/drm_edid.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index d9fa994a3acc..8b2b75885027 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5418,7 +5418,7 @@ static void drm_calculate_luminance_range(struct drm_connector *connector) static uint8_t eotf_supported(const u8 *edid_ext) { - return edid_ext[2] & + return edid_ext[1] & (BIT(HDMI_EOTF_TRADITIONAL_GAMMA_SDR) | BIT(HDMI_EOTF_TRADITIONAL_GAMMA_HDR) | BIT(HDMI_EOTF_SMPTE_ST2084) | @@ -5427,28 +5427,29 @@ static uint8_t eotf_supported(const u8 *edid_ext) static uint8_t hdr_metadata_type(const u8 *edid_ext) { - return edid_ext[3] & + return edid_ext[2] & BIT(HDMI_STATIC_METADATA_TYPE1); } static void -drm_parse_hdr_metadata_block(struct drm_connector *connector, const u8 *db) +drm_parse_hdr_metadata_block(struct drm_connector *connector, const struct cea_db *db) { u16 len; len = cea_db_payload_len(db); + const u8 *data = cea_db_data(db); connector->hdr_sink_metadata.hdmi_type1.eotf = - eotf_supported(db); + eotf_supported(data); connector->hdr_sink_metadata.hdmi_type1.metadata_type = - hdr_metadata_type(db); + hdr_metadata_type(data); if (len >= 4) - connector->hdr_sink_metadata.hdmi_type1.max_cll = db[4]; + connector->hdr_sink_metadata.hdmi_type1.max_cll = data[3]; if (len >= 5) - connector->hdr_sink_metadata.hdmi_type1.max_fall = db[5]; + connector->hdr_sink_metadata.hdmi_type1.max_fall = data[4]; if (len >= 6) { - connector->hdr_sink_metadata.hdmi_type1.min_cll = db[6]; + connector->hdr_sink_metadata.hdmi_type1.min_cll = data[5]; /* Calculate only when all values are available */ drm_calculate_luminance_range(connector); @@ -6416,9 +6417,6 @@ static void drm_parse_cea_ext(struct drm_connector *connector, cea_db_iter_edid_begin(drm_edid, &iter); cea_db_iter_for_each(db, &iter) { - /* FIXME: convert parsers to use struct cea_db */ - const u8 *data = (const u8 *)db; - if (cea_db_is_hdmi_vsdb(db)) drm_parse_hdmi_vsdb_video(connector, db); else if (cea_db_is_hdmi_forum_vsdb(db) || @@ -6433,7 +6431,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector, else if (cea_db_is_vcdb(db)) drm_parse_vcdb(connector, db); else if (cea_db_is_hdmi_hdr_metadata_block(db)) - drm_parse_hdr_metadata_block(connector, data); + drm_parse_hdr_metadata_block(connector, db); else if (cea_db_tag(db) == CTA_DB_VIDEO) parse_cta_vdb(connector, db); else if (cea_db_tag(db) == CTA_DB_AUDIO)