Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp856152ybv; Thu, 20 Feb 2020 08:28:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxyKunx1LTRRsUZwewsGd9Tla2HgNBLntb+MlNTiAXhJTUNeWmEdZ6WUYK9K0UGtmTax4Xc X-Received: by 2002:a9d:7305:: with SMTP id e5mr23158662otk.64.1582216111496; Thu, 20 Feb 2020 08:28:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582216111; cv=none; d=google.com; s=arc-20160816; b=cFqSo3uDFb86Fh+z/HQOM8AEL1R3S4cewENocwz1F4+D2wVM/iLLZIbBxMvIz9oakP krDb5wuPoK/0XwmwMEAzoWTDBAwI3q0UaRK0KKpuSHfK+XbP4DKaPglapnkIqgEQc5PD R5DScpPPoWnXnaoGkgXaEN9AXN4DCnlega5HWl0HV4Zlw5vHuh6GhUBgGGN4vNVOhuRz YtluYJR65gvFjnvGpXPwGuuSGlWnAdfW3w715d8PY0uRbQK2fbUgp71w2AMQoyY9W4Cs S6Y9EveFoYOpJd6GbYveKT6acwwzuo4MIlmRcExx2qyGtLH/GCnLCtU/7OEoX7gUNOqU k3mA== 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=z4siHNiUQCFqX95yS1MjDYBH29ZOfGjDcY811fsF1lQ=; b=gCcRodjAzKAgOCvDK+IeFHo0Q4So04rRjR2oIT9d1SXdcUVFi+sH71/Hg88tb17imH Ne7meYoMWwj57NXkBm7AEEiT+wN35SFXnkEdi9QGrzyf8gB+CV/C3aNB/5JvxOKpVs9M Te93viD+P+7dUeshKutOaEjCDCZLuycfViIKhBtesKwDx48WXYGKVJm+t8kKNnWmZ04u eibwrkaLWJQtVc8m0OECcL7qB1NA2cp+fbRp6MBAL9ApLrQSG6MchBPQovaUCdZpqZNW +D2G833AEgQUw6xFz2bKv6CWRZkjzkmjvdPyi/wuUO+kjz7btkWMbi1OtjfPxoLY9tZq r9JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hUcv84nV; 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 s22si2860111oij.35.2020.02.20.08.28.18; Thu, 20 Feb 2020 08:28:31 -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=hUcv84nV; 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 S1728598AbgBTQ2H (ORCPT + 99 others); Thu, 20 Feb 2020 11:28:07 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37871 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728351AbgBTQ2G (ORCPT ); Thu, 20 Feb 2020 11:28:06 -0500 Received: by mail-wm1-f68.google.com with SMTP id a6so2744504wme.2 for ; Thu, 20 Feb 2020 08:28:03 -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=z4siHNiUQCFqX95yS1MjDYBH29ZOfGjDcY811fsF1lQ=; b=hUcv84nVgsJ3vp8Wn9xxaPUwSALsdcNkdFh/h89t/aV6g9hwU70NICdzTZ9qzGiU85 NLNkxtKLQT0+Fe5YKcmrHzDTQ/ZjpkxJH2aPrF7UooK1q+4gte0eZb8pm9lJKgiZUd73 Y1tzJjOkMIINcv0qS4xTXH2xibQh4647jDJTGaXZeUszyn7Lw+MjAFXz7SMVqDImWwEJ 7KYrSncFiF37t/a/dQKQL3yopFr3kSEAzacS7WERjheWPcblKomLVNYRIUHTS/FyUbEA wBpsdhCBTrXITUcadU6E2NhVltC9WN/IsxRwxPIJQ2wfWvR7JeQOZPBUuUnxTS2M01Ey dvfg== 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=z4siHNiUQCFqX95yS1MjDYBH29ZOfGjDcY811fsF1lQ=; b=i5lYohw6zrzmbZmGiygL0m3CQA5CgY7QKc8b929a+2U4Ofkr1inGY3y5pb36GcAY3d XCveI0zImJIs2vsctURoZeAgfZq0MlNMNRMVGNt54nF8fCr1ggyLHTFHg9fj7FE/E59o U+lljnIvdo/Kobf5RF6U9kJu0XmBX11AqASDjfFhNZ5EszS8zfEadq2Q+cybpQtu2u2Y uq36zDGt0/Ja5RoorFoUFmL0204PqMhoZXiD1SAzpKR513Tg6ygkXaT29Draj/z1Vnzm PWtvpFTlYuJwEMikdpL6Lf/mc5TGDDc/e1CTm3HDx/A+iUBENyXNJGsjcGlQfXRa1/aP xupQ== X-Gm-Message-State: APjAAAWP4gVWUrQ57WU2844QUC2Ri09mOFtG5D5lp04EiwCvxMug2WMt CxS048Sja7/cISNauDEOoPzhxQ== X-Received: by 2002:a1c:4e02:: with SMTP id g2mr5506842wmh.131.1582216081787; Thu, 20 Feb 2020 08:28:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 08:28:00 -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 1/4] drm/fourcc: Add modifier definitions for describing Amlogic Video Framebuffer Compression Date: Thu, 20 Feb 2020 17:27:55 +0100 Message-Id: <20200220162758.13524-2-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 Amlogic uses a proprietary lossless image compression protocol and format for their hardware video codec accelerators, either video decoders or video input encoders. It considerably reduces memory bandwidth while writing and reading frames in memory. The underlying storage is considered to be 3 components, 8bit or 10-bit per component, YCbCr 420, single plane : - DRM_FORMAT_YUV420_8BIT - DRM_FORMAT_YUV420_10BIT This modifier will be notably added to DMA-BUF frames imported from the V4L2 Amlogic VDEC decoder. At least two options are supported : - Scatter mode: the buffer is filled with a IOMMU scatter table referring to the encoder current memory layout. This mode if more efficient in terms of memory allocation but frames are not dumpable and only valid during until the buffer is freed and back in control of the encoder - Memory saving: when the pixel bpp is 8b, the size of the superblock can be reduced, thus saving memory. Signed-off-by: Neil Armstrong --- include/uapi/drm/drm_fourcc.h | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 5ba481f49931..ad58f2a92669 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -309,6 +309,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 #define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 +#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a /* add more to the end as needed */ @@ -791,6 +792,61 @@ extern "C" { */ #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) +/* + * Amlogic Video Framebuffer Compression modifiers + * + * Amlogic uses a proprietary lossless image compression protocol and format + * for their hardware video codec accelerators, either video decoders or + * video input encoders. + * + * It considerably reduces memory bandwidth while writing and reading + * frames in memory. + * Implementation details may be platform and SoC specific, and shared + * between the producer and the decoder on the same platform. + * + * The underlying storage is considered to be 3 components, 8bit or 10-bit + * per component YCbCr 420, single plane : + * - DRM_FORMAT_YUV420_8BIT + * - DRM_FORMAT_YUV420_10BIT + * + * The classic memory storage is composed of: + * - a body content organized in 64x32 superblocks with 4096 bytes per + * superblock in default mode. + * - a 32 bytes per 128x64 header block + */ +#define DRM_FORMAT_MOD_AMLOGIC_FBC_DEFAULT fourcc_mod_code(AMLOGIC, 0) + +/* + * Amlogic Video Framebuffer Compression Options + * + * Two optional features are available which may not supported/used on every + * SoCs and Compressed Framebuffer producers. + */ +#define DRM_FORMAT_MOD_AMLOGIC_FBC(__modes) fourcc_mod_code(AMLOGIC, __modes) + +/* + * 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. + */ +#define DRM_FORMAT_MOD_AMLOGIC_FBC_SCATTER (1ULL << 0) + +/* + * Amlogic FBC Memory Saving mode + * + * Indicates the storage is packed when pixel size is multiple of word + * boudaries, i.e. 8bit should be stored in this mode to save allocation + * memory. + * + * This mode reduces body layout to 3072 bytes per 64x32 superblock and + * 3200 bytes per 64x32 superblock combined with scatter mode. + */ +#define DRM_FORMAT_MOD_AMLOGIC_FBC_MEM_SAVING (1ULL << 1) + #if defined(__cplusplus) } #endif -- 2.22.0