All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set()
@ 2014-07-29  9:57 Philipp Zabel
  2014-07-29  9:57 ` [PATCH 2/4] imx-drm: ipuv3-plane: move stride setting out of base setup Philipp Zabel
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Philipp Zabel @ 2014-07-29  9:57 UTC (permalink / raw)
  To: Russell King; +Cc: Fabio Estevam, devel, kernel, Greg Kroah-Hartman, dri-devel

For the overlay plane scanning out a framebuffer with an alpha component,
enable the DP local alpha feature on the partial plane.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/ipuv3-plane.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c
index 50de10a..43e36ea 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.c
+++ b/drivers/staging/imx-drm/ipuv3-plane.c
@@ -151,14 +151,22 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 				ret);
 			return ret;
 		}
-		ipu_dp_set_global_alpha(ipu_plane->dp, 1, 0, 1);
+		ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true);
 		break;
 	case IPU_DP_FLOW_SYNC_FG:
 		ipu_dp_setup_channel(ipu_plane->dp,
 				ipu_drm_fourcc_to_colorspace(fb->pixel_format),
 				IPUV3_COLORSPACE_UNKNOWN);
 		ipu_dp_set_window_pos(ipu_plane->dp, crtc_x, crtc_y);
-		break;
+		/* Enable local alpha on partial plane */
+		switch (fb->pixel_format) {
+		case DRM_FORMAT_ARGB8888:
+		case DRM_FORMAT_ABGR8888:
+			ipu_dp_set_global_alpha(ipu_plane->dp, false, 0, false);
+			break;
+		default:
+			break;
+		}
 	}
 
 	ret = ipu_dmfc_init_channel(ipu_plane->dmfc, crtc_w);
-- 
2.0.1

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

* [PATCH 2/4] imx-drm: ipuv3-plane: move stride setting out of base setup
  2014-07-29  9:57 [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Philipp Zabel
@ 2014-07-29  9:57 ` Philipp Zabel
  2014-07-29  9:57 ` [PATCH 3/4] imx-drm: ipuv3-plane: enable double buffering Philipp Zabel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2014-07-29  9:57 UTC (permalink / raw)
  To: Russell King; +Cc: Fabio Estevam, devel, kernel, Greg Kroah-Hartman, dri-devel

Setting the stride can only be done on inactive channels, while
the buffer base address can also be updated for running channels
using the hardware double buffering feature.

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

diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c
index 43e36ea..9f79a17 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.c
+++ b/drivers/staging/imx-drm/ipuv3-plane.c
@@ -76,8 +76,6 @@ int ipu_plane_set_base(struct ipu_plane *ipu_plane, struct drm_framebuffer *fb,
 		&cma_obj->paddr, x, y);
 
 	cpmem = ipu_get_cpmem(ipu_plane->ipu_ch);
-	ipu_cpmem_set_stride(cpmem, fb->pitches[0]);
-
 	eba = cma_obj->paddr + fb->offsets[0] +
 	      fb->pitches[0] * y + (fb->bits_per_pixel >> 3) * x;
 	ipu_cpmem_set_buffer(cpmem, 0, eba);
@@ -193,6 +191,7 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 		return ret;
 	}
 	ipu_cpmem_set_high_priority(ipu_plane->ipu_ch);
+	ipu_cpmem_set_stride(cpmem, fb->pitches[0]);
 
 	ret = ipu_plane_set_base(ipu_plane, fb, src_x, src_y);
 	if (ret < 0)
-- 
2.0.1

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

* [PATCH 3/4] imx-drm: ipuv3-plane: enable double buffering
  2014-07-29  9:57 [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Philipp Zabel
  2014-07-29  9:57 ` [PATCH 2/4] imx-drm: ipuv3-plane: move stride setting out of base setup Philipp Zabel
@ 2014-07-29  9:57 ` Philipp Zabel
  2014-07-29  9:57 ` [PATCH 4/4] imx-drm: ipuv3-plane: fix plane updates for active planes Philipp Zabel
  2014-09-08 19:50 ` [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Greg Kroah-Hartman
  3 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2014-07-29  9:57 UTC (permalink / raw)
  To: Russell King; +Cc: Fabio Estevam, devel, kernel, Greg Kroah-Hartman, dri-devel

This allows to update the buffer base address while the DMA
channel is running. It is needed to flip the frame buffer of
an active plane.

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

diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c
index 9f79a17..9fdab14 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.c
+++ b/drivers/staging/imx-drm/ipuv3-plane.c
@@ -65,6 +65,7 @@ int ipu_plane_set_base(struct ipu_plane *ipu_plane, struct drm_framebuffer *fb,
 	struct ipu_ch_param __iomem *cpmem;
 	struct drm_gem_cma_object *cma_obj;
 	unsigned long eba;
+	int active;
 
 	cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
 	if (!cma_obj) {
@@ -75,11 +76,17 @@ int ipu_plane_set_base(struct ipu_plane *ipu_plane, struct drm_framebuffer *fb,
 	dev_dbg(ipu_plane->base.dev->dev, "phys = %pad, x = %d, y = %d",
 		&cma_obj->paddr, x, y);
 
-	cpmem = ipu_get_cpmem(ipu_plane->ipu_ch);
 	eba = cma_obj->paddr + fb->offsets[0] +
 	      fb->pitches[0] * y + (fb->bits_per_pixel >> 3) * x;
-	ipu_cpmem_set_buffer(cpmem, 0, eba);
-	ipu_cpmem_set_buffer(cpmem, 1, eba);
+
+	cpmem = ipu_get_cpmem(ipu_plane->ipu_ch);
+	if (ipu_plane->enabled) {
+		active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch);
+		ipu_cpmem_set_buffer(cpmem, !active, eba);
+	} else {
+		ipu_cpmem_set_buffer(cpmem, 0, eba);
+		ipu_cpmem_set_buffer(cpmem, 1, eba);
+	}
 
 	/* cache offsets for subsequent pageflips */
 	ipu_plane->x = x;
@@ -191,6 +198,7 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 		return ret;
 	}
 	ipu_cpmem_set_high_priority(ipu_plane->ipu_ch);
+	ipu_idmac_set_double_buffer(ipu_plane->ipu_ch, 1);
 	ipu_cpmem_set_stride(cpmem, fb->pitches[0]);
 
 	ret = ipu_plane_set_base(ipu_plane, fb, src_x, src_y);
-- 
2.0.1

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

* [PATCH 4/4] imx-drm: ipuv3-plane: fix plane updates for active planes
  2014-07-29  9:57 [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Philipp Zabel
  2014-07-29  9:57 ` [PATCH 2/4] imx-drm: ipuv3-plane: move stride setting out of base setup Philipp Zabel
  2014-07-29  9:57 ` [PATCH 3/4] imx-drm: ipuv3-plane: enable double buffering Philipp Zabel
@ 2014-07-29  9:57 ` Philipp Zabel
  2014-09-08 19:50 ` [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Greg Kroah-Hartman
  3 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2014-07-29  9:57 UTC (permalink / raw)
  To: Russell King; +Cc: Fabio Estevam, devel, kernel, Greg Kroah-Hartman, dri-devel

While the DMA channel is running, it is not allowed to change anything
but the inactive (double) buffer base address, so resizing a plane or
changing to a frame buffer with different pixel format is not possible.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/ipuv3-plane.c | 15 +++++++++++++++
 drivers/staging/imx-drm/ipuv3-plane.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c
index 9fdab14..3dfcdfd 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.c
+++ b/drivers/staging/imx-drm/ipuv3-plane.c
@@ -145,6 +145,18 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 	if (crtc_h < 2)
 		return -EINVAL;
 
+	/*
+	 * since we cannot touch active IDMAC channels, we do not support
+	 * resizing the enabled plane or changing its format
+	 */
+	if (ipu_plane->enabled) {
+		if (src_w != ipu_plane->w || src_h != ipu_plane->h ||
+		    fb->pixel_format != ipu_plane->base.fb->pixel_format)
+			return -EINVAL;
+
+		return ipu_plane_set_base(ipu_plane, fb, src_x, src_y);
+	}
+
 	switch (ipu_plane->dp_flow) {
 	case IPU_DP_FLOW_SYNC_BG:
 		ret = ipu_dp_setup_channel(ipu_plane->dp,
@@ -205,6 +217,9 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 	if (ret < 0)
 		return ret;
 
+	ipu_plane->w = src_w;
+	ipu_plane->h = src_h;
+
 	return 0;
 }
 
diff --git a/drivers/staging/imx-drm/ipuv3-plane.h b/drivers/staging/imx-drm/ipuv3-plane.h
index c0aae5b..af125fb 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.h
+++ b/drivers/staging/imx-drm/ipuv3-plane.h
@@ -26,6 +26,8 @@ struct ipu_plane {
 
 	int			x;
 	int			y;
+	int			w;
+	int			h;
 
 	bool			enabled;
 };
-- 
2.0.1

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

* Re: [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set()
  2014-07-29  9:57 [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Philipp Zabel
                   ` (2 preceding siblings ...)
  2014-07-29  9:57 ` [PATCH 4/4] imx-drm: ipuv3-plane: fix plane updates for active planes Philipp Zabel
@ 2014-09-08 19:50 ` Greg Kroah-Hartman
  2014-09-09 11:36   ` Philipp Zabel
  3 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2014-09-08 19:50 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Fabio Estevam, Russell King, devel, kernel, dri-devel

On Tue, Jul 29, 2014 at 11:57:06AM +0200, Philipp Zabel wrote:
> For the overlay plane scanning out a framebuffer with an alpha component,
> enable the DP local alpha feature on the partial plane.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/staging/imx-drm/ipuv3-plane.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)

Russell, are these ok to take?

thanks,

greg k-h

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

* Re: [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set()
  2014-09-08 19:50 ` [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Greg Kroah-Hartman
@ 2014-09-09 11:36   ` Philipp Zabel
  0 siblings, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2014-09-09 11:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Fabio Estevam, Russell King, devel, kernel, dri-devel

Am Montag, den 08.09.2014, 12:50 -0700 schrieb Greg Kroah-Hartman:
> On Tue, Jul 29, 2014 at 11:57:06AM +0200, Philipp Zabel wrote:
> > For the overlay plane scanning out a framebuffer with an alpha component,
> > enable the DP local alpha feature on the partial plane.
> > 
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > ---
> >  drivers/staging/imx-drm/ipuv3-plane.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> Russell, are these ok to take?

Actually, no. Thanks for the reminder.
There's an error in the double buffering patch. I'll send a v2.

regards
Philipp

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

end of thread, other threads:[~2014-09-09 11:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29  9:57 [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Philipp Zabel
2014-07-29  9:57 ` [PATCH 2/4] imx-drm: ipuv3-plane: move stride setting out of base setup Philipp Zabel
2014-07-29  9:57 ` [PATCH 3/4] imx-drm: ipuv3-plane: enable double buffering Philipp Zabel
2014-07-29  9:57 ` [PATCH 4/4] imx-drm: ipuv3-plane: fix plane updates for active planes Philipp Zabel
2014-09-08 19:50 ` [PATCH 1/4] imx-drm: ipuv3-plane: allow local alpha in ipu_plane_mode_set() Greg Kroah-Hartman
2014-09-09 11:36   ` Philipp Zabel

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.