Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4898926ybb; Tue, 24 Mar 2020 07:21:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtuY8IFKFLbxj2v+L1/5Dz9pQA0MoCDF8BoVR9+r2bSZfG1/X9+W3c7lD2yN9McOdxPW0O7 X-Received: by 2002:aca:3b85:: with SMTP id i127mr1205219oia.123.1585059705436; Tue, 24 Mar 2020 07:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585059705; cv=none; d=google.com; s=arc-20160816; b=wOI7j6Rdd2TMoU/xPMN1wSgFVrHNoOl+BFiB5UvLVhOJJpMtqAXV5vYBUEj4NeOx0J SwCM/ertlMf4jfeNXTWQpBBr0eVmN4BbFBD7fhqYjvapBxAKM1vLhxvperZfZ0v2S6xT +aLAFqB1b4KvbjHTw0cF86QTLY4F4qGmfVX3N4tXgECm5DyGRLIRtu4xDRwxWjPktorg o9BiTrJJmGXJI/HAZeXUU17uDNnc/C6VC7xfAJtgfN9nKy33HgICRB5XW6Fta6mY7/Zs jXSegNyRwOk/W0eYrafKu6aTqWfEIQID6KrPoh2TV99Ke1n9A3/xzzN3uOrtLvYNz7iK rnGA== 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=bQ1QYtO/tMQBwkAJAywEsN2ZoHeRcm9xw/UIMy3tzWs=; b=Nk8XDEF3Eug7w30l+d0UJcZnFsrJNE26wWNqnYYckUsFi8ro2YeKh2NwvhqceEE/Kd RDmjFVB9z5GHe5Yre1u4N3m1VRZcqqK2dzsk+6o1Pcwoz2v1ByHcKlRjSFU7CkWR19RE SD34kdeZU7uf7gcbwazF3dyTO+0VLD2j0s6ehGTL6q7aXpERfOOKSW/EFah2490GtaDZ tgEeiXadsP6CHZpOyZsy9KuVN3FC+5Ejs1QlwriuTdNDtEYRHuek/uZDozEOjyjPNbsK wAobwdHSpxp1KOe0R2oIqfz0QQ6DNZU35Sk0XI2wXBc/nRZMNMMlhyy7mSHFWMljdYw3 DA4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=pwZM4Kzj; 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 k19si2139120otb.279.2020.03.24.07.21.31; Tue, 24 Mar 2020 07:21:45 -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=pwZM4Kzj; 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 S1728056AbgCXOUn (ORCPT + 99 others); Tue, 24 Mar 2020 10:20:43 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54425 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728184AbgCXOUe (ORCPT ); Tue, 24 Mar 2020 10:20:34 -0400 Received: by mail-wm1-f67.google.com with SMTP id c81so3386355wmd.4 for ; Tue, 24 Mar 2020 07:20:32 -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=bQ1QYtO/tMQBwkAJAywEsN2ZoHeRcm9xw/UIMy3tzWs=; b=pwZM4KzjFSd+3f1bt4y1Pqx9BLK42KWI8HI8KK1kJ+uazCIs3hjQ+8ihLR3uLh5/Uy KdHKsY8UvqzvVucEp5OicS06lI/9GzhyLPrW1rZE6bDUZQi8KyzZ0UoUqEW5e9dMxEr7 SUfg2LFhOmL+l5LpQHwZP/kNFAqPg6RjBm8aIOpoyH7Hw1qfNFMRDXRx65KijMlG3Wgw AfJTGfc+JZPOgd9l46jkKMRFUxV0x1SuiTnmm2BzVxHZrae946x+inQJ3t0ueVadx0pO Hi9IkCLSwoimSXbjLX85mhBp5K48JNkgDTGPSyvq/ZKZinVLrfHyT2lXuhs2b4B9JT7n LeTg== 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=bQ1QYtO/tMQBwkAJAywEsN2ZoHeRcm9xw/UIMy3tzWs=; b=mPxPDj66+hYZROsVQX/ISqJ9pgAYBQcN7VmrKsdzDnfQJm/PnJo2ZNT92WLcht3Kyh wgpjtb6Ca5UY9+PZJlKUAiRf8IBvSx2rIL9yeP8htLSBImj36XaXFgNs08PcsucxsV6H z+/CzFi/e+Ptm7ETBTL16iFTDz0qsKa1CdcTLvYELzqFRmmTWHip4JjKiQp4tdswxLWa /sO1DMT4UP6s2eRzgrdmibXHhtwXgFl1BXEOTTzwE1w1UQSLMKFSU16nGxYJ8vtcYuNw x8VcHUFpI9y7zQ5wpz+1dERbUd6TPZCaD3s/Euim0lmHeAbeWVwDeQMchG4zxWLvoeFv ZzsQ== X-Gm-Message-State: ANhLgQ05GSV6DtJs0E8JGrsRx9IFYOTP8kjvNWlSuyBft5UEf2AULcf7 W79IxV2f1Vv4CiCl+wLpRqd9RbKzMsLSzg== X-Received: by 2002:a1c:196:: with SMTP id 144mr6069214wmb.100.1585059631328; Tue, 24 Mar 2020 07:20:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 07:20:30 -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 6/7] drm/meson: overlay: setup overlay for Amlogic FBC Memory Saving mode Date: Tue, 24 Mar 2020 15:20:15 +0100 Message-Id: <20200324142016.31824-7-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 Setup the Amlogic FBC decoder for the VD1 video overlay plane to use a different superblock size for the Memory Saving mode. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_overlay.c | 14 ++++++++++++-- include/uapi/drm/drm_fourcc.h | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c index 51fa038ad5d7..8b9d4984b2a7 100644 --- a/drivers/gpu/drm/meson/meson_overlay.c +++ b/drivers/gpu/drm/meson/meson_overlay.c @@ -487,6 +487,9 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, AFBC_HOLD_LINE_NUM(8) | AFBC_BURST_LEN(2); + if (fb->modifier & DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING) + priv->viu.vd1_afbc_mode |= AFBC_BLK_MEM_MODE; + priv->viu.vd1_afbc_en = 0x1600 | AFBC_DEC_ENABLE; priv->viu.vd1_afbc_conv_ctrl = AFBC_CONV_LBUF_LEN(256); @@ -672,12 +675,17 @@ static void meson_overlay_atomic_update(struct drm_plane *plane, } if (priv->viu.vd1_afbc) { + /* Default mode is 4k per superblock */ + unsigned long block_size = 4096; unsigned long body_size; - /* Default mode is 4k per superblock */ + /* 8bit mem saving mode is 3072bytes per superblock */ + if (priv->viu.vd1_afbc_mode & AFBC_BLK_MEM_MODE) + block_size = 3072; + body_size = (ALIGN(priv->viu.vd1_stride0, 64) / 64) * (ALIGN(priv->viu.vd1_height0, 32) / 32) * - 4096; + block_size; priv->viu.vd1_afbc_body_addr = priv->viu.vd1_addr0 >> 4; @@ -763,6 +771,8 @@ static const uint32_t supported_drm_formats[] = { }; static const uint64_t format_modifiers[] = { + DRM_FORMAT_MOD_AMLOGIC_FBC(DRM_FORMAT_MOD_AMLOGIC_FBC_LAYOUT_BASIC | + DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING), DRM_FORMAT_MOD_AMLOGIC_FBC(DRM_FORMAT_MOD_AMLOGIC_FBC_LAYOUT_BASIC), DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID, diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 84edc5d69613..b49f1d45e1b4 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -840,6 +840,19 @@ extern "C" { */ #define DRM_FORMAT_MOD_AMLOGIC_FBC_LAYOUT_BASIC (1ULL << 0) +/* + * Amlogic FBC Scatter Memory layout + * + * Indicates the header contains IOMMU references to the compressed + * frames content to optimize memory access and layout. + * + * In this mode, only the header memory address is needed, thus the + * content memory organization is tied to the current producer + * execution and cannot be saved/dumped neither transferrable between + * Amlogic SoCs supporting this modifier. + */ +#define DRM_FORMAT_MOD_AMLOGIC_FBC_LAYOUT_SCATTER (2ULL << 0) + /* * Amlogic FBC Layout Options */ @@ -852,7 +865,8 @@ extern "C" { * memory. * * This mode reduces body layout to 3072 bytes per 64x32 superblock with - * the basic layout. + * the basic layout and 3200 bytes per 64x32 superblock combined with + * the scatter layout. */ #define DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING (1ULL << 8) -- 2.22.0