From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33C34C3F68F for ; Thu, 6 Feb 2020 19:18:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07D8422527 for ; Thu, 6 Feb 2020 19:18:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="tLRb2ev7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728033AbgBFTS5 (ORCPT ); Thu, 6 Feb 2020 14:18:57 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:53712 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728015AbgBFTSw (ORCPT ); Thu, 6 Feb 2020 14:18:52 -0500 Received: by mail-wm1-f67.google.com with SMTP id s10so1209446wmh.3 for ; Thu, 06 Feb 2020 11:18:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fthTlSvdqndaDon1km3RUC8MaAbjzEmDQ4T+qx7kFIg=; b=tLRb2ev7H3keiN0RtJlGvE0tnAN6Lp0TIP6ZilsTp6GnzlFiPUDJeg+GERg0Z3V/+S nH7l+EzoTX7RphmWgUdXloilUCNO7I21UbRnrf150VhhttkCXCZi2+zZ41TWWGKhu+S1 NToFdQtwoZh+53Xq5u3o4U93i9Rrl1i7Xt3PUJwPz5N87x6LBXxTqg8a/dMq0UYmtjiC oSCL1qoIrxk5VMC+8kjkQYRHlKCDu8iHUCbTYPXYxu5bC/0pg3Wxxi8mtbDNUM5FBret rx4NqAz1K3STqXJb3E8584rHGl+wYFMgdQ53v2g3ua+1o2iGrwiuM99y2F92rFFkL5po RGmw== 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:mime-version:content-transfer-encoding; bh=fthTlSvdqndaDon1km3RUC8MaAbjzEmDQ4T+qx7kFIg=; b=FpndNqeJh/I+mIDcfWu2X055LuaEHcR7M2MPWZu2/9FiCvAjVfKAP4R9Pj+CZ/zmnL 59D+aZgdiqD2bj85Et6ZxRJ/j6Grxb3mDJ9davcL60cg09nXYAgfNa1r9whyLUv9ChpZ Ee/SO//Jt39FgRWFHQhF6jPG6xLHWNQNaeuRxpPjxv+ZSwY/0ed8BA8xI/3UNHcnqcin pMX76qLHn4eNAISZ5LXK2p9OcUSgYjfx+06fIjXK+erV30egNE1vu/6EN1OaiawgXWTu daT2A++nO2Y0EiTHi5t1uYgJVK8XzgisTZG0w20elXfwiVTt7hmiROlBr0YCskcZupW8 0lgQ== X-Gm-Message-State: APjAAAVazXapRcmeYB2zq5zEqg3B70/2briUUZE/iawIMxCRVuEera71 7wXOksvENe4dMsSbdxTm+r+mJg== X-Google-Smtp-Source: APXvYqwlQi9eASN0rOmDcfSxEfYRW3a2yYVPMtn73nQR0JHbukVgLpa0edWoF2Pu+QOpxSmJNLlT9w== X-Received: by 2002:a7b:cc6a:: with SMTP id n10mr6240559wmj.170.1581016729357; Thu, 06 Feb 2020 11:18:49 -0800 (PST) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:7d33:17f7:8097:ecc7]) by smtp.gmail.com with ESMTPSA id m3sm272662wrs.53.2020.02.06.11.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 11:18:48 -0800 (PST) From: Neil Armstrong To: a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, boris.brezillon@collabora.com Cc: Neil Armstrong , linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 09/11] drm/meson: venc: add support for YUV420 setup Date: Thu, 6 Feb 2020 20:18:32 +0100 Message-Id: <20200206191834.6125-10-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200206191834.6125-1-narmstrong@baylibre.com> References: <20200206191834.6125-1-narmstrong@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds encoding support for the YUV420 output from the Amlogic Meson SoCs Video Processing Unit to the HDMI Controller. The YUV420 is obtained by generating a YUV444 pixel stream like the classic HDMI display modes, but then the Video Encoder output can be configured to down-sample the YUV444 pixel stream to a YUV420 stream. In addition if pixel stream down-sampling, the Y Cb Cr components must also be mapped differently to align with the HDMI2.0 specifications. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 ++- drivers/gpu/drm/meson/meson_venc.c | 8 +++++--- drivers/gpu/drm/meson/meson_venc.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index 686c47106a18..f5d46d082534 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -772,7 +772,8 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge, DRM_DEBUG_DRIVER("\"%s\" vic %d\n", mode->name, vic); /* VENC + VENC-DVI Mode setup */ - meson_venc_hdmi_mode_set(priv, vic, mode); + meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, false, + VPU_HDMI_OUTPUT_CBYCR); /* VCLK Set clock */ dw_hdmi_set_vclk(dw_hdmi, mode); diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c index a9ab78970bfe..f93c725b6f02 100644 --- a/drivers/gpu/drm/meson/meson_venc.c +++ b/drivers/gpu/drm/meson/meson_venc.c @@ -946,6 +946,8 @@ bool meson_venc_hdmi_venc_repeat(int vic) EXPORT_SYMBOL_GPL(meson_venc_hdmi_venc_repeat); void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, + unsigned int ycrcb_map, + bool yuv420_mode, const struct drm_display_mode *mode) { union meson_hdmi_venc_mode *vmode = NULL; @@ -1528,14 +1530,14 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, if (mode->flags & DRM_MODE_FLAG_PVSYNC) reg |= VPU_HDMI_INV_VSYNC; - /* Output data format: CbYCr */ - reg |= VPU_HDMI_OUTPUT_CBYCR; + /* Output data format */ + reg |= ycrcb_map; /* * Write rate to the async FIFO between VENC and HDMI. * One write every 2 wr_clk. */ - if (venc_repeat) + if (venc_repeat || yuv420_mode) reg |= VPU_HDMI_WR_RATE(2); /* diff --git a/drivers/gpu/drm/meson/meson_venc.h b/drivers/gpu/drm/meson/meson_venc.h index 1abdcbdf51c0..9138255ffc9e 100644 --- a/drivers/gpu/drm/meson/meson_venc.h +++ b/drivers/gpu/drm/meson/meson_venc.h @@ -60,6 +60,8 @@ extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc; void meson_venci_cvbs_mode_set(struct meson_drm *priv, struct meson_cvbs_enci_mode *mode); void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, + unsigned int ycrcb_map, + bool yuv420_mode, const struct drm_display_mode *mode); unsigned int meson_venci_get_field(struct meson_drm *priv); -- 2.22.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DA3DC47409 for ; Thu, 6 Feb 2020 19:19:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 665C32464B for ; Thu, 6 Feb 2020 19:19:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="tLRb2ev7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 665C32464B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D69A96FB29; Thu, 6 Feb 2020 19:18:52 +0000 (UTC) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 47C466FB28 for ; Thu, 6 Feb 2020 19:18:51 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id t23so1228737wmi.1 for ; Thu, 06 Feb 2020 11:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fthTlSvdqndaDon1km3RUC8MaAbjzEmDQ4T+qx7kFIg=; b=tLRb2ev7H3keiN0RtJlGvE0tnAN6Lp0TIP6ZilsTp6GnzlFiPUDJeg+GERg0Z3V/+S nH7l+EzoTX7RphmWgUdXloilUCNO7I21UbRnrf150VhhttkCXCZi2+zZ41TWWGKhu+S1 NToFdQtwoZh+53Xq5u3o4U93i9Rrl1i7Xt3PUJwPz5N87x6LBXxTqg8a/dMq0UYmtjiC oSCL1qoIrxk5VMC+8kjkQYRHlKCDu8iHUCbTYPXYxu5bC/0pg3Wxxi8mtbDNUM5FBret rx4NqAz1K3STqXJb3E8584rHGl+wYFMgdQ53v2g3ua+1o2iGrwiuM99y2F92rFFkL5po RGmw== 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:mime-version:content-transfer-encoding; bh=fthTlSvdqndaDon1km3RUC8MaAbjzEmDQ4T+qx7kFIg=; b=ptZWGVG5wLLQ365cog2DxQhWeqeWcSbMSpWrIJXWXOR03mrAfFq5JdydoiShtYv/3U 9D1TU0NAN+LUvkdN8kTgEpj46Y+oCzoMlQkK0zq1rHOkdW8cgAwXWw0VgUhOraWaHeZq a0mP2YtwAq0p9X2r2pjeMH5yLOP5+2HbtJXMQDcJGqrZ4UTtkCkyQaRRfShSfiI5S5Ic PkXiVzV1IFeLgo4ZuaQ2+t93uOlJt4v8vDtdHXo3V76ARWB9xFZ2mljpgC52P8sL8aUK vEJ0on3OMnSIJm7aj0tPv+XxfxrtlgqacNN7Qe1VIO+XA9l5dvpzzfHsj6RPfpSCGEY4 GZZQ== X-Gm-Message-State: APjAAAU0BzU/D8gWJofMWz59/qjhJ1obACTQeEzeMDOjn5lhJjL+PfOG MVKOmVCDrnyiID1HE8HH5af8ew== X-Google-Smtp-Source: APXvYqwlQi9eASN0rOmDcfSxEfYRW3a2yYVPMtn73nQR0JHbukVgLpa0edWoF2Pu+QOpxSmJNLlT9w== X-Received: by 2002:a7b:cc6a:: with SMTP id n10mr6240559wmj.170.1581016729357; Thu, 06 Feb 2020 11:18:49 -0800 (PST) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:7d33:17f7:8097:ecc7]) by smtp.gmail.com with ESMTPSA id m3sm272662wrs.53.2020.02.06.11.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 11:18:48 -0800 (PST) From: Neil Armstrong To: a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, boris.brezillon@collabora.com Subject: [PATCH v4 09/11] drm/meson: venc: add support for YUV420 setup Date: Thu, 6 Feb 2020 20:18:32 +0100 Message-Id: <20200206191834.6125-10-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200206191834.6125-1-narmstrong@baylibre.com> References: <20200206191834.6125-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Neil Armstrong Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This patch adds encoding support for the YUV420 output from the Amlogic Meson SoCs Video Processing Unit to the HDMI Controller. The YUV420 is obtained by generating a YUV444 pixel stream like the classic HDMI display modes, but then the Video Encoder output can be configured to down-sample the YUV444 pixel stream to a YUV420 stream. In addition if pixel stream down-sampling, the Y Cb Cr components must also be mapped differently to align with the HDMI2.0 specifications. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 ++- drivers/gpu/drm/meson/meson_venc.c | 8 +++++--- drivers/gpu/drm/meson/meson_venc.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index 686c47106a18..f5d46d082534 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -772,7 +772,8 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge, DRM_DEBUG_DRIVER("\"%s\" vic %d\n", mode->name, vic); /* VENC + VENC-DVI Mode setup */ - meson_venc_hdmi_mode_set(priv, vic, mode); + meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, false, + VPU_HDMI_OUTPUT_CBYCR); /* VCLK Set clock */ dw_hdmi_set_vclk(dw_hdmi, mode); diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c index a9ab78970bfe..f93c725b6f02 100644 --- a/drivers/gpu/drm/meson/meson_venc.c +++ b/drivers/gpu/drm/meson/meson_venc.c @@ -946,6 +946,8 @@ bool meson_venc_hdmi_venc_repeat(int vic) EXPORT_SYMBOL_GPL(meson_venc_hdmi_venc_repeat); void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, + unsigned int ycrcb_map, + bool yuv420_mode, const struct drm_display_mode *mode) { union meson_hdmi_venc_mode *vmode = NULL; @@ -1528,14 +1530,14 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, if (mode->flags & DRM_MODE_FLAG_PVSYNC) reg |= VPU_HDMI_INV_VSYNC; - /* Output data format: CbYCr */ - reg |= VPU_HDMI_OUTPUT_CBYCR; + /* Output data format */ + reg |= ycrcb_map; /* * Write rate to the async FIFO between VENC and HDMI. * One write every 2 wr_clk. */ - if (venc_repeat) + if (venc_repeat || yuv420_mode) reg |= VPU_HDMI_WR_RATE(2); /* diff --git a/drivers/gpu/drm/meson/meson_venc.h b/drivers/gpu/drm/meson/meson_venc.h index 1abdcbdf51c0..9138255ffc9e 100644 --- a/drivers/gpu/drm/meson/meson_venc.h +++ b/drivers/gpu/drm/meson/meson_venc.h @@ -60,6 +60,8 @@ extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc; void meson_venci_cvbs_mode_set(struct meson_drm *priv, struct meson_cvbs_enci_mode *mode); void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, + unsigned int ycrcb_map, + bool yuv420_mode, const struct drm_display_mode *mode); unsigned int meson_venci_get_field(struct meson_drm *priv); -- 2.22.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D9BC35247 for ; Thu, 6 Feb 2020 19:19:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB74C21927 for ; Thu, 6 Feb 2020 19:19:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rnvryo9E"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="tLRb2ev7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB74C21927 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O2FJVfGnRnXno5p8ELocfbBoPbyKH7Fhf8JgtxVUIl4=; b=rnvryo9EZvt3Pr HK9bxuVn4KY39F+GJ1YCfuKQSu4FTiDJ0aGDWItSJtzmZT9RVKwfWewsfQbhdRL1mXBwzDP/3BBXH HKyAoDzFdSVg9DptSFh9lG7hQcqRpp5Cd2J/H4yrD59pylhvfpDSyuesqDgHpaJza7KB1giZ/T4M/ fDbCpdTpnnRix5G0IKrzlcvuJAGIK/WQe53AZ1g1Dixi6qbpfbVk2fIcOh4GMqr34+vG9ReLA5cg3 y24joJgMeR+HsRWqyKkHfV8Sd33LLErSSB0W53GtrF935mgdo2CS8jkM0jsDg4Apuc5qchzWvewN7 AuMfl+MpskkjPJnUIHVg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1izmg5-0000Cx-Av; Thu, 06 Feb 2020 19:19:05 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1izmfr-0008PH-9Q for linux-amlogic@lists.infradead.org; Thu, 06 Feb 2020 19:18:52 +0000 Received: by mail-wm1-x344.google.com with SMTP id s10so1209447wmh.3 for ; Thu, 06 Feb 2020 11:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fthTlSvdqndaDon1km3RUC8MaAbjzEmDQ4T+qx7kFIg=; b=tLRb2ev7H3keiN0RtJlGvE0tnAN6Lp0TIP6ZilsTp6GnzlFiPUDJeg+GERg0Z3V/+S nH7l+EzoTX7RphmWgUdXloilUCNO7I21UbRnrf150VhhttkCXCZi2+zZ41TWWGKhu+S1 NToFdQtwoZh+53Xq5u3o4U93i9Rrl1i7Xt3PUJwPz5N87x6LBXxTqg8a/dMq0UYmtjiC oSCL1qoIrxk5VMC+8kjkQYRHlKCDu8iHUCbTYPXYxu5bC/0pg3Wxxi8mtbDNUM5FBret rx4NqAz1K3STqXJb3E8584rHGl+wYFMgdQ53v2g3ua+1o2iGrwiuM99y2F92rFFkL5po RGmw== 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:mime-version:content-transfer-encoding; bh=fthTlSvdqndaDon1km3RUC8MaAbjzEmDQ4T+qx7kFIg=; b=Z01QS0AV7/A0LochhQq3UOavhKOkSsGNQ/EJGa8kRw9myJZLAGQijz/Z5DilFzPy5V bHYCMUqJE9OScK++dceDJcSVrtEt1BprWqsTDb8yld2PyUl3k1QhUbe8s8kPGsX0GXBN kXAAu/1KlqF4JyWeMgYeakV/4JIj5PwW4TpkW/alKbKorIHyja+A8yGqHOoyqhY4JQ1e 1iblTrlT5Y4EcPBCx6DTlBw7PxlcCl+igqEXDfcpghnMEk2v7wLc75Nc1A2eLFlnenSN 7cq/+8xbCdMwgFwf3ptLwIuRADyRV9bShPohvNivyuNqfiGpza4wEK3i9ojZE8yBCcMR HVUA== X-Gm-Message-State: APjAAAWUCd030crzqXvJZe/C2vAY8Ls5ZQR/i3SffY5+DlaWZWRtcJZX iPaBSZTZza+7K2LO39R89Iac9A== X-Google-Smtp-Source: APXvYqwlQi9eASN0rOmDcfSxEfYRW3a2yYVPMtn73nQR0JHbukVgLpa0edWoF2Pu+QOpxSmJNLlT9w== X-Received: by 2002:a7b:cc6a:: with SMTP id n10mr6240559wmj.170.1581016729357; Thu, 06 Feb 2020 11:18:49 -0800 (PST) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:7d33:17f7:8097:ecc7]) by smtp.gmail.com with ESMTPSA id m3sm272662wrs.53.2020.02.06.11.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 11:18:48 -0800 (PST) From: Neil Armstrong To: a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@siol.net, boris.brezillon@collabora.com Subject: [PATCH v4 09/11] drm/meson: venc: add support for YUV420 setup Date: Thu, 6 Feb 2020 20:18:32 +0100 Message-Id: <20200206191834.6125-10-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200206191834.6125-1-narmstrong@baylibre.com> References: <20200206191834.6125-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200206_111851_344802_06E62841 X-CRM114-Status: GOOD ( 12.31 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Neil Armstrong Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org This patch adds encoding support for the YUV420 output from the Amlogic Meson SoCs Video Processing Unit to the HDMI Controller. The YUV420 is obtained by generating a YUV444 pixel stream like the classic HDMI display modes, but then the Video Encoder output can be configured to down-sample the YUV444 pixel stream to a YUV420 stream. In addition if pixel stream down-sampling, the Y Cb Cr components must also be mapped differently to align with the HDMI2.0 specifications. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 ++- drivers/gpu/drm/meson/meson_venc.c | 8 +++++--- drivers/gpu/drm/meson/meson_venc.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index 686c47106a18..f5d46d082534 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -772,7 +772,8 @@ static void meson_venc_hdmi_encoder_mode_set(struct drm_bridge *bridge, DRM_DEBUG_DRIVER("\"%s\" vic %d\n", mode->name, vic); /* VENC + VENC-DVI Mode setup */ - meson_venc_hdmi_mode_set(priv, vic, mode); + meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, false, + VPU_HDMI_OUTPUT_CBYCR); /* VCLK Set clock */ dw_hdmi_set_vclk(dw_hdmi, mode); diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c index a9ab78970bfe..f93c725b6f02 100644 --- a/drivers/gpu/drm/meson/meson_venc.c +++ b/drivers/gpu/drm/meson/meson_venc.c @@ -946,6 +946,8 @@ bool meson_venc_hdmi_venc_repeat(int vic) EXPORT_SYMBOL_GPL(meson_venc_hdmi_venc_repeat); void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, + unsigned int ycrcb_map, + bool yuv420_mode, const struct drm_display_mode *mode) { union meson_hdmi_venc_mode *vmode = NULL; @@ -1528,14 +1530,14 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, if (mode->flags & DRM_MODE_FLAG_PVSYNC) reg |= VPU_HDMI_INV_VSYNC; - /* Output data format: CbYCr */ - reg |= VPU_HDMI_OUTPUT_CBYCR; + /* Output data format */ + reg |= ycrcb_map; /* * Write rate to the async FIFO between VENC and HDMI. * One write every 2 wr_clk. */ - if (venc_repeat) + if (venc_repeat || yuv420_mode) reg |= VPU_HDMI_WR_RATE(2); /* diff --git a/drivers/gpu/drm/meson/meson_venc.h b/drivers/gpu/drm/meson/meson_venc.h index 1abdcbdf51c0..9138255ffc9e 100644 --- a/drivers/gpu/drm/meson/meson_venc.h +++ b/drivers/gpu/drm/meson/meson_venc.h @@ -60,6 +60,8 @@ extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc; void meson_venci_cvbs_mode_set(struct meson_drm *priv, struct meson_cvbs_enci_mode *mode); void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, + unsigned int ycrcb_map, + bool yuv420_mode, const struct drm_display_mode *mode); unsigned int meson_venci_get_field(struct meson_drm *priv); -- 2.22.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic