All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org
Cc: Liviu.Dudau@arm.com, Jyri Sarha <jsarha@ti.com>,
	tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com
Subject: [PATCH RFC 5/6] drm/omap: csc full range support
Date: Fri, 21 Apr 2017 12:51:16 +0300	[thread overview]
Message-ID: <3db17e1a60e852047c7f9c7ca7c237edab354104.1492768073.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1492768073.git.jsarha@ti.com>

From: Tomi Valkeinen <tomi.valkeinen@ti.com>

At the moment the driver always uses limited range when doing YUV-RGB
conversions. This patch adds full-range tables, and makes the code to
always use full-range tables.

In the future we should allow the user to select the color range instead
of hardcoding it.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index b53e63d..f2a2d08 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -799,6 +799,8 @@ static void dispc_setup_color_conv_coef(void)
 {
 	int i;
 	int num_ovl = dss_feat_get_num_ovls();
+	/* always use full range for now */
+	bool use_full_range = true;
 
 	/* YUV -> RGB, ITU-R BT.601, limited range */
 	const struct csc_coef_yuv2rgb coefs_yuv2rgb_bt601_lim = {
@@ -808,6 +810,14 @@ static void dispc_setup_color_conv_coef(void)
 		false,			/* limited range */
 	};
 
+	/* YUV -> RGB, ITU-R BT.601, full range */
+	const struct csc_coef_yuv2rgb coefs_yuv2rgb_bt601_full = {
+		256,   0,  358,		/* ry, rcb, rcr */
+		256, -88, -182,		/* gy, gcb, gcr */
+		256, 452,    0,		/* by, bcb, bcr */
+		true,			/* full range */
+	};
+
 	/* RGB -> YUV, ITU-R BT.601, limited range */
 	const struct csc_coef_rgb2yuv coefs_rgb2yuv_bt601_lim = {
 		 66, 129,  25,		/* yr,   yg,  yb */
@@ -816,11 +826,30 @@ static void dispc_setup_color_conv_coef(void)
 		false,			/* limited range */
 	};
 
+	/* RGB -> YUV, ITU-R BT.601, full range */
+	const struct csc_coef_rgb2yuv coefs_rgb2yuv_bt601_full = {
+		 77,  150,  29,		/* yr,   yg,  yb */
+		-43,  -85, 128,		/* cbr, cbg, cbb */
+		128, -107, -21,		/* crr, crg, crb */
+		true,			/* full range */
+	};
+
+	const struct csc_coef_yuv2rgb *yuv2rgb;
+	const struct csc_coef_rgb2yuv *rgb2yuv;
+
+	if (use_full_range) {
+		yuv2rgb = &coefs_yuv2rgb_bt601_full;
+		rgb2yuv = &coefs_rgb2yuv_bt601_full;
+	} else {
+		yuv2rgb = &coefs_yuv2rgb_bt601_lim;
+		rgb2yuv = &coefs_rgb2yuv_bt601_lim;
+	}
+
 	for (i = 1; i < num_ovl; i++)
-		dispc_ovl_write_color_conv_coef(i, &coefs_yuv2rgb_bt601_lim);
+		dispc_ovl_write_color_conv_coef(i, yuv2rgb);
 
 	if (dispc.feat->has_writeback)
-		dispc_wb_write_color_conv_coef(&coefs_rgb2yuv_bt601_lim);
+		dispc_wb_write_color_conv_coef(rgb2yuv);
 }
 
 static void dispc_ovl_set_ba0(enum omap_plane_id plane, u32 paddr)
-- 
1.9.1

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

  parent reply	other threads:[~2017-04-21  9:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21  9:51 [PATCH RFC 0/6] drm: Add properties to control YCbCr to RGB conversion Jyri Sarha
2017-04-21  9:51 ` [PATCH RFC 1/6] drm: drm_color_mgmt.h needs struct drm_crtc declaration Jyri Sarha
2017-04-21 11:46   ` Laurent Pinchart
2017-04-21  9:51 ` [PATCH RFC 2/6] drm: Make drm_atomic_replace_property_blob_from_id() more generic Jyri Sarha
2017-04-21 11:47   ` Laurent Pinchart
2017-05-02  8:31     ` Daniel Vetter
2017-04-21  9:51 ` [PATCH RFC 3/6] drm: Plane YCbCr to RGB conversion related properties Jyri Sarha
2017-04-21 11:17   ` Ville Syrjälä
2017-04-21 12:10     ` Laurent Pinchart
2017-04-21 13:08       ` Ville Syrjälä
2017-04-21 12:58     ` Sharma, Shashank
2017-04-21 13:39     ` Jyri Sarha
2017-04-21 13:52       ` Ville Syrjälä
2017-04-21 14:53         ` Brian Starkey
2017-04-21 15:21           ` Ville Syrjälä
2017-04-21 15:34             ` Brian Starkey
2017-04-21 16:49               ` Ville Syrjälä
2017-04-24 12:58                 ` Brian Starkey
2017-04-24  9:02         ` [PATCH] RFC: Design: DRM: Blending pipeline using DRM plane properties Shashank Sharma
2017-04-24 13:21         ` [PATCH RFC 3/6] drm: Plane YCbCr to RGB conversion related properties Jyri Sarha
2017-04-24 15:13           ` Ville Syrjälä
2017-04-24 15:49             ` Jyri Sarha
2017-04-24 16:55               ` Ville Syrjälä
2017-04-26 12:56                 ` Jyri Sarha
2017-04-26 13:28                   ` Sharma, Shashank
2017-04-26 17:22                   ` Ville Syrjälä
2017-05-02  8:33   ` Daniel Vetter
2017-05-02  9:29     ` Jyri Sarha
2017-04-21  9:51 ` [PATCH RFC 4/6] drm/omap: cleanup color space conversion Jyri Sarha
2017-04-21 11:53   ` Laurent Pinchart
2017-04-21  9:51 ` Jyri Sarha [this message]
2017-04-21 11:55   ` [PATCH RFC 5/6] drm/omap: csc full range support Laurent Pinchart
2017-04-21  9:51 ` [PATCH RFC 6/6] drm/omap: Enable ycbcr_to_rgb_properties for omapdrm planes REVISIT Jyri Sarha
2017-04-21 12:53 ` [PATCH RFC 0/6] drm: Add properties to control YCbCr to RGB conversion Sharma, Shashank
2017-04-21 13:50 ` Liviu Dudau
2017-04-24  9:18 ` ✓ Fi.CI.BAT: success for RFC: Design: DRM: Blending pipeline using DRM plane properties Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3db17e1a60e852047c7f9c7ca7c237edab354104.1492768073.git.jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.