From patchwork Fri Nov 30 12:02:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Manszewski X-Patchwork-Id: 10708305 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 552071057 for ; Sun, 2 Dec 2018 21:23:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474C72A624 for ; Sun, 2 Dec 2018 21:23:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BCBF2A62C; Sun, 2 Dec 2018 21:23:11 +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 BB3D92A624 for ; Sun, 2 Dec 2018 21:23:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B4D7189B9A; Sun, 2 Dec 2018 21:23:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 11DB56E5F6 for ; Fri, 30 Nov 2018 12:02:32 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181130120230euoutp029cb029c9d40d53fd700908d96f6202f0~r5T2mb5aG1188611886euoutp02V for ; Fri, 30 Nov 2018 12:02:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181130120230euoutp029cb029c9d40d53fd700908d96f6202f0~r5T2mb5aG1188611886euoutp02V Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181130120229eucas1p2218be6aff3ee2cd618709a63da427bfd~r5T1xFy1i0231202312eucas1p23; Fri, 30 Nov 2018 12:02:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A5.6B.04294.5D6210C5; Fri, 30 Nov 2018 12:02:29 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181130120228eucas1p17dd7e4da8adb8bb8c88f1e372fb0ebd9~r5T0_MW5P2507925079eucas1p1d; Fri, 30 Nov 2018 12:02:28 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181130120228eusmtrp26e297096bd7a2e63c1764b930b85e90b~r5T0u5LPx2249222492eusmtrp2g; Fri, 30 Nov 2018 12:02:28 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-96-5c0126d50732 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id C2.A1.04128.4D6210C5; Fri, 30 Nov 2018 12:02:28 +0000 (GMT) Received: from AMDC2034.DIGITAL.local (unknown [106.120.51.41]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181130120227eusmtip21b340e588508aee92205f932d1bb7546~r5T0IGLcg0121601216eusmtip2F; Fri, 30 Nov 2018 12:02:27 +0000 (GMT) From: Christoph Manszewski To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/edid: Add colorimetry helper function Date: Fri, 30 Nov 2018 13:02:11 +0100 Message-Id: <1543579332-16609-2-git-send-email-c.manszewski@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543579332-16609-1-git-send-email-c.manszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSfyyUcRzHfe957rmHOR7H+EzNrWvZZH416lk1/Vhbj//UsiVKF09YHN05 JRViCqVDi0n6MeZHtnSdH11FbtxlcaYwx8Qmm1/NdPRrIo9n5r/X9/3j+/7u2UNiEp3QnYxX pLBKhTxBRtjhzcY/Zp9BTxTp32PB6XvmbgFteluN6IHlBYIuHtfg9PTXfpy+PzmH0X19jSK6 99a8iNZODgnpL/oKgi7raxPQzxabcHpiph3RYyWdiC4rmSEOOzKVDemMtj6PYFp+TgiZyu4T zHiBScC8rspgTPoREVOoq0eMVesRanvG7mAMmxCfyir9gs/bxT0sn8KT2x2uLrb8FWQig30+ siWBCoSs5QKUj+xICVWLoL94RcgZEmoJQfYIwxtWBI9KM4WbjZyuuyLeqEFQ0Krfakx/DOWY oIJgdOwHwbELtRP+FdVvTGBUAw5Zo80bBWcqGJoGs3COcWoXFA2/F3Esphioere55gEWcx7G sS0VAp9b5jHuIqCMIqiY7UJ86BhkfagheHaGWZNOxPN2WHvzRMAXshGMLA0J+YMGQceLfJxP HQDt8Ox6ilx/nxe81Pvx8hFozJnCORkoBxj+7sTJ2DoWN5divCyGO7kSPu0JczodsTk7bV1G fISBztZA/mNVIGi0rmIaJC3f2nqKUD1yY9WqxFhWtUfBXvFVyRNVakWsb3RSohat/0ufVk1L rUi/csGAKBLJ7MXTv9YiJEJ5qiot0YCAxGQuYnOuTaREHCNPu8Yqk6KU6gRWZUDbSFzmJk63 mYiQULHyFPYSyyazyk1XQNq6Z6KjCY9DW52COqKd9vfcODVjvPkNpC5FO+ZP+xibwtNSvJgA tUJnE15XebbkYpgfE7B3ON510GC5HRriaHWzerQteLtaddH+3iJNr/GBRRqVkfP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A X-RootMTR: 20181130120228eucas1p17dd7e4da8adb8bb8c88f1e372fb0ebd9 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181130120228eucas1p17dd7e4da8adb8bb8c88f1e372fb0ebd9 References: <1543579332-16609-1-git-send-email-c.manszewski@samsung.com> X-Mailman-Approved-At: Sun, 02 Dec 2018 21:23:01 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, Christoph Manszewski , Seung-Woo Kim , David Airlie , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Maxime Ripard , Kyungmin Park , Kukjin Kim , Sean Paul , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In analogy to drm_default_rgb_quant_range, create drm_default_colorimetry helper function to determine the default colorimetry value based on drm_display_mode. Currently there isn't any standarized way to determine the default color space format. Signed-off-by: Christoph Manszewski --- drivers/gpu/drm/drm_edid.c | 12 ++++++++++++ include/drm/drm_edid.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index b506e3622b08..03ac833dcc3c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4278,6 +4278,18 @@ drm_default_rgb_quant_range(const struct drm_display_mode *mode) } EXPORT_SYMBOL(drm_default_rgb_quant_range); +enum hdmi_colorimetry +drm_default_colorimetry(const struct drm_display_mode *mode) +{ + if (mode->vdisplay < 720) + return HDMI_COLORIMETRY_ITU_601; + else if (mode->vdisplay <= 1080) + return HDMI_COLORIMETRY_ITU_709; + else + return HDMI_COLORIMETRY_EXTENDED; +} +EXPORT_SYMBOL(drm_default_colorimetry); + static void drm_parse_ycbcr420_deep_color_info(struct drm_connector *connector, const u8 *db) { diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index e3c404833115..da43a5d02f7f 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -474,6 +474,8 @@ bool drm_detect_monitor_audio(struct edid *edid); bool drm_rgb_quant_range_selectable(struct edid *edid); enum hdmi_quantization_range drm_default_rgb_quant_range(const struct drm_display_mode *mode); +enum hdmi_colorimetry +drm_default_colorimetry(const struct drm_display_mode *mode); int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay); void drm_set_preferred_mode(struct drm_connector *connector,