From patchwork Mon Jan 9 14:38:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Melissa Wen X-Patchwork-Id: 40904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2196327wrt; Mon, 9 Jan 2023 06:47:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXvD5562nLgp2AW8qxIfFFoRTYLJz5sDZS2xCbO99jm6ok1XwhpbheeDv8SazF/pyvMNiZxT X-Received: by 2002:a17:906:ce3a:b0:84d:242c:13a with SMTP id sd26-20020a170906ce3a00b0084d242c013amr8515569ejb.74.1673275667772; Mon, 09 Jan 2023 06:47:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673275667; cv=none; d=google.com; s=arc-20160816; b=MACTGtybtjFPQEHnTneb7j5A7LbDYkKsr2hbAhzeOgqXRVKiXiEWaqGtg+cK0u8s+i 7GW/CNHVvMy14K8eEHUEzgD3kSvXq0Vvqk75L2ewnIWARi+WwCRI9YW5xE19W7vvAhlr D/EmyvzoWGV05ks00ZEDBPfJDyTxcB0V1NcSkXhI/vO4YKaPbMWy8pxKCAZ8l39Xm4rp 4UVUncX+DipsjoMoTUl+iKOfJwqduAdzfnLayGwsxVcQNL1WkgfVocuWdBeTvbgAYcrH NYv2RitUf858IOnuxJBibJP5rFEntX7LHXuH3s/uWE0VTlauUySI4asfRwJvqAG0DP67 BXAg== 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=OfJZdZE/V/ZvpMRh36U0jcNUuCeLwAP2JLdu4FaqZsM=; b=gRMgxKzHSEcmeWgK0EYHlkVTUQOmEgnRqynlpFeFTINFjb7qGrkt31XiQ0BJj2aJcA OIJ6Ia98ljaE9Jt6jjQ7raGGO1+SSRwhjv7A7t2VuB67srIfrATOYgyW0qOAKx5kI0dU 1PXohK7ZhMT+5/kVNMfx4QhbefTL7BdeK4VrQsaOLKJBllt6cnnMjss0/jKSWJjmTUe1 Ons9C3l5pQGWAapcIb2sY6gcVInggz2SKm81IuxpYrYTSM+Jc2mwygb7YJNyVmuV2+0y RqXVS7zzcrKc/I+dngArbLe5kPBG9W2dtA9kUeUfqOOmJIzV5K1sp4esbLoXwYY3yQrt feeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b="JHBNX7/v"; 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 xf9-20020a17090731c900b0084d0b4b4fdbsi9743931ejb.555.2023.01.09.06.47.23; Mon, 09 Jan 2023 06:47:47 -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="JHBNX7/v"; 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 S231258AbjAIOot (ORCPT + 99 others); Mon, 9 Jan 2023 09:44:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232429AbjAIOoP (ORCPT ); Mon, 9 Jan 2023 09:44:15 -0500 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884861DF32 for ; Mon, 9 Jan 2023 06:44:14 -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=OfJZdZE/V/ZvpMRh36U0jcNUuCeLwAP2JLdu4FaqZsM=; b=JHBNX7/vGX/O5LzLAHWKxyjD85 zn/TvGUHh0lPLjc34lNvMR3GD6CdgpqSd40ppq7yjeENLS0lF3nUuPwTYBrlL8sD/hT1THDzMohWB j2QMfc+tnOwcVccvM373aYiw4mtuDQfhlo2jrn4yH6DT2j2tyOKZJSEoppBwMWF+1RMo4sDrBCgRB 3Ydz2LG7B38W+m0HPPSrubVVVIY7Dzsgxj6LFAu/FG+lVXDmzLpRpKKYgLh9k2M+Iaz1gsDqLX7IB cjPdYetmgMkmLvFVcQhkHPTD1NiP49sSWzDiKFMH6bzQZkUib3Ieo3JJYHYrnAgFE8KAdPHDU8DHB 7Ndp951A==; 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 1pEtNa-003TyM-Sh; Mon, 09 Jan 2023 15:44:03 +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 06/18] drm/drm_color_mgmt: set first lut3d mode as default Date: Mon, 9 Jan 2023 13:38:34 -0100 Message-Id: <20230109143846.1966301-7-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?1754556706330704614?= X-GMAIL-MSGID: =?utf-8?q?1754556706330704614?= Signed-off-by: Melissa Wen --- drivers/gpu/drm/drm_color_mgmt.c | 18 ++++++++++++++++-- include/drm/drm_color_mgmt.h | 3 ++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 06503f693ecd..d6283f049881 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -280,18 +280,32 @@ EXPORT_SYMBOL(drm_crtc_create_lut3d_mode_property); * therefore optional. */ void drm_crtc_enable_lut3d(struct drm_crtc *crtc, - uint shaper_lut_size) + uint shaper_lut_size, + bool first_value_as_default) { struct drm_device *dev = crtc->dev; struct drm_mode_config *config = &dev->mode_config; + struct drm_property_enum *prop; + uint init_value = 0; if (!config->lut3d_mode_property) return; drm_object_attach_property(&crtc->base, config->lut3d_property, 0); + + if (first_value_as_default) { + prop = list_first_entry_or_null(&config->lut3d_mode_property->enum_list, + typeof(*prop), head); + init_value = prop ? prop->value : 0; + } + drm_object_attach_property(&crtc->base, - config->lut3d_mode_property, 0); + config->lut3d_mode_property, + init_value); + + if (crtc->state && prop) + crtc->state->lut3d_mode = init_value; if (!shaper_lut_size) return; diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index db2026dc825e..d13e99e2e877 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h @@ -64,7 +64,8 @@ int drm_crtc_create_lut3d_mode_property(struct drm_crtc *crtc, unsigned int num_modes); void drm_crtc_enable_lut3d(struct drm_crtc *crtc, - uint shaper_lut_size); + uint shaper_lut_size, + bool first_value_as_default); int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, int gamma_size);