dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 04/29] drm/omap: Use atomic suspend/resume helpers
Date: Mon, 10 Dec 2018 08:49:57 +0200	[thread overview]
Message-ID: <3149436.95CKvIV4Vr@avalon> (raw)
In-Reply-To: <20181209215309.uktuwmbvci6r55db@earth.universe>

Hi Sebastian,

On Sunday, 9 December 2018 23:53:09 EET Sebastian Reichel wrote:
> Hi,
> 
> On Wed, Dec 05, 2018 at 04:59:57PM +0200, Laurent Pinchart wrote:
> > Instead of rolling out custom suspend/resume implementations based on
> > state information stored in the driver's data structures, use the atomic
> > suspend/resume helpers that rely on a DRM atomic state object.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> 
> Documentation/gpu/todo.rst says, that this should be converted to
> drm_mode_config_helper_suspend, but at least it's no longer open
> coded after your change.

Good point. I'll fix this in the next version. Thank you for pointing it out.

> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> >  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 --
> >  drivers/gpu/drm/omapdrm/omap_drv.c    | 52 +++++----------------------
> >  drivers/gpu/drm/omapdrm/omap_drv.h    |  2 ++
> >  3 files changed, 11 insertions(+), 46 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> > b/drivers/gpu/drm/omapdrm/dss/omapdss.h index d3b576e6edf5..149a0f09adbc
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> > +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> > @@ -432,9 +432,6 @@ struct omap_dss_device {
> > 
> >  	unsigned long ops_flags;
> >  	unsigned long bus_flags;
> > 
> > -	/* helper variable for driver suspend/resume */
> > -	bool activate_after_resume;
> > -
> > 
> >  	enum omap_display_caps caps;
> >  	
> >  	enum omap_dss_display_state state;
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c
> > b/drivers/gpu/drm/omapdrm/omap_drv.c index 5e67d58cbc28..66c4cedb5539
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> > @@ -685,52 +685,21 @@ static int pdev_remove(struct platform_device *pdev)
> > 
> >  }
> >  
> >  #ifdef CONFIG_PM_SLEEP
> > 
> > -static int omap_drm_suspend_all_displays(struct drm_device *ddev)
> > -{
> > -	struct omap_drm_private *priv = ddev->dev_private;
> > -	int i;
> > -
> > -	for (i = 0; i < priv->num_pipes; i++) {
> > -		struct omap_dss_device *display = priv->pipes[i].display;
> > -
> > -		if (display->state == OMAP_DSS_DISPLAY_ACTIVE) {
> > -			display->ops->disable(display);
> > -			display->activate_after_resume = true;
> > -		} else {
> > -			display->activate_after_resume = false;
> > -		}
> > -	}
> > -
> > -	return 0;
> > -}
> > -
> > -static int omap_drm_resume_all_displays(struct drm_device *ddev)
> > -{
> > -	struct omap_drm_private *priv = ddev->dev_private;
> > -	int i;
> > -
> > -	for (i = 0; i < priv->num_pipes; i++) {
> > -		struct omap_dss_device *display = priv->pipes[i].display;
> > -
> > -		if (display->activate_after_resume) {
> > -			display->ops->enable(display);
> > -			display->activate_after_resume = false;
> > -		}
> > -	}
> > -
> > -	return 0;
> > -}
> > -
> > 
> >  static int omap_drm_suspend(struct device *dev)
> >  {
> >  
> >  	struct omap_drm_private *priv = dev_get_drvdata(dev);
> >  	struct drm_device *drm_dev = priv->ddev;
> > 
> > +	struct drm_atomic_state *state;
> > 
> >  	drm_kms_helper_poll_disable(drm_dev);
> > 
> > -	drm_modeset_lock_all(drm_dev);
> > -	omap_drm_suspend_all_displays(drm_dev);
> > -	drm_modeset_unlock_all(drm_dev);
> > +	state = drm_atomic_helper_suspend(drm_dev);
> > +	if (IS_ERR(state)) {
> > +		drm_kms_helper_poll_enable(drm_dev);
> > +		return PTR_ERR(state);
> > +	}
> > +
> > +	priv->suspend_state = state;
> > 
> >  	return 0;
> >  
> >  }
> > 
> > @@ -740,10 +709,7 @@ static int omap_drm_resume(struct device *dev)
> > 
> >  	struct omap_drm_private *priv = dev_get_drvdata(dev);
> >  	struct drm_device *drm_dev = priv->ddev;
> > 
> > -	drm_modeset_lock_all(drm_dev);
> > -	omap_drm_resume_all_displays(drm_dev);
> > -	drm_modeset_unlock_all(drm_dev);
> > -
> > +	drm_atomic_helper_resume(drm_dev, priv->suspend_state);
> > 
> >  	drm_kms_helper_poll_enable(drm_dev);
> >  	
> >  	return omap_gem_resume(drm_dev);
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h
> > b/drivers/gpu/drm/omapdrm/omap_drv.h index bd7f2c227a25..788aa9f7e6df
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> > +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> > @@ -73,6 +73,8 @@ struct omap_drm_private {
> > 
> >  	struct workqueue_struct *wq;
> > 
> > +	struct drm_atomic_state *suspend_state;
> > +
> > 
> >  	/* lock for obj_list below */
> >  	struct mutex list_lock;

-- 
Regards,

Laurent Pinchart



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

  reply	other threads:[~2018-12-10  6:49 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 14:59 [PATCH 00/29] omapdrm: Last large refactoring for drm_bridge transition Laurent Pinchart
2018-12-05 14:59 ` [PATCH 01/29] drm/omap: Remove declaration of nonexisting function Laurent Pinchart
2018-12-09 21:44   ` Sebastian Reichel
2018-12-05 14:59 ` [PATCH 02/29] drm/omap: Remove unused kobj field from struct omap_dss_device Laurent Pinchart
2018-12-09 21:44   ` Sebastian Reichel
2018-12-05 14:59 ` [PATCH 03/29] drm/omap: venc: Remove wss_data field from venc_device structure Laurent Pinchart
2018-12-09 21:45   ` Sebastian Reichel
2018-12-05 14:59 ` [PATCH 04/29] drm/omap: Use atomic suspend/resume helpers Laurent Pinchart
2018-12-09 21:53   ` Sebastian Reichel
2018-12-10  6:49     ` Laurent Pinchart [this message]
2018-12-10  8:01       ` [PATCH v1.1 " Laurent Pinchart
2018-12-10 13:08         ` Sebastian Reichel
2018-12-05 14:59 ` [PATCH 05/29] drm/omap: Move common display enable/disable code to encoder Laurent Pinchart
2018-12-09 21:53   ` Sebastian Reichel
2018-12-05 14:59 ` [PATCH 06/29] drm/omap: Remove connection checks from internal encoders .enable() Laurent Pinchart
2018-12-09 21:54   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 07/29] drm/omap: Remove connection checks from display .enable() and .remove() Laurent Pinchart
2018-12-09 21:54   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 08/29] drm/omap: Remove enable " Laurent Pinchart
2018-12-09 21:55   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 09/29] drm/omap: Reverse direction of the DSS device enable/disable operations Laurent Pinchart
2018-12-09 21:59   ` Sebastian Reichel
2018-12-10  1:01   ` [PATCH v1.1 " Laurent Pinchart
2018-12-05 15:00 ` [PATCH 10/29] drm/omap: Remove omap_dss_device dst field Laurent Pinchart
2018-12-09 22:00   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 11/29] drm/omap: Factor out common init/cleanup code for output devices Laurent Pinchart
2018-12-09 22:01   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 12/29] drm/omap: Expose DRM modes instead of timings in display devices Laurent Pinchart
2018-12-09 22:02   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 13/29] drm/omap: Merge display .get_modes() and .get_size() operations Laurent Pinchart
2018-12-09 22:02   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 14/29] drm/omap: Add a dss device operation flag for .get_modes() Laurent Pinchart
2018-12-09 22:02   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 15/29] drm/omap: venc: List both PAL and NTSC modes Laurent Pinchart
2018-12-09 22:03   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 16/29] drm/omap: Don't pass display pointer to encoder init function Laurent Pinchart
2018-12-09 22:03   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 17/29] drm/omap: Move display alias ID to omap_drm_pipeline Laurent Pinchart
2018-12-09 22:03   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 18/29] drm/omap: Don't store display pointer in omap_connector structure Laurent Pinchart
2018-12-09 22:04   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 19/29] drm/omap: panel-dsi-cm: Store source pointer internally Laurent Pinchart
2018-12-09 22:04   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 20/29] drm/omap: Notify all devices in the pipeline of output disconnection Laurent Pinchart
2018-12-09 22:04   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 21/29] drm/omap: Remove src field from omap_dss_device structure Laurent Pinchart
2018-12-09 22:04   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 22/29] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation Laurent Pinchart
2018-12-09 22:07   ` Sebastian Reichel
2018-12-10  7:50     ` Laurent Pinchart
2018-12-10 13:14       ` Sebastian Reichel
2018-12-11  1:07         ` Sebastian Reichel
2018-12-11  8:06           ` Laurent Pinchart
2019-02-11 20:30             ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 23/29] drm/omap: venc: Simplify mode setting by caching configuration Laurent Pinchart
2018-12-09 22:08   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 24/29] drm/omap: Factor out common mode validation code Laurent Pinchart
2018-12-09 22:19   ` Sebastian Reichel
2018-12-10  8:27     ` Laurent Pinchart
2018-12-10 13:16       ` Sebastian Reichel
2018-12-10  8:27     ` [PATCH] " Laurent Pinchart
2018-12-05 15:00 ` [PATCH 25/29] drm/omap: Pass drm_display_mode to .check_timings() and .set_timings() Laurent Pinchart
2018-12-09 22:26   ` Sebastian Reichel
2018-12-10  8:07     ` Laurent Pinchart
2018-12-05 15:00 ` [PATCH 26/29] drm/omap: venc: Use drm_display_mode natively Laurent Pinchart
2018-12-06 16:23   ` [PATCH v1.1 " Laurent Pinchart
2018-12-09 22:27     ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 27/29] drm/omap: Store pixel clock instead of full mode in DPI and SDI encoders Laurent Pinchart
2018-12-09 22:27   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 28/29] drm/omap: Simplify OF lookup of DSS devices Laurent Pinchart
2018-12-09 22:27   ` Sebastian Reichel
2018-12-05 15:00 ` [PATCH 29/29] drm/omap: Refactor initialization sequence Laurent Pinchart
2018-12-09 22:27   ` Sebastian Reichel
2018-12-10 12:28 ` [PATCH 30/29] drm/omap: Merge omap_dss_device type and output_type fields Laurent Pinchart
2018-12-10 13:20   ` Sebastian Reichel

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=3149436.95CKvIV4Vr@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=tomi.valkeinen@ti.com \
    /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