dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Brian Starkey <brian.starkey@arm.com>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/atomic-helper: add unlocked disable all outputs helper
Date: Tue, 4 Oct 2016 17:38:50 +0100	[thread overview]
Message-ID: <20161004163850.GA10609@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <1470992834-12868-1-git-send-email-l.stach@pengutronix.de>

Hi Lucas,

On Fri, Aug 12, 2016 at 11:07:14AM +0200, Lucas Stach wrote:
>This adds the unlocked variant of drm_atomic_helper_disable_all(),
>which takes all the required modeset locks itself. This is intended
>to be used when shutting down the driver, without retaining any
>state.
>

Is this meant to be analogous to:

	drm_for_each_plane(plane, dev)
		drm_plane_force_disable(plane);
	drm_for_each_crtc(crtc, dev)
		drm_crtc_force_disable(crtc);

?

I may have misunderstood the intention here, but it seems like this
patch only disables the outputs and doesn't disable planes or
remove their framebuffers (which I think we'd want for driver
shutdown).

Thanks,
Brian

>Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
>---
> drivers/gpu/drm/drm_atomic_helper.c | 43 +++++++++++++++++++++++++++++++++++++
> include/drm/drm_atomic_helper.h     |  1 +
> 2 files changed, 44 insertions(+)
>
>diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>index 99365087645b..6673021ab21e 100644
>--- a/drivers/gpu/drm/drm_atomic_helper.c
>+++ b/drivers/gpu/drm/drm_atomic_helper.c
>@@ -2435,6 +2435,49 @@ free:
> EXPORT_SYMBOL(drm_atomic_helper_disable_all);
>
> /**
>+ * drm_atomic_helper_disable_all_unlocked - disable all currently active
>+ * outputs taking the modeset locks itself
>+ * @dev: DRM device
>+ *
>+ * Loops through all connectors, finding those that aren't turned off and then
>+ * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
>+ * that they are connected to.
>+ *
>+ * This is used for example when shutting down the DRM device.
>+ *
>+ * Returns:
>+ * 0 on success or a negative error code on failure.
>+ */
>+int drm_atomic_helper_disable_all_unlocked(struct drm_device *dev)
>+{
>+	struct drm_modeset_acquire_ctx ctx;
>+	int err;
>+
>+	drm_modeset_acquire_init(&ctx, 0);
>+
>+retry:
>+	err = drm_modeset_lock_all_ctx(dev, &ctx);
>+	if (err < 0)
>+		goto unlock;
>+
>+	err = drm_atomic_helper_disable_all(dev, &ctx);
>+	if (err < 0)
>+		goto unlock;
>+
>+unlock:
>+	if (err == -EDEADLK) {
>+		drm_modeset_backoff(&ctx);
>+		goto retry;
>+	}
>+
>+	drm_modeset_drop_locks(&ctx);
>+	drm_modeset_acquire_fini(&ctx);
>+
>+	return err;
>+}
>+EXPORT_SYMBOL(drm_atomic_helper_disable_all_unlocked);
>+
>+/**
>  * drm_atomic_helper_suspend - subsystem-level suspend helper
>  * @dev: DRM device
>  *
>diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
>index d86ae5dcd7b4..104d310c2c70 100644
>--- a/include/drm/drm_atomic_helper.h
>+++ b/include/drm/drm_atomic_helper.h
>@@ -99,6 +99,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
>
> int drm_atomic_helper_disable_all(struct drm_device *dev,
> 				  struct drm_modeset_acquire_ctx *ctx);
>+int drm_atomic_helper_disable_all_unlocked(struct drm_device *dev);
> struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev);
> int drm_atomic_helper_resume(struct drm_device *dev,
> 			     struct drm_atomic_state *state);
>-- 
>2.8.1
>
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2016-10-04 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  9:07 [PATCH] drm/atomic-helper: add unlocked disable all outputs helper Lucas Stach
2016-08-15 21:13 ` Sean Paul
2016-10-04 16:38 ` Brian Starkey [this message]

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=20161004163850.GA10609@e106950-lin.cambridge.arm.com \
    --to=brian.starkey@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=l.stach@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).