From patchwork Sun Apr 23 14:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Melissa Wen X-Patchwork-Id: 86733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2221672vqo; Sun, 23 Apr 2023 07:24:48 -0700 (PDT) X-Google-Smtp-Source: AKy350ZG+GZMV+wYfj2nu9owv0zaa1L6KClT1ASwvcBYYdn/6FeEROJ6NLk9mMesV+MLrX6d54WP X-Received: by 2002:a05:6a00:2487:b0:63d:368b:76b4 with SMTP id c7-20020a056a00248700b0063d368b76b4mr16739965pfv.17.1682259887743; Sun, 23 Apr 2023 07:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682259887; cv=none; d=google.com; s=arc-20160816; b=hlYcDExHnyVZU/Cif9Alcw046Pl85riuFWJn/seWq5YKT4AxW1MdGfukhi49QbIbpy Azg3WP/kAD8lSYIRq1K5E2aCowSEf4cFrVyO4cqp6MO0Y4pz6u9krfjWcf/sNdG3Rjft 7xITY60l0IiMe66azlo3TnHMnIbhjUB0RJ7dsOWm3yefbEQHaw2H2ntCoTIAizMfTzH0 NZ/QdipkNPSvKAGtNyNxlGMwZzAX2V2coqTUcuMM6KtocVV7Ikik2jirlMXODpeklN7N jxxwMhcZ9mBeGMNFTwRFsNhcjK6EBSJPHCftYgKGPScmlwkx9dImRAM0A0IRQEfl7b2L mKxg== 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=cUSOYLuQjdiS9Ja6dEexWHo4C4Y5Ft7LRX3bN1lCnPA=; b=c0lp1sPo3pUHNz0XIkbCBuyhcRriO73RE4HIQ7CcrJqcDIzAjO8R5cafHgaTw3aBhE MeWn3642AL+BtBHZTTsP9gyBk4/dsg4B9ix1PefdRJaIbtdySarFalLOF0gv99LFLrDO cwDW2Z2KWt9N7G1CETcRflEnHmR2ovdDCtB309FRSM9uurRhJ0rCzx+zds/ZPxUvNCVG 1lUY43nrG9/LS1qU6lybaVmimm6ccDx3m7ZzBG3rQkW/2Oahy9uJYoWuQvM7+bnqM/C6 odFlkGCgyaBoRRrtBzWDpxVeSPb2zG5adyteuRexF8DMg/hdzSBCihUsJDeivHnicxWy KEHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=Hb2Dt82V; 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 z22-20020aa79f96000000b0063b506e148asi6588380pfr.90.2023.04.23.07.24.33; Sun, 23 Apr 2023 07:24:47 -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=Hb2Dt82V; 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 S230370AbjDWOQA (ORCPT + 99 others); Sun, 23 Apr 2023 10:16:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbjDWOPg (ORCPT ); Sun, 23 Apr 2023 10:15:36 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BE2F3C3A for ; Sun, 23 Apr 2023 07:15:11 -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=cUSOYLuQjdiS9Ja6dEexWHo4C4Y5Ft7LRX3bN1lCnPA=; b=Hb2Dt82V6RFUBwoDi4OOl2AXD6 W25R+uc2mmPiqDDZdhT/qjdm9B2ExG7lHDc6ZSDHhEriZSu1Hsdenn/F1dLW+OC9hKfOa3L5l2pRD EzRoTJFneYRBuQu7Ltjmch4nxIhf7CK45/fBxGFI6GZTcrxJdVfAu9hiTth+25f4hinBoq+ezULAL 1LdBNRSzQtdELh+smst/0SliQMRLRYFhkmxtInCi8O0dj8vuhiI8VFXjszCZdBRxp7RolpA3g56UY 9t8/UqwevdkKIyOWXG1A4Z8kyizgGLVLeB8gvORC8dxiI3jCdDDrU02Zntxg7V2zZL9pK20gzt2gM BdVYLpOA==; Received: from nat-wifi.fi.muni.cz ([147.251.43.9] helo=killbill.fi.muni.cz) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pqaTb-00ANVs-JK; Sun, 23 Apr 2023 16:14:03 +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 , linux-kernel@vger.kernel.org Subject: [RFC PATCH 37/40] drm/amd/display: handle empty LUTs in __set_input_tf Date: Sun, 23 Apr 2023 13:10:49 -0100 Message-Id: <20230423141051.702990-38-mwen@igalia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230423141051.702990-1-mwen@igalia.com> References: <20230423141051.702990-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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763977344371778532?= X-GMAIL-MSGID: =?utf-8?q?1763977344371778532?= From: Joshua Ashton Unlike degamma, blend gamma doesn't support hardcoded curve (predefined/ROM), but we can use AMD color module to fill blend gamma parameters when we have non-linear plane gamma TF without plane gamma LUT. The regular degamma path doesn't hit this. Signed-off-by: Joshua Ashton --- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) 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 e17141fc8d12..baa7fea9ebae 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 @@ -349,21 +349,26 @@ static int __set_input_tf(struct dc_transfer_func *func, struct dc_gamma *gamma = NULL; bool res; - gamma = dc_create_gamma(); - if (!gamma) - return -ENOMEM; + if (lut_size) { + gamma = dc_create_gamma(); + if (!gamma) + return -ENOMEM; - gamma->type = GAMMA_CUSTOM; - gamma->num_entries = lut_size; + gamma->type = GAMMA_CUSTOM; + gamma->num_entries = lut_size; - __drm_lut_to_dc_gamma(lut, gamma, false); + __drm_lut_to_dc_gamma(lut, gamma, false); + } - res = mod_color_calculate_degamma_params(NULL, func, gamma, true); - dc_gamma_release(&gamma); + res = mod_color_calculate_degamma_params(NULL, func, gamma, gamma != NULL); + + if (gamma) + dc_gamma_release(&gamma); return res ? 0 : -ENOMEM; } + #ifdef CONFIG_STEAM_DECK static enum dc_transfer_func_predefined drm_tf_to_dc_tf(enum drm_transfer_function drm_tf) {