From patchwork Wed Sep 23 11:57:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 11794931 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B213C112E for ; Wed, 23 Sep 2020 11:58:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 81910221EB for ; Wed, 23 Sep 2020 11:58:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="FYwvp9t1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81910221EB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0941D6E994; Wed, 23 Sep 2020 11:58:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by gabe.freedesktop.org (Postfix) with ESMTPS id D95BF6E994 for ; Wed, 23 Sep 2020 11:58:30 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 08NBwRug029762; Wed, 23 Sep 2020 06:58:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1600862307; bh=YochQlWGFyA3cWoEkbNumxFSI6n0LilPR4enz10eGT8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FYwvp9t17FC50cFweulATgnfoRAw4tSc8jXlAw/mMzcqveUPipXoV3M0JOa81w1B7 vVRVDu5z2HHJYak0PhcsNuNtbKpr7zA/2RlzvkGAg17Genntrv8hdkNTRtNP/hra9j VsDRy8cVioJOrC9fpsq7nzXXVbh42iG9QUxMWte0= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 08NBwQeu036822 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 23 Sep 2020 06:58:26 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 23 Sep 2020 06:58:26 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 23 Sep 2020 06:58:26 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 08NBwJhw038765; Wed, 23 Sep 2020 06:58:24 -0500 From: Tomi Valkeinen To: , Pekka Paalanen , Daniel Stone , Laurent Pinchart , Jyri Sarha , Daniel Vetter Subject: [PATCH 2/5] drm/omap: use degamma property for gamma table Date: Wed, 23 Sep 2020 14:57:24 +0300 Message-ID: <20200923115727.248705-3-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200923115727.248705-1-tomi.valkeinen@ti.com> References: <20200923115727.248705-1-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , Nikhil Devshatwar Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" omapdrm supports gamma via GAMMA_LUT property. However, the HW we have is: gamma -> ctm -> out instead of what the model DRM framework uses: ctm -> gamma -> out As the following patches add CTM support for omapdrm, lets first fix the gamma. This patch changes the property from GAMMA_LUT to DEGAMMA_LUT, and uses drm_atomic_helper_legacy_degamma_set for gamma_set helper. Thus we will have: degamma -> ctm -> out and the legacy ioctl will continue working as before. Signed-off-by: Tomi Valkeinen Reviewed-by: Pekka Paalanen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 328a4a74f534..6116af920660 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -573,8 +573,8 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc, { struct drm_plane_state *pri_state; - if (state->color_mgmt_changed && state->gamma_lut) { - unsigned int length = state->gamma_lut->length / + if (state->color_mgmt_changed && state->degamma_lut) { + unsigned int length = state->degamma_lut->length / sizeof(struct drm_color_lut); if (length < 2) @@ -614,10 +614,10 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_color_lut *lut = NULL; unsigned int length = 0; - if (crtc->state->gamma_lut) { + if (crtc->state->degamma_lut) { lut = (struct drm_color_lut *) - crtc->state->gamma_lut->data; - length = crtc->state->gamma_lut->length / + crtc->state->degamma_lut->data; + length = crtc->state->degamma_lut->length / sizeof(*lut); } priv->dispc_ops->mgr_set_gamma(priv->dispc, omap_crtc->channel, @@ -738,7 +738,7 @@ static const struct drm_crtc_funcs omap_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .destroy = omap_crtc_destroy, .page_flip = drm_atomic_helper_page_flip, - .gamma_set = drm_atomic_helper_legacy_gamma_set, + .gamma_set = drm_atomic_helper_legacy_degamma_set, .atomic_duplicate_state = omap_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_set_property = omap_crtc_atomic_set_property, @@ -839,7 +839,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, if (priv->dispc_ops->mgr_gamma_size(priv->dispc, channel)) { unsigned int gamma_lut_size = 256; - drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size); + drm_crtc_enable_color_mgmt(crtc, gamma_lut_size, false, 0); drm_mode_crtc_set_gamma_size(crtc, gamma_lut_size); }