dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] drm/crtc_helper: Add drm_crtc_helper_disable_planes()
@ 2015-11-20 10:03 Jyri Sarha
  2015-11-20 10:37 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Jyri Sarha @ 2015-11-20 10:03 UTC (permalink / raw)
  To: dri-devel; +Cc: tomi.valkeinen, Jyri Sarha, laurent.pinchart

Add drm_crtc_helper_disable_planes() for disabling all planes
associated with the given CRTC and having disable callback. This can
be used for instance in CRTC helper disable callback.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
So it appears that this is the only missing piece for disabling and
enabling planes with their associated CRTCs for the times when the
CRTCs are blanked or otherwise unused.

 drivers/gpu/drm/drm_crtc_helper.c | 26 ++++++++++++++++++++++++++
 include/drm/drm_crtc_helper.h     |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index ef53475..33dddd5 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -410,6 +410,32 @@ done:
 }
 EXPORT_SYMBOL(drm_crtc_helper_set_mode);
 
+/**
+ * drm_crtc_helper_disable_planes - helper to disable CRTC's planes
+ * @crtc: CRTC
+ *
+ * Disables all planes associated with the given CRTC and having
+ * disable callback. This can be used for instance in CRTC helper
+ * disable callback.
+ */
+void drm_crtc_helper_disable_planes(struct drm_crtc *crtc)
+{
+	struct drm_plane *plane;
+	int i;
+
+	drm_for_each_plane(plane, crtc->dev) {
+		const struct drm_plane_helper_funcs *plane_funcs =
+			plane->helper_private;
+
+		if (plane->state->crtc != crtc || !plane_funcs)
+			continue;
+
+		if (plane_funcs->atomic_disable)
+			plane_funcs->atomic_disable(plane, NULL);
+	}
+}
+EXPORT_SYMBOL(drm_crtc_helper_disable_planes);
+
 static void
 drm_crtc_helper_disable(struct drm_crtc *crtc)
 {
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 3febb4b..d47051f 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -189,6 +189,7 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
 				     struct drm_display_mode *mode,
 				     int x, int y,
 				     struct drm_framebuffer *old_fb);
+extern void drm_crtc_helper_disable_planes(struct drm_crtc *crtc);
 extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
 extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-20 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 10:03 [PATCH RFC] drm/crtc_helper: Add drm_crtc_helper_disable_planes() Jyri Sarha
2015-11-20 10:37 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox