diff mbox

drm/fb-helper: Remove drm_mode_config_fb.

Message ID 20170703115106.18783-1-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst July 3, 2017, 11:51 a.m. UTC
Remove drm_mode_config_fb, I don't see the point of it.
To make it clear that it's ok to use plane->fb directly,
move up drm_drv_uses_atomic_modeset so the code is skipped for atomic
drivers that require plane_state->fb.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

Comments

Daniel Vetter July 3, 2017, 4:52 p.m. UTC | #1
On Mon, Jul 03, 2017 at 01:51:06PM +0200, Maarten Lankhorst wrote:
> Remove drm_mode_config_fb, I don't see the point of it.
> To make it clear that it's ok to use plane->fb directly,
> move up drm_drv_uses_atomic_modeset so the code is skipped for atomic
> drivers that require plane_state->fb.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Makes sense. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_fb_helper.c | 22 ++++------------------
>  1 file changed, 4 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index e49bae10f0ee..0cd2035ac1d1 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -322,20 +322,6 @@ int drm_fb_helper_debug_enter(struct fb_info *info)
>  }
>  EXPORT_SYMBOL(drm_fb_helper_debug_enter);
>  
> -/* Find the real fb for a given fb helper CRTC */
> -static struct drm_framebuffer *drm_mode_config_fb(struct drm_crtc *crtc)
> -{
> -	struct drm_device *dev = crtc->dev;
> -	struct drm_crtc *c;
> -
> -	drm_for_each_crtc(c, dev) {
> -		if (crtc->base.id == c->base.id)
> -			return c->primary->fb;
> -	}
> -
> -	return NULL;
> -}
> -
>  /**
>   * drm_fb_helper_debug_leave - implementation for &fb_ops.fb_debug_leave
>   * @info: fbdev registered by the helper
> @@ -352,8 +338,11 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
>  		struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set;
>  
>  		crtc = mode_set->crtc;
> +		if (drm_drv_uses_atomic_modeset(crtc->dev))
> +			continue;
> +
>  		funcs = crtc->helper_private;
> -		fb = drm_mode_config_fb(crtc);
> +		fb = crtc->primary->fb;
>  
>  		if (!crtc->enabled)
>  			continue;
> @@ -366,9 +355,6 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
>  		if (funcs->mode_set_base_atomic == NULL)
>  			continue;
>  
> -		if (drm_drv_uses_atomic_modeset(crtc->dev))
> -			continue;
> -
>  		drm_fb_helper_restore_lut_atomic(mode_set->crtc);
>  		funcs->mode_set_base_atomic(mode_set->crtc, fb, crtc->x,
>  					    crtc->y, LEAVE_ATOMIC_MODE_SET);
> -- 
> 2.11.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index e49bae10f0ee..0cd2035ac1d1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -322,20 +322,6 @@  int drm_fb_helper_debug_enter(struct fb_info *info)
 }
 EXPORT_SYMBOL(drm_fb_helper_debug_enter);
 
-/* Find the real fb for a given fb helper CRTC */
-static struct drm_framebuffer *drm_mode_config_fb(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct drm_crtc *c;
-
-	drm_for_each_crtc(c, dev) {
-		if (crtc->base.id == c->base.id)
-			return c->primary->fb;
-	}
-
-	return NULL;
-}
-
 /**
  * drm_fb_helper_debug_leave - implementation for &fb_ops.fb_debug_leave
  * @info: fbdev registered by the helper
@@ -352,8 +338,11 @@  int drm_fb_helper_debug_leave(struct fb_info *info)
 		struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set;
 
 		crtc = mode_set->crtc;
+		if (drm_drv_uses_atomic_modeset(crtc->dev))
+			continue;
+
 		funcs = crtc->helper_private;
-		fb = drm_mode_config_fb(crtc);
+		fb = crtc->primary->fb;
 
 		if (!crtc->enabled)
 			continue;
@@ -366,9 +355,6 @@  int drm_fb_helper_debug_leave(struct fb_info *info)
 		if (funcs->mode_set_base_atomic == NULL)
 			continue;
 
-		if (drm_drv_uses_atomic_modeset(crtc->dev))
-			continue;
-
 		drm_fb_helper_restore_lut_atomic(mode_set->crtc);
 		funcs->mode_set_base_atomic(mode_set->crtc, fb, crtc->x,
 					    crtc->y, LEAVE_ATOMIC_MODE_SET);