Skip to contentSkip to conversation

Armada DRM: four fixes

PATCH In review Russell King - ARM Linux 4 participants 10 messages Dec 9, 2013 – Dec 10, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Armada DRM: four fixes

Rob, David,

Here are four fixes for review for the Armada DRM driver.

 drivers/gpu/drm/armada/armada_drm.h   |    1 +
 drivers/gpu/drm/armada/armada_drv.c   |    7 ++++++-
 drivers/gpu/drm/armada/armada_fbdev.c |   20 +++++++++++++++-----
 drivers/gpu/drm/armada/armada_gem.c   |    7 ++++---
 4 files changed, 26 insertions(+), 9 deletions(-)

If you're happy with them, I can send a pull request.

Thanks.

#1 lore raw

RFC PATCH 1/4 DRM: Armada: implement lastclose() for fbhelper

Call drm_fb_helper_restore_fbdev_mode() upon last close so that in the event of the X server crashing, we have some kind of mode restored.

---
 drivers/gpu/drm/armada/armada_drm.h   |    1 +
 drivers/gpu/drm/armada/armada_drv.c   |    7 ++++++-
 drivers/gpu/drm/armada/armada_fbdev.c |   10 ++++++++++
 3 files changed, 17 insertions(+), 1 deletions(-)
drivers/gpu/drm/armada/armada_drm.h +1 -0
index eef09ec9a5ff..a72cae03b99b 100644
@@ -103,6 +103,7 @@ void armada_drm_queue_unref_work(struct drm_device *,
 extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs;
 
 int armada_fbdev_init(struct drm_device *);
+void armada_fbdev_lastclose(struct drm_device *);
 void armada_fbdev_fini(struct drm_device *);
 
 int armada_overlay_plane_create(struct drm_device *, unsigned long);
drivers/gpu/drm/armada/armada_drv.c +6 -1
index 7aede900a221..15425d23c9cc 100644
@@ -321,6 +321,11 @@ static struct drm_ioctl_desc armada_ioctls[] = {
 		DRM_UNLOCKED),
 };
 
+static void armada_drm_lastclose(struct drm_device *dev)
+{
+	armada_fbdev_lastclose(dev);
+}
+
 static const struct file_operations armada_drm_fops = {
 	.owner			= THIS_MODULE,
 	.llseek			= no_llseek,
@@ -337,7 +342,7 @@ static struct drm_driver armada_drm_driver = {
 	.open			= NULL,
 	.preclose		= NULL,
 	.postclose		= NULL,
-	.lastclose		= NULL,
+	.lastclose		= armada_drm_lastclose,
 	.unload			= armada_drm_unload,
 	.get_vblank_counter	= drm_vblank_count,
 	.enable_vblank		= armada_drm_enable_vblank,
drivers/gpu/drm/armada/armada_fbdev.c +10 -0
index dd5ea77dac96..743570e99f90 100644
@@ -177,6 +177,16 @@ int armada_fbdev_init(struct drm_device *dev)
 	return ret;
 }
 
+void armada_fbdev_lastclose(struct drm_device *dev)
+{
+	struct armada_private *priv = dev->dev_private;
+
+	drm_modeset_lock_all(dev);
+	if (priv->fbdev)
+		drm_fb_helper_restore_fbdev_mode(priv->fbdev);
+	drm_modeset_unlock_all(dev);
+}
+
 void armada_fbdev_fini(struct drm_device *dev)
 {
 	struct armada_private *priv = dev->dev_private;
Signature · 1 line
1.7.4.4
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH RFC 1/4] DRM: Armada: implement lastclose() for fbhelper

Quoted 9 lines · Russell King

Call drm_fb_helper_restore_fbdev_mode() upon last close so that in the event of the X server crashing, we have some kind of mode restored.

---
 drivers/gpu/drm/armada/armada_drm.h   |    1 +
 drivers/gpu/drm/armada/armada_drv.c   |    7 ++++++-
 drivers/gpu/drm/armada/armada_fbdev.c |   10 ++++++++++
 3 files changed, 17 insertions(+), 1 deletions(-)

Looks good:

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

RFC PATCH 2/4 DRM: Armada: destroy framebuffer after helper

In reply to Russell King - ARM Linux

Destroy the framebuffer only after the helper, since the helper may still be referencing the framebufer at this point.

---
 drivers/gpu/drm/armada/armada_fbdev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +2 -2
index 743570e99f90..b348b16f81e2 100644
@@ -202,11 +202,11 @@ void armada_fbdev_fini(struct drm_device *dev)
 			framebuffer_release(info);
 		}
 
+		drm_fb_helper_fini(fbh);
+
 		if (fbh->fb)
 			fbh->fb->funcs->destroy(fbh->fb);
 
-		drm_fb_helper_fini(fbh);
-
 		priv->fbdev = NULL;
 	}
 }
Signature · 1 line
1.7.4.4
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH RFC 2/4] DRM: Armada: destroy framebuffer after helper

Quoted 7 lines · Russell King

Destroy the framebuffer only after the helper, since the helper may still be referencing the framebufer at this point.

---
 drivers/gpu/drm/armada/armada_fbdev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

RFC PATCH 3/4 DRM: Armada: fix printing of phys_addr_t/dma_addr_t

In reply to Russell King - ARM Linux

These can be 64-bit quantities, so fix them up appropriately.

---
 drivers/gpu/drm/armada/armada_fbdev.c |    6 +++---
 drivers/gpu/drm/armada/armada_gem.c   |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +3 -3
index b348b16f81e2..948cb14c561e 100644
@@ -105,9 +105,9 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
 	drm_fb_helper_fill_fix(info, dfb->fb.pitches[0], dfb->fb.depth);
 	drm_fb_helper_fill_var(info, fbh, sizes->fb_width, sizes->fb_height);
 
-	DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08x\n",
-		dfb->fb.width, dfb->fb.height,
-		dfb->fb.bits_per_pixel, obj->phys_addr);
+	DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08llx\n",
+		dfb->fb.width, dfb->fb.height, dfb->fb.bits_per_pixel,
+		(unsigned long long)obj->phys_addr);
 
 	return 0;
 
drivers/gpu/drm/armada/armada_gem.c +3 -2
index 9f2356bae7fd..adc7c2da75bb 100644
@@ -172,8 +172,9 @@ armada_gem_linear_back(struct drm_device *dev, struct armada_gem_object *obj)
 		obj->dev_addr = obj->linear->start;
 	}
 
-	DRM_DEBUG_DRIVER("obj %p phys %#x dev %#x\n",
-			 obj, obj->phys_addr, obj->dev_addr);
+	DRM_DEBUG_DRIVER("obj %p phys %#llx dev %#llx\n", obj,
+			 (unsigned long long)obj->phys_addr,
+			 (unsigned long long)obj->dev_addr);
 
 	return 0;
 }
Signature · 1 line
1.7.4.4
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH RFC 3/4] DRM: Armada: fix printing of phys_addr_t/dma_addr_t

Quoted 7 lines · Russell King

These can be 64-bit quantities, so fix them up appropriately.

---
 drivers/gpu/drm/armada/armada_fbdev.c |    6 +++---
 drivers/gpu/drm/armada/armada_gem.c   |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

RFC PATCH 4/4 DRM: Armada: prime refcounting bug fix

In reply to Russell King - ARM Linux

Commit 011c2282c74d changed the way refcounting on imported dma_bufs works, and this hadn't been spotted while forward-porting Armada. Reflect the changes in that commit into the Armada driver.

---
 drivers/gpu/drm/armada/armada_gem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/armada/armada_gem.c +1 -1
index adc7c2da75bb..887816f43476 100644
@@ -558,7 +558,6 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf)
 			 * refcount on the gem object itself.
 			 */
 			drm_gem_object_reference(obj);
-			dma_buf_put(buf);
 			return obj;
 		}
 	}
@@ -574,6 +573,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf)
 	}
 
 	dobj->obj.import_attach = attach;
+	get_dma_buf(buf);
 
 	/*
 	 * Don't call dma_buf_map_attachment() here - it maps the
Signature · 1 line
1.7.4.4
Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH RFC 4/4] DRM: Armada: prime refcounting bug fix

Quoted 8 lines · Russell King

Commit 011c2282c74d changed the way refcounting on imported dma_bufs works, and this hadn't been spotted while forward-porting Armada. Reflect the changes in that commit into the Armada driver.

---
 drivers/gpu/drm/armada/armada_gem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on the v1 series
#9 lore raw
In reply to Russell King - ARM Linux
Quoted 11 lines · Russell King - ARM Linux

Rob, David,

Here are four fixes for review for the Armada DRM driver.

 drivers/gpu/drm/armada/armada_drm.h   |    1 +
 drivers/gpu/drm/armada/armada_drv.c   |    7 ++++++-
 drivers/gpu/drm/armada/armada_fbdev.c |   20 +++++++++++++++-----
 drivers/gpu/drm/armada/armada_gem.c   |    7 ++++---
 4 files changed, 26 insertions(+), 9 deletions(-)

If you're happy with them, I can send a pull request.

yeah, they look good.. for the series:

Quoted 1 line

Thanks.