From patchwork Fri Apr 21 09:51:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 9692303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C73E660383 for ; Fri, 21 Apr 2017 09:51:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFDFC223A6 for ; Fri, 21 Apr 2017 09:51:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B40FF28614; Fri, 21 Apr 2017 09:51:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4733D223A6 for ; Fri, 21 Apr 2017 09:51:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8B5A6E415; Fri, 21 Apr 2017 09:51:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4DD7F6E415 for ; Fri, 21 Apr 2017 09:51:49 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v3L9pdlS032298; Fri, 21 Apr 2017 04:51:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1492768299; bh=h5aMpWtAe0JLdOq4LlpBqq26ya/VYw0MZDXmYfVRZpM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ewQC+cE1zRmHaSyWwO59g9vQGxSYfssf7LIubnSJVY+VTAXfNCQ6hzG0mDNude+EU CFQKKd2QzZzv7vqRnzxW0BDYRiOYgf1neMFrOBdPgKPPNvsYTwZ8yRb9tVOa56XBfj lOeY4JWq6XjX9u6LSQlXRLEZ8ruEdSDnWXzqDqDI= Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v3L9pdpu003080; Fri, 21 Apr 2017 04:51:39 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Fri, 21 Apr 2017 04:51:38 -0500 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v3L9pNB1015129; Fri, 21 Apr 2017 04:51:36 -0500 From: Jyri Sarha To: Subject: [PATCH RFC 5/6] drm/omap: csc full range support Date: Fri, 21 Apr 2017 12:51:16 +0300 Message-ID: <3db17e1a60e852047c7f9c7ca7c237edab354104.1492768073.git.jsarha@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 Cc: Liviu.Dudau@arm.com, Jyri Sarha , tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Tomi Valkeinen 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 Signed-off-by: Jyri Sarha Reviewed-by: Laurent Pinchart --- 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)