intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, Ben Skeggs <bskeggs@redhat.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm: Wrap the check for atomic_commit implementation
Date: Wed, 21 Dec 2016 11:23:30 +0200	[thread overview]
Message-ID: <20161221092330.GD31595@intel.com> (raw)
In-Reply-To: <1482282183-4452-1-git-send-email-dhinakaran.pandiyan@intel.com>

On Tue, Dec 20, 2016 at 05:03:02PM -0800, Dhinakaran Pandiyan wrote:
> This check is useful for drivers that do not have DRIVER_ATOMIC set but
> have atomic modesetting internally implemented. Wrap the check into a
> function since this is used in many places and as a bonus, the function
> name helps to document what the check is for.
> 
> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/drm_fb_helper.c             | 6 +++---
>  drivers/gpu/drm/nouveau/nouveau_connector.c | 4 ++--
>  drivers/gpu/drm/nouveau/nouveau_display.c   | 6 +++---
>  drivers/gpu/drm/nouveau/nouveau_fbcon.c     | 2 +-
>  include/drm/drmP.h                          | 5 +++++
>  5 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 145d55f..730342c 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -405,7 +405,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
>  
>  	drm_warn_on_modeset_not_all_locked(dev);
>  
> -	if (dev->mode_config.funcs->atomic_commit)
> +	if (drm_drv_uses_atomic_modeset(dev))
>  		return restore_fbdev_mode_atomic(fb_helper);
>  
>  	drm_for_each_plane(plane, dev) {
> @@ -1444,7 +1444,7 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
>  		return -EBUSY;
>  	}
>  
> -	if (dev->mode_config.funcs->atomic_commit) {
> +	if (drm_drv_uses_atomic_modeset(dev)) {
>  		ret = pan_display_atomic(var, info);
>  		goto unlock;
>  	}
> @@ -2060,7 +2060,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
>  	 * NULL we fallback to the default drm_atomic_helper_best_encoder()
>  	 * helper.
>  	 */
> -	if (fb_helper->dev->mode_config.funcs->atomic_commit &&
> +	if (drm_drv_uses_atomic_modeset(fb_helper->dev) &&
>  	    !connector_funcs->best_encoder)
>  		encoder = drm_atomic_helper_best_encoder(connector);
>  	else
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index 947c200..c4cc21a 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -769,7 +769,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
>  	struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
>  	int ret;
>  
> -	if (connector->dev->mode_config.funcs->atomic_commit)
> +	if (drm_drv_uses_atomic_modeset(connector->dev))
>  		return drm_atomic_helper_connector_set_property(connector, property, value);
>  
>  	ret = connector->funcs->atomic_set_property(&nv_connector->base,
> @@ -1074,7 +1074,7 @@ nouveau_connector_helper_funcs = {
>  static int
>  nouveau_connector_dpms(struct drm_connector *connector, int mode)
>  {
> -	if (connector->dev->mode_config.funcs->atomic_commit)
> +	if (drm_drv_uses_atomic_modeset(connector->dev))
>  		return drm_atomic_helper_connector_dpms(connector, mode);
>  	return drm_helper_connector_dpms(connector, mode);
>  }
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index c5cf888..add353e 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -162,7 +162,7 @@ nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe,
>  	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
>  		if (nouveau_crtc(crtc)->index == pipe) {
>  			struct drm_display_mode *mode;
> -			if (dev->mode_config.funcs->atomic_commit)
> +			if (drm_drv_uses_atomic_modeset(dev))
>  				mode = &crtc->state->adjusted_mode;
>  			else
>  				mode = &crtc->hwmode;
> @@ -738,7 +738,7 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime)
>  	struct nouveau_display *disp = nouveau_display(dev);
>  	struct drm_crtc *crtc;
>  
> -	if (dev->mode_config.funcs->atomic_commit) {
> +	if (drm_drv_uses_atomic_modeset(dev)) {
>  		if (!runtime) {
>  			disp->suspend = nouveau_atomic_suspend(dev);
>  			if (IS_ERR(disp->suspend)) {
> @@ -784,7 +784,7 @@ nouveau_display_resume(struct drm_device *dev, bool runtime)
>  	struct drm_crtc *crtc;
>  	int ret;
>  
> -	if (dev->mode_config.funcs->atomic_commit) {
> +	if (drm_drv_uses_atomic_modeset(dev)) {
>  		nouveau_display_init(dev);
>  		if (disp->suspend) {
>  			drm_atomic_helper_resume(dev, disp->suspend);
> diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
> index 5600f6c..ad722f14 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
> @@ -524,7 +524,7 @@ nouveau_fbcon_init(struct drm_device *dev)
>  		preferred_bpp = 32;
>  
>  	/* disable all the possible outputs/crtcs before entering KMS mode */
> -	if (!dev->mode_config.funcs->atomic_commit)
> +	if (!drm_drv_uses_atomic_modeset(dev))
>  		drm_helper_disable_unused_functions(dev);
>  
>  	ret = drm_fb_helper_initial_config(&fbcon->helper, preferred_bpp);
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index a9cfd33..247acba 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -647,6 +647,11 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
>  	return ((dev->driver->driver_features & feature) ? 1 : 0);
>  }
>  
> +static inline int drm_drv_uses_atomic_modeset(struct drm_device *dev)
> +{
> +	return dev->mode_config.funcs->atomic_commit ? 1 : 0;
> +}

bool ...
{
	return atomic_commit != NULL;
}

> +
>  static inline void drm_device_set_unplugged(struct drm_device *dev)
>  {
>  	smp_wmb();
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-12-21  9:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21  1:03 [PATCH 1/2] drm: Wrap the check for atomic_commit implementation Dhinakaran Pandiyan
2016-12-21  1:03 ` [PATCH 2/2] drm: Get atomic property value even if DRIVER_ATOMIC is not set Dhinakaran Pandiyan
2016-12-21  8:53   ` Daniel Vetter
2016-12-21  1:45 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm: Wrap the check for atomic_commit implementation Patchwork
2016-12-21  8:51 ` [PATCH 1/2] " Daniel Vetter
2016-12-21 20:12   ` [PATCH v2 " Dhinakaran Pandiyan
2016-12-21 20:12     ` [PATCH v2 2/2] drm: Get atomic property value even if DRIVER_ATOMIC is not set Dhinakaran Pandiyan
2017-01-03 16:06       ` Alex Deucher
2016-12-22  7:11     ` [PATCH v2 1/2] drm: Wrap the check for atomic_commit implementation Daniel Vetter
2016-12-22  8:07     ` kbuild test robot
2016-12-22  8:36     ` [Intel-gfx] " Ander Conselvan De Oliveira
     [not found]       ` <1482395761.4759.32.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-22  8:52         ` Daniel Vetter
2016-12-22  9:14           ` Pandiyan, Dhinakaran
2016-12-21  9:23 ` Ville Syrjälä [this message]
2016-12-21 20:31 ` ✗ Fi.CI.BAT: failure for series starting with [v2,2/2] drm: Get atomic property value even if DRIVER_ATOMIC is not set (rev3) Patchwork
2016-12-21 22:14   ` Pandiyan, Dhinakaran

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=20161221092330.GD31595@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=bskeggs@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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).