Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1662371ybv; Fri, 21 Feb 2020 01:13:53 -0800 (PST) X-Google-Smtp-Source: APXvYqw6sJZzw2DUWd2mVFqLNQ6LnAGHTmXFQc83Jx3zkIL1mHrDLJX5QFdUeaMobq3hLsdAyAW4 X-Received: by 2002:a9d:7511:: with SMTP id r17mr26410052otk.154.1582276433486; Fri, 21 Feb 2020 01:13:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582276433; cv=none; d=google.com; s=arc-20160816; b=IfppTeu/zCgbCoCt9nniEr8iFr0gsccQb3zF3ocT8JA6KkjpCISlG/eUXgRRWSzJD4 bYCYRyEwNzIZbuJKxRQFhSvk0TmVwDwrJDMDCCjnXBA1irvJUKX1Ob4vtwE1zvGyThHp n8EmqsOpN2OVp6ieLfHhjd74yPHAW8BUwNzRJ7ovNv6m3wWseyfHaVicBVdPL3e8Q4K2 uizG1t4xOj0lXyisaJmRpDBMIMgB7bjQAt7i0ughTL/frVx+2ZuRJ9GNFX3WyARIJXoL CtT679K9QYF+xUYkX5obXn4ICLkivORIOrQ86twICXVdCYng9uIo65RSJirbeLAI/lJg xB4g== 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=9ZPNY6eETpZNcp3QuqXzHqt5QrKJ6DQWjlcqya6MZlM=; b=pKGU5ZSLh77armYIXNl7ypwlBWBJekputg1CTvZXpBRoXUM+vRe3cfVdGmgkWeXwKy mlSfWIdV98O9hGy7HqcRXBOHY0310Dj1pisY4uDHhrzQoaRLsZ5Y2mCamKQe2qvGLz5s qxF9G8cGK8K4f4fy96yCARW7PSmf0ULidg6uoOec27Bkyyb/v27SOKGGzzMNtNCI5Jb0 SxB7HqpIFDfTHM/AnFkMKnJveZdQuNmqvfgaLR62004zzVQuz7ueAFXX4iJmMUpU1krD yWifyi+IcqysdzqHJbQF+PzcRLJ7moB0XZXCGl31oCJPaWW0wKmzhKtzX8dyjioTmpRq 2ImA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=bmtEkaEZ; 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 u14si1216497otk.178.2020.02.21.01.13.41; Fri, 21 Feb 2020 01:13:53 -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=bmtEkaEZ; 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 S1728158AbgBUJI6 (ORCPT + 99 others); Fri, 21 Feb 2020 04:08:58 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36430 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbgBUJIx (ORCPT ); Fri, 21 Feb 2020 04:08:53 -0500 Received: by mail-wr1-f65.google.com with SMTP id z3so1095188wru.3 for ; Fri, 21 Feb 2020 01:08: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=9ZPNY6eETpZNcp3QuqXzHqt5QrKJ6DQWjlcqya6MZlM=; b=bmtEkaEZQVDuBjGZWI82M+/IsDgVMHVVQjAzBDHWki9q2OsN0culoXtjRzi8Dz/XNh EogN5A1BN0w3+0KFBjUVnsF6korHn+5I2GEdvK9r0fhwRZl2hfOK9W5embpdYRKxQB9p twl7tMUmYXwIc2GF2v1KcITFU9GFjt4aYz6pp8GKs8CnmjZRDNvr6XM7K3CQpPp/Va6t LshrGPJ79xKiYRzVdHK/vreUPm6Ve55M4v4E8dPdBiWn6N7g/ld2kWYNt7TG6u9ZXQqz Qz/oX+weRZr6SkNwgeFsvj8SZVo3/OtQem9zhQa5BD55Aa8JS/CJW2jaiB50AF+k5aTW HPJg== 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=9ZPNY6eETpZNcp3QuqXzHqt5QrKJ6DQWjlcqya6MZlM=; b=rHu74Ac+x5sMf3M4nzR5EwdoJMSYKmRNgcx5IQhqrwqPQVCMWM8mlVJ1kcM0QwbIvv 2fzUUMetIV93xrzvLK9aN/cPpNEOXbkxGlopJchzxW+ab9+dbVEfhmyDstk7iaY//rXn dijwvgv3HXztZR3KuIcOMJIwHfOPZWjS0hLyHciw9xLQNyVOXe2jTKLtp3HIL5n6kQXA abGj0tK84zOxvaYlmnViNqGjJsuPyyL1To+gK90NajQpTL8CCtKZm2kBd+XRQhO0NIBu lqqy2pDBT2aAD0BVUmdBWbJciCxWL+MQ28OjJ31nLx49+boXF3fSK9oPfRp+oSAoGirg EBBw== X-Gm-Message-State: APjAAAUgNXUZj/XEISiu1FhReE8oktAcrefzJyjFK1vYT+VardzIb4gJ SocClXR1UCQ0xbMqOpVWsVJ3+w== X-Received: by 2002:a05:6000:1012:: with SMTP id a18mr46758161wrx.113.1582276129963; Fri, 21 Feb 2020 01:08:49 -0800 (PST) Received: from bender.baylibre.local ([2a01:e35:2ec0:82b0:4ca8:b25b:98e4:858]) by smtp.gmail.com with ESMTPSA id h5sm3173288wmf.8.2020.02.21.01.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 01:08:49 -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: Fri, 21 Feb 2020 10:08:42 +0100 Message-Id: <20200221090845.7397-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200221090845.7397-1-narmstrong@baylibre.com> References: <20200221090845.7397-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 8bc0b31597d8..8a6e87bacadb 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 */ @@ -804,6 +805,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