162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright © 2014 Broadcom 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * The above copyright notice and this permission notice (including the next 1262306a36Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 1362306a36Sopenharmony_ci * Software. 1462306a36Sopenharmony_ci * 1562306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1662306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1762306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1862306a36Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1962306a36Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2062306a36Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 2162306a36Sopenharmony_ci * IN THE SOFTWARE. 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#ifndef VC4_PACKET_H 2562306a36Sopenharmony_ci#define VC4_PACKET_H 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci#include "vc4_regs.h" /* for VC4_MASK, VC4_GET_FIELD, VC4_SET_FIELD */ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_cienum vc4_packet { 3062306a36Sopenharmony_ci VC4_PACKET_HALT = 0, 3162306a36Sopenharmony_ci VC4_PACKET_NOP = 1, 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci VC4_PACKET_FLUSH = 4, 3462306a36Sopenharmony_ci VC4_PACKET_FLUSH_ALL = 5, 3562306a36Sopenharmony_ci VC4_PACKET_START_TILE_BINNING = 6, 3662306a36Sopenharmony_ci VC4_PACKET_INCREMENT_SEMAPHORE = 7, 3762306a36Sopenharmony_ci VC4_PACKET_WAIT_ON_SEMAPHORE = 8, 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci VC4_PACKET_BRANCH = 16, 4062306a36Sopenharmony_ci VC4_PACKET_BRANCH_TO_SUB_LIST = 17, 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci VC4_PACKET_STORE_MS_TILE_BUFFER = 24, 4362306a36Sopenharmony_ci VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF = 25, 4462306a36Sopenharmony_ci VC4_PACKET_STORE_FULL_RES_TILE_BUFFER = 26, 4562306a36Sopenharmony_ci VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER = 27, 4662306a36Sopenharmony_ci VC4_PACKET_STORE_TILE_BUFFER_GENERAL = 28, 4762306a36Sopenharmony_ci VC4_PACKET_LOAD_TILE_BUFFER_GENERAL = 29, 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci VC4_PACKET_GL_INDEXED_PRIMITIVE = 32, 5062306a36Sopenharmony_ci VC4_PACKET_GL_ARRAY_PRIMITIVE = 33, 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci VC4_PACKET_COMPRESSED_PRIMITIVE = 48, 5362306a36Sopenharmony_ci VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE = 49, 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci VC4_PACKET_PRIMITIVE_LIST_FORMAT = 56, 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci VC4_PACKET_GL_SHADER_STATE = 64, 5862306a36Sopenharmony_ci VC4_PACKET_NV_SHADER_STATE = 65, 5962306a36Sopenharmony_ci VC4_PACKET_VG_SHADER_STATE = 66, 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci VC4_PACKET_CONFIGURATION_BITS = 96, 6262306a36Sopenharmony_ci VC4_PACKET_FLAT_SHADE_FLAGS = 97, 6362306a36Sopenharmony_ci VC4_PACKET_POINT_SIZE = 98, 6462306a36Sopenharmony_ci VC4_PACKET_LINE_WIDTH = 99, 6562306a36Sopenharmony_ci VC4_PACKET_RHT_X_BOUNDARY = 100, 6662306a36Sopenharmony_ci VC4_PACKET_DEPTH_OFFSET = 101, 6762306a36Sopenharmony_ci VC4_PACKET_CLIP_WINDOW = 102, 6862306a36Sopenharmony_ci VC4_PACKET_VIEWPORT_OFFSET = 103, 6962306a36Sopenharmony_ci VC4_PACKET_Z_CLIPPING = 104, 7062306a36Sopenharmony_ci VC4_PACKET_CLIPPER_XY_SCALING = 105, 7162306a36Sopenharmony_ci VC4_PACKET_CLIPPER_Z_SCALING = 106, 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci VC4_PACKET_TILE_BINNING_MODE_CONFIG = 112, 7462306a36Sopenharmony_ci VC4_PACKET_TILE_RENDERING_MODE_CONFIG = 113, 7562306a36Sopenharmony_ci VC4_PACKET_CLEAR_COLORS = 114, 7662306a36Sopenharmony_ci VC4_PACKET_TILE_COORDINATES = 115, 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci /* Not an actual hardware packet -- this is what we use to put 7962306a36Sopenharmony_ci * references to GEM bos in the command stream, since we need the u32 8062306a36Sopenharmony_ci * int the actual address packet in order to store the offset from the 8162306a36Sopenharmony_ci * start of the BO. 8262306a36Sopenharmony_ci */ 8362306a36Sopenharmony_ci VC4_PACKET_GEM_HANDLES = 254, 8462306a36Sopenharmony_ci} __attribute__ ((__packed__)); 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define VC4_PACKET_HALT_SIZE 1 8762306a36Sopenharmony_ci#define VC4_PACKET_NOP_SIZE 1 8862306a36Sopenharmony_ci#define VC4_PACKET_FLUSH_SIZE 1 8962306a36Sopenharmony_ci#define VC4_PACKET_FLUSH_ALL_SIZE 1 9062306a36Sopenharmony_ci#define VC4_PACKET_START_TILE_BINNING_SIZE 1 9162306a36Sopenharmony_ci#define VC4_PACKET_INCREMENT_SEMAPHORE_SIZE 1 9262306a36Sopenharmony_ci#define VC4_PACKET_WAIT_ON_SEMAPHORE_SIZE 1 9362306a36Sopenharmony_ci#define VC4_PACKET_BRANCH_SIZE 5 9462306a36Sopenharmony_ci#define VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE 5 9562306a36Sopenharmony_ci#define VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE 1 9662306a36Sopenharmony_ci#define VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF_SIZE 1 9762306a36Sopenharmony_ci#define VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE 5 9862306a36Sopenharmony_ci#define VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE 5 9962306a36Sopenharmony_ci#define VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE 7 10062306a36Sopenharmony_ci#define VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE 7 10162306a36Sopenharmony_ci#define VC4_PACKET_GL_INDEXED_PRIMITIVE_SIZE 14 10262306a36Sopenharmony_ci#define VC4_PACKET_GL_ARRAY_PRIMITIVE_SIZE 10 10362306a36Sopenharmony_ci#define VC4_PACKET_COMPRESSED_PRIMITIVE_SIZE 1 10462306a36Sopenharmony_ci#define VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE_SIZE 1 10562306a36Sopenharmony_ci#define VC4_PACKET_PRIMITIVE_LIST_FORMAT_SIZE 2 10662306a36Sopenharmony_ci#define VC4_PACKET_GL_SHADER_STATE_SIZE 5 10762306a36Sopenharmony_ci#define VC4_PACKET_NV_SHADER_STATE_SIZE 5 10862306a36Sopenharmony_ci#define VC4_PACKET_VG_SHADER_STATE_SIZE 5 10962306a36Sopenharmony_ci#define VC4_PACKET_CONFIGURATION_BITS_SIZE 4 11062306a36Sopenharmony_ci#define VC4_PACKET_FLAT_SHADE_FLAGS_SIZE 5 11162306a36Sopenharmony_ci#define VC4_PACKET_POINT_SIZE_SIZE 5 11262306a36Sopenharmony_ci#define VC4_PACKET_LINE_WIDTH_SIZE 5 11362306a36Sopenharmony_ci#define VC4_PACKET_RHT_X_BOUNDARY_SIZE 3 11462306a36Sopenharmony_ci#define VC4_PACKET_DEPTH_OFFSET_SIZE 5 11562306a36Sopenharmony_ci#define VC4_PACKET_CLIP_WINDOW_SIZE 9 11662306a36Sopenharmony_ci#define VC4_PACKET_VIEWPORT_OFFSET_SIZE 5 11762306a36Sopenharmony_ci#define VC4_PACKET_Z_CLIPPING_SIZE 9 11862306a36Sopenharmony_ci#define VC4_PACKET_CLIPPER_XY_SCALING_SIZE 9 11962306a36Sopenharmony_ci#define VC4_PACKET_CLIPPER_Z_SCALING_SIZE 9 12062306a36Sopenharmony_ci#define VC4_PACKET_TILE_BINNING_MODE_CONFIG_SIZE 16 12162306a36Sopenharmony_ci#define VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE 11 12262306a36Sopenharmony_ci#define VC4_PACKET_CLEAR_COLORS_SIZE 14 12362306a36Sopenharmony_ci#define VC4_PACKET_TILE_COORDINATES_SIZE 3 12462306a36Sopenharmony_ci#define VC4_PACKET_GEM_HANDLES_SIZE 9 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci/* Number of multisamples supported. */ 12762306a36Sopenharmony_ci#define VC4_MAX_SAMPLES 4 12862306a36Sopenharmony_ci/* Size of a full resolution color or Z tile buffer load/store. */ 12962306a36Sopenharmony_ci#define VC4_TILE_BUFFER_SIZE (64 * 64 * 4) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci/** @{ 13262306a36Sopenharmony_ci * Bits used by packets like VC4_PACKET_STORE_TILE_BUFFER_GENERAL and 13362306a36Sopenharmony_ci * VC4_PACKET_TILE_RENDERING_MODE_CONFIG. 13462306a36Sopenharmony_ci*/ 13562306a36Sopenharmony_ci#define VC4_TILING_FORMAT_LINEAR 0 13662306a36Sopenharmony_ci#define VC4_TILING_FORMAT_T 1 13762306a36Sopenharmony_ci#define VC4_TILING_FORMAT_LT 2 13862306a36Sopenharmony_ci/** @} */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci/** @{ 14162306a36Sopenharmony_ci * 14262306a36Sopenharmony_ci * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and 14362306a36Sopenharmony_ci * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. 14462306a36Sopenharmony_ci */ 14562306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_EOF BIT(3) 14662306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL BIT(2) 14762306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS BIT(1) 14862306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR BIT(0) 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/** @{ 15162306a36Sopenharmony_ci * 15262306a36Sopenharmony_ci * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and 15362306a36Sopenharmony_ci * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER. 15462306a36Sopenharmony_ci */ 15562306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_EOF BIT(3) 15662306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL BIT(2) 15762306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS BIT(1) 15862306a36Sopenharmony_ci#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR BIT(0) 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci/** @{ 16162306a36Sopenharmony_ci * 16262306a36Sopenharmony_ci * byte 2 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and 16362306a36Sopenharmony_ci * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL (low bits of the address) 16462306a36Sopenharmony_ci */ 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_EOF BIT(3) 16762306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK BIT(2) 16862306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS BIT(1) 16962306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR BIT(0) 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci/** @} */ 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci/** @{ 17462306a36Sopenharmony_ci * 17562306a36Sopenharmony_ci * byte 0-1 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and 17662306a36Sopenharmony_ci * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL 17762306a36Sopenharmony_ci */ 17862306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR BIT(15) 17962306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR BIT(14) 18062306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR BIT(13) 18162306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP BIT(12) 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK VC4_MASK(9, 8) 18462306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT 8 18562306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_RGBA8888 0 18662306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_BGR565_DITHER 1 18762306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_BGR565 2 18862306a36Sopenharmony_ci/** @} */ 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci/** @{ 19162306a36Sopenharmony_ci * 19262306a36Sopenharmony_ci * byte 0 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and 19362306a36Sopenharmony_ci * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL 19462306a36Sopenharmony_ci */ 19562306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_MODE_MASK VC4_MASK(7, 6) 19662306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_MODE_SHIFT 6 19762306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_MODE_SAMPLE0 (0 << 6) 19862306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X4 (1 << 6) 19962306a36Sopenharmony_ci#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X16 (2 << 6) 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci/** The values of the field are VC4_TILING_FORMAT_* */ 20262306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_TILING_MASK VC4_MASK(5, 4) 20362306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_TILING_SHIFT 4 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK VC4_MASK(2, 0) 20662306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_SHIFT 0 20762306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_NONE 0 20862306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_COLOR 1 20962306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_ZS 2 21062306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_Z 3 21162306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_VG_MASK 4 21262306a36Sopenharmony_ci#define VC4_LOADSTORE_TILE_BUFFER_FULL 5 21362306a36Sopenharmony_ci/** @} */ 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci#define VC4_INDEX_BUFFER_U8 (0 << 4) 21662306a36Sopenharmony_ci#define VC4_INDEX_BUFFER_U16 (1 << 4) 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci/* This flag is only present in NV shader state. */ 21962306a36Sopenharmony_ci#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS BIT(3) 22062306a36Sopenharmony_ci#define VC4_SHADER_FLAG_ENABLE_CLIPPING BIT(2) 22162306a36Sopenharmony_ci#define VC4_SHADER_FLAG_VS_POINT_SIZE BIT(1) 22262306a36Sopenharmony_ci#define VC4_SHADER_FLAG_FS_SINGLE_THREAD BIT(0) 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci/** @{ byte 2 of config bits. */ 22562306a36Sopenharmony_ci#define VC4_CONFIG_BITS_EARLY_Z_UPDATE BIT(1) 22662306a36Sopenharmony_ci#define VC4_CONFIG_BITS_EARLY_Z BIT(0) 22762306a36Sopenharmony_ci/** @} */ 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci/** @{ byte 1 of config bits. */ 23062306a36Sopenharmony_ci#define VC4_CONFIG_BITS_Z_UPDATE BIT(7) 23162306a36Sopenharmony_ci/** same values in this 3-bit field as PIPE_FUNC_* */ 23262306a36Sopenharmony_ci#define VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT 4 23362306a36Sopenharmony_ci#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE BIT(3) 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_ci#define VC4_CONFIG_BITS_COVERAGE_UPDATE_NONZERO (0 << 1) 23662306a36Sopenharmony_ci#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ODD (1 << 1) 23762306a36Sopenharmony_ci#define VC4_CONFIG_BITS_COVERAGE_UPDATE_OR (2 << 1) 23862306a36Sopenharmony_ci#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ZERO (3 << 1) 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT BIT(0) 24162306a36Sopenharmony_ci/** @} */ 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci/** @{ byte 0 of config bits. */ 24462306a36Sopenharmony_ci#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_NONE (0 << 6) 24562306a36Sopenharmony_ci#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X (1 << 6) 24662306a36Sopenharmony_ci#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_16X (2 << 6) 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES BIT(4) 24962306a36Sopenharmony_ci#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET BIT(3) 25062306a36Sopenharmony_ci#define VC4_CONFIG_BITS_CW_PRIMITIVES BIT(2) 25162306a36Sopenharmony_ci#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK BIT(1) 25262306a36Sopenharmony_ci#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT BIT(0) 25362306a36Sopenharmony_ci/** @} */ 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_ci/** @{ bits in the last u8 of VC4_PACKET_TILE_BINNING_MODE_CONFIG */ 25662306a36Sopenharmony_ci#define VC4_BIN_CONFIG_DB_NON_MS BIT(7) 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK VC4_MASK(6, 5) 25962306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_SHIFT 5 26062306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_32 0 26162306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_64 1 26262306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128 2 26362306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_256 3 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK VC4_MASK(4, 3) 26662306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_SHIFT 3 26762306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32 0 26862306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_64 1 26962306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_128 2 27062306a36Sopenharmony_ci#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_256 3 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_ci#define VC4_BIN_CONFIG_AUTO_INIT_TSDA BIT(2) 27362306a36Sopenharmony_ci#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT BIT(1) 27462306a36Sopenharmony_ci#define VC4_BIN_CONFIG_MS_MODE_4X BIT(0) 27562306a36Sopenharmony_ci/** @} */ 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci/** @{ bits in the last u16 of VC4_PACKET_TILE_RENDERING_MODE_CONFIG */ 27862306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_DB_NON_MS BIT(12) 27962306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE BIT(11) 28062306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G BIT(10) 28162306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_COVERAGE_MODE BIT(9) 28262306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_ENABLE_VG_MASK BIT(8) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci/** The values of the field are VC4_TILING_FORMAT_* */ 28562306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK VC4_MASK(7, 6) 28662306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_MEMORY_FORMAT_SHIFT 6 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_DECIMATE_MODE_1X (0 << 4) 28962306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_DECIMATE_MODE_4X (1 << 4) 29062306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_DECIMATE_MODE_16X (2 << 4) 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_FORMAT_MASK VC4_MASK(3, 2) 29362306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_FORMAT_SHIFT 2 29462306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_FORMAT_BGR565_DITHERED 0 29562306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_FORMAT_RGBA8888 1 29662306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_FORMAT_BGR565 2 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT BIT(1) 29962306a36Sopenharmony_ci#define VC4_RENDER_CONFIG_MS_MODE_4X BIT(0) 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci#define VC4_PRIMITIVE_LIST_FORMAT_16_INDEX (1 << 4) 30262306a36Sopenharmony_ci#define VC4_PRIMITIVE_LIST_FORMAT_32_XY (3 << 4) 30362306a36Sopenharmony_ci#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_POINTS (0 << 0) 30462306a36Sopenharmony_ci#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_LINES (1 << 0) 30562306a36Sopenharmony_ci#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_TRIANGLES (2 << 0) 30662306a36Sopenharmony_ci#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_RHT (3 << 0) 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_cienum vc4_texture_data_type { 30962306a36Sopenharmony_ci VC4_TEXTURE_TYPE_RGBA8888 = 0, 31062306a36Sopenharmony_ci VC4_TEXTURE_TYPE_RGBX8888 = 1, 31162306a36Sopenharmony_ci VC4_TEXTURE_TYPE_RGBA4444 = 2, 31262306a36Sopenharmony_ci VC4_TEXTURE_TYPE_RGBA5551 = 3, 31362306a36Sopenharmony_ci VC4_TEXTURE_TYPE_RGB565 = 4, 31462306a36Sopenharmony_ci VC4_TEXTURE_TYPE_LUMINANCE = 5, 31562306a36Sopenharmony_ci VC4_TEXTURE_TYPE_ALPHA = 6, 31662306a36Sopenharmony_ci VC4_TEXTURE_TYPE_LUMALPHA = 7, 31762306a36Sopenharmony_ci VC4_TEXTURE_TYPE_ETC1 = 8, 31862306a36Sopenharmony_ci VC4_TEXTURE_TYPE_S16F = 9, 31962306a36Sopenharmony_ci VC4_TEXTURE_TYPE_S8 = 10, 32062306a36Sopenharmony_ci VC4_TEXTURE_TYPE_S16 = 11, 32162306a36Sopenharmony_ci VC4_TEXTURE_TYPE_BW1 = 12, 32262306a36Sopenharmony_ci VC4_TEXTURE_TYPE_A4 = 13, 32362306a36Sopenharmony_ci VC4_TEXTURE_TYPE_A1 = 14, 32462306a36Sopenharmony_ci VC4_TEXTURE_TYPE_RGBA64 = 15, 32562306a36Sopenharmony_ci VC4_TEXTURE_TYPE_RGBA32R = 16, 32662306a36Sopenharmony_ci VC4_TEXTURE_TYPE_YUV422R = 17, 32762306a36Sopenharmony_ci}; 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci#define VC4_TEX_P0_OFFSET_MASK VC4_MASK(31, 12) 33062306a36Sopenharmony_ci#define VC4_TEX_P0_OFFSET_SHIFT 12 33162306a36Sopenharmony_ci#define VC4_TEX_P0_CSWIZ_MASK VC4_MASK(11, 10) 33262306a36Sopenharmony_ci#define VC4_TEX_P0_CSWIZ_SHIFT 10 33362306a36Sopenharmony_ci#define VC4_TEX_P0_CMMODE_MASK VC4_MASK(9, 9) 33462306a36Sopenharmony_ci#define VC4_TEX_P0_CMMODE_SHIFT 9 33562306a36Sopenharmony_ci#define VC4_TEX_P0_FLIPY_MASK VC4_MASK(8, 8) 33662306a36Sopenharmony_ci#define VC4_TEX_P0_FLIPY_SHIFT 8 33762306a36Sopenharmony_ci#define VC4_TEX_P0_TYPE_MASK VC4_MASK(7, 4) 33862306a36Sopenharmony_ci#define VC4_TEX_P0_TYPE_SHIFT 4 33962306a36Sopenharmony_ci#define VC4_TEX_P0_MIPLVLS_MASK VC4_MASK(3, 0) 34062306a36Sopenharmony_ci#define VC4_TEX_P0_MIPLVLS_SHIFT 0 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci#define VC4_TEX_P1_TYPE4_MASK VC4_MASK(31, 31) 34362306a36Sopenharmony_ci#define VC4_TEX_P1_TYPE4_SHIFT 31 34462306a36Sopenharmony_ci#define VC4_TEX_P1_HEIGHT_MASK VC4_MASK(30, 20) 34562306a36Sopenharmony_ci#define VC4_TEX_P1_HEIGHT_SHIFT 20 34662306a36Sopenharmony_ci#define VC4_TEX_P1_ETCFLIP_MASK VC4_MASK(19, 19) 34762306a36Sopenharmony_ci#define VC4_TEX_P1_ETCFLIP_SHIFT 19 34862306a36Sopenharmony_ci#define VC4_TEX_P1_WIDTH_MASK VC4_MASK(18, 8) 34962306a36Sopenharmony_ci#define VC4_TEX_P1_WIDTH_SHIFT 8 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_ci#define VC4_TEX_P1_MAGFILT_MASK VC4_MASK(7, 7) 35262306a36Sopenharmony_ci#define VC4_TEX_P1_MAGFILT_SHIFT 7 35362306a36Sopenharmony_ci# define VC4_TEX_P1_MAGFILT_LINEAR 0 35462306a36Sopenharmony_ci# define VC4_TEX_P1_MAGFILT_NEAREST 1 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_ci#define VC4_TEX_P1_MINFILT_MASK VC4_MASK(6, 4) 35762306a36Sopenharmony_ci#define VC4_TEX_P1_MINFILT_SHIFT 4 35862306a36Sopenharmony_ci# define VC4_TEX_P1_MINFILT_LINEAR 0 35962306a36Sopenharmony_ci# define VC4_TEX_P1_MINFILT_NEAREST 1 36062306a36Sopenharmony_ci# define VC4_TEX_P1_MINFILT_NEAR_MIP_NEAR 2 36162306a36Sopenharmony_ci# define VC4_TEX_P1_MINFILT_NEAR_MIP_LIN 3 36262306a36Sopenharmony_ci# define VC4_TEX_P1_MINFILT_LIN_MIP_NEAR 4 36362306a36Sopenharmony_ci# define VC4_TEX_P1_MINFILT_LIN_MIP_LIN 5 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ci#define VC4_TEX_P1_WRAP_T_MASK VC4_MASK(3, 2) 36662306a36Sopenharmony_ci#define VC4_TEX_P1_WRAP_T_SHIFT 2 36762306a36Sopenharmony_ci#define VC4_TEX_P1_WRAP_S_MASK VC4_MASK(1, 0) 36862306a36Sopenharmony_ci#define VC4_TEX_P1_WRAP_S_SHIFT 0 36962306a36Sopenharmony_ci# define VC4_TEX_P1_WRAP_REPEAT 0 37062306a36Sopenharmony_ci# define VC4_TEX_P1_WRAP_CLAMP 1 37162306a36Sopenharmony_ci# define VC4_TEX_P1_WRAP_MIRROR 2 37262306a36Sopenharmony_ci# define VC4_TEX_P1_WRAP_BORDER 3 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci#define VC4_TEX_P2_PTYPE_MASK VC4_MASK(31, 30) 37562306a36Sopenharmony_ci#define VC4_TEX_P2_PTYPE_SHIFT 30 37662306a36Sopenharmony_ci# define VC4_TEX_P2_PTYPE_IGNORED 0 37762306a36Sopenharmony_ci# define VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE 1 37862306a36Sopenharmony_ci# define VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS 2 37962306a36Sopenharmony_ci# define VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS 3 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_ci/* VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE bits */ 38262306a36Sopenharmony_ci#define VC4_TEX_P2_CMST_MASK VC4_MASK(29, 12) 38362306a36Sopenharmony_ci#define VC4_TEX_P2_CMST_SHIFT 12 38462306a36Sopenharmony_ci#define VC4_TEX_P2_BSLOD_MASK VC4_MASK(0, 0) 38562306a36Sopenharmony_ci#define VC4_TEX_P2_BSLOD_SHIFT 0 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS */ 38862306a36Sopenharmony_ci#define VC4_TEX_P2_CHEIGHT_MASK VC4_MASK(22, 12) 38962306a36Sopenharmony_ci#define VC4_TEX_P2_CHEIGHT_SHIFT 12 39062306a36Sopenharmony_ci#define VC4_TEX_P2_CWIDTH_MASK VC4_MASK(10, 0) 39162306a36Sopenharmony_ci#define VC4_TEX_P2_CWIDTH_SHIFT 0 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS */ 39462306a36Sopenharmony_ci#define VC4_TEX_P2_CYOFF_MASK VC4_MASK(22, 12) 39562306a36Sopenharmony_ci#define VC4_TEX_P2_CYOFF_SHIFT 12 39662306a36Sopenharmony_ci#define VC4_TEX_P2_CXOFF_MASK VC4_MASK(10, 0) 39762306a36Sopenharmony_ci#define VC4_TEX_P2_CXOFF_SHIFT 0 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_ci#endif /* VC4_PACKET_H */ 400