diff mbox

[07/23] drm: Make the fb refcount handover less magic

Message ID 20180322152313.6561-8-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä March 22, 2018, 3:22 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of assigning the plane->fb pointer and clearing the fb pointer
to hand over the reference, let's just do it by grabbing another
referece for plane->fb and let fb keep its original one.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Daniel Vetter March 27, 2018, 7:49 a.m. UTC | #1
On Thu, Mar 22, 2018 at 05:22:57PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Instead of assigning the plane->fb pointer and clearing the fb pointer
> to hand over the reference, let's just do it by grabbing another
> referece for plane->fb and let fb keep its original one.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  drivers/gpu/drm/drm_plane.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index bedceca7dd06..008f9456a5e8 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1084,8 +1084,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  		plane->old_fb = NULL;
>  	} else {
>  		plane->fb = fb;
> -		/* Unref only the old framebuffer. */
> -		fb = NULL;
> +		drm_framebuffer_get(fb);
>  	}
>  
>  out:
> -- 
> 2.16.1
> 
> _______________________________________________
> 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_plane.c b/drivers/gpu/drm/drm_plane.c
index bedceca7dd06..008f9456a5e8 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1084,8 +1084,7 @@  int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		plane->old_fb = NULL;
 	} else {
 		plane->fb = fb;
-		/* Unref only the old framebuffer. */
-		fb = NULL;
+		drm_framebuffer_get(fb);
 	}
 
 out: