From patchwork Sun Feb 3 19:47:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10794817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 692E81390 for ; Sun, 3 Feb 2019 19:48:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CBFA28A75 for ; Sun, 3 Feb 2019 19:48:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 500D42B169; Sun, 3 Feb 2019 19:48:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC39428A75 for ; Sun, 3 Feb 2019 19:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727502AbfBCTsE (ORCPT ); Sun, 3 Feb 2019 14:48:04 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46830 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbfBCTsE (ORCPT ); Sun, 3 Feb 2019 14:48:04 -0500 Received: by mail-pf1-f196.google.com with SMTP id c73so5734478pfe.13; Sun, 03 Feb 2019 11:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7lxqbLiE+uIi/LoSq4/IqkPXxqEo9I5bwA9g+I5eDek=; b=ZdnPZGKIEA3v89NWtXxpCl/iUJ1VLiKY/zDd+qDGoAO0v2KdjcJiIrTbGslWIhhk2D wF2wesSS+drUw4G56h1ltBuc/05ELgm7RkSse/1PMYNkhF+yQaUqPL67BoKjZ/zdQmPM aKU33AmiZdFdIJ3HxscOeFfDFfFEURicoqy+M6PjCK3dm9ExdUIlQf/SY05/f0uDDLkw eEzMGGf8CgInjvSj0/DjP/QUI7bo6A3x2gruBRx0JzoT7C8/HXtq3AG7Z+/+ih5n1P6C JhC3PTM85H+0TwlCdo/YyQtlGEN/1eF4jch0h+8qlyu36DzLG93EhaaQqLaH5VDVMDSZ HBJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7lxqbLiE+uIi/LoSq4/IqkPXxqEo9I5bwA9g+I5eDek=; b=k+QhOgekWmHzR+ie559xUbRA1yKiYuJWCR3w5H/CuSeiOVtMevgPIQb67WYJey/Kn1 QMt6+1TMunDwsfg36BwChhxKHo5BWpPtikc4s0IHal2fjNWgZ5KetZc4Q90uaaXLeqWc DLP6ZxuZW6U5GdzSUhNjVm7bZwn91d8Jo7Z5ryUblValKrestGde5vpno9a5bZ0tsvlO jeXQclcxQoceHXxWBh0F69q/WXEWDz+5ERnTRwZBadj8gpeqZEkzIoxqUx/DFNHRdQrm dZUFcq47hqq19Zz+ssNnPdRU8l7mxQJooPGHbPte2EhKfy2FIrtuXwM3GR7OwicKGwIe iviA== X-Gm-Message-State: AHQUAuYtRyc7KxE3K398ZTLxbOq9F7fP52xcjPeyFgAeOvalPbCUmAc0 rYR5GDnAGBtz8VT2nLPVGgXHP9zh X-Google-Smtp-Source: AHgI3IYZaCWA9gzHCO4wVaXjPR43e8cqRbPC4Vxo/whUSSfQOL0cxxWhyeVowc8NBTLR3IFEKL5aTg== X-Received: by 2002:a63:bd1a:: with SMTP id a26mr10361787pgf.121.1549223283149; Sun, 03 Feb 2019 11:48:03 -0800 (PST) Received: from mappy.world.mentorg.com (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id f67sm23487724pff.29.2019.02.03.11.47.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Feb 2019 11:48:02 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Tim Harvey , Philipp Zabel , Steve Longerbeam , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR FREESCALE IMX), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] gpu: ipu-v3: ipu-ic: Rename yuv2rgb encoding matrices Date: Sun, 3 Feb 2019 11:47:42 -0800 Message-Id: <20190203194744.11546-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190203194744.11546-1-slongerbeam@gmail.com> References: <20190203194744.11546-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ycbcr2rgb and inverse rgb2ycbcr matrices define the BT.601 encoding coefficients, so rename them to indicate that. And add some comments to make clear these are BT.601 coefficients encoding between YUV limited range and RGB full range. No functional changes. Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-ic.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index 594c3cbc8291..35ae86ff0585 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -183,11 +183,13 @@ struct ic_csc_params { }; /* + * BT.601 encoding from RGB full range to YUV limited range: + * * Y = R * .299 + G * .587 + B * .114; * U = R * -.169 + G * -.332 + B * .500 + 128.; * V = R * .500 + G * -.419 + B * -.0813 + 128.; */ -static const struct ic_csc_params ic_csc_rgb2ycbcr = { +static const struct ic_csc_params ic_csc_rgb2ycbcr_bt601 = { .coeff = { { 77, 150, 29 }, { 469, 427, 128 }, @@ -208,11 +210,13 @@ static const struct ic_csc_params ic_csc_rgb2rgb = { }; /* + * Inverse BT.601 encoding from YUV limited range to RGB full range: + * * R = (1.164 * (Y - 16)) + (1.596 * (Cr - 128)); * G = (1.164 * (Y - 16)) - (0.392 * (Cb - 128)) - (0.813 * (Cr - 128)); * B = (1.164 * (Y - 16)) + (2.017 * (Cb - 128); */ -static const struct ic_csc_params ic_csc_ycbcr2rgb = { +static const struct ic_csc_params ic_csc_ycbcr2rgb_bt601 = { .coeff = { { 149, 0, 204 }, { 149, 462, 408 }, @@ -238,9 +242,9 @@ static int init_csc(struct ipu_ic *ic, (priv->tpmem_base + ic->reg->tpmem_csc[csc_index]); if (inf == IPUV3_COLORSPACE_YUV && outf == IPUV3_COLORSPACE_RGB) - params = &ic_csc_ycbcr2rgb; + params = &ic_csc_ycbcr2rgb_bt601; else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_YUV) - params = &ic_csc_rgb2ycbcr; + params = &ic_csc_rgb2ycbcr_bt601; else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_RGB) params = &ic_csc_rgb2rgb; else { From patchwork Sun Feb 3 19:47:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10794821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9385D922 for ; Sun, 3 Feb 2019 19:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87C1C28A75 for ; Sun, 3 Feb 2019 19:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BB7D29033; Sun, 3 Feb 2019 19:48:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D95F228A75 for ; Sun, 3 Feb 2019 19:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727919AbfBCTsM (ORCPT ); Sun, 3 Feb 2019 14:48:12 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36710 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbfBCTsM (ORCPT ); Sun, 3 Feb 2019 14:48:12 -0500 Received: by mail-pf1-f196.google.com with SMTP id b85so5765861pfc.3; Sun, 03 Feb 2019 11:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pHmKXMOajx+sKZCyoTb/XhdLePG+iJ3f6Vh1XpVeYDs=; b=m8/+7D3V8tDL9ifZWm5f3bVzq2R/IQX/JYemcNXZ8inL8z/4BwFmddoSc4sSYrR5+J wFoQGQF61VsF8OAlBWt9CcWYZfTRVPXUNw1N/KlGJbhWSE/qJ5u+T1q/bh6gKt8Mp0o+ YRdWeqcovDJxco6Vyyy2oZV7xGBHmwd+JkV50VUoKiY+o1Aj/h+Z7ccyqDPN91DnB+gw AfaJpc1WXMwBAK94EWdscBc3c6ox/Nkw7alnrX/Ky1SnfIEJ5OelpBLCaL7v9QdrOZk9 +bvlLrQo7jfvB/N3X+CgM11QVmCkL7tV6dsUGgaQLlzMlT56EimxRR3EPwl1cTKqtmhu glGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pHmKXMOajx+sKZCyoTb/XhdLePG+iJ3f6Vh1XpVeYDs=; b=guEdcJyEocTTpEB5T6e0fFyRoqyYCmDfv8SBmopDrqtr437J6AhEMAwha4cd2bnLoZ 1Ar0ELN6Xw9knHM5xLlT/aLsNFRlLFDaDNw1E/ECLYZT4TjuUVVRDuy7WSReoQ0UQv/V 9xAm+X2taehTnbkB5BrLt4HgZwldNOItt/Fp7b6k6HCPsAQy0VlpTs7Lage8E7UjTC1z lt8kB7SXCzhoietGJPdL9lQVu8N2tU+FCei3TnkeW5QeIQRC7Ezw5mjxy59rKqTNDY1x sj7gvC6aIrZCzYnqgEBRmkwmaNGq3KanBKMAw9nd+ZJQDIj2xdfPjB6oIg8oYudcSwZy E4Hg== X-Gm-Message-State: AHQUAuZNVXPCuMoG2t0dKwrUqkCtOpLbHDGIaHca6IVcXOZlHYbjCzsj JWheT3ZOfUd3wNZXJBl5E7sMgjgy X-Google-Smtp-Source: AHgI3IbsKF2WeAmIU3EXtt/UITniu7WOl8mE4J+KnnW7x2+MQs80SwjwBFBRES2m7LBxj/wWcJU68w== X-Received: by 2002:a63:8742:: with SMTP id i63mr10328767pge.298.1549223290278; Sun, 03 Feb 2019 11:48:10 -0800 (PST) Received: from mappy.world.mentorg.com (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id f67sm23487724pff.29.2019.02.03.11.48.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Feb 2019 11:48:09 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Tim Harvey , Philipp Zabel , Steve Longerbeam , Mauro Carvalho Chehab , Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR FREESCALE IMX), linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-fbdev@vger.kernel.org (open list:FRAMEBUFFER LAYER) Subject: [PATCH 2/3] gpu: ipu-v3: ipu-ic: Add support for BT.709 encoding Date: Sun, 3 Feb 2019 11:47:43 -0800 Message-Id: <20190203194744.11546-3-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190203194744.11546-1-slongerbeam@gmail.com> References: <20190203194744.11546-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pass v4l2 encoding enum to the ipu_ic task init functions, and add support for the BT.709 encoding and inverse encoding matrices. Reported-by: Tim Harvey Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-ic.c | 67 ++++++++++++++++++--- drivers/gpu/ipu-v3/ipu-image-convert.c | 1 + drivers/staging/media/imx/imx-ic-prpencvf.c | 4 +- include/video/imx-ipu-v3.h | 5 +- 4 files changed, 67 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index 35ae86ff0585..63362b4fff81 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -199,6 +199,23 @@ static const struct ic_csc_params ic_csc_rgb2ycbcr_bt601 = { .scale = 1, }; +/* + * BT.709 encoding from RGB full range to YUV limited range: + * + * Y = R * .2126 + G * .7152 + B * .0722; + * U = R * -.1146 + G * -.3854 + B * .5000 + 128.; + * V = R * .5000 + G * -.4542 + B * -.0458 + 128.; + */ +static const struct ic_csc_params ic_csc_rgb2ycbcr_bt709 = { + .coeff = { + { 54, 183, 18 }, + { 483, 413, 128 }, + { 128, 396, 500 }, + }, + .offset = { 0, 512, 512 }, + .scale = 1, +}; + /* transparent RGB->RGB matrix for graphics combining */ static const struct ic_csc_params ic_csc_rgb2rgb = { .coeff = { @@ -226,12 +243,31 @@ static const struct ic_csc_params ic_csc_ycbcr2rgb_bt601 = { .scale = 2, }; +/* + * Inverse BT.709 encoding from YUV limited range to RGB full range: + * + * R = (1. * (Y - 16)) + (1.5748 * (Cr - 128)); + * G = (1. * (Y - 16)) - (0.1873 * (Cb - 128)) - (0.4681 * (Cr - 128)); + * B = (1. * (Y - 16)) + (1.8556 * (Cb - 128); + */ +static const struct ic_csc_params ic_csc_ycbcr2rgb_bt709 = { + .coeff = { + { 128, 0, 202 }, + { 128, 488, 452 }, + { 128, 238, 0 }, + }, + .offset = { -435, 136, -507 }, + .scale = 2, +}; + static int init_csc(struct ipu_ic *ic, enum ipu_color_space inf, enum ipu_color_space outf, + enum v4l2_ycbcr_encoding encoding, int csc_index) { struct ipu_ic_priv *priv = ic->priv; + const struct ic_csc_params *params_rgb2yuv, *params_yuv2rgb; const struct ic_csc_params *params; u32 __iomem *base; const u16 (*c)[3]; @@ -241,10 +277,24 @@ static int init_csc(struct ipu_ic *ic, base = (u32 __iomem *) (priv->tpmem_base + ic->reg->tpmem_csc[csc_index]); + switch (encoding) { + case V4L2_YCBCR_ENC_601: + params_rgb2yuv = &ic_csc_rgb2ycbcr_bt601; + params_yuv2rgb = &ic_csc_ycbcr2rgb_bt601; + break; + case V4L2_YCBCR_ENC_709: + params_rgb2yuv = &ic_csc_rgb2ycbcr_bt709; + params_yuv2rgb = &ic_csc_ycbcr2rgb_bt709; + break; + default: + dev_err(priv->ipu->dev, "Unsupported YCbCr encoding\n"); + return -EINVAL; + } + if (inf == IPUV3_COLORSPACE_YUV && outf == IPUV3_COLORSPACE_RGB) - params = &ic_csc_ycbcr2rgb_bt601; + params = params_yuv2rgb; else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_YUV) - params = &ic_csc_rgb2ycbcr_bt601; + params = params_rgb2yuv; else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_RGB) params = &ic_csc_rgb2rgb; else { @@ -391,6 +441,7 @@ EXPORT_SYMBOL_GPL(ipu_ic_task_disable); int ipu_ic_task_graphics_init(struct ipu_ic *ic, enum ipu_color_space in_g_cs, + enum v4l2_ycbcr_encoding encoding, bool galpha_en, u32 galpha, bool colorkey_en, u32 colorkey) { @@ -409,7 +460,7 @@ int ipu_ic_task_graphics_init(struct ipu_ic *ic, if (!(ic_conf & ic->bit->ic_conf_csc1_en)) { /* need transparent CSC1 conversion */ ret = init_csc(ic, IPUV3_COLORSPACE_RGB, - IPUV3_COLORSPACE_RGB, 0); + IPUV3_COLORSPACE_RGB, encoding, 0); if (ret) goto unlock; } @@ -417,7 +468,7 @@ int ipu_ic_task_graphics_init(struct ipu_ic *ic, ic->g_in_cs = in_g_cs; if (ic->g_in_cs != ic->out_cs) { - ret = init_csc(ic, ic->g_in_cs, ic->out_cs, 1); + ret = init_csc(ic, ic->g_in_cs, ic->out_cs, encoding, 1); if (ret) goto unlock; } @@ -451,6 +502,7 @@ int ipu_ic_task_init_rsc(struct ipu_ic *ic, int out_width, int out_height, enum ipu_color_space in_cs, enum ipu_color_space out_cs, + enum v4l2_ycbcr_encoding encoding, u32 rsc) { struct ipu_ic_priv *priv = ic->priv; @@ -486,7 +538,7 @@ int ipu_ic_task_init_rsc(struct ipu_ic *ic, ic->out_cs = out_cs; if (ic->in_cs != ic->out_cs) { - ret = init_csc(ic, ic->in_cs, ic->out_cs, 0); + ret = init_csc(ic, ic->in_cs, ic->out_cs, encoding, 0); if (ret) goto unlock; } @@ -500,10 +552,11 @@ int ipu_ic_task_init(struct ipu_ic *ic, int in_width, int in_height, int out_width, int out_height, enum ipu_color_space in_cs, - enum ipu_color_space out_cs) + enum ipu_color_space out_cs, + enum v4l2_ycbcr_encoding encoding) { return ipu_ic_task_init_rsc(ic, in_width, in_height, out_width, - out_height, in_cs, out_cs, 0); + out_height, in_cs, out_cs, encoding, 0); } EXPORT_SYMBOL_GPL(ipu_ic_task_init); diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 13103ab86050..8b37daa99f58 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -1358,6 +1358,7 @@ static int convert_start(struct ipu_image_convert_run *run, unsigned int tile) dest_width, dest_height, src_cs, dest_cs, + d_image->base.pix.ycbcr_enc, rsc); if (ret) { dev_err(priv->ipu->dev, "ipu_ic_task_init failed, %d\n", ret); diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index 3637693c2bc8..c86d5275db46 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -484,7 +484,7 @@ static int prp_setup_rotation(struct prp_priv *priv) ret = ipu_ic_task_init(priv->ic, infmt->width, infmt->height, outfmt->height, outfmt->width, - incc->cs, outcc->cs); + incc->cs, outcc->cs, outfmt->ycbcr_enc); if (ret) { v4l2_err(&ic_priv->sd, "ipu_ic_task_init failed, %d\n", ret); goto free_rot1; @@ -587,7 +587,7 @@ static int prp_setup_norotation(struct prp_priv *priv) ret = ipu_ic_task_init(priv->ic, infmt->width, infmt->height, outfmt->width, outfmt->height, - incc->cs, outcc->cs); + incc->cs, outcc->cs, outfmt->ycbcr_enc); if (ret) { v4l2_err(&ic_priv->sd, "ipu_ic_task_init failed, %d\n", ret); return ret; diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index c887f4bee5f8..b19d1e23eece 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h @@ -391,15 +391,18 @@ int ipu_ic_task_init(struct ipu_ic *ic, int in_width, int in_height, int out_width, int out_height, enum ipu_color_space in_cs, - enum ipu_color_space out_cs); + enum ipu_color_space out_cs, + enum v4l2_ycbcr_encoding encoding); int ipu_ic_task_init_rsc(struct ipu_ic *ic, int in_width, int in_height, int out_width, int out_height, enum ipu_color_space in_cs, enum ipu_color_space out_cs, + enum v4l2_ycbcr_encoding encoding, u32 rsc); int ipu_ic_task_graphics_init(struct ipu_ic *ic, enum ipu_color_space in_g_cs, + enum v4l2_ycbcr_encoding encoding, bool galpha_en, u32 galpha, bool colorkey_en, u32 colorkey); void ipu_ic_task_enable(struct ipu_ic *ic); From patchwork Sun Feb 3 19:47:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10794823 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCE5B922 for ; Sun, 3 Feb 2019 19:48:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD16528A75 for ; Sun, 3 Feb 2019 19:48:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BED3029033; Sun, 3 Feb 2019 19:48:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5725D28A75 for ; Sun, 3 Feb 2019 19:48:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727977AbfBCTsS (ORCPT ); Sun, 3 Feb 2019 14:48:18 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39317 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbfBCTsR (ORCPT ); Sun, 3 Feb 2019 14:48:17 -0500 Received: by mail-pf1-f194.google.com with SMTP id r136so5758152pfc.6; Sun, 03 Feb 2019 11:48:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QAoOKPe12ieq5hCZTV0LGSX3PpYeMJKxTVN8PEs4WCw=; b=QN4USepgJsFxKXbhQa3j5yC5Yu2VdaBxLxQFiL8W41K82ckpEZNQuQffVCxwvREPac 8PFMZHAV+s6EqJbQCBDZCeZXJi5Mpn5MFFhkpJp5wpORZn/J1sWuuLvphfd2KfTVVO85 7Om74h3MVSGPR5yvSuhcbioY/EkgE7vDsaTYvgxSwes8gyJ4MiogtbfLBq3xiYsvL+Fa WObx4YmSkcRGl8a4SxJWr+XiGtqQkuCiFMt9pWFy7RQIZl7w4p63nAjhhXkXoho8Epat yUkIbb93zfcw5tiO1S9/ykUtZ0q+lwS1anos5345JEbky988vqjlLrYPoI7RhYw8H7mB 8+Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QAoOKPe12ieq5hCZTV0LGSX3PpYeMJKxTVN8PEs4WCw=; b=lFtQoYS0rg/NdV6lcyuXRYId4jAz6YMd7RR/2xc7vzxdV4jVfAyIJshx3ZH5Zps1Nh QQfcyPIIAFZfoQJEpP9T2KqMsPpRXoTwueWwMuqa0MjGaM8MvKGYK1ujpAeXax+NELzf HrNPCAmdN+HqJucS46SputEMayV1QjhBDaFlolvXT5jw9p8bal7Enor0ZOUUi8545NBK dV1x/SD+6vznWWg3mh0L+z8jTVQQ5/uIio1DzOfV9fiUcTgWSzTD/cDkZO9/mx+BlsG4 slN5uV1/ugEiPYzoZ15nBfHzDOp8K5+D8c2f9kUCuS//I5vMmsxUxPSsMIuzhCBTGTA8 Bf3w== X-Gm-Message-State: AJcUukecIVY8/F2Pt+1pOH5XEL68sEJHI6C5jOAuSn5g6EY/LvvzOjbp WvRBK0xvipV6jAP50FlJvJd6zU53 X-Google-Smtp-Source: ALg8bN5ogv7yA/7prYRqjHeGodXTfL/ZyX2dpwT/TvI9Ep4ubgTYM5jUv4NUkekHqNbBmz7TffeCJA== X-Received: by 2002:a63:eb52:: with SMTP id b18mr42799199pgk.213.1549223296459; Sun, 03 Feb 2019 11:48:16 -0800 (PST) Received: from mappy.world.mentorg.com (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id f67sm23487724pff.29.2019.02.03.11.48.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Feb 2019 11:48:15 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Tim Harvey , Philipp Zabel , Steve Longerbeam , Mauro Carvalho Chehab , Greg Kroah-Hartman , devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] media: imx: Allow BT.709 encoding for IC routes Date: Sun, 3 Feb 2019 11:47:44 -0800 Message-Id: <20190203194744.11546-4-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190203194744.11546-1-slongerbeam@gmail.com> References: <20190203194744.11546-1-slongerbeam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The IC now supports BT.709 Y'CbCr encoding, in addition to existing BT.601 encoding, so allow both, for pipelines that route through the IC. Reported-by: Tim Harvey Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-media-utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 5f110d90a4ef..3512f09fb226 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -571,7 +571,9 @@ void imx_media_fill_default_mbus_fields(struct v4l2_mbus_framefmt *tryfmt, tryfmt->quantization = is_rgb ? V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE; - tryfmt->ycbcr_enc = V4L2_YCBCR_ENC_601; + if (tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_601 && + tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_709) + tryfmt->ycbcr_enc = V4L2_YCBCR_ENC_601; } } EXPORT_SYMBOL_GPL(imx_media_fill_default_mbus_fields);