mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Chiras <robert.chiras@nxp.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Marek Vasut <marex@denx.de>
Cc: Mirela Rabulea <mirela.rabulea@nxp.com>,
	Stefan Agner <stefan@agner.ch>, Shawn Guo <shawnguo@kernel.org>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	David Airlie <airlied@linux.ie>,
	Anson Huang <anson.huang@nxp.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 07/10] drm/mxsfb: Signal mode changed when bpp changed
Date: Wed, 9 Jan 2019 14:13:47 +0000	[thread overview]
Message-ID: <1547043209-8283-8-git-send-email-robert.chiras@nxp.com> (raw)
In-Reply-To: <1547043209-8283-1-git-send-email-robert.chiras@nxp.com>

From: Mirela Rabulea <mirela.rabulea@nxp.com>

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 <mirela.rabulea@nxp.com>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 48 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index d3fb3a8..f528a37 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -115,9 +115,55 @@ 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 *crtc_state;
+	int i, ret;
+
+	ret = drm_atomic_helper_check(dev, state);
+	if (ret)
+		return ret;
+
+	for_each_crtc_in_state(state, crtc, crtc_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) {
+			crtc_state->mode_changed = true;
+			DRM_DEBUG_ATOMIC(
+				"[CRTC:%d:%s] mode changed, bpp %d->%d\n",
+				crtc->base.id, crtc->name, old_bpp, new_bpp);
+		}
+	}
+	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


  parent reply	other threads:[~2019-01-09 14:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 14:13 [PATCH 00/10] Add support for DRM bridge and additional pixel formats Robert Chiras
2019-01-09 14:13 ` [PATCH 01/10] drm/mxsfb: Update mxsfb to support a bridge Robert Chiras
2019-01-09 14:13 ` [PATCH 02/10] dt-bindings: display: Add max-res property for mxsfb Robert Chiras
2019-01-09 14:13 ` [PATCH 03/10] drm/mxsfb: Add max-res property for MXSFB Robert Chiras
2019-01-09 14:13 ` [PATCH 04/10] drm/mxsfb: Update mxsfb with additional pixel formats Robert Chiras
2019-01-14 16:38   ` Guido Günther
2019-01-09 14:13 ` [PATCH 05/10] drm/mxsfb: Fix the vblank events Robert Chiras
2019-01-09 14:13 ` [PATCH 06/10] drm/mxsfb: Add support for new pixel formats in eLCDIF Robert Chiras
2019-01-09 14:13 ` Robert Chiras [this message]
2019-01-14 16:37   ` [PATCH 07/10] drm/mxsfb: Signal mode changed when bpp changed Guido Günther
2019-01-09 14:13 ` [PATCH 08/10] drm/mxsfb: Update mxsfb to support LCD reset Robert Chiras
2019-01-10 21:19   ` Fabio Estevam
2019-01-09 14:13 ` [PATCH 09/10] drm/mxsfb: Improve the axi clock usage Robert Chiras
2019-01-09 17:09   ` Stefan Agner
2019-01-15  9:53     ` Robert Chiras
2019-01-09 14:13 ` [PATCH 10/10] drm/mxsfb: Clear OUTSTANDING_REQS bits Robert Chiras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1547043209-8283-8-git-send-email-robert.chiras@nxp.com \
    --to=robert.chiras@nxp.com \
    --cc=airlied@linux.ie \
    --cc=anson.huang@nxp.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mirela.rabulea@nxp.com \
    --cc=p.zabel@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome