From patchwork Mon Jan 9 14:38:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Melissa Wen X-Patchwork-Id: 40892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2195520wrt; Mon, 9 Jan 2023 06:46:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXvElHv+yatwBEDC8GFsAtgrx7NV65Lhv7pZlovcAziKqjMSn2WNOEgsN9B+X/tJK4vvb2Cx X-Received: by 2002:a17:907:cbc9:b0:7ad:b6d8:c9d0 with SMTP id vk9-20020a170907cbc900b007adb6d8c9d0mr60428611ejc.53.1673275573468; Mon, 09 Jan 2023 06:46:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673275573; cv=none; d=google.com; s=arc-20160816; b=mnkZ4405wFQM0dn8UemMT4Dbfr4iwIeNkW+VzRGo6QnnkVCiRiCsSlF9sXWYRRjsLR ZgqvoqrIzYOonfzkA1F5Q/6jdgwfE1AvtxfqUyJQ/vWSuIy4ameOwy0STMoIbFblH/vz qraQ2EfP98S9HlagFHqZiLoCy+DW+GOHlILTKVYB0QsLXIvNF9CxZlOjKimWj2kAskmV Hn9LVXLj2RJz+u9w/QIPQQw1Rh3/4WZTxrTFJgqCshOMWJCs4hxGdpG3ZqUqlFq4Lp24 eFlhVhdxJdIKTPB8ES6cct0wZwroghKVCWou0XtR3jmYMUBgQMCLYTor+KnmhlINtdun 6hyA== 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=eUiu9Wjf4cO16yZY2bNhlA8qvES7ZdJnbNszqoBABJk=; b=E9/2cHjSRQzh+hs/YKZvcvrUeSidK5YhIfS5ZT8pQJBN9E8M3bZD1U5m6+8JEDQxj5 yUQYk1X1vSHQMMzjhzGve/R32KvZ48y2xjieANEuE7+XMsoT6BzownFOP70xTG3KX7FC E8fR1tXe7byOZIqCjqvhVC1rlnqlD5sHzs9wUaU+L+geNW0Lf1gMWYeDUgjQWgHR0V2b QUUOLeFL6vyHeyu4LAO/e70aR7biOa6kr7okx6F+vqEP0ZI/I76qRvCyKYDMF24KEbYl l8vREEtsjRYp3UNZ0eBGDXyYIX16GUiZEO7XX5f/FNvQhjtwvDGfTIPdrbxTB5iNxGQ/ gOKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=AcFBRRJP; 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 gn11-20020a1709070d0b00b007c13387a548si10149399ejc.26.2023.01.09.06.45.49; Mon, 09 Jan 2023 06:46:13 -0800 (PST) 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=AcFBRRJP; 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 S234529AbjAIOox (ORCPT + 99 others); Mon, 9 Jan 2023 09:44:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbjAIOoT (ORCPT ); Mon, 9 Jan 2023 09:44:19 -0500 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 054BF1DF3C for ; Mon, 9 Jan 2023 06:44:18 -0800 (PST) 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=eUiu9Wjf4cO16yZY2bNhlA8qvES7ZdJnbNszqoBABJk=; b=AcFBRRJPlEyliGEC7GMXryCRso +PtpcH1KZao7XWkZvq6yU2ttxiXjMGPocxbxuXhqDxmaxPG3sfm7u++kHlqBEUImCa9aC+YLWBV3/ teSel5vTH7vn2CxnEMOlwUnSObf9iE4N816Uh47bQ5EKZOr3ku9imykLH7QVSHw4tzjjwbUp6p8hQ A36echmG6vsG3XeED97XdS+E0Q7+jiCQUo6cDjSvKVUuZ+z5uGMZuwpgcBNZFKJLNfaUufrboCLsL y2pOJejCbEO9j4jqz8qlKZImBUWJket+kd96gNEEEAAf8DSV0rUD/U7oo4uxvfaHdlVoTDbHZoZ3G QX8/If7A==; Received: from [41.74.137.107] (helo=killbill.home) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEtNe-003TyM-7Z; Mon, 09 Jan 2023 15:44:06 +0100 From: Melissa Wen To: harry.wentland@amd.com, sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch Cc: Joshua Ashton , alex.hung@amd.com, nicholas.kazlauskas@amd.com, sungjoon.kim@amd.com, seanpaul@chromium.org, bhawanpreet.lakha@amd.com, Shashank Sharma , ville.syrjala@linux.intel.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, kernel-dev@igalia.com, laurent.pinchart+renesas@ideasonboard.com, Melissa Wen , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 07/18] drm/amd/display: remove unused regamma condition Date: Mon, 9 Jan 2023 13:38:35 -0100 Message-Id: <20230109143846.1966301-8-mwen@igalia.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230109143846.1966301-1-mwen@igalia.com> References: <20230109143846.1966301-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 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?1754556608028510620?= X-GMAIL-MSGID: =?utf-8?q?1754556608028510620?= The function __set_output_tf is only called by amdgpu_dm_update_crtc_color_mgmt() when using atomic regamma. In this situation, func->tf == TRANSFER_FUNCTION_LINEAR (the original if condition) and it never falls into tf != LINEAR (the else condition). Therefore, remove unused condition to avoid misunderstandings here. Signed-off-by: Melissa Wen --- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 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 a4cb23d059bd..10a29d131424 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 @@ -255,14 +255,13 @@ static int __set_legacy_tf(struct dc_transfer_func *func, * @func: transfer function * @lut: lookup table that defines the color space * @lut_size: size of respective lut - * @has_rom: if ROM can be used for hardcoded curve * * Returns: * 0 in case of success. -ENOMEM if fails. */ static int __set_output_tf(struct dc_transfer_func *func, - const struct drm_color_lut *lut, uint32_t lut_size, - bool has_rom) + const struct drm_color_lut *lut, + uint32_t lut_size) { struct dc_gamma *gamma = NULL; struct calculate_buffer cal_buffer = {0}; @@ -279,24 +278,13 @@ static int __set_output_tf(struct dc_transfer_func *func, gamma->num_entries = lut_size; __drm_lut_to_dc_gamma(lut, gamma, false); - if (func->tf == TRANSFER_FUNCTION_LINEAR) { - /* - * Color module doesn't like calculating regamma params - * on top of a linear input. But degamma params can be used - * instead to simulate this. - */ - gamma->type = GAMMA_CUSTOM; - res = mod_color_calculate_degamma_params(NULL, func, - gamma, true); - } else { - /* - * Assume sRGB. The actual mapping will depend on whether the - * input was legacy or not. - */ - gamma->type = GAMMA_CS_TFM_1D; - res = mod_color_calculate_regamma_params(func, gamma, false, - has_rom, NULL, &cal_buffer); - } + /* + * Color module doesn't like calculating regamma params + * on top of a linear input. But degamma params can be used + * instead to simulate this. + */ + gamma->type = GAMMA_CUSTOM; + res = mod_color_calculate_degamma_params(NULL, func, gamma, true); dc_gamma_release(&gamma); @@ -450,7 +438,7 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc) stream->out_transfer_func->tf = TRANSFER_FUNCTION_LINEAR; r = __set_output_tf(stream->out_transfer_func, regamma_lut, - regamma_size, has_rom); + regamma_size); if (r) return r; } else {