linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups
@ 2013-06-21  8:57 Philipp Zabel
  2013-06-21  8:57 ` [PATCH 1/4] staging: drm/imx: remove unused variables Philipp Zabel
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Philipp Zabel @ 2013-06-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

the following patches remove some unused variables, replace some
hard-coded channel numbers with existing descriptive defines, fix
the DMFC bandwidth (or rather: FIFO space) allocation, and update
ipu_page_flip() to immediately set crtc->fb.    

regards
Philipp

---
 drivers/staging/imx-drm/imx-drm-core.c    |  3 ---
 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 22 ++++++++++++++++------
 drivers/staging/imx-drm/ipuv3-crtc.c      |  7 +------
 3 files changed, 17 insertions(+), 15 deletions(-)

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

* [PATCH 1/4] staging: drm/imx: remove unused variables
  2013-06-21  8:57 [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Philipp Zabel
@ 2013-06-21  8:57 ` Philipp Zabel
  2013-06-21  8:57 ` [PATCH 2/4] staging: drm/imx: ipu-dmfc: fix bandwidth allocation Philipp Zabel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2013-06-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/imx-drm-core.c | 3 ---
 drivers/staging/imx-drm/ipuv3-crtc.c   | 5 -----
 2 files changed, 8 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index 6455305..56d6bc4 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -491,7 +491,6 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,
 {
 	struct imx_drm_device *imxdrm = __imx_drm_device();
 	struct imx_drm_crtc *imx_drm_crtc;
-	const struct drm_crtc_funcs *crtc_funcs;
 	int ret;
 
 	mutex_lock(&imxdrm->mutex);
@@ -512,8 +511,6 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,
 	imx_drm_crtc->cookie.cookie = cookie;
 	imx_drm_crtc->cookie.id = id;
 
-	crtc_funcs = imx_drm_helper_funcs->crtc_funcs;
-
 	imx_drm_crtc->crtc = crtc;
 	imx_drm_crtc->imxdrm = imxdrm;
 
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index ff5c633..abcdaef 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -22,7 +22,6 @@
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <drm/drmP.h>
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <linux/fb.h>
 #include <linux/clk.h>
@@ -42,9 +41,6 @@ struct ipu_framebuffer {
 };
 
 struct ipu_crtc {
-	struct drm_fb_helper	fb_helper;
-	struct ipu_framebuffer	ifb;
-	int			num_crtcs;
 	struct device		*dev;
 	struct drm_crtc		base;
 	struct imx_drm_crtc	*imx_crtc;
@@ -54,7 +50,6 @@ struct ipu_crtc {
 	struct dmfc_channel	*dmfc;
 	struct ipu_di		*di;
 	int			enabled;
-	struct ipu_priv		*ipu_priv;
 	struct drm_pending_vblank_event *page_flip_event;
 	struct drm_framebuffer	*newfb;
 	int			irq;
-- 
1.8.3.1

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

* [PATCH 2/4] staging: drm/imx: ipu-dmfc: fix bandwidth allocation
  2013-06-21  8:57 [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Philipp Zabel
  2013-06-21  8:57 ` [PATCH 1/4] staging: drm/imx: remove unused variables Philipp Zabel
@ 2013-06-21  8:57 ` Philipp Zabel
  2013-06-21  8:57 ` [PATCH 3/4] staging: drm/imx: ipuv3-crtc: immediately update crtc->fb in ipu_page_flip Philipp Zabel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2013-06-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

The IPU can request up to four pixels per access, which gives four
times the bandwidth compared to what the driver currently assumes.
After correcting this, we have to increase safety margins for
bandwidth requirement calculations.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
index 91821bc..1dc9817 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
@@ -292,7 +292,7 @@ int ipu_dmfc_alloc_bandwidth(struct dmfc_channel *dmfc,
 {
 	struct ipu_dmfc_priv *priv = dmfc->priv;
 	int slots = dmfc_bandwidth_to_slots(priv, bandwidth_pixel_per_second);
-	int segment = 0, ret = 0;
+	int segment = -1, ret = 0;
 
 	dev_dbg(priv->dev, "dmfc: trying to allocate %ldMpixel/s for IPU channel %d\n",
 			bandwidth_pixel_per_second / 1000000,
@@ -307,7 +307,17 @@ int ipu_dmfc_alloc_bandwidth(struct dmfc_channel *dmfc,
 		goto out;
 	}
 
-	segment = dmfc_find_slots(priv, slots);
+	/* Always allocate at least 128*4 bytes (2 slots) */
+	if (slots < 2)
+		slots = 2;
+
+	/* For the MEM_BG channel, first try to allocate twice the slots */
+	if (dmfc->data->ipu_channel == IPUV3_CHANNEL_MEM_BG_SYNC)
+		segment = dmfc_find_slots(priv, slots * 2);
+	if (segment >= 0)
+		slots *= 2;
+	else
+		segment = dmfc_find_slots(priv, slots);
 	if (segment < 0) {
 		ret = -EBUSY;
 		goto out;
@@ -391,7 +401,7 @@ int ipu_dmfc_init(struct ipu_soc *ipu, struct device *dev, unsigned long base,
 	 * We have a total bandwidth of clkrate * 4pixel divided
 	 * into 8 slots.
 	 */
-	priv->bandwidth_per_slot = clk_get_rate(ipu_clk) / 8;
+	priv->bandwidth_per_slot = clk_get_rate(ipu_clk) * 4 / 8;
 
 	dev_dbg(dev, "dmfc: 8 slots with %ldMpixel/s bandwidth each\n",
 			priv->bandwidth_per_slot / 1000000);
-- 
1.8.3.1

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

* [PATCH 3/4] staging: drm/imx: ipuv3-crtc: immediately update crtc->fb in ipu_page_flip
  2013-06-21  8:57 [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Philipp Zabel
  2013-06-21  8:57 ` [PATCH 1/4] staging: drm/imx: remove unused variables Philipp Zabel
  2013-06-21  8:57 ` [PATCH 2/4] staging: drm/imx: ipu-dmfc: fix bandwidth allocation Philipp Zabel
@ 2013-06-21  8:57 ` Philipp Zabel
  2013-06-21  8:57 ` [PATCH 4/4] staging: drm/imx: ipu-dmfc: use defines for ipu channel numbers Philipp Zabel
  2013-06-24 19:42 ` [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2013-06-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

Since commit 8cf1e9811471f2910fa38dc1b28e1789080ba961
("drm: Add consistency check for page-flipping") drm_mode_page_flip_ioctl
contains a WARN_ON that triggers if the .page_flip callback didn't update
the crtc->fb pointer to the new framebuffer immediately.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/ipuv3-crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index abcdaef..4a7eedf 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -147,6 +147,7 @@ static int ipu_page_flip(struct drm_crtc *crtc,
 
 	ipu_crtc->newfb = fb;
 	ipu_crtc->page_flip_event = event;
+	crtc->fb = fb;
 
 	return 0;
 }
@@ -329,7 +330,6 @@ static irqreturn_t ipu_irq_handler(int irq, void *dev_id)
 	imx_drm_handle_vblank(ipu_crtc->imx_crtc);
 
 	if (ipu_crtc->newfb) {
-		ipu_crtc->base.fb = ipu_crtc->newfb;
 		ipu_crtc->newfb = NULL;
 		ipu_drm_set_base(&ipu_crtc->base, 0, 0);
 		ipu_crtc_handle_pageflip(ipu_crtc);
-- 
1.8.3.1

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

* [PATCH 4/4] staging: drm/imx: ipu-dmfc: use defines for ipu channel numbers
  2013-06-21  8:57 [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Philipp Zabel
                   ` (2 preceding siblings ...)
  2013-06-21  8:57 ` [PATCH 3/4] staging: drm/imx: ipuv3-crtc: immediately update crtc->fb in ipu_page_flip Philipp Zabel
@ 2013-06-21  8:57 ` Philipp Zabel
  2013-06-24 19:42 ` [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2013-06-21  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
index 1dc9817..2e97c33 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
@@ -61,7 +61,7 @@ struct dmfc_channel_data {
 
 static const struct dmfc_channel_data dmfcdata[] = {
 	{
-		.ipu_channel	= 23,
+		.ipu_channel	= IPUV3_CHANNEL_MEM_BG_SYNC,
 		.channel_reg	= DMFC_DP_CHAN,
 		.shift		= DMFC_DP_CHAN_5B_23,
 		.eot_shift	= 20,
@@ -73,13 +73,13 @@ static const struct dmfc_channel_data dmfcdata[] = {
 		.eot_shift	= 22,
 		.max_fifo_lines	= 1,
 	}, {
-		.ipu_channel	= 27,
+		.ipu_channel	= IPUV3_CHANNEL_MEM_FG_SYNC,
 		.channel_reg	= DMFC_DP_CHAN,
 		.shift		= DMFC_DP_CHAN_5F_27,
 		.eot_shift	= 21,
 		.max_fifo_lines	= 2,
 	}, {
-		.ipu_channel	= 28,
+		.ipu_channel	= IPUV3_CHANNEL_MEM_DC_SYNC,
 		.channel_reg	= DMFC_WR_CHAN,
 		.shift		= DMFC_WR_CHAN_1_28,
 		.eot_shift	= 16,
-- 
1.8.3.1

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

* [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups
  2013-06-21  8:57 [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Philipp Zabel
                   ` (3 preceding siblings ...)
  2013-06-21  8:57 ` [PATCH 4/4] staging: drm/imx: ipu-dmfc: use defines for ipu channel numbers Philipp Zabel
@ 2013-06-24 19:42 ` Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2013-06-24 19:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 21, 2013 at 10:57:17AM +0200, Philipp Zabel wrote:
> Hi,
> 
> the following patches remove some unused variables, replace some
> hard-coded channel numbers with existing descriptive defines, fix
> the DMFC bandwidth (or rather: FIFO space) allocation, and update
> ipu_page_flip() to immediately set crtc->fb.    


Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

end of thread, other threads:[~2013-06-24 19:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21  8:57 [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Philipp Zabel
2013-06-21  8:57 ` [PATCH 1/4] staging: drm/imx: remove unused variables Philipp Zabel
2013-06-21  8:57 ` [PATCH 2/4] staging: drm/imx: ipu-dmfc: fix bandwidth allocation Philipp Zabel
2013-06-21  8:57 ` [PATCH 3/4] staging: drm/imx: ipuv3-crtc: immediately update crtc->fb in ipu_page_flip Philipp Zabel
2013-06-21  8:57 ` [PATCH 4/4] staging: drm/imx: ipu-dmfc: use defines for ipu channel numbers Philipp Zabel
2013-06-24 19:42 ` [PATCH 0/4] IPU DMFC bandwidth allocation fix and cleanups Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).