All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb()
@ 2019-10-24  8:14 Thomas Zimmermann
  2019-10-24  8:14 ` [PATCH v2 1/4] drm/vram-helpers: Add " Thomas Zimmermann
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2019-10-24  8:14 UTC (permalink / raw)
  To: kraxel, airlied, daniel, z.liuxinliang, zourongrong,
	kong.kongxinwei, puck.chen, hdegoede, sam
  Cc: Thomas Zimmermann, dri-devel

The implementation of the plane's call-back functions prepare_fb() and
cleanup_fb() for GEM VRAM helpers are sharable among drivers.

Patch #3 also fixes two bugs that have been present in hibmc since it was
first added. The primary plane's atomic_update() is not responsible for
pinning BOs. And it never unpinned unused BOs. VRAM is being exausted
over time.

The new helpers have been tested to work.

v2:
	* provide helpers for struct drm_simple_display_pipe_funcs, and...
	* ...use them in bochs

Thomas Zimmermann (4):
  drm/vram-helpers: Add helpers for prepare_fb() and cleanup_fb()
  drm/bochs: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers
  drm/hisilicon/hibmc: Use GEM VRAM's prepare_fb() and cleanup_fb()
    helpers
  drm/vboxvideo: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers

 drivers/gpu/drm/bochs/bochs_kms.c             |  26 +---
 drivers/gpu/drm/drm_gem_vram_helper.c         | 126 ++++++++++++++++++
 .../gpu/drm/hisilicon/hibmc/hibmc_drm_de.c    |  14 +-
 drivers/gpu/drm/vboxvideo/vbox_mode.c         |  61 +--------
 include/drm/drm_gem_vram_helper.h             |  25 ++++
 5 files changed, 161 insertions(+), 91 deletions(-)

--
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] drm/vram-helpers: Add helpers for prepare_fb() and cleanup_fb()
  2019-10-24  8:14 [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Thomas Zimmermann
@ 2019-10-24  8:14 ` Thomas Zimmermann
  2019-10-24  8:14 ` [PATCH v2 2/4] drm/bochs: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers Thomas Zimmermann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2019-10-24  8:14 UTC (permalink / raw)
  To: kraxel, airlied, daniel, z.liuxinliang, zourongrong,
	kong.kongxinwei, puck.chen, hdegoede, sam
  Cc: Thomas Zimmermann, dri-devel

The new helpers pin and unpin a framebuffer's GEM VRAM objects during
plane updates. This should be sufficient for most drivers' implementation
of prepare_fb() and cleanup_fb().

v2:
	* provide helpers for struct drm_simple_display_pipe_funcs
	* rename plane-helper funcs

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_gem_vram_helper.c | 126 ++++++++++++++++++++++++++
 include/drm/drm_gem_vram_helper.h     |  25 +++++
 2 files changed, 151 insertions(+)

diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index b86fe0fa9d05..7fe93cd38eea 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -3,10 +3,13 @@
 #include <drm/drm_debugfs.h>
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
+#include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_gem_vram_helper.h>
 #include <drm/drm_mode.h>
+#include <drm/drm_plane.h>
 #include <drm/drm_prime.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/ttm/ttm_page_alloc.h>
 
 static const struct drm_gem_object_funcs drm_gem_vram_object_funcs;
@@ -646,6 +649,129 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
 }
 EXPORT_SYMBOL(drm_gem_vram_driver_dumb_mmap_offset);
 
+/*
+ * Helpers for struct drm_plane_helper_funcs
+ */
+
+/**
+ * drm_gem_vram_plane_helper_prepare_fb() - \
+ *	Implements &struct drm_plane_helper_funcs.prepare_fb
+ * @plane:	a DRM plane
+ * @new_state:	the plane's new state
+ *
+ * During plane updates, this function pins the GEM VRAM
+ * objects of the plane's new framebuffer to VRAM. Call
+ * drm_gem_vram_plane_helper_cleanup_fb() to unpin them.
+ *
+ * Returns:
+ *	0 on success, or
+ *	a negative errno code otherwise.
+ */
+int
+drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane,
+				     struct drm_plane_state *new_state)
+{
+	size_t i;
+	struct drm_gem_vram_object *gbo;
+	int ret;
+
+	if (!new_state->fb)
+		return 0;
+
+	for (i = 0; i < ARRAY_SIZE(new_state->fb->obj); ++i) {
+		if (!new_state->fb->obj[i])
+			continue;
+		gbo = drm_gem_vram_of_gem(new_state->fb->obj[i]);
+		ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM);
+		if (ret)
+			goto err_drm_gem_vram_unpin;
+	}
+
+	return 0;
+
+err_drm_gem_vram_unpin:
+	while (i) {
+		--i;
+		gbo = drm_gem_vram_of_gem(new_state->fb->obj[i]);
+		drm_gem_vram_unpin(gbo);
+	}
+	return ret;
+}
+EXPORT_SYMBOL(drm_gem_vram_plane_helper_prepare_fb);
+
+/**
+ * drm_gem_vram_plane_helper_cleanup_fb() - \
+ *	Implements &struct drm_plane_helper_funcs.cleanup_fb
+ * @plane:	a DRM plane
+ * @old_state:	the plane's old state
+ *
+ * During plane updates, this function unpins the GEM VRAM
+ * objects of the plane's old framebuffer from VRAM. Complements
+ * drm_gem_vram_plane_helper_prepare_fb().
+ */
+void
+drm_gem_vram_plane_helper_cleanup_fb(struct drm_plane *plane,
+				     struct drm_plane_state *old_state)
+{
+	size_t i;
+	struct drm_gem_vram_object *gbo;
+
+	if (!old_state->fb)
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(old_state->fb->obj); ++i) {
+		if (!old_state->fb->obj[i])
+			continue;
+		gbo = drm_gem_vram_of_gem(old_state->fb->obj[i]);
+		drm_gem_vram_unpin(gbo);
+	}
+}
+EXPORT_SYMBOL(drm_gem_vram_plane_helper_cleanup_fb);
+
+/*
+ * Helpers for struct drm_simple_display_pipe_funcs
+ */
+
+/**
+ * drm_gem_vram_simple_display_pipe_prepare_fb() - \
+ *	Implements &struct drm_simple_display_pipe_funcs.prepare_fb
+ * @pipe:	a simple display pipe
+ * @new_state:	the plane's new state
+ *
+ * During plane updates, this function pins the GEM VRAM
+ * objects of the plane's new framebuffer to VRAM. Call
+ * drm_gem_vram_simple_display_pipe_cleanup_fb() to unpin them.
+ *
+ * Returns:
+ *	0 on success, or
+ *	a negative errno code otherwise.
+ */
+int drm_gem_vram_simple_display_pipe_prepare_fb(
+	struct drm_simple_display_pipe *pipe,
+	struct drm_plane_state *new_state)
+{
+	return drm_gem_vram_plane_helper_prepare_fb(&pipe->plane, new_state);
+}
+EXPORT_SYMBOL(drm_gem_vram_simple_display_pipe_prepare_fb);
+
+/**
+ * drm_gem_vram_simple_display_pipe_cleanup_fb() - \
+ *	Implements &struct drm_simple_display_pipe_funcs.cleanup_fb
+ * @pipe:	a simple display pipe
+ * @old_state:	the plane's old state
+ *
+ * During plane updates, this function unpins the GEM VRAM
+ * objects of the plane's old framebuffer from VRAM. Complements
+ * drm_gem_vram_simple_display_pipe_prepare_fb().
+ */
+void drm_gem_vram_simple_display_pipe_cleanup_fb(
+	struct drm_simple_display_pipe *pipe,
+	struct drm_plane_state *old_state)
+{
+	drm_gem_vram_plane_helper_cleanup_fb(&pipe->plane, old_state);
+}
+EXPORT_SYMBOL(drm_gem_vram_simple_display_pipe_cleanup_fb);
+
 /*
  * PRIME helpers
  */
diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h
index b8ad4531ebb4..e040541a105f 100644
--- a/include/drm/drm_gem_vram_helper.h
+++ b/include/drm/drm_gem_vram_helper.h
@@ -13,6 +13,9 @@
 #include <linux/kernel.h> /* for container_of() */
 
 struct drm_mode_create_dumb;
+struct drm_plane;
+struct drm_plane_state;
+struct drm_simple_display_pipe;
 struct drm_vram_mm_funcs;
 struct filp;
 struct vm_area_struct;
@@ -124,6 +127,28 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
 					 struct drm_device *dev,
 					 uint32_t handle, uint64_t *offset);
 
+/*
+ * Helpers for struct drm_plane_helper_funcs
+ */
+int
+drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane,
+				     struct drm_plane_state *new_state);
+void
+drm_gem_vram_plane_helper_cleanup_fb(struct drm_plane *plane,
+				     struct drm_plane_state *old_state);
+
+/*
+ * Helpers for struct drm_simple_display_pipe_funcs
+ */
+
+int drm_gem_vram_simple_display_pipe_prepare_fb(
+	struct drm_simple_display_pipe *pipe,
+	struct drm_plane_state *new_state);
+
+void drm_gem_vram_simple_display_pipe_cleanup_fb(
+	struct drm_simple_display_pipe *pipe,
+	struct drm_plane_state *old_state);
+
 /**
  * define DRM_GEM_VRAM_DRIVER - default callback functions for \
 	&struct drm_driver
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] drm/bochs: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers
  2019-10-24  8:14 [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Thomas Zimmermann
  2019-10-24  8:14 ` [PATCH v2 1/4] drm/vram-helpers: Add " Thomas Zimmermann
@ 2019-10-24  8:14 ` Thomas Zimmermann
  2019-10-24  8:14 ` [PATCH v2 3/4] drm/hisilicon/hibmc: Use GEM VRAM's prepare_fb() and cleanup_fb() helpers Thomas Zimmermann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2019-10-24  8:14 UTC (permalink / raw)
  To: kraxel, airlied, daniel, z.liuxinliang, zourongrong,
	kong.kongxinwei, puck.chen, hdegoede, sam
  Cc: Thomas Zimmermann, dri-devel

GEM VRAM provides an implementation for prepare_fb() and cleanup_fb()
of struct drm_simple_display_pipe_funcs. Switch over bochs.

v2:
	* use helpers for struct drm_simple_display_pipe_funcs

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/bochs/bochs_kms.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 02a9c1ed165b..3f0006c2470d 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -69,33 +69,11 @@ static void bochs_pipe_update(struct drm_simple_display_pipe *pipe,
 	}
 }
 
-static int bochs_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
-				 struct drm_plane_state *new_state)
-{
-	struct drm_gem_vram_object *gbo;
-
-	if (!new_state->fb)
-		return 0;
-	gbo = drm_gem_vram_of_gem(new_state->fb->obj[0]);
-	return drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM);
-}
-
-static void bochs_pipe_cleanup_fb(struct drm_simple_display_pipe *pipe,
-				  struct drm_plane_state *old_state)
-{
-	struct drm_gem_vram_object *gbo;
-
-	if (!old_state->fb)
-		return;
-	gbo = drm_gem_vram_of_gem(old_state->fb->obj[0]);
-	drm_gem_vram_unpin(gbo);
-}
-
 static const struct drm_simple_display_pipe_funcs bochs_pipe_funcs = {
 	.enable	    = bochs_pipe_enable,
 	.update	    = bochs_pipe_update,
-	.prepare_fb = bochs_pipe_prepare_fb,
-	.cleanup_fb = bochs_pipe_cleanup_fb,
+	.prepare_fb = drm_gem_vram_simple_display_pipe_prepare_fb,
+	.cleanup_fb = drm_gem_vram_simple_display_pipe_cleanup_fb,
 };
 
 static int bochs_connector_get_modes(struct drm_connector *connector)
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] drm/hisilicon/hibmc: Use GEM VRAM's prepare_fb() and cleanup_fb() helpers
  2019-10-24  8:14 [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Thomas Zimmermann
  2019-10-24  8:14 ` [PATCH v2 1/4] drm/vram-helpers: Add " Thomas Zimmermann
  2019-10-24  8:14 ` [PATCH v2 2/4] drm/bochs: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers Thomas Zimmermann
@ 2019-10-24  8:14 ` Thomas Zimmermann
  2019-10-24  8:14 ` [PATCH v2 4/4] drm/vboxvideo: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers Thomas Zimmermann
  2019-10-24 12:37 ` [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Daniel Vetter
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2019-10-24  8:14 UTC (permalink / raw)
  To: kraxel, airlied, daniel, z.liuxinliang, zourongrong,
	kong.kongxinwei, puck.chen, hdegoede, sam
  Cc: Thomas Zimmermann, dri-devel

This patch implements prepare_fb() and cleanup_fb() in hibmc with the
GEM VRAM helpers. In the current code, pinning the BO is performed by
hibmc_plane_atomic_update(), where the operation does not belong.

This patch also fixes a bug where the pinned BO was never unpinned.
Pinning multiple BOs would have exhaused the available VRAM and further
pin operations would have failed, leaving the display in a corrupt
state.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
index cc4c41748cfb..6527a97f68a3 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
@@ -96,7 +96,6 @@ static void hibmc_plane_atomic_update(struct drm_plane *plane,
 {
 	struct drm_plane_state	*state	= plane->state;
 	u32 reg;
-	int ret;
 	s64 gpu_addr = 0;
 	unsigned int line_l;
 	struct hibmc_drm_private *priv = plane->dev->dev_private;
@@ -109,16 +108,9 @@ static void hibmc_plane_atomic_update(struct drm_plane *plane,
 	hibmc_fb = to_hibmc_framebuffer(state->fb);
 	gbo = drm_gem_vram_of_gem(hibmc_fb->obj);
 
-	ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM);
-	if (ret) {
-		DRM_ERROR("failed to pin bo: %d", ret);
-		return;
-	}
 	gpu_addr = drm_gem_vram_offset(gbo);
-	if (gpu_addr < 0) {
-		drm_gem_vram_unpin(gbo);
-		return;
-	}
+	if (WARN_ON_ONCE(gpu_addr < 0))
+		return; /* Bug: we didn't pin the BO to VRAM in prepare_fb. */
 
 	writel(gpu_addr, priv->mmio + HIBMC_CRT_FB_ADDRESS);
 
@@ -157,6 +149,8 @@ static struct drm_plane_funcs hibmc_plane_funcs = {
 };
 
 static const struct drm_plane_helper_funcs hibmc_plane_helper_funcs = {
+	.prepare_fb	= drm_gem_vram_plane_helper_prepare_fb,
+	.cleanup_fb	= drm_gem_vram_plane_helper_cleanup_fb,
 	.atomic_check = hibmc_plane_atomic_check,
 	.atomic_update = hibmc_plane_atomic_update,
 };
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] drm/vboxvideo: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers
  2019-10-24  8:14 [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2019-10-24  8:14 ` [PATCH v2 3/4] drm/hisilicon/hibmc: Use GEM VRAM's prepare_fb() and cleanup_fb() helpers Thomas Zimmermann
@ 2019-10-24  8:14 ` Thomas Zimmermann
  2019-10-24 12:37 ` [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Daniel Vetter
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2019-10-24  8:14 UTC (permalink / raw)
  To: kraxel, airlied, daniel, z.liuxinliang, zourongrong,
	kong.kongxinwei, puck.chen, hdegoede, sam
  Cc: Thomas Zimmermann, dri-devel

GEM VRAM provides an implementation for prepare_fb() and cleanup_fb()
of struct drm_plane_helper_funcs. Switch over vboxvideo.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vboxvideo/vbox_mode.c | 61 ++-------------------------
 1 file changed, 4 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/vboxvideo/vbox_mode.c b/drivers/gpu/drm/vboxvideo/vbox_mode.c
index b5604d32122e..cea38c5345c6 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_mode.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_mode.c
@@ -334,35 +334,6 @@ static void vbox_primary_atomic_disable(struct drm_plane *plane,
 				    old_state->src_y >> 16);
 }
 
-static int vbox_primary_prepare_fb(struct drm_plane *plane,
-				   struct drm_plane_state *new_state)
-{
-	struct drm_gem_vram_object *gbo;
-	int ret;
-
-	if (!new_state->fb)
-		return 0;
-
-	gbo = drm_gem_vram_of_gem(new_state->fb->obj[0]);
-	ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM);
-	if (ret)
-		DRM_WARN("Error %d pinning new fb, out of video mem?\n", ret);
-
-	return ret;
-}
-
-static void vbox_primary_cleanup_fb(struct drm_plane *plane,
-				    struct drm_plane_state *old_state)
-{
-	struct drm_gem_vram_object *gbo;
-
-	if (!old_state->fb)
-		return;
-
-	gbo = drm_gem_vram_of_gem(old_state->fb->obj[0]);
-	drm_gem_vram_unpin(gbo);
-}
-
 static int vbox_cursor_atomic_check(struct drm_plane *plane,
 				    struct drm_plane_state *new_state)
 {
@@ -492,30 +463,6 @@ static void vbox_cursor_atomic_disable(struct drm_plane *plane,
 	mutex_unlock(&vbox->hw_mutex);
 }
 
-static int vbox_cursor_prepare_fb(struct drm_plane *plane,
-				  struct drm_plane_state *new_state)
-{
-	struct drm_gem_vram_object *gbo;
-
-	if (!new_state->fb)
-		return 0;
-
-	gbo = drm_gem_vram_of_gem(new_state->fb->obj[0]);
-	return drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_SYSTEM);
-}
-
-static void vbox_cursor_cleanup_fb(struct drm_plane *plane,
-				   struct drm_plane_state *old_state)
-{
-	struct drm_gem_vram_object *gbo;
-
-	if (!plane->state->fb)
-		return;
-
-	gbo = drm_gem_vram_of_gem(plane->state->fb->obj[0]);
-	drm_gem_vram_unpin(gbo);
-}
-
 static const u32 vbox_cursor_plane_formats[] = {
 	DRM_FORMAT_ARGB8888,
 };
@@ -524,8 +471,8 @@ static const struct drm_plane_helper_funcs vbox_cursor_helper_funcs = {
 	.atomic_check	= vbox_cursor_atomic_check,
 	.atomic_update	= vbox_cursor_atomic_update,
 	.atomic_disable	= vbox_cursor_atomic_disable,
-	.prepare_fb	= vbox_cursor_prepare_fb,
-	.cleanup_fb	= vbox_cursor_cleanup_fb,
+	.prepare_fb	= drm_gem_vram_plane_helper_prepare_fb,
+	.cleanup_fb	= drm_gem_vram_plane_helper_cleanup_fb,
 };
 
 static const struct drm_plane_funcs vbox_cursor_plane_funcs = {
@@ -546,8 +493,8 @@ static const struct drm_plane_helper_funcs vbox_primary_helper_funcs = {
 	.atomic_check = vbox_primary_atomic_check,
 	.atomic_update = vbox_primary_atomic_update,
 	.atomic_disable = vbox_primary_atomic_disable,
-	.prepare_fb = vbox_primary_prepare_fb,
-	.cleanup_fb = vbox_primary_cleanup_fb,
+	.prepare_fb	= drm_gem_vram_plane_helper_prepare_fb,
+	.cleanup_fb	= drm_gem_vram_plane_helper_cleanup_fb,
 };
 
 static const struct drm_plane_funcs vbox_primary_plane_funcs = {
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb()
  2019-10-24  8:14 [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2019-10-24  8:14 ` [PATCH v2 4/4] drm/vboxvideo: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers Thomas Zimmermann
@ 2019-10-24 12:37 ` Daniel Vetter
  2019-10-24 14:05   ` Thomas Zimmermann
  4 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2019-10-24 12:37 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, puck.chen, dri-devel, z.liuxinliang, hdegoede,
	kong.kongxinwei, kraxel, zourongrong, sam

On Thu, Oct 24, 2019 at 10:14:00AM +0200, Thomas Zimmermann wrote:
> The implementation of the plane's call-back functions prepare_fb() and
> cleanup_fb() for GEM VRAM helpers are sharable among drivers.
> 
> Patch #3 also fixes two bugs that have been present in hibmc since it was
> first added. The primary plane's atomic_update() is not responsible for
> pinning BOs. And it never unpinned unused BOs. VRAM is being exausted
> over time.
> 
> The new helpers have been tested to work.
> 
> v2:
> 	* provide helpers for struct drm_simple_display_pipe_funcs, and...
> 	* ...use them in bochs

Oh I thought we agreed on changing the simple_pipe type for
prepare/cleanup_fb ... But this works too ofc. On the series:

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

> 
> Thomas Zimmermann (4):
>   drm/vram-helpers: Add helpers for prepare_fb() and cleanup_fb()
>   drm/bochs: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers
>   drm/hisilicon/hibmc: Use GEM VRAM's prepare_fb() and cleanup_fb()
>     helpers
>   drm/vboxvideo: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers
> 
>  drivers/gpu/drm/bochs/bochs_kms.c             |  26 +---
>  drivers/gpu/drm/drm_gem_vram_helper.c         | 126 ++++++++++++++++++
>  .../gpu/drm/hisilicon/hibmc/hibmc_drm_de.c    |  14 +-
>  drivers/gpu/drm/vboxvideo/vbox_mode.c         |  61 +--------
>  include/drm/drm_gem_vram_helper.h             |  25 ++++
>  5 files changed, 161 insertions(+), 91 deletions(-)
> 
> --
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb()
  2019-10-24 12:37 ` [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Daniel Vetter
@ 2019-10-24 14:05   ` Thomas Zimmermann
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2019-10-24 14:05 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: airlied, puck.chen, dri-devel, z.liuxinliang, hdegoede,
	kong.kongxinwei, kraxel, zourongrong, sam


[-- Attachment #1.1.1: Type: text/plain, Size: 2068 bytes --]

Hi

Am 24.10.19 um 14:37 schrieb Daniel Vetter:
> On Thu, Oct 24, 2019 at 10:14:00AM +0200, Thomas Zimmermann wrote:
>> The implementation of the plane's call-back functions prepare_fb() and
>> cleanup_fb() for GEM VRAM helpers are sharable among drivers.
>>
>> Patch #3 also fixes two bugs that have been present in hibmc since it was
>> first added. The primary plane's atomic_update() is not responsible for
>> pinning BOs. And it never unpinned unused BOs. VRAM is being exausted
>> over time.
>>
>> The new helpers have been tested to work.
>>
>> v2:
>> 	* provide helpers for struct drm_simple_display_pipe_funcs, and...
>> 	* ...use them in bochs
> 
> Oh I thought we agreed on changing the simple_pipe type for
> prepare/cleanup_fb ... But this works too ofc. On the series:

Well, I'm still no fan of the current simple pipe helpers. But after you
changed the signature of mode_valid() and explained the reasons, I
thought it was more important to have consistent interfaces.

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

Thanks!

Best regards
Thomas

> 
>>
>> Thomas Zimmermann (4):
>>   drm/vram-helpers: Add helpers for prepare_fb() and cleanup_fb()
>>   drm/bochs: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers
>>   drm/hisilicon/hibmc: Use GEM VRAM's prepare_fb() and cleanup_fb()
>>     helpers
>>   drm/vboxvideo: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers
>>
>>  drivers/gpu/drm/bochs/bochs_kms.c             |  26 +---
>>  drivers/gpu/drm/drm_gem_vram_helper.c         | 126 ++++++++++++++++++
>>  .../gpu/drm/hisilicon/hibmc/hibmc_drm_de.c    |  14 +-
>>  drivers/gpu/drm/vboxvideo/vbox_mode.c         |  61 +--------
>>  include/drm/drm_gem_vram_helper.h             |  25 ++++
>>  5 files changed, 161 insertions(+), 91 deletions(-)
>>
>> --
>> 2.23.0
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-24 14:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-24  8:14 [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Thomas Zimmermann
2019-10-24  8:14 ` [PATCH v2 1/4] drm/vram-helpers: Add " Thomas Zimmermann
2019-10-24  8:14 ` [PATCH v2 2/4] drm/bochs: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers Thomas Zimmermann
2019-10-24  8:14 ` [PATCH v2 3/4] drm/hisilicon/hibmc: Use GEM VRAM's prepare_fb() and cleanup_fb() helpers Thomas Zimmermann
2019-10-24  8:14 ` [PATCH v2 4/4] drm/vboxvideo: Replace prepare_fb()/cleanup_fb() with GEM VRAM helpers Thomas Zimmermann
2019-10-24 12:37 ` [PATCH v2 0/4] drm/vram: Provide helpers for prepare_fb() and cleanup_fb() Daniel Vetter
2019-10-24 14:05   ` Thomas Zimmermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.