Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp856686ybv; Thu, 20 Feb 2020 08:29:04 -0800 (PST) X-Google-Smtp-Source: APXvYqw+5uoDkfYCb3Hu/dJi/7E05Ugosj8eGbTjpUc8fkK3xDS1dGLb6nUUpTEYLmjWpUQvxvxU X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr2719270oig.81.1582216144192; Thu, 20 Feb 2020 08:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582216144; cv=none; d=google.com; s=arc-20160816; b=tltsu9KcPEbRXTb+iMZn1Kqe8yZjswUBW4VKLmZ/LDszurpDcA652OToXO6eTP63uq YwkmN4M9DSDgURF2feDfkAGkRoll4V6hSNCc8cavu2pro8ISuqV/2RGvokvpnyU1aemO 5ztxLragMbzyCJluToOPFBcyJDDHSdw99tZFgmcbZn4/X6kIFC1JXkvw2CFh2lLu4+O2 P2EIDE5/QkYcmb3ZaYmSsGyr5TFmrHGwUwR5pDwPG1Jh4bnF11hTil5vu+w1mCpULy31 x8hAV2+6Ba/MqehLPrLF0PjQbZUEpYCW10D+Yiv6oM11oBc7+7lB4rG31x/sGUjXaCf9 0mgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ISULOS1UCLwuUa+INumyziDbxt+K8PYtRxwNxV5Yeuk=; b=RCfBtAo1PwVVO7ViqwWCqOkBW1zPJQrrvW3sbgMEtZgPQPD2eS2m+dFEb7h/Xrhgqd jv1ZHeT9TTxhHw9ChM7+f2f5Vr08DXHzaBRY9SWYF2XrLi2+y4dos+AxS7xt0r8Xq1JN 137qtcQS+kE2cpGCb76dr1/LFtlzvFJALku4bkftolarQqcJoDTjabAwTQO7fk0S49OV zf1aPBrE1uUx9+sDh6mJZM3B7+uYAOkEeCkjpBZN0s5OhKnYldD0es04o+xNpd6675AV iO0DWtn8APWzzpdzmgpXZWWqAk8Ub1irw8VqKOlzhE6nncdo0ccPgf/WeUcB7qHfGUU8 LsEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WnGMAtLQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si2184022otd.219.2020.02.20.08.28.51; Thu, 20 Feb 2020 08:29:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WnGMAtLQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728651AbgBTQ2J (ORCPT + 99 others); Thu, 20 Feb 2020 11:28:09 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44010 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728474AbgBTQ2H (ORCPT ); Thu, 20 Feb 2020 11:28:07 -0500 Received: by mail-wr1-f68.google.com with SMTP id r11so5294940wrq.10 for ; Thu, 20 Feb 2020 08:28:06 -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=ISULOS1UCLwuUa+INumyziDbxt+K8PYtRxwNxV5Yeuk=; b=WnGMAtLQ1BCCTXE8agBqLSu7tjqnUQwlOXNdcOZG2WTgrTtohRfd8yhgJCyiPDgKQI wN08QRu1F3FR90NjleYoaYGezlCcIhHHkoehPdMnvONU9rvphpFYJ+Fxd3To2wGYSaE3 vzBlUxcpKnIT9oWUz5obkww8uadktK+qcroSva/9Xd8zusJ+dojUTKEVlaua2E4SxJ/F XelhtSVlFvyc3XNghhxDOp8lvp6uAJjYi7H5HeYBWdYkiv58+PbQvOWuENMsj/L9QCNf RaNPJAReYGQB11JHGItGH5CFvDsjLMZpc793/9S61khy8uFo3wndq2QJO4xwoneLytsM 6e9g== 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=ISULOS1UCLwuUa+INumyziDbxt+K8PYtRxwNxV5Yeuk=; b=sM3zMROyKCP2SMIsEMGSqiBZcLwT0A1fIeR4J1WjfiXMSjvwvCTePJUcxGtNiSWp8y Pz2/tAFXKbIc5DS8NQFbekEE4t5lG7d8HmwWjoPowYjy7Ow4wnhCRZD572Dctp2+r/AZ iWBIMEAuR7bivMGOui7HSdcC2+gyhy/Lv36SZC1LisqJNu0v2C+Dnd2Gh57Jvf44nHpX eSATNmDQOwHig0WRvyP+2jr3NKQ8vmp+VwWkszNENd7gNgwZHunfO1RxlDtEz32p1YE6 Rsuh5Cx8zoaPbaix9gmISHw7/zmUTkn3sKyJZOzq43GKn4/Hb5erXHJUcQAHFB3QzEDK VyGw== X-Gm-Message-State: APjAAAXAeogbqfAmv+ZAK0UeeXgcYKVNhB96AQ4l/dG45h2IGVWgLFwU shencYYvUjBgSycD0uCAT8zZ4g== X-Received: by 2002:a05:6000:1201:: with SMTP id e1mr43848428wrx.386.1582216085318; Thu, 20 Feb 2020 08:28:05 -0800 (PST) Received: from bender.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id c15sm104164wrt.1.2020.02.20.08.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 08:28:04 -0800 (PST) From: Neil Armstrong To: daniel@ffwll.ch, dri-devel@lists.freedesktop.org Cc: Neil Armstrong , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] drm/meson: crtc: handle commit of Amlogic FBC frames Date: Thu, 20 Feb 2020 17:27:58 +0100 Message-Id: <20200220162758.13524-5-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200220162758.13524-1-narmstrong@baylibre.com> References: <20200220162758.13524-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 Since the VD1 Amlogic FBC decoder is now configured by the overlay driver, commit the right registers to decode the Amlogic FBC frame. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_crtc.c | 118 +++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c index e66b6271ff58..d6dcfd654e9c 100644 --- a/drivers/gpu/drm/meson/meson_crtc.c +++ b/drivers/gpu/drm/meson/meson_crtc.c @@ -291,6 +291,10 @@ static void meson_crtc_enable_vd1(struct meson_drm *priv) VPP_VD1_PREBLEND | VPP_VD1_POSTBLEND | VPP_COLOR_MNG_ENABLE, priv->io_base + _REG(VPP_MISC)); + + writel_bits_relaxed(VIU_CTRL0_AFBC_TO_VD1, + priv->viu.vd1_afbc ? VIU_CTRL0_AFBC_TO_VD1 : 0, + priv->io_base + _REG(VIU_MISC_CTRL0)); } static void meson_g12a_crtc_enable_vd1(struct meson_drm *priv) @@ -300,6 +304,10 @@ static void meson_g12a_crtc_enable_vd1(struct meson_drm *priv) VD_BLEND_POSTBLD_SRC_VD1 | VD_BLEND_POSTBLD_PREMULT_EN, priv->io_base + _REG(VD1_BLEND_SRC_CTRL)); + + writel_relaxed(priv->viu.vd1_afbc ? + (VD1_AXI_SEL_AFBC | AFBC_VD1_SEL) : 0, + priv->io_base + _REG(VD1_AFBCD0_MISC_CTRL)); } void meson_crtc_irq(struct meson_drm *priv) @@ -383,36 +391,86 @@ void meson_crtc_irq(struct meson_drm *priv) /* Update the VD1 registers */ if (priv->viu.vd1_enabled && priv->viu.vd1_commit) { - switch (priv->viu.vd1_planes) { - case 3: - meson_canvas_config(priv->canvas, - priv->canvas_id_vd1_2, - priv->viu.vd1_addr2, - priv->viu.vd1_stride2, - priv->viu.vd1_height2, - MESON_CANVAS_WRAP_NONE, - MESON_CANVAS_BLKMODE_LINEAR, - MESON_CANVAS_ENDIAN_SWAP64); - /* fallthrough */ - case 2: - meson_canvas_config(priv->canvas, - priv->canvas_id_vd1_1, - priv->viu.vd1_addr1, - priv->viu.vd1_stride1, - priv->viu.vd1_height1, - MESON_CANVAS_WRAP_NONE, - MESON_CANVAS_BLKMODE_LINEAR, - MESON_CANVAS_ENDIAN_SWAP64); - /* fallthrough */ - case 1: - meson_canvas_config(priv->canvas, - priv->canvas_id_vd1_0, - priv->viu.vd1_addr0, - priv->viu.vd1_stride0, - priv->viu.vd1_height0, - MESON_CANVAS_WRAP_NONE, - MESON_CANVAS_BLKMODE_LINEAR, - MESON_CANVAS_ENDIAN_SWAP64); + if (priv->viu.vd1_afbc) { + writel_relaxed(priv->viu.vd1_afbc_head_addr, + priv->io_base + + _REG(AFBC_HEAD_BADDR)); + writel_relaxed(priv->viu.vd1_afbc_body_addr, + priv->io_base + + _REG(AFBC_BODY_BADDR)); + writel_relaxed(priv->viu.vd1_afbc_en, + priv->io_base + + _REG(AFBC_ENABLE)); + writel_relaxed(priv->viu.vd1_afbc_mode, + priv->io_base + + _REG(AFBC_MODE)); + writel_relaxed(priv->viu.vd1_afbc_size_in, + priv->io_base + + _REG(AFBC_SIZE_IN)); + writel_relaxed(priv->viu.vd1_afbc_dec_def_color, + priv->io_base + + _REG(AFBC_DEC_DEF_COLOR)); + writel_relaxed(priv->viu.vd1_afbc_conv_ctrl, + priv->io_base + + _REG(AFBC_CONV_CTRL)); + writel_relaxed(priv->viu.vd1_afbc_size_out, + priv->io_base + + _REG(AFBC_SIZE_OUT)); + writel_relaxed(priv->viu.vd1_afbc_vd_cfmt_ctrl, + priv->io_base + + _REG(AFBC_VD_CFMT_CTRL)); + writel_relaxed(priv->viu.vd1_afbc_vd_cfmt_w, + priv->io_base + + _REG(AFBC_VD_CFMT_W)); + writel_relaxed(priv->viu.vd1_afbc_mif_hor_scope, + priv->io_base + + _REG(AFBC_MIF_HOR_SCOPE)); + writel_relaxed(priv->viu.vd1_afbc_mif_ver_scope, + priv->io_base + + _REG(AFBC_MIF_VER_SCOPE)); + writel_relaxed(priv->viu.vd1_afbc_pixel_hor_scope, + priv->io_base+ + _REG(AFBC_PIXEL_HOR_SCOPE)); + writel_relaxed(priv->viu.vd1_afbc_pixel_ver_scope, + priv->io_base + + _REG(AFBC_PIXEL_VER_SCOPE)); + writel_relaxed(priv->viu.vd1_afbc_vd_cfmt_h, + priv->io_base + + _REG(AFBC_VD_CFMT_H)); + } else { + switch (priv->viu.vd1_planes) { + case 3: + meson_canvas_config(priv->canvas, + priv->canvas_id_vd1_2, + priv->viu.vd1_addr2, + priv->viu.vd1_stride2, + priv->viu.vd1_height2, + MESON_CANVAS_WRAP_NONE, + MESON_CANVAS_BLKMODE_LINEAR, + MESON_CANVAS_ENDIAN_SWAP64); + /* fallthrough */ + case 2: + meson_canvas_config(priv->canvas, + priv->canvas_id_vd1_1, + priv->viu.vd1_addr1, + priv->viu.vd1_stride1, + priv->viu.vd1_height1, + MESON_CANVAS_WRAP_NONE, + MESON_CANVAS_BLKMODE_LINEAR, + MESON_CANVAS_ENDIAN_SWAP64); + /* fallthrough */ + case 1: + meson_canvas_config(priv->canvas, + priv->canvas_id_vd1_0, + priv->viu.vd1_addr0, + priv->viu.vd1_stride0, + priv->viu.vd1_height0, + MESON_CANVAS_WRAP_NONE, + MESON_CANVAS_BLKMODE_LINEAR, + MESON_CANVAS_ENDIAN_SWAP64); + } + + writel_relaxed(0, priv->io_base + _REG(AFBC_ENABLE)); } writel_relaxed(priv->viu.vd1_if0_gen_reg, -- 2.22.0