diff mbox

[62/72] imx-drm: ipuv3-plane: Assign correct dmfc burst size

Message ID 1414796095-10107-63-git-send-email-steve_longerbeam@mentor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Longerbeam Oct. 31, 2014, 10:54 p.m. UTC
According to the imx6 reference manual, the DMFC channel's
burstsize must match the corresponding IDMAC channel's burstsize,
so make sure to pass the IDMAC channel burstsize to
ipu_dmfc_alloc_bandwidth(). We need to move ipu_dmfc_alloc_bandwidth()
to after the channel is setup, in order to first initialize the
channel burstsize, before retrieving it with ipu_cpmem_get_burstsize().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/staging/imx-drm/ipuv3-plane.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c
index 61d47e9..aa10ae7 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.c
+++ b/drivers/staging/imx-drm/ipuv3-plane.c
@@ -159,7 +159,7 @@  int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 {
 	struct device *dev = ipu_plane->base.dev->dev;
 	bool is_bg = (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_BG);
-	int ret;
+	int burstsize, ret;
 
 	/* no scaling */
 	if (src_w != crtc_w || src_h != crtc_h)
@@ -238,14 +238,6 @@  int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 		}
 	}
 
-	ret = ipu_dmfc_alloc_bandwidth(ipu_plane->dmfc,
-			calc_bandwidth(crtc_w, crtc_h,
-				       calc_vref(mode)), crtc_w, 64);
-	if (ret) {
-		dev_err(dev, "allocating dmfc bandwidth failed with %d\n", ret);
-		return ret;
-	}
-
 	ipu_cpmem_zero(ipu_plane->ipu_ch);
 	ipu_cpmem_set_resolution(ipu_plane->ipu_ch, src_w, src_h);
 	ret = ipu_cpmem_set_fmt(ipu_plane->ipu_ch, fb->pixel_format);
@@ -260,6 +252,16 @@  int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 
 	ipu_cpmem_set_high_priority(ipu_plane->ipu_ch);
 
+	burstsize = ipu_cpmem_get_burstsize(ipu_plane->ipu_ch);
+
+	ret = ipu_dmfc_alloc_bandwidth(ipu_plane->dmfc,
+			calc_bandwidth(crtc_w, crtc_h,
+				       calc_vref(mode)), crtc_w, burstsize);
+	if (ret) {
+		dev_err(dev, "allocating dmfc bandwidth failed with %d\n", ret);
+		return ret;
+	}
+
 	/* enable double-buffering */
 	ipu_idmac_set_double_buffer(ipu_plane->ipu_ch, true);