Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6351292rwl; Mon, 9 Jan 2023 07:20:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXv8rymRpiiRD4h3XvlGehDiWO56AXBELY7wZ7XDleQFfr6fzx7Ug3fcYN5N/dVkdy/sfrrq X-Received: by 2002:a05:6a20:dc86:b0:b5:b84b:6791 with SMTP id ky6-20020a056a20dc8600b000b5b84b6791mr4900393pzb.20.1673277635891; Mon, 09 Jan 2023 07:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673277635; cv=none; d=google.com; s=arc-20160816; b=vw8KB/X/g48AgFUbfgwMMNL0m7PEi2okraEuh8aO4A0xaKw21SH3uqWA02YGhHl77t Wt2yGsVs1ZR9IQ6pReVBxK3S5v0kRQPwYZumMV9n4f+iirXChvn0xxdS3ECbPK0J/o9G O9e27HgVeHhq0bDy48jLXiQ7eTBQKd+bkdefJJC5039/7G5MEyzhzgGXYl5lhhslVWJP WSlPse11zZClCW4wjHRvqfKyu6pEEl5YK9z3zoNfopBPpUmTiWUPx9l8TMdbc1aCcYZj K/v6VR4EZ4CzPadgve4EaGZMhtkTbZlQEc1qYyQt0W7WoqSvX1NXJUVliVapp6V0bAwU pHfA== 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=2zK6khS89ThpmVaHiRDcsbcddbtTFdwhm1vSRQdPNqQ=; b=kCnA6oP1HPAeQOf1LIBxZ7QOo5M5JxXKSo3aVbf2LlJFIIF/RvwXZWvataemLnDT3/ OMLJKO0cBY0gbSPHuaOudAmXzmUtaa0WLv8XrOLHK4Ir9rpYngETWlbZEtEEL24QQ1MJ EMmktKXNJHaXtyBZc7fpukp83Hr5WPAcjQ7VxfZKOqANtfVBK7F+VnqufcUq4yBgWTOB QA6wKSnbDZNkb7AHbVLwx3yYi0az5gEYnBqcI5SV8sovr1euh6tjbNQSvA3vLFQw4gjp bgNYiHxXF/NEOeUugSo3sdwxrRFqci5LpgHykI7mXp4captNIM7f+ps4DdJMSDTGEBna WPmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=f1FH40gS; 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 y190-20020a638ac7000000b004b40f8fb6d7si2020452pgd.380.2023.01.09.07.20.29; Mon, 09 Jan 2023 07:20:35 -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=f1FH40gS; 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 S233753AbjAIOqm (ORCPT + 53 others); Mon, 9 Jan 2023 09:46:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231811AbjAIOqF (ORCPT ); Mon, 9 Jan 2023 09:46:05 -0500 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1C983C38E for ; Mon, 9 Jan 2023 06:44:46 -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=2zK6khS89ThpmVaHiRDcsbcddbtTFdwhm1vSRQdPNqQ=; b=f1FH40gSKxdQJGhbFNvdkdwPo2 2X2NSIOskXk+ypl8si36Usf3NWqtJqUwuak0ujIcj1akVquJuy5uooBVl5gdOtYW15GVUP5eQl4Rv 41f/Ukbr7PJ6dGpgqi4hcQd4siyK38kSRKkaIenpC0PszhAy5cXygnEYs1RdODCMHI/rC+qeqVFNF 9rcB8IeJ7za8s1OKx6lQTdK/b5dI9hw/gqb7TIEkJkWkkO0K0TAnH2RhdO6wgC4lqa8ss2yH0avGO gNuDzcLqnZbA/WVl+FD5QCfdavInGcUBEFB4eLZBPFJxQO/b4qB0WYroX+S9NM07+VHO3qZah/O2g JI1IZbZA==; 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 1pEtO7-003TyM-73; Mon, 09 Jan 2023 15:44:35 +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 17/18] drm/amd/display: decouple steps to reuse in shaper LUT support Date: Mon, 9 Jan 2023 13:38:45 -0100 Message-Id: <20230109143846.1966301-18-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 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,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 Decouple steps of shaper LUT setup and LUT size validation according to HW caps as a preparation for shaper LUT support. Signed-off-by: Melissa Wen --- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 22 ++++++++++++------- 1 file changed, 14 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 0fb1244c8aef..8a930f9bce60 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 @@ -497,6 +497,19 @@ static void amdgpu_dm_atomic_lut3d(struct dc_stream_state *stream, stream->lut3d_func = lut; } +static int amdgpu_dm_atomic_shaper_lut(struct dc_stream_state *stream, + struct dc_transfer_func *func_shaper_new) +{ + /* We don't get DRM shaper LUT yet. We assume the input color space is already + * delinearized, so we don't need a shaper LUT and we can just BYPASS + */ + func_shaper_new->type = TF_TYPE_BYPASS; + func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR; + stream->func_shaper = func_shaper_new; + + return 0; +} + /* amdgpu_dm_atomic_shaper_lut3d - set DRM CRTC shaper LUT and 3D LUT to DC * interface * @dc: Display Core control structure @@ -519,18 +532,11 @@ static int amdgpu_dm_atomic_shaper_lut3d(struct dc *dc, lut3d_func_new = (struct dc_3dlut *) stream->lut3d_func; func_shaper_new = (struct dc_transfer_func *) stream->func_shaper; - /* We don't get DRM shaper LUT yet. We assume the input color space is - * already delinearized, so we don't need a shaper LUT and we can just - * BYPASS. - */ - func_shaper_new->type = TF_TYPE_BYPASS; - func_shaper_new->tf = TRANSFER_FUNCTION_LINEAR; - stream->func_shaper = func_shaper_new; amdgpu_dm_atomic_lut3d(stream, drm_lut3d, drm_lut3d_size, mode, lut3d_func_new); - return 0; + return amdgpu_dm_atomic_shaper_lut(stream, func_shaper_new); } static const struct drm_mode_lut3d_mode * -- 2.35.1