Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6350270rwl; Mon, 9 Jan 2023 07:19:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXt7fWZyaTP3qYAnd9Jd3xQ0zd0TJ8fEI2mn/mfxYnPzmLA21Tey28QNjEYZ0rtYiIQSbMA3 X-Received: by 2002:a17:90a:bc92:b0:226:fa8c:e50b with SMTP id x18-20020a17090abc9200b00226fa8ce50bmr6888787pjr.21.1673277597523; Mon, 09 Jan 2023 07:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673277597; cv=none; d=google.com; s=arc-20160816; b=w3dJzpKYlOmng/llxBzXOvw7pJrGUG8GdPtWcWttW9zsfp5cbECXunsstkJQ9+bvdq JfJZZ3xq/F9zi7SdMaZvuANPw0BvoOi+w5oeR3HUTmqGtKVbQKYBmdDZGGlKF5Upjq6B ekrcx3jQ2Om/Rceuu5ttaec0p5Spe74hxSZyDGoce4X1WOfyYdnWmjry3/Hh0umOjjqd oPtQ8Wx1AC1HO/EskxhGfnidSWssexFOQEwOee8dbLe7baj6hyKrw1kMiR5eLCxMdltq BprwNjdi+bSwEIuoSEkyCFfw0zsv2mRW2lEfAqB0NfN1VmZwVDjglUnYIxKl1aOpUopJ Y0NQ== 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=0r/YKTFRwpqtasaSu+TXALDbDG9nOKnJqiwlyrK/4as=; b=RRfxVK+y9gPJusJkeD5YWAEPjyWHJ01G2wlLF1oj2cNefE2lw1tffSbucJDpK+eGX2 JG7OTIEexMInLhkEkMtYIBueh87DSv9fqlijwgNHEHq03UMo9r5ta8O5Pi/IVI6G6WNk GT79GByZnU2SdUulQ2nzjIxc+zSG9pQFnNZgc7ci/goAiPyYMHRmc6CB1eHxES6t5kw8 d4zQfOrpewfV+Q6qMBks3MY5Nj7TFxgw8ZTRMRKiLBllnW5/oSM8usln87wgkikgJwp6 Fw1fVuiGaUueYhVnSPJBkUagj3d/aOXxSdGMCf4QM+I+4VZ70TKPh56ZKrbYxBoquLYh 77Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b="IUDT/m33"; 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 il18-20020a17090b165200b002190eb641d3si15161031pjb.88.2023.01.09.07.19.51; Mon, 09 Jan 2023 07:19:57 -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="IUDT/m33"; 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 S230013AbjAIOom (ORCPT + 53 others); Mon, 9 Jan 2023 09:44:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233660AbjAIOoM (ORCPT ); Mon, 9 Jan 2023 09:44:12 -0500 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA35B1E3C0 for ; Mon, 9 Jan 2023 06:44:11 -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=0r/YKTFRwpqtasaSu+TXALDbDG9nOKnJqiwlyrK/4as=; b=IUDT/m33kXvkNtSdS/4qsMQINo dq0n9SoMUor3bd/Rw5LOOIuDpC9ngY9awRLDxP3azAfNHsZ6/s2xQJo8xaWiRTBqAiOUJcVzif2/F iLHuQPa74RA90u1PoRZlzhZgcHUO/EdvvjyI3tlvowW2B5gRy+Nitf8r0vIxCYWibFKz7/jk1J+8o qp9mPE/c6nozubFOIaq0dh0mJMBP01vBrn/OJ/fWempQWUBiawc58yWeV6nnHeY3bK/6wKfkdl38H j+DiNdjAapYxucLFEUWUdk1gIwsBvzQbvqpzybRB2IJyF3GuuaSdCoX7koVe8dYnwHkrvJWDVlT2R l6abuV2A==; 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 1pEtNY-003TyM-8V; Mon, 09 Jan 2023 15:44:00 +0100 From: Melissa Wen To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, 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, kernel-dev@igalia.com, laurent.pinchart+renesas@ideasonboard.com, Melissa Wen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 05/18] drm/drm_color_mgmt: add function to attach 3D LUT props Date: Mon, 9 Jan 2023 13:38:33 -0100 Message-Id: <20230109143846.1966301-6-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 If the driver supports user 3D LUT then it calls a drm function to attach 3D LUT related properties according to HW caps. Signed-off-by: Melissa Wen --- drivers/gpu/drm/drm_color_mgmt.c | 35 ++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ 2 files changed, 38 insertions(+) diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 6ce48007cdd4..06503f693ecd 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -269,6 +269,41 @@ int drm_crtc_create_lut3d_mode_property(struct drm_crtc *crtc, } EXPORT_SYMBOL(drm_crtc_create_lut3d_mode_property); +/** + * drm_crtc_enable_lut3d - enable 3D LUT properties + * @crtc: DRM CRTC + * @shaper_lut_size: the size of shaper lut + * + * This function lets the driver enable the 3D LUT color correction property + * on a CRTC. This includes 3D LUT and also a shaper LUT, if set. The shaper + * LUT property is only attached if its size is not 0 and 3D LUT is set, being + * therefore optional. + */ +void drm_crtc_enable_lut3d(struct drm_crtc *crtc, + uint shaper_lut_size) +{ + struct drm_device *dev = crtc->dev; + struct drm_mode_config *config = &dev->mode_config; + + if (!config->lut3d_mode_property) + return; + + drm_object_attach_property(&crtc->base, + config->lut3d_property, 0); + drm_object_attach_property(&crtc->base, + config->lut3d_mode_property, 0); + + if (!shaper_lut_size) + return; + + drm_object_attach_property(&crtc->base, + config->shaper_lut_property, 0); + drm_object_attach_property(&crtc->base, + config->shaper_lut_size_property, + shaper_lut_size); +} +EXPORT_SYMBOL(drm_crtc_enable_lut3d); + /** * drm_mode_crtc_set_gamma_size - set the gamma table size * @crtc: CRTC to set the gamma table size for diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index af9305925572..db2026dc825e 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h @@ -63,6 +63,9 @@ int drm_crtc_create_lut3d_mode_property(struct drm_crtc *crtc, const struct drm_mode_lut3d_mode modes[], unsigned int num_modes); +void drm_crtc_enable_lut3d(struct drm_crtc *crtc, + uint shaper_lut_size); + int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, int gamma_size); -- 2.35.1