Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp821230ybd; Wed, 26 Jun 2019 06:34:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFIuMAKcbRRxIF2Ppg0Xg+njJs4x7PWz7UAlRXHeOkhRkjncZOncBpSXXrHz8ckbVhqDXe X-Received: by 2002:a63:35c7:: with SMTP id c190mr3007376pga.445.1561556054847; Wed, 26 Jun 2019 06:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561556054; cv=none; d=google.com; s=arc-20160816; b=si6ctGp03gSBcpr1DO5HbtDYCEDoAHGqczgnssABcnovCeopI04Ap20OYdseUQ9gZ5 eGSBgW2FZl0Ae6a1mOZ+FwrAHjxXnbk7/C195qecHUVtT7yuLe7FGhiRSDPKiOduxBEM MHjhX/t+VXemDo+aLG/fVw0BYcxRWzLSsCoAt/oslG+twgW67iDhf0WZwoPA1IktDcZh /otTrrHjotG3WYVq15r5IoeVzK7e6we8VJZ689ad5vkEYjAaSh/5lvyjPs+LzNg7qONC nVJlvK6JpMVFaZzHIDB19l50zHAaEpuIvhMOllO1xf2b+BrPebtBK+MyRBRBzQYK9HUE NEKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=HW5J1g5N6zUWEovMt3p7rPR24lYsV7X3wDRjuNU27Iw=; b=yl5/Yby5cevpKlVw0jAzKXmoGvJkiO4LFqFlxR3HXh9RZtpRk1rtI5eaLf15tfY+H7 WnX8hnQK1hEJyrmwj63riJgya1Dc/lr/U4NQElr0KOvUEQHiDbVJ5Jow4zMckIrmEXJf fOuOLdiMwfNhg4YWUlCvxyxE4eTBTv18UTZcYxpLTfPNzYaoKAEgETC9NJRWSz+EWAeD cVEWUdmpCjaE6v9eBzJImZMAp06sL8gW4Ll2jKO0mowKg7PVbPf22ExPI4hnYx7KaiW4 wNipiUnsToB7ow9QSyRnLZ82zhT49fvLuHS9R5OTwI0L7qBEuHTFuIfmKWUsJV4Fj9lZ UKRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15si1958463pjv.54.2019.06.26.06.33.58; Wed, 26 Jun 2019 06:34:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727940AbfFZNdP (ORCPT + 99 others); Wed, 26 Jun 2019 09:33:15 -0400 Received: from inva021.nxp.com ([92.121.34.21]:57430 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727709AbfFZNc0 (ORCPT ); Wed, 26 Jun 2019 09:32:26 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 21B2A200F53; Wed, 26 Jun 2019 15:32:25 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 138C82009B6; Wed, 26 Jun 2019 15:32:25 +0200 (CEST) Received: from fsr-ub1664-120.ea.freescale.net (fsr-ub1664-120.ea.freescale.net [10.171.82.81]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 5AE4D205DB; Wed, 26 Jun 2019 15:32:24 +0200 (CEST) From: Robert Chiras To: Marek Vasut , Stefan Agner , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mirela Rabulea , Robert Chiras Subject: [PATCH 04/10] drm/mxsfb: Signal mode changed when bpp changed Date: Wed, 26 Jun 2019 16:32:12 +0300 Message-Id: <1561555938-21595-5-git-send-email-robert.chiras@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561555938-21595-1-git-send-email-robert.chiras@nxp.com> References: <1561555938-21595-1-git-send-email-robert.chiras@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mirela Rabulea Add mxsfb_atomic_helper_check to signal mode changed when bpp changed. This will trigger the execution of disable/enable on a modeset with different bpp than the current one. Signed-off-by: Mirela Rabulea Signed-off-by: Robert Chiras --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 44 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 8d14921..64575df 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -105,9 +105,51 @@ void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb) clk_disable_unprepare(mxsfb->clk_axi); } +/** + * mxsfb_atomic_helper_check - validate state object + * @dev: DRM device + * @state: the driver state object + * + * On top of the drm imlementation drm_atomic_helper_check, + * check if the bpp is changed, if so, signal mode_changed, + * this will trigger disable/enable + * + * RETURNS: + * Zero for success or -errno + */ +static int mxsfb_atomic_helper_check(struct drm_device *dev, + struct drm_atomic_state *state) +{ + struct drm_crtc *crtc; + struct drm_crtc_state *new_state; + int i, ret; + + ret = drm_atomic_helper_check(dev, state); + if (ret) + return ret; + + for_each_new_crtc_in_state(state, crtc, new_state, i) { + struct drm_plane_state *primary_state; + int old_bpp = 0; + int new_bpp = 0; + + if (!crtc->primary || !crtc->primary->old_fb) + continue; + primary_state = + drm_atomic_get_plane_state(state, crtc->primary); + if (!primary_state || !primary_state->fb) + continue; + old_bpp = crtc->primary->old_fb->format->depth; + new_bpp = primary_state->fb->format->depth; + if (old_bpp != new_bpp) + new_state->mode_changed = true; + } + return ret; +} + static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .atomic_check = drm_atomic_helper_check, + .atomic_check = mxsfb_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; -- 2.7.4