Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1297111rwl; Thu, 10 Aug 2023 09:07:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkIbxk0jwQdDR3i3HspWcBOmZvnu8KKCN1jVGmuMgLmybf4fXB0ZTorN0+YWH6MYfdZeus X-Received: by 2002:a05:6512:522:b0:4f8:72fd:ed95 with SMTP id o2-20020a056512052200b004f872fded95mr2129041lfc.22.1691683634650; Thu, 10 Aug 2023 09:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691683634; cv=none; d=google.com; s=arc-20160816; b=P2usuBMnkqQOad0bhCBuaweru450QRXIbAEn63kxlR0keKkBuORE7+mFz3RXw+yyeE GkmlGhIVEjfDqXY90Zuq63dN5TnmVuCw5smfOVpTsTIfhjz0dm/ZY+WBW5jglwhrB+Xg SVQo5I+okpzNtIOl0xPZ74vB/e4qdzErp2SL0SL6Pkl0OjzRYrMdpu2lLfO/XDB0UGzF MBebS9n8f3Unbt2Oz1i/ejnVXsMvbk4Gpn5EQA8VY+Y17OhPRTknJS4S/QHUdYwGqwr4 8NXFw6B/WarNPhwpjyV5vucExbDuJmhVDnd6JYpekirg/S00VbDp+mxul8NrqXNF7m2f KICg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=OtEX00Zz86ZdotII/QVp6fdEQKAfqBlaMcy6m5VgsMI=; fh=9C50U64Iobpg2x0Q3GNvcAiNInEN1A+LBE3gGVv2S6A=; b=Thtrk82eLv8bVewSj558QyTnKVLK80mjuOOmv1MDoEr+jKrcN4NXWmlLrw6QZN3VG4 xz5qAI4jR1XkjwQMY/nKSDCelUZMHciyMrCYsUARcVAd6nsguGXh9mV9bbVzoyxqAccb KCenGwhmSMHmBuIjhIuj7Gtr79TKdDsziTbHwiZ//4Ng+yeSDW1K49sNyZEZ2LWY+j+S CjebnRit6Iv8R5EEvKl9MC8rZR5gmtJtI2r+rZ5gC+nSCDQKuhD1On3Owv/vM+yPl0va WHGETNVAKa30tUECmIl7s07hmJkvFVwdoeDTtN0s0Okt+Whhnsa8XoZyyZ6P0GBmj0OQ 7TRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b="fDSz/VVO"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020aa7d492000000b00523228766fasi1694840edr.166.2023.08.10.09.06.39; Thu, 10 Aug 2023 09:07:14 -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="fDSz/VVO"; 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 S233488AbjHJQEj (ORCPT + 99 others); Thu, 10 Aug 2023 12:04:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236368AbjHJQEA (ORCPT ); Thu, 10 Aug 2023 12:04:00 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF22A2D57 for ; Thu, 10 Aug 2023 09:03:59 -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: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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OtEX00Zz86ZdotII/QVp6fdEQKAfqBlaMcy6m5VgsMI=; b=fDSz/VVOxqter06/jIssmOeO+H fVJK10sgVPQYSKS/UHFrFjwTfMMutnUjGojo3TqDt6iYEPh0/nHvt4jUlHGsWwn8l1aDA30ZCHQ16 IAgdhZphuWCmjqv0AumUWHWdgTmEed1UbADxpdPhr6QwVdK4aOC6+WDYcUEScCwvcAFRP1s/bcsd4 1my7pL6/TVPNRfVPFVKV+hqwQLYTkmg4v6mByAqJDnXmY+2ejUjbr8ChHlWq+oPVC0rmyJUsFg6Gf U7kTnwZGn19p6jlFof77AG0gTuHPFSlffJ0nGduv40ssDpnBR67zjHLEL+F4OnUHB6AwJgQCEYBI5 QLEbJjRA==; 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 1qU885-00GjYD-Ll; Thu, 10 Aug 2023 18:03:17 +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, airlied@gmail.com, brian.starkey@arm.com, christian.koenig@amd.com, daniel@ffwll.ch, liviu.dudau@arm.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, Xinhui.Pan@amd.com 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 00/34] drm/amd/display: add AMD driver-specific properties for color mgmt Date: Thu, 10 Aug 2023 15:02:40 -0100 Message-Id: <20230810160314.48225-1-mwen@igalia.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi all, Here is the next version of our work to enable AMD driver-specific color management properties [1][2]. This series is a collection of contributions from Joshua, Harry, and me to enhance the AMD KMS color pipeline for Steam Deck/SteamOS by exposing additional pre-blending and post-blending color capabilities from those available in the current DRM KMS API[3]. The userspace case here is Gamescope which is the compositor for SteamOS. Gamescope is already using these features to implement its color management pipeline [4]. In this version, I try to address all concerns shared in the previous one, i.e.: - Replace DRM_ by AMDGPU_ prefix for transfer function enumeration; - Explicitly define EOTFs and inverse EOTFs and set props accordingly; - Document pre-defined transfer functions; - Remove misleading comments; - Remove post-blending/MPC shaper and 3D LUT support; - Move driver-specific property operations from amdgpu_display.c to amdgpu_dm_color.c; - Reset planes if any color props change; - Nits/small fixes; Bearing in mind the complexity of color concepts, I believe there is a high chance of some misunderstanding from my side when defining EOTFs and documenting pre-defined TFs. So, reviews are very important and welcome (thanks in advance). FWIW, I added Harry as a co-developer of this TF documentation since I based on his description of EOTF/inv_EOTF and previous documentation work [5]. Let me know if there is a better way for credits. Two DC patches were already applied and, therefore, removed from the series. I added r-b according to previous feedback. We also add plane CTM to driver-specific properties. As a result, this is the updated list of all driver-specific color properties exposed by this series: - plane degamma LUT and pre-defined TF; - plane HDR multiplier; - plane CTM 3x4; - plane shaper LUT and pre-defined TF; - plane 3D LUT; - plane blend LUT and pre-defined TF; - CRTC gamma pre-defined TF; Remember you can find the AMD HW color capabilities documented here: https://dri.freedesktop.org/docs/drm/gpu/amdgpu/display/display-manager.html#color-management-properties Worth mentioning that the pre-blending degamma block can use ROM curves for some pre-defined TFs, but the other blocks use the AMD color module to calculate this curve considering pre-defined coefficients. We need changes on DC gamut remap matrix to support the plane and CRTC CTM on drivers that support both. I've sent a previous patch to apply these changes to all DCN3+ families [6]. Here I use the same changes but limited to DCN301. Just let me know if you prefer the previous/expanded version. Finally, this is the Linux/AMD color management API before and after blending with the driver-specific properties: +----------------------+ | PLANE | | | | +----------------+ | | | AMD Degamma | | | | | | | | EOTF | 1D LUT | | | +--------+-------+ | | | | | +--------v-------+ | | | AMD HDR | | | | Multiply | | | +--------+-------+ | | | | | +--------v-------+ | | | AMD CTM (3x4) | | | +--------+-------+ | | | | | +--------v-------+ | | | AMD Shaper | | | | | | | | inv_EOTF | | | | | Custom 1D LUT | | | +--------+-------+ | | | | | +--------v-------+ | | | AMD 3D LUT | | | | 17^3/12-bit | | | +--------+-------+ | | | | | +--------v-------+ | | | AMD Blend | | | | | | | | EOTF | 1D LUT | | | +--------+-------+ | | | | ++----------v---------++ || Blending || ++----------+---------++ | CRTC | | | | | | +-------v-------+ | | | DRM Degamma | | | | | | | | Custom 1D LUT | | | +-------+-------+ | | | | | +-------v-------+ | | | DRM CTM (3x3) | | | +-------+-------+ | | | | | +-------v-------+ | | | DRM Gamma | | | | | | | | Custom 1D LUT | | | +---------------+ | | | *AMD Gamma | | | | inv_EOTF | | | +---------------+ | | | +----------------------+ Let me know your thoughts. Best Regards, Melissa Wen [1] https://lore.kernel.org/dri-devel/20230423141051.702990-1-mwen@igalia.com [2] https://lore.kernel.org/dri-devel/20230523221520.3115570-1-mwen@igalia.com [3] https://github.com/ValveSoftware/gamescope/blob/master/src/docs/Steam%20Deck%20Display%20Pipeline.png [4] https://github.com/ValveSoftware/gamescope [5] https://lore.kernel.org/dri-devel/20210730204134.21769-1-harry.wentland@amd.com [6] https://lore.kernel.org/dri-devel/20230721132431.692158-1-mwen@igalia.com Harry Wentland (1): drm/amd/display: fix segment distribution for linear LUTs Joshua Ashton (14): drm/amd/display: add plane degamma TF driver-specific property drm/amd/display: add plane HDR multiplier driver-specific property drm/amd/display: add plane blend LUT and TF driver-specific properties drm/amd/display: add CRTC gamma TF support drm/amd/display: set sdr_ref_white_level to 80 for out_transfer_func drm/amd/display: mark plane as needing reset if color props change drm/amd/display: add plane degamma TF and LUT support drm/amd/display: add dc_fixpt_from_s3132 helper drm/amd/display: add HDR multiplier support drm/amd/display: handle empty LUTs in __set_input_tf drm/amd/display: add plane blend LUT and TF support drm/amd/display: allow newer DC hardware to use degamma ROM for PQ/HLG drm/amd/display: copy 3D LUT settings from crtc state to stream_update drm/amd/display: Use 3x4 CTM for plane CTM Melissa Wen (19): drm/drm_mode_object: increase max objects to accommodate new color props drm/drm_property: make replace_property_blob_from_id a DRM helper drm/drm_plane: track color mgmt changes per plane drm/amd/display: add driver-specific property for plane degamma LUT drm/amd/display: explicitly define EOTF and inverse EOTF drm/amd/display: document AMDGPU pre-defined transfer functions drm/amd/display: add plane 3D LUT driver-specific properties drm/amd/display: add plane shaper LUT and TF driver-specific properties drm/amd/display: add CRTC gamma TF driver-specific property drm/amd/display: add comments to describe DM crtc color mgmt behavior drm/amd/display: encapsulate atomic regamma operation drm/amd/display: decouple steps for mapping CRTC degamma to DC plane drm/amd/display: reject atomic commit if setting both plane and CRTC degamma drm/amd/display: add plane shaper LUT support drm/amd/display: add plane shaper TF support drm/amd/display: add plane 3D LUT support drm/amd/display: set stream gamut remap matrix to MPC for DCN301 drm/amd/display: add plane CTM driver-specific property drm/amd/display: add plane CTM support drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 71 ++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 34 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 101 +++ .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 805 ++++++++++++++++-- .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 72 ++ .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 224 ++++- .../amd/display/dc/dcn10/dcn10_cm_common.c | 93 +- .../drm/amd/display/dc/dcn30/dcn30_hwseq.c | 37 + .../drm/amd/display/dc/dcn30/dcn30_hwseq.h | 3 + .../drm/amd/display/dc/dcn301/dcn301_init.c | 2 +- .../gpu/drm/amd/display/include/fixed31_32.h | 12 + drivers/gpu/drm/arm/malidp_crtc.c | 2 +- drivers/gpu/drm/drm_atomic.c | 1 + drivers/gpu/drm/drm_atomic_state_helper.c | 1 + drivers/gpu/drm/drm_atomic_uapi.c | 43 +- drivers/gpu/drm/drm_property.c | 49 ++ include/drm/drm_mode_object.h | 2 +- include/drm/drm_plane.h | 7 + include/drm/drm_property.h | 6 + include/uapi/drm/drm_mode.h | 8 + 20 files changed, 1446 insertions(+), 127 deletions(-) -- 2.40.1