diff mbox

drm: Keep a reference to the active plane framebuffer

Message ID 1361287087-32035-1-git-send-email-thierry.reding@avionic-design.de (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding Feb. 19, 2013, 3:18 p.m. UTC
When updating a plane, the DRM core always sets the plane's framebuffer
to NULL. This in turn will cause the reference count on the plane's
active framebuffer to become unbalanced because on the next update, the
old framebuffer will be NULL.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
---
 drivers/gpu/drm/drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ville Syrjälä Feb. 19, 2013, 3:32 p.m. UTC | #1
On Tue, Feb 19, 2013 at 04:18:07PM +0100, Thierry Reding wrote:
> When updating a plane, the DRM core always sets the plane's framebuffer
> to NULL. This in turn will cause the reference count on the plane's
> active framebuffer to become unbalanced because on the next update, the
> old framebuffer will be NULL.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>

http://lists.freedesktop.org/archives/dri-devel/2013-February/034978.html
Thierry Reding Feb. 19, 2013, 3:36 p.m. UTC | #2
On Tue, Feb 19, 2013 at 05:32:56PM +0200, Ville Syrjälä wrote:
> On Tue, Feb 19, 2013 at 04:18:07PM +0100, Thierry Reding wrote:
> > When updating a plane, the DRM core always sets the plane's framebuffer
> > to NULL. This in turn will cause the reference count on the plane's
> > active framebuffer to become unbalanced because on the next update, the
> > old framebuffer will be NULL.
> > 
> > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> 
> http://lists.freedesktop.org/archives/dri-devel/2013-February/034978.html

Darn, I had searched for it but must have missed it. Thanks.

Thierry
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d06ec7e..b235fa0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1984,9 +1984,9 @@  int drm_mode_setplane(struct drm_device *dev, void *data,
 					 plane_req->src_w, plane_req->src_h);
 	if (!ret) {
 		old_fb = plane->fb;
+		plane->fb = fb;
 		fb = NULL;
 		plane->crtc = crtc;
-		plane->fb = fb;
 	}
 	drm_modeset_unlock_all(dev);