Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp643235ybl; Wed, 14 Aug 2019 03:50:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAuDaaPeYmEsH075XPIKZxBfrSJ9zZHri8hs6VBY2m8rxR/+dm6WIw5wnBta6i7nCf0e9n X-Received: by 2002:a17:90a:17c4:: with SMTP id q62mr4759486pja.135.1565779846088; Wed, 14 Aug 2019 03:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565779846; cv=none; d=google.com; s=arc-20160816; b=q02bWzKEG6QZpdt2uFbV8SkJXKQ3ulKhSU/fbezcj4MLcKiof34V/LuE9lSf28z0fT D5JGdp5OfqhLBd9vIda5iQNxVNR6cLqAhYu7/Z77eHZg9jQu04oWXijpcJ9iy+0DG8eC nNWnOUMBNCm+TvvTwkI2WqiZIaWQlR1xU8GbcHyaR/KyUkFPWnEmGWX8LmyiCNbPUIK1 QtR+/McmMacU/RT2/G93feX02rdFnGyvO+3rcaVMg0DIWX9TU68ZbKaVmm2GE3RqcCW8 77JNOPTSgZzXKKzFHJfMKd08VS0s8fg79DrXLrATA+gZlKCygW7D2HEpDl0qnwvDUB3E M47g== 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=fWfWIGkBVWwLfS6KsQRUWt/xeP3RdyWs0O9dP1Pd7pg=; b=WZ+xs0t5IAAjqAyIcsq8C2WSXQy9JfOGzLJgTyTEJkl35PbXOPB40H4m7zWa57YC4E dezS0ARqDeNVe17JKwktMelsHCOaL8gn5T7dz2JbJM51HSKhtmA92L71X7oZRDJ4Vt9B wK5lEAwcW+3gfe0VslWj6tWVSLSZXH9rrp9iLiFP1Gdkal0kJn6Pk0rdwPVdbB0/2iop H11zewkcCWbMLPX7/VYzPthqWoLmzBozCCIKLWXrLDQU6P4NbeqTUQI0Cjq2E8aCXtFd KxYwfF+peZCujH34ALJLMpwYsp6MhncvKqS4t9zVjh+GqjBrru2RZ1xKhnu8NBRlt0NZ 17Dw== 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 w8si5126879pfn.190.2019.08.14.03.50.29; Wed, 14 Aug 2019 03:50:46 -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 S1727991AbfHNKtJ (ORCPT + 99 others); Wed, 14 Aug 2019 06:49:09 -0400 Received: from inva020.nxp.com ([92.121.34.13]:55182 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727935AbfHNKtG (ORCPT ); Wed, 14 Aug 2019 06:49:06 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C80971A0395; Wed, 14 Aug 2019 12:49:04 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id BB6A81A039B; Wed, 14 Aug 2019 12:49:04 +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 C3F0C2060E; Wed, 14 Aug 2019 12:49:03 +0200 (CEST) From: Robert Chiras To: =?UTF-8?q?Guido=20G=C3=BCnther?= , 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 Subject: [PATCH v2 08/15] drm/mxsfb: Signal mode changed when bpp changed Date: Wed, 14 Aug 2019 13:48:44 +0300 Message-Id: <1565779731-1300-9-git-send-email-robert.chiras@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565779731-1300-1-git-send-email-robert.chiras@nxp.com> References: <1565779731-1300-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 | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 829abec..59c8ba7 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -108,9 +109,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