linux/drivers/gpu/drm/vc4/vc4_packet.h

/*
 * Copyright © 2014 Broadcom
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#ifndef VC4_PACKET_H
#define VC4_PACKET_H

#include "vc4_regs.h" /* for VC4_MASK, VC4_GET_FIELD, VC4_SET_FIELD */

enum vc4_packet {} __attribute__ ((packed));

#define VC4_PACKET_HALT_SIZE
#define VC4_PACKET_NOP_SIZE
#define VC4_PACKET_FLUSH_SIZE
#define VC4_PACKET_FLUSH_ALL_SIZE
#define VC4_PACKET_START_TILE_BINNING_SIZE
#define VC4_PACKET_INCREMENT_SEMAPHORE_SIZE
#define VC4_PACKET_WAIT_ON_SEMAPHORE_SIZE
#define VC4_PACKET_BRANCH_SIZE
#define VC4_PACKET_BRANCH_TO_SUB_LIST_SIZE
#define VC4_PACKET_STORE_MS_TILE_BUFFER_SIZE
#define VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF_SIZE
#define VC4_PACKET_STORE_FULL_RES_TILE_BUFFER_SIZE
#define VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER_SIZE
#define VC4_PACKET_STORE_TILE_BUFFER_GENERAL_SIZE
#define VC4_PACKET_LOAD_TILE_BUFFER_GENERAL_SIZE
#define VC4_PACKET_GL_INDEXED_PRIMITIVE_SIZE
#define VC4_PACKET_GL_ARRAY_PRIMITIVE_SIZE
#define VC4_PACKET_COMPRESSED_PRIMITIVE_SIZE
#define VC4_PACKET_CLIPPED_COMPRESSED_PRIMITIVE_SIZE
#define VC4_PACKET_PRIMITIVE_LIST_FORMAT_SIZE
#define VC4_PACKET_GL_SHADER_STATE_SIZE
#define VC4_PACKET_NV_SHADER_STATE_SIZE
#define VC4_PACKET_VG_SHADER_STATE_SIZE
#define VC4_PACKET_CONFIGURATION_BITS_SIZE
#define VC4_PACKET_FLAT_SHADE_FLAGS_SIZE
#define VC4_PACKET_POINT_SIZE_SIZE
#define VC4_PACKET_LINE_WIDTH_SIZE
#define VC4_PACKET_RHT_X_BOUNDARY_SIZE
#define VC4_PACKET_DEPTH_OFFSET_SIZE
#define VC4_PACKET_CLIP_WINDOW_SIZE
#define VC4_PACKET_VIEWPORT_OFFSET_SIZE
#define VC4_PACKET_Z_CLIPPING_SIZE
#define VC4_PACKET_CLIPPER_XY_SCALING_SIZE
#define VC4_PACKET_CLIPPER_Z_SCALING_SIZE
#define VC4_PACKET_TILE_BINNING_MODE_CONFIG_SIZE
#define VC4_PACKET_TILE_RENDERING_MODE_CONFIG_SIZE
#define VC4_PACKET_CLEAR_COLORS_SIZE
#define VC4_PACKET_TILE_COORDINATES_SIZE
#define VC4_PACKET_GEM_HANDLES_SIZE

/* Number of multisamples supported. */
#define VC4_MAX_SAMPLES
/* Size of a full resolution color or Z tile buffer load/store. */
#define VC4_TILE_BUFFER_SIZE

/** @{
 * Bits used by packets like VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
 * VC4_PACKET_TILE_RENDERING_MODE_CONFIG.
*/
#define VC4_TILING_FORMAT_LINEAR
#define VC4_TILING_FORMAT_T
#define VC4_TILING_FORMAT_LT
/** @} */

/** @{
 *
 * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and
 * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER.
 */
#define VC4_LOADSTORE_FULL_RES_EOF
#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL
#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS
#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR

/** @{
 *
 * low bits of VC4_PACKET_STORE_FULL_RES_TILE_BUFFER and
 * VC4_PACKET_LOAD_FULL_RES_TILE_BUFFER.
 */
#define VC4_LOADSTORE_FULL_RES_EOF
#define VC4_LOADSTORE_FULL_RES_DISABLE_CLEAR_ALL
#define VC4_LOADSTORE_FULL_RES_DISABLE_ZS
#define VC4_LOADSTORE_FULL_RES_DISABLE_COLOR

/** @{
 *
 * byte 2 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
 * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL (low bits of the address)
 */

#define VC4_LOADSTORE_TILE_BUFFER_EOF
#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_VG_MASK
#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_ZS
#define VC4_LOADSTORE_TILE_BUFFER_DISABLE_FULL_COLOR

/** @} */

/** @{
 *
 * byte 0-1 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
 * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL
 */
#define VC4_STORE_TILE_BUFFER_DISABLE_VG_MASK_CLEAR
#define VC4_STORE_TILE_BUFFER_DISABLE_ZS_CLEAR
#define VC4_STORE_TILE_BUFFER_DISABLE_COLOR_CLEAR
#define VC4_STORE_TILE_BUFFER_DISABLE_SWAP

#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK
#define VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT
#define VC4_LOADSTORE_TILE_BUFFER_RGBA8888
#define VC4_LOADSTORE_TILE_BUFFER_BGR565_DITHER
#define VC4_LOADSTORE_TILE_BUFFER_BGR565
/** @} */

/** @{
 *
 * byte 0 of VC4_PACKET_STORE_TILE_BUFFER_GENERAL and
 * VC4_PACKET_LOAD_TILE_BUFFER_GENERAL
 */
#define VC4_STORE_TILE_BUFFER_MODE_MASK
#define VC4_STORE_TILE_BUFFER_MODE_SHIFT
#define VC4_STORE_TILE_BUFFER_MODE_SAMPLE0
#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X4
#define VC4_STORE_TILE_BUFFER_MODE_DECIMATE_X16

/** The values of the field are VC4_TILING_FORMAT_* */
#define VC4_LOADSTORE_TILE_BUFFER_TILING_MASK
#define VC4_LOADSTORE_TILE_BUFFER_TILING_SHIFT

#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK
#define VC4_LOADSTORE_TILE_BUFFER_BUFFER_SHIFT
#define VC4_LOADSTORE_TILE_BUFFER_NONE
#define VC4_LOADSTORE_TILE_BUFFER_COLOR
#define VC4_LOADSTORE_TILE_BUFFER_ZS
#define VC4_LOADSTORE_TILE_BUFFER_Z
#define VC4_LOADSTORE_TILE_BUFFER_VG_MASK
#define VC4_LOADSTORE_TILE_BUFFER_FULL
/** @} */

#define VC4_INDEX_BUFFER_U8
#define VC4_INDEX_BUFFER_U16

/* This flag is only present in NV shader state. */
#define VC4_SHADER_FLAG_SHADED_CLIP_COORDS
#define VC4_SHADER_FLAG_ENABLE_CLIPPING
#define VC4_SHADER_FLAG_VS_POINT_SIZE
#define VC4_SHADER_FLAG_FS_SINGLE_THREAD

/** @{ byte 2 of config bits. */
#define VC4_CONFIG_BITS_EARLY_Z_UPDATE
#define VC4_CONFIG_BITS_EARLY_Z
/** @} */

/** @{ byte 1 of config bits. */
#define VC4_CONFIG_BITS_Z_UPDATE
/** same values in this 3-bit field as PIPE_FUNC_* */
#define VC4_CONFIG_BITS_DEPTH_FUNC_SHIFT
#define VC4_CONFIG_BITS_COVERAGE_READ_LEAVE

#define VC4_CONFIG_BITS_COVERAGE_UPDATE_NONZERO
#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ODD
#define VC4_CONFIG_BITS_COVERAGE_UPDATE_OR
#define VC4_CONFIG_BITS_COVERAGE_UPDATE_ZERO

#define VC4_CONFIG_BITS_COVERAGE_PIPE_SELECT
/** @} */

/** @{ byte 0 of config bits. */
#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_NONE
#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_4X
#define VC4_CONFIG_BITS_RASTERIZER_OVERSAMPLE_16X

#define VC4_CONFIG_BITS_AA_POINTS_AND_LINES
#define VC4_CONFIG_BITS_ENABLE_DEPTH_OFFSET
#define VC4_CONFIG_BITS_CW_PRIMITIVES
#define VC4_CONFIG_BITS_ENABLE_PRIM_BACK
#define VC4_CONFIG_BITS_ENABLE_PRIM_FRONT
/** @} */

/** @{ bits in the last u8 of VC4_PACKET_TILE_BINNING_MODE_CONFIG */
#define VC4_BIN_CONFIG_DB_NON_MS

#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_MASK
#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_SHIFT
#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_32
#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_64
#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128
#define VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_256

#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK
#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_SHIFT
#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_32
#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_64
#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_128
#define VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_256

#define VC4_BIN_CONFIG_AUTO_INIT_TSDA
#define VC4_BIN_CONFIG_TILE_BUFFER_64BIT
#define VC4_BIN_CONFIG_MS_MODE_4X
/** @} */

/** @{ bits in the last u16 of VC4_PACKET_TILE_RENDERING_MODE_CONFIG */
#define VC4_RENDER_CONFIG_DB_NON_MS
#define VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE
#define VC4_RENDER_CONFIG_EARLY_Z_DIRECTION_G
#define VC4_RENDER_CONFIG_COVERAGE_MODE
#define VC4_RENDER_CONFIG_ENABLE_VG_MASK

/** The values of the field are VC4_TILING_FORMAT_* */
#define VC4_RENDER_CONFIG_MEMORY_FORMAT_MASK
#define VC4_RENDER_CONFIG_MEMORY_FORMAT_SHIFT

#define VC4_RENDER_CONFIG_DECIMATE_MODE_1X
#define VC4_RENDER_CONFIG_DECIMATE_MODE_4X
#define VC4_RENDER_CONFIG_DECIMATE_MODE_16X

#define VC4_RENDER_CONFIG_FORMAT_MASK
#define VC4_RENDER_CONFIG_FORMAT_SHIFT
#define VC4_RENDER_CONFIG_FORMAT_BGR565_DITHERED
#define VC4_RENDER_CONFIG_FORMAT_RGBA8888
#define VC4_RENDER_CONFIG_FORMAT_BGR565

#define VC4_RENDER_CONFIG_TILE_BUFFER_64BIT
#define VC4_RENDER_CONFIG_MS_MODE_4X

#define VC4_PRIMITIVE_LIST_FORMAT_16_INDEX
#define VC4_PRIMITIVE_LIST_FORMAT_32_XY
#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_POINTS
#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_LINES
#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_TRIANGLES
#define VC4_PRIMITIVE_LIST_FORMAT_TYPE_RHT

enum vc4_texture_data_type {};

#define VC4_TEX_P0_OFFSET_MASK
#define VC4_TEX_P0_OFFSET_SHIFT
#define VC4_TEX_P0_CSWIZ_MASK
#define VC4_TEX_P0_CSWIZ_SHIFT
#define VC4_TEX_P0_CMMODE_MASK
#define VC4_TEX_P0_CMMODE_SHIFT
#define VC4_TEX_P0_FLIPY_MASK
#define VC4_TEX_P0_FLIPY_SHIFT
#define VC4_TEX_P0_TYPE_MASK
#define VC4_TEX_P0_TYPE_SHIFT
#define VC4_TEX_P0_MIPLVLS_MASK
#define VC4_TEX_P0_MIPLVLS_SHIFT

#define VC4_TEX_P1_TYPE4_MASK
#define VC4_TEX_P1_TYPE4_SHIFT
#define VC4_TEX_P1_HEIGHT_MASK
#define VC4_TEX_P1_HEIGHT_SHIFT
#define VC4_TEX_P1_ETCFLIP_MASK
#define VC4_TEX_P1_ETCFLIP_SHIFT
#define VC4_TEX_P1_WIDTH_MASK
#define VC4_TEX_P1_WIDTH_SHIFT

#define VC4_TEX_P1_MAGFILT_MASK
#define VC4_TEX_P1_MAGFILT_SHIFT
#define VC4_TEX_P1_MAGFILT_LINEAR
#define VC4_TEX_P1_MAGFILT_NEAREST

#define VC4_TEX_P1_MINFILT_MASK
#define VC4_TEX_P1_MINFILT_SHIFT
#define VC4_TEX_P1_MINFILT_LINEAR
#define VC4_TEX_P1_MINFILT_NEAREST
#define VC4_TEX_P1_MINFILT_NEAR_MIP_NEAR
#define VC4_TEX_P1_MINFILT_NEAR_MIP_LIN
#define VC4_TEX_P1_MINFILT_LIN_MIP_NEAR
#define VC4_TEX_P1_MINFILT_LIN_MIP_LIN

#define VC4_TEX_P1_WRAP_T_MASK
#define VC4_TEX_P1_WRAP_T_SHIFT
#define VC4_TEX_P1_WRAP_S_MASK
#define VC4_TEX_P1_WRAP_S_SHIFT
#define VC4_TEX_P1_WRAP_REPEAT
#define VC4_TEX_P1_WRAP_CLAMP
#define VC4_TEX_P1_WRAP_MIRROR
#define VC4_TEX_P1_WRAP_BORDER

#define VC4_TEX_P2_PTYPE_MASK
#define VC4_TEX_P2_PTYPE_SHIFT
#define VC4_TEX_P2_PTYPE_IGNORED
#define VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE
#define VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS
#define VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS

/* VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE bits */
#define VC4_TEX_P2_CMST_MASK
#define VC4_TEX_P2_CMST_SHIFT
#define VC4_TEX_P2_BSLOD_MASK
#define VC4_TEX_P2_BSLOD_SHIFT

/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_DIMENSIONS */
#define VC4_TEX_P2_CHEIGHT_MASK
#define VC4_TEX_P2_CHEIGHT_SHIFT
#define VC4_TEX_P2_CWIDTH_MASK
#define VC4_TEX_P2_CWIDTH_SHIFT

/* VC4_TEX_P2_PTYPE_CHILD_IMAGE_OFFSETS */
#define VC4_TEX_P2_CYOFF_MASK
#define VC4_TEX_P2_CYOFF_SHIFT
#define VC4_TEX_P2_CXOFF_MASK
#define VC4_TEX_P2_CXOFF_SHIFT

#endif /* VC4_PACKET_H */