From patchwork Thu Aug 10 16:02:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Melissa Wen X-Patchwork-Id: 134067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp522782vqi; Thu, 10 Aug 2023 09:06:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECE3PcdeBiaQnsHGLPJt/7ycjzocbkeBnRlXuL16e8DOGFCXURRuSf7oTMf+9LQU8jqV+j X-Received: by 2002:a17:906:32d4:b0:99b:499d:4635 with SMTP id k20-20020a17090632d400b0099b499d4635mr2392391ejk.75.1691683601570; Thu, 10 Aug 2023 09:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691683601; cv=none; d=google.com; s=arc-20160816; b=Q/Ex9lqYXhtaeb4oXSkoW7bDAP2RYQw7r4XG5qDE3itQaMW4ViCniF8tQO74v9A6Xp vZWsmi4hwCSpjsDLIVSmg9UbBX0Mb4mECZ++I+TeChToVsGNoVlrs1dmUO2p7TOei78p JPBItiW18kwO3qAG8MVvS3JAi03Xm9uZOjLIW4A2L7tEiAM0SBfxgG/Vz2NEZgubodjP 1iujTchH6eqHkpKOE0dSo5KgQA5os66bcppt0xeNJmei6G1JoEv+iYi3de4SgsJr9WEJ cBpxOWCqU0xXFd9gjrQRabOIsDVrTNW4qqAIz+fNrMBv+dtys3NEFnAWtIZ2SkgtEtrF f1Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=P9MEKtJhSMgnLsIUAgMIyHv1PUh5yex761a8f47xbF0=; fh=K4g2hpcHeis9i+u86e9V+yTBU0PZFkfdrKenkMdV+qw=; b=EZ0for6RwGPecs5/cX/MR4wcsFwP63O2dxNOLi1qktRMGm94OcWvnU++Ku3X/gh2zD 0S3DLDcD/XR9onJHMrOdfdqVRdr7KJeZPobcajHe/IdHn0FVNuW8K5cYMuY2ALf8wkz4 JGJ1PSKMYZAZmHMFaTRe3bK2K+Zh4UstJrRguuTVCtPjJY6XgOCbX+WC6iiR7qjEOIsu Z8dTs6nsiwTc6ZGJd4kXzDf9hLFWDDlwNaCWiGBeuobJIaBerTa1tdcMe48vce2OYZId zpPZruGN0wWLSQ1HAb6cTu3EyL820eB4FsC8ba0fVwk8SLywWpUNVebb9d+ukSyOpca8 a1GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=swq6cD3C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id op18-20020a170906bcf200b00991ece4c966si1823039ejb.101.2023.08.10.09.06.16; Thu, 10 Aug 2023 09:06:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=swq6cD3C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236486AbjHJQEO (ORCPT + 99 others); Thu, 10 Aug 2023 12:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235124AbjHJQDx (ORCPT ); Thu, 10 Aug 2023 12:03:53 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBD52723 for ; Thu, 10 Aug 2023 09:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=P9MEKtJhSMgnLsIUAgMIyHv1PUh5yex761a8f47xbF0=; b=swq6cD3C1dUjaAvuAZM/bLVita EqMOTO6SwjYjNG9oMqWML6wVDB5DJxM3riDflq6oaDk42oPSxPpKzLJeXVyN2Zdv3dnQsGIiBqELS 0lTNLEQPv+gEKg1REF/jWQjjRs/w/PPGTHSaGaSzJni2CulOXRxuR4EAvIcsURC02sShGbGg3krVJ GdE6MagS742FMJ/rBh7uQXLkH4bb9cnHL1GSTLFpNw0rorCbTNzASvn+lIwiY4EhAImkoZuJwVRIb 4sR6vb+3ojeksfecp522nDaLYW0pD5AEzSFvq0PyTWaBRBrjIVx3kVFh18AhEl10RRx4OpqjmX1P8 Gzt1f4hw==; Received: from [38.44.68.151] (helo=killbill.home) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1qU88N-00GjYD-Fv; Thu, 10 Aug 2023 18:03:35 +0200 From: Melissa Wen To: amd-gfx@lists.freedesktop.org, Harry Wentland , Rodrigo Siqueira , sunpeng.li@amd.com, Alex Deucher , dri-devel@lists.freedesktop.org, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch Cc: Joshua Ashton , Sebastian Wick , Xaver Hugl , Shashank Sharma , Nicholas Kazlauskas , sungjoon.kim@amd.com, Alex Hung , Pekka Paalanen , Simon Ser , kernel-dev@igalia.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 08/34] drm/amd/display: document AMDGPU pre-defined transfer functions Date: Thu, 10 Aug 2023 15:02:48 -0100 Message-Id: <20230810160314.48225-9-mwen@igalia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230810160314.48225-1-mwen@igalia.com> References: <20230810160314.48225-1-mwen@igalia.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773858824054901968 X-GMAIL-MSGID: 1773858824054901968 Brief documentation about pre-defined transfer function usage on AMD display driver and standardized EOTFs and inverse EOTFs. Co-developed-by: Harry Wentland Signed-off-by: Harry Wentland Signed-off-by: Melissa Wen --- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c index cc2187c0879a..7f13bcdaf016 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c @@ -85,6 +85,45 @@ void amdgpu_dm_init_color_mod(void) } #ifdef AMD_PRIVATE_COLOR +/* Pre-defined Transfer Functions (TF) + * + * AMD driver supports pre-defined mathematical functions for transferring + * between encoded values and optical/linear space. Depending on HW color caps, + * ROMs and curves built by the AMD color module support these transforms. + * + * The driver-specific color implementation exposes properties for pre-blending + * degamma TF, shaper TF (before 3D LUT), and blend(dpp.ogam) TF and + * post-blending regamma (mpc.ogam) TF. However, only pre-blending degamma + * supports ROM curves. AMD color module uses pre-defined coefficients to build + * curves for the other blocks. What can be done by each color block is + * described by struct dpp_color_capsand struct mpc_color_caps. + * + * AMD driver-specific color API exposes the following pre-defined transfer + * functions: + * + * - Linear/Unity: linear/identity relationship between pixel value and + * luminance value; + * - Gamma 2.2, Gamma 2.4, Gamma 2.6: pure gamma functions; + * - sRGB: 2.4 gamma with small initial linear section as standardized by IEC + * 61966-2-1:1999; + * - BT.709 (BT.1886): 2.4 gamma with differences in the dark end of the scale. + * Used in HD-TV and standardized by ITU-R BT.1886; + * - PQ (Perceptual Quantizer): used for HDR display, allows luminance range + * capability of 0 to 10,000 nits; standardized by SMPTE ST 2084. + * + * In the driver-specific API, color block names attached to TF properties + * suggest the intention regarding non-linear encoding pixel's luminance + * values. As some newer encodings don't use gamma curve, we make encoding and + * decoding explicit by defining an enum list of transfer functions supported + * in terms of EOTF and inverse EOTF, where: + * + * - EOTF (electro-optical transfer function): is the transfer function to go + * from the encoded value to an optical (linear) value. De-gamma functions + * traditionally do this. + * - Inverse EOTF (simply the inverse of the EOTF): is usually intended to go + * from an optical/linear space (which might have been used for blending) + * back to the encoded values. Gamma functions traditionally do this. + */ static const char * const amdgpu_transfer_function_names[] = { [AMDGPU_TRANSFER_FUNCTION_DEFAULT] = "Default",