[PATCH] drm/imx: Add support for non-RGB output colorspace

Philipp Zabel p.zabel at pengutronix.de
Mon Mar 2 06:57:30 PST 2015


This patch allows to use non-RGB color formats on the output. This is needed
to support YUV output via HDMI or TV-Encoder.

Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
---
 drivers/gpu/drm/imx/ipuv3-crtc.c  | 3 ++-
 drivers/gpu/drm/imx/ipuv3-plane.c | 9 +++++----
 drivers/gpu/drm/imx/ipuv3-plane.h | 3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 09d6f98..35a3375 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -203,7 +203,8 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
 				  crtc->primary->fb,
 				  0, 0, mode->hdisplay, mode->vdisplay,
 				  x, y, mode->hdisplay, mode->vdisplay,
-				  mode->flags & DRM_MODE_FLAG_INTERLACE);
+				  mode->flags & DRM_MODE_FLAG_INTERLACE,
+				  ipu_pixelformat_to_colorspace(out_pixel_fmt));
 }
 
 static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc)
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 878a643..566cbe0 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -99,7 +99,8 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 		       struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 		       unsigned int crtc_w, unsigned int crtc_h,
 		       uint32_t src_x, uint32_t src_y,
-		       uint32_t src_w, uint32_t src_h, bool interlaced)
+		       uint32_t src_w, uint32_t src_h, bool interlaced,
+		       enum ipu_color_space out_colorspace)
 {
 	struct device *dev = ipu_plane->base.dev->dev;
 	int ret;
@@ -158,8 +159,8 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
 	switch (ipu_plane->dp_flow) {
 	case IPU_DP_FLOW_SYNC_BG:
 		ret = ipu_dp_setup_channel(ipu_plane->dp,
-				IPUV3_COLORSPACE_RGB,
-				IPUV3_COLORSPACE_RGB);
+				ipu_drm_fourcc_to_colorspace(fb->pixel_format),
+				out_colorspace);
 		if (ret) {
 			dev_err(dev,
 				"initializing display processor failed with %d\n",
@@ -315,7 +316,7 @@ static int ipu_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	ret = ipu_plane_mode_set(ipu_plane, crtc, &crtc->hwmode, fb,
 			crtc_x, crtc_y, crtc_w, crtc_h,
 			src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
-			false);
+			false, IPUV3_COLORSPACE_UNKNOWN);
 	if (ret < 0) {
 		ipu_plane_put_resources(ipu_plane);
 		return ret;
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.h b/drivers/gpu/drm/imx/ipuv3-plane.h
index 9b5eff1..8a3ae68 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.h
+++ b/drivers/gpu/drm/imx/ipuv3-plane.h
@@ -42,7 +42,8 @@ int ipu_plane_mode_set(struct ipu_plane *plane, struct drm_crtc *crtc,
 		       struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 		       unsigned int crtc_w, unsigned int crtc_h,
 		       uint32_t src_x, uint32_t src_y, uint32_t src_w,
-		       uint32_t src_h, bool interlaced);
+		       uint32_t src_h, bool interlaced,
+		       enum ipu_color_space out_colorspace);
 
 void ipu_plane_enable(struct ipu_plane *plane);
 void ipu_plane_disable(struct ipu_plane *plane);
-- 
2.1.4



More information about the dri-devel mailing list