From patchwork Fri Feb 8 19:28: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: 10804503 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 5FAC213A4 for ; Sat, 9 Feb 2019 15:28:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50D1329875 for ; Sat, 9 Feb 2019 15:28:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 452002A9A2; Sat, 9 Feb 2019 15:28: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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 06B0B29875 for ; Sat, 9 Feb 2019 15:28:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D03346E393; Sat, 9 Feb 2019 15:28:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A6D86E31D for ; Fri, 8 Feb 2019 19:28:53 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id c123so2154324pfb.0 for ; Fri, 08 Feb 2019 11:28:53 -0800 (PST) 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=3w1ZGnPWLWsPLUCMvmcd6xOmljpJ1mYZFLF4k+OJhIU=; b=J45WgmY+QOpWjO8r2nxG9X8YN1I1zr56zJpg0y5EIIr692cEl87pIPkgjfT9MXJwvL Ul/hr5/SaaI35e3gWBGQxslmf9zsyIm5Zs7+sDZLx/xb7M8xzMmOf0JXM2DXlVxSJAZE 1gBoK3NlKd+vmu8NR+YKCt6iNGfZp1Y9k0Cw6MvaKlaflxYrh0lBRYBOTXs2PGVH432F fjobfz+fK17LcYGLUFZA8egLDj5nzEqlQRyAd4cbk8HtzTj8p047NHEUhoNch0tvojSe cSR7cZywtC2cdzXcDOFLvageZd4BFtKbJA08hLI3LVthrZsY1MfhXBJLzOJn/DPTfmsQ U8Vw== X-Gm-Message-State: AHQUAuavoJd9OHqudrH1o8mhuyxTcSrdqeV9rbmywhxDV4A94IF9/4+1 Ue0Q20GkwFHpgLjeYB9YPJI= X-Google-Smtp-Source: AHgI3IZ9xloEX+FlRQlYVbXSRHVwOw/h8kzxAJzttFWEyQVp04aXsA0+Epem0FK2nxKr3nzQkZ/P4w== X-Received: by 2002:a65:4904:: with SMTP id p4mr6947876pgs.384.1549654133128; Fri, 08 Feb 2019 11:28:53 -0800 (PST) Received: from majic.sklembedded.com (c-73-202-231-77.hsd1.ca.comcast.net. [73.202.231.77]) by smtp.googlemail.com with ESMTPSA id e128sm4443129pfe.67.2019.02.08.11.28.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 11:28:52 -0800 (PST) From: Steve Longerbeam To: linux-media@vger.kernel.org Subject: [PATCH v3 2/4] gpu: ipu-v3: ipu-ic: Simplify selection of encoding matrix Date: Fri, 8 Feb 2019 11:28:42 -0800 Message-Id: <20190208192844.13930-3-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190208192844.13930-1-slongerbeam@gmail.com> References: <20190208192844.13930-1-slongerbeam@gmail.com> X-Mailman-Approved-At: Sat, 09 Feb 2019 15:28:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: open list , "open list:DRM DRIVERS FOR FREESCALE IMX" , Steve Longerbeam MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Simplify the selection of the Y'CbCr encoding matrices in init_csc(). A side-effect of this change is that init_csc() now allows YUV->YUV using the identity matrix, intead of returning error. Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-ic.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index 3ef61f0b509b..e459615a49a1 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c @@ -244,16 +244,12 @@ static int init_csc(struct ipu_ic *ic, base = (u32 __iomem *) (priv->tpmem_base + ic->reg->tpmem_csc[csc_index]); - if (inf == IPUV3_COLORSPACE_YUV && outf == IPUV3_COLORSPACE_RGB) + if (inf == outf) + params = &ic_csc_identity; + else if (inf == IPUV3_COLORSPACE_YUV) params = &ic_csc_ycbcr2rgb_bt601; - else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_YUV) + else params = &ic_csc_rgb2ycbcr_bt601; - else if (inf == IPUV3_COLORSPACE_RGB && outf == IPUV3_COLORSPACE_RGB) - params = &ic_csc_identity; - else { - dev_err(priv->ipu->dev, "Unsupported color space conversion\n"); - return -EINVAL; - } /* Cast to unsigned */ c = (const u16 (*)[3])params->coeff;