From patchwork Wed Jan 31 11:04:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10193911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7237B603EE for ; Wed, 31 Jan 2018 11:05:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C6BF28618 for ; Wed, 31 Jan 2018 11:05:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90FD12862D; Wed, 31 Jan 2018 11:05:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E58D28618 for ; Wed, 31 Jan 2018 11:05:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 522036EBA8; Wed, 31 Jan 2018 11:05:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4C9906EBA8 for ; Wed, 31 Jan 2018 11:04:59 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id b21so7148458wme.4 for ; Wed, 31 Jan 2018 03:04:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id; bh=OZlRNAC1mk4WcfszNn3xV9fCbQxHuZwJf1Xa8JVHFBs=; b=AQIAAMNsAKMZIvV4gFcXdoOhdC3pslLqVsSE+GSTHXFC6d1nzDvnwHh4BqCvj88fOQ aKy77upcDjhYfWSQGD6oornNH2rerKSMIttyvDBgC5iDFQoN1O6jmRkW3RUYIBhelQff QtK7+ubz6VOh05flySBYc/kI7xK7j/6unKyuE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OZlRNAC1mk4WcfszNn3xV9fCbQxHuZwJf1Xa8JVHFBs=; b=LuqHox16/QHOlnqBVxJaJO63PIbl9KPtLwPCotKixj5Yqg45qAgrqUf4bHWa0haE9s QbVdPYDMDSZHNuFFvLvvy1sKGm4lXu/H7q7xovW5WTMMwEXNiiGB2QUHYdwd0D8rbXo2 B4ewiIPbtsBqkD7lU87iYhoZVqgGQrQgpSMYVvH7FRUoJRvoiA7UfwSnxlA66I3a59+g 5Klv+P5lbW9/9ys3ygugEMnof55NrlnYIoEZo45hTLpCiZ6U5D42FL6Bb+p1wwd+EXIg iM5VG0VW7OaD6Q88KCCv7SE+pMz6bj69OdfDc0A2McHbiGobaeCpGEz9LoOC0Lj8p+lf 6Tcg== X-Gm-Message-State: AKwxytfg+5Hue+DLSoTo0xamWzJHYNCQalFrYqXzuFySuhPq7YsvtY2p otVidhTH4Qx5YQjCiIPNkr6/ncew X-Google-Smtp-Source: AH8x225fv/bN8AiqXq/pNQmDWJoy5TvG/bUc00iw09cb1uIue94853V/3+y8RxwHelCMuaxw2hdOJA== X-Received: by 10.80.240.86 with SMTP id u22mr56778396edl.276.1517396697618; Wed, 31 Jan 2018 03:04:57 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id e12sm1882454edi.29.2018.01.31.03.04.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 03:04:56 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm/cirrus: Load lut in crtc_commit Date: Wed, 31 Jan 2018 12:04:50 +0100 Message-Id: <20180131110450.22153-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.15.1 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Peter Rosin , stable@vger.kernel.org, Daniel Vetter MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In the past the ast driver relied upon the fbdev emulation helpers to call ->load_lut at boot-up. But since commit b8e2b0199cc377617dc238f5106352c06dcd3fa2 Author: Peter Rosin Date: Tue Jul 4 12:36:57 2017 +0200 drm/fb-helper: factor out pseudo-palette that's cleaned up and drivers are expected to boot into a consistent lut state. This patch fixes that. Fixes: b8e2b0199cc3 ("drm/fb-helper: factor out pseudo-palette") Cc: Peter Rosin Cc: Daniel Vetter Cc: # v4.14+ References: https://bugzilla.kernel.org/show_bug.cgi?id=198123 Signed-off-by: Daniel Vetter --- drivers/gpu/drm/cirrus/cirrus_mode.c | 40 +++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index cd23b1b28259..c91b9b054e3f 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c @@ -294,22 +294,7 @@ static void cirrus_crtc_prepare(struct drm_crtc *crtc) { } -/* - * This is called after a mode is programmed. It should reverse anything done - * by the prepare function - */ -static void cirrus_crtc_commit(struct drm_crtc *crtc) -{ -} - -/* - * The core can pass us a set of gamma values to program. We actually only - * use this for 8-bit mode so can't perform smooth fades on deeper modes, - * but it's a requirement that we provide the function - */ -static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, - u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) +static void cirrus_crtc_load_lut(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct cirrus_device *cdev = dev->dev_private; @@ -317,7 +302,7 @@ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, int i; if (!crtc->enabled) - return 0; + return; r = crtc->gamma_store; g = r + crtc->gamma_size; @@ -330,6 +315,27 @@ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, WREG8(PALETTE_DATA, *g++ >> 8); WREG8(PALETTE_DATA, *b++ >> 8); } +} + +/* + * This is called after a mode is programmed. It should reverse anything done + * by the prepare function + */ +static void cirrus_crtc_commit(struct drm_crtc *crtc) +{ + cirrus_crtc_load_lut(crtc); +} + +/* + * The core can pass us a set of gamma values to program. We actually only + * use this for 8-bit mode so can't perform smooth fades on deeper modes, + * but it's a requirement that we provide the function + */ +static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + u16 *blue, uint32_t size, + struct drm_modeset_acquire_ctx *ctx) +{ + cirrus_crtc_load_lut(crtc); return 0; }