Re: [PATCH 1/3] drm/gma500: Unpin framebuffer when destroying it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 26, 2013 at 08:03:53PM +0200, Patrik Jakobsson wrote:
> A framebuffer is pinned when it's set as pipe base, so we also need to
> unpin it when it's destroyed. Some framebuffers are never used as
> scanout (no mode set on them) so if the pin count is less than one, no
> unpinning is needed.
> 
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=889511
> Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=812113
> 
> Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx>
> ---
>  drivers/gpu/drm/gma500/framebuffer.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
> index 8b1b6d9..1a11b69 100644
> --- a/drivers/gpu/drm/gma500/framebuffer.c
> +++ b/drivers/gpu/drm/gma500/framebuffer.c
> @@ -668,6 +668,11 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
>  
>  	/* Let DRM do its clean up */
>  	drm_framebuffer_cleanup(fb);
> +
> +	/* Unpin any psb_intel_pipe_set_base() pinning */
> +	if (r->in_gart > 0)
> +		psb_gtt_unpin(r);

The drm core /should/ have removed the user framebuffer from all active
users before it calls down into your ->destroy callback. Why can't gma500
just pin/unpin on demand when the buffer is actually in use?

If a pin survives the official use as seen by the drm core (e.g. to keep a
buffer around until the pageflip completes) you can simply keep an
additional reference around.

Cheers, Daniel

> +
>  	/*  We are no longer using the resource in GEM */
>  	drm_gem_object_unreference_unlocked(&r->gem);
>  	kfree(fb);
> -- 
> 1.8.1.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux