[PATCH 4/4] [RFC] drm: Releasing FBs before releasing GEM objects during drm_release

Prathyush prathyush.k at samsung.com
Sat Apr 14 04:52:13 PDT 2012

During DRM release, all the FBs and gem objects are released. If
a gem object is being used as a FB and set to a crtc, it must not
be freed before releasing the framebuffer first.

If FBs are released first, the crtc using the FB is disabled first
so now the GEM object can be freed safely. The CRTC will be enabled
again when the driver restores fbdev mode.

Signed-off-by: Prathyush K <prathyush.k at samsung.com>
 drivers/gpu/drm/drm_fops.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 6263b01..f6525ef 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -498,12 +498,12 @@ int drm_release(struct inode *inode, struct file *filp)
-	if (dev->driver->driver_features & DRIVER_GEM)
-		drm_gem_release(dev, file_priv);
 	if (dev->driver->driver_features & DRIVER_MODESET)
+	if (dev->driver->driver_features & DRIVER_GEM)
+		drm_gem_release(dev, file_priv);
 	if (!list_empty(&dev->ctxlist)) {
 		struct drm_ctx_list *pos, *n;

More information about the dri-devel mailing list