Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4899601ybb; Tue, 24 Mar 2020 07:22:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuOdacdhYY0ZZycJeEqcRqUw34nA7kjczVqLmV8RXfjVSzyYIP6zELFFcgh5EcFPsi3BjCH X-Received: by 2002:a9d:ed5:: with SMTP id 79mr20624823otj.249.1585059753625; Tue, 24 Mar 2020 07:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585059753; cv=none; d=google.com; s=arc-20160816; b=A6MThBtWv7POQMeSJFp4mHCh7Wx9Q2JjspBriXbgBo8s5ggowhXKzWEMfEFeaYI82h Fr1n4xkF0cLBAVBoTqBcVNSD8ROZWJdym3GDCyHwUtJzjZgo8TttIgyFuBCeZkVZrMFE +nbfsUVNezdCRrYbrBanQDIKVE7aqVlJlhomyVRtD7ciNvrIKtEF3QSQmP1k+bxTy9Im TxOzSBYPRyTBAKzin8RRRwfMVSH+5I0ChPmNO2ueGWv7aIWoBEzyhID9Yn4QDg0Xyo/P fy8LaTu9F34cddkceJxl5oo+4D3wdWYAmxFJW73st3ordkOoYZJZ51ce2/2VC0aVaQKE xZwQ== 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=Y1vyhnKYD2Ak0aHlpMHvN10K2oo7WgpQ+3SkrG+Z6j5UXA7P/559ApT8NHBuA/y4BN UZULyzDl+nz3e3W/4yhtEXaTyeCc5KudBoouXQBQT+XLDSIHAJcCWopoPgYqUHKhb5yg jrE2dgr0ZTNVK8RDJQ4lj5RJ7IUzHHirQ1AZ6lZz9+9TpBVduY/X0bfjQResFggDi9AS 3qUYf++iJHKjlBBos4Spl0yGrVsGmAbYXqBbyVsbJZ6Nqk7aWt/pizEw6c+P6S4x7lmS 5daZgYltU67KEdNEk1AGaou2ZtKq3pgJZie+YYdLR9iv4Ow2VZ8plJ/wxYNiHIuiF6os FQ3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hPkWBNBA; 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 b197si8573414oii.198.2020.03.24.07.22.07; Tue, 24 Mar 2020 07:22:33 -0700 (PDT) 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=hPkWBNBA; 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 S1728181AbgCXOUc (ORCPT + 99 others); Tue, 24 Mar 2020 10:20:32 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34560 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728165AbgCXOUa (ORCPT ); Tue, 24 Mar 2020 10:20:30 -0400 Received: by mail-wr1-f66.google.com with SMTP id 65so4967001wrl.1 for ; Tue, 24 Mar 2020 07:20:29 -0700 (PDT) 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=hPkWBNBAcjZXjA9YLmH+GLOpArD8rMGgLDKE4XQP4++kffN4ql79D7aSQVvqXRhjbo Gvn4BXAgo6yeJ6IIYevGN/darj2vn39PZkstifUYbflKrnnbwsIcS2Znk7mRRTPEdvEE PGWmsG96RmOqrxq4C5NSu5FBS//oHtO72WvcUH8nyudwJ+IzhXfKFi6mt61pkpT7Y4MB wi0o1Y4OamkO+xyDR0ti6eJtEqEd+o0n6z1xgKEFXDeoOKOXWjOfB2JLKG3c7tm05Us5 ZUpCG8dbsSnt1DJVAk42LZ1ZMOkq/sOA52jZw8h3S/1BbPupKULJpCF+4gBE6J2CJ/6u ZpQw== 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=WYp9/bJb9mtR67wn6664NBbXrqLFjaOdUb4QJOUDZwEZmbJHoP8uUMBKgH4RcNReHr MI1K6nZXjRR1p5cGjjfdeWUmEKkFCoBe9cbjdhHI+0A5JC1Dff0v0ydexoUhMkp9oOSH hSk0kZE7zFOOhGZ8whJ0wc0MB7VQQZ34Xup/nJEOQivtkieAC4UP4enz6Bp15l0bBPe5 9ipDRWyBtRNb5zl+f6T+t38Mc14Y44LR9ve0eXwxFE9AhON+WpdG6ww8Vk4oEqYC3u+y jFmGKqkEpPOFbTIjbl+zGc1toenQyatEG0nIoI4AwwwONwGzDURtaSXadrn1/MGZeq+2 yPYg== X-Gm-Message-State: ANhLgQ2fR0lws7nIiqoL3jrfFzoaOI4WEczp3ZOUfyhK5nS25f0u3197 myQWy7SaobDmUZDgYZgzpmhzMA== X-Received: by 2002:adf:e70d:: with SMTP id c13mr38003370wrm.306.1585059628744; Tue, 24 Mar 2020 07:20:28 -0700 (PDT) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:5c5f:613e:f775:b6a2]) by smtp.gmail.com with ESMTPSA id o4sm28688472wrp.84.2020.03.24.07.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 07:20:28 -0700 (PDT) From: Neil Armstrong To: daniel@ffwll.ch, dri-devel@lists.freedesktop.org Cc: ppaalanen@gmail.com, mjourdan@baylibre.com, brian.starkey@arm.com, Neil Armstrong , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/7] drm/meson: crtc: handle commit of Amlogic FBC frames Date: Tue, 24 Mar 2020 15:20:13 +0100 Message-Id: <20200324142016.31824-5-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200324142016.31824-1-narmstrong@baylibre.com> References: <20200324142016.31824-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