196c5ddc4Srjs 296c5ddc4Srjs/* Generated code, see midgard.xml and gen_pack_header.py 396c5ddc4Srjs * 496c5ddc4Srjs * Packets, enums and structures for Panfrost. 596c5ddc4Srjs * 696c5ddc4Srjs * This file has been generated, do not hand edit. 796c5ddc4Srjs */ 896c5ddc4Srjs 996c5ddc4Srjs#ifndef PAN_PACK_H 1096c5ddc4Srjs#define PAN_PACK_H 1196c5ddc4Srjs 1296c5ddc4Srjs#include <stdio.h> 1396c5ddc4Srjs#include <stdint.h> 1496c5ddc4Srjs#include <stdbool.h> 1596c5ddc4Srjs#include <assert.h> 1696c5ddc4Srjs#include <math.h> 1796c5ddc4Srjs#include <inttypes.h> 1896c5ddc4Srjs#include "util/macros.h" 1996c5ddc4Srjs#include "util/u_math.h" 2096c5ddc4Srjs 2196c5ddc4Srjs#define __gen_unpack_float(x, y, z) uif(__gen_unpack_uint(x, y, z)) 2296c5ddc4Srjs 2396c5ddc4Srjsstatic inline uint64_t 2496c5ddc4Srjs__gen_uint(uint64_t v, uint32_t start, uint32_t end) 2596c5ddc4Srjs{ 2696c5ddc4Srjs#ifndef NDEBUG 2796c5ddc4Srjs const int width = end - start + 1; 2896c5ddc4Srjs if (width < 64) { 2996c5ddc4Srjs const uint64_t max = (1ull << width) - 1; 3096c5ddc4Srjs assert(v <= max); 3196c5ddc4Srjs } 3296c5ddc4Srjs#endif 3396c5ddc4Srjs 3496c5ddc4Srjs return v << start; 3596c5ddc4Srjs} 3696c5ddc4Srjs 3796c5ddc4Srjsstatic inline uint32_t 3896c5ddc4Srjs__gen_sint(int32_t v, uint32_t start, uint32_t end) 3996c5ddc4Srjs{ 4096c5ddc4Srjs#ifndef NDEBUG 4196c5ddc4Srjs const int width = end - start + 1; 4296c5ddc4Srjs if (width < 64) { 4396c5ddc4Srjs const int64_t max = (1ll << (width - 1)) - 1; 4496c5ddc4Srjs const int64_t min = -(1ll << (width - 1)); 4596c5ddc4Srjs assert(min <= v && v <= max); 4696c5ddc4Srjs } 4796c5ddc4Srjs#endif 4896c5ddc4Srjs 4996c5ddc4Srjs return (((uint32_t) v) << start) & ((2ll << end) - 1); 5096c5ddc4Srjs} 5196c5ddc4Srjs 5296c5ddc4Srjsstatic inline uint32_t 5396c5ddc4Srjs__gen_padded(uint32_t v, uint32_t start, uint32_t end) 5496c5ddc4Srjs{ 5596c5ddc4Srjs unsigned shift = __builtin_ctz(v); 5696c5ddc4Srjs unsigned odd = v >> (shift + 1); 5796c5ddc4Srjs 5896c5ddc4Srjs#ifndef NDEBUG 5996c5ddc4Srjs assert((v >> shift) & 1); 6096c5ddc4Srjs assert(shift <= 31); 6196c5ddc4Srjs assert(odd <= 7); 6296c5ddc4Srjs assert((end - start + 1) == 8); 6396c5ddc4Srjs#endif 6496c5ddc4Srjs 6596c5ddc4Srjs return __gen_uint(shift | (odd << 5), start, end); 6696c5ddc4Srjs} 6796c5ddc4Srjs 6896c5ddc4Srjs 6996c5ddc4Srjsstatic inline uint64_t 7096c5ddc4Srjs__gen_unpack_uint(const uint8_t *restrict cl, uint32_t start, uint32_t end) 7196c5ddc4Srjs{ 7296c5ddc4Srjs uint64_t val = 0; 7396c5ddc4Srjs const int width = end - start + 1; 7496c5ddc4Srjs const uint64_t mask = (width == 64 ? ~0 : (1ull << width) - 1 ); 7596c5ddc4Srjs 7696c5ddc4Srjs for (uint32_t byte = start / 8; byte <= end / 8; byte++) { 7796c5ddc4Srjs val |= ((uint64_t) cl[byte]) << ((byte - start / 8) * 8); 7896c5ddc4Srjs } 7996c5ddc4Srjs 8096c5ddc4Srjs return (val >> (start % 8)) & mask; 8196c5ddc4Srjs} 8296c5ddc4Srjs 8396c5ddc4Srjsstatic inline uint64_t 8496c5ddc4Srjs__gen_unpack_sint(const uint8_t *restrict cl, uint32_t start, uint32_t end) 8596c5ddc4Srjs{ 8696c5ddc4Srjs int size = end - start + 1; 8796c5ddc4Srjs int64_t val = __gen_unpack_uint(cl, start, end); 8896c5ddc4Srjs 8996c5ddc4Srjs /* Get the sign bit extended. */ 9096c5ddc4Srjs return (val << (64 - size)) >> (64 - size); 9196c5ddc4Srjs} 9296c5ddc4Srjs 9396c5ddc4Srjsstatic inline uint64_t 9496c5ddc4Srjs__gen_unpack_padded(const uint8_t *restrict cl, uint32_t start, uint32_t end) 9596c5ddc4Srjs{ 9696c5ddc4Srjs unsigned val = __gen_unpack_uint(cl, start, end); 9796c5ddc4Srjs unsigned shift = val & 0b11111; 9896c5ddc4Srjs unsigned odd = val >> 5; 9996c5ddc4Srjs 10096c5ddc4Srjs return (2*odd + 1) << shift; 10196c5ddc4Srjs} 10296c5ddc4Srjs 10396c5ddc4Srjs#define PREFIX1(A) MALI_ ## A 10496c5ddc4Srjs#define PREFIX2(A, B) MALI_ ## A ## _ ## B 10596c5ddc4Srjs#define PREFIX4(A, B, C, D) MALI_ ## A ## _ ## B ## _ ## C ## _ ## D 10696c5ddc4Srjs 10796c5ddc4Srjs#define pan_prepare(dst, T) \ 10896c5ddc4Srjs *(dst) = (struct PREFIX1(T)){ PREFIX2(T, header) } 10996c5ddc4Srjs 11096c5ddc4Srjs#define pan_pack(dst, T, name) \ 11196c5ddc4Srjs for (struct PREFIX1(T) name = { PREFIX2(T, header) }, \ 11296c5ddc4Srjs *_loop_terminate = (void *) (dst); \ 11396c5ddc4Srjs __builtin_expect(_loop_terminate != NULL, 1); \ 11496c5ddc4Srjs ({ PREFIX2(T, pack)((uint32_t *) (dst), &name); \ 11596c5ddc4Srjs _loop_terminate = NULL; })) 11696c5ddc4Srjs 11796c5ddc4Srjs#define pan_unpack(src, T, name) \ 11896c5ddc4Srjs struct PREFIX1(T) name; \ 11996c5ddc4Srjs PREFIX2(T, unpack)((uint8_t *)(src), &name) 12096c5ddc4Srjs 12196c5ddc4Srjs#define pan_print(fp, T, var, indent) \ 12296c5ddc4Srjs PREFIX2(T, print)(fp, &(var), indent) 12396c5ddc4Srjs 12496c5ddc4Srjs#define pan_size(T) PREFIX2(T, LENGTH) 12596c5ddc4Srjs#define pan_alignment(T) PREFIX2(T, ALIGN) 12696c5ddc4Srjs 12796c5ddc4Srjs#define pan_section_offset(A, S) \ 12896c5ddc4Srjs PREFIX4(A, SECTION, S, OFFSET) 12996c5ddc4Srjs 13096c5ddc4Srjs#define pan_section_ptr(base, A, S) \ 13196c5ddc4Srjs ((void *)((uint8_t *)(base) + pan_section_offset(A, S))) 13296c5ddc4Srjs 13396c5ddc4Srjs#define pan_section_pack(dst, A, S, name) \ 13496c5ddc4Srjs for (PREFIX4(A, SECTION, S, TYPE) name = { PREFIX4(A, SECTION, S, header) }, \ 13596c5ddc4Srjs *_loop_terminate = (void *) (dst); \ 13696c5ddc4Srjs __builtin_expect(_loop_terminate != NULL, 1); \ 13796c5ddc4Srjs ({ PREFIX4(A, SECTION, S, pack) (pan_section_ptr(dst, A, S), &name); \ 13896c5ddc4Srjs _loop_terminate = NULL; })) 13996c5ddc4Srjs 14096c5ddc4Srjs#define pan_section_unpack(src, A, S, name) \ 14196c5ddc4Srjs PREFIX4(A, SECTION, S, TYPE) name; \ 14296c5ddc4Srjs PREFIX4(A, SECTION, S, unpack)(pan_section_ptr(src, A, S), &name) 14396c5ddc4Srjs 14496c5ddc4Srjs#define pan_section_print(fp, A, S, var, indent) \ 14596c5ddc4Srjs PREFIX4(A, SECTION, S, print)(fp, &(var), indent) 14696c5ddc4Srjs 14796c5ddc4Srjs#define pan_merge(packed1, packed2, type) do { for (unsigned i = 0; i < (PREFIX2(type, LENGTH) / 4); ++i) (packed1).opaque[i] |= (packed2).opaque[i]; } while(0) 14896c5ddc4Srjs 14996c5ddc4Srjs/* From presentations, 16x16 tiles externally. Use shift for fast computation 15096c5ddc4Srjs * of tile numbers. */ 15196c5ddc4Srjs 15296c5ddc4Srjs#define MALI_TILE_SHIFT 4 15396c5ddc4Srjs#define MALI_TILE_LENGTH (1 << MALI_TILE_SHIFT) 15496c5ddc4Srjs 15596c5ddc4Srjs 15696c5ddc4Srjs 15796c5ddc4Srjs 15896c5ddc4Srjs#define mali_pixel_format_print(fp, format) \ 15996c5ddc4Srjs fprintf(fp, "%*sFormat (v6): %s%s%s %s%s%s%s\n", indent, "", \ 16096c5ddc4Srjs mali_format_as_str((enum mali_format)((format >> 12) & 0xFF)), \ 16196c5ddc4Srjs (format & (1 << 20)) ? " sRGB" : "", \ 16296c5ddc4Srjs (format & (1 << 21)) ? " big-endian" : "", \ 16396c5ddc4Srjs mali_channel_as_str((enum mali_channel)((format >> 0) & 0x7)), \ 16496c5ddc4Srjs mali_channel_as_str((enum mali_channel)((format >> 3) & 0x7)), \ 16596c5ddc4Srjs mali_channel_as_str((enum mali_channel)((format >> 6) & 0x7)), \ 16696c5ddc4Srjs mali_channel_as_str((enum mali_channel)((format >> 9) & 0x7))); 16796c5ddc4Srjs 16896c5ddc4Srjs 16996c5ddc4Srjsenum mali_attribute_type { 17096c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D = 1, 17196c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D_POT_DIVISOR = 2, 17296c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D_MODULUS = 3, 17396c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D_NPOT_DIVISOR = 4, 17496c5ddc4Srjs MALI_ATTRIBUTE_TYPE_3D_LINEAR = 5, 17596c5ddc4Srjs MALI_ATTRIBUTE_TYPE_3D_INTERLEAVED = 6, 17696c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D_PRIMITIVE_INDEX_BUFFER = 7, 17796c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D_POT_DIVISOR_WRITE_REDUCTION = 10, 17896c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D_MODULUS_WRITE_REDUCTION = 11, 17996c5ddc4Srjs MALI_ATTRIBUTE_TYPE_1D_NPOT_DIVISOR_WRITE_REDUCTION = 12, 18096c5ddc4Srjs MALI_ATTRIBUTE_TYPE_CONTINUATION = 32, 18196c5ddc4Srjs}; 18296c5ddc4Srjs 18396c5ddc4Srjsstatic inline const char * 18496c5ddc4Srjsmali_attribute_type_as_str(enum mali_attribute_type imm) 18596c5ddc4Srjs{ 18696c5ddc4Srjs switch (imm) { 18796c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D: return "1D"; 18896c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D_POT_DIVISOR: return "1D POT Divisor"; 18996c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D_MODULUS: return "1D Modulus"; 19096c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D_NPOT_DIVISOR: return "1D NPOT Divisor"; 19196c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_3D_LINEAR: return "3D Linear"; 19296c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_3D_INTERLEAVED: return "3D Interleaved"; 19396c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D_PRIMITIVE_INDEX_BUFFER: return "1D Primitive Index Buffer"; 19496c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D_POT_DIVISOR_WRITE_REDUCTION: return "1D POT Divisor Write Reduction"; 19596c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D_MODULUS_WRITE_REDUCTION: return "1D Modulus Write Reduction"; 19696c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_1D_NPOT_DIVISOR_WRITE_REDUCTION: return "1D NPOT Divisor Write Reduction"; 19796c5ddc4Srjs case MALI_ATTRIBUTE_TYPE_CONTINUATION: return "Continuation"; 19896c5ddc4Srjs default: return "XXX: INVALID"; 19996c5ddc4Srjs } 20096c5ddc4Srjs} 20196c5ddc4Srjs 20296c5ddc4Srjsenum mali_channel { 20396c5ddc4Srjs MALI_CHANNEL_R = 0, 20496c5ddc4Srjs MALI_CHANNEL_G = 1, 20596c5ddc4Srjs MALI_CHANNEL_B = 2, 20696c5ddc4Srjs MALI_CHANNEL_A = 3, 20796c5ddc4Srjs MALI_CHANNEL_0 = 4, 20896c5ddc4Srjs MALI_CHANNEL_1 = 5, 20996c5ddc4Srjs}; 21096c5ddc4Srjs 21196c5ddc4Srjsstatic inline const char * 21296c5ddc4Srjsmali_channel_as_str(enum mali_channel imm) 21396c5ddc4Srjs{ 21496c5ddc4Srjs switch (imm) { 21596c5ddc4Srjs case MALI_CHANNEL_R: return "R"; 21696c5ddc4Srjs case MALI_CHANNEL_G: return "G"; 21796c5ddc4Srjs case MALI_CHANNEL_B: return "B"; 21896c5ddc4Srjs case MALI_CHANNEL_A: return "A"; 21996c5ddc4Srjs case MALI_CHANNEL_0: return "0"; 22096c5ddc4Srjs case MALI_CHANNEL_1: return "1"; 22196c5ddc4Srjs default: return "XXX: INVALID"; 22296c5ddc4Srjs } 22396c5ddc4Srjs} 22496c5ddc4Srjs 22596c5ddc4Srjsenum mali_depth_source { 22696c5ddc4Srjs MALI_DEPTH_SOURCE_MINIMUM = 0, 22796c5ddc4Srjs MALI_DEPTH_SOURCE_MAXIMUM = 1, 22896c5ddc4Srjs MALI_DEPTH_SOURCE_FIXED_FUNCTION = 2, 22996c5ddc4Srjs MALI_DEPTH_SOURCE_SHADER = 3, 23096c5ddc4Srjs}; 23196c5ddc4Srjs 23296c5ddc4Srjsstatic inline const char * 23396c5ddc4Srjsmali_depth_source_as_str(enum mali_depth_source imm) 23496c5ddc4Srjs{ 23596c5ddc4Srjs switch (imm) { 23696c5ddc4Srjs case MALI_DEPTH_SOURCE_MINIMUM: return "Minimum"; 23796c5ddc4Srjs case MALI_DEPTH_SOURCE_MAXIMUM: return "Maximum"; 23896c5ddc4Srjs case MALI_DEPTH_SOURCE_FIXED_FUNCTION: return "Fixed function"; 23996c5ddc4Srjs case MALI_DEPTH_SOURCE_SHADER: return "Shader"; 24096c5ddc4Srjs default: return "XXX: INVALID"; 24196c5ddc4Srjs } 24296c5ddc4Srjs} 24396c5ddc4Srjs 24496c5ddc4Srjsenum mali_job_type { 24596c5ddc4Srjs MALI_JOB_TYPE_NOT_STARTED = 0, 24696c5ddc4Srjs MALI_JOB_TYPE_NULL = 1, 24796c5ddc4Srjs MALI_JOB_TYPE_WRITE_VALUE = 2, 24896c5ddc4Srjs MALI_JOB_TYPE_CACHE_FLUSH = 3, 24996c5ddc4Srjs MALI_JOB_TYPE_COMPUTE = 4, 25096c5ddc4Srjs MALI_JOB_TYPE_VERTEX = 5, 25196c5ddc4Srjs MALI_JOB_TYPE_GEOMETRY = 6, 25296c5ddc4Srjs MALI_JOB_TYPE_TILER = 7, 25396c5ddc4Srjs MALI_JOB_TYPE_FUSED = 8, 25496c5ddc4Srjs MALI_JOB_TYPE_FRAGMENT = 9, 25596c5ddc4Srjs MALI_JOB_TYPE_INDEXED_VERTEX = 10, 25696c5ddc4Srjs}; 25796c5ddc4Srjs 25896c5ddc4Srjsstatic inline const char * 25996c5ddc4Srjsmali_job_type_as_str(enum mali_job_type imm) 26096c5ddc4Srjs{ 26196c5ddc4Srjs switch (imm) { 26296c5ddc4Srjs case MALI_JOB_TYPE_NOT_STARTED: return "Not started"; 26396c5ddc4Srjs case MALI_JOB_TYPE_NULL: return "Null"; 26496c5ddc4Srjs case MALI_JOB_TYPE_WRITE_VALUE: return "Write value"; 26596c5ddc4Srjs case MALI_JOB_TYPE_CACHE_FLUSH: return "Cache flush"; 26696c5ddc4Srjs case MALI_JOB_TYPE_COMPUTE: return "Compute"; 26796c5ddc4Srjs case MALI_JOB_TYPE_VERTEX: return "Vertex"; 26896c5ddc4Srjs case MALI_JOB_TYPE_GEOMETRY: return "Geometry"; 26996c5ddc4Srjs case MALI_JOB_TYPE_TILER: return "Tiler"; 27096c5ddc4Srjs case MALI_JOB_TYPE_FUSED: return "Fused"; 27196c5ddc4Srjs case MALI_JOB_TYPE_FRAGMENT: return "Fragment"; 27296c5ddc4Srjs case MALI_JOB_TYPE_INDEXED_VERTEX: return "Indexed Vertex"; 27396c5ddc4Srjs default: return "XXX: INVALID"; 27496c5ddc4Srjs } 27596c5ddc4Srjs} 27696c5ddc4Srjs 27796c5ddc4Srjsenum mali_draw_mode { 27896c5ddc4Srjs MALI_DRAW_MODE_NONE = 0, 27996c5ddc4Srjs MALI_DRAW_MODE_POINTS = 1, 28096c5ddc4Srjs MALI_DRAW_MODE_LINES = 2, 28196c5ddc4Srjs MALI_DRAW_MODE_LINE_STRIP = 4, 28296c5ddc4Srjs MALI_DRAW_MODE_LINE_LOOP = 6, 28396c5ddc4Srjs MALI_DRAW_MODE_TRIANGLES = 8, 28496c5ddc4Srjs MALI_DRAW_MODE_TRIANGLE_STRIP = 10, 28596c5ddc4Srjs MALI_DRAW_MODE_TRIANGLE_FAN = 12, 28696c5ddc4Srjs MALI_DRAW_MODE_POLYGON = 13, 28796c5ddc4Srjs MALI_DRAW_MODE_QUADS = 14, 28896c5ddc4Srjs MALI_DRAW_MODE_QUAD_STRIP = 15, 28996c5ddc4Srjs}; 29096c5ddc4Srjs 29196c5ddc4Srjsstatic inline const char * 29296c5ddc4Srjsmali_draw_mode_as_str(enum mali_draw_mode imm) 29396c5ddc4Srjs{ 29496c5ddc4Srjs switch (imm) { 29596c5ddc4Srjs case MALI_DRAW_MODE_NONE: return "None"; 29696c5ddc4Srjs case MALI_DRAW_MODE_POINTS: return "Points"; 29796c5ddc4Srjs case MALI_DRAW_MODE_LINES: return "Lines"; 29896c5ddc4Srjs case MALI_DRAW_MODE_LINE_STRIP: return "Line strip"; 29996c5ddc4Srjs case MALI_DRAW_MODE_LINE_LOOP: return "Line loop"; 30096c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLES: return "Triangles"; 30196c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLE_STRIP: return "Triangle strip"; 30296c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLE_FAN: return "Triangle fan"; 30396c5ddc4Srjs case MALI_DRAW_MODE_POLYGON: return "Polygon"; 30496c5ddc4Srjs case MALI_DRAW_MODE_QUADS: return "Quads"; 30596c5ddc4Srjs case MALI_DRAW_MODE_QUAD_STRIP: return "Quad strip"; 30696c5ddc4Srjs default: return "XXX: INVALID"; 30796c5ddc4Srjs } 30896c5ddc4Srjs} 30996c5ddc4Srjs 31096c5ddc4Srjsenum mali_exception_access { 31196c5ddc4Srjs MALI_EXCEPTION_ACCESS_NONE = 0, 31296c5ddc4Srjs MALI_EXCEPTION_ACCESS_EXECUTE = 2, 31396c5ddc4Srjs MALI_EXCEPTION_ACCESS_READ = 1, 31496c5ddc4Srjs MALI_EXCEPTION_ACCESS_WRITE = 3, 31596c5ddc4Srjs}; 31696c5ddc4Srjs 31796c5ddc4Srjsstatic inline const char * 31896c5ddc4Srjsmali_exception_access_as_str(enum mali_exception_access imm) 31996c5ddc4Srjs{ 32096c5ddc4Srjs switch (imm) { 32196c5ddc4Srjs case MALI_EXCEPTION_ACCESS_NONE: return "None"; 32296c5ddc4Srjs case MALI_EXCEPTION_ACCESS_EXECUTE: return "Execute"; 32396c5ddc4Srjs case MALI_EXCEPTION_ACCESS_READ: return "Read"; 32496c5ddc4Srjs case MALI_EXCEPTION_ACCESS_WRITE: return "Write"; 32596c5ddc4Srjs default: return "XXX: INVALID"; 32696c5ddc4Srjs } 32796c5ddc4Srjs} 32896c5ddc4Srjs 32996c5ddc4Srjsenum mali_func { 33096c5ddc4Srjs MALI_FUNC_NEVER = 0, 33196c5ddc4Srjs MALI_FUNC_LESS = 1, 33296c5ddc4Srjs MALI_FUNC_EQUAL = 2, 33396c5ddc4Srjs MALI_FUNC_LEQUAL = 3, 33496c5ddc4Srjs MALI_FUNC_GREATER = 4, 33596c5ddc4Srjs MALI_FUNC_NOT_EQUAL = 5, 33696c5ddc4Srjs MALI_FUNC_GEQUAL = 6, 33796c5ddc4Srjs MALI_FUNC_ALWAYS = 7, 33896c5ddc4Srjs}; 33996c5ddc4Srjs 34096c5ddc4Srjsstatic inline const char * 34196c5ddc4Srjsmali_func_as_str(enum mali_func imm) 34296c5ddc4Srjs{ 34396c5ddc4Srjs switch (imm) { 34496c5ddc4Srjs case MALI_FUNC_NEVER: return "Never"; 34596c5ddc4Srjs case MALI_FUNC_LESS: return "Less"; 34696c5ddc4Srjs case MALI_FUNC_EQUAL: return "Equal"; 34796c5ddc4Srjs case MALI_FUNC_LEQUAL: return "Lequal"; 34896c5ddc4Srjs case MALI_FUNC_GREATER: return "Greater"; 34996c5ddc4Srjs case MALI_FUNC_NOT_EQUAL: return "Not Equal"; 35096c5ddc4Srjs case MALI_FUNC_GEQUAL: return "Gequal"; 35196c5ddc4Srjs case MALI_FUNC_ALWAYS: return "Always"; 35296c5ddc4Srjs default: return "XXX: INVALID"; 35396c5ddc4Srjs } 35496c5ddc4Srjs} 35596c5ddc4Srjs 35696c5ddc4Srjsenum mali_format { 35796c5ddc4Srjs MALI_ETC2_RGB8 = 1, 35896c5ddc4Srjs MALI_ETC2_R11_UNORM = 2, 35996c5ddc4Srjs MALI_ETC2_RGBA8 = 3, 36096c5ddc4Srjs MALI_ETC2_RG11_UNORM = 4, 36196c5ddc4Srjs MALI_BC1_UNORM = 7, 36296c5ddc4Srjs MALI_BC2_UNORM = 8, 36396c5ddc4Srjs MALI_BC3_UNORM = 9, 36496c5ddc4Srjs MALI_BC4_UNORM = 10, 36596c5ddc4Srjs MALI_BC4_SNORM = 11, 36696c5ddc4Srjs MALI_BC5_UNORM = 12, 36796c5ddc4Srjs MALI_BC5_SNORM = 13, 36896c5ddc4Srjs MALI_BC6H_UF16 = 14, 36996c5ddc4Srjs MALI_BC6H_SF16 = 15, 37096c5ddc4Srjs MALI_BC7_UNORM = 16, 37196c5ddc4Srjs MALI_ETC2_R11_SNORM = 17, 37296c5ddc4Srjs MALI_ETC2_RG11_SNORM = 18, 37396c5ddc4Srjs MALI_ETC2_RGB8A1 = 19, 37496c5ddc4Srjs MALI_ASTC_3D_LDR = 20, 37596c5ddc4Srjs MALI_ASTC_3D_HDR = 21, 37696c5ddc4Srjs MALI_ASTC_2D_LDR = 22, 37796c5ddc4Srjs MALI_ASTC_2D_HDR = 23, 37896c5ddc4Srjs MALI_RGB565 = 64, 37996c5ddc4Srjs MALI_RGB5_A1_UNORM = 65, 38096c5ddc4Srjs MALI_A1_BGR5_UNORM = 66, 38196c5ddc4Srjs MALI_RGB10_A2_UNORM = 67, 38296c5ddc4Srjs MALI_A2_BGR10_UNORM = 68, 38396c5ddc4Srjs MALI_RGB10_A2_SNORM = 69, 38496c5ddc4Srjs MALI_A2_BGR10_SNORM = 70, 38596c5ddc4Srjs MALI_RGB10_A2UI = 71, 38696c5ddc4Srjs MALI_A2_BGR10UI = 72, 38796c5ddc4Srjs MALI_RGB10_A2I = 73, 38896c5ddc4Srjs MALI_A2_BGR10I = 74, 38996c5ddc4Srjs MALI_Z24X8_UNORM = 77, 39096c5ddc4Srjs MALI_X8Z24 = 78, 39196c5ddc4Srjs MALI_X32_S8X24 = 79, 39296c5ddc4Srjs MALI_X24S8_X32 = 80, 39396c5ddc4Srjs MALI_R32_FIXED = 81, 39496c5ddc4Srjs MALI_RG32_FIXED = 82, 39596c5ddc4Srjs MALI_RGB32_FIXED = 83, 39696c5ddc4Srjs MALI_RGBA32_FIXED = 84, 39796c5ddc4Srjs MALI_R11F_G11F_B10F = 89, 39896c5ddc4Srjs MALI_B10F_G11F_R11F = 90, 39996c5ddc4Srjs MALI_R9F_G9F_B9F_E5F = 91, 40096c5ddc4Srjs MALI_E5F_B9F_G9F_R9F = 92, 40196c5ddc4Srjs MALI_SNAP_2 = 93, 40296c5ddc4Srjs MALI_SNAP_4 = 94, 40396c5ddc4Srjs MALI_CONSTANT = 95, 40496c5ddc4Srjs MALI_R1_SNORM = 96, 40596c5ddc4Srjs MALI_R2_SNORM = 97, 40696c5ddc4Srjs MALI_R4_SNORM = 98, 40796c5ddc4Srjs MALI_R8_SNORM = 99, 40896c5ddc4Srjs MALI_R16_SNORM = 100, 40996c5ddc4Srjs MALI_R32_SNORM = 101, 41096c5ddc4Srjs MALI_R64_SNORM = 102, 41196c5ddc4Srjs MALI_RG1_SNORM = 104, 41296c5ddc4Srjs MALI_RG2_SNORM = 105, 41396c5ddc4Srjs MALI_RG4_SNORM = 106, 41496c5ddc4Srjs MALI_RG8_SNORM = 107, 41596c5ddc4Srjs MALI_RG16_SNORM = 108, 41696c5ddc4Srjs MALI_RG32_SNORM = 109, 41796c5ddc4Srjs MALI_RG64_SNORM = 110, 41896c5ddc4Srjs MALI_RGB1_SNORM = 112, 41996c5ddc4Srjs MALI_RGB2_SNORM = 113, 42096c5ddc4Srjs MALI_RGB4_SNORM = 114, 42196c5ddc4Srjs MALI_RGB8_SNORM = 115, 42296c5ddc4Srjs MALI_RGB16_SNORM = 116, 42396c5ddc4Srjs MALI_RGB32_SNORM = 117, 42496c5ddc4Srjs MALI_RGB64_SNORM = 118, 42596c5ddc4Srjs MALI_RGBA1_SNORM = 120, 42696c5ddc4Srjs MALI_RGBA2_SNORM = 121, 42796c5ddc4Srjs MALI_RGBA4_SNORM = 122, 42896c5ddc4Srjs MALI_RGBA8_SNORM = 123, 42996c5ddc4Srjs MALI_RGBA16_SNORM = 124, 43096c5ddc4Srjs MALI_RGBA32_SNORM = 125, 43196c5ddc4Srjs MALI_RGBA64_SNORM = 126, 43296c5ddc4Srjs MALI_R1UI = 128, 43396c5ddc4Srjs MALI_R2UI = 129, 43496c5ddc4Srjs MALI_R4UI = 130, 43596c5ddc4Srjs MALI_R8UI = 131, 43696c5ddc4Srjs MALI_R16UI = 132, 43796c5ddc4Srjs MALI_R32UI = 133, 43896c5ddc4Srjs MALI_R64UI = 134, 43996c5ddc4Srjs MALI_R64F = 135, 44096c5ddc4Srjs MALI_RG1UI = 136, 44196c5ddc4Srjs MALI_RG2UI = 137, 44296c5ddc4Srjs MALI_RG4UI = 138, 44396c5ddc4Srjs MALI_RG8UI = 139, 44496c5ddc4Srjs MALI_RG16UI = 140, 44596c5ddc4Srjs MALI_RG32UI = 141, 44696c5ddc4Srjs MALI_RG64UI = 142, 44796c5ddc4Srjs MALI_RG64F = 143, 44896c5ddc4Srjs MALI_RGB1UI = 144, 44996c5ddc4Srjs MALI_RGB2UI = 145, 45096c5ddc4Srjs MALI_RGB4UI = 146, 45196c5ddc4Srjs MALI_RGB8UI = 147, 45296c5ddc4Srjs MALI_RGB16UI = 148, 45396c5ddc4Srjs MALI_RGB32UI = 149, 45496c5ddc4Srjs MALI_RGB64UI = 150, 45596c5ddc4Srjs MALI_RGB64F = 151, 45696c5ddc4Srjs MALI_RGBA1UI = 152, 45796c5ddc4Srjs MALI_RGBA2UI = 153, 45896c5ddc4Srjs MALI_RGBA4UI = 154, 45996c5ddc4Srjs MALI_RGBA8UI = 155, 46096c5ddc4Srjs MALI_RGBA16UI = 156, 46196c5ddc4Srjs MALI_RGBA32UI = 157, 46296c5ddc4Srjs MALI_RGBA64UI = 158, 46396c5ddc4Srjs MALI_RGBA64F = 159, 46496c5ddc4Srjs MALI_R1_UNORM = 160, 46596c5ddc4Srjs MALI_R2_UNORM = 161, 46696c5ddc4Srjs MALI_R4_UNORM = 162, 46796c5ddc4Srjs MALI_R8_UNORM = 163, 46896c5ddc4Srjs MALI_R16_UNORM = 164, 46996c5ddc4Srjs MALI_R32_UNORM = 165, 47096c5ddc4Srjs MALI_R64_UNORM = 166, 47196c5ddc4Srjs MALI_R32F = 167, 47296c5ddc4Srjs MALI_RG1_UNORM = 168, 47396c5ddc4Srjs MALI_RG2_UNORM = 169, 47496c5ddc4Srjs MALI_RG4_UNORM = 170, 47596c5ddc4Srjs MALI_RG8_UNORM = 171, 47696c5ddc4Srjs MALI_RG16_UNORM = 172, 47796c5ddc4Srjs MALI_RG32_UNORM = 173, 47896c5ddc4Srjs MALI_RG64_UNORM = 174, 47996c5ddc4Srjs MALI_RG32F = 175, 48096c5ddc4Srjs MALI_RGB1_UNORM = 176, 48196c5ddc4Srjs MALI_RGB2_UNORM = 177, 48296c5ddc4Srjs MALI_RGB4_UNORM = 178, 48396c5ddc4Srjs MALI_RGB8_UNORM = 179, 48496c5ddc4Srjs MALI_RGB16_UNORM = 180, 48596c5ddc4Srjs MALI_RGB32_UNORM = 181, 48696c5ddc4Srjs MALI_RGB64_UNORM = 182, 48796c5ddc4Srjs MALI_RGB32F = 183, 48896c5ddc4Srjs MALI_RGBA1_UNORM = 184, 48996c5ddc4Srjs MALI_RGBA2_UNORM = 185, 49096c5ddc4Srjs MALI_RGBA4_UNORM = 186, 49196c5ddc4Srjs MALI_RGBA8_UNORM = 187, 49296c5ddc4Srjs MALI_RGBA16_UNORM = 188, 49396c5ddc4Srjs MALI_RGBA32_UNORM = 189, 49496c5ddc4Srjs MALI_RGBA64_UNORM = 190, 49596c5ddc4Srjs MALI_RGBA32F = 191, 49696c5ddc4Srjs MALI_R1I = 192, 49796c5ddc4Srjs MALI_R2I = 193, 49896c5ddc4Srjs MALI_R4I = 194, 49996c5ddc4Srjs MALI_R8I = 195, 50096c5ddc4Srjs MALI_R16I = 196, 50196c5ddc4Srjs MALI_R32I = 197, 50296c5ddc4Srjs MALI_R64I = 198, 50396c5ddc4Srjs MALI_R16F = 199, 50496c5ddc4Srjs MALI_RG1I = 200, 50596c5ddc4Srjs MALI_RG2I = 201, 50696c5ddc4Srjs MALI_RG4I = 202, 50796c5ddc4Srjs MALI_RG8I = 203, 50896c5ddc4Srjs MALI_RG16I = 204, 50996c5ddc4Srjs MALI_RG32I = 205, 51096c5ddc4Srjs MALI_RG64I = 206, 51196c5ddc4Srjs MALI_RG16F = 207, 51296c5ddc4Srjs MALI_RGB1I = 208, 51396c5ddc4Srjs MALI_RGB2I = 209, 51496c5ddc4Srjs MALI_RGB4I = 210, 51596c5ddc4Srjs MALI_RGB8I = 211, 51696c5ddc4Srjs MALI_RGB16I = 212, 51796c5ddc4Srjs MALI_RGB32I = 213, 51896c5ddc4Srjs MALI_RGB64I = 214, 51996c5ddc4Srjs MALI_RGB16F = 215, 52096c5ddc4Srjs MALI_RGBA1I = 216, 52196c5ddc4Srjs MALI_RGBA2I = 217, 52296c5ddc4Srjs MALI_RGBA4I = 218, 52396c5ddc4Srjs MALI_RGBA8I = 219, 52496c5ddc4Srjs MALI_RGBA16I = 220, 52596c5ddc4Srjs MALI_RGBA32I = 221, 52696c5ddc4Srjs MALI_RGBA64I = 222, 52796c5ddc4Srjs MALI_RGBA16F = 223, 52896c5ddc4Srjs MALI_RGB5_A1_AU = 224, 52996c5ddc4Srjs MALI_RGB5_A1_PU = 225, 53096c5ddc4Srjs MALI_R5G6B5_AU = 226, 53196c5ddc4Srjs MALI_R5G6B5_PU = 227, 53296c5ddc4Srjs MALI_SNAP4_V = 230, 53396c5ddc4Srjs MALI_RGBA4_AU = 232, 53496c5ddc4Srjs MALI_RGBA4_PU = 233, 53596c5ddc4Srjs MALI_RGBA8_TB = 237, 53696c5ddc4Srjs MALI_RGB10_A2_TB = 238, 53796c5ddc4Srjs MALI_TESS_VERTEX_PACK = 240, 53896c5ddc4Srjs MALI_RGB8_A2_AU = 241, 53996c5ddc4Srjs MALI_RGB8_A2_PU = 242, 54096c5ddc4Srjs}; 54196c5ddc4Srjs 54296c5ddc4Srjsstatic inline const char * 54396c5ddc4Srjsmali_format_as_str(enum mali_format imm) 54496c5ddc4Srjs{ 54596c5ddc4Srjs switch (imm) { 54696c5ddc4Srjs case MALI_ETC2_RGB8: return "ETC2 RGB8"; 54796c5ddc4Srjs case MALI_ETC2_R11_UNORM: return "ETC2 R11 UNORM"; 54896c5ddc4Srjs case MALI_ETC2_RGBA8: return "ETC2 RGBA8"; 54996c5ddc4Srjs case MALI_ETC2_RG11_UNORM: return "ETC2 RG11 UNORM"; 55096c5ddc4Srjs case MALI_BC1_UNORM: return "BC1 UNORM"; 55196c5ddc4Srjs case MALI_BC2_UNORM: return "BC2 UNORM"; 55296c5ddc4Srjs case MALI_BC3_UNORM: return "BC3 UNORM"; 55396c5ddc4Srjs case MALI_BC4_UNORM: return "BC4 UNORM"; 55496c5ddc4Srjs case MALI_BC4_SNORM: return "BC4 SNORM"; 55596c5ddc4Srjs case MALI_BC5_UNORM: return "BC5 UNORM"; 55696c5ddc4Srjs case MALI_BC5_SNORM: return "BC5 SNORM"; 55796c5ddc4Srjs case MALI_BC6H_UF16: return "BC6H UF16"; 55896c5ddc4Srjs case MALI_BC6H_SF16: return "BC6H SF16"; 55996c5ddc4Srjs case MALI_BC7_UNORM: return "BC7 UNORM"; 56096c5ddc4Srjs case MALI_ETC2_R11_SNORM: return "ETC2 R11 SNORM"; 56196c5ddc4Srjs case MALI_ETC2_RG11_SNORM: return "ETC2 RG11 SNORM"; 56296c5ddc4Srjs case MALI_ETC2_RGB8A1: return "ETC2 RGB8A1"; 56396c5ddc4Srjs case MALI_ASTC_3D_LDR: return "ASTC 3D LDR"; 56496c5ddc4Srjs case MALI_ASTC_3D_HDR: return "ASTC 3D HDR"; 56596c5ddc4Srjs case MALI_ASTC_2D_LDR: return "ASTC 2D LDR"; 56696c5ddc4Srjs case MALI_ASTC_2D_HDR: return "ASTC 2D HDR"; 56796c5ddc4Srjs case MALI_RGB565: return "RGB565"; 56896c5ddc4Srjs case MALI_RGB5_A1_UNORM: return "RGB5 A1 UNORM"; 56996c5ddc4Srjs case MALI_A1_BGR5_UNORM: return "A1 BGR5 UNORM"; 57096c5ddc4Srjs case MALI_RGB10_A2_UNORM: return "RGB10 A2 UNORM"; 57196c5ddc4Srjs case MALI_A2_BGR10_UNORM: return "A2 BGR10 UNORM"; 57296c5ddc4Srjs case MALI_RGB10_A2_SNORM: return "RGB10 A2 SNORM"; 57396c5ddc4Srjs case MALI_A2_BGR10_SNORM: return "A2 BGR10 SNORM"; 57496c5ddc4Srjs case MALI_RGB10_A2UI: return "RGB10 A2UI"; 57596c5ddc4Srjs case MALI_A2_BGR10UI: return "A2 BGR10UI"; 57696c5ddc4Srjs case MALI_RGB10_A2I: return "RGB10 A2I"; 57796c5ddc4Srjs case MALI_A2_BGR10I: return "A2 BGR10I"; 57896c5ddc4Srjs case MALI_Z24X8_UNORM: return "Z24X8 UNORM"; 57996c5ddc4Srjs case MALI_X8Z24: return "X8Z24"; 58096c5ddc4Srjs case MALI_X32_S8X24: return "X32 S8X24"; 58196c5ddc4Srjs case MALI_X24S8_X32: return "X24S8 X32"; 58296c5ddc4Srjs case MALI_R32_FIXED: return "R32 FIXED"; 58396c5ddc4Srjs case MALI_RG32_FIXED: return "RG32 FIXED"; 58496c5ddc4Srjs case MALI_RGB32_FIXED: return "RGB32 FIXED"; 58596c5ddc4Srjs case MALI_RGBA32_FIXED: return "RGBA32 FIXED"; 58696c5ddc4Srjs case MALI_R11F_G11F_B10F: return "R11F G11F B10F"; 58796c5ddc4Srjs case MALI_B10F_G11F_R11F: return "B10F G11F R11F"; 58896c5ddc4Srjs case MALI_R9F_G9F_B9F_E5F: return "R9F G9F B9F E5F"; 58996c5ddc4Srjs case MALI_E5F_B9F_G9F_R9F: return "E5F B9F G9F R9F"; 59096c5ddc4Srjs case MALI_SNAP_2: return "Snap 2"; 59196c5ddc4Srjs case MALI_SNAP_4: return "Snap 4"; 59296c5ddc4Srjs case MALI_CONSTANT: return "Constant"; 59396c5ddc4Srjs case MALI_R1_SNORM: return "R1 SNORM"; 59496c5ddc4Srjs case MALI_R2_SNORM: return "R2 SNORM"; 59596c5ddc4Srjs case MALI_R4_SNORM: return "R4 SNORM"; 59696c5ddc4Srjs case MALI_R8_SNORM: return "R8 SNORM"; 59796c5ddc4Srjs case MALI_R16_SNORM: return "R16 SNORM"; 59896c5ddc4Srjs case MALI_R32_SNORM: return "R32 SNORM"; 59996c5ddc4Srjs case MALI_R64_SNORM: return "R64 SNORM"; 60096c5ddc4Srjs case MALI_RG1_SNORM: return "RG1 SNORM"; 60196c5ddc4Srjs case MALI_RG2_SNORM: return "RG2 SNORM"; 60296c5ddc4Srjs case MALI_RG4_SNORM: return "RG4 SNORM"; 60396c5ddc4Srjs case MALI_RG8_SNORM: return "RG8 SNORM"; 60496c5ddc4Srjs case MALI_RG16_SNORM: return "RG16 SNORM"; 60596c5ddc4Srjs case MALI_RG32_SNORM: return "RG32 SNORM"; 60696c5ddc4Srjs case MALI_RG64_SNORM: return "RG64 SNORM"; 60796c5ddc4Srjs case MALI_RGB1_SNORM: return "RGB1 SNORM"; 60896c5ddc4Srjs case MALI_RGB2_SNORM: return "RGB2 SNORM"; 60996c5ddc4Srjs case MALI_RGB4_SNORM: return "RGB4 SNORM"; 61096c5ddc4Srjs case MALI_RGB8_SNORM: return "RGB8 SNORM"; 61196c5ddc4Srjs case MALI_RGB16_SNORM: return "RGB16 SNORM"; 61296c5ddc4Srjs case MALI_RGB32_SNORM: return "RGB32 SNORM"; 61396c5ddc4Srjs case MALI_RGB64_SNORM: return "RGB64 SNORM"; 61496c5ddc4Srjs case MALI_RGBA1_SNORM: return "RGBA1 SNORM"; 61596c5ddc4Srjs case MALI_RGBA2_SNORM: return "RGBA2 SNORM"; 61696c5ddc4Srjs case MALI_RGBA4_SNORM: return "RGBA4 SNORM"; 61796c5ddc4Srjs case MALI_RGBA8_SNORM: return "RGBA8 SNORM"; 61896c5ddc4Srjs case MALI_RGBA16_SNORM: return "RGBA16 SNORM"; 61996c5ddc4Srjs case MALI_RGBA32_SNORM: return "RGBA32 SNORM"; 62096c5ddc4Srjs case MALI_RGBA64_SNORM: return "RGBA64 SNORM"; 62196c5ddc4Srjs case MALI_R1UI: return "R1UI"; 62296c5ddc4Srjs case MALI_R2UI: return "R2UI"; 62396c5ddc4Srjs case MALI_R4UI: return "R4UI"; 62496c5ddc4Srjs case MALI_R8UI: return "R8UI"; 62596c5ddc4Srjs case MALI_R16UI: return "R16UI"; 62696c5ddc4Srjs case MALI_R32UI: return "R32UI"; 62796c5ddc4Srjs case MALI_R64UI: return "R64UI"; 62896c5ddc4Srjs case MALI_R64F: return "R64F"; 62996c5ddc4Srjs case MALI_RG1UI: return "RG1UI"; 63096c5ddc4Srjs case MALI_RG2UI: return "RG2UI"; 63196c5ddc4Srjs case MALI_RG4UI: return "RG4UI"; 63296c5ddc4Srjs case MALI_RG8UI: return "RG8UI"; 63396c5ddc4Srjs case MALI_RG16UI: return "RG16UI"; 63496c5ddc4Srjs case MALI_RG32UI: return "RG32UI"; 63596c5ddc4Srjs case MALI_RG64UI: return "RG64UI"; 63696c5ddc4Srjs case MALI_RG64F: return "RG64F"; 63796c5ddc4Srjs case MALI_RGB1UI: return "RGB1UI"; 63896c5ddc4Srjs case MALI_RGB2UI: return "RGB2UI"; 63996c5ddc4Srjs case MALI_RGB4UI: return "RGB4UI"; 64096c5ddc4Srjs case MALI_RGB8UI: return "RGB8UI"; 64196c5ddc4Srjs case MALI_RGB16UI: return "RGB16UI"; 64296c5ddc4Srjs case MALI_RGB32UI: return "RGB32UI"; 64396c5ddc4Srjs case MALI_RGB64UI: return "RGB64UI"; 64496c5ddc4Srjs case MALI_RGB64F: return "RGB64F"; 64596c5ddc4Srjs case MALI_RGBA1UI: return "RGBA1UI"; 64696c5ddc4Srjs case MALI_RGBA2UI: return "RGBA2UI"; 64796c5ddc4Srjs case MALI_RGBA4UI: return "RGBA4UI"; 64896c5ddc4Srjs case MALI_RGBA8UI: return "RGBA8UI"; 64996c5ddc4Srjs case MALI_RGBA16UI: return "RGBA16UI"; 65096c5ddc4Srjs case MALI_RGBA32UI: return "RGBA32UI"; 65196c5ddc4Srjs case MALI_RGBA64UI: return "RGBA64UI"; 65296c5ddc4Srjs case MALI_RGBA64F: return "RGBA64F"; 65396c5ddc4Srjs case MALI_R1_UNORM: return "R1 UNORM"; 65496c5ddc4Srjs case MALI_R2_UNORM: return "R2 UNORM"; 65596c5ddc4Srjs case MALI_R4_UNORM: return "R4 UNORM"; 65696c5ddc4Srjs case MALI_R8_UNORM: return "R8 UNORM"; 65796c5ddc4Srjs case MALI_R16_UNORM: return "R16 UNORM"; 65896c5ddc4Srjs case MALI_R32_UNORM: return "R32 UNORM"; 65996c5ddc4Srjs case MALI_R64_UNORM: return "R64 UNORM"; 66096c5ddc4Srjs case MALI_R32F: return "R32F"; 66196c5ddc4Srjs case MALI_RG1_UNORM: return "RG1 UNORM"; 66296c5ddc4Srjs case MALI_RG2_UNORM: return "RG2 UNORM"; 66396c5ddc4Srjs case MALI_RG4_UNORM: return "RG4 UNORM"; 66496c5ddc4Srjs case MALI_RG8_UNORM: return "RG8 UNORM"; 66596c5ddc4Srjs case MALI_RG16_UNORM: return "RG16 UNORM"; 66696c5ddc4Srjs case MALI_RG32_UNORM: return "RG32 UNORM"; 66796c5ddc4Srjs case MALI_RG64_UNORM: return "RG64 UNORM"; 66896c5ddc4Srjs case MALI_RG32F: return "RG32F"; 66996c5ddc4Srjs case MALI_RGB1_UNORM: return "RGB1 UNORM"; 67096c5ddc4Srjs case MALI_RGB2_UNORM: return "RGB2 UNORM"; 67196c5ddc4Srjs case MALI_RGB4_UNORM: return "RGB4 UNORM"; 67296c5ddc4Srjs case MALI_RGB8_UNORM: return "RGB8 UNORM"; 67396c5ddc4Srjs case MALI_RGB16_UNORM: return "RGB16 UNORM"; 67496c5ddc4Srjs case MALI_RGB32_UNORM: return "RGB32 UNORM"; 67596c5ddc4Srjs case MALI_RGB64_UNORM: return "RGB64 UNORM"; 67696c5ddc4Srjs case MALI_RGB32F: return "RGB32F"; 67796c5ddc4Srjs case MALI_RGBA1_UNORM: return "RGBA1 UNORM"; 67896c5ddc4Srjs case MALI_RGBA2_UNORM: return "RGBA2 UNORM"; 67996c5ddc4Srjs case MALI_RGBA4_UNORM: return "RGBA4 UNORM"; 68096c5ddc4Srjs case MALI_RGBA8_UNORM: return "RGBA8 UNORM"; 68196c5ddc4Srjs case MALI_RGBA16_UNORM: return "RGBA16 UNORM"; 68296c5ddc4Srjs case MALI_RGBA32_UNORM: return "RGBA32 UNORM"; 68396c5ddc4Srjs case MALI_RGBA64_UNORM: return "RGBA64 UNORM"; 68496c5ddc4Srjs case MALI_RGBA32F: return "RGBA32F"; 68596c5ddc4Srjs case MALI_R1I: return "R1I"; 68696c5ddc4Srjs case MALI_R2I: return "R2I"; 68796c5ddc4Srjs case MALI_R4I: return "R4I"; 68896c5ddc4Srjs case MALI_R8I: return "R8I"; 68996c5ddc4Srjs case MALI_R16I: return "R16I"; 69096c5ddc4Srjs case MALI_R32I: return "R32I"; 69196c5ddc4Srjs case MALI_R64I: return "R64I"; 69296c5ddc4Srjs case MALI_R16F: return "R16F"; 69396c5ddc4Srjs case MALI_RG1I: return "RG1I"; 69496c5ddc4Srjs case MALI_RG2I: return "RG2I"; 69596c5ddc4Srjs case MALI_RG4I: return "RG4I"; 69696c5ddc4Srjs case MALI_RG8I: return "RG8I"; 69796c5ddc4Srjs case MALI_RG16I: return "RG16I"; 69896c5ddc4Srjs case MALI_RG32I: return "RG32I"; 69996c5ddc4Srjs case MALI_RG64I: return "RG64I"; 70096c5ddc4Srjs case MALI_RG16F: return "RG16F"; 70196c5ddc4Srjs case MALI_RGB1I: return "RGB1I"; 70296c5ddc4Srjs case MALI_RGB2I: return "RGB2I"; 70396c5ddc4Srjs case MALI_RGB4I: return "RGB4I"; 70496c5ddc4Srjs case MALI_RGB8I: return "RGB8I"; 70596c5ddc4Srjs case MALI_RGB16I: return "RGB16I"; 70696c5ddc4Srjs case MALI_RGB32I: return "RGB32I"; 70796c5ddc4Srjs case MALI_RGB64I: return "RGB64I"; 70896c5ddc4Srjs case MALI_RGB16F: return "RGB16F"; 70996c5ddc4Srjs case MALI_RGBA1I: return "RGBA1I"; 71096c5ddc4Srjs case MALI_RGBA2I: return "RGBA2I"; 71196c5ddc4Srjs case MALI_RGBA4I: return "RGBA4I"; 71296c5ddc4Srjs case MALI_RGBA8I: return "RGBA8I"; 71396c5ddc4Srjs case MALI_RGBA16I: return "RGBA16I"; 71496c5ddc4Srjs case MALI_RGBA32I: return "RGBA32I"; 71596c5ddc4Srjs case MALI_RGBA64I: return "RGBA64I"; 71696c5ddc4Srjs case MALI_RGBA16F: return "RGBA16F"; 71796c5ddc4Srjs case MALI_RGB5_A1_AU: return "RGB5 A1 AU"; 71896c5ddc4Srjs case MALI_RGB5_A1_PU: return "RGB5 A1 PU"; 71996c5ddc4Srjs case MALI_R5G6B5_AU: return "R5G6B5 AU"; 72096c5ddc4Srjs case MALI_R5G6B5_PU: return "R5G6B5 PU"; 72196c5ddc4Srjs case MALI_SNAP4_V: return "Snap4 V"; 72296c5ddc4Srjs case MALI_RGBA4_AU: return "RGBA4 AU"; 72396c5ddc4Srjs case MALI_RGBA4_PU: return "RGBA4 PU"; 72496c5ddc4Srjs case MALI_RGBA8_TB: return "RGBA8 TB"; 72596c5ddc4Srjs case MALI_RGB10_A2_TB: return "RGB10 A2 TB"; 72696c5ddc4Srjs case MALI_TESS_VERTEX_PACK: return "Tess Vertex Pack"; 72796c5ddc4Srjs case MALI_RGB8_A2_AU: return "RGB8 A2 AU"; 72896c5ddc4Srjs case MALI_RGB8_A2_PU: return "RGB8 A2 PU"; 72996c5ddc4Srjs default: return "XXX: INVALID"; 73096c5ddc4Srjs } 73196c5ddc4Srjs} 73296c5ddc4Srjs 73396c5ddc4Srjsenum mali_yuv_swizzle { 73496c5ddc4Srjs MALI_YUV_SWIZZLE_YUVA = 0, 73596c5ddc4Srjs MALI_YUV_SWIZZLE_YVUA = 1, 73696c5ddc4Srjs MALI_YUV_SWIZZLE_UYVA = 2, 73796c5ddc4Srjs MALI_YUV_SWIZZLE_UVYA = 3, 73896c5ddc4Srjs MALI_YUV_SWIZZLE_VUYA = 4, 73996c5ddc4Srjs MALI_YUV_SWIZZLE_VYUA = 5, 74096c5ddc4Srjs MALI_YUV_SWIZZLE_Y00A = 6, 74196c5ddc4Srjs MALI_YUV_SWIZZLE_YXXA = 7, 74296c5ddc4Srjs}; 74396c5ddc4Srjs 74496c5ddc4Srjsstatic inline const char * 74596c5ddc4Srjsmali_yuv_swizzle_as_str(enum mali_yuv_swizzle imm) 74696c5ddc4Srjs{ 74796c5ddc4Srjs switch (imm) { 74896c5ddc4Srjs case MALI_YUV_SWIZZLE_YUVA: return "YUVA"; 74996c5ddc4Srjs case MALI_YUV_SWIZZLE_YVUA: return "YVUA"; 75096c5ddc4Srjs case MALI_YUV_SWIZZLE_UYVA: return "UYVA"; 75196c5ddc4Srjs case MALI_YUV_SWIZZLE_UVYA: return "UVYA"; 75296c5ddc4Srjs case MALI_YUV_SWIZZLE_VUYA: return "VUYA"; 75396c5ddc4Srjs case MALI_YUV_SWIZZLE_VYUA: return "VYUA"; 75496c5ddc4Srjs case MALI_YUV_SWIZZLE_Y00A: return "Y00A"; 75596c5ddc4Srjs case MALI_YUV_SWIZZLE_YXXA: return "YXXA"; 75696c5ddc4Srjs default: return "XXX: INVALID"; 75796c5ddc4Srjs } 75896c5ddc4Srjs} 75996c5ddc4Srjs 76096c5ddc4Srjsenum mali_yuv_conversion_mode { 76196c5ddc4Srjs MALI_YUV_CONVERSION_MODE_NO_CONVERSION = 0, 76296c5ddc4Srjs MALI_YUV_CONVERSION_MODE_BT_601 = 3, 76396c5ddc4Srjs MALI_YUV_CONVERSION_MODE_BT_709 = 4, 76496c5ddc4Srjs MALI_YUV_CONVERSION_MODE_BT_2020 = 6, 76596c5ddc4Srjs}; 76696c5ddc4Srjs 76796c5ddc4Srjsstatic inline const char * 76896c5ddc4Srjsmali_yuv_conversion_mode_as_str(enum mali_yuv_conversion_mode imm) 76996c5ddc4Srjs{ 77096c5ddc4Srjs switch (imm) { 77196c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_NO_CONVERSION: return "No Conversion"; 77296c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_BT_601: return "BT 601"; 77396c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_BT_709: return "BT 709"; 77496c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_BT_2020: return "BT 2020"; 77596c5ddc4Srjs default: return "XXX: INVALID"; 77696c5ddc4Srjs } 77796c5ddc4Srjs} 77896c5ddc4Srjs 77996c5ddc4Srjsenum mali_yuv_cr_siting { 78096c5ddc4Srjs MALI_YUV_CR_SITING_CO_SITED = 0, 78196c5ddc4Srjs MALI_YUV_CR_SITING_CENTER_Y = 1, 78296c5ddc4Srjs MALI_YUV_CR_SITING_CENTER_X = 2, 78396c5ddc4Srjs MALI_YUV_CR_SITING_CENTER = 3, 78496c5ddc4Srjs MALI_YUV_CR_SITING_ONE_QUARTER = 4, 78596c5ddc4Srjs MALI_YUV_CR_SITING_THREE_QUARTERS = 5, 78696c5ddc4Srjs MALI_YUV_CR_SITING_REPLICATED = 7, 78796c5ddc4Srjs}; 78896c5ddc4Srjs 78996c5ddc4Srjsstatic inline const char * 79096c5ddc4Srjsmali_yuv_cr_siting_as_str(enum mali_yuv_cr_siting imm) 79196c5ddc4Srjs{ 79296c5ddc4Srjs switch (imm) { 79396c5ddc4Srjs case MALI_YUV_CR_SITING_CO_SITED: return "Co-Sited"; 79496c5ddc4Srjs case MALI_YUV_CR_SITING_CENTER_Y: return "Center Y"; 79596c5ddc4Srjs case MALI_YUV_CR_SITING_CENTER_X: return "Center X"; 79696c5ddc4Srjs case MALI_YUV_CR_SITING_CENTER: return "Center"; 79796c5ddc4Srjs case MALI_YUV_CR_SITING_ONE_QUARTER: return "One Quarter"; 79896c5ddc4Srjs case MALI_YUV_CR_SITING_THREE_QUARTERS: return "Three Quarters"; 79996c5ddc4Srjs case MALI_YUV_CR_SITING_REPLICATED: return "Replicated"; 80096c5ddc4Srjs default: return "XXX: INVALID"; 80196c5ddc4Srjs } 80296c5ddc4Srjs} 80396c5ddc4Srjs 80496c5ddc4Srjsenum mali_astc_2d_dimension { 80596c5ddc4Srjs MALI_ASTC_2D_DIMENSION_4 = 0, 80696c5ddc4Srjs MALI_ASTC_2D_DIMENSION_5 = 1, 80796c5ddc4Srjs MALI_ASTC_2D_DIMENSION_6 = 2, 80896c5ddc4Srjs MALI_ASTC_2D_DIMENSION_8 = 4, 80996c5ddc4Srjs MALI_ASTC_2D_DIMENSION_10 = 6, 81096c5ddc4Srjs MALI_ASTC_2D_DIMENSION_12 = 7, 81196c5ddc4Srjs}; 81296c5ddc4Srjs 81396c5ddc4Srjsstatic inline const char * 81496c5ddc4Srjsmali_astc_2d_dimension_as_str(enum mali_astc_2d_dimension imm) 81596c5ddc4Srjs{ 81696c5ddc4Srjs switch (imm) { 81796c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_4: return "4"; 81896c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_5: return "5"; 81996c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_6: return "6"; 82096c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_8: return "8"; 82196c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_10: return "10"; 82296c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_12: return "12"; 82396c5ddc4Srjs default: return "XXX: INVALID"; 82496c5ddc4Srjs } 82596c5ddc4Srjs} 82696c5ddc4Srjs 82796c5ddc4Srjsenum mali_astc_3d_dimension { 82896c5ddc4Srjs MALI_ASTC_3D_DIMENSION_4 = 0, 82996c5ddc4Srjs MALI_ASTC_3D_DIMENSION_5 = 1, 83096c5ddc4Srjs MALI_ASTC_3D_DIMENSION_6 = 2, 83196c5ddc4Srjs MALI_ASTC_3D_DIMENSION_3 = 3, 83296c5ddc4Srjs}; 83396c5ddc4Srjs 83496c5ddc4Srjsstatic inline const char * 83596c5ddc4Srjsmali_astc_3d_dimension_as_str(enum mali_astc_3d_dimension imm) 83696c5ddc4Srjs{ 83796c5ddc4Srjs switch (imm) { 83896c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_4: return "4"; 83996c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_5: return "5"; 84096c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_6: return "6"; 84196c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_3: return "3"; 84296c5ddc4Srjs default: return "XXX: INVALID"; 84396c5ddc4Srjs } 84496c5ddc4Srjs} 84596c5ddc4Srjs 84696c5ddc4Srjsenum mali_pixel_kill { 84796c5ddc4Srjs MALI_PIXEL_KILL_FORCE_EARLY = 0, 84896c5ddc4Srjs MALI_PIXEL_KILL_STRONG_EARLY = 1, 84996c5ddc4Srjs MALI_PIXEL_KILL_WEAK_EARLY = 2, 85096c5ddc4Srjs MALI_PIXEL_KILL_FORCE_LATE = 3, 85196c5ddc4Srjs}; 85296c5ddc4Srjs 85396c5ddc4Srjsstatic inline const char * 85496c5ddc4Srjsmali_pixel_kill_as_str(enum mali_pixel_kill imm) 85596c5ddc4Srjs{ 85696c5ddc4Srjs switch (imm) { 85796c5ddc4Srjs case MALI_PIXEL_KILL_FORCE_EARLY: return "Force Early"; 85896c5ddc4Srjs case MALI_PIXEL_KILL_STRONG_EARLY: return "Strong Early"; 85996c5ddc4Srjs case MALI_PIXEL_KILL_WEAK_EARLY: return "Weak Early"; 86096c5ddc4Srjs case MALI_PIXEL_KILL_FORCE_LATE: return "Force Late"; 86196c5ddc4Srjs default: return "XXX: INVALID"; 86296c5ddc4Srjs } 86396c5ddc4Srjs} 86496c5ddc4Srjs 86596c5ddc4Srjsenum mali_block_format { 86696c5ddc4Srjs MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED = 0, 86796c5ddc4Srjs MALI_BLOCK_FORMAT_TILED_LINEAR = 1, 86896c5ddc4Srjs MALI_BLOCK_FORMAT_LINEAR = 2, 86996c5ddc4Srjs MALI_BLOCK_FORMAT_AFBC = 3, 87096c5ddc4Srjs}; 87196c5ddc4Srjs 87296c5ddc4Srjsstatic inline const char * 87396c5ddc4Srjsmali_block_format_as_str(enum mali_block_format imm) 87496c5ddc4Srjs{ 87596c5ddc4Srjs switch (imm) { 87696c5ddc4Srjs case MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED: return "Tiled U-Interleaved"; 87796c5ddc4Srjs case MALI_BLOCK_FORMAT_TILED_LINEAR: return "Tiled Linear"; 87896c5ddc4Srjs case MALI_BLOCK_FORMAT_LINEAR: return "Linear"; 87996c5ddc4Srjs case MALI_BLOCK_FORMAT_AFBC: return "AFBC"; 88096c5ddc4Srjs default: return "XXX: INVALID"; 88196c5ddc4Srjs } 88296c5ddc4Srjs} 88396c5ddc4Srjs 88496c5ddc4Srjsenum mali_mipmap_mode { 88596c5ddc4Srjs MALI_MIPMAP_MODE_NEAREST = 0, 88696c5ddc4Srjs MALI_MIPMAP_MODE_NONE = 1, 88796c5ddc4Srjs MALI_MIPMAP_MODE_TRILINEAR = 3, 88896c5ddc4Srjs}; 88996c5ddc4Srjs 89096c5ddc4Srjsstatic inline const char * 89196c5ddc4Srjsmali_mipmap_mode_as_str(enum mali_mipmap_mode imm) 89296c5ddc4Srjs{ 89396c5ddc4Srjs switch (imm) { 89496c5ddc4Srjs case MALI_MIPMAP_MODE_NEAREST: return "Nearest"; 89596c5ddc4Srjs case MALI_MIPMAP_MODE_NONE: return "None"; 89696c5ddc4Srjs case MALI_MIPMAP_MODE_TRILINEAR: return "Trilinear"; 89796c5ddc4Srjs default: return "XXX: INVALID"; 89896c5ddc4Srjs } 89996c5ddc4Srjs} 90096c5ddc4Srjs 90196c5ddc4Srjsenum mali_lod_algorithm { 90296c5ddc4Srjs MALI_LOD_ALGORITHM_ISOTROPIC = 0, 90396c5ddc4Srjs MALI_LOD_ALGORITHM_ANISOTROPIC = 3, 90496c5ddc4Srjs}; 90596c5ddc4Srjs 90696c5ddc4Srjsstatic inline const char * 90796c5ddc4Srjsmali_lod_algorithm_as_str(enum mali_lod_algorithm imm) 90896c5ddc4Srjs{ 90996c5ddc4Srjs switch (imm) { 91096c5ddc4Srjs case MALI_LOD_ALGORITHM_ISOTROPIC: return "Isotropic"; 91196c5ddc4Srjs case MALI_LOD_ALGORITHM_ANISOTROPIC: return "Anisotropic"; 91296c5ddc4Srjs default: return "XXX: INVALID"; 91396c5ddc4Srjs } 91496c5ddc4Srjs} 91596c5ddc4Srjs 91696c5ddc4Srjsenum mali_msaa { 91796c5ddc4Srjs MALI_MSAA_SINGLE = 0, 91896c5ddc4Srjs MALI_MSAA_AVERAGE = 1, 91996c5ddc4Srjs MALI_MSAA_MULTIPLE = 2, 92096c5ddc4Srjs MALI_MSAA_LAYERED = 3, 92196c5ddc4Srjs}; 92296c5ddc4Srjs 92396c5ddc4Srjsstatic inline const char * 92496c5ddc4Srjsmali_msaa_as_str(enum mali_msaa imm) 92596c5ddc4Srjs{ 92696c5ddc4Srjs switch (imm) { 92796c5ddc4Srjs case MALI_MSAA_SINGLE: return "Single"; 92896c5ddc4Srjs case MALI_MSAA_AVERAGE: return "Average"; 92996c5ddc4Srjs case MALI_MSAA_MULTIPLE: return "Multiple"; 93096c5ddc4Srjs case MALI_MSAA_LAYERED: return "Layered"; 93196c5ddc4Srjs default: return "XXX: INVALID"; 93296c5ddc4Srjs } 93396c5ddc4Srjs} 93496c5ddc4Srjs 93596c5ddc4Srjsenum mali_index_type { 93696c5ddc4Srjs MALI_INDEX_TYPE_NONE = 0, 93796c5ddc4Srjs MALI_INDEX_TYPE_UINT8 = 1, 93896c5ddc4Srjs MALI_INDEX_TYPE_UINT16 = 2, 93996c5ddc4Srjs MALI_INDEX_TYPE_UINT32 = 3, 94096c5ddc4Srjs}; 94196c5ddc4Srjs 94296c5ddc4Srjsstatic inline const char * 94396c5ddc4Srjsmali_index_type_as_str(enum mali_index_type imm) 94496c5ddc4Srjs{ 94596c5ddc4Srjs switch (imm) { 94696c5ddc4Srjs case MALI_INDEX_TYPE_NONE: return "None"; 94796c5ddc4Srjs case MALI_INDEX_TYPE_UINT8: return "UINT8"; 94896c5ddc4Srjs case MALI_INDEX_TYPE_UINT16: return "UINT16"; 94996c5ddc4Srjs case MALI_INDEX_TYPE_UINT32: return "UINT32"; 95096c5ddc4Srjs default: return "XXX: INVALID"; 95196c5ddc4Srjs } 95296c5ddc4Srjs} 95396c5ddc4Srjs 95496c5ddc4Srjsenum mali_occlusion_mode { 95596c5ddc4Srjs MALI_OCCLUSION_MODE_DISABLED = 0, 95696c5ddc4Srjs MALI_OCCLUSION_MODE_PREDICATE = 1, 95796c5ddc4Srjs MALI_OCCLUSION_MODE_COUNTER = 3, 95896c5ddc4Srjs}; 95996c5ddc4Srjs 96096c5ddc4Srjsstatic inline const char * 96196c5ddc4Srjsmali_occlusion_mode_as_str(enum mali_occlusion_mode imm) 96296c5ddc4Srjs{ 96396c5ddc4Srjs switch (imm) { 96496c5ddc4Srjs case MALI_OCCLUSION_MODE_DISABLED: return "Disabled"; 96596c5ddc4Srjs case MALI_OCCLUSION_MODE_PREDICATE: return "Predicate"; 96696c5ddc4Srjs case MALI_OCCLUSION_MODE_COUNTER: return "Counter"; 96796c5ddc4Srjs default: return "XXX: INVALID"; 96896c5ddc4Srjs } 96996c5ddc4Srjs} 97096c5ddc4Srjs 97196c5ddc4Srjsenum mali_stencil_op { 97296c5ddc4Srjs MALI_STENCIL_OP_KEEP = 0, 97396c5ddc4Srjs MALI_STENCIL_OP_REPLACE = 1, 97496c5ddc4Srjs MALI_STENCIL_OP_ZERO = 2, 97596c5ddc4Srjs MALI_STENCIL_OP_INVERT = 3, 97696c5ddc4Srjs MALI_STENCIL_OP_INCR_WRAP = 4, 97796c5ddc4Srjs MALI_STENCIL_OP_DECR_WRAP = 5, 97896c5ddc4Srjs MALI_STENCIL_OP_INCR_SAT = 6, 97996c5ddc4Srjs MALI_STENCIL_OP_DECR_SAT = 7, 98096c5ddc4Srjs}; 98196c5ddc4Srjs 98296c5ddc4Srjsstatic inline const char * 98396c5ddc4Srjsmali_stencil_op_as_str(enum mali_stencil_op imm) 98496c5ddc4Srjs{ 98596c5ddc4Srjs switch (imm) { 98696c5ddc4Srjs case MALI_STENCIL_OP_KEEP: return "Keep"; 98796c5ddc4Srjs case MALI_STENCIL_OP_REPLACE: return "Replace"; 98896c5ddc4Srjs case MALI_STENCIL_OP_ZERO: return "Zero"; 98996c5ddc4Srjs case MALI_STENCIL_OP_INVERT: return "Invert"; 99096c5ddc4Srjs case MALI_STENCIL_OP_INCR_WRAP: return "Incr Wrap"; 99196c5ddc4Srjs case MALI_STENCIL_OP_DECR_WRAP: return "Decr Wrap"; 99296c5ddc4Srjs case MALI_STENCIL_OP_INCR_SAT: return "Incr Sat"; 99396c5ddc4Srjs case MALI_STENCIL_OP_DECR_SAT: return "Decr Sat"; 99496c5ddc4Srjs default: return "XXX: INVALID"; 99596c5ddc4Srjs } 99696c5ddc4Srjs} 99796c5ddc4Srjs 99896c5ddc4Srjsenum mali_texture_dimension { 99996c5ddc4Srjs MALI_TEXTURE_DIMENSION_CUBE = 0, 100096c5ddc4Srjs MALI_TEXTURE_DIMENSION_1D = 1, 100196c5ddc4Srjs MALI_TEXTURE_DIMENSION_2D = 2, 100296c5ddc4Srjs MALI_TEXTURE_DIMENSION_3D = 3, 100396c5ddc4Srjs}; 100496c5ddc4Srjs 100596c5ddc4Srjsstatic inline const char * 100696c5ddc4Srjsmali_texture_dimension_as_str(enum mali_texture_dimension imm) 100796c5ddc4Srjs{ 100896c5ddc4Srjs switch (imm) { 100996c5ddc4Srjs case MALI_TEXTURE_DIMENSION_CUBE: return "Cube"; 101096c5ddc4Srjs case MALI_TEXTURE_DIMENSION_1D: return "1D"; 101196c5ddc4Srjs case MALI_TEXTURE_DIMENSION_2D: return "2D"; 101296c5ddc4Srjs case MALI_TEXTURE_DIMENSION_3D: return "3D"; 101396c5ddc4Srjs default: return "XXX: INVALID"; 101496c5ddc4Srjs } 101596c5ddc4Srjs} 101696c5ddc4Srjs 101796c5ddc4Srjsenum mali_texture_layout { 101896c5ddc4Srjs MALI_TEXTURE_LAYOUT_TILED = 1, 101996c5ddc4Srjs MALI_TEXTURE_LAYOUT_LINEAR = 2, 102096c5ddc4Srjs MALI_TEXTURE_LAYOUT_AFBC = 12, 102196c5ddc4Srjs}; 102296c5ddc4Srjs 102396c5ddc4Srjsstatic inline const char * 102496c5ddc4Srjsmali_texture_layout_as_str(enum mali_texture_layout imm) 102596c5ddc4Srjs{ 102696c5ddc4Srjs switch (imm) { 102796c5ddc4Srjs case MALI_TEXTURE_LAYOUT_TILED: return "Tiled"; 102896c5ddc4Srjs case MALI_TEXTURE_LAYOUT_LINEAR: return "Linear"; 102996c5ddc4Srjs case MALI_TEXTURE_LAYOUT_AFBC: return "AFBC"; 103096c5ddc4Srjs default: return "XXX: INVALID"; 103196c5ddc4Srjs } 103296c5ddc4Srjs} 103396c5ddc4Srjs 103496c5ddc4Srjsenum mali_afbc_surface_flag { 103596c5ddc4Srjs MALI_AFBC_SURFACE_FLAG_YTR = 1, 103696c5ddc4Srjs MALI_AFBC_SURFACE_FLAG_SPLIT_BLOCK = 2, 103796c5ddc4Srjs MALI_AFBC_SURFACE_FLAG_WIDE_BLOCK = 4, 103896c5ddc4Srjs MALI_AFBC_SURFACE_FLAG_TILED_HEADER = 8, 103996c5ddc4Srjs MALI_AFBC_SURFACE_FLAG_PREFETCH = 16, 104096c5ddc4Srjs MALI_AFBC_SURFACE_FLAG_CHECK_PAYLOAD_RANGE = 32, 104196c5ddc4Srjs}; 104296c5ddc4Srjs 104396c5ddc4Srjsstatic inline const char * 104496c5ddc4Srjsmali_afbc_surface_flag_as_str(enum mali_afbc_surface_flag imm) 104596c5ddc4Srjs{ 104696c5ddc4Srjs switch (imm) { 104796c5ddc4Srjs case MALI_AFBC_SURFACE_FLAG_YTR: return "YTR"; 104896c5ddc4Srjs case MALI_AFBC_SURFACE_FLAG_SPLIT_BLOCK: return "Split Block"; 104996c5ddc4Srjs case MALI_AFBC_SURFACE_FLAG_WIDE_BLOCK: return "Wide Block"; 105096c5ddc4Srjs case MALI_AFBC_SURFACE_FLAG_TILED_HEADER: return "Tiled Header"; 105196c5ddc4Srjs case MALI_AFBC_SURFACE_FLAG_PREFETCH: return "Prefetch"; 105296c5ddc4Srjs case MALI_AFBC_SURFACE_FLAG_CHECK_PAYLOAD_RANGE: return "Check Payload Range"; 105396c5ddc4Srjs default: return "XXX: INVALID"; 105496c5ddc4Srjs } 105596c5ddc4Srjs} 105696c5ddc4Srjs 105796c5ddc4Srjsenum mali_wrap_mode { 105896c5ddc4Srjs MALI_WRAP_MODE_REPEAT = 8, 105996c5ddc4Srjs MALI_WRAP_MODE_CLAMP_TO_EDGE = 9, 106096c5ddc4Srjs MALI_WRAP_MODE_CLAMP_TO_BORDER = 11, 106196c5ddc4Srjs MALI_WRAP_MODE_MIRRORED_REPEAT = 12, 106296c5ddc4Srjs MALI_WRAP_MODE_MIRRORED_CLAMP_TO_EDGE = 13, 106396c5ddc4Srjs MALI_WRAP_MODE_MIRRORED_CLAMP_TO_BORDER = 15, 106496c5ddc4Srjs}; 106596c5ddc4Srjs 106696c5ddc4Srjsstatic inline const char * 106796c5ddc4Srjsmali_wrap_mode_as_str(enum mali_wrap_mode imm) 106896c5ddc4Srjs{ 106996c5ddc4Srjs switch (imm) { 107096c5ddc4Srjs case MALI_WRAP_MODE_REPEAT: return "Repeat"; 107196c5ddc4Srjs case MALI_WRAP_MODE_CLAMP_TO_EDGE: return "Clamp to Edge"; 107296c5ddc4Srjs case MALI_WRAP_MODE_CLAMP_TO_BORDER: return "Clamp to Border"; 107396c5ddc4Srjs case MALI_WRAP_MODE_MIRRORED_REPEAT: return "Mirrored Repeat"; 107496c5ddc4Srjs case MALI_WRAP_MODE_MIRRORED_CLAMP_TO_EDGE: return "Mirrored Clamp to Edge"; 107596c5ddc4Srjs case MALI_WRAP_MODE_MIRRORED_CLAMP_TO_BORDER: return "Mirrored Clamp to Border"; 107696c5ddc4Srjs default: return "XXX: INVALID"; 107796c5ddc4Srjs } 107896c5ddc4Srjs} 107996c5ddc4Srjs 108096c5ddc4Srjsstruct MALI_ATTRIBUTE { 108196c5ddc4Srjs uint32_t buffer_index; 108296c5ddc4Srjs bool offset_enable; 108396c5ddc4Srjs uint32_t format; 108496c5ddc4Srjs int32_t offset; 108596c5ddc4Srjs}; 108696c5ddc4Srjs 108796c5ddc4Srjs#define MALI_ATTRIBUTE_header \ 108896c5ddc4Srjs .offset_enable = true 108996c5ddc4Srjs 109096c5ddc4Srjsstatic inline void 109196c5ddc4SrjsMALI_ATTRIBUTE_pack(uint32_t * restrict cl, 109296c5ddc4Srjs const struct MALI_ATTRIBUTE * restrict values) 109396c5ddc4Srjs{ 109496c5ddc4Srjs cl[ 0] = __gen_uint(values->buffer_index, 0, 8) | 109596c5ddc4Srjs __gen_uint(values->offset_enable, 9, 9) | 109696c5ddc4Srjs __gen_uint(values->format, 10, 31); 109796c5ddc4Srjs cl[ 1] = __gen_sint(values->offset, 0, 31); 109896c5ddc4Srjs} 109996c5ddc4Srjs 110096c5ddc4Srjs 110196c5ddc4Srjs#define MALI_ATTRIBUTE_LENGTH 8 110296c5ddc4Srjs#define MALI_ATTRIBUTE_ALIGN 8 110396c5ddc4Srjsstruct mali_attribute_packed { uint32_t opaque[2]; }; 110496c5ddc4Srjsstatic inline void 110596c5ddc4SrjsMALI_ATTRIBUTE_unpack(const uint8_t * restrict cl, 110696c5ddc4Srjs struct MALI_ATTRIBUTE * restrict values) 110796c5ddc4Srjs{ 110896c5ddc4Srjs values->buffer_index = __gen_unpack_uint(cl, 0, 8); 110996c5ddc4Srjs values->offset_enable = __gen_unpack_uint(cl, 9, 9); 111096c5ddc4Srjs values->format = __gen_unpack_uint(cl, 10, 31); 111196c5ddc4Srjs values->offset = __gen_unpack_sint(cl, 32, 63); 111296c5ddc4Srjs} 111396c5ddc4Srjs 111496c5ddc4Srjsstatic inline void 111596c5ddc4SrjsMALI_ATTRIBUTE_print(FILE *fp, const struct MALI_ATTRIBUTE * values, unsigned indent) 111696c5ddc4Srjs{ 111796c5ddc4Srjs fprintf(fp, "%*sBuffer index: %u\n", indent, "", values->buffer_index); 111896c5ddc4Srjs fprintf(fp, "%*sOffset enable: %s\n", indent, "", values->offset_enable ? "true" : "false"); 111996c5ddc4Srjs mali_pixel_format_print(fp, values->format); 112096c5ddc4Srjs fprintf(fp, "%*sOffset: %d\n", indent, "", values->offset); 112196c5ddc4Srjs} 112296c5ddc4Srjs 112396c5ddc4Srjsstruct MALI_ATTRIBUTE_BUFFER { 112496c5ddc4Srjs enum mali_attribute_type type; 112596c5ddc4Srjs uint64_t pointer; 112696c5ddc4Srjs uint32_t stride; 112796c5ddc4Srjs uint32_t size; 112896c5ddc4Srjs uint32_t divisor; 112996c5ddc4Srjs uint32_t divisor_r; 113096c5ddc4Srjs uint32_t divisor_p; 113196c5ddc4Srjs uint32_t divisor_e; 113296c5ddc4Srjs}; 113396c5ddc4Srjs 113496c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_header \ 113596c5ddc4Srjs .type = MALI_ATTRIBUTE_TYPE_1D, \ 113696c5ddc4Srjs .divisor = 1 113796c5ddc4Srjs 113896c5ddc4Srjsstatic inline void 113996c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_pack(uint32_t * restrict cl, 114096c5ddc4Srjs const struct MALI_ATTRIBUTE_BUFFER * restrict values) 114196c5ddc4Srjs{ 114296c5ddc4Srjs assert((values->pointer & 0x3f) == 0); 114396c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 5) | 114496c5ddc4Srjs __gen_uint(values->pointer >> 6, 6, 55); 114596c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer >> 6, 6, 55) >> 32 | 114696c5ddc4Srjs __gen_padded(values->divisor, 24, 31) | 114796c5ddc4Srjs __gen_uint(values->divisor_r, 24, 28) | 114896c5ddc4Srjs __gen_uint(values->divisor_p, 29, 31) | 114996c5ddc4Srjs __gen_uint(values->divisor_e, 29, 29); 115096c5ddc4Srjs cl[ 2] = __gen_uint(values->stride, 0, 31); 115196c5ddc4Srjs cl[ 3] = __gen_uint(values->size, 0, 31); 115296c5ddc4Srjs} 115396c5ddc4Srjs 115496c5ddc4Srjs 115596c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_LENGTH 16 115696c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_ALIGN 32 115796c5ddc4Srjsstruct mali_attribute_buffer_packed { uint32_t opaque[4]; }; 115896c5ddc4Srjsstatic inline void 115996c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_unpack(const uint8_t * restrict cl, 116096c5ddc4Srjs struct MALI_ATTRIBUTE_BUFFER * restrict values) 116196c5ddc4Srjs{ 116296c5ddc4Srjs values->type = (enum mali_attribute_type)__gen_unpack_uint(cl, 0, 5); 116396c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 6, 55) << 6; 116496c5ddc4Srjs values->stride = __gen_unpack_uint(cl, 64, 95); 116596c5ddc4Srjs values->size = __gen_unpack_uint(cl, 96, 127); 116696c5ddc4Srjs values->divisor = __gen_unpack_padded(cl, 56, 63); 116796c5ddc4Srjs values->divisor_r = __gen_unpack_uint(cl, 56, 60); 116896c5ddc4Srjs values->divisor_p = __gen_unpack_uint(cl, 61, 63); 116996c5ddc4Srjs values->divisor_e = __gen_unpack_uint(cl, 61, 61); 117096c5ddc4Srjs} 117196c5ddc4Srjs 117296c5ddc4Srjsstatic inline void 117396c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_print(FILE *fp, const struct MALI_ATTRIBUTE_BUFFER * values, unsigned indent) 117496c5ddc4Srjs{ 117596c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_type_as_str(values->type)); 117696c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 117796c5ddc4Srjs fprintf(fp, "%*sStride: %u\n", indent, "", values->stride); 117896c5ddc4Srjs fprintf(fp, "%*sSize: %u\n", indent, "", values->size); 117996c5ddc4Srjs fprintf(fp, "%*sDivisor: %u\n", indent, "", values->divisor); 118096c5ddc4Srjs fprintf(fp, "%*sDivisor R: %u\n", indent, "", values->divisor_r); 118196c5ddc4Srjs fprintf(fp, "%*sDivisor P: %u\n", indent, "", values->divisor_p); 118296c5ddc4Srjs fprintf(fp, "%*sDivisor E: %u\n", indent, "", values->divisor_e); 118396c5ddc4Srjs} 118496c5ddc4Srjs 118596c5ddc4Srjsstruct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT { 118696c5ddc4Srjs enum mali_attribute_type type; 118796c5ddc4Srjs uint32_t divisor_numerator; 118896c5ddc4Srjs uint32_t divisor; 118996c5ddc4Srjs}; 119096c5ddc4Srjs 119196c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_header\ 119296c5ddc4Srjs .type = MALI_ATTRIBUTE_TYPE_CONTINUATION 119396c5ddc4Srjs 119496c5ddc4Srjsstatic inline void 119596c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_pack(uint32_t * restrict cl, 119696c5ddc4Srjs const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT * restrict values) 119796c5ddc4Srjs{ 119896c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 5); 119996c5ddc4Srjs cl[ 1] = __gen_uint(values->divisor_numerator, 0, 31); 120096c5ddc4Srjs cl[ 2] = 0; 120196c5ddc4Srjs cl[ 3] = __gen_uint(values->divisor, 0, 31); 120296c5ddc4Srjs} 120396c5ddc4Srjs 120496c5ddc4Srjs 120596c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_LENGTH 16 120696c5ddc4Srjsstruct mali_attribute_buffer_continuation_npot_packed { uint32_t opaque[4]; }; 120796c5ddc4Srjsstatic inline void 120896c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_unpack(const uint8_t * restrict cl, 120996c5ddc4Srjs struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT * restrict values) 121096c5ddc4Srjs{ 121196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffc0) fprintf(stderr, "XXX: Invalid field of Attribute Buffer Continuation NPOT unpacked at word 0\n"); 121296c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Attribute Buffer Continuation NPOT unpacked at word 2\n"); 121396c5ddc4Srjs values->type = (enum mali_attribute_type)__gen_unpack_uint(cl, 0, 5); 121496c5ddc4Srjs values->divisor_numerator = __gen_unpack_uint(cl, 32, 63); 121596c5ddc4Srjs values->divisor = __gen_unpack_uint(cl, 96, 127); 121696c5ddc4Srjs} 121796c5ddc4Srjs 121896c5ddc4Srjsstatic inline void 121996c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_print(FILE *fp, const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT * values, unsigned indent) 122096c5ddc4Srjs{ 122196c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_type_as_str(values->type)); 122296c5ddc4Srjs fprintf(fp, "%*sDivisor Numerator: %u\n", indent, "", values->divisor_numerator); 122396c5ddc4Srjs fprintf(fp, "%*sDivisor: %u\n", indent, "", values->divisor); 122496c5ddc4Srjs} 122596c5ddc4Srjs 122696c5ddc4Srjsstruct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D { 122796c5ddc4Srjs enum mali_attribute_type type; 122896c5ddc4Srjs uint32_t s_dimension; 122996c5ddc4Srjs uint32_t t_dimension; 123096c5ddc4Srjs uint32_t r_dimension; 123196c5ddc4Srjs uint32_t row_stride; 123296c5ddc4Srjs uint32_t slice_stride; 123396c5ddc4Srjs}; 123496c5ddc4Srjs 123596c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_header\ 123696c5ddc4Srjs .type = MALI_ATTRIBUTE_TYPE_CONTINUATION 123796c5ddc4Srjs 123896c5ddc4Srjsstatic inline void 123996c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_pack(uint32_t * restrict cl, 124096c5ddc4Srjs const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D * restrict values) 124196c5ddc4Srjs{ 124296c5ddc4Srjs assert(values->s_dimension >= 1); 124396c5ddc4Srjs assert(values->t_dimension >= 1); 124496c5ddc4Srjs assert(values->r_dimension >= 1); 124596c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 5) | 124696c5ddc4Srjs __gen_uint(values->s_dimension - 1, 16, 31); 124796c5ddc4Srjs cl[ 1] = __gen_uint(values->t_dimension - 1, 0, 15) | 124896c5ddc4Srjs __gen_uint(values->r_dimension - 1, 16, 31); 124996c5ddc4Srjs cl[ 2] = __gen_uint(values->row_stride, 0, 31); 125096c5ddc4Srjs cl[ 3] = __gen_uint(values->slice_stride, 0, 31); 125196c5ddc4Srjs} 125296c5ddc4Srjs 125396c5ddc4Srjs 125496c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_LENGTH 16 125596c5ddc4Srjsstruct mali_attribute_buffer_continuation_3d_packed { uint32_t opaque[4]; }; 125696c5ddc4Srjsstatic inline void 125796c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_unpack(const uint8_t * restrict cl, 125896c5ddc4Srjs struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D * restrict values) 125996c5ddc4Srjs{ 126096c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffc0) fprintf(stderr, "XXX: Invalid field of Attribute Buffer Continuation 3D unpacked at word 0\n"); 126196c5ddc4Srjs values->type = (enum mali_attribute_type)__gen_unpack_uint(cl, 0, 5); 126296c5ddc4Srjs values->s_dimension = __gen_unpack_uint(cl, 16, 31) + 1; 126396c5ddc4Srjs values->t_dimension = __gen_unpack_uint(cl, 32, 47) + 1; 126496c5ddc4Srjs values->r_dimension = __gen_unpack_uint(cl, 48, 63) + 1; 126596c5ddc4Srjs values->row_stride = __gen_unpack_uint(cl, 64, 95); 126696c5ddc4Srjs values->slice_stride = __gen_unpack_uint(cl, 96, 127); 126796c5ddc4Srjs} 126896c5ddc4Srjs 126996c5ddc4Srjsstatic inline void 127096c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_print(FILE *fp, const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D * values, unsigned indent) 127196c5ddc4Srjs{ 127296c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_type_as_str(values->type)); 127396c5ddc4Srjs fprintf(fp, "%*sS dimension: %u\n", indent, "", values->s_dimension); 127496c5ddc4Srjs fprintf(fp, "%*sT dimension: %u\n", indent, "", values->t_dimension); 127596c5ddc4Srjs fprintf(fp, "%*sR dimension: %u\n", indent, "", values->r_dimension); 127696c5ddc4Srjs fprintf(fp, "%*sRow Stride: %u\n", indent, "", values->row_stride); 127796c5ddc4Srjs fprintf(fp, "%*sSlice Stride: %u\n", indent, "", values->slice_stride); 127896c5ddc4Srjs} 127996c5ddc4Srjs 128096c5ddc4Srjsenum mali_blend_operand_a { 128196c5ddc4Srjs MALI_BLEND_OPERAND_A_ZERO = 1, 128296c5ddc4Srjs MALI_BLEND_OPERAND_A_SRC = 2, 128396c5ddc4Srjs MALI_BLEND_OPERAND_A_DEST = 3, 128496c5ddc4Srjs}; 128596c5ddc4Srjs 128696c5ddc4Srjsstatic inline const char * 128796c5ddc4Srjsmali_blend_operand_a_as_str(enum mali_blend_operand_a imm) 128896c5ddc4Srjs{ 128996c5ddc4Srjs switch (imm) { 129096c5ddc4Srjs case MALI_BLEND_OPERAND_A_ZERO: return "Zero"; 129196c5ddc4Srjs case MALI_BLEND_OPERAND_A_SRC: return "Src"; 129296c5ddc4Srjs case MALI_BLEND_OPERAND_A_DEST: return "Dest"; 129396c5ddc4Srjs default: return "XXX: INVALID"; 129496c5ddc4Srjs } 129596c5ddc4Srjs} 129696c5ddc4Srjs 129796c5ddc4Srjsenum mali_blend_operand_b { 129896c5ddc4Srjs MALI_BLEND_OPERAND_B_SRC_MINUS_DEST = 0, 129996c5ddc4Srjs MALI_BLEND_OPERAND_B_SRC_PLUS_DEST = 1, 130096c5ddc4Srjs MALI_BLEND_OPERAND_B_SRC = 2, 130196c5ddc4Srjs MALI_BLEND_OPERAND_B_DEST = 3, 130296c5ddc4Srjs}; 130396c5ddc4Srjs 130496c5ddc4Srjsstatic inline const char * 130596c5ddc4Srjsmali_blend_operand_b_as_str(enum mali_blend_operand_b imm) 130696c5ddc4Srjs{ 130796c5ddc4Srjs switch (imm) { 130896c5ddc4Srjs case MALI_BLEND_OPERAND_B_SRC_MINUS_DEST: return "Src Minus Dest"; 130996c5ddc4Srjs case MALI_BLEND_OPERAND_B_SRC_PLUS_DEST: return "Src Plus Dest"; 131096c5ddc4Srjs case MALI_BLEND_OPERAND_B_SRC: return "Src"; 131196c5ddc4Srjs case MALI_BLEND_OPERAND_B_DEST: return "Dest"; 131296c5ddc4Srjs default: return "XXX: INVALID"; 131396c5ddc4Srjs } 131496c5ddc4Srjs} 131596c5ddc4Srjs 131696c5ddc4Srjsenum mali_blend_operand_c { 131796c5ddc4Srjs MALI_BLEND_OPERAND_C_ZERO = 1, 131896c5ddc4Srjs MALI_BLEND_OPERAND_C_SRC = 2, 131996c5ddc4Srjs MALI_BLEND_OPERAND_C_DEST = 3, 132096c5ddc4Srjs MALI_BLEND_OPERAND_C_SRC_X_2 = 4, 132196c5ddc4Srjs MALI_BLEND_OPERAND_C_SRC_ALPHA = 5, 132296c5ddc4Srjs MALI_BLEND_OPERAND_C_DEST_ALPHA = 6, 132396c5ddc4Srjs MALI_BLEND_OPERAND_C_CONSTANT = 7, 132496c5ddc4Srjs}; 132596c5ddc4Srjs 132696c5ddc4Srjsstatic inline const char * 132796c5ddc4Srjsmali_blend_operand_c_as_str(enum mali_blend_operand_c imm) 132896c5ddc4Srjs{ 132996c5ddc4Srjs switch (imm) { 133096c5ddc4Srjs case MALI_BLEND_OPERAND_C_ZERO: return "Zero"; 133196c5ddc4Srjs case MALI_BLEND_OPERAND_C_SRC: return "Src"; 133296c5ddc4Srjs case MALI_BLEND_OPERAND_C_DEST: return "Dest"; 133396c5ddc4Srjs case MALI_BLEND_OPERAND_C_SRC_X_2: return "Src x 2"; 133496c5ddc4Srjs case MALI_BLEND_OPERAND_C_SRC_ALPHA: return "Src Alpha"; 133596c5ddc4Srjs case MALI_BLEND_OPERAND_C_DEST_ALPHA: return "Dest Alpha"; 133696c5ddc4Srjs case MALI_BLEND_OPERAND_C_CONSTANT: return "Constant"; 133796c5ddc4Srjs default: return "XXX: INVALID"; 133896c5ddc4Srjs } 133996c5ddc4Srjs} 134096c5ddc4Srjs 134196c5ddc4Srjsstruct MALI_BLEND_FUNCTION { 134296c5ddc4Srjs enum mali_blend_operand_a a; 134396c5ddc4Srjs bool negate_a; 134496c5ddc4Srjs enum mali_blend_operand_b b; 134596c5ddc4Srjs bool negate_b; 134696c5ddc4Srjs enum mali_blend_operand_c c; 134796c5ddc4Srjs bool invert_c; 134896c5ddc4Srjs}; 134996c5ddc4Srjs 135096c5ddc4Srjs#define MALI_BLEND_FUNCTION_header \ 135196c5ddc4Srjs 0 135296c5ddc4Srjs 135396c5ddc4Srjsstatic inline void 135496c5ddc4SrjsMALI_BLEND_FUNCTION_print(FILE *fp, const struct MALI_BLEND_FUNCTION * values, unsigned indent) 135596c5ddc4Srjs{ 135696c5ddc4Srjs fprintf(fp, "%*sA: %s\n", indent, "", mali_blend_operand_a_as_str(values->a)); 135796c5ddc4Srjs fprintf(fp, "%*sNegate A: %s\n", indent, "", values->negate_a ? "true" : "false"); 135896c5ddc4Srjs fprintf(fp, "%*sB: %s\n", indent, "", mali_blend_operand_b_as_str(values->b)); 135996c5ddc4Srjs fprintf(fp, "%*sNegate B: %s\n", indent, "", values->negate_b ? "true" : "false"); 136096c5ddc4Srjs fprintf(fp, "%*sC: %s\n", indent, "", mali_blend_operand_c_as_str(values->c)); 136196c5ddc4Srjs fprintf(fp, "%*sInvert C: %s\n", indent, "", values->invert_c ? "true" : "false"); 136296c5ddc4Srjs} 136396c5ddc4Srjs 136496c5ddc4Srjsstruct MALI_BLEND_EQUATION { 136596c5ddc4Srjs struct MALI_BLEND_FUNCTION rgb; 136696c5ddc4Srjs struct MALI_BLEND_FUNCTION alpha; 136796c5ddc4Srjs uint32_t color_mask; 136896c5ddc4Srjs}; 136996c5ddc4Srjs 137096c5ddc4Srjs#define MALI_BLEND_EQUATION_header \ 137196c5ddc4Srjs .rgb = { MALI_BLEND_FUNCTION_header }, \ 137296c5ddc4Srjs .alpha = { MALI_BLEND_FUNCTION_header } 137396c5ddc4Srjs 137496c5ddc4Srjsstatic inline void 137596c5ddc4SrjsMALI_BLEND_EQUATION_pack(uint32_t * restrict cl, 137696c5ddc4Srjs const struct MALI_BLEND_EQUATION * restrict values) 137796c5ddc4Srjs{ 137896c5ddc4Srjs cl[ 0] = __gen_uint(values->rgb.a, 0, 1) | 137996c5ddc4Srjs __gen_uint(values->rgb.negate_a, 3, 3) | 138096c5ddc4Srjs __gen_uint(values->rgb.b, 4, 5) | 138196c5ddc4Srjs __gen_uint(values->rgb.negate_b, 7, 7) | 138296c5ddc4Srjs __gen_uint(values->rgb.c, 8, 10) | 138396c5ddc4Srjs __gen_uint(values->rgb.invert_c, 11, 11) | 138496c5ddc4Srjs __gen_uint(values->alpha.a, 12, 13) | 138596c5ddc4Srjs __gen_uint(values->alpha.negate_a, 15, 15) | 138696c5ddc4Srjs __gen_uint(values->alpha.b, 16, 17) | 138796c5ddc4Srjs __gen_uint(values->alpha.negate_b, 19, 19) | 138896c5ddc4Srjs __gen_uint(values->alpha.c, 20, 22) | 138996c5ddc4Srjs __gen_uint(values->alpha.invert_c, 23, 23) | 139096c5ddc4Srjs __gen_uint(values->color_mask, 28, 31); 139196c5ddc4Srjs} 139296c5ddc4Srjs 139396c5ddc4Srjs 139496c5ddc4Srjs#define MALI_BLEND_EQUATION_LENGTH 4 139596c5ddc4Srjsstruct mali_blend_equation_packed { uint32_t opaque[1]; }; 139696c5ddc4Srjsstatic inline void 139796c5ddc4SrjsMALI_BLEND_EQUATION_unpack(const uint8_t * restrict cl, 139896c5ddc4Srjs struct MALI_BLEND_EQUATION * restrict values) 139996c5ddc4Srjs{ 140096c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf044044) fprintf(stderr, "XXX: Invalid field of Blend Equation unpacked at word 0\n"); 140196c5ddc4Srjs values->rgb.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 0, 1); 140296c5ddc4Srjs values->rgb.negate_a = __gen_unpack_uint(cl, 3, 3); 140396c5ddc4Srjs values->rgb.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 4, 5); 140496c5ddc4Srjs values->rgb.negate_b = __gen_unpack_uint(cl, 7, 7); 140596c5ddc4Srjs values->rgb.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 8, 10); 140696c5ddc4Srjs values->rgb.invert_c = __gen_unpack_uint(cl, 11, 11); 140796c5ddc4Srjs values->alpha.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 12, 13); 140896c5ddc4Srjs values->alpha.negate_a = __gen_unpack_uint(cl, 15, 15); 140996c5ddc4Srjs values->alpha.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 16, 17); 141096c5ddc4Srjs values->alpha.negate_b = __gen_unpack_uint(cl, 19, 19); 141196c5ddc4Srjs values->alpha.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 20, 22); 141296c5ddc4Srjs values->alpha.invert_c = __gen_unpack_uint(cl, 23, 23); 141396c5ddc4Srjs values->color_mask = __gen_unpack_uint(cl, 28, 31); 141496c5ddc4Srjs} 141596c5ddc4Srjs 141696c5ddc4Srjsstatic inline void 141796c5ddc4SrjsMALI_BLEND_EQUATION_print(FILE *fp, const struct MALI_BLEND_EQUATION * values, unsigned indent) 141896c5ddc4Srjs{ 141996c5ddc4Srjs fprintf(fp, "%*sRGB:\n", indent, ""); 142096c5ddc4Srjs MALI_BLEND_FUNCTION_print(fp, &values->rgb, indent + 2); 142196c5ddc4Srjs fprintf(fp, "%*sAlpha:\n", indent, ""); 142296c5ddc4Srjs MALI_BLEND_FUNCTION_print(fp, &values->alpha, indent + 2); 142396c5ddc4Srjs fprintf(fp, "%*sColor Mask: %u\n", indent, "", values->color_mask); 142496c5ddc4Srjs} 142596c5ddc4Srjs 142696c5ddc4Srjsenum mali_register_file_format { 142796c5ddc4Srjs MALI_REGISTER_FILE_FORMAT_F16 = 0, 142896c5ddc4Srjs MALI_REGISTER_FILE_FORMAT_F32 = 1, 142996c5ddc4Srjs MALI_REGISTER_FILE_FORMAT_I32 = 2, 143096c5ddc4Srjs MALI_REGISTER_FILE_FORMAT_U32 = 3, 143196c5ddc4Srjs MALI_REGISTER_FILE_FORMAT_I16 = 4, 143296c5ddc4Srjs MALI_REGISTER_FILE_FORMAT_U16 = 5, 143396c5ddc4Srjs}; 143496c5ddc4Srjs 143596c5ddc4Srjsstatic inline const char * 143696c5ddc4Srjsmali_register_file_format_as_str(enum mali_register_file_format imm) 143796c5ddc4Srjs{ 143896c5ddc4Srjs switch (imm) { 143996c5ddc4Srjs case MALI_REGISTER_FILE_FORMAT_F16: return "F16"; 144096c5ddc4Srjs case MALI_REGISTER_FILE_FORMAT_F32: return "F32"; 144196c5ddc4Srjs case MALI_REGISTER_FILE_FORMAT_I32: return "I32"; 144296c5ddc4Srjs case MALI_REGISTER_FILE_FORMAT_U32: return "U32"; 144396c5ddc4Srjs case MALI_REGISTER_FILE_FORMAT_I16: return "I16"; 144496c5ddc4Srjs case MALI_REGISTER_FILE_FORMAT_U16: return "U16"; 144596c5ddc4Srjs default: return "XXX: INVALID"; 144696c5ddc4Srjs } 144796c5ddc4Srjs} 144896c5ddc4Srjs 144996c5ddc4Srjsenum mali_message_type { 145096c5ddc4Srjs MALI_MESSAGE_TYPE_DISABLED = 0, 145196c5ddc4Srjs MALI_MESSAGE_TYPE_LD_VAR = 1, 145296c5ddc4Srjs MALI_MESSAGE_TYPE_VAR_TEX = 2, 145396c5ddc4Srjs}; 145496c5ddc4Srjs 145596c5ddc4Srjsstatic inline const char * 145696c5ddc4Srjsmali_message_type_as_str(enum mali_message_type imm) 145796c5ddc4Srjs{ 145896c5ddc4Srjs switch (imm) { 145996c5ddc4Srjs case MALI_MESSAGE_TYPE_DISABLED: return "Disabled"; 146096c5ddc4Srjs case MALI_MESSAGE_TYPE_LD_VAR: return "LD_VAR"; 146196c5ddc4Srjs case MALI_MESSAGE_TYPE_VAR_TEX: return "VAR_TEX"; 146296c5ddc4Srjs default: return "XXX: INVALID"; 146396c5ddc4Srjs } 146496c5ddc4Srjs} 146596c5ddc4Srjs 146696c5ddc4Srjsenum mali_message_preload_register_format { 146796c5ddc4Srjs MALI_MESSAGE_PRELOAD_REGISTER_FORMAT_F32 = 0, 146896c5ddc4Srjs MALI_MESSAGE_PRELOAD_REGISTER_FORMAT_F16 = 1, 146996c5ddc4Srjs}; 147096c5ddc4Srjs 147196c5ddc4Srjsstatic inline const char * 147296c5ddc4Srjsmali_message_preload_register_format_as_str(enum mali_message_preload_register_format imm) 147396c5ddc4Srjs{ 147496c5ddc4Srjs switch (imm) { 147596c5ddc4Srjs case MALI_MESSAGE_PRELOAD_REGISTER_FORMAT_F32: return "F32"; 147696c5ddc4Srjs case MALI_MESSAGE_PRELOAD_REGISTER_FORMAT_F16: return "F16"; 147796c5ddc4Srjs default: return "XXX: INVALID"; 147896c5ddc4Srjs } 147996c5ddc4Srjs} 148096c5ddc4Srjs 148196c5ddc4Srjsenum mali_blend_mode { 148296c5ddc4Srjs MALI_BLEND_MODE_SHADER = 0, 148396c5ddc4Srjs MALI_BLEND_MODE_OPAQUE = 1, 148496c5ddc4Srjs MALI_BLEND_MODE_FIXED_FUNCTION = 2, 148596c5ddc4Srjs MALI_BLEND_MODE_OFF = 3, 148696c5ddc4Srjs}; 148796c5ddc4Srjs 148896c5ddc4Srjsstatic inline const char * 148996c5ddc4Srjsmali_blend_mode_as_str(enum mali_blend_mode imm) 149096c5ddc4Srjs{ 149196c5ddc4Srjs switch (imm) { 149296c5ddc4Srjs case MALI_BLEND_MODE_SHADER: return "Shader"; 149396c5ddc4Srjs case MALI_BLEND_MODE_OPAQUE: return "Opaque"; 149496c5ddc4Srjs case MALI_BLEND_MODE_FIXED_FUNCTION: return "Fixed-Function"; 149596c5ddc4Srjs case MALI_BLEND_MODE_OFF: return "Off"; 149696c5ddc4Srjs default: return "XXX: INVALID"; 149796c5ddc4Srjs } 149896c5ddc4Srjs} 149996c5ddc4Srjs 150096c5ddc4Srjsstruct MALI_BLEND_SHADER { 150196c5ddc4Srjs uint32_t return_value; 150296c5ddc4Srjs uint32_t pc; 150396c5ddc4Srjs}; 150496c5ddc4Srjs 150596c5ddc4Srjs#define MALI_BLEND_SHADER_header \ 150696c5ddc4Srjs 0 150796c5ddc4Srjs 150896c5ddc4Srjsstatic inline void 150996c5ddc4SrjsMALI_BLEND_SHADER_pack(uint32_t * restrict cl, 151096c5ddc4Srjs const struct MALI_BLEND_SHADER * restrict values) 151196c5ddc4Srjs{ 151296c5ddc4Srjs assert((values->return_value & 0x7) == 0); 151396c5ddc4Srjs assert((values->pc & 0xf) == 0); 151496c5ddc4Srjs cl[ 0] = __gen_uint(values->return_value >> 3, 3, 31); 151596c5ddc4Srjs cl[ 1] = __gen_uint(values->pc >> 4, 4, 31); 151696c5ddc4Srjs} 151796c5ddc4Srjs 151896c5ddc4Srjs 151996c5ddc4Srjs#define MALI_BLEND_SHADER_LENGTH 8 152096c5ddc4Srjsstruct mali_blend_shader_packed { uint32_t opaque[2]; }; 152196c5ddc4Srjsstatic inline void 152296c5ddc4SrjsMALI_BLEND_SHADER_unpack(const uint8_t * restrict cl, 152396c5ddc4Srjs struct MALI_BLEND_SHADER * restrict values) 152496c5ddc4Srjs{ 152596c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0x7) fprintf(stderr, "XXX: Invalid field of Blend Shader unpacked at word 0\n"); 152696c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xf) fprintf(stderr, "XXX: Invalid field of Blend Shader unpacked at word 1\n"); 152796c5ddc4Srjs values->return_value = __gen_unpack_uint(cl, 3, 31) << 3; 152896c5ddc4Srjs values->pc = __gen_unpack_uint(cl, 36, 63) << 4; 152996c5ddc4Srjs} 153096c5ddc4Srjs 153196c5ddc4Srjsstatic inline void 153296c5ddc4SrjsMALI_BLEND_SHADER_print(FILE *fp, const struct MALI_BLEND_SHADER * values, unsigned indent) 153396c5ddc4Srjs{ 153496c5ddc4Srjs fprintf(fp, "%*sReturn Value: %u\n", indent, "", values->return_value); 153596c5ddc4Srjs fprintf(fp, "%*sPC: %u\n", indent, "", values->pc); 153696c5ddc4Srjs} 153796c5ddc4Srjs 153896c5ddc4Srjsstruct MALI_INTERNAL_CONVERSION { 153996c5ddc4Srjs uint32_t memory_format; 154096c5ddc4Srjs bool raw; 154196c5ddc4Srjs enum mali_register_file_format register_format; 154296c5ddc4Srjs}; 154396c5ddc4Srjs 154496c5ddc4Srjs#define MALI_INTERNAL_CONVERSION_header \ 154596c5ddc4Srjs 0 154696c5ddc4Srjs 154796c5ddc4Srjsstatic inline void 154896c5ddc4SrjsMALI_INTERNAL_CONVERSION_pack(uint32_t * restrict cl, 154996c5ddc4Srjs const struct MALI_INTERNAL_CONVERSION * restrict values) 155096c5ddc4Srjs{ 155196c5ddc4Srjs cl[ 0] = __gen_uint(values->memory_format, 0, 21) | 155296c5ddc4Srjs __gen_uint(values->raw, 22, 22) | 155396c5ddc4Srjs __gen_uint(values->register_format, 24, 26); 155496c5ddc4Srjs} 155596c5ddc4Srjs 155696c5ddc4Srjs 155796c5ddc4Srjs#define MALI_INTERNAL_CONVERSION_LENGTH 4 155896c5ddc4Srjsstruct mali_internal_conversion_packed { uint32_t opaque[1]; }; 155996c5ddc4Srjsstatic inline void 156096c5ddc4SrjsMALI_INTERNAL_CONVERSION_unpack(const uint8_t * restrict cl, 156196c5ddc4Srjs struct MALI_INTERNAL_CONVERSION * restrict values) 156296c5ddc4Srjs{ 156396c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf8800000) fprintf(stderr, "XXX: Invalid field of Internal Conversion unpacked at word 0\n"); 156496c5ddc4Srjs values->memory_format = __gen_unpack_uint(cl, 0, 21); 156596c5ddc4Srjs values->raw = __gen_unpack_uint(cl, 22, 22); 156696c5ddc4Srjs values->register_format = (enum mali_register_file_format)__gen_unpack_uint(cl, 24, 26); 156796c5ddc4Srjs} 156896c5ddc4Srjs 156996c5ddc4Srjsstatic inline void 157096c5ddc4SrjsMALI_INTERNAL_CONVERSION_print(FILE *fp, const struct MALI_INTERNAL_CONVERSION * values, unsigned indent) 157196c5ddc4Srjs{ 157296c5ddc4Srjs mali_pixel_format_print(fp, values->memory_format); 157396c5ddc4Srjs fprintf(fp, "%*sRaw: %s\n", indent, "", values->raw ? "true" : "false"); 157496c5ddc4Srjs fprintf(fp, "%*sRegister Format: %s\n", indent, "", mali_register_file_format_as_str(values->register_format)); 157596c5ddc4Srjs} 157696c5ddc4Srjs 157796c5ddc4Srjsstruct MALI_BLEND_FIXED_FUNCTION { 157896c5ddc4Srjs uint32_t num_comps; 157996c5ddc4Srjs bool alpha_zero_nop; 158096c5ddc4Srjs bool alpha_one_store; 158196c5ddc4Srjs uint32_t rt; 158296c5ddc4Srjs#define MALI_BIFROST_BLEND_MAX_RT 8 158396c5ddc4Srjs struct MALI_INTERNAL_CONVERSION conversion; 158496c5ddc4Srjs}; 158596c5ddc4Srjs 158696c5ddc4Srjs#define MALI_BLEND_FIXED_FUNCTION_header \ 158796c5ddc4Srjs .num_comps = 1, \ 158896c5ddc4Srjs .conversion = { MALI_INTERNAL_CONVERSION_header } 158996c5ddc4Srjs 159096c5ddc4Srjsstatic inline void 159196c5ddc4SrjsMALI_BLEND_FIXED_FUNCTION_pack(uint32_t * restrict cl, 159296c5ddc4Srjs const struct MALI_BLEND_FIXED_FUNCTION * restrict values) 159396c5ddc4Srjs{ 159496c5ddc4Srjs assert(values->num_comps >= 1); 159596c5ddc4Srjs cl[ 0] = __gen_uint(values->num_comps - 1, 3, 4) | 159696c5ddc4Srjs __gen_uint(values->alpha_zero_nop, 5, 5) | 159796c5ddc4Srjs __gen_uint(values->alpha_one_store, 6, 6) | 159896c5ddc4Srjs __gen_uint(values->rt, 16, 19); 159996c5ddc4Srjs cl[ 1] = __gen_uint(values->conversion.memory_format, 0, 21) | 160096c5ddc4Srjs __gen_uint(values->conversion.raw, 22, 22) | 160196c5ddc4Srjs __gen_uint(values->conversion.register_format, 24, 26); 160296c5ddc4Srjs} 160396c5ddc4Srjs 160496c5ddc4Srjs 160596c5ddc4Srjs#define MALI_BLEND_FIXED_FUNCTION_LENGTH 8 160696c5ddc4Srjsstruct mali_blend_fixed_function_packed { uint32_t opaque[2]; }; 160796c5ddc4Srjsstatic inline void 160896c5ddc4SrjsMALI_BLEND_FIXED_FUNCTION_unpack(const uint8_t * restrict cl, 160996c5ddc4Srjs struct MALI_BLEND_FIXED_FUNCTION * restrict values) 161096c5ddc4Srjs{ 161196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xfff0ff87) fprintf(stderr, "XXX: Invalid field of Blend Fixed-Function unpacked at word 0\n"); 161296c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xf8800000) fprintf(stderr, "XXX: Invalid field of Blend Fixed-Function unpacked at word 1\n"); 161396c5ddc4Srjs values->num_comps = __gen_unpack_uint(cl, 3, 4) + 1; 161496c5ddc4Srjs values->alpha_zero_nop = __gen_unpack_uint(cl, 5, 5); 161596c5ddc4Srjs values->alpha_one_store = __gen_unpack_uint(cl, 6, 6); 161696c5ddc4Srjs values->rt = __gen_unpack_uint(cl, 16, 19); 161796c5ddc4Srjs values->conversion.memory_format = __gen_unpack_uint(cl, 32, 53); 161896c5ddc4Srjs values->conversion.raw = __gen_unpack_uint(cl, 54, 54); 161996c5ddc4Srjs values->conversion.register_format = (enum mali_register_file_format)__gen_unpack_uint(cl, 56, 58); 162096c5ddc4Srjs} 162196c5ddc4Srjs 162296c5ddc4Srjsstatic inline void 162396c5ddc4SrjsMALI_BLEND_FIXED_FUNCTION_print(FILE *fp, const struct MALI_BLEND_FIXED_FUNCTION * values, unsigned indent) 162496c5ddc4Srjs{ 162596c5ddc4Srjs fprintf(fp, "%*sNum Comps: %u\n", indent, "", values->num_comps); 162696c5ddc4Srjs fprintf(fp, "%*sAlpha Zero NOP: %s\n", indent, "", values->alpha_zero_nop ? "true" : "false"); 162796c5ddc4Srjs fprintf(fp, "%*sAlpha One Store: %s\n", indent, "", values->alpha_one_store ? "true" : "false"); 162896c5ddc4Srjs fprintf(fp, "%*sRT: %u\n", indent, "", values->rt); 162996c5ddc4Srjs fprintf(fp, "%*sConversion:\n", indent, ""); 163096c5ddc4Srjs MALI_INTERNAL_CONVERSION_print(fp, &values->conversion, indent + 2); 163196c5ddc4Srjs} 163296c5ddc4Srjs 163396c5ddc4Srjsstruct MALI_INTERNAL_BLEND { 163496c5ddc4Srjs enum mali_blend_mode mode; 163596c5ddc4Srjs struct MALI_BLEND_SHADER shader; 163696c5ddc4Srjs struct MALI_BLEND_FIXED_FUNCTION fixed_function; 163796c5ddc4Srjs}; 163896c5ddc4Srjs 163996c5ddc4Srjs#define MALI_INTERNAL_BLEND_header \ 164096c5ddc4Srjs .shader = { MALI_BLEND_SHADER_header }, \ 164196c5ddc4Srjs .fixed_function = { MALI_BLEND_FIXED_FUNCTION_header } 164296c5ddc4Srjs 164396c5ddc4Srjsstatic inline void 164496c5ddc4SrjsMALI_INTERNAL_BLEND_pack(uint32_t * restrict cl, 164596c5ddc4Srjs const struct MALI_INTERNAL_BLEND * restrict values) 164696c5ddc4Srjs{ 164796c5ddc4Srjs cl[ 0] = __gen_uint(values->mode, 0, 1) | 164896c5ddc4Srjs __gen_uint(values->shader.return_value >> 3, 3, 31) | 164996c5ddc4Srjs __gen_uint(values->fixed_function.num_comps - 1, 3, 4) | 165096c5ddc4Srjs __gen_uint(values->fixed_function.alpha_zero_nop, 5, 5) | 165196c5ddc4Srjs __gen_uint(values->fixed_function.alpha_one_store, 6, 6) | 165296c5ddc4Srjs __gen_uint(values->fixed_function.rt, 16, 19); 165396c5ddc4Srjs cl[ 1] = __gen_uint(values->shader.pc >> 4, 4, 31) | 165496c5ddc4Srjs __gen_uint(values->fixed_function.conversion.memory_format, 0, 21) | 165596c5ddc4Srjs __gen_uint(values->fixed_function.conversion.raw, 22, 22) | 165696c5ddc4Srjs __gen_uint(values->fixed_function.conversion.register_format, 24, 26); 165796c5ddc4Srjs} 165896c5ddc4Srjs 165996c5ddc4Srjs 166096c5ddc4Srjs#define MALI_INTERNAL_BLEND_LENGTH 8 166196c5ddc4Srjsstruct mali_internal_blend_packed { uint32_t opaque[2]; }; 166296c5ddc4Srjsstatic inline void 166396c5ddc4SrjsMALI_INTERNAL_BLEND_unpack(const uint8_t * restrict cl, 166496c5ddc4Srjs struct MALI_INTERNAL_BLEND * restrict values) 166596c5ddc4Srjs{ 166696c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0x4) fprintf(stderr, "XXX: Invalid field of Internal Blend unpacked at word 0\n"); 166796c5ddc4Srjs values->mode = (enum mali_blend_mode)__gen_unpack_uint(cl, 0, 1); 166896c5ddc4Srjs values->shader.return_value = __gen_unpack_uint(cl, 3, 31) << 3; 166996c5ddc4Srjs values->shader.pc = __gen_unpack_uint(cl, 36, 63) << 4; 167096c5ddc4Srjs values->fixed_function.num_comps = __gen_unpack_uint(cl, 3, 4) + 1; 167196c5ddc4Srjs values->fixed_function.alpha_zero_nop = __gen_unpack_uint(cl, 5, 5); 167296c5ddc4Srjs values->fixed_function.alpha_one_store = __gen_unpack_uint(cl, 6, 6); 167396c5ddc4Srjs values->fixed_function.rt = __gen_unpack_uint(cl, 16, 19); 167496c5ddc4Srjs values->fixed_function.conversion.memory_format = __gen_unpack_uint(cl, 32, 53); 167596c5ddc4Srjs values->fixed_function.conversion.raw = __gen_unpack_uint(cl, 54, 54); 167696c5ddc4Srjs values->fixed_function.conversion.register_format = (enum mali_register_file_format)__gen_unpack_uint(cl, 56, 58); 167796c5ddc4Srjs} 167896c5ddc4Srjs 167996c5ddc4Srjsstatic inline void 168096c5ddc4SrjsMALI_INTERNAL_BLEND_print(FILE *fp, const struct MALI_INTERNAL_BLEND * values, unsigned indent) 168196c5ddc4Srjs{ 168296c5ddc4Srjs fprintf(fp, "%*sMode: %s\n", indent, "", mali_blend_mode_as_str(values->mode)); 168396c5ddc4Srjs fprintf(fp, "%*sShader:\n", indent, ""); 168496c5ddc4Srjs MALI_BLEND_SHADER_print(fp, &values->shader, indent + 2); 168596c5ddc4Srjs fprintf(fp, "%*sFixed-Function:\n", indent, ""); 168696c5ddc4Srjs MALI_BLEND_FIXED_FUNCTION_print(fp, &values->fixed_function, indent + 2); 168796c5ddc4Srjs} 168896c5ddc4Srjs 168996c5ddc4Srjsstruct MALI_BLEND { 169096c5ddc4Srjs bool load_destination; 169196c5ddc4Srjs bool alpha_to_one; 169296c5ddc4Srjs bool enable; 169396c5ddc4Srjs bool srgb; 169496c5ddc4Srjs bool round_to_fb_precision; 169596c5ddc4Srjs uint32_t constant; 169696c5ddc4Srjs struct MALI_BLEND_EQUATION equation; 169796c5ddc4Srjs struct MALI_INTERNAL_BLEND internal; 169896c5ddc4Srjs}; 169996c5ddc4Srjs 170096c5ddc4Srjs#define MALI_BLEND_header \ 170196c5ddc4Srjs .load_destination = false, \ 170296c5ddc4Srjs .enable = true, \ 170396c5ddc4Srjs .srgb = false, \ 170496c5ddc4Srjs .round_to_fb_precision = false, \ 170596c5ddc4Srjs .equation = { MALI_BLEND_EQUATION_header }, \ 170696c5ddc4Srjs .internal = { MALI_INTERNAL_BLEND_header } 170796c5ddc4Srjs 170896c5ddc4Srjsstatic inline void 170996c5ddc4SrjsMALI_BLEND_pack(uint32_t * restrict cl, 171096c5ddc4Srjs const struct MALI_BLEND * restrict values) 171196c5ddc4Srjs{ 171296c5ddc4Srjs cl[ 0] = __gen_uint(values->load_destination, 0, 0) | 171396c5ddc4Srjs __gen_uint(values->alpha_to_one, 8, 8) | 171496c5ddc4Srjs __gen_uint(values->enable, 9, 9) | 171596c5ddc4Srjs __gen_uint(values->srgb, 10, 10) | 171696c5ddc4Srjs __gen_uint(values->round_to_fb_precision, 11, 11) | 171796c5ddc4Srjs __gen_uint(values->constant, 16, 31); 171896c5ddc4Srjs cl[ 1] = __gen_uint(values->equation.rgb.a, 0, 1) | 171996c5ddc4Srjs __gen_uint(values->equation.rgb.negate_a, 3, 3) | 172096c5ddc4Srjs __gen_uint(values->equation.rgb.b, 4, 5) | 172196c5ddc4Srjs __gen_uint(values->equation.rgb.negate_b, 7, 7) | 172296c5ddc4Srjs __gen_uint(values->equation.rgb.c, 8, 10) | 172396c5ddc4Srjs __gen_uint(values->equation.rgb.invert_c, 11, 11) | 172496c5ddc4Srjs __gen_uint(values->equation.alpha.a, 12, 13) | 172596c5ddc4Srjs __gen_uint(values->equation.alpha.negate_a, 15, 15) | 172696c5ddc4Srjs __gen_uint(values->equation.alpha.b, 16, 17) | 172796c5ddc4Srjs __gen_uint(values->equation.alpha.negate_b, 19, 19) | 172896c5ddc4Srjs __gen_uint(values->equation.alpha.c, 20, 22) | 172996c5ddc4Srjs __gen_uint(values->equation.alpha.invert_c, 23, 23) | 173096c5ddc4Srjs __gen_uint(values->equation.color_mask, 28, 31); 173196c5ddc4Srjs cl[ 2] = __gen_uint(values->internal.mode, 0, 1) | 173296c5ddc4Srjs __gen_uint(values->internal.shader.return_value >> 3, 3, 31) | 173396c5ddc4Srjs __gen_uint(values->internal.fixed_function.num_comps - 1, 3, 4) | 173496c5ddc4Srjs __gen_uint(values->internal.fixed_function.alpha_zero_nop, 5, 5) | 173596c5ddc4Srjs __gen_uint(values->internal.fixed_function.alpha_one_store, 6, 6) | 173696c5ddc4Srjs __gen_uint(values->internal.fixed_function.rt, 16, 19); 173796c5ddc4Srjs cl[ 3] = __gen_uint(values->internal.shader.pc >> 4, 4, 31) | 173896c5ddc4Srjs __gen_uint(values->internal.fixed_function.conversion.memory_format, 0, 21) | 173996c5ddc4Srjs __gen_uint(values->internal.fixed_function.conversion.raw, 22, 22) | 174096c5ddc4Srjs __gen_uint(values->internal.fixed_function.conversion.register_format, 24, 26); 174196c5ddc4Srjs} 174296c5ddc4Srjs 174396c5ddc4Srjs 174496c5ddc4Srjs#define MALI_BLEND_LENGTH 16 174596c5ddc4Srjs#define MALI_BLEND_ALIGN 16 174696c5ddc4Srjsstruct mali_blend_packed { uint32_t opaque[4]; }; 174796c5ddc4Srjsstatic inline void 174896c5ddc4SrjsMALI_BLEND_unpack(const uint8_t * restrict cl, 174996c5ddc4Srjs struct MALI_BLEND * restrict values) 175096c5ddc4Srjs{ 175196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf0fe) fprintf(stderr, "XXX: Invalid field of Blend unpacked at word 0\n"); 175296c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xf044044) fprintf(stderr, "XXX: Invalid field of Blend unpacked at word 1\n"); 175396c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0x4) fprintf(stderr, "XXX: Invalid field of Blend unpacked at word 2\n"); 175496c5ddc4Srjs values->load_destination = __gen_unpack_uint(cl, 0, 0); 175596c5ddc4Srjs values->alpha_to_one = __gen_unpack_uint(cl, 8, 8); 175696c5ddc4Srjs values->enable = __gen_unpack_uint(cl, 9, 9); 175796c5ddc4Srjs values->srgb = __gen_unpack_uint(cl, 10, 10); 175896c5ddc4Srjs values->round_to_fb_precision = __gen_unpack_uint(cl, 11, 11); 175996c5ddc4Srjs values->constant = __gen_unpack_uint(cl, 16, 31); 176096c5ddc4Srjs values->equation.rgb.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 32, 33); 176196c5ddc4Srjs values->equation.rgb.negate_a = __gen_unpack_uint(cl, 35, 35); 176296c5ddc4Srjs values->equation.rgb.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 36, 37); 176396c5ddc4Srjs values->equation.rgb.negate_b = __gen_unpack_uint(cl, 39, 39); 176496c5ddc4Srjs values->equation.rgb.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 40, 42); 176596c5ddc4Srjs values->equation.rgb.invert_c = __gen_unpack_uint(cl, 43, 43); 176696c5ddc4Srjs values->equation.alpha.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 44, 45); 176796c5ddc4Srjs values->equation.alpha.negate_a = __gen_unpack_uint(cl, 47, 47); 176896c5ddc4Srjs values->equation.alpha.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 48, 49); 176996c5ddc4Srjs values->equation.alpha.negate_b = __gen_unpack_uint(cl, 51, 51); 177096c5ddc4Srjs values->equation.alpha.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 52, 54); 177196c5ddc4Srjs values->equation.alpha.invert_c = __gen_unpack_uint(cl, 55, 55); 177296c5ddc4Srjs values->equation.color_mask = __gen_unpack_uint(cl, 60, 63); 177396c5ddc4Srjs values->internal.mode = (enum mali_blend_mode)__gen_unpack_uint(cl, 64, 65); 177496c5ddc4Srjs values->internal.shader.return_value = __gen_unpack_uint(cl, 67, 95) << 3; 177596c5ddc4Srjs values->internal.shader.pc = __gen_unpack_uint(cl, 100, 127) << 4; 177696c5ddc4Srjs values->internal.fixed_function.num_comps = __gen_unpack_uint(cl, 67, 68) + 1; 177796c5ddc4Srjs values->internal.fixed_function.alpha_zero_nop = __gen_unpack_uint(cl, 69, 69); 177896c5ddc4Srjs values->internal.fixed_function.alpha_one_store = __gen_unpack_uint(cl, 70, 70); 177996c5ddc4Srjs values->internal.fixed_function.rt = __gen_unpack_uint(cl, 80, 83); 178096c5ddc4Srjs values->internal.fixed_function.conversion.memory_format = __gen_unpack_uint(cl, 96, 117); 178196c5ddc4Srjs values->internal.fixed_function.conversion.raw = __gen_unpack_uint(cl, 118, 118); 178296c5ddc4Srjs values->internal.fixed_function.conversion.register_format = (enum mali_register_file_format)__gen_unpack_uint(cl, 120, 122); 178396c5ddc4Srjs} 178496c5ddc4Srjs 178596c5ddc4Srjsstatic inline void 178696c5ddc4SrjsMALI_BLEND_print(FILE *fp, const struct MALI_BLEND * values, unsigned indent) 178796c5ddc4Srjs{ 178896c5ddc4Srjs fprintf(fp, "%*sLoad Destination: %s\n", indent, "", values->load_destination ? "true" : "false"); 178996c5ddc4Srjs fprintf(fp, "%*sAlpha To One: %s\n", indent, "", values->alpha_to_one ? "true" : "false"); 179096c5ddc4Srjs fprintf(fp, "%*sEnable: %s\n", indent, "", values->enable ? "true" : "false"); 179196c5ddc4Srjs fprintf(fp, "%*ssRGB: %s\n", indent, "", values->srgb ? "true" : "false"); 179296c5ddc4Srjs fprintf(fp, "%*sRound to FB precision: %s\n", indent, "", values->round_to_fb_precision ? "true" : "false"); 179396c5ddc4Srjs fprintf(fp, "%*sConstant: %u\n", indent, "", values->constant); 179496c5ddc4Srjs fprintf(fp, "%*sEquation:\n", indent, ""); 179596c5ddc4Srjs MALI_BLEND_EQUATION_print(fp, &values->equation, indent + 2); 179696c5ddc4Srjs fprintf(fp, "%*sInternal:\n", indent, ""); 179796c5ddc4Srjs MALI_INTERNAL_BLEND_print(fp, &values->internal, indent + 2); 179896c5ddc4Srjs} 179996c5ddc4Srjs 180096c5ddc4Srjsstruct MALI_INVOCATION { 180196c5ddc4Srjs uint32_t invocations; 180296c5ddc4Srjs uint32_t size_y_shift; 180396c5ddc4Srjs uint32_t size_z_shift; 180496c5ddc4Srjs uint32_t workgroups_x_shift; 180596c5ddc4Srjs uint32_t workgroups_y_shift; 180696c5ddc4Srjs uint32_t workgroups_z_shift; 180796c5ddc4Srjs uint32_t thread_group_split; 180896c5ddc4Srjs#define MALI_SPLIT_MIN_EFFICIENT 2 180996c5ddc4Srjs}; 181096c5ddc4Srjs 181196c5ddc4Srjs#define MALI_INVOCATION_header \ 181296c5ddc4Srjs 0 181396c5ddc4Srjs 181496c5ddc4Srjsstatic inline void 181596c5ddc4SrjsMALI_INVOCATION_pack(uint32_t * restrict cl, 181696c5ddc4Srjs const struct MALI_INVOCATION * restrict values) 181796c5ddc4Srjs{ 181896c5ddc4Srjs cl[ 0] = __gen_uint(values->invocations, 0, 31); 181996c5ddc4Srjs cl[ 1] = __gen_uint(values->size_y_shift, 0, 4) | 182096c5ddc4Srjs __gen_uint(values->size_z_shift, 5, 9) | 182196c5ddc4Srjs __gen_uint(values->workgroups_x_shift, 10, 15) | 182296c5ddc4Srjs __gen_uint(values->workgroups_y_shift, 16, 21) | 182396c5ddc4Srjs __gen_uint(values->workgroups_z_shift, 22, 27) | 182496c5ddc4Srjs __gen_uint(values->thread_group_split, 28, 31); 182596c5ddc4Srjs} 182696c5ddc4Srjs 182796c5ddc4Srjs 182896c5ddc4Srjs#define MALI_INVOCATION_LENGTH 8 182996c5ddc4Srjsstruct mali_invocation_packed { uint32_t opaque[2]; }; 183096c5ddc4Srjsstatic inline void 183196c5ddc4SrjsMALI_INVOCATION_unpack(const uint8_t * restrict cl, 183296c5ddc4Srjs struct MALI_INVOCATION * restrict values) 183396c5ddc4Srjs{ 183496c5ddc4Srjs values->invocations = __gen_unpack_uint(cl, 0, 31); 183596c5ddc4Srjs values->size_y_shift = __gen_unpack_uint(cl, 32, 36); 183696c5ddc4Srjs values->size_z_shift = __gen_unpack_uint(cl, 37, 41); 183796c5ddc4Srjs values->workgroups_x_shift = __gen_unpack_uint(cl, 42, 47); 183896c5ddc4Srjs values->workgroups_y_shift = __gen_unpack_uint(cl, 48, 53); 183996c5ddc4Srjs values->workgroups_z_shift = __gen_unpack_uint(cl, 54, 59); 184096c5ddc4Srjs values->thread_group_split = __gen_unpack_uint(cl, 60, 63); 184196c5ddc4Srjs} 184296c5ddc4Srjs 184396c5ddc4Srjsstatic inline void 184496c5ddc4SrjsMALI_INVOCATION_print(FILE *fp, const struct MALI_INVOCATION * values, unsigned indent) 184596c5ddc4Srjs{ 184696c5ddc4Srjs fprintf(fp, "%*sInvocations: %u\n", indent, "", values->invocations); 184796c5ddc4Srjs fprintf(fp, "%*sSize Y shift: %u\n", indent, "", values->size_y_shift); 184896c5ddc4Srjs fprintf(fp, "%*sSize Z shift: %u\n", indent, "", values->size_z_shift); 184996c5ddc4Srjs fprintf(fp, "%*sWorkgroups X shift: %u\n", indent, "", values->workgroups_x_shift); 185096c5ddc4Srjs fprintf(fp, "%*sWorkgroups Y shift: %u\n", indent, "", values->workgroups_y_shift); 185196c5ddc4Srjs fprintf(fp, "%*sWorkgroups Z shift: %u\n", indent, "", values->workgroups_z_shift); 185296c5ddc4Srjs fprintf(fp, "%*sThread group split: %u\n", indent, "", values->thread_group_split); 185396c5ddc4Srjs} 185496c5ddc4Srjs 185596c5ddc4Srjsenum mali_point_size_array_format { 185696c5ddc4Srjs MALI_POINT_SIZE_ARRAY_FORMAT_NONE = 0, 185796c5ddc4Srjs MALI_POINT_SIZE_ARRAY_FORMAT_FP16 = 2, 185896c5ddc4Srjs MALI_POINT_SIZE_ARRAY_FORMAT_FP32 = 3, 185996c5ddc4Srjs}; 186096c5ddc4Srjs 186196c5ddc4Srjsstatic inline const char * 186296c5ddc4Srjsmali_point_size_array_format_as_str(enum mali_point_size_array_format imm) 186396c5ddc4Srjs{ 186496c5ddc4Srjs switch (imm) { 186596c5ddc4Srjs case MALI_POINT_SIZE_ARRAY_FORMAT_NONE: return "None"; 186696c5ddc4Srjs case MALI_POINT_SIZE_ARRAY_FORMAT_FP16: return "FP16"; 186796c5ddc4Srjs case MALI_POINT_SIZE_ARRAY_FORMAT_FP32: return "FP32"; 186896c5ddc4Srjs default: return "XXX: INVALID"; 186996c5ddc4Srjs } 187096c5ddc4Srjs} 187196c5ddc4Srjs 187296c5ddc4Srjsenum mali_primitive_restart { 187396c5ddc4Srjs MALI_PRIMITIVE_RESTART_NONE = 0, 187496c5ddc4Srjs MALI_PRIMITIVE_RESTART_IMPLICIT = 2, 187596c5ddc4Srjs MALI_PRIMITIVE_RESTART_EXPLICIT = 3, 187696c5ddc4Srjs}; 187796c5ddc4Srjs 187896c5ddc4Srjsstatic inline const char * 187996c5ddc4Srjsmali_primitive_restart_as_str(enum mali_primitive_restart imm) 188096c5ddc4Srjs{ 188196c5ddc4Srjs switch (imm) { 188296c5ddc4Srjs case MALI_PRIMITIVE_RESTART_NONE: return "None"; 188396c5ddc4Srjs case MALI_PRIMITIVE_RESTART_IMPLICIT: return "Implicit"; 188496c5ddc4Srjs case MALI_PRIMITIVE_RESTART_EXPLICIT: return "Explicit"; 188596c5ddc4Srjs default: return "XXX: INVALID"; 188696c5ddc4Srjs } 188796c5ddc4Srjs} 188896c5ddc4Srjs 188996c5ddc4Srjsstruct MALI_PRIMITIVE { 189096c5ddc4Srjs enum mali_draw_mode draw_mode; 189196c5ddc4Srjs enum mali_index_type index_type; 189296c5ddc4Srjs enum mali_point_size_array_format point_size_array_format; 189396c5ddc4Srjs bool primitive_index_enable; 189496c5ddc4Srjs bool primitive_index_writeback; 189596c5ddc4Srjs bool first_provoking_vertex; 189696c5ddc4Srjs bool low_depth_cull; 189796c5ddc4Srjs bool high_depth_cull; 189896c5ddc4Srjs bool secondary_shader; 189996c5ddc4Srjs enum mali_primitive_restart primitive_restart; 190096c5ddc4Srjs uint32_t job_task_split; 190196c5ddc4Srjs uint32_t base_vertex_offset; 190296c5ddc4Srjs uint32_t primitive_restart_index; 190396c5ddc4Srjs uint32_t index_count; 190496c5ddc4Srjs uint64_t indices; 190596c5ddc4Srjs}; 190696c5ddc4Srjs 190796c5ddc4Srjs#define MALI_PRIMITIVE_header \ 190896c5ddc4Srjs .draw_mode = MALI_DRAW_MODE_NONE, \ 190996c5ddc4Srjs .index_type = MALI_INDEX_TYPE_NONE, \ 191096c5ddc4Srjs .first_provoking_vertex = true, \ 191196c5ddc4Srjs .low_depth_cull = true, \ 191296c5ddc4Srjs .high_depth_cull = true 191396c5ddc4Srjs 191496c5ddc4Srjsstatic inline void 191596c5ddc4SrjsMALI_PRIMITIVE_pack(uint32_t * restrict cl, 191696c5ddc4Srjs const struct MALI_PRIMITIVE * restrict values) 191796c5ddc4Srjs{ 191896c5ddc4Srjs assert(values->index_count >= 1); 191996c5ddc4Srjs cl[ 0] = __gen_uint(values->draw_mode, 0, 7) | 192096c5ddc4Srjs __gen_uint(values->index_type, 8, 10) | 192196c5ddc4Srjs __gen_uint(values->point_size_array_format, 11, 12) | 192296c5ddc4Srjs __gen_uint(values->primitive_index_enable, 13, 13) | 192396c5ddc4Srjs __gen_uint(values->primitive_index_writeback, 14, 14) | 192496c5ddc4Srjs __gen_uint(values->first_provoking_vertex, 15, 15) | 192596c5ddc4Srjs __gen_uint(values->low_depth_cull, 16, 16) | 192696c5ddc4Srjs __gen_uint(values->high_depth_cull, 17, 17) | 192796c5ddc4Srjs __gen_uint(values->secondary_shader, 18, 18) | 192896c5ddc4Srjs __gen_uint(values->primitive_restart, 19, 20) | 192996c5ddc4Srjs __gen_uint(values->job_task_split, 26, 31); 193096c5ddc4Srjs cl[ 1] = __gen_uint(values->base_vertex_offset, 0, 31); 193196c5ddc4Srjs cl[ 2] = __gen_uint(values->primitive_restart_index, 0, 31); 193296c5ddc4Srjs cl[ 3] = __gen_uint(values->index_count - 1, 0, 31); 193396c5ddc4Srjs cl[ 4] = __gen_uint(values->indices, 0, 63); 193496c5ddc4Srjs cl[ 5] = __gen_uint(values->indices, 0, 63) >> 32; 193596c5ddc4Srjs} 193696c5ddc4Srjs 193796c5ddc4Srjs 193896c5ddc4Srjs#define MALI_PRIMITIVE_LENGTH 24 193996c5ddc4Srjsstruct mali_primitive_packed { uint32_t opaque[6]; }; 194096c5ddc4Srjsstatic inline void 194196c5ddc4SrjsMALI_PRIMITIVE_unpack(const uint8_t * restrict cl, 194296c5ddc4Srjs struct MALI_PRIMITIVE * restrict values) 194396c5ddc4Srjs{ 194496c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0x3e00000) fprintf(stderr, "XXX: Invalid field of Primitive unpacked at word 0\n"); 194596c5ddc4Srjs values->draw_mode = (enum mali_draw_mode)__gen_unpack_uint(cl, 0, 7); 194696c5ddc4Srjs values->index_type = (enum mali_index_type)__gen_unpack_uint(cl, 8, 10); 194796c5ddc4Srjs values->point_size_array_format = (enum mali_point_size_array_format)__gen_unpack_uint(cl, 11, 12); 194896c5ddc4Srjs values->primitive_index_enable = __gen_unpack_uint(cl, 13, 13); 194996c5ddc4Srjs values->primitive_index_writeback = __gen_unpack_uint(cl, 14, 14); 195096c5ddc4Srjs values->first_provoking_vertex = __gen_unpack_uint(cl, 15, 15); 195196c5ddc4Srjs values->low_depth_cull = __gen_unpack_uint(cl, 16, 16); 195296c5ddc4Srjs values->high_depth_cull = __gen_unpack_uint(cl, 17, 17); 195396c5ddc4Srjs values->secondary_shader = __gen_unpack_uint(cl, 18, 18); 195496c5ddc4Srjs values->primitive_restart = (enum mali_primitive_restart)__gen_unpack_uint(cl, 19, 20); 195596c5ddc4Srjs values->job_task_split = __gen_unpack_uint(cl, 26, 31); 195696c5ddc4Srjs values->base_vertex_offset = __gen_unpack_uint(cl, 32, 63); 195796c5ddc4Srjs values->primitive_restart_index = __gen_unpack_uint(cl, 64, 95); 195896c5ddc4Srjs values->index_count = __gen_unpack_uint(cl, 96, 127) + 1; 195996c5ddc4Srjs values->indices = __gen_unpack_uint(cl, 128, 191); 196096c5ddc4Srjs} 196196c5ddc4Srjs 196296c5ddc4Srjsstatic inline void 196396c5ddc4SrjsMALI_PRIMITIVE_print(FILE *fp, const struct MALI_PRIMITIVE * values, unsigned indent) 196496c5ddc4Srjs{ 196596c5ddc4Srjs fprintf(fp, "%*sDraw mode: %s\n", indent, "", mali_draw_mode_as_str(values->draw_mode)); 196696c5ddc4Srjs fprintf(fp, "%*sIndex type: %s\n", indent, "", mali_index_type_as_str(values->index_type)); 196796c5ddc4Srjs fprintf(fp, "%*sPoint size array format: %s\n", indent, "", mali_point_size_array_format_as_str(values->point_size_array_format)); 196896c5ddc4Srjs fprintf(fp, "%*sPrimitive Index Enable: %s\n", indent, "", values->primitive_index_enable ? "true" : "false"); 196996c5ddc4Srjs fprintf(fp, "%*sPrimitive Index Writeback: %s\n", indent, "", values->primitive_index_writeback ? "true" : "false"); 197096c5ddc4Srjs fprintf(fp, "%*sFirst provoking vertex: %s\n", indent, "", values->first_provoking_vertex ? "true" : "false"); 197196c5ddc4Srjs fprintf(fp, "%*sLow Depth Cull: %s\n", indent, "", values->low_depth_cull ? "true" : "false"); 197296c5ddc4Srjs fprintf(fp, "%*sHigh Depth Cull: %s\n", indent, "", values->high_depth_cull ? "true" : "false"); 197396c5ddc4Srjs fprintf(fp, "%*sSecondary Shader: %s\n", indent, "", values->secondary_shader ? "true" : "false"); 197496c5ddc4Srjs fprintf(fp, "%*sPrimitive restart: %s\n", indent, "", mali_primitive_restart_as_str(values->primitive_restart)); 197596c5ddc4Srjs fprintf(fp, "%*sJob Task Split: %u\n", indent, "", values->job_task_split); 197696c5ddc4Srjs fprintf(fp, "%*sBase vertex offset: %u\n", indent, "", values->base_vertex_offset); 197796c5ddc4Srjs fprintf(fp, "%*sPrimitive Restart Index: %u\n", indent, "", values->primitive_restart_index); 197896c5ddc4Srjs fprintf(fp, "%*sIndex count: %u\n", indent, "", values->index_count); 197996c5ddc4Srjs fprintf(fp, "%*sIndices: 0x%" PRIx64 "\n", indent, "", values->indices); 198096c5ddc4Srjs} 198196c5ddc4Srjs 198296c5ddc4Srjsstruct MALI_DRAW { 198396c5ddc4Srjs bool four_components_per_vertex; 198496c5ddc4Srjs bool draw_descriptor_is_64b; 198596c5ddc4Srjs enum mali_occlusion_mode occlusion_query; 198696c5ddc4Srjs bool front_face_ccw; 198796c5ddc4Srjs bool cull_front_face; 198896c5ddc4Srjs bool cull_back_face; 198996c5ddc4Srjs uint32_t flat_shading_vertex; 199096c5ddc4Srjs bool exclude_filtered_perf_counters; 199196c5ddc4Srjs bool primitive_barrier; 199296c5ddc4Srjs bool clean_fragment_write; 199396c5ddc4Srjs uint32_t instance_size; 199496c5ddc4Srjs uint32_t instance_primitive_size; 199596c5ddc4Srjs uint32_t offset_start; 199696c5ddc4Srjs uint32_t primitive_index_base; 199796c5ddc4Srjs uint64_t position; 199896c5ddc4Srjs uint64_t uniform_buffers; 199996c5ddc4Srjs uint64_t textures; 200096c5ddc4Srjs uint64_t samplers; 200196c5ddc4Srjs uint64_t push_uniforms; 200296c5ddc4Srjs uint64_t state; 200396c5ddc4Srjs uint64_t attribute_buffers; 200496c5ddc4Srjs uint64_t attributes; 200596c5ddc4Srjs uint64_t varying_buffers; 200696c5ddc4Srjs uint64_t varyings; 200796c5ddc4Srjs uint64_t viewport; 200896c5ddc4Srjs uint64_t occlusion; 200996c5ddc4Srjs uint64_t thread_storage; 201096c5ddc4Srjs uint64_t fbd; 201196c5ddc4Srjs}; 201296c5ddc4Srjs 201396c5ddc4Srjs#define MALI_DRAW_header \ 201496c5ddc4Srjs .occlusion_query = MALI_OCCLUSION_MODE_DISABLED, \ 201596c5ddc4Srjs .instance_size = 1, \ 201696c5ddc4Srjs .instance_primitive_size = 1 201796c5ddc4Srjs 201896c5ddc4Srjsstatic inline void 201996c5ddc4SrjsMALI_DRAW_pack(uint32_t * restrict cl, 202096c5ddc4Srjs const struct MALI_DRAW * restrict values) 202196c5ddc4Srjs{ 202296c5ddc4Srjs cl[ 0] = __gen_uint(values->four_components_per_vertex, 0, 0) | 202396c5ddc4Srjs __gen_uint(values->draw_descriptor_is_64b, 1, 1) | 202496c5ddc4Srjs __gen_uint(values->occlusion_query, 3, 4) | 202596c5ddc4Srjs __gen_uint(values->front_face_ccw, 5, 5) | 202696c5ddc4Srjs __gen_uint(values->cull_front_face, 6, 6) | 202796c5ddc4Srjs __gen_uint(values->cull_back_face, 7, 7) | 202896c5ddc4Srjs __gen_uint(values->flat_shading_vertex, 8, 8) | 202996c5ddc4Srjs __gen_uint(values->exclude_filtered_perf_counters, 9, 9) | 203096c5ddc4Srjs __gen_uint(values->primitive_barrier, 10, 10) | 203196c5ddc4Srjs __gen_uint(values->clean_fragment_write, 11, 11) | 203296c5ddc4Srjs __gen_padded(values->instance_size, 16, 23) | 203396c5ddc4Srjs __gen_padded(values->instance_primitive_size, 24, 31); 203496c5ddc4Srjs cl[ 1] = __gen_uint(values->offset_start, 0, 31); 203596c5ddc4Srjs cl[ 2] = __gen_uint(values->primitive_index_base, 0, 31); 203696c5ddc4Srjs cl[ 3] = 0; 203796c5ddc4Srjs cl[ 4] = __gen_uint(values->position, 0, 63); 203896c5ddc4Srjs cl[ 5] = __gen_uint(values->position, 0, 63) >> 32; 203996c5ddc4Srjs cl[ 6] = __gen_uint(values->uniform_buffers, 0, 63); 204096c5ddc4Srjs cl[ 7] = __gen_uint(values->uniform_buffers, 0, 63) >> 32; 204196c5ddc4Srjs cl[ 8] = __gen_uint(values->textures, 0, 63); 204296c5ddc4Srjs cl[ 9] = __gen_uint(values->textures, 0, 63) >> 32; 204396c5ddc4Srjs cl[10] = __gen_uint(values->samplers, 0, 63); 204496c5ddc4Srjs cl[11] = __gen_uint(values->samplers, 0, 63) >> 32; 204596c5ddc4Srjs cl[12] = __gen_uint(values->push_uniforms, 0, 63); 204696c5ddc4Srjs cl[13] = __gen_uint(values->push_uniforms, 0, 63) >> 32; 204796c5ddc4Srjs cl[14] = __gen_uint(values->state, 0, 63); 204896c5ddc4Srjs cl[15] = __gen_uint(values->state, 0, 63) >> 32; 204996c5ddc4Srjs cl[16] = __gen_uint(values->attribute_buffers, 0, 63); 205096c5ddc4Srjs cl[17] = __gen_uint(values->attribute_buffers, 0, 63) >> 32; 205196c5ddc4Srjs cl[18] = __gen_uint(values->attributes, 0, 63); 205296c5ddc4Srjs cl[19] = __gen_uint(values->attributes, 0, 63) >> 32; 205396c5ddc4Srjs cl[20] = __gen_uint(values->varying_buffers, 0, 63); 205496c5ddc4Srjs cl[21] = __gen_uint(values->varying_buffers, 0, 63) >> 32; 205596c5ddc4Srjs cl[22] = __gen_uint(values->varyings, 0, 63); 205696c5ddc4Srjs cl[23] = __gen_uint(values->varyings, 0, 63) >> 32; 205796c5ddc4Srjs cl[24] = __gen_uint(values->viewport, 0, 63); 205896c5ddc4Srjs cl[25] = __gen_uint(values->viewport, 0, 63) >> 32; 205996c5ddc4Srjs cl[26] = __gen_uint(values->occlusion, 0, 63); 206096c5ddc4Srjs cl[27] = __gen_uint(values->occlusion, 0, 63) >> 32; 206196c5ddc4Srjs cl[28] = __gen_uint(values->thread_storage, 0, 63) | 206296c5ddc4Srjs __gen_uint(values->fbd, 0, 63); 206396c5ddc4Srjs cl[29] = __gen_uint(values->thread_storage, 0, 63) >> 32 | 206496c5ddc4Srjs __gen_uint(values->fbd, 0, 63) >> 32; 206596c5ddc4Srjs cl[30] = 0; 206696c5ddc4Srjs cl[31] = 0; 206796c5ddc4Srjs} 206896c5ddc4Srjs 206996c5ddc4Srjs 207096c5ddc4Srjs#define MALI_DRAW_LENGTH 128 207196c5ddc4Srjs#define MALI_DRAW_ALIGN 64 207296c5ddc4Srjsstruct mali_draw_packed { uint32_t opaque[32]; }; 207396c5ddc4Srjsstatic inline void 207496c5ddc4SrjsMALI_DRAW_unpack(const uint8_t * restrict cl, 207596c5ddc4Srjs struct MALI_DRAW * restrict values) 207696c5ddc4Srjs{ 207796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf004) fprintf(stderr, "XXX: Invalid field of Draw unpacked at word 0\n"); 207896c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Draw unpacked at word 3\n"); 207996c5ddc4Srjs if (((const uint32_t *) cl)[30] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Draw unpacked at word 30\n"); 208096c5ddc4Srjs if (((const uint32_t *) cl)[31] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Draw unpacked at word 31\n"); 208196c5ddc4Srjs values->four_components_per_vertex = __gen_unpack_uint(cl, 0, 0); 208296c5ddc4Srjs values->draw_descriptor_is_64b = __gen_unpack_uint(cl, 1, 1); 208396c5ddc4Srjs values->occlusion_query = (enum mali_occlusion_mode)__gen_unpack_uint(cl, 3, 4); 208496c5ddc4Srjs values->front_face_ccw = __gen_unpack_uint(cl, 5, 5); 208596c5ddc4Srjs values->cull_front_face = __gen_unpack_uint(cl, 6, 6); 208696c5ddc4Srjs values->cull_back_face = __gen_unpack_uint(cl, 7, 7); 208796c5ddc4Srjs values->flat_shading_vertex = __gen_unpack_uint(cl, 8, 8); 208896c5ddc4Srjs values->exclude_filtered_perf_counters = __gen_unpack_uint(cl, 9, 9); 208996c5ddc4Srjs values->primitive_barrier = __gen_unpack_uint(cl, 10, 10); 209096c5ddc4Srjs values->clean_fragment_write = __gen_unpack_uint(cl, 11, 11); 209196c5ddc4Srjs values->instance_size = __gen_unpack_padded(cl, 16, 23); 209296c5ddc4Srjs values->instance_primitive_size = __gen_unpack_padded(cl, 24, 31); 209396c5ddc4Srjs values->offset_start = __gen_unpack_uint(cl, 32, 63); 209496c5ddc4Srjs values->primitive_index_base = __gen_unpack_uint(cl, 64, 95); 209596c5ddc4Srjs values->position = __gen_unpack_uint(cl, 128, 191); 209696c5ddc4Srjs values->uniform_buffers = __gen_unpack_uint(cl, 192, 255); 209796c5ddc4Srjs values->textures = __gen_unpack_uint(cl, 256, 319); 209896c5ddc4Srjs values->samplers = __gen_unpack_uint(cl, 320, 383); 209996c5ddc4Srjs values->push_uniforms = __gen_unpack_uint(cl, 384, 447); 210096c5ddc4Srjs values->state = __gen_unpack_uint(cl, 448, 511); 210196c5ddc4Srjs values->attribute_buffers = __gen_unpack_uint(cl, 512, 575); 210296c5ddc4Srjs values->attributes = __gen_unpack_uint(cl, 576, 639); 210396c5ddc4Srjs values->varying_buffers = __gen_unpack_uint(cl, 640, 703); 210496c5ddc4Srjs values->varyings = __gen_unpack_uint(cl, 704, 767); 210596c5ddc4Srjs values->viewport = __gen_unpack_uint(cl, 768, 831); 210696c5ddc4Srjs values->occlusion = __gen_unpack_uint(cl, 832, 895); 210796c5ddc4Srjs values->thread_storage = __gen_unpack_uint(cl, 896, 959); 210896c5ddc4Srjs values->fbd = __gen_unpack_uint(cl, 896, 959); 210996c5ddc4Srjs} 211096c5ddc4Srjs 211196c5ddc4Srjsstatic inline void 211296c5ddc4SrjsMALI_DRAW_print(FILE *fp, const struct MALI_DRAW * values, unsigned indent) 211396c5ddc4Srjs{ 211496c5ddc4Srjs fprintf(fp, "%*sFour Components Per Vertex: %s\n", indent, "", values->four_components_per_vertex ? "true" : "false"); 211596c5ddc4Srjs fprintf(fp, "%*sDraw Descriptor Is 64b: %s\n", indent, "", values->draw_descriptor_is_64b ? "true" : "false"); 211696c5ddc4Srjs fprintf(fp, "%*sOcclusion query: %s\n", indent, "", mali_occlusion_mode_as_str(values->occlusion_query)); 211796c5ddc4Srjs fprintf(fp, "%*sFront face CCW: %s\n", indent, "", values->front_face_ccw ? "true" : "false"); 211896c5ddc4Srjs fprintf(fp, "%*sCull front face: %s\n", indent, "", values->cull_front_face ? "true" : "false"); 211996c5ddc4Srjs fprintf(fp, "%*sCull back face: %s\n", indent, "", values->cull_back_face ? "true" : "false"); 212096c5ddc4Srjs fprintf(fp, "%*sFlat Shading Vertex: %u\n", indent, "", values->flat_shading_vertex); 212196c5ddc4Srjs fprintf(fp, "%*sExclude Filtered Perf Counters: %s\n", indent, "", values->exclude_filtered_perf_counters ? "true" : "false"); 212296c5ddc4Srjs fprintf(fp, "%*sPrimitive Barrier: %s\n", indent, "", values->primitive_barrier ? "true" : "false"); 212396c5ddc4Srjs fprintf(fp, "%*sClean Fragment Write: %s\n", indent, "", values->clean_fragment_write ? "true" : "false"); 212496c5ddc4Srjs fprintf(fp, "%*sInstance Size: %u\n", indent, "", values->instance_size); 212596c5ddc4Srjs fprintf(fp, "%*sInstance Primitive Size: %u\n", indent, "", values->instance_primitive_size); 212696c5ddc4Srjs fprintf(fp, "%*sOffset start: %u\n", indent, "", values->offset_start); 212796c5ddc4Srjs fprintf(fp, "%*sPrimitive Index Base: %u\n", indent, "", values->primitive_index_base); 212896c5ddc4Srjs fprintf(fp, "%*sPosition: 0x%" PRIx64 "\n", indent, "", values->position); 212996c5ddc4Srjs fprintf(fp, "%*sUniform buffers: 0x%" PRIx64 "\n", indent, "", values->uniform_buffers); 213096c5ddc4Srjs fprintf(fp, "%*sTextures: 0x%" PRIx64 "\n", indent, "", values->textures); 213196c5ddc4Srjs fprintf(fp, "%*sSamplers: 0x%" PRIx64 "\n", indent, "", values->samplers); 213296c5ddc4Srjs fprintf(fp, "%*sPush uniforms: 0x%" PRIx64 "\n", indent, "", values->push_uniforms); 213396c5ddc4Srjs fprintf(fp, "%*sState: 0x%" PRIx64 "\n", indent, "", values->state); 213496c5ddc4Srjs fprintf(fp, "%*sAttribute buffers: 0x%" PRIx64 "\n", indent, "", values->attribute_buffers); 213596c5ddc4Srjs fprintf(fp, "%*sAttributes: 0x%" PRIx64 "\n", indent, "", values->attributes); 213696c5ddc4Srjs fprintf(fp, "%*sVarying buffers: 0x%" PRIx64 "\n", indent, "", values->varying_buffers); 213796c5ddc4Srjs fprintf(fp, "%*sVaryings: 0x%" PRIx64 "\n", indent, "", values->varyings); 213896c5ddc4Srjs fprintf(fp, "%*sViewport: 0x%" PRIx64 "\n", indent, "", values->viewport); 213996c5ddc4Srjs fprintf(fp, "%*sOcclusion: 0x%" PRIx64 "\n", indent, "", values->occlusion); 214096c5ddc4Srjs fprintf(fp, "%*sThread Storage: 0x%" PRIx64 "\n", indent, "", values->thread_storage); 214196c5ddc4Srjs fprintf(fp, "%*sFBD: 0x%" PRIx64 "\n", indent, "", values->fbd); 214296c5ddc4Srjs} 214396c5ddc4Srjs 214496c5ddc4Srjsstruct MALI_SURFACE { 214596c5ddc4Srjs uint64_t pointer; 214696c5ddc4Srjs}; 214796c5ddc4Srjs 214896c5ddc4Srjs#define MALI_SURFACE_header \ 214996c5ddc4Srjs 0 215096c5ddc4Srjs 215196c5ddc4Srjsstatic inline void 215296c5ddc4SrjsMALI_SURFACE_pack(uint32_t * restrict cl, 215396c5ddc4Srjs const struct MALI_SURFACE * restrict values) 215496c5ddc4Srjs{ 215596c5ddc4Srjs cl[ 0] = __gen_uint(values->pointer, 0, 63); 215696c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer, 0, 63) >> 32; 215796c5ddc4Srjs} 215896c5ddc4Srjs 215996c5ddc4Srjs 216096c5ddc4Srjs#define MALI_SURFACE_LENGTH 8 216196c5ddc4Srjs#define MALI_SURFACE_ALIGN 8 216296c5ddc4Srjsstruct mali_surface_packed { uint32_t opaque[2]; }; 216396c5ddc4Srjsstatic inline void 216496c5ddc4SrjsMALI_SURFACE_unpack(const uint8_t * restrict cl, 216596c5ddc4Srjs struct MALI_SURFACE * restrict values) 216696c5ddc4Srjs{ 216796c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 0, 63); 216896c5ddc4Srjs} 216996c5ddc4Srjs 217096c5ddc4Srjsstatic inline void 217196c5ddc4SrjsMALI_SURFACE_print(FILE *fp, const struct MALI_SURFACE * values, unsigned indent) 217296c5ddc4Srjs{ 217396c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 217496c5ddc4Srjs} 217596c5ddc4Srjs 217696c5ddc4Srjsstruct MALI_SURFACE_WITH_STRIDE { 217796c5ddc4Srjs uint64_t pointer; 217896c5ddc4Srjs int32_t row_stride; 217996c5ddc4Srjs int32_t surface_stride; 218096c5ddc4Srjs}; 218196c5ddc4Srjs 218296c5ddc4Srjs#define MALI_SURFACE_WITH_STRIDE_header \ 218396c5ddc4Srjs 0 218496c5ddc4Srjs 218596c5ddc4Srjsstatic inline void 218696c5ddc4SrjsMALI_SURFACE_WITH_STRIDE_pack(uint32_t * restrict cl, 218796c5ddc4Srjs const struct MALI_SURFACE_WITH_STRIDE * restrict values) 218896c5ddc4Srjs{ 218996c5ddc4Srjs cl[ 0] = __gen_uint(values->pointer, 0, 63); 219096c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer, 0, 63) >> 32; 219196c5ddc4Srjs cl[ 2] = __gen_sint(values->row_stride, 0, 31); 219296c5ddc4Srjs cl[ 3] = __gen_sint(values->surface_stride, 0, 31); 219396c5ddc4Srjs} 219496c5ddc4Srjs 219596c5ddc4Srjs 219696c5ddc4Srjs#define MALI_SURFACE_WITH_STRIDE_LENGTH 16 219796c5ddc4Srjs#define MALI_SURFACE_WITH_STRIDE_ALIGN 8 219896c5ddc4Srjsstruct mali_surface_with_stride_packed { uint32_t opaque[4]; }; 219996c5ddc4Srjsstatic inline void 220096c5ddc4SrjsMALI_SURFACE_WITH_STRIDE_unpack(const uint8_t * restrict cl, 220196c5ddc4Srjs struct MALI_SURFACE_WITH_STRIDE * restrict values) 220296c5ddc4Srjs{ 220396c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 0, 63); 220496c5ddc4Srjs values->row_stride = __gen_unpack_sint(cl, 64, 95); 220596c5ddc4Srjs values->surface_stride = __gen_unpack_sint(cl, 96, 127); 220696c5ddc4Srjs} 220796c5ddc4Srjs 220896c5ddc4Srjsstatic inline void 220996c5ddc4SrjsMALI_SURFACE_WITH_STRIDE_print(FILE *fp, const struct MALI_SURFACE_WITH_STRIDE * values, unsigned indent) 221096c5ddc4Srjs{ 221196c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 221296c5ddc4Srjs fprintf(fp, "%*sRow stride: %d\n", indent, "", values->row_stride); 221396c5ddc4Srjs fprintf(fp, "%*sSurface stride: %d\n", indent, "", values->surface_stride); 221496c5ddc4Srjs} 221596c5ddc4Srjs 221696c5ddc4Srjsstruct MALI_SAMPLER { 221796c5ddc4Srjs uint32_t type; 221896c5ddc4Srjs enum mali_wrap_mode wrap_mode_r; 221996c5ddc4Srjs enum mali_wrap_mode wrap_mode_t; 222096c5ddc4Srjs enum mali_wrap_mode wrap_mode_s; 222196c5ddc4Srjs bool round_to_nearest_even; 222296c5ddc4Srjs bool srgb_override; 222396c5ddc4Srjs bool seamless_cube_map; 222496c5ddc4Srjs bool clamp_integer_coordinates; 222596c5ddc4Srjs bool normalized_coordinates; 222696c5ddc4Srjs bool clamp_integer_array_indices; 222796c5ddc4Srjs bool minify_nearest; 222896c5ddc4Srjs bool magnify_nearest; 222996c5ddc4Srjs bool magnify_cutoff; 223096c5ddc4Srjs enum mali_mipmap_mode mipmap_mode; 223196c5ddc4Srjs uint32_t minimum_lod; 223296c5ddc4Srjs enum mali_func compare_function; 223396c5ddc4Srjs uint32_t maximum_lod; 223496c5ddc4Srjs int32_t lod_bias; 223596c5ddc4Srjs uint32_t maximum_anisotropy; 223696c5ddc4Srjs enum mali_lod_algorithm lod_algorithm; 223796c5ddc4Srjs uint32_t border_color_r; 223896c5ddc4Srjs uint32_t border_color_g; 223996c5ddc4Srjs uint32_t border_color_b; 224096c5ddc4Srjs uint32_t border_color_a; 224196c5ddc4Srjs}; 224296c5ddc4Srjs 224396c5ddc4Srjs#define MALI_SAMPLER_header \ 224496c5ddc4Srjs .type = 1, \ 224596c5ddc4Srjs .wrap_mode_r = MALI_WRAP_MODE_CLAMP_TO_EDGE, \ 224696c5ddc4Srjs .wrap_mode_t = MALI_WRAP_MODE_CLAMP_TO_EDGE, \ 224796c5ddc4Srjs .wrap_mode_s = MALI_WRAP_MODE_CLAMP_TO_EDGE, \ 224896c5ddc4Srjs .round_to_nearest_even = false, \ 224996c5ddc4Srjs .srgb_override = false, \ 225096c5ddc4Srjs .seamless_cube_map = true, \ 225196c5ddc4Srjs .normalized_coordinates = true, \ 225296c5ddc4Srjs .clamp_integer_array_indices = true, \ 225396c5ddc4Srjs .minify_nearest = false, \ 225496c5ddc4Srjs .magnify_nearest = false, \ 225596c5ddc4Srjs .magnify_cutoff = false, \ 225696c5ddc4Srjs .mipmap_mode = MALI_MIPMAP_MODE_NEAREST, \ 225796c5ddc4Srjs .minimum_lod = 0, \ 225896c5ddc4Srjs .compare_function = MALI_FUNC_NEVER, \ 225996c5ddc4Srjs .maximum_lod = 0, \ 226096c5ddc4Srjs .lod_bias = 0, \ 226196c5ddc4Srjs .maximum_anisotropy = 1, \ 226296c5ddc4Srjs .lod_algorithm = MALI_LOD_ALGORITHM_ISOTROPIC, \ 226396c5ddc4Srjs .border_color_r = 0.0, \ 226496c5ddc4Srjs .border_color_g = 0.0, \ 226596c5ddc4Srjs .border_color_b = 0.0, \ 226696c5ddc4Srjs .border_color_a = 0.0 226796c5ddc4Srjs 226896c5ddc4Srjsstatic inline void 226996c5ddc4SrjsMALI_SAMPLER_pack(uint32_t * restrict cl, 227096c5ddc4Srjs const struct MALI_SAMPLER * restrict values) 227196c5ddc4Srjs{ 227296c5ddc4Srjs assert(values->maximum_anisotropy >= 1); 227396c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 3) | 227496c5ddc4Srjs __gen_uint(values->wrap_mode_r, 8, 11) | 227596c5ddc4Srjs __gen_uint(values->wrap_mode_t, 12, 15) | 227696c5ddc4Srjs __gen_uint(values->wrap_mode_s, 16, 19) | 227796c5ddc4Srjs __gen_uint(values->round_to_nearest_even, 21, 21) | 227896c5ddc4Srjs __gen_uint(values->srgb_override, 22, 22) | 227996c5ddc4Srjs __gen_uint(values->seamless_cube_map, 23, 23) | 228096c5ddc4Srjs __gen_uint(values->clamp_integer_coordinates, 24, 24) | 228196c5ddc4Srjs __gen_uint(values->normalized_coordinates, 25, 25) | 228296c5ddc4Srjs __gen_uint(values->clamp_integer_array_indices, 26, 26) | 228396c5ddc4Srjs __gen_uint(values->minify_nearest, 27, 27) | 228496c5ddc4Srjs __gen_uint(values->magnify_nearest, 28, 28) | 228596c5ddc4Srjs __gen_uint(values->magnify_cutoff, 29, 29) | 228696c5ddc4Srjs __gen_uint(values->mipmap_mode, 30, 31); 228796c5ddc4Srjs cl[ 1] = __gen_uint(values->minimum_lod, 0, 12) | 228896c5ddc4Srjs __gen_uint(values->compare_function, 13, 15) | 228996c5ddc4Srjs __gen_uint(values->maximum_lod, 16, 28); 229096c5ddc4Srjs cl[ 2] = __gen_sint(values->lod_bias, 0, 15) | 229196c5ddc4Srjs __gen_uint(values->maximum_anisotropy - 1, 16, 20) | 229296c5ddc4Srjs __gen_uint(values->lod_algorithm, 24, 25); 229396c5ddc4Srjs cl[ 3] = 0; 229496c5ddc4Srjs cl[ 4] = __gen_uint(values->border_color_r, 0, 31); 229596c5ddc4Srjs cl[ 5] = __gen_uint(values->border_color_g, 0, 31); 229696c5ddc4Srjs cl[ 6] = __gen_uint(values->border_color_b, 0, 31); 229796c5ddc4Srjs cl[ 7] = __gen_uint(values->border_color_a, 0, 31); 229896c5ddc4Srjs} 229996c5ddc4Srjs 230096c5ddc4Srjs 230196c5ddc4Srjs#define MALI_SAMPLER_LENGTH 32 230296c5ddc4Srjs#define MALI_SAMPLER_ALIGN 32 230396c5ddc4Srjsstruct mali_sampler_packed { uint32_t opaque[8]; }; 230496c5ddc4Srjsstatic inline void 230596c5ddc4SrjsMALI_SAMPLER_unpack(const uint8_t * restrict cl, 230696c5ddc4Srjs struct MALI_SAMPLER * restrict values) 230796c5ddc4Srjs{ 230896c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0x1000f0) fprintf(stderr, "XXX: Invalid field of Sampler unpacked at word 0\n"); 230996c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xe0000000) fprintf(stderr, "XXX: Invalid field of Sampler unpacked at word 1\n"); 231096c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xfce00000) fprintf(stderr, "XXX: Invalid field of Sampler unpacked at word 2\n"); 231196c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Sampler unpacked at word 3\n"); 231296c5ddc4Srjs values->type = __gen_unpack_uint(cl, 0, 3); 231396c5ddc4Srjs values->wrap_mode_r = (enum mali_wrap_mode)__gen_unpack_uint(cl, 8, 11); 231496c5ddc4Srjs values->wrap_mode_t = (enum mali_wrap_mode)__gen_unpack_uint(cl, 12, 15); 231596c5ddc4Srjs values->wrap_mode_s = (enum mali_wrap_mode)__gen_unpack_uint(cl, 16, 19); 231696c5ddc4Srjs values->round_to_nearest_even = __gen_unpack_uint(cl, 21, 21); 231796c5ddc4Srjs values->srgb_override = __gen_unpack_uint(cl, 22, 22); 231896c5ddc4Srjs values->seamless_cube_map = __gen_unpack_uint(cl, 23, 23); 231996c5ddc4Srjs values->clamp_integer_coordinates = __gen_unpack_uint(cl, 24, 24); 232096c5ddc4Srjs values->normalized_coordinates = __gen_unpack_uint(cl, 25, 25); 232196c5ddc4Srjs values->clamp_integer_array_indices = __gen_unpack_uint(cl, 26, 26); 232296c5ddc4Srjs values->minify_nearest = __gen_unpack_uint(cl, 27, 27); 232396c5ddc4Srjs values->magnify_nearest = __gen_unpack_uint(cl, 28, 28); 232496c5ddc4Srjs values->magnify_cutoff = __gen_unpack_uint(cl, 29, 29); 232596c5ddc4Srjs values->mipmap_mode = (enum mali_mipmap_mode)__gen_unpack_uint(cl, 30, 31); 232696c5ddc4Srjs values->minimum_lod = __gen_unpack_uint(cl, 32, 44); 232796c5ddc4Srjs values->compare_function = (enum mali_func)__gen_unpack_uint(cl, 45, 47); 232896c5ddc4Srjs values->maximum_lod = __gen_unpack_uint(cl, 48, 60); 232996c5ddc4Srjs values->lod_bias = __gen_unpack_sint(cl, 64, 79); 233096c5ddc4Srjs values->maximum_anisotropy = __gen_unpack_uint(cl, 80, 84) + 1; 233196c5ddc4Srjs values->lod_algorithm = (enum mali_lod_algorithm)__gen_unpack_uint(cl, 88, 89); 233296c5ddc4Srjs values->border_color_r = __gen_unpack_uint(cl, 128, 159); 233396c5ddc4Srjs values->border_color_g = __gen_unpack_uint(cl, 160, 191); 233496c5ddc4Srjs values->border_color_b = __gen_unpack_uint(cl, 192, 223); 233596c5ddc4Srjs values->border_color_a = __gen_unpack_uint(cl, 224, 255); 233696c5ddc4Srjs} 233796c5ddc4Srjs 233896c5ddc4Srjsstatic inline void 233996c5ddc4SrjsMALI_SAMPLER_print(FILE *fp, const struct MALI_SAMPLER * values, unsigned indent) 234096c5ddc4Srjs{ 234196c5ddc4Srjs fprintf(fp, "%*sType: %u\n", indent, "", values->type); 234296c5ddc4Srjs fprintf(fp, "%*sWrap Mode R: %s\n", indent, "", mali_wrap_mode_as_str(values->wrap_mode_r)); 234396c5ddc4Srjs fprintf(fp, "%*sWrap Mode T: %s\n", indent, "", mali_wrap_mode_as_str(values->wrap_mode_t)); 234496c5ddc4Srjs fprintf(fp, "%*sWrap Mode S: %s\n", indent, "", mali_wrap_mode_as_str(values->wrap_mode_s)); 234596c5ddc4Srjs fprintf(fp, "%*sRound to nearest even: %s\n", indent, "", values->round_to_nearest_even ? "true" : "false"); 234696c5ddc4Srjs fprintf(fp, "%*ssRGB override: %s\n", indent, "", values->srgb_override ? "true" : "false"); 234796c5ddc4Srjs fprintf(fp, "%*sSeamless Cube Map: %s\n", indent, "", values->seamless_cube_map ? "true" : "false"); 234896c5ddc4Srjs fprintf(fp, "%*sClamp integer coordinates: %s\n", indent, "", values->clamp_integer_coordinates ? "true" : "false"); 234996c5ddc4Srjs fprintf(fp, "%*sNormalized Coordinates: %s\n", indent, "", values->normalized_coordinates ? "true" : "false"); 235096c5ddc4Srjs fprintf(fp, "%*sClamp integer array indices: %s\n", indent, "", values->clamp_integer_array_indices ? "true" : "false"); 235196c5ddc4Srjs fprintf(fp, "%*sMinify nearest: %s\n", indent, "", values->minify_nearest ? "true" : "false"); 235296c5ddc4Srjs fprintf(fp, "%*sMagnify nearest: %s\n", indent, "", values->magnify_nearest ? "true" : "false"); 235396c5ddc4Srjs fprintf(fp, "%*sMagnify cutoff: %s\n", indent, "", values->magnify_cutoff ? "true" : "false"); 235496c5ddc4Srjs fprintf(fp, "%*sMipmap Mode: %s\n", indent, "", mali_mipmap_mode_as_str(values->mipmap_mode)); 235596c5ddc4Srjs fprintf(fp, "%*sMinimum LOD: %u\n", indent, "", values->minimum_lod); 235696c5ddc4Srjs fprintf(fp, "%*sCompare Function: %s\n", indent, "", mali_func_as_str(values->compare_function)); 235796c5ddc4Srjs fprintf(fp, "%*sMaximum LOD: %u\n", indent, "", values->maximum_lod); 235896c5ddc4Srjs fprintf(fp, "%*sLOD bias: %d\n", indent, "", values->lod_bias); 235996c5ddc4Srjs fprintf(fp, "%*sMaximum anisotropy: %u\n", indent, "", values->maximum_anisotropy); 236096c5ddc4Srjs fprintf(fp, "%*sLOD algorithm: %s\n", indent, "", mali_lod_algorithm_as_str(values->lod_algorithm)); 236196c5ddc4Srjs fprintf(fp, "%*sBorder Color R: 0x%X (%f)\n", indent, "", values->border_color_r, uif(values->border_color_r)); 236296c5ddc4Srjs fprintf(fp, "%*sBorder Color G: 0x%X (%f)\n", indent, "", values->border_color_g, uif(values->border_color_g)); 236396c5ddc4Srjs fprintf(fp, "%*sBorder Color B: 0x%X (%f)\n", indent, "", values->border_color_b, uif(values->border_color_b)); 236496c5ddc4Srjs fprintf(fp, "%*sBorder Color A: 0x%X (%f)\n", indent, "", values->border_color_a, uif(values->border_color_a)); 236596c5ddc4Srjs} 236696c5ddc4Srjs 236796c5ddc4Srjsstruct MALI_TEXTURE { 236896c5ddc4Srjs uint32_t type; 236996c5ddc4Srjs enum mali_texture_dimension dimension; 237096c5ddc4Srjs bool sample_corner_position; 237196c5ddc4Srjs bool normalize_coordinates; 237296c5ddc4Srjs uint32_t format; 237396c5ddc4Srjs uint32_t width; 237496c5ddc4Srjs uint32_t height; 237596c5ddc4Srjs uint32_t swizzle; 237696c5ddc4Srjs enum mali_texture_layout texel_ordering; 237796c5ddc4Srjs uint32_t levels; 237896c5ddc4Srjs uint32_t minimum_level; 237996c5ddc4Srjs uint32_t minimum_lod; 238096c5ddc4Srjs uint32_t sample_count; 238196c5ddc4Srjs uint32_t maximum_lod; 238296c5ddc4Srjs uint64_t surfaces; 238396c5ddc4Srjs uint32_t array_size; 238496c5ddc4Srjs uint32_t depth; 238596c5ddc4Srjs}; 238696c5ddc4Srjs 238796c5ddc4Srjs#define MALI_TEXTURE_header \ 238896c5ddc4Srjs .type = 2, \ 238996c5ddc4Srjs .sample_corner_position = false, \ 239096c5ddc4Srjs .normalize_coordinates = false, \ 239196c5ddc4Srjs .levels = 1, \ 239296c5ddc4Srjs .minimum_lod = 0, \ 239396c5ddc4Srjs .sample_count = 1, \ 239496c5ddc4Srjs .maximum_lod = 0, \ 239596c5ddc4Srjs .array_size = 1, \ 239696c5ddc4Srjs .depth = 1 239796c5ddc4Srjs 239896c5ddc4Srjsstatic inline void 239996c5ddc4SrjsMALI_TEXTURE_pack(uint32_t * restrict cl, 240096c5ddc4Srjs const struct MALI_TEXTURE * restrict values) 240196c5ddc4Srjs{ 240296c5ddc4Srjs assert(values->width >= 1); 240396c5ddc4Srjs assert(values->height >= 1); 240496c5ddc4Srjs assert(values->levels >= 1); 240596c5ddc4Srjs assert(util_is_power_of_two_nonzero(values->sample_count)); 240696c5ddc4Srjs assert(values->array_size >= 1); 240796c5ddc4Srjs assert(values->depth >= 1); 240896c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 3) | 240996c5ddc4Srjs __gen_uint(values->dimension, 4, 5) | 241096c5ddc4Srjs __gen_uint(values->sample_corner_position, 8, 8) | 241196c5ddc4Srjs __gen_uint(values->normalize_coordinates, 9, 9) | 241296c5ddc4Srjs __gen_uint(values->format, 10, 31); 241396c5ddc4Srjs cl[ 1] = __gen_uint(values->width - 1, 0, 15) | 241496c5ddc4Srjs __gen_uint(values->height - 1, 16, 31); 241596c5ddc4Srjs cl[ 2] = __gen_uint(values->swizzle, 0, 11) | 241696c5ddc4Srjs __gen_uint(values->texel_ordering, 12, 15) | 241796c5ddc4Srjs __gen_uint(values->levels - 1, 16, 20) | 241896c5ddc4Srjs __gen_uint(values->minimum_level, 24, 28); 241996c5ddc4Srjs cl[ 3] = __gen_uint(values->minimum_lod, 0, 12) | 242096c5ddc4Srjs __gen_uint(util_logbase2(values->sample_count), 13, 15) | 242196c5ddc4Srjs __gen_uint(values->maximum_lod, 16, 28); 242296c5ddc4Srjs cl[ 4] = __gen_uint(values->surfaces, 0, 63); 242396c5ddc4Srjs cl[ 5] = __gen_uint(values->surfaces, 0, 63) >> 32; 242496c5ddc4Srjs cl[ 6] = __gen_uint(values->array_size - 1, 0, 15); 242596c5ddc4Srjs cl[ 7] = __gen_uint(values->depth - 1, 0, 15); 242696c5ddc4Srjs} 242796c5ddc4Srjs 242896c5ddc4Srjs 242996c5ddc4Srjs#define MALI_TEXTURE_LENGTH 32 243096c5ddc4Srjs#define MALI_TEXTURE_ALIGN 32 243196c5ddc4Srjsstruct mali_texture_packed { uint32_t opaque[8]; }; 243296c5ddc4Srjsstatic inline void 243396c5ddc4SrjsMALI_TEXTURE_unpack(const uint8_t * restrict cl, 243496c5ddc4Srjs struct MALI_TEXTURE * restrict values) 243596c5ddc4Srjs{ 243696c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xc0) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 0\n"); 243796c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xe0e00000) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 2\n"); 243896c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xe0000000) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 3\n"); 243996c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffff0000) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 6\n"); 244096c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffff0000) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 7\n"); 244196c5ddc4Srjs values->type = __gen_unpack_uint(cl, 0, 3); 244296c5ddc4Srjs values->dimension = (enum mali_texture_dimension)__gen_unpack_uint(cl, 4, 5); 244396c5ddc4Srjs values->sample_corner_position = __gen_unpack_uint(cl, 8, 8); 244496c5ddc4Srjs values->normalize_coordinates = __gen_unpack_uint(cl, 9, 9); 244596c5ddc4Srjs values->format = __gen_unpack_uint(cl, 10, 31); 244696c5ddc4Srjs values->width = __gen_unpack_uint(cl, 32, 47) + 1; 244796c5ddc4Srjs values->height = __gen_unpack_uint(cl, 48, 63) + 1; 244896c5ddc4Srjs values->swizzle = __gen_unpack_uint(cl, 64, 75); 244996c5ddc4Srjs values->texel_ordering = (enum mali_texture_layout)__gen_unpack_uint(cl, 76, 79); 245096c5ddc4Srjs values->levels = __gen_unpack_uint(cl, 80, 84) + 1; 245196c5ddc4Srjs values->minimum_level = __gen_unpack_uint(cl, 88, 92); 245296c5ddc4Srjs values->minimum_lod = __gen_unpack_uint(cl, 96, 108); 245396c5ddc4Srjs values->sample_count = 1U << __gen_unpack_uint(cl, 109, 111); 245496c5ddc4Srjs values->maximum_lod = __gen_unpack_uint(cl, 112, 124); 245596c5ddc4Srjs values->surfaces = __gen_unpack_uint(cl, 128, 191); 245696c5ddc4Srjs values->array_size = __gen_unpack_uint(cl, 192, 207) + 1; 245796c5ddc4Srjs values->depth = __gen_unpack_uint(cl, 224, 239) + 1; 245896c5ddc4Srjs} 245996c5ddc4Srjs 246096c5ddc4Srjsstatic inline void 246196c5ddc4SrjsMALI_TEXTURE_print(FILE *fp, const struct MALI_TEXTURE * values, unsigned indent) 246296c5ddc4Srjs{ 246396c5ddc4Srjs fprintf(fp, "%*sType: %u\n", indent, "", values->type); 246496c5ddc4Srjs fprintf(fp, "%*sDimension: %s\n", indent, "", mali_texture_dimension_as_str(values->dimension)); 246596c5ddc4Srjs fprintf(fp, "%*sSample corner position: %s\n", indent, "", values->sample_corner_position ? "true" : "false"); 246696c5ddc4Srjs fprintf(fp, "%*sNormalize coordinates: %s\n", indent, "", values->normalize_coordinates ? "true" : "false"); 246796c5ddc4Srjs mali_pixel_format_print(fp, values->format); 246896c5ddc4Srjs fprintf(fp, "%*sWidth: %u\n", indent, "", values->width); 246996c5ddc4Srjs fprintf(fp, "%*sHeight: %u\n", indent, "", values->height); 247096c5ddc4Srjs fprintf(fp, "%*sSwizzle: %u\n", indent, "", values->swizzle); 247196c5ddc4Srjs fprintf(fp, "%*sTexel ordering: %s\n", indent, "", mali_texture_layout_as_str(values->texel_ordering)); 247296c5ddc4Srjs fprintf(fp, "%*sLevels: %u\n", indent, "", values->levels); 247396c5ddc4Srjs fprintf(fp, "%*sMinimum level: %u\n", indent, "", values->minimum_level); 247496c5ddc4Srjs fprintf(fp, "%*sMinimum LOD: %u\n", indent, "", values->minimum_lod); 247596c5ddc4Srjs fprintf(fp, "%*sSample count: %u\n", indent, "", values->sample_count); 247696c5ddc4Srjs fprintf(fp, "%*sMaximum LOD: %u\n", indent, "", values->maximum_lod); 247796c5ddc4Srjs fprintf(fp, "%*sSurfaces: 0x%" PRIx64 "\n", indent, "", values->surfaces); 247896c5ddc4Srjs fprintf(fp, "%*sArray size: %u\n", indent, "", values->array_size); 247996c5ddc4Srjs fprintf(fp, "%*sDepth: %u\n", indent, "", values->depth); 248096c5ddc4Srjs} 248196c5ddc4Srjs 248296c5ddc4Srjsenum mali_shader_register_allocation { 248396c5ddc4Srjs MALI_SHADER_REGISTER_ALLOCATION_64_PER_THREAD = 0, 248496c5ddc4Srjs MALI_SHADER_REGISTER_ALLOCATION_32_PER_THREAD = 2, 248596c5ddc4Srjs}; 248696c5ddc4Srjs 248796c5ddc4Srjsstatic inline const char * 248896c5ddc4Srjsmali_shader_register_allocation_as_str(enum mali_shader_register_allocation imm) 248996c5ddc4Srjs{ 249096c5ddc4Srjs switch (imm) { 249196c5ddc4Srjs case MALI_SHADER_REGISTER_ALLOCATION_64_PER_THREAD: return "64 Per Thread"; 249296c5ddc4Srjs case MALI_SHADER_REGISTER_ALLOCATION_32_PER_THREAD: return "32 Per Thread"; 249396c5ddc4Srjs default: return "XXX: INVALID"; 249496c5ddc4Srjs } 249596c5ddc4Srjs} 249696c5ddc4Srjs 249796c5ddc4Srjsstruct MALI_RENDERER_PROPERTIES { 249896c5ddc4Srjs uint32_t uniform_buffer_count; 249996c5ddc4Srjs enum mali_depth_source depth_source; 250096c5ddc4Srjs bool shader_contains_barrier; 250196c5ddc4Srjs enum mali_shader_register_allocation shader_register_allocation; 250296c5ddc4Srjs bool shader_modifies_coverage; 250396c5ddc4Srjs bool allow_forward_pixel_to_kill; 250496c5ddc4Srjs bool allow_forward_pixel_to_be_killed; 250596c5ddc4Srjs enum mali_pixel_kill pixel_kill_operation; 250696c5ddc4Srjs enum mali_pixel_kill zs_update_operation; 250796c5ddc4Srjs bool point_sprite_coord_origin_max_y; 250896c5ddc4Srjs bool stencil_from_shader; 250996c5ddc4Srjs}; 251096c5ddc4Srjs 251196c5ddc4Srjs#define MALI_RENDERER_PROPERTIES_header \ 251296c5ddc4Srjs .depth_source = MALI_DEPTH_SOURCE_MINIMUM 251396c5ddc4Srjs 251496c5ddc4Srjsstatic inline void 251596c5ddc4SrjsMALI_RENDERER_PROPERTIES_pack(uint32_t * restrict cl, 251696c5ddc4Srjs const struct MALI_RENDERER_PROPERTIES * restrict values) 251796c5ddc4Srjs{ 251896c5ddc4Srjs cl[ 0] = __gen_uint(values->uniform_buffer_count, 0, 7) | 251996c5ddc4Srjs __gen_uint(values->depth_source, 8, 9) | 252096c5ddc4Srjs __gen_uint(values->shader_contains_barrier, 11, 11) | 252196c5ddc4Srjs __gen_uint(values->shader_register_allocation, 12, 13) | 252296c5ddc4Srjs __gen_uint(values->shader_modifies_coverage, 16, 16) | 252396c5ddc4Srjs __gen_uint(values->allow_forward_pixel_to_kill, 19, 19) | 252496c5ddc4Srjs __gen_uint(values->allow_forward_pixel_to_be_killed, 20, 20) | 252596c5ddc4Srjs __gen_uint(values->pixel_kill_operation, 21, 22) | 252696c5ddc4Srjs __gen_uint(values->zs_update_operation, 23, 24) | 252796c5ddc4Srjs __gen_uint(values->point_sprite_coord_origin_max_y, 27, 27) | 252896c5ddc4Srjs __gen_uint(values->stencil_from_shader, 28, 28); 252996c5ddc4Srjs} 253096c5ddc4Srjs 253196c5ddc4Srjs 253296c5ddc4Srjs#define MALI_RENDERER_PROPERTIES_LENGTH 4 253396c5ddc4Srjsstruct mali_renderer_properties_packed { uint32_t opaque[1]; }; 253496c5ddc4Srjsstatic inline void 253596c5ddc4SrjsMALI_RENDERER_PROPERTIES_unpack(const uint8_t * restrict cl, 253696c5ddc4Srjs struct MALI_RENDERER_PROPERTIES * restrict values) 253796c5ddc4Srjs{ 253896c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xe606c400) fprintf(stderr, "XXX: Invalid field of Renderer Properties unpacked at word 0\n"); 253996c5ddc4Srjs values->uniform_buffer_count = __gen_unpack_uint(cl, 0, 7); 254096c5ddc4Srjs values->depth_source = (enum mali_depth_source)__gen_unpack_uint(cl, 8, 9); 254196c5ddc4Srjs values->shader_contains_barrier = __gen_unpack_uint(cl, 11, 11); 254296c5ddc4Srjs values->shader_register_allocation = (enum mali_shader_register_allocation)__gen_unpack_uint(cl, 12, 13); 254396c5ddc4Srjs values->shader_modifies_coverage = __gen_unpack_uint(cl, 16, 16); 254496c5ddc4Srjs values->allow_forward_pixel_to_kill = __gen_unpack_uint(cl, 19, 19); 254596c5ddc4Srjs values->allow_forward_pixel_to_be_killed = __gen_unpack_uint(cl, 20, 20); 254696c5ddc4Srjs values->pixel_kill_operation = (enum mali_pixel_kill)__gen_unpack_uint(cl, 21, 22); 254796c5ddc4Srjs values->zs_update_operation = (enum mali_pixel_kill)__gen_unpack_uint(cl, 23, 24); 254896c5ddc4Srjs values->point_sprite_coord_origin_max_y = __gen_unpack_uint(cl, 27, 27); 254996c5ddc4Srjs values->stencil_from_shader = __gen_unpack_uint(cl, 28, 28); 255096c5ddc4Srjs} 255196c5ddc4Srjs 255296c5ddc4Srjsstatic inline void 255396c5ddc4SrjsMALI_RENDERER_PROPERTIES_print(FILE *fp, const struct MALI_RENDERER_PROPERTIES * values, unsigned indent) 255496c5ddc4Srjs{ 255596c5ddc4Srjs fprintf(fp, "%*sUniform buffer count: %u\n", indent, "", values->uniform_buffer_count); 255696c5ddc4Srjs fprintf(fp, "%*sDepth source: %s\n", indent, "", mali_depth_source_as_str(values->depth_source)); 255796c5ddc4Srjs fprintf(fp, "%*sShader contains barrier: %s\n", indent, "", values->shader_contains_barrier ? "true" : "false"); 255896c5ddc4Srjs fprintf(fp, "%*sShader register allocation: %s\n", indent, "", mali_shader_register_allocation_as_str(values->shader_register_allocation)); 255996c5ddc4Srjs fprintf(fp, "%*sShader modifies coverage: %s\n", indent, "", values->shader_modifies_coverage ? "true" : "false"); 256096c5ddc4Srjs fprintf(fp, "%*sAllow forward pixel to kill: %s\n", indent, "", values->allow_forward_pixel_to_kill ? "true" : "false"); 256196c5ddc4Srjs fprintf(fp, "%*sAllow forward pixel to be killed: %s\n", indent, "", values->allow_forward_pixel_to_be_killed ? "true" : "false"); 256296c5ddc4Srjs fprintf(fp, "%*sPixel kill operation: %s\n", indent, "", mali_pixel_kill_as_str(values->pixel_kill_operation)); 256396c5ddc4Srjs fprintf(fp, "%*sZS update operation: %s\n", indent, "", mali_pixel_kill_as_str(values->zs_update_operation)); 256496c5ddc4Srjs fprintf(fp, "%*sPoint sprite coord origin max Y: %s\n", indent, "", values->point_sprite_coord_origin_max_y ? "true" : "false"); 256596c5ddc4Srjs fprintf(fp, "%*sStencil from shader: %s\n", indent, "", values->stencil_from_shader ? "true" : "false"); 256696c5ddc4Srjs} 256796c5ddc4Srjs 256896c5ddc4Srjsstruct MALI_COMPUTE_PRELOAD { 256996c5ddc4Srjs bool pc; 257096c5ddc4Srjs bool local_invocation_xy; 257196c5ddc4Srjs bool local_invocation_z; 257296c5ddc4Srjs bool work_group_x; 257396c5ddc4Srjs bool work_group_y; 257496c5ddc4Srjs bool work_group_z; 257596c5ddc4Srjs bool global_invocation_x; 257696c5ddc4Srjs bool global_invocation_y; 257796c5ddc4Srjs bool global_invocation_z; 257896c5ddc4Srjs}; 257996c5ddc4Srjs 258096c5ddc4Srjs#define MALI_COMPUTE_PRELOAD_header \ 258196c5ddc4Srjs 0 258296c5ddc4Srjs 258396c5ddc4Srjsstatic inline void 258496c5ddc4SrjsMALI_COMPUTE_PRELOAD_print(FILE *fp, const struct MALI_COMPUTE_PRELOAD * values, unsigned indent) 258596c5ddc4Srjs{ 258696c5ddc4Srjs fprintf(fp, "%*sPC: %s\n", indent, "", values->pc ? "true" : "false"); 258796c5ddc4Srjs fprintf(fp, "%*sLocal Invocation XY: %s\n", indent, "", values->local_invocation_xy ? "true" : "false"); 258896c5ddc4Srjs fprintf(fp, "%*sLocal Invocation Z: %s\n", indent, "", values->local_invocation_z ? "true" : "false"); 258996c5ddc4Srjs fprintf(fp, "%*sWork group X: %s\n", indent, "", values->work_group_x ? "true" : "false"); 259096c5ddc4Srjs fprintf(fp, "%*sWork group Y: %s\n", indent, "", values->work_group_y ? "true" : "false"); 259196c5ddc4Srjs fprintf(fp, "%*sWork group Z: %s\n", indent, "", values->work_group_z ? "true" : "false"); 259296c5ddc4Srjs fprintf(fp, "%*sGlobal Invocation X: %s\n", indent, "", values->global_invocation_x ? "true" : "false"); 259396c5ddc4Srjs fprintf(fp, "%*sGlobal Invocation Y: %s\n", indent, "", values->global_invocation_y ? "true" : "false"); 259496c5ddc4Srjs fprintf(fp, "%*sGlobal Invocation Z: %s\n", indent, "", values->global_invocation_z ? "true" : "false"); 259596c5ddc4Srjs} 259696c5ddc4Srjs 259796c5ddc4Srjsenum mali_warp_limit { 259896c5ddc4Srjs MALI_WARP_LIMIT_NONE = 0, 259996c5ddc4Srjs MALI_WARP_LIMIT_2 = 1, 260096c5ddc4Srjs MALI_WARP_LIMIT_4 = 2, 260196c5ddc4Srjs MALI_WARP_LIMIT_8 = 3, 260296c5ddc4Srjs}; 260396c5ddc4Srjs 260496c5ddc4Srjsstatic inline const char * 260596c5ddc4Srjsmali_warp_limit_as_str(enum mali_warp_limit imm) 260696c5ddc4Srjs{ 260796c5ddc4Srjs switch (imm) { 260896c5ddc4Srjs case MALI_WARP_LIMIT_NONE: return "None"; 260996c5ddc4Srjs case MALI_WARP_LIMIT_2: return "2"; 261096c5ddc4Srjs case MALI_WARP_LIMIT_4: return "4"; 261196c5ddc4Srjs case MALI_WARP_LIMIT_8: return "8"; 261296c5ddc4Srjs default: return "XXX: INVALID"; 261396c5ddc4Srjs } 261496c5ddc4Srjs} 261596c5ddc4Srjs 261696c5ddc4Srjsstruct MALI_VERTEX_PRELOAD { 261796c5ddc4Srjs enum mali_warp_limit warp_limit; 261896c5ddc4Srjs bool pc; 261996c5ddc4Srjs bool position_result_address_lo; 262096c5ddc4Srjs bool position_result_address_hi; 262196c5ddc4Srjs bool vertex_id; 262296c5ddc4Srjs bool instance_id; 262396c5ddc4Srjs}; 262496c5ddc4Srjs 262596c5ddc4Srjs#define MALI_VERTEX_PRELOAD_header \ 262696c5ddc4Srjs 0 262796c5ddc4Srjs 262896c5ddc4Srjsstatic inline void 262996c5ddc4SrjsMALI_VERTEX_PRELOAD_print(FILE *fp, const struct MALI_VERTEX_PRELOAD * values, unsigned indent) 263096c5ddc4Srjs{ 263196c5ddc4Srjs fprintf(fp, "%*sWarp limit: %s\n", indent, "", mali_warp_limit_as_str(values->warp_limit)); 263296c5ddc4Srjs fprintf(fp, "%*sPC: %s\n", indent, "", values->pc ? "true" : "false"); 263396c5ddc4Srjs fprintf(fp, "%*sPosition result address lo: %s\n", indent, "", values->position_result_address_lo ? "true" : "false"); 263496c5ddc4Srjs fprintf(fp, "%*sPosition result address hi: %s\n", indent, "", values->position_result_address_hi ? "true" : "false"); 263596c5ddc4Srjs fprintf(fp, "%*sVertex ID: %s\n", indent, "", values->vertex_id ? "true" : "false"); 263696c5ddc4Srjs fprintf(fp, "%*sInstance ID: %s\n", indent, "", values->instance_id ? "true" : "false"); 263796c5ddc4Srjs} 263896c5ddc4Srjs 263996c5ddc4Srjsstruct MALI_FRAGMENT_PRELOAD { 264096c5ddc4Srjs bool pc; 264196c5ddc4Srjs bool coverage; 264296c5ddc4Srjs bool primitive_id; 264396c5ddc4Srjs bool primitive_flags; 264496c5ddc4Srjs bool fragment_position; 264596c5ddc4Srjs bool sample_mask_id; 264696c5ddc4Srjs}; 264796c5ddc4Srjs 264896c5ddc4Srjs#define MALI_FRAGMENT_PRELOAD_header \ 264996c5ddc4Srjs 0 265096c5ddc4Srjs 265196c5ddc4Srjsstatic inline void 265296c5ddc4SrjsMALI_FRAGMENT_PRELOAD_print(FILE *fp, const struct MALI_FRAGMENT_PRELOAD * values, unsigned indent) 265396c5ddc4Srjs{ 265496c5ddc4Srjs fprintf(fp, "%*sPC: %s\n", indent, "", values->pc ? "true" : "false"); 265596c5ddc4Srjs fprintf(fp, "%*sCoverage: %s\n", indent, "", values->coverage ? "true" : "false"); 265696c5ddc4Srjs fprintf(fp, "%*sPrimitive ID: %s\n", indent, "", values->primitive_id ? "true" : "false"); 265796c5ddc4Srjs fprintf(fp, "%*sPrimitive flags: %s\n", indent, "", values->primitive_flags ? "true" : "false"); 265896c5ddc4Srjs fprintf(fp, "%*sFragment position: %s\n", indent, "", values->fragment_position ? "true" : "false"); 265996c5ddc4Srjs fprintf(fp, "%*sSample mask/ID: %s\n", indent, "", values->sample_mask_id ? "true" : "false"); 266096c5ddc4Srjs} 266196c5ddc4Srjs 266296c5ddc4Srjsstruct MALI_PRELOAD { 266396c5ddc4Srjs struct MALI_COMPUTE_PRELOAD compute; 266496c5ddc4Srjs struct MALI_VERTEX_PRELOAD vertex; 266596c5ddc4Srjs struct MALI_FRAGMENT_PRELOAD fragment; 266696c5ddc4Srjs uint32_t uniform_count; 266796c5ddc4Srjs}; 266896c5ddc4Srjs 266996c5ddc4Srjs#define MALI_PRELOAD_header \ 267096c5ddc4Srjs .compute = { MALI_COMPUTE_PRELOAD_header }, \ 267196c5ddc4Srjs .vertex = { MALI_VERTEX_PRELOAD_header }, \ 267296c5ddc4Srjs .fragment = { MALI_FRAGMENT_PRELOAD_header } 267396c5ddc4Srjs 267496c5ddc4Srjsstatic inline void 267596c5ddc4SrjsMALI_PRELOAD_pack(uint32_t * restrict cl, 267696c5ddc4Srjs const struct MALI_PRELOAD * restrict values) 267796c5ddc4Srjs{ 267896c5ddc4Srjs cl[ 0] = __gen_uint(values->compute.pc, 6, 6) | 267996c5ddc4Srjs __gen_uint(values->compute.local_invocation_xy, 7, 7) | 268096c5ddc4Srjs __gen_uint(values->compute.local_invocation_z, 8, 8) | 268196c5ddc4Srjs __gen_uint(values->compute.work_group_x, 9, 9) | 268296c5ddc4Srjs __gen_uint(values->compute.work_group_y, 10, 10) | 268396c5ddc4Srjs __gen_uint(values->compute.work_group_z, 11, 11) | 268496c5ddc4Srjs __gen_uint(values->compute.global_invocation_x, 12, 12) | 268596c5ddc4Srjs __gen_uint(values->compute.global_invocation_y, 13, 13) | 268696c5ddc4Srjs __gen_uint(values->compute.global_invocation_z, 14, 14) | 268796c5ddc4Srjs __gen_uint(values->vertex.warp_limit, 0, 1) | 268896c5ddc4Srjs __gen_uint(values->vertex.pc, 6, 6) | 268996c5ddc4Srjs __gen_uint(values->vertex.position_result_address_lo, 10, 10) | 269096c5ddc4Srjs __gen_uint(values->vertex.position_result_address_hi, 11, 11) | 269196c5ddc4Srjs __gen_uint(values->vertex.vertex_id, 13, 13) | 269296c5ddc4Srjs __gen_uint(values->vertex.instance_id, 14, 14) | 269396c5ddc4Srjs __gen_uint(values->fragment.pc, 6, 6) | 269496c5ddc4Srjs __gen_uint(values->fragment.coverage, 7, 7) | 269596c5ddc4Srjs __gen_uint(values->fragment.primitive_id, 9, 9) | 269696c5ddc4Srjs __gen_uint(values->fragment.primitive_flags, 10, 10) | 269796c5ddc4Srjs __gen_uint(values->fragment.fragment_position, 11, 11) | 269896c5ddc4Srjs __gen_uint(values->fragment.sample_mask_id, 13, 13) | 269996c5ddc4Srjs __gen_uint(values->uniform_count, 15, 21); 270096c5ddc4Srjs} 270196c5ddc4Srjs 270296c5ddc4Srjs 270396c5ddc4Srjs#define MALI_PRELOAD_LENGTH 4 270496c5ddc4Srjsstruct mali_preload_packed { uint32_t opaque[1]; }; 270596c5ddc4Srjsstatic inline void 270696c5ddc4SrjsMALI_PRELOAD_unpack(const uint8_t * restrict cl, 270796c5ddc4Srjs struct MALI_PRELOAD * restrict values) 270896c5ddc4Srjs{ 270996c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffc0003c) fprintf(stderr, "XXX: Invalid field of Preload unpacked at word 0\n"); 271096c5ddc4Srjs values->compute.pc = __gen_unpack_uint(cl, 6, 6); 271196c5ddc4Srjs values->compute.local_invocation_xy = __gen_unpack_uint(cl, 7, 7); 271296c5ddc4Srjs values->compute.local_invocation_z = __gen_unpack_uint(cl, 8, 8); 271396c5ddc4Srjs values->compute.work_group_x = __gen_unpack_uint(cl, 9, 9); 271496c5ddc4Srjs values->compute.work_group_y = __gen_unpack_uint(cl, 10, 10); 271596c5ddc4Srjs values->compute.work_group_z = __gen_unpack_uint(cl, 11, 11); 271696c5ddc4Srjs values->compute.global_invocation_x = __gen_unpack_uint(cl, 12, 12); 271796c5ddc4Srjs values->compute.global_invocation_y = __gen_unpack_uint(cl, 13, 13); 271896c5ddc4Srjs values->compute.global_invocation_z = __gen_unpack_uint(cl, 14, 14); 271996c5ddc4Srjs values->vertex.warp_limit = (enum mali_warp_limit)__gen_unpack_uint(cl, 0, 1); 272096c5ddc4Srjs values->vertex.pc = __gen_unpack_uint(cl, 6, 6); 272196c5ddc4Srjs values->vertex.position_result_address_lo = __gen_unpack_uint(cl, 10, 10); 272296c5ddc4Srjs values->vertex.position_result_address_hi = __gen_unpack_uint(cl, 11, 11); 272396c5ddc4Srjs values->vertex.vertex_id = __gen_unpack_uint(cl, 13, 13); 272496c5ddc4Srjs values->vertex.instance_id = __gen_unpack_uint(cl, 14, 14); 272596c5ddc4Srjs values->fragment.pc = __gen_unpack_uint(cl, 6, 6); 272696c5ddc4Srjs values->fragment.coverage = __gen_unpack_uint(cl, 7, 7); 272796c5ddc4Srjs values->fragment.primitive_id = __gen_unpack_uint(cl, 9, 9); 272896c5ddc4Srjs values->fragment.primitive_flags = __gen_unpack_uint(cl, 10, 10); 272996c5ddc4Srjs values->fragment.fragment_position = __gen_unpack_uint(cl, 11, 11); 273096c5ddc4Srjs values->fragment.sample_mask_id = __gen_unpack_uint(cl, 13, 13); 273196c5ddc4Srjs values->uniform_count = __gen_unpack_uint(cl, 15, 21); 273296c5ddc4Srjs} 273396c5ddc4Srjs 273496c5ddc4Srjsstatic inline void 273596c5ddc4SrjsMALI_PRELOAD_print(FILE *fp, const struct MALI_PRELOAD * values, unsigned indent) 273696c5ddc4Srjs{ 273796c5ddc4Srjs fprintf(fp, "%*sCompute:\n", indent, ""); 273896c5ddc4Srjs MALI_COMPUTE_PRELOAD_print(fp, &values->compute, indent + 2); 273996c5ddc4Srjs fprintf(fp, "%*sVertex:\n", indent, ""); 274096c5ddc4Srjs MALI_VERTEX_PRELOAD_print(fp, &values->vertex, indent + 2); 274196c5ddc4Srjs fprintf(fp, "%*sFragment:\n", indent, ""); 274296c5ddc4Srjs MALI_FRAGMENT_PRELOAD_print(fp, &values->fragment, indent + 2); 274396c5ddc4Srjs fprintf(fp, "%*sUniform count: %u\n", indent, "", values->uniform_count); 274496c5ddc4Srjs} 274596c5ddc4Srjs 274696c5ddc4Srjsstruct MALI_SHADER { 274796c5ddc4Srjs uint64_t shader; 274896c5ddc4Srjs uint32_t sampler_count; 274996c5ddc4Srjs uint32_t texture_count; 275096c5ddc4Srjs uint32_t attribute_count; 275196c5ddc4Srjs uint32_t varying_count; 275296c5ddc4Srjs}; 275396c5ddc4Srjs 275496c5ddc4Srjs#define MALI_SHADER_header \ 275596c5ddc4Srjs 0 275696c5ddc4Srjs 275796c5ddc4Srjsstatic inline void 275896c5ddc4SrjsMALI_SHADER_pack(uint32_t * restrict cl, 275996c5ddc4Srjs const struct MALI_SHADER * restrict values) 276096c5ddc4Srjs{ 276196c5ddc4Srjs cl[ 0] = __gen_uint(values->shader, 0, 63); 276296c5ddc4Srjs cl[ 1] = __gen_uint(values->shader, 0, 63) >> 32; 276396c5ddc4Srjs cl[ 2] = __gen_uint(values->sampler_count, 0, 15) | 276496c5ddc4Srjs __gen_uint(values->texture_count, 16, 31); 276596c5ddc4Srjs cl[ 3] = __gen_uint(values->attribute_count, 0, 15) | 276696c5ddc4Srjs __gen_uint(values->varying_count, 16, 31); 276796c5ddc4Srjs} 276896c5ddc4Srjs 276996c5ddc4Srjs 277096c5ddc4Srjs#define MALI_SHADER_LENGTH 16 277196c5ddc4Srjsstruct mali_shader_packed { uint32_t opaque[4]; }; 277296c5ddc4Srjsstatic inline void 277396c5ddc4SrjsMALI_SHADER_unpack(const uint8_t * restrict cl, 277496c5ddc4Srjs struct MALI_SHADER * restrict values) 277596c5ddc4Srjs{ 277696c5ddc4Srjs values->shader = __gen_unpack_uint(cl, 0, 63); 277796c5ddc4Srjs values->sampler_count = __gen_unpack_uint(cl, 64, 79); 277896c5ddc4Srjs values->texture_count = __gen_unpack_uint(cl, 80, 95); 277996c5ddc4Srjs values->attribute_count = __gen_unpack_uint(cl, 96, 111); 278096c5ddc4Srjs values->varying_count = __gen_unpack_uint(cl, 112, 127); 278196c5ddc4Srjs} 278296c5ddc4Srjs 278396c5ddc4Srjsstatic inline void 278496c5ddc4SrjsMALI_SHADER_print(FILE *fp, const struct MALI_SHADER * values, unsigned indent) 278596c5ddc4Srjs{ 278696c5ddc4Srjs fprintf(fp, "%*sShader: 0x%" PRIx64 "\n", indent, "", values->shader); 278796c5ddc4Srjs fprintf(fp, "%*sSampler count: %u\n", indent, "", values->sampler_count); 278896c5ddc4Srjs fprintf(fp, "%*sTexture count: %u\n", indent, "", values->texture_count); 278996c5ddc4Srjs fprintf(fp, "%*sAttribute count: %u\n", indent, "", values->attribute_count); 279096c5ddc4Srjs fprintf(fp, "%*sVarying count: %u\n", indent, "", values->varying_count); 279196c5ddc4Srjs} 279296c5ddc4Srjs 279396c5ddc4Srjsstruct MALI_MULTISAMPLE_MISC { 279496c5ddc4Srjs uint32_t sample_mask; 279596c5ddc4Srjs bool multisample_enable; 279696c5ddc4Srjs bool multisample_late_coverage; 279796c5ddc4Srjs bool evaluate_per_sample; 279896c5ddc4Srjs bool fixed_function_depth_range_fixed; 279996c5ddc4Srjs bool shader_depth_range_fixed; 280096c5ddc4Srjs bool overdraw_alpha1; 280196c5ddc4Srjs bool overdraw_alpha0; 280296c5ddc4Srjs enum mali_func depth_function; 280396c5ddc4Srjs bool depth_write_mask; 280496c5ddc4Srjs bool fixed_function_near_discard; 280596c5ddc4Srjs bool fixed_function_far_discard; 280696c5ddc4Srjs bool fragment_near_discard; 280796c5ddc4Srjs bool fragment_far_discard; 280896c5ddc4Srjs}; 280996c5ddc4Srjs 281096c5ddc4Srjs#define MALI_MULTISAMPLE_MISC_header \ 281196c5ddc4Srjs 0 281296c5ddc4Srjs 281396c5ddc4Srjsstatic inline void 281496c5ddc4SrjsMALI_MULTISAMPLE_MISC_pack(uint32_t * restrict cl, 281596c5ddc4Srjs const struct MALI_MULTISAMPLE_MISC * restrict values) 281696c5ddc4Srjs{ 281796c5ddc4Srjs cl[ 0] = __gen_uint(values->sample_mask, 0, 15) | 281896c5ddc4Srjs __gen_uint(values->multisample_enable, 16, 16) | 281996c5ddc4Srjs __gen_uint(values->multisample_late_coverage, 17, 17) | 282096c5ddc4Srjs __gen_uint(values->evaluate_per_sample, 18, 18) | 282196c5ddc4Srjs __gen_uint(values->fixed_function_depth_range_fixed, 19, 19) | 282296c5ddc4Srjs __gen_uint(values->shader_depth_range_fixed, 20, 20) | 282396c5ddc4Srjs __gen_uint(values->overdraw_alpha1, 22, 22) | 282496c5ddc4Srjs __gen_uint(values->overdraw_alpha0, 23, 23) | 282596c5ddc4Srjs __gen_uint(values->depth_function, 24, 26) | 282696c5ddc4Srjs __gen_uint(values->depth_write_mask, 27, 27) | 282796c5ddc4Srjs __gen_uint(values->fixed_function_near_discard, 28, 28) | 282896c5ddc4Srjs __gen_uint(values->fixed_function_far_discard, 29, 29) | 282996c5ddc4Srjs __gen_uint(values->fragment_near_discard, 30, 30) | 283096c5ddc4Srjs __gen_uint(values->fragment_far_discard, 31, 31); 283196c5ddc4Srjs} 283296c5ddc4Srjs 283396c5ddc4Srjs 283496c5ddc4Srjs#define MALI_MULTISAMPLE_MISC_LENGTH 4 283596c5ddc4Srjsstruct mali_multisample_misc_packed { uint32_t opaque[1]; }; 283696c5ddc4Srjsstatic inline void 283796c5ddc4SrjsMALI_MULTISAMPLE_MISC_unpack(const uint8_t * restrict cl, 283896c5ddc4Srjs struct MALI_MULTISAMPLE_MISC * restrict values) 283996c5ddc4Srjs{ 284096c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0x200000) fprintf(stderr, "XXX: Invalid field of Multisample, Misc unpacked at word 0\n"); 284196c5ddc4Srjs values->sample_mask = __gen_unpack_uint(cl, 0, 15); 284296c5ddc4Srjs values->multisample_enable = __gen_unpack_uint(cl, 16, 16); 284396c5ddc4Srjs values->multisample_late_coverage = __gen_unpack_uint(cl, 17, 17); 284496c5ddc4Srjs values->evaluate_per_sample = __gen_unpack_uint(cl, 18, 18); 284596c5ddc4Srjs values->fixed_function_depth_range_fixed = __gen_unpack_uint(cl, 19, 19); 284696c5ddc4Srjs values->shader_depth_range_fixed = __gen_unpack_uint(cl, 20, 20); 284796c5ddc4Srjs values->overdraw_alpha1 = __gen_unpack_uint(cl, 22, 22); 284896c5ddc4Srjs values->overdraw_alpha0 = __gen_unpack_uint(cl, 23, 23); 284996c5ddc4Srjs values->depth_function = (enum mali_func)__gen_unpack_uint(cl, 24, 26); 285096c5ddc4Srjs values->depth_write_mask = __gen_unpack_uint(cl, 27, 27); 285196c5ddc4Srjs values->fixed_function_near_discard = __gen_unpack_uint(cl, 28, 28); 285296c5ddc4Srjs values->fixed_function_far_discard = __gen_unpack_uint(cl, 29, 29); 285396c5ddc4Srjs values->fragment_near_discard = __gen_unpack_uint(cl, 30, 30); 285496c5ddc4Srjs values->fragment_far_discard = __gen_unpack_uint(cl, 31, 31); 285596c5ddc4Srjs} 285696c5ddc4Srjs 285796c5ddc4Srjsstatic inline void 285896c5ddc4SrjsMALI_MULTISAMPLE_MISC_print(FILE *fp, const struct MALI_MULTISAMPLE_MISC * values, unsigned indent) 285996c5ddc4Srjs{ 286096c5ddc4Srjs fprintf(fp, "%*sSample mask: %u\n", indent, "", values->sample_mask); 286196c5ddc4Srjs fprintf(fp, "%*sMultisample enable: %s\n", indent, "", values->multisample_enable ? "true" : "false"); 286296c5ddc4Srjs fprintf(fp, "%*sMultisample late coverage: %s\n", indent, "", values->multisample_late_coverage ? "true" : "false"); 286396c5ddc4Srjs fprintf(fp, "%*sEvaluate per-sample: %s\n", indent, "", values->evaluate_per_sample ? "true" : "false"); 286496c5ddc4Srjs fprintf(fp, "%*sFixed-function depth range fixed: %s\n", indent, "", values->fixed_function_depth_range_fixed ? "true" : "false"); 286596c5ddc4Srjs fprintf(fp, "%*sShader depth range fixed: %s\n", indent, "", values->shader_depth_range_fixed ? "true" : "false"); 286696c5ddc4Srjs fprintf(fp, "%*sOverdraw alpha1: %s\n", indent, "", values->overdraw_alpha1 ? "true" : "false"); 286796c5ddc4Srjs fprintf(fp, "%*sOverdraw alpha0: %s\n", indent, "", values->overdraw_alpha0 ? "true" : "false"); 286896c5ddc4Srjs fprintf(fp, "%*sDepth function: %s\n", indent, "", mali_func_as_str(values->depth_function)); 286996c5ddc4Srjs fprintf(fp, "%*sDepth write mask: %s\n", indent, "", values->depth_write_mask ? "true" : "false"); 287096c5ddc4Srjs fprintf(fp, "%*sFixed-function near discard: %s\n", indent, "", values->fixed_function_near_discard ? "true" : "false"); 287196c5ddc4Srjs fprintf(fp, "%*sFixed-function far discard: %s\n", indent, "", values->fixed_function_far_discard ? "true" : "false"); 287296c5ddc4Srjs fprintf(fp, "%*sFragment near discard: %s\n", indent, "", values->fragment_near_discard ? "true" : "false"); 287396c5ddc4Srjs fprintf(fp, "%*sFragment far discard: %s\n", indent, "", values->fragment_far_discard ? "true" : "false"); 287496c5ddc4Srjs} 287596c5ddc4Srjs 287696c5ddc4Srjsstruct MALI_STENCIL_MASK_MISC { 287796c5ddc4Srjs uint32_t stencil_mask_front; 287896c5ddc4Srjs uint32_t stencil_mask_back; 287996c5ddc4Srjs bool stencil_enable; 288096c5ddc4Srjs bool alpha_to_coverage; 288196c5ddc4Srjs bool alpha_to_coverage_invert; 288296c5ddc4Srjs enum mali_func alpha_test_compare_function; 288396c5ddc4Srjs bool force_seamless_cubemaps; 288496c5ddc4Srjs bool depth_range_1; 288596c5ddc4Srjs bool depth_range_2; 288696c5ddc4Srjs bool single_sampled_lines; 288796c5ddc4Srjs bool point_snap; 288896c5ddc4Srjs}; 288996c5ddc4Srjs 289096c5ddc4Srjs#define MALI_STENCIL_MASK_MISC_header \ 289196c5ddc4Srjs 0 289296c5ddc4Srjs 289396c5ddc4Srjsstatic inline void 289496c5ddc4SrjsMALI_STENCIL_MASK_MISC_pack(uint32_t * restrict cl, 289596c5ddc4Srjs const struct MALI_STENCIL_MASK_MISC * restrict values) 289696c5ddc4Srjs{ 289796c5ddc4Srjs cl[ 0] = __gen_uint(values->stencil_mask_front, 0, 7) | 289896c5ddc4Srjs __gen_uint(values->stencil_mask_back, 8, 15) | 289996c5ddc4Srjs __gen_uint(values->stencil_enable, 16, 16) | 290096c5ddc4Srjs __gen_uint(values->alpha_to_coverage, 17, 17) | 290196c5ddc4Srjs __gen_uint(values->alpha_to_coverage_invert, 18, 18) | 290296c5ddc4Srjs __gen_uint(values->alpha_test_compare_function, 21, 23) | 290396c5ddc4Srjs __gen_uint(values->force_seamless_cubemaps, 26, 26) | 290496c5ddc4Srjs __gen_uint(values->depth_range_1, 28, 28) | 290596c5ddc4Srjs __gen_uint(values->depth_range_2, 29, 29) | 290696c5ddc4Srjs __gen_uint(values->single_sampled_lines, 30, 30) | 290796c5ddc4Srjs __gen_uint(values->point_snap, 31, 31); 290896c5ddc4Srjs} 290996c5ddc4Srjs 291096c5ddc4Srjs 291196c5ddc4Srjs#define MALI_STENCIL_MASK_MISC_LENGTH 4 291296c5ddc4Srjsstruct mali_stencil_mask_misc_packed { uint32_t opaque[1]; }; 291396c5ddc4Srjsstatic inline void 291496c5ddc4SrjsMALI_STENCIL_MASK_MISC_unpack(const uint8_t * restrict cl, 291596c5ddc4Srjs struct MALI_STENCIL_MASK_MISC * restrict values) 291696c5ddc4Srjs{ 291796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xb180000) fprintf(stderr, "XXX: Invalid field of Stencil Mask, Misc unpacked at word 0\n"); 291896c5ddc4Srjs values->stencil_mask_front = __gen_unpack_uint(cl, 0, 7); 291996c5ddc4Srjs values->stencil_mask_back = __gen_unpack_uint(cl, 8, 15); 292096c5ddc4Srjs values->stencil_enable = __gen_unpack_uint(cl, 16, 16); 292196c5ddc4Srjs values->alpha_to_coverage = __gen_unpack_uint(cl, 17, 17); 292296c5ddc4Srjs values->alpha_to_coverage_invert = __gen_unpack_uint(cl, 18, 18); 292396c5ddc4Srjs values->alpha_test_compare_function = (enum mali_func)__gen_unpack_uint(cl, 21, 23); 292496c5ddc4Srjs values->force_seamless_cubemaps = __gen_unpack_uint(cl, 26, 26); 292596c5ddc4Srjs values->depth_range_1 = __gen_unpack_uint(cl, 28, 28); 292696c5ddc4Srjs values->depth_range_2 = __gen_unpack_uint(cl, 29, 29); 292796c5ddc4Srjs values->single_sampled_lines = __gen_unpack_uint(cl, 30, 30); 292896c5ddc4Srjs values->point_snap = __gen_unpack_uint(cl, 31, 31); 292996c5ddc4Srjs} 293096c5ddc4Srjs 293196c5ddc4Srjsstatic inline void 293296c5ddc4SrjsMALI_STENCIL_MASK_MISC_print(FILE *fp, const struct MALI_STENCIL_MASK_MISC * values, unsigned indent) 293396c5ddc4Srjs{ 293496c5ddc4Srjs fprintf(fp, "%*sStencil mask front: %u\n", indent, "", values->stencil_mask_front); 293596c5ddc4Srjs fprintf(fp, "%*sStencil mask back: %u\n", indent, "", values->stencil_mask_back); 293696c5ddc4Srjs fprintf(fp, "%*sStencil enable: %s\n", indent, "", values->stencil_enable ? "true" : "false"); 293796c5ddc4Srjs fprintf(fp, "%*sAlpha-to-coverage: %s\n", indent, "", values->alpha_to_coverage ? "true" : "false"); 293896c5ddc4Srjs fprintf(fp, "%*sAlpha-to-coverage Invert: %s\n", indent, "", values->alpha_to_coverage_invert ? "true" : "false"); 293996c5ddc4Srjs fprintf(fp, "%*sAlpha test compare function: %s\n", indent, "", mali_func_as_str(values->alpha_test_compare_function)); 294096c5ddc4Srjs fprintf(fp, "%*sForce seamless cubemaps: %s\n", indent, "", values->force_seamless_cubemaps ? "true" : "false"); 294196c5ddc4Srjs fprintf(fp, "%*sDepth Range 1: %s\n", indent, "", values->depth_range_1 ? "true" : "false"); 294296c5ddc4Srjs fprintf(fp, "%*sDepth Range 2: %s\n", indent, "", values->depth_range_2 ? "true" : "false"); 294396c5ddc4Srjs fprintf(fp, "%*sSingle-sampled lines: %s\n", indent, "", values->single_sampled_lines ? "true" : "false"); 294496c5ddc4Srjs fprintf(fp, "%*sPoint snap: %s\n", indent, "", values->point_snap ? "true" : "false"); 294596c5ddc4Srjs} 294696c5ddc4Srjs 294796c5ddc4Srjsstruct MALI_STENCIL { 294896c5ddc4Srjs uint32_t reference_value; 294996c5ddc4Srjs uint32_t mask; 295096c5ddc4Srjs enum mali_func compare_function; 295196c5ddc4Srjs enum mali_stencil_op stencil_fail; 295296c5ddc4Srjs enum mali_stencil_op depth_fail; 295396c5ddc4Srjs enum mali_stencil_op depth_pass; 295496c5ddc4Srjs}; 295596c5ddc4Srjs 295696c5ddc4Srjs#define MALI_STENCIL_header \ 295796c5ddc4Srjs 0 295896c5ddc4Srjs 295996c5ddc4Srjsstatic inline void 296096c5ddc4SrjsMALI_STENCIL_pack(uint32_t * restrict cl, 296196c5ddc4Srjs const struct MALI_STENCIL * restrict values) 296296c5ddc4Srjs{ 296396c5ddc4Srjs cl[ 0] = __gen_uint(values->reference_value, 0, 7) | 296496c5ddc4Srjs __gen_uint(values->mask, 8, 15) | 296596c5ddc4Srjs __gen_uint(values->compare_function, 16, 18) | 296696c5ddc4Srjs __gen_uint(values->stencil_fail, 19, 21) | 296796c5ddc4Srjs __gen_uint(values->depth_fail, 22, 24) | 296896c5ddc4Srjs __gen_uint(values->depth_pass, 25, 27); 296996c5ddc4Srjs} 297096c5ddc4Srjs 297196c5ddc4Srjs 297296c5ddc4Srjs#define MALI_STENCIL_LENGTH 4 297396c5ddc4Srjsstruct mali_stencil_packed { uint32_t opaque[1]; }; 297496c5ddc4Srjsstatic inline void 297596c5ddc4SrjsMALI_STENCIL_unpack(const uint8_t * restrict cl, 297696c5ddc4Srjs struct MALI_STENCIL * restrict values) 297796c5ddc4Srjs{ 297896c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf0000000) fprintf(stderr, "XXX: Invalid field of Stencil unpacked at word 0\n"); 297996c5ddc4Srjs values->reference_value = __gen_unpack_uint(cl, 0, 7); 298096c5ddc4Srjs values->mask = __gen_unpack_uint(cl, 8, 15); 298196c5ddc4Srjs values->compare_function = (enum mali_func)__gen_unpack_uint(cl, 16, 18); 298296c5ddc4Srjs values->stencil_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 19, 21); 298396c5ddc4Srjs values->depth_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 22, 24); 298496c5ddc4Srjs values->depth_pass = (enum mali_stencil_op)__gen_unpack_uint(cl, 25, 27); 298596c5ddc4Srjs} 298696c5ddc4Srjs 298796c5ddc4Srjsstatic inline void 298896c5ddc4SrjsMALI_STENCIL_print(FILE *fp, const struct MALI_STENCIL * values, unsigned indent) 298996c5ddc4Srjs{ 299096c5ddc4Srjs fprintf(fp, "%*sReference Value: %u\n", indent, "", values->reference_value); 299196c5ddc4Srjs fprintf(fp, "%*sMask: %u\n", indent, "", values->mask); 299296c5ddc4Srjs fprintf(fp, "%*sCompare Function: %s\n", indent, "", mali_func_as_str(values->compare_function)); 299396c5ddc4Srjs fprintf(fp, "%*sStencil Fail: %s\n", indent, "", mali_stencil_op_as_str(values->stencil_fail)); 299496c5ddc4Srjs fprintf(fp, "%*sDepth Fail: %s\n", indent, "", mali_stencil_op_as_str(values->depth_fail)); 299596c5ddc4Srjs fprintf(fp, "%*sDepth Pass: %s\n", indent, "", mali_stencil_op_as_str(values->depth_pass)); 299696c5ddc4Srjs} 299796c5ddc4Srjs 299896c5ddc4Srjsstruct MALI_LD_VAR_PRELOAD { 299996c5ddc4Srjs uint32_t varying_index; 300096c5ddc4Srjs enum mali_message_preload_register_format register_format; 300196c5ddc4Srjs uint32_t num_components; 300296c5ddc4Srjs}; 300396c5ddc4Srjs 300496c5ddc4Srjs#define MALI_LD_VAR_PRELOAD_header \ 300596c5ddc4Srjs .num_components = 1 300696c5ddc4Srjs 300796c5ddc4Srjsstatic inline void 300896c5ddc4SrjsMALI_LD_VAR_PRELOAD_print(FILE *fp, const struct MALI_LD_VAR_PRELOAD * values, unsigned indent) 300996c5ddc4Srjs{ 301096c5ddc4Srjs fprintf(fp, "%*sVarying Index: %u\n", indent, "", values->varying_index); 301196c5ddc4Srjs fprintf(fp, "%*sRegister Format: %s\n", indent, "", mali_message_preload_register_format_as_str(values->register_format)); 301296c5ddc4Srjs fprintf(fp, "%*sNum Components: %u\n", indent, "", values->num_components); 301396c5ddc4Srjs} 301496c5ddc4Srjs 301596c5ddc4Srjsstruct MALI_VAR_TEX_PRELOAD { 301696c5ddc4Srjs uint32_t varying_index; 301796c5ddc4Srjs uint32_t sampler_index; 301896c5ddc4Srjs enum mali_message_preload_register_format register_format; 301996c5ddc4Srjs bool skip; 302096c5ddc4Srjs bool zero_lod; 302196c5ddc4Srjs}; 302296c5ddc4Srjs 302396c5ddc4Srjs#define MALI_VAR_TEX_PRELOAD_header \ 302496c5ddc4Srjs 0 302596c5ddc4Srjs 302696c5ddc4Srjsstatic inline void 302796c5ddc4SrjsMALI_VAR_TEX_PRELOAD_print(FILE *fp, const struct MALI_VAR_TEX_PRELOAD * values, unsigned indent) 302896c5ddc4Srjs{ 302996c5ddc4Srjs fprintf(fp, "%*sVarying Index: %u\n", indent, "", values->varying_index); 303096c5ddc4Srjs fprintf(fp, "%*sSampler Index: %u\n", indent, "", values->sampler_index); 303196c5ddc4Srjs fprintf(fp, "%*sRegister Format: %s\n", indent, "", mali_message_preload_register_format_as_str(values->register_format)); 303296c5ddc4Srjs fprintf(fp, "%*sSkip: %s\n", indent, "", values->skip ? "true" : "false"); 303396c5ddc4Srjs fprintf(fp, "%*sZero LOD: %s\n", indent, "", values->zero_lod ? "true" : "false"); 303496c5ddc4Srjs} 303596c5ddc4Srjs 303696c5ddc4Srjsstruct MALI_MESSAGE_PRELOAD { 303796c5ddc4Srjs enum mali_message_type type; 303896c5ddc4Srjs struct MALI_LD_VAR_PRELOAD ld_var; 303996c5ddc4Srjs struct MALI_VAR_TEX_PRELOAD var_tex; 304096c5ddc4Srjs}; 304196c5ddc4Srjs 304296c5ddc4Srjs#define MALI_MESSAGE_PRELOAD_header \ 304396c5ddc4Srjs .ld_var = { MALI_LD_VAR_PRELOAD_header }, \ 304496c5ddc4Srjs .var_tex = { MALI_VAR_TEX_PRELOAD_header } 304596c5ddc4Srjs 304696c5ddc4Srjsstatic inline void 304796c5ddc4SrjsMALI_MESSAGE_PRELOAD_pack(uint32_t * restrict cl, 304896c5ddc4Srjs const struct MALI_MESSAGE_PRELOAD * restrict values) 304996c5ddc4Srjs{ 305096c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 3) | 305196c5ddc4Srjs __gen_uint(values->ld_var.varying_index, 4, 8) | 305296c5ddc4Srjs __gen_uint(values->ld_var.register_format, 9, 10) | 305396c5ddc4Srjs __gen_uint(values->ld_var.num_components - 1, 11, 12) | 305496c5ddc4Srjs __gen_uint(values->var_tex.varying_index, 4, 6) | 305596c5ddc4Srjs __gen_uint(values->var_tex.sampler_index, 7, 8) | 305696c5ddc4Srjs __gen_uint(values->var_tex.register_format, 9, 10) | 305796c5ddc4Srjs __gen_uint(values->var_tex.skip, 14, 14) | 305896c5ddc4Srjs __gen_uint(values->var_tex.zero_lod, 15, 15); 305996c5ddc4Srjs} 306096c5ddc4Srjs 306196c5ddc4Srjs 306296c5ddc4Srjs#define MALI_MESSAGE_PRELOAD_LENGTH 4 306396c5ddc4Srjsstruct mali_message_preload_packed { uint32_t opaque[1]; }; 306496c5ddc4Srjsstatic inline void 306596c5ddc4SrjsMALI_MESSAGE_PRELOAD_unpack(const uint8_t * restrict cl, 306696c5ddc4Srjs struct MALI_MESSAGE_PRELOAD * restrict values) 306796c5ddc4Srjs{ 306896c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffff2000) fprintf(stderr, "XXX: Invalid field of Message Preload unpacked at word 0\n"); 306996c5ddc4Srjs values->type = (enum mali_message_type)__gen_unpack_uint(cl, 0, 3); 307096c5ddc4Srjs values->ld_var.varying_index = __gen_unpack_uint(cl, 4, 8); 307196c5ddc4Srjs values->ld_var.register_format = (enum mali_message_preload_register_format)__gen_unpack_uint(cl, 9, 10); 307296c5ddc4Srjs values->ld_var.num_components = __gen_unpack_uint(cl, 11, 12) + 1; 307396c5ddc4Srjs values->var_tex.varying_index = __gen_unpack_uint(cl, 4, 6); 307496c5ddc4Srjs values->var_tex.sampler_index = __gen_unpack_uint(cl, 7, 8); 307596c5ddc4Srjs values->var_tex.register_format = (enum mali_message_preload_register_format)__gen_unpack_uint(cl, 9, 10); 307696c5ddc4Srjs values->var_tex.skip = __gen_unpack_uint(cl, 14, 14); 307796c5ddc4Srjs values->var_tex.zero_lod = __gen_unpack_uint(cl, 15, 15); 307896c5ddc4Srjs} 307996c5ddc4Srjs 308096c5ddc4Srjsstatic inline void 308196c5ddc4SrjsMALI_MESSAGE_PRELOAD_print(FILE *fp, const struct MALI_MESSAGE_PRELOAD * values, unsigned indent) 308296c5ddc4Srjs{ 308396c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_message_type_as_str(values->type)); 308496c5ddc4Srjs fprintf(fp, "%*sLD_VAR:\n", indent, ""); 308596c5ddc4Srjs MALI_LD_VAR_PRELOAD_print(fp, &values->ld_var, indent + 2); 308696c5ddc4Srjs fprintf(fp, "%*sVAR_TEX:\n", indent, ""); 308796c5ddc4Srjs MALI_VAR_TEX_PRELOAD_print(fp, &values->var_tex, indent + 2); 308896c5ddc4Srjs} 308996c5ddc4Srjs 309096c5ddc4Srjsstruct MALI_RENDERER_STATE { 309196c5ddc4Srjs struct MALI_SHADER shader; 309296c5ddc4Srjs struct MALI_RENDERER_PROPERTIES properties; 309396c5ddc4Srjs float depth_units; 309496c5ddc4Srjs float depth_factor; 309596c5ddc4Srjs float depth_bias_clamp; 309696c5ddc4Srjs struct MALI_MULTISAMPLE_MISC multisample_misc; 309796c5ddc4Srjs struct MALI_STENCIL_MASK_MISC stencil_mask_misc; 309896c5ddc4Srjs struct MALI_STENCIL stencil_front; 309996c5ddc4Srjs struct MALI_STENCIL stencil_back; 310096c5ddc4Srjs struct MALI_PRELOAD preload; 310196c5ddc4Srjs float alpha_reference; 310296c5ddc4Srjs uint32_t thread_balancing; 310396c5ddc4Srjs struct MALI_PRELOAD secondary_preload; 310496c5ddc4Srjs uint64_t secondary_shader; 310596c5ddc4Srjs}; 310696c5ddc4Srjs 310796c5ddc4Srjs#define MALI_RENDERER_STATE_header \ 310896c5ddc4Srjs .shader = { MALI_SHADER_header }, \ 310996c5ddc4Srjs .properties = { MALI_RENDERER_PROPERTIES_header }, \ 311096c5ddc4Srjs .multisample_misc = { MALI_MULTISAMPLE_MISC_header }, \ 311196c5ddc4Srjs .stencil_mask_misc = { MALI_STENCIL_MASK_MISC_header }, \ 311296c5ddc4Srjs .stencil_front = { MALI_STENCIL_header }, \ 311396c5ddc4Srjs .stencil_back = { MALI_STENCIL_header }, \ 311496c5ddc4Srjs .preload = { MALI_PRELOAD_header }, \ 311596c5ddc4Srjs .secondary_preload = { MALI_PRELOAD_header } 311696c5ddc4Srjs 311796c5ddc4Srjsstatic inline void 311896c5ddc4SrjsMALI_RENDERER_STATE_pack(uint32_t * restrict cl, 311996c5ddc4Srjs const struct MALI_RENDERER_STATE * restrict values) 312096c5ddc4Srjs{ 312196c5ddc4Srjs cl[ 0] = __gen_uint(values->shader.shader, 0, 63); 312296c5ddc4Srjs cl[ 1] = __gen_uint(values->shader.shader, 0, 63) >> 32; 312396c5ddc4Srjs cl[ 2] = __gen_uint(values->shader.sampler_count, 0, 15) | 312496c5ddc4Srjs __gen_uint(values->shader.texture_count, 16, 31); 312596c5ddc4Srjs cl[ 3] = __gen_uint(values->shader.attribute_count, 0, 15) | 312696c5ddc4Srjs __gen_uint(values->shader.varying_count, 16, 31); 312796c5ddc4Srjs cl[ 4] = __gen_uint(values->properties.uniform_buffer_count, 0, 7) | 312896c5ddc4Srjs __gen_uint(values->properties.depth_source, 8, 9) | 312996c5ddc4Srjs __gen_uint(values->properties.shader_contains_barrier, 11, 11) | 313096c5ddc4Srjs __gen_uint(values->properties.shader_register_allocation, 12, 13) | 313196c5ddc4Srjs __gen_uint(values->properties.shader_modifies_coverage, 16, 16) | 313296c5ddc4Srjs __gen_uint(values->properties.allow_forward_pixel_to_kill, 19, 19) | 313396c5ddc4Srjs __gen_uint(values->properties.allow_forward_pixel_to_be_killed, 20, 20) | 313496c5ddc4Srjs __gen_uint(values->properties.pixel_kill_operation, 21, 22) | 313596c5ddc4Srjs __gen_uint(values->properties.zs_update_operation, 23, 24) | 313696c5ddc4Srjs __gen_uint(values->properties.point_sprite_coord_origin_max_y, 27, 27) | 313796c5ddc4Srjs __gen_uint(values->properties.stencil_from_shader, 28, 28); 313896c5ddc4Srjs cl[ 5] = __gen_uint(fui(values->depth_units), 0, 32); 313996c5ddc4Srjs cl[ 6] = __gen_uint(fui(values->depth_factor), 0, 32); 314096c5ddc4Srjs cl[ 7] = __gen_uint(fui(values->depth_bias_clamp), 0, 32); 314196c5ddc4Srjs cl[ 8] = __gen_uint(values->multisample_misc.sample_mask, 0, 15) | 314296c5ddc4Srjs __gen_uint(values->multisample_misc.multisample_enable, 16, 16) | 314396c5ddc4Srjs __gen_uint(values->multisample_misc.multisample_late_coverage, 17, 17) | 314496c5ddc4Srjs __gen_uint(values->multisample_misc.evaluate_per_sample, 18, 18) | 314596c5ddc4Srjs __gen_uint(values->multisample_misc.fixed_function_depth_range_fixed, 19, 19) | 314696c5ddc4Srjs __gen_uint(values->multisample_misc.shader_depth_range_fixed, 20, 20) | 314796c5ddc4Srjs __gen_uint(values->multisample_misc.overdraw_alpha1, 22, 22) | 314896c5ddc4Srjs __gen_uint(values->multisample_misc.overdraw_alpha0, 23, 23) | 314996c5ddc4Srjs __gen_uint(values->multisample_misc.depth_function, 24, 26) | 315096c5ddc4Srjs __gen_uint(values->multisample_misc.depth_write_mask, 27, 27) | 315196c5ddc4Srjs __gen_uint(values->multisample_misc.fixed_function_near_discard, 28, 28) | 315296c5ddc4Srjs __gen_uint(values->multisample_misc.fixed_function_far_discard, 29, 29) | 315396c5ddc4Srjs __gen_uint(values->multisample_misc.fragment_near_discard, 30, 30) | 315496c5ddc4Srjs __gen_uint(values->multisample_misc.fragment_far_discard, 31, 31); 315596c5ddc4Srjs cl[ 9] = __gen_uint(values->stencil_mask_misc.stencil_mask_front, 0, 7) | 315696c5ddc4Srjs __gen_uint(values->stencil_mask_misc.stencil_mask_back, 8, 15) | 315796c5ddc4Srjs __gen_uint(values->stencil_mask_misc.stencil_enable, 16, 16) | 315896c5ddc4Srjs __gen_uint(values->stencil_mask_misc.alpha_to_coverage, 17, 17) | 315996c5ddc4Srjs __gen_uint(values->stencil_mask_misc.alpha_to_coverage_invert, 18, 18) | 316096c5ddc4Srjs __gen_uint(values->stencil_mask_misc.alpha_test_compare_function, 21, 23) | 316196c5ddc4Srjs __gen_uint(values->stencil_mask_misc.force_seamless_cubemaps, 26, 26) | 316296c5ddc4Srjs __gen_uint(values->stencil_mask_misc.depth_range_1, 28, 28) | 316396c5ddc4Srjs __gen_uint(values->stencil_mask_misc.depth_range_2, 29, 29) | 316496c5ddc4Srjs __gen_uint(values->stencil_mask_misc.single_sampled_lines, 30, 30) | 316596c5ddc4Srjs __gen_uint(values->stencil_mask_misc.point_snap, 31, 31); 316696c5ddc4Srjs cl[10] = __gen_uint(values->stencil_front.reference_value, 0, 7) | 316796c5ddc4Srjs __gen_uint(values->stencil_front.mask, 8, 15) | 316896c5ddc4Srjs __gen_uint(values->stencil_front.compare_function, 16, 18) | 316996c5ddc4Srjs __gen_uint(values->stencil_front.stencil_fail, 19, 21) | 317096c5ddc4Srjs __gen_uint(values->stencil_front.depth_fail, 22, 24) | 317196c5ddc4Srjs __gen_uint(values->stencil_front.depth_pass, 25, 27); 317296c5ddc4Srjs cl[11] = __gen_uint(values->stencil_back.reference_value, 0, 7) | 317396c5ddc4Srjs __gen_uint(values->stencil_back.mask, 8, 15) | 317496c5ddc4Srjs __gen_uint(values->stencil_back.compare_function, 16, 18) | 317596c5ddc4Srjs __gen_uint(values->stencil_back.stencil_fail, 19, 21) | 317696c5ddc4Srjs __gen_uint(values->stencil_back.depth_fail, 22, 24) | 317796c5ddc4Srjs __gen_uint(values->stencil_back.depth_pass, 25, 27); 317896c5ddc4Srjs cl[12] = __gen_uint(values->preload.compute.pc, 6, 6) | 317996c5ddc4Srjs __gen_uint(values->preload.compute.local_invocation_xy, 7, 7) | 318096c5ddc4Srjs __gen_uint(values->preload.compute.local_invocation_z, 8, 8) | 318196c5ddc4Srjs __gen_uint(values->preload.compute.work_group_x, 9, 9) | 318296c5ddc4Srjs __gen_uint(values->preload.compute.work_group_y, 10, 10) | 318396c5ddc4Srjs __gen_uint(values->preload.compute.work_group_z, 11, 11) | 318496c5ddc4Srjs __gen_uint(values->preload.compute.global_invocation_x, 12, 12) | 318596c5ddc4Srjs __gen_uint(values->preload.compute.global_invocation_y, 13, 13) | 318696c5ddc4Srjs __gen_uint(values->preload.compute.global_invocation_z, 14, 14) | 318796c5ddc4Srjs __gen_uint(values->preload.vertex.warp_limit, 0, 1) | 318896c5ddc4Srjs __gen_uint(values->preload.vertex.pc, 6, 6) | 318996c5ddc4Srjs __gen_uint(values->preload.vertex.position_result_address_lo, 10, 10) | 319096c5ddc4Srjs __gen_uint(values->preload.vertex.position_result_address_hi, 11, 11) | 319196c5ddc4Srjs __gen_uint(values->preload.vertex.vertex_id, 13, 13) | 319296c5ddc4Srjs __gen_uint(values->preload.vertex.instance_id, 14, 14) | 319396c5ddc4Srjs __gen_uint(values->preload.fragment.pc, 6, 6) | 319496c5ddc4Srjs __gen_uint(values->preload.fragment.coverage, 7, 7) | 319596c5ddc4Srjs __gen_uint(values->preload.fragment.primitive_id, 9, 9) | 319696c5ddc4Srjs __gen_uint(values->preload.fragment.primitive_flags, 10, 10) | 319796c5ddc4Srjs __gen_uint(values->preload.fragment.fragment_position, 11, 11) | 319896c5ddc4Srjs __gen_uint(values->preload.fragment.sample_mask_id, 13, 13) | 319996c5ddc4Srjs __gen_uint(values->preload.uniform_count, 15, 21) | 320096c5ddc4Srjs __gen_uint(fui(values->alpha_reference), 0, 32); 320196c5ddc4Srjs cl[13] = __gen_uint(values->thread_balancing, 0, 15) | 320296c5ddc4Srjs __gen_uint(values->secondary_preload.compute.pc, 6, 6) | 320396c5ddc4Srjs __gen_uint(values->secondary_preload.compute.local_invocation_xy, 7, 7) | 320496c5ddc4Srjs __gen_uint(values->secondary_preload.compute.local_invocation_z, 8, 8) | 320596c5ddc4Srjs __gen_uint(values->secondary_preload.compute.work_group_x, 9, 9) | 320696c5ddc4Srjs __gen_uint(values->secondary_preload.compute.work_group_y, 10, 10) | 320796c5ddc4Srjs __gen_uint(values->secondary_preload.compute.work_group_z, 11, 11) | 320896c5ddc4Srjs __gen_uint(values->secondary_preload.compute.global_invocation_x, 12, 12) | 320996c5ddc4Srjs __gen_uint(values->secondary_preload.compute.global_invocation_y, 13, 13) | 321096c5ddc4Srjs __gen_uint(values->secondary_preload.compute.global_invocation_z, 14, 14) | 321196c5ddc4Srjs __gen_uint(values->secondary_preload.vertex.warp_limit, 0, 1) | 321296c5ddc4Srjs __gen_uint(values->secondary_preload.vertex.pc, 6, 6) | 321396c5ddc4Srjs __gen_uint(values->secondary_preload.vertex.position_result_address_lo, 10, 10) | 321496c5ddc4Srjs __gen_uint(values->secondary_preload.vertex.position_result_address_hi, 11, 11) | 321596c5ddc4Srjs __gen_uint(values->secondary_preload.vertex.vertex_id, 13, 13) | 321696c5ddc4Srjs __gen_uint(values->secondary_preload.vertex.instance_id, 14, 14) | 321796c5ddc4Srjs __gen_uint(values->secondary_preload.fragment.pc, 6, 6) | 321896c5ddc4Srjs __gen_uint(values->secondary_preload.fragment.coverage, 7, 7) | 321996c5ddc4Srjs __gen_uint(values->secondary_preload.fragment.primitive_id, 9, 9) | 322096c5ddc4Srjs __gen_uint(values->secondary_preload.fragment.primitive_flags, 10, 10) | 322196c5ddc4Srjs __gen_uint(values->secondary_preload.fragment.fragment_position, 11, 11) | 322296c5ddc4Srjs __gen_uint(values->secondary_preload.fragment.sample_mask_id, 13, 13) | 322396c5ddc4Srjs __gen_uint(values->secondary_preload.uniform_count, 15, 21); 322496c5ddc4Srjs cl[14] = __gen_uint(values->secondary_shader, 0, 63); 322596c5ddc4Srjs cl[15] = __gen_uint(values->secondary_shader, 0, 63) >> 32; 322696c5ddc4Srjs} 322796c5ddc4Srjs 322896c5ddc4Srjs 322996c5ddc4Srjs#define MALI_RENDERER_STATE_LENGTH 64 323096c5ddc4Srjs#define MALI_RENDERER_STATE_ALIGN 64 323196c5ddc4Srjsstruct mali_renderer_state_packed { uint32_t opaque[16]; }; 323296c5ddc4Srjsstatic inline void 323396c5ddc4SrjsMALI_RENDERER_STATE_unpack(const uint8_t * restrict cl, 323496c5ddc4Srjs struct MALI_RENDERER_STATE * restrict values) 323596c5ddc4Srjs{ 323696c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xe606c400) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 4\n"); 323796c5ddc4Srjs if (((const uint32_t *) cl)[8] & 0x200000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 8\n"); 323896c5ddc4Srjs if (((const uint32_t *) cl)[9] & 0xb180000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 9\n"); 323996c5ddc4Srjs if (((const uint32_t *) cl)[10] & 0xf0000000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 10\n"); 324096c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0xf0000000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 11\n"); 324196c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffc00000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 13\n"); 324296c5ddc4Srjs values->shader.shader = __gen_unpack_uint(cl, 0, 63); 324396c5ddc4Srjs values->shader.sampler_count = __gen_unpack_uint(cl, 64, 79); 324496c5ddc4Srjs values->shader.texture_count = __gen_unpack_uint(cl, 80, 95); 324596c5ddc4Srjs values->shader.attribute_count = __gen_unpack_uint(cl, 96, 111); 324696c5ddc4Srjs values->shader.varying_count = __gen_unpack_uint(cl, 112, 127); 324796c5ddc4Srjs values->properties.uniform_buffer_count = __gen_unpack_uint(cl, 128, 135); 324896c5ddc4Srjs values->properties.depth_source = (enum mali_depth_source)__gen_unpack_uint(cl, 136, 137); 324996c5ddc4Srjs values->properties.shader_contains_barrier = __gen_unpack_uint(cl, 139, 139); 325096c5ddc4Srjs values->properties.shader_register_allocation = (enum mali_shader_register_allocation)__gen_unpack_uint(cl, 140, 141); 325196c5ddc4Srjs values->properties.shader_modifies_coverage = __gen_unpack_uint(cl, 144, 144); 325296c5ddc4Srjs values->properties.allow_forward_pixel_to_kill = __gen_unpack_uint(cl, 147, 147); 325396c5ddc4Srjs values->properties.allow_forward_pixel_to_be_killed = __gen_unpack_uint(cl, 148, 148); 325496c5ddc4Srjs values->properties.pixel_kill_operation = (enum mali_pixel_kill)__gen_unpack_uint(cl, 149, 150); 325596c5ddc4Srjs values->properties.zs_update_operation = (enum mali_pixel_kill)__gen_unpack_uint(cl, 151, 152); 325696c5ddc4Srjs values->properties.point_sprite_coord_origin_max_y = __gen_unpack_uint(cl, 155, 155); 325796c5ddc4Srjs values->properties.stencil_from_shader = __gen_unpack_uint(cl, 156, 156); 325896c5ddc4Srjs values->depth_units = __gen_unpack_float(cl, 160, 191); 325996c5ddc4Srjs values->depth_factor = __gen_unpack_float(cl, 192, 223); 326096c5ddc4Srjs values->depth_bias_clamp = __gen_unpack_float(cl, 224, 255); 326196c5ddc4Srjs values->multisample_misc.sample_mask = __gen_unpack_uint(cl, 256, 271); 326296c5ddc4Srjs values->multisample_misc.multisample_enable = __gen_unpack_uint(cl, 272, 272); 326396c5ddc4Srjs values->multisample_misc.multisample_late_coverage = __gen_unpack_uint(cl, 273, 273); 326496c5ddc4Srjs values->multisample_misc.evaluate_per_sample = __gen_unpack_uint(cl, 274, 274); 326596c5ddc4Srjs values->multisample_misc.fixed_function_depth_range_fixed = __gen_unpack_uint(cl, 275, 275); 326696c5ddc4Srjs values->multisample_misc.shader_depth_range_fixed = __gen_unpack_uint(cl, 276, 276); 326796c5ddc4Srjs values->multisample_misc.overdraw_alpha1 = __gen_unpack_uint(cl, 278, 278); 326896c5ddc4Srjs values->multisample_misc.overdraw_alpha0 = __gen_unpack_uint(cl, 279, 279); 326996c5ddc4Srjs values->multisample_misc.depth_function = (enum mali_func)__gen_unpack_uint(cl, 280, 282); 327096c5ddc4Srjs values->multisample_misc.depth_write_mask = __gen_unpack_uint(cl, 283, 283); 327196c5ddc4Srjs values->multisample_misc.fixed_function_near_discard = __gen_unpack_uint(cl, 284, 284); 327296c5ddc4Srjs values->multisample_misc.fixed_function_far_discard = __gen_unpack_uint(cl, 285, 285); 327396c5ddc4Srjs values->multisample_misc.fragment_near_discard = __gen_unpack_uint(cl, 286, 286); 327496c5ddc4Srjs values->multisample_misc.fragment_far_discard = __gen_unpack_uint(cl, 287, 287); 327596c5ddc4Srjs values->stencil_mask_misc.stencil_mask_front = __gen_unpack_uint(cl, 288, 295); 327696c5ddc4Srjs values->stencil_mask_misc.stencil_mask_back = __gen_unpack_uint(cl, 296, 303); 327796c5ddc4Srjs values->stencil_mask_misc.stencil_enable = __gen_unpack_uint(cl, 304, 304); 327896c5ddc4Srjs values->stencil_mask_misc.alpha_to_coverage = __gen_unpack_uint(cl, 305, 305); 327996c5ddc4Srjs values->stencil_mask_misc.alpha_to_coverage_invert = __gen_unpack_uint(cl, 306, 306); 328096c5ddc4Srjs values->stencil_mask_misc.alpha_test_compare_function = (enum mali_func)__gen_unpack_uint(cl, 309, 311); 328196c5ddc4Srjs values->stencil_mask_misc.force_seamless_cubemaps = __gen_unpack_uint(cl, 314, 314); 328296c5ddc4Srjs values->stencil_mask_misc.depth_range_1 = __gen_unpack_uint(cl, 316, 316); 328396c5ddc4Srjs values->stencil_mask_misc.depth_range_2 = __gen_unpack_uint(cl, 317, 317); 328496c5ddc4Srjs values->stencil_mask_misc.single_sampled_lines = __gen_unpack_uint(cl, 318, 318); 328596c5ddc4Srjs values->stencil_mask_misc.point_snap = __gen_unpack_uint(cl, 319, 319); 328696c5ddc4Srjs values->stencil_front.reference_value = __gen_unpack_uint(cl, 320, 327); 328796c5ddc4Srjs values->stencil_front.mask = __gen_unpack_uint(cl, 328, 335); 328896c5ddc4Srjs values->stencil_front.compare_function = (enum mali_func)__gen_unpack_uint(cl, 336, 338); 328996c5ddc4Srjs values->stencil_front.stencil_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 339, 341); 329096c5ddc4Srjs values->stencil_front.depth_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 342, 344); 329196c5ddc4Srjs values->stencil_front.depth_pass = (enum mali_stencil_op)__gen_unpack_uint(cl, 345, 347); 329296c5ddc4Srjs values->stencil_back.reference_value = __gen_unpack_uint(cl, 352, 359); 329396c5ddc4Srjs values->stencil_back.mask = __gen_unpack_uint(cl, 360, 367); 329496c5ddc4Srjs values->stencil_back.compare_function = (enum mali_func)__gen_unpack_uint(cl, 368, 370); 329596c5ddc4Srjs values->stencil_back.stencil_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 371, 373); 329696c5ddc4Srjs values->stencil_back.depth_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 374, 376); 329796c5ddc4Srjs values->stencil_back.depth_pass = (enum mali_stencil_op)__gen_unpack_uint(cl, 377, 379); 329896c5ddc4Srjs values->preload.compute.pc = __gen_unpack_uint(cl, 390, 390); 329996c5ddc4Srjs values->preload.compute.local_invocation_xy = __gen_unpack_uint(cl, 391, 391); 330096c5ddc4Srjs values->preload.compute.local_invocation_z = __gen_unpack_uint(cl, 392, 392); 330196c5ddc4Srjs values->preload.compute.work_group_x = __gen_unpack_uint(cl, 393, 393); 330296c5ddc4Srjs values->preload.compute.work_group_y = __gen_unpack_uint(cl, 394, 394); 330396c5ddc4Srjs values->preload.compute.work_group_z = __gen_unpack_uint(cl, 395, 395); 330496c5ddc4Srjs values->preload.compute.global_invocation_x = __gen_unpack_uint(cl, 396, 396); 330596c5ddc4Srjs values->preload.compute.global_invocation_y = __gen_unpack_uint(cl, 397, 397); 330696c5ddc4Srjs values->preload.compute.global_invocation_z = __gen_unpack_uint(cl, 398, 398); 330796c5ddc4Srjs values->preload.vertex.warp_limit = (enum mali_warp_limit)__gen_unpack_uint(cl, 384, 385); 330896c5ddc4Srjs values->preload.vertex.pc = __gen_unpack_uint(cl, 390, 390); 330996c5ddc4Srjs values->preload.vertex.position_result_address_lo = __gen_unpack_uint(cl, 394, 394); 331096c5ddc4Srjs values->preload.vertex.position_result_address_hi = __gen_unpack_uint(cl, 395, 395); 331196c5ddc4Srjs values->preload.vertex.vertex_id = __gen_unpack_uint(cl, 397, 397); 331296c5ddc4Srjs values->preload.vertex.instance_id = __gen_unpack_uint(cl, 398, 398); 331396c5ddc4Srjs values->preload.fragment.pc = __gen_unpack_uint(cl, 390, 390); 331496c5ddc4Srjs values->preload.fragment.coverage = __gen_unpack_uint(cl, 391, 391); 331596c5ddc4Srjs values->preload.fragment.primitive_id = __gen_unpack_uint(cl, 393, 393); 331696c5ddc4Srjs values->preload.fragment.primitive_flags = __gen_unpack_uint(cl, 394, 394); 331796c5ddc4Srjs values->preload.fragment.fragment_position = __gen_unpack_uint(cl, 395, 395); 331896c5ddc4Srjs values->preload.fragment.sample_mask_id = __gen_unpack_uint(cl, 397, 397); 331996c5ddc4Srjs values->preload.uniform_count = __gen_unpack_uint(cl, 399, 405); 332096c5ddc4Srjs values->alpha_reference = __gen_unpack_float(cl, 384, 415); 332196c5ddc4Srjs values->thread_balancing = __gen_unpack_uint(cl, 416, 431); 332296c5ddc4Srjs values->secondary_preload.compute.pc = __gen_unpack_uint(cl, 422, 422); 332396c5ddc4Srjs values->secondary_preload.compute.local_invocation_xy = __gen_unpack_uint(cl, 423, 423); 332496c5ddc4Srjs values->secondary_preload.compute.local_invocation_z = __gen_unpack_uint(cl, 424, 424); 332596c5ddc4Srjs values->secondary_preload.compute.work_group_x = __gen_unpack_uint(cl, 425, 425); 332696c5ddc4Srjs values->secondary_preload.compute.work_group_y = __gen_unpack_uint(cl, 426, 426); 332796c5ddc4Srjs values->secondary_preload.compute.work_group_z = __gen_unpack_uint(cl, 427, 427); 332896c5ddc4Srjs values->secondary_preload.compute.global_invocation_x = __gen_unpack_uint(cl, 428, 428); 332996c5ddc4Srjs values->secondary_preload.compute.global_invocation_y = __gen_unpack_uint(cl, 429, 429); 333096c5ddc4Srjs values->secondary_preload.compute.global_invocation_z = __gen_unpack_uint(cl, 430, 430); 333196c5ddc4Srjs values->secondary_preload.vertex.warp_limit = (enum mali_warp_limit)__gen_unpack_uint(cl, 416, 417); 333296c5ddc4Srjs values->secondary_preload.vertex.pc = __gen_unpack_uint(cl, 422, 422); 333396c5ddc4Srjs values->secondary_preload.vertex.position_result_address_lo = __gen_unpack_uint(cl, 426, 426); 333496c5ddc4Srjs values->secondary_preload.vertex.position_result_address_hi = __gen_unpack_uint(cl, 427, 427); 333596c5ddc4Srjs values->secondary_preload.vertex.vertex_id = __gen_unpack_uint(cl, 429, 429); 333696c5ddc4Srjs values->secondary_preload.vertex.instance_id = __gen_unpack_uint(cl, 430, 430); 333796c5ddc4Srjs values->secondary_preload.fragment.pc = __gen_unpack_uint(cl, 422, 422); 333896c5ddc4Srjs values->secondary_preload.fragment.coverage = __gen_unpack_uint(cl, 423, 423); 333996c5ddc4Srjs values->secondary_preload.fragment.primitive_id = __gen_unpack_uint(cl, 425, 425); 334096c5ddc4Srjs values->secondary_preload.fragment.primitive_flags = __gen_unpack_uint(cl, 426, 426); 334196c5ddc4Srjs values->secondary_preload.fragment.fragment_position = __gen_unpack_uint(cl, 427, 427); 334296c5ddc4Srjs values->secondary_preload.fragment.sample_mask_id = __gen_unpack_uint(cl, 429, 429); 334396c5ddc4Srjs values->secondary_preload.uniform_count = __gen_unpack_uint(cl, 431, 437); 334496c5ddc4Srjs values->secondary_shader = __gen_unpack_uint(cl, 448, 511); 334596c5ddc4Srjs} 334696c5ddc4Srjs 334796c5ddc4Srjsstatic inline void 334896c5ddc4SrjsMALI_RENDERER_STATE_print(FILE *fp, const struct MALI_RENDERER_STATE * values, unsigned indent) 334996c5ddc4Srjs{ 335096c5ddc4Srjs fprintf(fp, "%*sShader:\n", indent, ""); 335196c5ddc4Srjs MALI_SHADER_print(fp, &values->shader, indent + 2); 335296c5ddc4Srjs fprintf(fp, "%*sProperties:\n", indent, ""); 335396c5ddc4Srjs MALI_RENDERER_PROPERTIES_print(fp, &values->properties, indent + 2); 335496c5ddc4Srjs fprintf(fp, "%*sDepth units: %f\n", indent, "", values->depth_units); 335596c5ddc4Srjs fprintf(fp, "%*sDepth factor: %f\n", indent, "", values->depth_factor); 335696c5ddc4Srjs fprintf(fp, "%*sDepth bias clamp: %f\n", indent, "", values->depth_bias_clamp); 335796c5ddc4Srjs fprintf(fp, "%*sMultisample, Misc:\n", indent, ""); 335896c5ddc4Srjs MALI_MULTISAMPLE_MISC_print(fp, &values->multisample_misc, indent + 2); 335996c5ddc4Srjs fprintf(fp, "%*sStencil Mask, Misc:\n", indent, ""); 336096c5ddc4Srjs MALI_STENCIL_MASK_MISC_print(fp, &values->stencil_mask_misc, indent + 2); 336196c5ddc4Srjs fprintf(fp, "%*sStencil front:\n", indent, ""); 336296c5ddc4Srjs MALI_STENCIL_print(fp, &values->stencil_front, indent + 2); 336396c5ddc4Srjs fprintf(fp, "%*sStencil back:\n", indent, ""); 336496c5ddc4Srjs MALI_STENCIL_print(fp, &values->stencil_back, indent + 2); 336596c5ddc4Srjs fprintf(fp, "%*sPreload:\n", indent, ""); 336696c5ddc4Srjs MALI_PRELOAD_print(fp, &values->preload, indent + 2); 336796c5ddc4Srjs fprintf(fp, "%*sAlpha reference: %f\n", indent, "", values->alpha_reference); 336896c5ddc4Srjs fprintf(fp, "%*sThread Balancing: %u\n", indent, "", values->thread_balancing); 336996c5ddc4Srjs fprintf(fp, "%*sSecondary preload:\n", indent, ""); 337096c5ddc4Srjs MALI_PRELOAD_print(fp, &values->secondary_preload, indent + 2); 337196c5ddc4Srjs fprintf(fp, "%*sSecondary shader: 0x%" PRIx64 "\n", indent, "", values->secondary_shader); 337296c5ddc4Srjs} 337396c5ddc4Srjs 337496c5ddc4Srjsstruct MALI_UNIFORM_BUFFER { 337596c5ddc4Srjs uint32_t entries; 337696c5ddc4Srjs uint64_t pointer; 337796c5ddc4Srjs}; 337896c5ddc4Srjs 337996c5ddc4Srjs#define MALI_UNIFORM_BUFFER_header \ 338096c5ddc4Srjs 0 338196c5ddc4Srjs 338296c5ddc4Srjsstatic inline void 338396c5ddc4SrjsMALI_UNIFORM_BUFFER_pack(uint32_t * restrict cl, 338496c5ddc4Srjs const struct MALI_UNIFORM_BUFFER * restrict values) 338596c5ddc4Srjs{ 338696c5ddc4Srjs assert(values->entries >= 1); 338796c5ddc4Srjs assert((values->pointer & 0xf) == 0); 338896c5ddc4Srjs cl[ 0] = __gen_uint(values->entries - 1, 0, 11) | 338996c5ddc4Srjs __gen_uint(values->pointer >> 4, 12, 63); 339096c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer >> 4, 12, 63) >> 32; 339196c5ddc4Srjs} 339296c5ddc4Srjs 339396c5ddc4Srjs 339496c5ddc4Srjs#define MALI_UNIFORM_BUFFER_LENGTH 8 339596c5ddc4Srjs#define MALI_UNIFORM_BUFFER_ALIGN 8 339696c5ddc4Srjsstruct mali_uniform_buffer_packed { uint32_t opaque[2]; }; 339796c5ddc4Srjsstatic inline void 339896c5ddc4SrjsMALI_UNIFORM_BUFFER_unpack(const uint8_t * restrict cl, 339996c5ddc4Srjs struct MALI_UNIFORM_BUFFER * restrict values) 340096c5ddc4Srjs{ 340196c5ddc4Srjs values->entries = __gen_unpack_uint(cl, 0, 11) + 1; 340296c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 12, 63) << 4; 340396c5ddc4Srjs} 340496c5ddc4Srjs 340596c5ddc4Srjsstatic inline void 340696c5ddc4SrjsMALI_UNIFORM_BUFFER_print(FILE *fp, const struct MALI_UNIFORM_BUFFER * values, unsigned indent) 340796c5ddc4Srjs{ 340896c5ddc4Srjs fprintf(fp, "%*sEntries: %u\n", indent, "", values->entries); 340996c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 341096c5ddc4Srjs} 341196c5ddc4Srjs 341296c5ddc4Srjsstruct MALI_VIEWPORT { 341396c5ddc4Srjs float minimum_x; 341496c5ddc4Srjs float minimum_y; 341596c5ddc4Srjs float maximum_x; 341696c5ddc4Srjs float maximum_y; 341796c5ddc4Srjs float minimum_z; 341896c5ddc4Srjs float maximum_z; 341996c5ddc4Srjs uint32_t scissor_minimum_x; 342096c5ddc4Srjs uint32_t scissor_minimum_y; 342196c5ddc4Srjs uint32_t scissor_maximum_x; 342296c5ddc4Srjs uint32_t scissor_maximum_y; 342396c5ddc4Srjs}; 342496c5ddc4Srjs 342596c5ddc4Srjs#define MALI_VIEWPORT_header \ 342696c5ddc4Srjs .minimum_x = -INFINITY, \ 342796c5ddc4Srjs .minimum_y = -INFINITY, \ 342896c5ddc4Srjs .maximum_x = +INFINITY, \ 342996c5ddc4Srjs .maximum_y = +INFINITY, \ 343096c5ddc4Srjs .minimum_z = 0.0, \ 343196c5ddc4Srjs .maximum_z = 1.0, \ 343296c5ddc4Srjs .scissor_minimum_x = 0, \ 343396c5ddc4Srjs .scissor_minimum_y = 0 343496c5ddc4Srjs 343596c5ddc4Srjsstatic inline void 343696c5ddc4SrjsMALI_VIEWPORT_pack(uint32_t * restrict cl, 343796c5ddc4Srjs const struct MALI_VIEWPORT * restrict values) 343896c5ddc4Srjs{ 343996c5ddc4Srjs cl[ 0] = __gen_uint(fui(values->minimum_x), 0, 32); 344096c5ddc4Srjs cl[ 1] = __gen_uint(fui(values->minimum_y), 0, 32); 344196c5ddc4Srjs cl[ 2] = __gen_uint(fui(values->maximum_x), 0, 32); 344296c5ddc4Srjs cl[ 3] = __gen_uint(fui(values->maximum_y), 0, 32); 344396c5ddc4Srjs cl[ 4] = __gen_uint(fui(values->minimum_z), 0, 32); 344496c5ddc4Srjs cl[ 5] = __gen_uint(fui(values->maximum_z), 0, 32); 344596c5ddc4Srjs cl[ 6] = __gen_uint(values->scissor_minimum_x, 0, 15) | 344696c5ddc4Srjs __gen_uint(values->scissor_minimum_y, 16, 31); 344796c5ddc4Srjs cl[ 7] = __gen_uint(values->scissor_maximum_x, 0, 15) | 344896c5ddc4Srjs __gen_uint(values->scissor_maximum_y, 16, 31); 344996c5ddc4Srjs} 345096c5ddc4Srjs 345196c5ddc4Srjs 345296c5ddc4Srjs#define MALI_VIEWPORT_LENGTH 32 345396c5ddc4Srjs#define MALI_VIEWPORT_ALIGN 32 345496c5ddc4Srjsstruct mali_viewport_packed { uint32_t opaque[8]; }; 345596c5ddc4Srjsstatic inline void 345696c5ddc4SrjsMALI_VIEWPORT_unpack(const uint8_t * restrict cl, 345796c5ddc4Srjs struct MALI_VIEWPORT * restrict values) 345896c5ddc4Srjs{ 345996c5ddc4Srjs values->minimum_x = __gen_unpack_float(cl, 0, 31); 346096c5ddc4Srjs values->minimum_y = __gen_unpack_float(cl, 32, 63); 346196c5ddc4Srjs values->maximum_x = __gen_unpack_float(cl, 64, 95); 346296c5ddc4Srjs values->maximum_y = __gen_unpack_float(cl, 96, 127); 346396c5ddc4Srjs values->minimum_z = __gen_unpack_float(cl, 128, 159); 346496c5ddc4Srjs values->maximum_z = __gen_unpack_float(cl, 160, 191); 346596c5ddc4Srjs values->scissor_minimum_x = __gen_unpack_uint(cl, 192, 207); 346696c5ddc4Srjs values->scissor_minimum_y = __gen_unpack_uint(cl, 208, 223); 346796c5ddc4Srjs values->scissor_maximum_x = __gen_unpack_uint(cl, 224, 239); 346896c5ddc4Srjs values->scissor_maximum_y = __gen_unpack_uint(cl, 240, 255); 346996c5ddc4Srjs} 347096c5ddc4Srjs 347196c5ddc4Srjsstatic inline void 347296c5ddc4SrjsMALI_VIEWPORT_print(FILE *fp, const struct MALI_VIEWPORT * values, unsigned indent) 347396c5ddc4Srjs{ 347496c5ddc4Srjs fprintf(fp, "%*sMinimum X: %f\n", indent, "", values->minimum_x); 347596c5ddc4Srjs fprintf(fp, "%*sMinimum Y: %f\n", indent, "", values->minimum_y); 347696c5ddc4Srjs fprintf(fp, "%*sMaximum X: %f\n", indent, "", values->maximum_x); 347796c5ddc4Srjs fprintf(fp, "%*sMaximum Y: %f\n", indent, "", values->maximum_y); 347896c5ddc4Srjs fprintf(fp, "%*sMinimum Z: %f\n", indent, "", values->minimum_z); 347996c5ddc4Srjs fprintf(fp, "%*sMaximum Z: %f\n", indent, "", values->maximum_z); 348096c5ddc4Srjs fprintf(fp, "%*sScissor Minimum X: %u\n", indent, "", values->scissor_minimum_x); 348196c5ddc4Srjs fprintf(fp, "%*sScissor Minimum Y: %u\n", indent, "", values->scissor_minimum_y); 348296c5ddc4Srjs fprintf(fp, "%*sScissor Maximum X: %u\n", indent, "", values->scissor_maximum_x); 348396c5ddc4Srjs fprintf(fp, "%*sScissor Maximum Y: %u\n", indent, "", values->scissor_maximum_y); 348496c5ddc4Srjs} 348596c5ddc4Srjs 348696c5ddc4Srjsstruct MALI_LOCAL_STORAGE { 348796c5ddc4Srjs uint32_t tls_size; 348896c5ddc4Srjs uint32_t tls_initial_stack_pointer_offset; 348996c5ddc4Srjs uint32_t wls_instances; 349096c5ddc4Srjs#define MALI_LOCAL_STORAGE_NO_WORKGROUP_MEM 2147483648 349196c5ddc4Srjs uint32_t wls_size_base; 349296c5ddc4Srjs uint32_t wls_size_scale; 349396c5ddc4Srjs uint64_t tls_base_pointer; 349496c5ddc4Srjs uint64_t wls_base_pointer; 349596c5ddc4Srjs}; 349696c5ddc4Srjs 349796c5ddc4Srjs#define MALI_LOCAL_STORAGE_header \ 349896c5ddc4Srjs .wls_instances = MALI_LOCAL_STORAGE_NO_WORKGROUP_MEM 349996c5ddc4Srjs 350096c5ddc4Srjsstatic inline void 350196c5ddc4SrjsMALI_LOCAL_STORAGE_pack(uint32_t * restrict cl, 350296c5ddc4Srjs const struct MALI_LOCAL_STORAGE * restrict values) 350396c5ddc4Srjs{ 350496c5ddc4Srjs assert(util_is_power_of_two_nonzero(values->wls_instances)); 350596c5ddc4Srjs cl[ 0] = __gen_uint(values->tls_size, 0, 4) | 350696c5ddc4Srjs __gen_uint(values->tls_initial_stack_pointer_offset, 5, 31); 350796c5ddc4Srjs cl[ 1] = __gen_uint(util_logbase2(values->wls_instances), 0, 4) | 350896c5ddc4Srjs __gen_uint(values->wls_size_base, 5, 6) | 350996c5ddc4Srjs __gen_uint(values->wls_size_scale, 8, 12); 351096c5ddc4Srjs cl[ 2] = __gen_uint(values->tls_base_pointer, 0, 63); 351196c5ddc4Srjs cl[ 3] = __gen_uint(values->tls_base_pointer, 0, 63) >> 32; 351296c5ddc4Srjs cl[ 4] = __gen_uint(values->wls_base_pointer, 0, 63); 351396c5ddc4Srjs cl[ 5] = __gen_uint(values->wls_base_pointer, 0, 63) >> 32; 351496c5ddc4Srjs cl[ 6] = 0; 351596c5ddc4Srjs cl[ 7] = 0; 351696c5ddc4Srjs} 351796c5ddc4Srjs 351896c5ddc4Srjs 351996c5ddc4Srjs#define MALI_LOCAL_STORAGE_LENGTH 32 352096c5ddc4Srjs#define MALI_LOCAL_STORAGE_ALIGN 64 352196c5ddc4Srjsstruct mali_local_storage_packed { uint32_t opaque[8]; }; 352296c5ddc4Srjsstatic inline void 352396c5ddc4SrjsMALI_LOCAL_STORAGE_unpack(const uint8_t * restrict cl, 352496c5ddc4Srjs struct MALI_LOCAL_STORAGE * restrict values) 352596c5ddc4Srjs{ 352696c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffe080) fprintf(stderr, "XXX: Invalid field of Local Storage unpacked at word 1\n"); 352796c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Local Storage unpacked at word 6\n"); 352896c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Local Storage unpacked at word 7\n"); 352996c5ddc4Srjs values->tls_size = __gen_unpack_uint(cl, 0, 4); 353096c5ddc4Srjs values->tls_initial_stack_pointer_offset = __gen_unpack_uint(cl, 5, 31); 353196c5ddc4Srjs values->wls_instances = 1U << __gen_unpack_uint(cl, 32, 36); 353296c5ddc4Srjs values->wls_size_base = __gen_unpack_uint(cl, 37, 38); 353396c5ddc4Srjs values->wls_size_scale = __gen_unpack_uint(cl, 40, 44); 353496c5ddc4Srjs values->tls_base_pointer = __gen_unpack_uint(cl, 64, 127); 353596c5ddc4Srjs values->wls_base_pointer = __gen_unpack_uint(cl, 128, 191); 353696c5ddc4Srjs} 353796c5ddc4Srjs 353896c5ddc4Srjsstatic inline void 353996c5ddc4SrjsMALI_LOCAL_STORAGE_print(FILE *fp, const struct MALI_LOCAL_STORAGE * values, unsigned indent) 354096c5ddc4Srjs{ 354196c5ddc4Srjs fprintf(fp, "%*sTLS Size: %u\n", indent, "", values->tls_size); 354296c5ddc4Srjs fprintf(fp, "%*sTLS Initial Stack Pointer Offset: %u\n", indent, "", values->tls_initial_stack_pointer_offset); 354396c5ddc4Srjs fprintf(fp, "%*sWLS Instances: %u\n", indent, "", values->wls_instances); 354496c5ddc4Srjs fprintf(fp, "%*sWLS Size Base: %u\n", indent, "", values->wls_size_base); 354596c5ddc4Srjs fprintf(fp, "%*sWLS Size Scale: %u\n", indent, "", values->wls_size_scale); 354696c5ddc4Srjs fprintf(fp, "%*sTLS Base Pointer: 0x%" PRIx64 "\n", indent, "", values->tls_base_pointer); 354796c5ddc4Srjs fprintf(fp, "%*sWLS Base Pointer: 0x%" PRIx64 "\n", indent, "", values->wls_base_pointer); 354896c5ddc4Srjs} 354996c5ddc4Srjs 355096c5ddc4Srjsenum mali_color_buffer_internal_format { 355196c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW_VALUE = 0, 355296c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8 = 1, 355396c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2 = 2, 355496c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2 = 3, 355596c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R4G4B4A4 = 4, 355696c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G6B5A0 = 5, 355796c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G5B5A1 = 6, 355896c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW8 = 32, 355996c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW16 = 33, 356096c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW32 = 34, 356196c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW64 = 35, 356296c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW128 = 36, 356396c5ddc4Srjs}; 356496c5ddc4Srjs 356596c5ddc4Srjsstatic inline const char * 356696c5ddc4Srjsmali_color_buffer_internal_format_as_str(enum mali_color_buffer_internal_format imm) 356796c5ddc4Srjs{ 356896c5ddc4Srjs switch (imm) { 356996c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW_VALUE: return "Raw Value"; 357096c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8: return "R8G8B8A8"; 357196c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2: return "R10G10B10A2"; 357296c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2: return "R8G8B8A2"; 357396c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R4G4B4A4: return "R4G4B4A4"; 357496c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G6B5A0: return "R5G6B5A0"; 357596c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G5B5A1: return "R5G5B5A1"; 357696c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW8: return "RAW8"; 357796c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW16: return "RAW16"; 357896c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW32: return "RAW32"; 357996c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW64: return "RAW64"; 358096c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW128: return "RAW128"; 358196c5ddc4Srjs default: return "XXX: INVALID"; 358296c5ddc4Srjs } 358396c5ddc4Srjs} 358496c5ddc4Srjs 358596c5ddc4Srjsenum mali_color_format { 358696c5ddc4Srjs MALI_COLOR_FORMAT_RAW8 = 0, 358796c5ddc4Srjs MALI_COLOR_FORMAT_RAW16 = 1, 358896c5ddc4Srjs MALI_COLOR_FORMAT_RAW24 = 2, 358996c5ddc4Srjs MALI_COLOR_FORMAT_RAW32 = 3, 359096c5ddc4Srjs MALI_COLOR_FORMAT_RAW48 = 4, 359196c5ddc4Srjs MALI_COLOR_FORMAT_RAW64 = 5, 359296c5ddc4Srjs MALI_COLOR_FORMAT_RAW96 = 6, 359396c5ddc4Srjs MALI_COLOR_FORMAT_RAW128 = 7, 359496c5ddc4Srjs MALI_COLOR_FORMAT_RAW192 = 8, 359596c5ddc4Srjs MALI_COLOR_FORMAT_RAW256 = 9, 359696c5ddc4Srjs MALI_COLOR_FORMAT_RAW384 = 10, 359796c5ddc4Srjs MALI_COLOR_FORMAT_RAW512 = 11, 359896c5ddc4Srjs MALI_COLOR_FORMAT_RAW768 = 12, 359996c5ddc4Srjs MALI_COLOR_FORMAT_RAW1024 = 13, 360096c5ddc4Srjs MALI_COLOR_FORMAT_RAW1536 = 14, 360196c5ddc4Srjs MALI_COLOR_FORMAT_RAW2048 = 15, 360296c5ddc4Srjs MALI_COLOR_FORMAT_R8 = 16, 360396c5ddc4Srjs MALI_COLOR_FORMAT_R8G8 = 17, 360496c5ddc4Srjs MALI_COLOR_FORMAT_R8G8B8 = 18, 360596c5ddc4Srjs MALI_COLOR_FORMAT_R8G8B8A8 = 19, 360696c5ddc4Srjs MALI_COLOR_FORMAT_R4G4B4A4 = 20, 360796c5ddc4Srjs MALI_COLOR_FORMAT_R5G6B5 = 21, 360896c5ddc4Srjs MALI_COLOR_FORMAT_R8G8B8_FROM_R8G8B8A2 = 22, 360996c5ddc4Srjs MALI_COLOR_FORMAT_R10G10B10A2 = 24, 361096c5ddc4Srjs MALI_COLOR_FORMAT_A2B10G10R10 = 25, 361196c5ddc4Srjs MALI_COLOR_FORMAT_R5G5B5A1 = 28, 361296c5ddc4Srjs MALI_COLOR_FORMAT_A1B5G5R5 = 29, 361396c5ddc4Srjs MALI_COLOR_FORMAT_NATIVE = 31, 361496c5ddc4Srjs}; 361596c5ddc4Srjs 361696c5ddc4Srjsstatic inline const char * 361796c5ddc4Srjsmali_color_format_as_str(enum mali_color_format imm) 361896c5ddc4Srjs{ 361996c5ddc4Srjs switch (imm) { 362096c5ddc4Srjs case MALI_COLOR_FORMAT_RAW8: return "RAW8"; 362196c5ddc4Srjs case MALI_COLOR_FORMAT_RAW16: return "RAW16"; 362296c5ddc4Srjs case MALI_COLOR_FORMAT_RAW24: return "RAW24"; 362396c5ddc4Srjs case MALI_COLOR_FORMAT_RAW32: return "RAW32"; 362496c5ddc4Srjs case MALI_COLOR_FORMAT_RAW48: return "RAW48"; 362596c5ddc4Srjs case MALI_COLOR_FORMAT_RAW64: return "RAW64"; 362696c5ddc4Srjs case MALI_COLOR_FORMAT_RAW96: return "RAW96"; 362796c5ddc4Srjs case MALI_COLOR_FORMAT_RAW128: return "RAW128"; 362896c5ddc4Srjs case MALI_COLOR_FORMAT_RAW192: return "RAW192"; 362996c5ddc4Srjs case MALI_COLOR_FORMAT_RAW256: return "RAW256"; 363096c5ddc4Srjs case MALI_COLOR_FORMAT_RAW384: return "RAW384"; 363196c5ddc4Srjs case MALI_COLOR_FORMAT_RAW512: return "RAW512"; 363296c5ddc4Srjs case MALI_COLOR_FORMAT_RAW768: return "RAW768"; 363396c5ddc4Srjs case MALI_COLOR_FORMAT_RAW1024: return "RAW1024"; 363496c5ddc4Srjs case MALI_COLOR_FORMAT_RAW1536: return "RAW1536"; 363596c5ddc4Srjs case MALI_COLOR_FORMAT_RAW2048: return "RAW2048"; 363696c5ddc4Srjs case MALI_COLOR_FORMAT_R8: return "R8"; 363796c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8: return "R8G8"; 363896c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8B8: return "R8G8B8"; 363996c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8B8A8: return "R8G8B8A8"; 364096c5ddc4Srjs case MALI_COLOR_FORMAT_R4G4B4A4: return "R4G4B4A4"; 364196c5ddc4Srjs case MALI_COLOR_FORMAT_R5G6B5: return "R5G6B5"; 364296c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8B8_FROM_R8G8B8A2: return "R8G8B8_FROM_R8G8B8A2"; 364396c5ddc4Srjs case MALI_COLOR_FORMAT_R10G10B10A2: return "R10G10B10A2"; 364496c5ddc4Srjs case MALI_COLOR_FORMAT_A2B10G10R10: return "A2B10G10R10"; 364596c5ddc4Srjs case MALI_COLOR_FORMAT_R5G5B5A1: return "R5G5B5A1"; 364696c5ddc4Srjs case MALI_COLOR_FORMAT_A1B5G5R5: return "A1B5G5R5"; 364796c5ddc4Srjs case MALI_COLOR_FORMAT_NATIVE: return "NATIVE"; 364896c5ddc4Srjs default: return "XXX: INVALID"; 364996c5ddc4Srjs } 365096c5ddc4Srjs} 365196c5ddc4Srjs 365296c5ddc4Srjsenum mali_downsampling_accumulation_mode { 365396c5ddc4Srjs MALI_DOWNSAMPLING_ACCUMULATION_MODE_UNSIGNED_NORMALIZED_INTEGER = 0, 365496c5ddc4Srjs MALI_DOWNSAMPLING_ACCUMULATION_MODE_SIGNED_NORMALIZED_INTEGER = 1, 365596c5ddc4Srjs}; 365696c5ddc4Srjs 365796c5ddc4Srjsstatic inline const char * 365896c5ddc4Srjsmali_downsampling_accumulation_mode_as_str(enum mali_downsampling_accumulation_mode imm) 365996c5ddc4Srjs{ 366096c5ddc4Srjs switch (imm) { 366196c5ddc4Srjs case MALI_DOWNSAMPLING_ACCUMULATION_MODE_UNSIGNED_NORMALIZED_INTEGER: return "Unsigned normalized integer"; 366296c5ddc4Srjs case MALI_DOWNSAMPLING_ACCUMULATION_MODE_SIGNED_NORMALIZED_INTEGER: return "Signed normalized integer"; 366396c5ddc4Srjs default: return "XXX: INVALID"; 366496c5ddc4Srjs } 366596c5ddc4Srjs} 366696c5ddc4Srjs 366796c5ddc4Srjsenum mali_sample_layout { 366896c5ddc4Srjs MALI_SAMPLE_LAYOUT_ORDERED_4X_GRID = 0, 366996c5ddc4Srjs MALI_SAMPLE_LAYOUT_ROTATED_4X_GRID = 1, 367096c5ddc4Srjs MALI_SAMPLE_LAYOUT_D3D_8X_GRID = 2, 367196c5ddc4Srjs MALI_SAMPLE_LAYOUT_D3D_16X_GRID = 3, 367296c5ddc4Srjs}; 367396c5ddc4Srjs 367496c5ddc4Srjsstatic inline const char * 367596c5ddc4Srjsmali_sample_layout_as_str(enum mali_sample_layout imm) 367696c5ddc4Srjs{ 367796c5ddc4Srjs switch (imm) { 367896c5ddc4Srjs case MALI_SAMPLE_LAYOUT_ORDERED_4X_GRID: return "Ordered 4x Grid"; 367996c5ddc4Srjs case MALI_SAMPLE_LAYOUT_ROTATED_4X_GRID: return "Rotated 4x Grid"; 368096c5ddc4Srjs case MALI_SAMPLE_LAYOUT_D3D_8X_GRID: return "D3D 8x Grid"; 368196c5ddc4Srjs case MALI_SAMPLE_LAYOUT_D3D_16X_GRID: return "D3D 16x Grid"; 368296c5ddc4Srjs default: return "XXX: INVALID"; 368396c5ddc4Srjs } 368496c5ddc4Srjs} 368596c5ddc4Srjs 368696c5ddc4Srjsenum mali_zs_format { 368796c5ddc4Srjs MALI_ZS_FORMAT_D16 = 1, 368896c5ddc4Srjs MALI_ZS_FORMAT_D24 = 2, 368996c5ddc4Srjs MALI_ZS_FORMAT_D24X8 = 4, 369096c5ddc4Srjs MALI_ZS_FORMAT_D24S8 = 5, 369196c5ddc4Srjs MALI_ZS_FORMAT_X8D24 = 6, 369296c5ddc4Srjs MALI_ZS_FORMAT_S8D24 = 7, 369396c5ddc4Srjs MALI_ZS_FORMAT_D32_X8X24 = 13, 369496c5ddc4Srjs MALI_ZS_FORMAT_D32 = 14, 369596c5ddc4Srjs MALI_ZS_FORMAT_D32_S8X24 = 15, 369696c5ddc4Srjs}; 369796c5ddc4Srjs 369896c5ddc4Srjsstatic inline const char * 369996c5ddc4Srjsmali_zs_format_as_str(enum mali_zs_format imm) 370096c5ddc4Srjs{ 370196c5ddc4Srjs switch (imm) { 370296c5ddc4Srjs case MALI_ZS_FORMAT_D16: return "D16"; 370396c5ddc4Srjs case MALI_ZS_FORMAT_D24: return "D24"; 370496c5ddc4Srjs case MALI_ZS_FORMAT_D24X8: return "D24X8"; 370596c5ddc4Srjs case MALI_ZS_FORMAT_D24S8: return "D24S8"; 370696c5ddc4Srjs case MALI_ZS_FORMAT_X8D24: return "X8D24"; 370796c5ddc4Srjs case MALI_ZS_FORMAT_S8D24: return "S8D24"; 370896c5ddc4Srjs case MALI_ZS_FORMAT_D32_X8X24: return "D32_X8X24"; 370996c5ddc4Srjs case MALI_ZS_FORMAT_D32: return "D32"; 371096c5ddc4Srjs case MALI_ZS_FORMAT_D32_S8X24: return "D32_S8X24"; 371196c5ddc4Srjs default: return "XXX: INVALID"; 371296c5ddc4Srjs } 371396c5ddc4Srjs} 371496c5ddc4Srjs 371596c5ddc4Srjsenum mali_zs_preload_format { 371696c5ddc4Srjs MALI_ZS_PRELOAD_FORMAT_D32_S8X24 = 4, 371796c5ddc4Srjs}; 371896c5ddc4Srjs 371996c5ddc4Srjsstatic inline const char * 372096c5ddc4Srjsmali_zs_preload_format_as_str(enum mali_zs_preload_format imm) 372196c5ddc4Srjs{ 372296c5ddc4Srjs switch (imm) { 372396c5ddc4Srjs case MALI_ZS_PRELOAD_FORMAT_D32_S8X24: return "D32_S8X24"; 372496c5ddc4Srjs default: return "XXX: INVALID"; 372596c5ddc4Srjs } 372696c5ddc4Srjs} 372796c5ddc4Srjs 372896c5ddc4Srjsenum mali_s_format { 372996c5ddc4Srjs MALI_S_FORMAT_S8 = 1, 373096c5ddc4Srjs MALI_S_FORMAT_S8X8 = 2, 373196c5ddc4Srjs MALI_S_FORMAT_S8X24 = 3, 373296c5ddc4Srjs MALI_S_FORMAT_X24S8 = 4, 373396c5ddc4Srjs MALI_S_FORMAT_X8S8 = 5, 373496c5ddc4Srjs MALI_S_FORMAT_X32_S8X24 = 6, 373596c5ddc4Srjs}; 373696c5ddc4Srjs 373796c5ddc4Srjsstatic inline const char * 373896c5ddc4Srjsmali_s_format_as_str(enum mali_s_format imm) 373996c5ddc4Srjs{ 374096c5ddc4Srjs switch (imm) { 374196c5ddc4Srjs case MALI_S_FORMAT_S8: return "S8"; 374296c5ddc4Srjs case MALI_S_FORMAT_S8X8: return "S8X8"; 374396c5ddc4Srjs case MALI_S_FORMAT_S8X24: return "S8X24"; 374496c5ddc4Srjs case MALI_S_FORMAT_X24S8: return "X24S8"; 374596c5ddc4Srjs case MALI_S_FORMAT_X8S8: return "X8S8"; 374696c5ddc4Srjs case MALI_S_FORMAT_X32_S8X24: return "X32_S8X24"; 374796c5ddc4Srjs default: return "XXX: INVALID"; 374896c5ddc4Srjs } 374996c5ddc4Srjs} 375096c5ddc4Srjs 375196c5ddc4Srjsenum mali_tie_break_rule { 375296c5ddc4Srjs MALI_TIE_BREAK_RULE_0_IN_180_OUT = 0, 375396c5ddc4Srjs MALI_TIE_BREAK_RULE_0_OUT_180_IN = 1, 375496c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_180_IN_0_OUT = 2, 375596c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_180_OUT_0_IN = 3, 375696c5ddc4Srjs MALI_TIE_BREAK_RULE_90_IN_270_OUT = 4, 375796c5ddc4Srjs MALI_TIE_BREAK_RULE_90_OUT_270_IN = 5, 375896c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_90_IN_90_OUT = 6, 375996c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_90_OUT_90_IN = 7, 376096c5ddc4Srjs}; 376196c5ddc4Srjs 376296c5ddc4Srjsstatic inline const char * 376396c5ddc4Srjsmali_tie_break_rule_as_str(enum mali_tie_break_rule imm) 376496c5ddc4Srjs{ 376596c5ddc4Srjs switch (imm) { 376696c5ddc4Srjs case MALI_TIE_BREAK_RULE_0_IN_180_OUT: return "0_IN_180_OUT"; 376796c5ddc4Srjs case MALI_TIE_BREAK_RULE_0_OUT_180_IN: return "0_OUT_180_IN"; 376896c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_180_IN_0_OUT: return "MINUS_180_IN_0_OUT"; 376996c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_180_OUT_0_IN: return "MINUS_180_OUT_0_IN"; 377096c5ddc4Srjs case MALI_TIE_BREAK_RULE_90_IN_270_OUT: return "90_IN_270_OUT"; 377196c5ddc4Srjs case MALI_TIE_BREAK_RULE_90_OUT_270_IN: return "90_OUT_270_IN"; 377296c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_90_IN_90_OUT: return "MINUS_90_IN_90_OUT"; 377396c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_90_OUT_90_IN: return "MINUS_90_OUT_90_IN"; 377496c5ddc4Srjs default: return "XXX: INVALID"; 377596c5ddc4Srjs } 377696c5ddc4Srjs} 377796c5ddc4Srjs 377896c5ddc4Srjsstruct MALI_RT_BUFFER { 377996c5ddc4Srjs uint64_t base; 378096c5ddc4Srjs uint32_t row_stride; 378196c5ddc4Srjs uint32_t surface_stride; 378296c5ddc4Srjs}; 378396c5ddc4Srjs 378496c5ddc4Srjs#define MALI_RT_BUFFER_header \ 378596c5ddc4Srjs 0 378696c5ddc4Srjs 378796c5ddc4Srjsstatic inline void 378896c5ddc4SrjsMALI_RT_BUFFER_pack(uint32_t * restrict cl, 378996c5ddc4Srjs const struct MALI_RT_BUFFER * restrict values) 379096c5ddc4Srjs{ 379196c5ddc4Srjs cl[ 0] = __gen_uint(values->base, 0, 63); 379296c5ddc4Srjs cl[ 1] = __gen_uint(values->base, 0, 63) >> 32; 379396c5ddc4Srjs cl[ 2] = __gen_uint(values->row_stride, 0, 31); 379496c5ddc4Srjs cl[ 3] = __gen_uint(values->surface_stride, 0, 31); 379596c5ddc4Srjs} 379696c5ddc4Srjs 379796c5ddc4Srjs 379896c5ddc4Srjs#define MALI_RT_BUFFER_LENGTH 16 379996c5ddc4Srjsstruct mali_rt_buffer_packed { uint32_t opaque[4]; }; 380096c5ddc4Srjsstatic inline void 380196c5ddc4SrjsMALI_RT_BUFFER_unpack(const uint8_t * restrict cl, 380296c5ddc4Srjs struct MALI_RT_BUFFER * restrict values) 380396c5ddc4Srjs{ 380496c5ddc4Srjs values->base = __gen_unpack_uint(cl, 0, 63); 380596c5ddc4Srjs values->row_stride = __gen_unpack_uint(cl, 64, 95); 380696c5ddc4Srjs values->surface_stride = __gen_unpack_uint(cl, 96, 127); 380796c5ddc4Srjs} 380896c5ddc4Srjs 380996c5ddc4Srjsstatic inline void 381096c5ddc4SrjsMALI_RT_BUFFER_print(FILE *fp, const struct MALI_RT_BUFFER * values, unsigned indent) 381196c5ddc4Srjs{ 381296c5ddc4Srjs fprintf(fp, "%*sBase: 0x%" PRIx64 "\n", indent, "", values->base); 381396c5ddc4Srjs fprintf(fp, "%*sRow Stride: %u\n", indent, "", values->row_stride); 381496c5ddc4Srjs fprintf(fp, "%*sSurface Stride: %u\n", indent, "", values->surface_stride); 381596c5ddc4Srjs} 381696c5ddc4Srjs 381796c5ddc4Srjsenum mali_sample_pattern { 381896c5ddc4Srjs MALI_SAMPLE_PATTERN_SINGLE_SAMPLED = 0, 381996c5ddc4Srjs MALI_SAMPLE_PATTERN_ORDERED_4X_GRID = 1, 382096c5ddc4Srjs MALI_SAMPLE_PATTERN_ROTATED_4X_GRID = 2, 382196c5ddc4Srjs MALI_SAMPLE_PATTERN_D3D_8X_GRID = 3, 382296c5ddc4Srjs MALI_SAMPLE_PATTERN_D3D_16X_GRID = 4, 382396c5ddc4Srjs}; 382496c5ddc4Srjs 382596c5ddc4Srjsstatic inline const char * 382696c5ddc4Srjsmali_sample_pattern_as_str(enum mali_sample_pattern imm) 382796c5ddc4Srjs{ 382896c5ddc4Srjs switch (imm) { 382996c5ddc4Srjs case MALI_SAMPLE_PATTERN_SINGLE_SAMPLED: return "Single-sampled"; 383096c5ddc4Srjs case MALI_SAMPLE_PATTERN_ORDERED_4X_GRID: return "Ordered 4x Grid"; 383196c5ddc4Srjs case MALI_SAMPLE_PATTERN_ROTATED_4X_GRID: return "Rotated 4x Grid"; 383296c5ddc4Srjs case MALI_SAMPLE_PATTERN_D3D_8X_GRID: return "D3D 8x Grid"; 383396c5ddc4Srjs case MALI_SAMPLE_PATTERN_D3D_16X_GRID: return "D3D 16x Grid"; 383496c5ddc4Srjs default: return "XXX: INVALID"; 383596c5ddc4Srjs } 383696c5ddc4Srjs} 383796c5ddc4Srjs 383896c5ddc4Srjsenum mali_z_internal_format { 383996c5ddc4Srjs MALI_Z_INTERNAL_FORMAT_D16 = 0, 384096c5ddc4Srjs MALI_Z_INTERNAL_FORMAT_D24 = 1, 384196c5ddc4Srjs MALI_Z_INTERNAL_FORMAT_D32 = 2, 384296c5ddc4Srjs}; 384396c5ddc4Srjs 384496c5ddc4Srjsstatic inline const char * 384596c5ddc4Srjsmali_z_internal_format_as_str(enum mali_z_internal_format imm) 384696c5ddc4Srjs{ 384796c5ddc4Srjs switch (imm) { 384896c5ddc4Srjs case MALI_Z_INTERNAL_FORMAT_D16: return "D16"; 384996c5ddc4Srjs case MALI_Z_INTERNAL_FORMAT_D24: return "D24"; 385096c5ddc4Srjs case MALI_Z_INTERNAL_FORMAT_D32: return "D32"; 385196c5ddc4Srjs default: return "XXX: INVALID"; 385296c5ddc4Srjs } 385396c5ddc4Srjs} 385496c5ddc4Srjs 385596c5ddc4Srjsenum mali_fbd_tag { 385696c5ddc4Srjs MALI_FBD_TAG_IS_MFBD = 1, 385796c5ddc4Srjs MALI_FBD_TAG_HAS_ZS_RT = 2, 385896c5ddc4Srjs MALI_FBD_TAG_MASK = 63, 385996c5ddc4Srjs}; 386096c5ddc4Srjs 386196c5ddc4Srjsstatic inline const char * 386296c5ddc4Srjsmali_fbd_tag_as_str(enum mali_fbd_tag imm) 386396c5ddc4Srjs{ 386496c5ddc4Srjs switch (imm) { 386596c5ddc4Srjs case MALI_FBD_TAG_IS_MFBD: return "IS_MFBD"; 386696c5ddc4Srjs case MALI_FBD_TAG_HAS_ZS_RT: return "HAS_ZS_RT"; 386796c5ddc4Srjs case MALI_FBD_TAG_MASK: return "MASK"; 386896c5ddc4Srjs default: return "XXX: INVALID"; 386996c5ddc4Srjs } 387096c5ddc4Srjs} 387196c5ddc4Srjs 387296c5ddc4Srjsenum mali_pre_post_frame_shader_mode { 387396c5ddc4Srjs MALI_PRE_POST_FRAME_SHADER_MODE_NEVER = 0, 387496c5ddc4Srjs MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS = 1, 387596c5ddc4Srjs MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT = 2, 387696c5ddc4Srjs MALI_PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS = 3, 387796c5ddc4Srjs}; 387896c5ddc4Srjs 387996c5ddc4Srjsstatic inline const char * 388096c5ddc4Srjsmali_pre_post_frame_shader_mode_as_str(enum mali_pre_post_frame_shader_mode imm) 388196c5ddc4Srjs{ 388296c5ddc4Srjs switch (imm) { 388396c5ddc4Srjs case MALI_PRE_POST_FRAME_SHADER_MODE_NEVER: return "Never"; 388496c5ddc4Srjs case MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS: return "Always"; 388596c5ddc4Srjs case MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT: return "Intersect"; 388696c5ddc4Srjs case MALI_PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS: return "Early ZS always"; 388796c5ddc4Srjs default: return "XXX: INVALID"; 388896c5ddc4Srjs } 388996c5ddc4Srjs} 389096c5ddc4Srjs 389196c5ddc4Srjsstruct MALI_FRAMEBUFFER_PARAMETERS { 389296c5ddc4Srjs enum mali_pre_post_frame_shader_mode pre_frame_0; 389396c5ddc4Srjs enum mali_pre_post_frame_shader_mode pre_frame_1; 389496c5ddc4Srjs enum mali_pre_post_frame_shader_mode post_frame; 389596c5ddc4Srjs uint64_t sample_locations; 389696c5ddc4Srjs uint64_t frame_shader_dcds; 389796c5ddc4Srjs uint32_t width; 389896c5ddc4Srjs uint32_t height; 389996c5ddc4Srjs uint32_t bound_min_x; 390096c5ddc4Srjs uint32_t bound_min_y; 390196c5ddc4Srjs uint32_t bound_max_x; 390296c5ddc4Srjs uint32_t bound_max_y; 390396c5ddc4Srjs uint32_t sample_count; 390496c5ddc4Srjs enum mali_sample_pattern sample_pattern; 390596c5ddc4Srjs enum mali_tie_break_rule tie_break_rule; 390696c5ddc4Srjs uint32_t effective_tile_size; 390796c5ddc4Srjs uint32_t x_downsampling_scale; 390896c5ddc4Srjs uint32_t y_downsampling_scale; 390996c5ddc4Srjs uint32_t render_target_count; 391096c5ddc4Srjs uint32_t color_buffer_allocation; 391196c5ddc4Srjs uint32_t s_clear; 391296c5ddc4Srjs bool s_write_enable; 391396c5ddc4Srjs bool s_preload_enable; 391496c5ddc4Srjs bool s_unload_enable; 391596c5ddc4Srjs enum mali_z_internal_format z_internal_format; 391696c5ddc4Srjs bool z_write_enable; 391796c5ddc4Srjs bool z_preload_enable; 391896c5ddc4Srjs bool z_unload_enable; 391996c5ddc4Srjs bool has_zs_crc_extension; 392096c5ddc4Srjs bool crc_read_enable; 392196c5ddc4Srjs bool crc_write_enable; 392296c5ddc4Srjs float z_clear; 392396c5ddc4Srjs uint64_t tiler; 392496c5ddc4Srjs}; 392596c5ddc4Srjs 392696c5ddc4Srjs#define MALI_FRAMEBUFFER_PARAMETERS_header \ 392796c5ddc4Srjs .sample_count = 1 392896c5ddc4Srjs 392996c5ddc4Srjsstatic inline void 393096c5ddc4SrjsMALI_FRAMEBUFFER_PARAMETERS_pack(uint32_t * restrict cl, 393196c5ddc4Srjs const struct MALI_FRAMEBUFFER_PARAMETERS * restrict values) 393296c5ddc4Srjs{ 393396c5ddc4Srjs assert(values->width >= 1); 393496c5ddc4Srjs assert(values->height >= 1); 393596c5ddc4Srjs assert(util_is_power_of_two_nonzero(values->sample_count)); 393696c5ddc4Srjs assert(util_is_power_of_two_nonzero(values->effective_tile_size)); 393796c5ddc4Srjs assert(values->render_target_count >= 1); 393896c5ddc4Srjs assert((values->color_buffer_allocation & 0x3ff) == 0); 393996c5ddc4Srjs cl[ 0] = __gen_uint(values->pre_frame_0, 0, 2) | 394096c5ddc4Srjs __gen_uint(values->pre_frame_1, 3, 5) | 394196c5ddc4Srjs __gen_uint(values->post_frame, 6, 8); 394296c5ddc4Srjs cl[ 1] = 0; 394396c5ddc4Srjs cl[ 2] = 0; 394496c5ddc4Srjs cl[ 3] = 0; 394596c5ddc4Srjs cl[ 4] = __gen_uint(values->sample_locations, 0, 63); 394696c5ddc4Srjs cl[ 5] = __gen_uint(values->sample_locations, 0, 63) >> 32; 394796c5ddc4Srjs cl[ 6] = __gen_uint(values->frame_shader_dcds, 0, 63); 394896c5ddc4Srjs cl[ 7] = __gen_uint(values->frame_shader_dcds, 0, 63) >> 32; 394996c5ddc4Srjs cl[ 8] = __gen_uint(values->width - 1, 0, 15) | 395096c5ddc4Srjs __gen_uint(values->height - 1, 16, 31); 395196c5ddc4Srjs cl[ 9] = __gen_uint(values->bound_min_x, 0, 15) | 395296c5ddc4Srjs __gen_uint(values->bound_min_y, 16, 31); 395396c5ddc4Srjs cl[10] = __gen_uint(values->bound_max_x, 0, 15) | 395496c5ddc4Srjs __gen_uint(values->bound_max_y, 16, 31); 395596c5ddc4Srjs cl[11] = __gen_uint(util_logbase2(values->sample_count), 0, 2) | 395696c5ddc4Srjs __gen_uint(values->sample_pattern, 3, 5) | 395796c5ddc4Srjs __gen_uint(values->tie_break_rule, 6, 8) | 395896c5ddc4Srjs __gen_uint(util_logbase2(values->effective_tile_size), 9, 12) | 395996c5ddc4Srjs __gen_uint(values->x_downsampling_scale, 13, 15) | 396096c5ddc4Srjs __gen_uint(values->y_downsampling_scale, 16, 18) | 396196c5ddc4Srjs __gen_uint(values->render_target_count - 1, 19, 22) | 396296c5ddc4Srjs __gen_uint(values->color_buffer_allocation >> 10, 24, 31); 396396c5ddc4Srjs cl[12] = __gen_uint(values->s_clear, 0, 7) | 396496c5ddc4Srjs __gen_uint(values->s_write_enable, 8, 8) | 396596c5ddc4Srjs __gen_uint(values->s_preload_enable, 9, 9) | 396696c5ddc4Srjs __gen_uint(values->s_unload_enable, 10, 10) | 396796c5ddc4Srjs __gen_uint(values->z_internal_format, 16, 17) | 396896c5ddc4Srjs __gen_uint(values->z_write_enable, 18, 18) | 396996c5ddc4Srjs __gen_uint(values->z_preload_enable, 19, 19) | 397096c5ddc4Srjs __gen_uint(values->z_unload_enable, 20, 20) | 397196c5ddc4Srjs __gen_uint(values->has_zs_crc_extension, 21, 21) | 397296c5ddc4Srjs __gen_uint(values->crc_read_enable, 30, 30) | 397396c5ddc4Srjs __gen_uint(values->crc_write_enable, 31, 31); 397496c5ddc4Srjs cl[13] = __gen_uint(fui(values->z_clear), 0, 32); 397596c5ddc4Srjs cl[14] = __gen_uint(values->tiler, 0, 63); 397696c5ddc4Srjs cl[15] = __gen_uint(values->tiler, 0, 63) >> 32; 397796c5ddc4Srjs} 397896c5ddc4Srjs 397996c5ddc4Srjs 398096c5ddc4Srjs#define MALI_FRAMEBUFFER_PARAMETERS_LENGTH 64 398196c5ddc4Srjsstruct mali_framebuffer_parameters_packed { uint32_t opaque[16]; }; 398296c5ddc4Srjsstatic inline void 398396c5ddc4SrjsMALI_FRAMEBUFFER_PARAMETERS_unpack(const uint8_t * restrict cl, 398496c5ddc4Srjs struct MALI_FRAMEBUFFER_PARAMETERS * restrict values) 398596c5ddc4Srjs{ 398696c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xfffffe00) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 0\n"); 398796c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 1\n"); 398896c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 2\n"); 398996c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 3\n"); 399096c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0x800000) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 11\n"); 399196c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0x3fc0f800) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 12\n"); 399296c5ddc4Srjs values->pre_frame_0 = (enum mali_pre_post_frame_shader_mode)__gen_unpack_uint(cl, 0, 2); 399396c5ddc4Srjs values->pre_frame_1 = (enum mali_pre_post_frame_shader_mode)__gen_unpack_uint(cl, 3, 5); 399496c5ddc4Srjs values->post_frame = (enum mali_pre_post_frame_shader_mode)__gen_unpack_uint(cl, 6, 8); 399596c5ddc4Srjs values->sample_locations = __gen_unpack_uint(cl, 128, 191); 399696c5ddc4Srjs values->frame_shader_dcds = __gen_unpack_uint(cl, 192, 255); 399796c5ddc4Srjs values->width = __gen_unpack_uint(cl, 256, 271) + 1; 399896c5ddc4Srjs values->height = __gen_unpack_uint(cl, 272, 287) + 1; 399996c5ddc4Srjs values->bound_min_x = __gen_unpack_uint(cl, 288, 303); 400096c5ddc4Srjs values->bound_min_y = __gen_unpack_uint(cl, 304, 319); 400196c5ddc4Srjs values->bound_max_x = __gen_unpack_uint(cl, 320, 335); 400296c5ddc4Srjs values->bound_max_y = __gen_unpack_uint(cl, 336, 351); 400396c5ddc4Srjs values->sample_count = 1U << __gen_unpack_uint(cl, 352, 354); 400496c5ddc4Srjs values->sample_pattern = (enum mali_sample_pattern)__gen_unpack_uint(cl, 355, 357); 400596c5ddc4Srjs values->tie_break_rule = (enum mali_tie_break_rule)__gen_unpack_uint(cl, 358, 360); 400696c5ddc4Srjs values->effective_tile_size = 1U << __gen_unpack_uint(cl, 361, 364); 400796c5ddc4Srjs values->x_downsampling_scale = __gen_unpack_uint(cl, 365, 367); 400896c5ddc4Srjs values->y_downsampling_scale = __gen_unpack_uint(cl, 368, 370); 400996c5ddc4Srjs values->render_target_count = __gen_unpack_uint(cl, 371, 374) + 1; 401096c5ddc4Srjs values->color_buffer_allocation = __gen_unpack_uint(cl, 376, 383) << 10; 401196c5ddc4Srjs values->s_clear = __gen_unpack_uint(cl, 384, 391); 401296c5ddc4Srjs values->s_write_enable = __gen_unpack_uint(cl, 392, 392); 401396c5ddc4Srjs values->s_preload_enable = __gen_unpack_uint(cl, 393, 393); 401496c5ddc4Srjs values->s_unload_enable = __gen_unpack_uint(cl, 394, 394); 401596c5ddc4Srjs values->z_internal_format = (enum mali_z_internal_format)__gen_unpack_uint(cl, 400, 401); 401696c5ddc4Srjs values->z_write_enable = __gen_unpack_uint(cl, 402, 402); 401796c5ddc4Srjs values->z_preload_enable = __gen_unpack_uint(cl, 403, 403); 401896c5ddc4Srjs values->z_unload_enable = __gen_unpack_uint(cl, 404, 404); 401996c5ddc4Srjs values->has_zs_crc_extension = __gen_unpack_uint(cl, 405, 405); 402096c5ddc4Srjs values->crc_read_enable = __gen_unpack_uint(cl, 414, 414); 402196c5ddc4Srjs values->crc_write_enable = __gen_unpack_uint(cl, 415, 415); 402296c5ddc4Srjs values->z_clear = __gen_unpack_float(cl, 416, 447); 402396c5ddc4Srjs values->tiler = __gen_unpack_uint(cl, 448, 511); 402496c5ddc4Srjs} 402596c5ddc4Srjs 402696c5ddc4Srjsstatic inline void 402796c5ddc4SrjsMALI_FRAMEBUFFER_PARAMETERS_print(FILE *fp, const struct MALI_FRAMEBUFFER_PARAMETERS * values, unsigned indent) 402896c5ddc4Srjs{ 402996c5ddc4Srjs fprintf(fp, "%*sPre Frame 0: %s\n", indent, "", mali_pre_post_frame_shader_mode_as_str(values->pre_frame_0)); 403096c5ddc4Srjs fprintf(fp, "%*sPre Frame 1: %s\n", indent, "", mali_pre_post_frame_shader_mode_as_str(values->pre_frame_1)); 403196c5ddc4Srjs fprintf(fp, "%*sPost Frame: %s\n", indent, "", mali_pre_post_frame_shader_mode_as_str(values->post_frame)); 403296c5ddc4Srjs fprintf(fp, "%*sSample Locations: 0x%" PRIx64 "\n", indent, "", values->sample_locations); 403396c5ddc4Srjs fprintf(fp, "%*sFrame Shader DCDs: 0x%" PRIx64 "\n", indent, "", values->frame_shader_dcds); 403496c5ddc4Srjs fprintf(fp, "%*sWidth: %u\n", indent, "", values->width); 403596c5ddc4Srjs fprintf(fp, "%*sHeight: %u\n", indent, "", values->height); 403696c5ddc4Srjs fprintf(fp, "%*sBound Min X: %u\n", indent, "", values->bound_min_x); 403796c5ddc4Srjs fprintf(fp, "%*sBound Min Y: %u\n", indent, "", values->bound_min_y); 403896c5ddc4Srjs fprintf(fp, "%*sBound Max X: %u\n", indent, "", values->bound_max_x); 403996c5ddc4Srjs fprintf(fp, "%*sBound Max Y: %u\n", indent, "", values->bound_max_y); 404096c5ddc4Srjs fprintf(fp, "%*sSample Count: %u\n", indent, "", values->sample_count); 404196c5ddc4Srjs fprintf(fp, "%*sSample Pattern: %s\n", indent, "", mali_sample_pattern_as_str(values->sample_pattern)); 404296c5ddc4Srjs fprintf(fp, "%*sTie-Break Rule: %s\n", indent, "", mali_tie_break_rule_as_str(values->tie_break_rule)); 404396c5ddc4Srjs fprintf(fp, "%*sEffective Tile Size: %u\n", indent, "", values->effective_tile_size); 404496c5ddc4Srjs fprintf(fp, "%*sX Downsampling Scale: %u\n", indent, "", values->x_downsampling_scale); 404596c5ddc4Srjs fprintf(fp, "%*sY Downsampling Scale: %u\n", indent, "", values->y_downsampling_scale); 404696c5ddc4Srjs fprintf(fp, "%*sRender Target Count: %u\n", indent, "", values->render_target_count); 404796c5ddc4Srjs fprintf(fp, "%*sColor Buffer Allocation: %u\n", indent, "", values->color_buffer_allocation); 404896c5ddc4Srjs fprintf(fp, "%*sS Clear: %u\n", indent, "", values->s_clear); 404996c5ddc4Srjs fprintf(fp, "%*sS Write Enable: %s\n", indent, "", values->s_write_enable ? "true" : "false"); 405096c5ddc4Srjs fprintf(fp, "%*sS Preload Enable: %s\n", indent, "", values->s_preload_enable ? "true" : "false"); 405196c5ddc4Srjs fprintf(fp, "%*sS Unload Enable: %s\n", indent, "", values->s_unload_enable ? "true" : "false"); 405296c5ddc4Srjs fprintf(fp, "%*sZ Internal Format: %s\n", indent, "", mali_z_internal_format_as_str(values->z_internal_format)); 405396c5ddc4Srjs fprintf(fp, "%*sZ Write Enable: %s\n", indent, "", values->z_write_enable ? "true" : "false"); 405496c5ddc4Srjs fprintf(fp, "%*sZ Preload Enable: %s\n", indent, "", values->z_preload_enable ? "true" : "false"); 405596c5ddc4Srjs fprintf(fp, "%*sZ Unload Enable: %s\n", indent, "", values->z_unload_enable ? "true" : "false"); 405696c5ddc4Srjs fprintf(fp, "%*sHas ZS CRC Extension: %s\n", indent, "", values->has_zs_crc_extension ? "true" : "false"); 405796c5ddc4Srjs fprintf(fp, "%*sCRC Read Enable: %s\n", indent, "", values->crc_read_enable ? "true" : "false"); 405896c5ddc4Srjs fprintf(fp, "%*sCRC Write Enable: %s\n", indent, "", values->crc_write_enable ? "true" : "false"); 405996c5ddc4Srjs fprintf(fp, "%*sZ Clear: %f\n", indent, "", values->z_clear); 406096c5ddc4Srjs fprintf(fp, "%*sTiler: 0x%" PRIx64 "\n", indent, "", values->tiler); 406196c5ddc4Srjs} 406296c5ddc4Srjs 406396c5ddc4Srjsstruct MALI_ZS_CRC_EXTENSION { 406496c5ddc4Srjs uint64_t crc_base; 406596c5ddc4Srjs uint32_t crc_row_stride; 406696c5ddc4Srjs enum mali_zs_format zs_write_format; 406796c5ddc4Srjs enum mali_block_format zs_block_format; 406896c5ddc4Srjs enum mali_msaa zs_msaa; 406996c5ddc4Srjs bool zs_big_endian; 407096c5ddc4Srjs bool zs_clean_pixel_write_enable; 407196c5ddc4Srjs enum mali_s_format s_write_format; 407296c5ddc4Srjs enum mali_block_format s_block_format; 407396c5ddc4Srjs enum mali_msaa s_msaa; 407496c5ddc4Srjs uint64_t zs_writeback_base; 407596c5ddc4Srjs uint32_t zs_writeback_row_stride; 407696c5ddc4Srjs uint32_t zs_writeback_surface_stride; 407796c5ddc4Srjs uint64_t s_writeback_base; 407896c5ddc4Srjs uint32_t s_writeback_row_stride; 407996c5ddc4Srjs uint32_t s_writeback_surface_stride; 408096c5ddc4Srjs uint64_t zs_afbc_header; 408196c5ddc4Srjs uint32_t zs_afbc_row_stride; 408296c5ddc4Srjs uint64_t zs_afbc_body; 408396c5ddc4Srjs}; 408496c5ddc4Srjs 408596c5ddc4Srjs#define MALI_ZS_CRC_EXTENSION_header \ 408696c5ddc4Srjs .zs_msaa = MALI_MSAA_SINGLE, \ 408796c5ddc4Srjs .s_msaa = MALI_MSAA_SINGLE 408896c5ddc4Srjs 408996c5ddc4Srjsstatic inline void 409096c5ddc4SrjsMALI_ZS_CRC_EXTENSION_pack(uint32_t * restrict cl, 409196c5ddc4Srjs const struct MALI_ZS_CRC_EXTENSION * restrict values) 409296c5ddc4Srjs{ 409396c5ddc4Srjs cl[ 0] = __gen_uint(values->crc_base, 0, 63); 409496c5ddc4Srjs cl[ 1] = __gen_uint(values->crc_base, 0, 63) >> 32; 409596c5ddc4Srjs cl[ 2] = __gen_uint(values->crc_row_stride, 0, 31); 409696c5ddc4Srjs cl[ 3] = __gen_uint(values->zs_write_format, 0, 3) | 409796c5ddc4Srjs __gen_uint(values->zs_block_format, 4, 5) | 409896c5ddc4Srjs __gen_uint(values->zs_msaa, 6, 7) | 409996c5ddc4Srjs __gen_uint(values->zs_big_endian, 8, 8) | 410096c5ddc4Srjs __gen_uint(values->zs_clean_pixel_write_enable, 10, 10) | 410196c5ddc4Srjs __gen_uint(values->s_write_format, 16, 19) | 410296c5ddc4Srjs __gen_uint(values->s_block_format, 20, 21) | 410396c5ddc4Srjs __gen_uint(values->s_msaa, 22, 23); 410496c5ddc4Srjs cl[ 4] = __gen_uint(values->zs_writeback_base, 0, 63) | 410596c5ddc4Srjs __gen_uint(values->zs_afbc_header, 0, 63); 410696c5ddc4Srjs cl[ 5] = __gen_uint(values->zs_writeback_base, 0, 63) >> 32 | 410796c5ddc4Srjs __gen_uint(values->zs_afbc_header, 0, 63) >> 32; 410896c5ddc4Srjs cl[ 6] = __gen_uint(values->zs_writeback_row_stride, 0, 31) | 410996c5ddc4Srjs __gen_uint(values->zs_afbc_row_stride, 0, 12); 411096c5ddc4Srjs cl[ 7] = __gen_uint(values->zs_writeback_surface_stride, 0, 31); 411196c5ddc4Srjs cl[ 8] = __gen_uint(values->s_writeback_base, 0, 63) | 411296c5ddc4Srjs __gen_uint(values->zs_afbc_body, 0, 63); 411396c5ddc4Srjs cl[ 9] = __gen_uint(values->s_writeback_base, 0, 63) >> 32 | 411496c5ddc4Srjs __gen_uint(values->zs_afbc_body, 0, 63) >> 32; 411596c5ddc4Srjs cl[10] = __gen_uint(values->s_writeback_row_stride, 0, 31); 411696c5ddc4Srjs cl[11] = __gen_uint(values->s_writeback_surface_stride, 0, 31); 411796c5ddc4Srjs cl[12] = 0; 411896c5ddc4Srjs cl[13] = 0; 411996c5ddc4Srjs cl[14] = 0; 412096c5ddc4Srjs cl[15] = 0; 412196c5ddc4Srjs} 412296c5ddc4Srjs 412396c5ddc4Srjs 412496c5ddc4Srjs#define MALI_ZS_CRC_EXTENSION_LENGTH 64 412596c5ddc4Srjs#define MALI_ZS_CRC_EXTENSION_ALIGN 64 412696c5ddc4Srjsstruct mali_zs_crc_extension_packed { uint32_t opaque[16]; }; 412796c5ddc4Srjsstatic inline void 412896c5ddc4SrjsMALI_ZS_CRC_EXTENSION_unpack(const uint8_t * restrict cl, 412996c5ddc4Srjs struct MALI_ZS_CRC_EXTENSION * restrict values) 413096c5ddc4Srjs{ 413196c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xff00fa00) fprintf(stderr, "XXX: Invalid field of ZS CRC Extension unpacked at word 3\n"); 413296c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of ZS CRC Extension unpacked at word 12\n"); 413396c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of ZS CRC Extension unpacked at word 13\n"); 413496c5ddc4Srjs if (((const uint32_t *) cl)[14] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of ZS CRC Extension unpacked at word 14\n"); 413596c5ddc4Srjs if (((const uint32_t *) cl)[15] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of ZS CRC Extension unpacked at word 15\n"); 413696c5ddc4Srjs values->crc_base = __gen_unpack_uint(cl, 0, 63); 413796c5ddc4Srjs values->crc_row_stride = __gen_unpack_uint(cl, 64, 95); 413896c5ddc4Srjs values->zs_write_format = (enum mali_zs_format)__gen_unpack_uint(cl, 96, 99); 413996c5ddc4Srjs values->zs_block_format = (enum mali_block_format)__gen_unpack_uint(cl, 100, 101); 414096c5ddc4Srjs values->zs_msaa = (enum mali_msaa)__gen_unpack_uint(cl, 102, 103); 414196c5ddc4Srjs values->zs_big_endian = __gen_unpack_uint(cl, 104, 104); 414296c5ddc4Srjs values->zs_clean_pixel_write_enable = __gen_unpack_uint(cl, 106, 106); 414396c5ddc4Srjs values->s_write_format = (enum mali_s_format)__gen_unpack_uint(cl, 112, 115); 414496c5ddc4Srjs values->s_block_format = (enum mali_block_format)__gen_unpack_uint(cl, 116, 117); 414596c5ddc4Srjs values->s_msaa = (enum mali_msaa)__gen_unpack_uint(cl, 118, 119); 414696c5ddc4Srjs values->zs_writeback_base = __gen_unpack_uint(cl, 128, 191); 414796c5ddc4Srjs values->zs_writeback_row_stride = __gen_unpack_uint(cl, 192, 223); 414896c5ddc4Srjs values->zs_writeback_surface_stride = __gen_unpack_uint(cl, 224, 255); 414996c5ddc4Srjs values->s_writeback_base = __gen_unpack_uint(cl, 256, 319); 415096c5ddc4Srjs values->s_writeback_row_stride = __gen_unpack_uint(cl, 320, 351); 415196c5ddc4Srjs values->s_writeback_surface_stride = __gen_unpack_uint(cl, 352, 383); 415296c5ddc4Srjs values->zs_afbc_header = __gen_unpack_uint(cl, 128, 191); 415396c5ddc4Srjs values->zs_afbc_row_stride = __gen_unpack_uint(cl, 192, 204); 415496c5ddc4Srjs values->zs_afbc_body = __gen_unpack_uint(cl, 256, 319); 415596c5ddc4Srjs} 415696c5ddc4Srjs 415796c5ddc4Srjsstatic inline void 415896c5ddc4SrjsMALI_ZS_CRC_EXTENSION_print(FILE *fp, const struct MALI_ZS_CRC_EXTENSION * values, unsigned indent) 415996c5ddc4Srjs{ 416096c5ddc4Srjs fprintf(fp, "%*sCRC Base: 0x%" PRIx64 "\n", indent, "", values->crc_base); 416196c5ddc4Srjs fprintf(fp, "%*sCRC Row Stride: %u\n", indent, "", values->crc_row_stride); 416296c5ddc4Srjs fprintf(fp, "%*sZS Write Format: %s\n", indent, "", mali_zs_format_as_str(values->zs_write_format)); 416396c5ddc4Srjs fprintf(fp, "%*sZS Block Format: %s\n", indent, "", mali_block_format_as_str(values->zs_block_format)); 416496c5ddc4Srjs fprintf(fp, "%*sZS MSAA: %s\n", indent, "", mali_msaa_as_str(values->zs_msaa)); 416596c5ddc4Srjs fprintf(fp, "%*sZS Big Endian: %s\n", indent, "", values->zs_big_endian ? "true" : "false"); 416696c5ddc4Srjs fprintf(fp, "%*sZS Clean Pixel Write Enable: %s\n", indent, "", values->zs_clean_pixel_write_enable ? "true" : "false"); 416796c5ddc4Srjs fprintf(fp, "%*sS Write Format: %s\n", indent, "", mali_s_format_as_str(values->s_write_format)); 416896c5ddc4Srjs fprintf(fp, "%*sS Block Format: %s\n", indent, "", mali_block_format_as_str(values->s_block_format)); 416996c5ddc4Srjs fprintf(fp, "%*sS MSAA: %s\n", indent, "", mali_msaa_as_str(values->s_msaa)); 417096c5ddc4Srjs fprintf(fp, "%*sZS Writeback Base: 0x%" PRIx64 "\n", indent, "", values->zs_writeback_base); 417196c5ddc4Srjs fprintf(fp, "%*sZS Writeback Row Stride: %u\n", indent, "", values->zs_writeback_row_stride); 417296c5ddc4Srjs fprintf(fp, "%*sZS Writeback Surface Stride: %u\n", indent, "", values->zs_writeback_surface_stride); 417396c5ddc4Srjs fprintf(fp, "%*sS Writeback Base: 0x%" PRIx64 "\n", indent, "", values->s_writeback_base); 417496c5ddc4Srjs fprintf(fp, "%*sS Writeback Row Stride: %u\n", indent, "", values->s_writeback_row_stride); 417596c5ddc4Srjs fprintf(fp, "%*sS Writeback Surface Stride: %u\n", indent, "", values->s_writeback_surface_stride); 417696c5ddc4Srjs fprintf(fp, "%*sZS AFBC Header: 0x%" PRIx64 "\n", indent, "", values->zs_afbc_header); 417796c5ddc4Srjs fprintf(fp, "%*sZS AFBC Row Stride: %u\n", indent, "", values->zs_afbc_row_stride); 417896c5ddc4Srjs fprintf(fp, "%*sZS AFBC Body: 0x%" PRIx64 "\n", indent, "", values->zs_afbc_body); 417996c5ddc4Srjs} 418096c5ddc4Srjs 418196c5ddc4Srjsenum mali_rt_endianness { 418296c5ddc4Srjs MALI_RT_ENDIANNESS_LITTLE_ENDIAN = 0, 418396c5ddc4Srjs MALI_RT_ENDIANNESS_BIG_ENDIAN_2B = 1, 418496c5ddc4Srjs MALI_RT_ENDIANNESS_BIG_ENDIAN_4B = 2, 418596c5ddc4Srjs MALI_RT_ENDIANNESS_BIG_ENDIAN_8B = 3, 418696c5ddc4Srjs}; 418796c5ddc4Srjs 418896c5ddc4Srjsstatic inline const char * 418996c5ddc4Srjsmali_rt_endianness_as_str(enum mali_rt_endianness imm) 419096c5ddc4Srjs{ 419196c5ddc4Srjs switch (imm) { 419296c5ddc4Srjs case MALI_RT_ENDIANNESS_LITTLE_ENDIAN: return "Little Endian"; 419396c5ddc4Srjs case MALI_RT_ENDIANNESS_BIG_ENDIAN_2B: return "Big Endian 2B"; 419496c5ddc4Srjs case MALI_RT_ENDIANNESS_BIG_ENDIAN_4B: return "Big Endian 4B"; 419596c5ddc4Srjs case MALI_RT_ENDIANNESS_BIG_ENDIAN_8B: return "Big Endian 8B"; 419696c5ddc4Srjs default: return "XXX: INVALID"; 419796c5ddc4Srjs } 419896c5ddc4Srjs} 419996c5ddc4Srjs 420096c5ddc4Srjsenum mali_yuv_conv_k6 { 420196c5ddc4Srjs MALI_YUV_CONV_K6_0 = 0, 420296c5ddc4Srjs MALI_YUV_CONV_K6_16 = 1, 420396c5ddc4Srjs}; 420496c5ddc4Srjs 420596c5ddc4Srjsstatic inline const char * 420696c5ddc4Srjsmali_yuv_conv_k6_as_str(enum mali_yuv_conv_k6 imm) 420796c5ddc4Srjs{ 420896c5ddc4Srjs switch (imm) { 420996c5ddc4Srjs case MALI_YUV_CONV_K6_0: return "0"; 421096c5ddc4Srjs case MALI_YUV_CONV_K6_16: return "16"; 421196c5ddc4Srjs default: return "XXX: INVALID"; 421296c5ddc4Srjs } 421396c5ddc4Srjs} 421496c5ddc4Srjs 421596c5ddc4Srjsenum mali_yuv_conv_k7_clamp { 421696c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_MINUS_128_TO_127 = 0, 421796c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_MINUS_112_TO_111 = 1, 421896c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_0_TO_255 = 2, 421996c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_16_TO_239 = 3, 422096c5ddc4Srjs}; 422196c5ddc4Srjs 422296c5ddc4Srjsstatic inline const char * 422396c5ddc4Srjsmali_yuv_conv_k7_clamp_as_str(enum mali_yuv_conv_k7_clamp imm) 422496c5ddc4Srjs{ 422596c5ddc4Srjs switch (imm) { 422696c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_MINUS_128_TO_127: return "MINUS_128_TO_127"; 422796c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_MINUS_112_TO_111: return "MINUS_112_TO_111"; 422896c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_0_TO_255: return "0_TO_255"; 422996c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_16_TO_239: return "16_TO_239"; 423096c5ddc4Srjs default: return "XXX: INVALID"; 423196c5ddc4Srjs } 423296c5ddc4Srjs} 423396c5ddc4Srjs 423496c5ddc4Srjsenum mali_yuv_conv_k8 { 423596c5ddc4Srjs MALI_YUV_CONV_K8_220 = 0, 423696c5ddc4Srjs MALI_YUV_CONV_K8_256 = 1, 423796c5ddc4Srjs}; 423896c5ddc4Srjs 423996c5ddc4Srjsstatic inline const char * 424096c5ddc4Srjsmali_yuv_conv_k8_as_str(enum mali_yuv_conv_k8 imm) 424196c5ddc4Srjs{ 424296c5ddc4Srjs switch (imm) { 424396c5ddc4Srjs case MALI_YUV_CONV_K8_220: return "220"; 424496c5ddc4Srjs case MALI_YUV_CONV_K8_256: return "256"; 424596c5ddc4Srjs default: return "XXX: INVALID"; 424696c5ddc4Srjs } 424796c5ddc4Srjs} 424896c5ddc4Srjs 424996c5ddc4Srjsstruct MALI_RENDER_TARGET_YUV_OVERLAY { 425096c5ddc4Srjs enum mali_yuv_swizzle swizzle; 425196c5ddc4Srjs bool full_range; 425296c5ddc4Srjs enum mali_yuv_conversion_mode conversion_mode; 425396c5ddc4Srjs enum mali_yuv_cr_siting cr_siting; 425496c5ddc4Srjs bool unsigned_cr_range; 425596c5ddc4Srjs uint64_t plane_0_base; 425696c5ddc4Srjs uint64_t plane_1_base; 425796c5ddc4Srjs uint64_t plane_2_base; 425896c5ddc4Srjs uint32_t plane_0_stride; 425996c5ddc4Srjs uint32_t plane_1_2_stride; 426096c5ddc4Srjs}; 426196c5ddc4Srjs 426296c5ddc4Srjs#define MALI_RENDER_TARGET_YUV_OVERLAY_header \ 426396c5ddc4Srjs 0 426496c5ddc4Srjs 426596c5ddc4Srjsstatic inline void 426696c5ddc4SrjsMALI_RENDER_TARGET_YUV_OVERLAY_pack(uint32_t * restrict cl, 426796c5ddc4Srjs const struct MALI_RENDER_TARGET_YUV_OVERLAY * restrict values) 426896c5ddc4Srjs{ 426996c5ddc4Srjs cl[ 0] = 0; 427096c5ddc4Srjs cl[ 1] = 0; 427196c5ddc4Srjs cl[ 2] = __gen_uint(values->swizzle, 16, 18) | 427296c5ddc4Srjs __gen_uint(values->full_range, 20, 20) | 427396c5ddc4Srjs __gen_uint(values->conversion_mode, 21, 24) | 427496c5ddc4Srjs __gen_uint(values->cr_siting, 25, 27) | 427596c5ddc4Srjs __gen_uint(values->unsigned_cr_range, 28, 28); 427696c5ddc4Srjs cl[ 3] = 0; 427796c5ddc4Srjs cl[ 4] = __gen_uint(values->plane_0_base, 0, 63); 427896c5ddc4Srjs cl[ 5] = __gen_uint(values->plane_0_base, 0, 63) >> 32; 427996c5ddc4Srjs cl[ 6] = __gen_uint(values->plane_1_base, 0, 63); 428096c5ddc4Srjs cl[ 7] = __gen_uint(values->plane_1_base, 0, 63) >> 32; 428196c5ddc4Srjs cl[ 8] = __gen_uint(values->plane_2_base, 0, 63); 428296c5ddc4Srjs cl[ 9] = __gen_uint(values->plane_2_base, 0, 63) >> 32; 428396c5ddc4Srjs cl[10] = __gen_uint(values->plane_0_stride, 0, 31); 428496c5ddc4Srjs cl[11] = __gen_uint(values->plane_1_2_stride, 0, 31); 428596c5ddc4Srjs cl[12] = 0; 428696c5ddc4Srjs cl[13] = 0; 428796c5ddc4Srjs cl[14] = 0; 428896c5ddc4Srjs cl[15] = 0; 428996c5ddc4Srjs} 429096c5ddc4Srjs 429196c5ddc4Srjs 429296c5ddc4Srjs#define MALI_RENDER_TARGET_YUV_OVERLAY_LENGTH 64 429396c5ddc4Srjsstruct mali_render_target_yuv_overlay_packed { uint32_t opaque[16]; }; 429496c5ddc4Srjsstatic inline void 429596c5ddc4SrjsMALI_RENDER_TARGET_YUV_OVERLAY_unpack(const uint8_t * restrict cl, 429696c5ddc4Srjs struct MALI_RENDER_TARGET_YUV_OVERLAY * restrict values) 429796c5ddc4Srjs{ 429896c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 0\n"); 429996c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 1\n"); 430096c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xe008ffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 2\n"); 430196c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 3\n"); 430296c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 12\n"); 430396c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 13\n"); 430496c5ddc4Srjs if (((const uint32_t *) cl)[14] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 14\n"); 430596c5ddc4Srjs if (((const uint32_t *) cl)[15] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 15\n"); 430696c5ddc4Srjs values->swizzle = (enum mali_yuv_swizzle)__gen_unpack_uint(cl, 80, 82); 430796c5ddc4Srjs values->full_range = __gen_unpack_uint(cl, 84, 84); 430896c5ddc4Srjs values->conversion_mode = (enum mali_yuv_conversion_mode)__gen_unpack_uint(cl, 85, 88); 430996c5ddc4Srjs values->cr_siting = (enum mali_yuv_cr_siting)__gen_unpack_uint(cl, 89, 91); 431096c5ddc4Srjs values->unsigned_cr_range = __gen_unpack_uint(cl, 92, 92); 431196c5ddc4Srjs values->plane_0_base = __gen_unpack_uint(cl, 128, 191); 431296c5ddc4Srjs values->plane_1_base = __gen_unpack_uint(cl, 192, 255); 431396c5ddc4Srjs values->plane_2_base = __gen_unpack_uint(cl, 256, 319); 431496c5ddc4Srjs values->plane_0_stride = __gen_unpack_uint(cl, 320, 351); 431596c5ddc4Srjs values->plane_1_2_stride = __gen_unpack_uint(cl, 352, 383); 431696c5ddc4Srjs} 431796c5ddc4Srjs 431896c5ddc4Srjsstatic inline void 431996c5ddc4SrjsMALI_RENDER_TARGET_YUV_OVERLAY_print(FILE *fp, const struct MALI_RENDER_TARGET_YUV_OVERLAY * values, unsigned indent) 432096c5ddc4Srjs{ 432196c5ddc4Srjs fprintf(fp, "%*sSwizzle: %s\n", indent, "", mali_yuv_swizzle_as_str(values->swizzle)); 432296c5ddc4Srjs fprintf(fp, "%*sFull Range: %s\n", indent, "", values->full_range ? "true" : "false"); 432396c5ddc4Srjs fprintf(fp, "%*sConversion Mode: %s\n", indent, "", mali_yuv_conversion_mode_as_str(values->conversion_mode)); 432496c5ddc4Srjs fprintf(fp, "%*sCr Siting: %s\n", indent, "", mali_yuv_cr_siting_as_str(values->cr_siting)); 432596c5ddc4Srjs fprintf(fp, "%*sUnsigned Cr Range: %s\n", indent, "", values->unsigned_cr_range ? "true" : "false"); 432696c5ddc4Srjs fprintf(fp, "%*sPlane 0 Base: 0x%" PRIx64 "\n", indent, "", values->plane_0_base); 432796c5ddc4Srjs fprintf(fp, "%*sPlane 1 Base: 0x%" PRIx64 "\n", indent, "", values->plane_1_base); 432896c5ddc4Srjs fprintf(fp, "%*sPlane 2 Base: 0x%" PRIx64 "\n", indent, "", values->plane_2_base); 432996c5ddc4Srjs fprintf(fp, "%*sPlane 0 Stride: %u\n", indent, "", values->plane_0_stride); 433096c5ddc4Srjs fprintf(fp, "%*sPlane 1 2 Stride: %u\n", indent, "", values->plane_1_2_stride); 433196c5ddc4Srjs} 433296c5ddc4Srjs 433396c5ddc4Srjsstruct MALI_RENDER_TARGET_AFBC_OVERLAY { 433496c5ddc4Srjs uint64_t header; 433596c5ddc4Srjs uint32_t row_stride; 433696c5ddc4Srjs uint32_t chunk_size; 433796c5ddc4Srjs bool afbc_split_block_enable; 433896c5ddc4Srjs bool afbc_wide_block_enable; 433996c5ddc4Srjs bool reverse_issue_order; 434096c5ddc4Srjs bool yuv_transform_enable; 434196c5ddc4Srjs uint64_t body; 434296c5ddc4Srjs uint32_t body_size; 434396c5ddc4Srjs}; 434496c5ddc4Srjs 434596c5ddc4Srjs#define MALI_RENDER_TARGET_AFBC_OVERLAY_header \ 434696c5ddc4Srjs 0 434796c5ddc4Srjs 434896c5ddc4Srjsstatic inline void 434996c5ddc4SrjsMALI_RENDER_TARGET_AFBC_OVERLAY_pack(uint32_t * restrict cl, 435096c5ddc4Srjs const struct MALI_RENDER_TARGET_AFBC_OVERLAY * restrict values) 435196c5ddc4Srjs{ 435296c5ddc4Srjs cl[ 0] = 0; 435396c5ddc4Srjs cl[ 1] = 0; 435496c5ddc4Srjs cl[ 2] = 0; 435596c5ddc4Srjs cl[ 3] = 0; 435696c5ddc4Srjs cl[ 4] = __gen_uint(values->header, 0, 63); 435796c5ddc4Srjs cl[ 5] = __gen_uint(values->header, 0, 63) >> 32; 435896c5ddc4Srjs cl[ 6] = __gen_uint(values->row_stride, 0, 12); 435996c5ddc4Srjs cl[ 7] = __gen_uint(values->chunk_size, 0, 11) | 436096c5ddc4Srjs __gen_uint(values->afbc_split_block_enable, 18, 18) | 436196c5ddc4Srjs __gen_uint(values->afbc_wide_block_enable, 19, 19) | 436296c5ddc4Srjs __gen_uint(values->reverse_issue_order, 20, 20) | 436396c5ddc4Srjs __gen_uint(values->yuv_transform_enable, 17, 17); 436496c5ddc4Srjs cl[ 8] = __gen_uint(values->body, 0, 63); 436596c5ddc4Srjs cl[ 9] = __gen_uint(values->body, 0, 63) >> 32; 436696c5ddc4Srjs cl[10] = __gen_uint(values->body_size, 0, 31); 436796c5ddc4Srjs cl[11] = 0; 436896c5ddc4Srjs cl[12] = 0; 436996c5ddc4Srjs cl[13] = 0; 437096c5ddc4Srjs cl[14] = 0; 437196c5ddc4Srjs cl[15] = 0; 437296c5ddc4Srjs} 437396c5ddc4Srjs 437496c5ddc4Srjs 437596c5ddc4Srjs#define MALI_RENDER_TARGET_AFBC_OVERLAY_LENGTH 64 437696c5ddc4Srjsstruct mali_render_target_afbc_overlay_packed { uint32_t opaque[16]; }; 437796c5ddc4Srjsstatic inline void 437896c5ddc4SrjsMALI_RENDER_TARGET_AFBC_OVERLAY_unpack(const uint8_t * restrict cl, 437996c5ddc4Srjs struct MALI_RENDER_TARGET_AFBC_OVERLAY * restrict values) 438096c5ddc4Srjs{ 438196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 0\n"); 438296c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 1\n"); 438396c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 2\n"); 438496c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 3\n"); 438596c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffe000) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 6\n"); 438696c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffe1f000) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 7\n"); 438796c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 11\n"); 438896c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 12\n"); 438996c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 13\n"); 439096c5ddc4Srjs if (((const uint32_t *) cl)[14] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 14\n"); 439196c5ddc4Srjs if (((const uint32_t *) cl)[15] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 15\n"); 439296c5ddc4Srjs values->header = __gen_unpack_uint(cl, 128, 191); 439396c5ddc4Srjs values->row_stride = __gen_unpack_uint(cl, 192, 204); 439496c5ddc4Srjs values->chunk_size = __gen_unpack_uint(cl, 224, 235); 439596c5ddc4Srjs values->afbc_split_block_enable = __gen_unpack_uint(cl, 242, 242); 439696c5ddc4Srjs values->afbc_wide_block_enable = __gen_unpack_uint(cl, 243, 243); 439796c5ddc4Srjs values->reverse_issue_order = __gen_unpack_uint(cl, 244, 244); 439896c5ddc4Srjs values->yuv_transform_enable = __gen_unpack_uint(cl, 241, 241); 439996c5ddc4Srjs values->body = __gen_unpack_uint(cl, 256, 319); 440096c5ddc4Srjs values->body_size = __gen_unpack_uint(cl, 320, 351); 440196c5ddc4Srjs} 440296c5ddc4Srjs 440396c5ddc4Srjsstatic inline void 440496c5ddc4SrjsMALI_RENDER_TARGET_AFBC_OVERLAY_print(FILE *fp, const struct MALI_RENDER_TARGET_AFBC_OVERLAY * values, unsigned indent) 440596c5ddc4Srjs{ 440696c5ddc4Srjs fprintf(fp, "%*sHeader: 0x%" PRIx64 "\n", indent, "", values->header); 440796c5ddc4Srjs fprintf(fp, "%*sRow Stride: %u\n", indent, "", values->row_stride); 440896c5ddc4Srjs fprintf(fp, "%*sChunk Size: %u\n", indent, "", values->chunk_size); 440996c5ddc4Srjs fprintf(fp, "%*sAFBC Split Block Enable: %s\n", indent, "", values->afbc_split_block_enable ? "true" : "false"); 441096c5ddc4Srjs fprintf(fp, "%*sAFBC Wide Block Enable: %s\n", indent, "", values->afbc_wide_block_enable ? "true" : "false"); 441196c5ddc4Srjs fprintf(fp, "%*sReverse Issue Order: %s\n", indent, "", values->reverse_issue_order ? "true" : "false"); 441296c5ddc4Srjs fprintf(fp, "%*sYUV Transform Enable: %s\n", indent, "", values->yuv_transform_enable ? "true" : "false"); 441396c5ddc4Srjs fprintf(fp, "%*sBody: 0x%" PRIx64 "\n", indent, "", values->body); 441496c5ddc4Srjs fprintf(fp, "%*sBody Size: %u\n", indent, "", values->body_size); 441596c5ddc4Srjs} 441696c5ddc4Srjs 441796c5ddc4Srjsstruct MALI_RT_CLEAR { 441896c5ddc4Srjs uint32_t color_0; 441996c5ddc4Srjs uint32_t color_1; 442096c5ddc4Srjs uint32_t color_2; 442196c5ddc4Srjs uint32_t color_3; 442296c5ddc4Srjs}; 442396c5ddc4Srjs 442496c5ddc4Srjs#define MALI_RT_CLEAR_header \ 442596c5ddc4Srjs 0 442696c5ddc4Srjs 442796c5ddc4Srjsstatic inline void 442896c5ddc4SrjsMALI_RT_CLEAR_pack(uint32_t * restrict cl, 442996c5ddc4Srjs const struct MALI_RT_CLEAR * restrict values) 443096c5ddc4Srjs{ 443196c5ddc4Srjs cl[ 0] = __gen_uint(values->color_0, 0, 31); 443296c5ddc4Srjs cl[ 1] = __gen_uint(values->color_1, 0, 31); 443396c5ddc4Srjs cl[ 2] = __gen_uint(values->color_2, 0, 31); 443496c5ddc4Srjs cl[ 3] = __gen_uint(values->color_3, 0, 31); 443596c5ddc4Srjs} 443696c5ddc4Srjs 443796c5ddc4Srjs 443896c5ddc4Srjs#define MALI_RT_CLEAR_LENGTH 16 443996c5ddc4Srjsstruct mali_rt_clear_packed { uint32_t opaque[4]; }; 444096c5ddc4Srjsstatic inline void 444196c5ddc4SrjsMALI_RT_CLEAR_unpack(const uint8_t * restrict cl, 444296c5ddc4Srjs struct MALI_RT_CLEAR * restrict values) 444396c5ddc4Srjs{ 444496c5ddc4Srjs values->color_0 = __gen_unpack_uint(cl, 0, 31); 444596c5ddc4Srjs values->color_1 = __gen_unpack_uint(cl, 32, 63); 444696c5ddc4Srjs values->color_2 = __gen_unpack_uint(cl, 64, 95); 444796c5ddc4Srjs values->color_3 = __gen_unpack_uint(cl, 96, 127); 444896c5ddc4Srjs} 444996c5ddc4Srjs 445096c5ddc4Srjsstatic inline void 445196c5ddc4SrjsMALI_RT_CLEAR_print(FILE *fp, const struct MALI_RT_CLEAR * values, unsigned indent) 445296c5ddc4Srjs{ 445396c5ddc4Srjs fprintf(fp, "%*sColor 0: %u\n", indent, "", values->color_0); 445496c5ddc4Srjs fprintf(fp, "%*sColor 1: %u\n", indent, "", values->color_1); 445596c5ddc4Srjs fprintf(fp, "%*sColor 2: %u\n", indent, "", values->color_2); 445696c5ddc4Srjs fprintf(fp, "%*sColor 3: %u\n", indent, "", values->color_3); 445796c5ddc4Srjs} 445896c5ddc4Srjs 445996c5ddc4Srjsstruct MALI_RENDER_TARGET { 446096c5ddc4Srjs struct MALI_RENDER_TARGET_YUV_OVERLAY yuv; 446196c5ddc4Srjs struct MALI_RENDER_TARGET_AFBC_OVERLAY afbc; 446296c5ddc4Srjs uint32_t internal_buffer_offset; 446396c5ddc4Srjs bool yuv_enable; 446496c5ddc4Srjs bool dithered_clear; 446596c5ddc4Srjs enum mali_color_buffer_internal_format internal_format; 446696c5ddc4Srjs bool write_enable; 446796c5ddc4Srjs enum mali_color_format writeback_format; 446896c5ddc4Srjs enum mali_rt_endianness writeback_endianness; 446996c5ddc4Srjs enum mali_block_format writeback_block_format; 447096c5ddc4Srjs enum mali_msaa writeback_msaa; 447196c5ddc4Srjs bool srgb; 447296c5ddc4Srjs bool dithering_enable; 447396c5ddc4Srjs uint32_t swizzle; 447496c5ddc4Srjs bool clean_pixel_write_enable; 447596c5ddc4Srjs struct MALI_RT_BUFFER rgb; 447696c5ddc4Srjs struct MALI_RT_CLEAR clear; 447796c5ddc4Srjs}; 447896c5ddc4Srjs 447996c5ddc4Srjs#define MALI_RENDER_TARGET_header \ 448096c5ddc4Srjs .yuv = { MALI_RENDER_TARGET_YUV_OVERLAY_header }, \ 448196c5ddc4Srjs .afbc = { MALI_RENDER_TARGET_AFBC_OVERLAY_header }, \ 448296c5ddc4Srjs .rgb = { MALI_RT_BUFFER_header }, \ 448396c5ddc4Srjs .clear = { MALI_RT_CLEAR_header } 448496c5ddc4Srjs 448596c5ddc4Srjsstatic inline void 448696c5ddc4SrjsMALI_RENDER_TARGET_pack(uint32_t * restrict cl, 448796c5ddc4Srjs const struct MALI_RENDER_TARGET * restrict values) 448896c5ddc4Srjs{ 448996c5ddc4Srjs assert((values->internal_buffer_offset & 0xf) == 0); 449096c5ddc4Srjs cl[ 0] = __gen_uint(values->internal_buffer_offset >> 4, 4, 15) | 449196c5ddc4Srjs __gen_uint(values->yuv_enable, 24, 24) | 449296c5ddc4Srjs __gen_uint(values->dithered_clear, 25, 25) | 449396c5ddc4Srjs __gen_uint(values->internal_format, 26, 31); 449496c5ddc4Srjs cl[ 1] = __gen_uint(values->write_enable, 0, 0) | 449596c5ddc4Srjs __gen_uint(values->writeback_format, 3, 7) | 449696c5ddc4Srjs __gen_uint(values->writeback_endianness, 8, 9) | 449796c5ddc4Srjs __gen_uint(values->writeback_block_format, 10, 11) | 449896c5ddc4Srjs __gen_uint(values->writeback_msaa, 12, 13) | 449996c5ddc4Srjs __gen_uint(values->srgb, 14, 14) | 450096c5ddc4Srjs __gen_uint(values->dithering_enable, 15, 15) | 450196c5ddc4Srjs __gen_uint(values->swizzle, 16, 27) | 450296c5ddc4Srjs __gen_uint(values->clean_pixel_write_enable, 31, 31); 450396c5ddc4Srjs cl[ 2] = __gen_uint(values->yuv.swizzle, 16, 18) | 450496c5ddc4Srjs __gen_uint(values->yuv.full_range, 20, 20) | 450596c5ddc4Srjs __gen_uint(values->yuv.conversion_mode, 21, 24) | 450696c5ddc4Srjs __gen_uint(values->yuv.cr_siting, 25, 27) | 450796c5ddc4Srjs __gen_uint(values->yuv.unsigned_cr_range, 28, 28); 450896c5ddc4Srjs cl[ 3] = 0; 450996c5ddc4Srjs cl[ 4] = __gen_uint(values->yuv.plane_0_base, 0, 63) | 451096c5ddc4Srjs __gen_uint(values->afbc.header, 0, 63); 451196c5ddc4Srjs cl[ 5] = __gen_uint(values->yuv.plane_0_base, 0, 63) >> 32 | 451296c5ddc4Srjs __gen_uint(values->afbc.header, 0, 63) >> 32; 451396c5ddc4Srjs cl[ 6] = __gen_uint(values->yuv.plane_1_base, 0, 63) | 451496c5ddc4Srjs __gen_uint(values->afbc.row_stride, 0, 12); 451596c5ddc4Srjs cl[ 7] = __gen_uint(values->yuv.plane_1_base, 0, 63) >> 32 | 451696c5ddc4Srjs __gen_uint(values->afbc.chunk_size, 0, 11) | 451796c5ddc4Srjs __gen_uint(values->afbc.afbc_split_block_enable, 18, 18) | 451896c5ddc4Srjs __gen_uint(values->afbc.afbc_wide_block_enable, 19, 19) | 451996c5ddc4Srjs __gen_uint(values->afbc.reverse_issue_order, 20, 20) | 452096c5ddc4Srjs __gen_uint(values->afbc.yuv_transform_enable, 17, 17); 452196c5ddc4Srjs cl[ 8] = __gen_uint(values->yuv.plane_2_base, 0, 63) | 452296c5ddc4Srjs __gen_uint(values->afbc.body, 0, 63) | 452396c5ddc4Srjs __gen_uint(values->rgb.base, 0, 63); 452496c5ddc4Srjs cl[ 9] = __gen_uint(values->yuv.plane_2_base, 0, 63) >> 32 | 452596c5ddc4Srjs __gen_uint(values->afbc.body, 0, 63) >> 32 | 452696c5ddc4Srjs __gen_uint(values->rgb.base, 0, 63) >> 32; 452796c5ddc4Srjs cl[10] = __gen_uint(values->yuv.plane_0_stride, 0, 31) | 452896c5ddc4Srjs __gen_uint(values->afbc.body_size, 0, 31) | 452996c5ddc4Srjs __gen_uint(values->rgb.row_stride, 0, 31); 453096c5ddc4Srjs cl[11] = __gen_uint(values->yuv.plane_1_2_stride, 0, 31) | 453196c5ddc4Srjs __gen_uint(values->rgb.surface_stride, 0, 31); 453296c5ddc4Srjs cl[12] = __gen_uint(values->clear.color_0, 0, 31); 453396c5ddc4Srjs cl[13] = __gen_uint(values->clear.color_1, 0, 31); 453496c5ddc4Srjs cl[14] = __gen_uint(values->clear.color_2, 0, 31); 453596c5ddc4Srjs cl[15] = __gen_uint(values->clear.color_3, 0, 31); 453696c5ddc4Srjs} 453796c5ddc4Srjs 453896c5ddc4Srjs 453996c5ddc4Srjs#define MALI_RENDER_TARGET_LENGTH 64 454096c5ddc4Srjs#define MALI_RENDER_TARGET_ALIGN 64 454196c5ddc4Srjsstruct mali_render_target_packed { uint32_t opaque[16]; }; 454296c5ddc4Srjsstatic inline void 454396c5ddc4SrjsMALI_RENDER_TARGET_unpack(const uint8_t * restrict cl, 454496c5ddc4Srjs struct MALI_RENDER_TARGET * restrict values) 454596c5ddc4Srjs{ 454696c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xff000f) fprintf(stderr, "XXX: Invalid field of Render Target unpacked at word 0\n"); 454796c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0x70000006) fprintf(stderr, "XXX: Invalid field of Render Target unpacked at word 1\n"); 454896c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xe008ffff) fprintf(stderr, "XXX: Invalid field of Render Target unpacked at word 2\n"); 454996c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target unpacked at word 3\n"); 455096c5ddc4Srjs values->yuv.swizzle = (enum mali_yuv_swizzle)__gen_unpack_uint(cl, 80, 82); 455196c5ddc4Srjs values->yuv.full_range = __gen_unpack_uint(cl, 84, 84); 455296c5ddc4Srjs values->yuv.conversion_mode = (enum mali_yuv_conversion_mode)__gen_unpack_uint(cl, 85, 88); 455396c5ddc4Srjs values->yuv.cr_siting = (enum mali_yuv_cr_siting)__gen_unpack_uint(cl, 89, 91); 455496c5ddc4Srjs values->yuv.unsigned_cr_range = __gen_unpack_uint(cl, 92, 92); 455596c5ddc4Srjs values->yuv.plane_0_base = __gen_unpack_uint(cl, 128, 191); 455696c5ddc4Srjs values->yuv.plane_1_base = __gen_unpack_uint(cl, 192, 255); 455796c5ddc4Srjs values->yuv.plane_2_base = __gen_unpack_uint(cl, 256, 319); 455896c5ddc4Srjs values->yuv.plane_0_stride = __gen_unpack_uint(cl, 320, 351); 455996c5ddc4Srjs values->yuv.plane_1_2_stride = __gen_unpack_uint(cl, 352, 383); 456096c5ddc4Srjs values->afbc.header = __gen_unpack_uint(cl, 128, 191); 456196c5ddc4Srjs values->afbc.row_stride = __gen_unpack_uint(cl, 192, 204); 456296c5ddc4Srjs values->afbc.chunk_size = __gen_unpack_uint(cl, 224, 235); 456396c5ddc4Srjs values->afbc.afbc_split_block_enable = __gen_unpack_uint(cl, 242, 242); 456496c5ddc4Srjs values->afbc.afbc_wide_block_enable = __gen_unpack_uint(cl, 243, 243); 456596c5ddc4Srjs values->afbc.reverse_issue_order = __gen_unpack_uint(cl, 244, 244); 456696c5ddc4Srjs values->afbc.yuv_transform_enable = __gen_unpack_uint(cl, 241, 241); 456796c5ddc4Srjs values->afbc.body = __gen_unpack_uint(cl, 256, 319); 456896c5ddc4Srjs values->afbc.body_size = __gen_unpack_uint(cl, 320, 351); 456996c5ddc4Srjs values->internal_buffer_offset = __gen_unpack_uint(cl, 4, 15) << 4; 457096c5ddc4Srjs values->yuv_enable = __gen_unpack_uint(cl, 24, 24); 457196c5ddc4Srjs values->dithered_clear = __gen_unpack_uint(cl, 25, 25); 457296c5ddc4Srjs values->internal_format = (enum mali_color_buffer_internal_format)__gen_unpack_uint(cl, 26, 31); 457396c5ddc4Srjs values->write_enable = __gen_unpack_uint(cl, 32, 32); 457496c5ddc4Srjs values->writeback_format = (enum mali_color_format)__gen_unpack_uint(cl, 35, 39); 457596c5ddc4Srjs values->writeback_endianness = (enum mali_rt_endianness)__gen_unpack_uint(cl, 40, 41); 457696c5ddc4Srjs values->writeback_block_format = (enum mali_block_format)__gen_unpack_uint(cl, 42, 43); 457796c5ddc4Srjs values->writeback_msaa = (enum mali_msaa)__gen_unpack_uint(cl, 44, 45); 457896c5ddc4Srjs values->srgb = __gen_unpack_uint(cl, 46, 46); 457996c5ddc4Srjs values->dithering_enable = __gen_unpack_uint(cl, 47, 47); 458096c5ddc4Srjs values->swizzle = __gen_unpack_uint(cl, 48, 59); 458196c5ddc4Srjs values->clean_pixel_write_enable = __gen_unpack_uint(cl, 63, 63); 458296c5ddc4Srjs values->rgb.base = __gen_unpack_uint(cl, 256, 319); 458396c5ddc4Srjs values->rgb.row_stride = __gen_unpack_uint(cl, 320, 351); 458496c5ddc4Srjs values->rgb.surface_stride = __gen_unpack_uint(cl, 352, 383); 458596c5ddc4Srjs values->clear.color_0 = __gen_unpack_uint(cl, 384, 415); 458696c5ddc4Srjs values->clear.color_1 = __gen_unpack_uint(cl, 416, 447); 458796c5ddc4Srjs values->clear.color_2 = __gen_unpack_uint(cl, 448, 479); 458896c5ddc4Srjs values->clear.color_3 = __gen_unpack_uint(cl, 480, 511); 458996c5ddc4Srjs} 459096c5ddc4Srjs 459196c5ddc4Srjsstatic inline void 459296c5ddc4SrjsMALI_RENDER_TARGET_print(FILE *fp, const struct MALI_RENDER_TARGET * values, unsigned indent) 459396c5ddc4Srjs{ 459496c5ddc4Srjs fprintf(fp, "%*sYUV:\n", indent, ""); 459596c5ddc4Srjs MALI_RENDER_TARGET_YUV_OVERLAY_print(fp, &values->yuv, indent + 2); 459696c5ddc4Srjs fprintf(fp, "%*sAFBC:\n", indent, ""); 459796c5ddc4Srjs MALI_RENDER_TARGET_AFBC_OVERLAY_print(fp, &values->afbc, indent + 2); 459896c5ddc4Srjs fprintf(fp, "%*sInternal Buffer Offset: %u\n", indent, "", values->internal_buffer_offset); 459996c5ddc4Srjs fprintf(fp, "%*sYUV Enable: %s\n", indent, "", values->yuv_enable ? "true" : "false"); 460096c5ddc4Srjs fprintf(fp, "%*sDithered Clear: %s\n", indent, "", values->dithered_clear ? "true" : "false"); 460196c5ddc4Srjs fprintf(fp, "%*sInternal Format: %s\n", indent, "", mali_color_buffer_internal_format_as_str(values->internal_format)); 460296c5ddc4Srjs fprintf(fp, "%*sWrite Enable: %s\n", indent, "", values->write_enable ? "true" : "false"); 460396c5ddc4Srjs fprintf(fp, "%*sWriteback Format: %s\n", indent, "", mali_color_format_as_str(values->writeback_format)); 460496c5ddc4Srjs fprintf(fp, "%*sWriteback Endianness: %s\n", indent, "", mali_rt_endianness_as_str(values->writeback_endianness)); 460596c5ddc4Srjs fprintf(fp, "%*sWriteback Block Format: %s\n", indent, "", mali_block_format_as_str(values->writeback_block_format)); 460696c5ddc4Srjs fprintf(fp, "%*sWriteback MSAA: %s\n", indent, "", mali_msaa_as_str(values->writeback_msaa)); 460796c5ddc4Srjs fprintf(fp, "%*ssRGB: %s\n", indent, "", values->srgb ? "true" : "false"); 460896c5ddc4Srjs fprintf(fp, "%*sDithering Enable: %s\n", indent, "", values->dithering_enable ? "true" : "false"); 460996c5ddc4Srjs fprintf(fp, "%*sSwizzle: %u\n", indent, "", values->swizzle); 461096c5ddc4Srjs fprintf(fp, "%*sClean Pixel Write Enable: %s\n", indent, "", values->clean_pixel_write_enable ? "true" : "false"); 461196c5ddc4Srjs fprintf(fp, "%*sRGB:\n", indent, ""); 461296c5ddc4Srjs MALI_RT_BUFFER_print(fp, &values->rgb, indent + 2); 461396c5ddc4Srjs fprintf(fp, "%*sClear:\n", indent, ""); 461496c5ddc4Srjs MALI_RT_CLEAR_print(fp, &values->clear, indent + 2); 461596c5ddc4Srjs} 461696c5ddc4Srjs 461796c5ddc4Srjsstruct MALI_TILER_HEAP { 461896c5ddc4Srjs uint32_t size; 461996c5ddc4Srjs uint64_t base; 462096c5ddc4Srjs uint64_t bottom; 462196c5ddc4Srjs uint64_t top; 462296c5ddc4Srjs}; 462396c5ddc4Srjs 462496c5ddc4Srjs#define MALI_TILER_HEAP_header \ 462596c5ddc4Srjs 0 462696c5ddc4Srjs 462796c5ddc4Srjsstatic inline void 462896c5ddc4SrjsMALI_TILER_HEAP_pack(uint32_t * restrict cl, 462996c5ddc4Srjs const struct MALI_TILER_HEAP * restrict values) 463096c5ddc4Srjs{ 463196c5ddc4Srjs cl[ 0] = 0; 463296c5ddc4Srjs cl[ 1] = __gen_uint(ALIGN_POT(values->size, 4096), 0, 31); 463396c5ddc4Srjs cl[ 2] = __gen_uint(values->base, 0, 63); 463496c5ddc4Srjs cl[ 3] = __gen_uint(values->base, 0, 63) >> 32; 463596c5ddc4Srjs cl[ 4] = __gen_uint(values->bottom, 0, 63); 463696c5ddc4Srjs cl[ 5] = __gen_uint(values->bottom, 0, 63) >> 32; 463796c5ddc4Srjs cl[ 6] = __gen_uint(values->top, 0, 63); 463896c5ddc4Srjs cl[ 7] = __gen_uint(values->top, 0, 63) >> 32; 463996c5ddc4Srjs} 464096c5ddc4Srjs 464196c5ddc4Srjs 464296c5ddc4Srjs#define MALI_TILER_HEAP_LENGTH 32 464396c5ddc4Srjs#define MALI_TILER_HEAP_ALIGN 64 464496c5ddc4Srjsstruct mali_tiler_heap_packed { uint32_t opaque[8]; }; 464596c5ddc4Srjsstatic inline void 464696c5ddc4SrjsMALI_TILER_HEAP_unpack(const uint8_t * restrict cl, 464796c5ddc4Srjs struct MALI_TILER_HEAP * restrict values) 464896c5ddc4Srjs{ 464996c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Heap unpacked at word 0\n"); 465096c5ddc4Srjs values->size = __gen_unpack_uint(cl, 32, 63); 465196c5ddc4Srjs assert(!(values->size & 0xfff)); 465296c5ddc4Srjs values->base = __gen_unpack_uint(cl, 64, 127); 465396c5ddc4Srjs values->bottom = __gen_unpack_uint(cl, 128, 191); 465496c5ddc4Srjs values->top = __gen_unpack_uint(cl, 192, 255); 465596c5ddc4Srjs} 465696c5ddc4Srjs 465796c5ddc4Srjsstatic inline void 465896c5ddc4SrjsMALI_TILER_HEAP_print(FILE *fp, const struct MALI_TILER_HEAP * values, unsigned indent) 465996c5ddc4Srjs{ 466096c5ddc4Srjs fprintf(fp, "%*sSize: %u\n", indent, "", values->size); 466196c5ddc4Srjs fprintf(fp, "%*sBase: 0x%" PRIx64 "\n", indent, "", values->base); 466296c5ddc4Srjs fprintf(fp, "%*sBottom: 0x%" PRIx64 "\n", indent, "", values->bottom); 466396c5ddc4Srjs fprintf(fp, "%*sTop: 0x%" PRIx64 "\n", indent, "", values->top); 466496c5ddc4Srjs} 466596c5ddc4Srjs 466696c5ddc4Srjsstruct MALI_TILER_WEIGHTS { 466796c5ddc4Srjs uint32_t weight0; 466896c5ddc4Srjs uint32_t weight1; 466996c5ddc4Srjs uint32_t weight2; 467096c5ddc4Srjs uint32_t weight3; 467196c5ddc4Srjs uint32_t weight4; 467296c5ddc4Srjs uint32_t weight5; 467396c5ddc4Srjs uint32_t weight6; 467496c5ddc4Srjs uint32_t weight7; 467596c5ddc4Srjs}; 467696c5ddc4Srjs 467796c5ddc4Srjs#define MALI_TILER_WEIGHTS_header \ 467896c5ddc4Srjs 0 467996c5ddc4Srjs 468096c5ddc4Srjsstatic inline void 468196c5ddc4SrjsMALI_TILER_WEIGHTS_pack(uint32_t * restrict cl, 468296c5ddc4Srjs const struct MALI_TILER_WEIGHTS * restrict values) 468396c5ddc4Srjs{ 468496c5ddc4Srjs cl[ 0] = __gen_uint(values->weight0, 16, 31); 468596c5ddc4Srjs cl[ 1] = __gen_uint(values->weight1, 16, 31); 468696c5ddc4Srjs cl[ 2] = __gen_uint(values->weight2, 16, 31); 468796c5ddc4Srjs cl[ 3] = __gen_uint(values->weight3, 16, 31); 468896c5ddc4Srjs cl[ 4] = __gen_uint(values->weight4, 16, 31); 468996c5ddc4Srjs cl[ 5] = __gen_uint(values->weight5, 16, 31); 469096c5ddc4Srjs cl[ 6] = __gen_uint(values->weight6, 16, 31); 469196c5ddc4Srjs cl[ 7] = __gen_uint(values->weight7, 16, 31); 469296c5ddc4Srjs} 469396c5ddc4Srjs 469496c5ddc4Srjs 469596c5ddc4Srjs#define MALI_TILER_WEIGHTS_LENGTH 32 469696c5ddc4Srjsstruct mali_tiler_weights_packed { uint32_t opaque[8]; }; 469796c5ddc4Srjsstatic inline void 469896c5ddc4SrjsMALI_TILER_WEIGHTS_unpack(const uint8_t * restrict cl, 469996c5ddc4Srjs struct MALI_TILER_WEIGHTS * restrict values) 470096c5ddc4Srjs{ 470196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 0\n"); 470296c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 1\n"); 470396c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 2\n"); 470496c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 3\n"); 470596c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 4\n"); 470696c5ddc4Srjs if (((const uint32_t *) cl)[5] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 5\n"); 470796c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 6\n"); 470896c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Weights unpacked at word 7\n"); 470996c5ddc4Srjs values->weight0 = __gen_unpack_uint(cl, 16, 31); 471096c5ddc4Srjs values->weight1 = __gen_unpack_uint(cl, 48, 63); 471196c5ddc4Srjs values->weight2 = __gen_unpack_uint(cl, 80, 95); 471296c5ddc4Srjs values->weight3 = __gen_unpack_uint(cl, 112, 127); 471396c5ddc4Srjs values->weight4 = __gen_unpack_uint(cl, 144, 159); 471496c5ddc4Srjs values->weight5 = __gen_unpack_uint(cl, 176, 191); 471596c5ddc4Srjs values->weight6 = __gen_unpack_uint(cl, 208, 223); 471696c5ddc4Srjs values->weight7 = __gen_unpack_uint(cl, 240, 255); 471796c5ddc4Srjs} 471896c5ddc4Srjs 471996c5ddc4Srjsstatic inline void 472096c5ddc4SrjsMALI_TILER_WEIGHTS_print(FILE *fp, const struct MALI_TILER_WEIGHTS * values, unsigned indent) 472196c5ddc4Srjs{ 472296c5ddc4Srjs fprintf(fp, "%*sWeight0: %u\n", indent, "", values->weight0); 472396c5ddc4Srjs fprintf(fp, "%*sWeight1: %u\n", indent, "", values->weight1); 472496c5ddc4Srjs fprintf(fp, "%*sWeight2: %u\n", indent, "", values->weight2); 472596c5ddc4Srjs fprintf(fp, "%*sWeight3: %u\n", indent, "", values->weight3); 472696c5ddc4Srjs fprintf(fp, "%*sWeight4: %u\n", indent, "", values->weight4); 472796c5ddc4Srjs fprintf(fp, "%*sWeight5: %u\n", indent, "", values->weight5); 472896c5ddc4Srjs fprintf(fp, "%*sWeight6: %u\n", indent, "", values->weight6); 472996c5ddc4Srjs fprintf(fp, "%*sWeight7: %u\n", indent, "", values->weight7); 473096c5ddc4Srjs} 473196c5ddc4Srjs 473296c5ddc4Srjsstruct MALI_TILER_STATE { 473396c5ddc4Srjs uint32_t word0; 473496c5ddc4Srjs uint32_t word1; 473596c5ddc4Srjs uint32_t word2; 473696c5ddc4Srjs uint32_t word3; 473796c5ddc4Srjs uint32_t word4; 473896c5ddc4Srjs uint32_t word5; 473996c5ddc4Srjs uint32_t word6; 474096c5ddc4Srjs uint32_t word7; 474196c5ddc4Srjs uint32_t word8; 474296c5ddc4Srjs uint32_t word9; 474396c5ddc4Srjs uint32_t word10; 474496c5ddc4Srjs uint32_t word11; 474596c5ddc4Srjs uint32_t word12; 474696c5ddc4Srjs uint32_t word13; 474796c5ddc4Srjs uint32_t word14; 474896c5ddc4Srjs uint32_t word15; 474996c5ddc4Srjs}; 475096c5ddc4Srjs 475196c5ddc4Srjs#define MALI_TILER_STATE_header \ 475296c5ddc4Srjs 0 475396c5ddc4Srjs 475496c5ddc4Srjsstatic inline void 475596c5ddc4SrjsMALI_TILER_STATE_pack(uint32_t * restrict cl, 475696c5ddc4Srjs const struct MALI_TILER_STATE * restrict values) 475796c5ddc4Srjs{ 475896c5ddc4Srjs cl[ 0] = __gen_uint(values->word0, 0, 31); 475996c5ddc4Srjs cl[ 1] = __gen_uint(values->word1, 0, 31); 476096c5ddc4Srjs cl[ 2] = __gen_uint(values->word2, 0, 31); 476196c5ddc4Srjs cl[ 3] = __gen_uint(values->word3, 0, 31); 476296c5ddc4Srjs cl[ 4] = __gen_uint(values->word4, 0, 31); 476396c5ddc4Srjs cl[ 5] = __gen_uint(values->word5, 0, 31); 476496c5ddc4Srjs cl[ 6] = __gen_uint(values->word6, 0, 31); 476596c5ddc4Srjs cl[ 7] = __gen_uint(values->word7, 0, 31); 476696c5ddc4Srjs cl[ 8] = __gen_uint(values->word8, 0, 31); 476796c5ddc4Srjs cl[ 9] = __gen_uint(values->word9, 0, 31); 476896c5ddc4Srjs cl[10] = __gen_uint(values->word10, 0, 31); 476996c5ddc4Srjs cl[11] = __gen_uint(values->word11, 0, 31); 477096c5ddc4Srjs cl[12] = __gen_uint(values->word12, 0, 31); 477196c5ddc4Srjs cl[13] = __gen_uint(values->word13, 0, 31); 477296c5ddc4Srjs cl[14] = __gen_uint(values->word14, 0, 31); 477396c5ddc4Srjs cl[15] = __gen_uint(values->word15, 0, 31); 477496c5ddc4Srjs} 477596c5ddc4Srjs 477696c5ddc4Srjs 477796c5ddc4Srjs#define MALI_TILER_STATE_LENGTH 64 477896c5ddc4Srjsstruct mali_tiler_state_packed { uint32_t opaque[16]; }; 477996c5ddc4Srjsstatic inline void 478096c5ddc4SrjsMALI_TILER_STATE_unpack(const uint8_t * restrict cl, 478196c5ddc4Srjs struct MALI_TILER_STATE * restrict values) 478296c5ddc4Srjs{ 478396c5ddc4Srjs values->word0 = __gen_unpack_uint(cl, 0, 31); 478496c5ddc4Srjs values->word1 = __gen_unpack_uint(cl, 32, 63); 478596c5ddc4Srjs values->word2 = __gen_unpack_uint(cl, 64, 95); 478696c5ddc4Srjs values->word3 = __gen_unpack_uint(cl, 96, 127); 478796c5ddc4Srjs values->word4 = __gen_unpack_uint(cl, 128, 159); 478896c5ddc4Srjs values->word5 = __gen_unpack_uint(cl, 160, 191); 478996c5ddc4Srjs values->word6 = __gen_unpack_uint(cl, 192, 223); 479096c5ddc4Srjs values->word7 = __gen_unpack_uint(cl, 224, 255); 479196c5ddc4Srjs values->word8 = __gen_unpack_uint(cl, 256, 287); 479296c5ddc4Srjs values->word9 = __gen_unpack_uint(cl, 288, 319); 479396c5ddc4Srjs values->word10 = __gen_unpack_uint(cl, 320, 351); 479496c5ddc4Srjs values->word11 = __gen_unpack_uint(cl, 352, 383); 479596c5ddc4Srjs values->word12 = __gen_unpack_uint(cl, 384, 415); 479696c5ddc4Srjs values->word13 = __gen_unpack_uint(cl, 416, 447); 479796c5ddc4Srjs values->word14 = __gen_unpack_uint(cl, 448, 479); 479896c5ddc4Srjs values->word15 = __gen_unpack_uint(cl, 480, 511); 479996c5ddc4Srjs} 480096c5ddc4Srjs 480196c5ddc4Srjsstatic inline void 480296c5ddc4SrjsMALI_TILER_STATE_print(FILE *fp, const struct MALI_TILER_STATE * values, unsigned indent) 480396c5ddc4Srjs{ 480496c5ddc4Srjs fprintf(fp, "%*sWord0: %u\n", indent, "", values->word0); 480596c5ddc4Srjs fprintf(fp, "%*sWord1: %u\n", indent, "", values->word1); 480696c5ddc4Srjs fprintf(fp, "%*sWord2: %u\n", indent, "", values->word2); 480796c5ddc4Srjs fprintf(fp, "%*sWord3: %u\n", indent, "", values->word3); 480896c5ddc4Srjs fprintf(fp, "%*sWord4: %u\n", indent, "", values->word4); 480996c5ddc4Srjs fprintf(fp, "%*sWord5: %u\n", indent, "", values->word5); 481096c5ddc4Srjs fprintf(fp, "%*sWord6: %u\n", indent, "", values->word6); 481196c5ddc4Srjs fprintf(fp, "%*sWord7: %u\n", indent, "", values->word7); 481296c5ddc4Srjs fprintf(fp, "%*sWord8: %u\n", indent, "", values->word8); 481396c5ddc4Srjs fprintf(fp, "%*sWord9: %u\n", indent, "", values->word9); 481496c5ddc4Srjs fprintf(fp, "%*sWord10: %u\n", indent, "", values->word10); 481596c5ddc4Srjs fprintf(fp, "%*sWord11: %u\n", indent, "", values->word11); 481696c5ddc4Srjs fprintf(fp, "%*sWord12: %u\n", indent, "", values->word12); 481796c5ddc4Srjs fprintf(fp, "%*sWord13: %u\n", indent, "", values->word13); 481896c5ddc4Srjs fprintf(fp, "%*sWord14: %u\n", indent, "", values->word14); 481996c5ddc4Srjs fprintf(fp, "%*sWord15: %u\n", indent, "", values->word15); 482096c5ddc4Srjs} 482196c5ddc4Srjs 482296c5ddc4Srjsstruct MALI_TILER_CONTEXT { 482396c5ddc4Srjs uint64_t polygon_list; 482496c5ddc4Srjs uint32_t hierarchy_mask; 482596c5ddc4Srjs enum mali_sample_pattern sample_pattern; 482696c5ddc4Srjs bool update_cost_table; 482796c5ddc4Srjs uint32_t fb_width; 482896c5ddc4Srjs uint32_t fb_height; 482996c5ddc4Srjs uint64_t heap; 483096c5ddc4Srjs struct MALI_TILER_WEIGHTS weights; 483196c5ddc4Srjs struct MALI_TILER_STATE state; 483296c5ddc4Srjs}; 483396c5ddc4Srjs 483496c5ddc4Srjs#define MALI_TILER_CONTEXT_header \ 483596c5ddc4Srjs .weights = { MALI_TILER_WEIGHTS_header }, \ 483696c5ddc4Srjs .state = { MALI_TILER_STATE_header } 483796c5ddc4Srjs 483896c5ddc4Srjsstatic inline void 483996c5ddc4SrjsMALI_TILER_CONTEXT_pack(uint32_t * restrict cl, 484096c5ddc4Srjs const struct MALI_TILER_CONTEXT * restrict values) 484196c5ddc4Srjs{ 484296c5ddc4Srjs assert(values->fb_width >= 1); 484396c5ddc4Srjs assert(values->fb_height >= 1); 484496c5ddc4Srjs cl[ 0] = __gen_uint(values->polygon_list, 0, 63); 484596c5ddc4Srjs cl[ 1] = __gen_uint(values->polygon_list, 0, 63) >> 32; 484696c5ddc4Srjs cl[ 2] = __gen_uint(values->hierarchy_mask, 0, 12) | 484796c5ddc4Srjs __gen_uint(values->sample_pattern, 13, 15) | 484896c5ddc4Srjs __gen_uint(values->update_cost_table, 16, 16); 484996c5ddc4Srjs cl[ 3] = __gen_uint(values->fb_width - 1, 0, 15) | 485096c5ddc4Srjs __gen_uint(values->fb_height - 1, 16, 31); 485196c5ddc4Srjs cl[ 4] = 0; 485296c5ddc4Srjs cl[ 5] = 0; 485396c5ddc4Srjs cl[ 6] = __gen_uint(values->heap, 0, 63); 485496c5ddc4Srjs cl[ 7] = __gen_uint(values->heap, 0, 63) >> 32; 485596c5ddc4Srjs cl[ 8] = __gen_uint(values->weights.weight0, 16, 31); 485696c5ddc4Srjs cl[ 9] = __gen_uint(values->weights.weight1, 16, 31); 485796c5ddc4Srjs cl[10] = __gen_uint(values->weights.weight2, 16, 31); 485896c5ddc4Srjs cl[11] = __gen_uint(values->weights.weight3, 16, 31); 485996c5ddc4Srjs cl[12] = __gen_uint(values->weights.weight4, 16, 31); 486096c5ddc4Srjs cl[13] = __gen_uint(values->weights.weight5, 16, 31); 486196c5ddc4Srjs cl[14] = __gen_uint(values->weights.weight6, 16, 31); 486296c5ddc4Srjs cl[15] = __gen_uint(values->weights.weight7, 16, 31); 486396c5ddc4Srjs cl[16] = 0; 486496c5ddc4Srjs cl[17] = 0; 486596c5ddc4Srjs cl[18] = 0; 486696c5ddc4Srjs cl[19] = 0; 486796c5ddc4Srjs cl[20] = 0; 486896c5ddc4Srjs cl[21] = 0; 486996c5ddc4Srjs cl[22] = 0; 487096c5ddc4Srjs cl[23] = 0; 487196c5ddc4Srjs cl[24] = 0; 487296c5ddc4Srjs cl[25] = 0; 487396c5ddc4Srjs cl[26] = 0; 487496c5ddc4Srjs cl[27] = 0; 487596c5ddc4Srjs cl[28] = 0; 487696c5ddc4Srjs cl[29] = 0; 487796c5ddc4Srjs cl[30] = 0; 487896c5ddc4Srjs cl[31] = 0; 487996c5ddc4Srjs cl[32] = __gen_uint(values->state.word0, 0, 31); 488096c5ddc4Srjs cl[33] = __gen_uint(values->state.word1, 0, 31); 488196c5ddc4Srjs cl[34] = __gen_uint(values->state.word2, 0, 31); 488296c5ddc4Srjs cl[35] = __gen_uint(values->state.word3, 0, 31); 488396c5ddc4Srjs cl[36] = __gen_uint(values->state.word4, 0, 31); 488496c5ddc4Srjs cl[37] = __gen_uint(values->state.word5, 0, 31); 488596c5ddc4Srjs cl[38] = __gen_uint(values->state.word6, 0, 31); 488696c5ddc4Srjs cl[39] = __gen_uint(values->state.word7, 0, 31); 488796c5ddc4Srjs cl[40] = __gen_uint(values->state.word8, 0, 31); 488896c5ddc4Srjs cl[41] = __gen_uint(values->state.word9, 0, 31); 488996c5ddc4Srjs cl[42] = __gen_uint(values->state.word10, 0, 31); 489096c5ddc4Srjs cl[43] = __gen_uint(values->state.word11, 0, 31); 489196c5ddc4Srjs cl[44] = __gen_uint(values->state.word12, 0, 31); 489296c5ddc4Srjs cl[45] = __gen_uint(values->state.word13, 0, 31); 489396c5ddc4Srjs cl[46] = __gen_uint(values->state.word14, 0, 31); 489496c5ddc4Srjs cl[47] = __gen_uint(values->state.word15, 0, 31); 489596c5ddc4Srjs} 489696c5ddc4Srjs 489796c5ddc4Srjs 489896c5ddc4Srjs#define MALI_TILER_CONTEXT_LENGTH 192 489996c5ddc4Srjs#define MALI_TILER_CONTEXT_ALIGN 64 490096c5ddc4Srjsstruct mali_tiler_context_packed { uint32_t opaque[48]; }; 490196c5ddc4Srjsstatic inline void 490296c5ddc4SrjsMALI_TILER_CONTEXT_unpack(const uint8_t * restrict cl, 490396c5ddc4Srjs struct MALI_TILER_CONTEXT * restrict values) 490496c5ddc4Srjs{ 490596c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xfffe0000) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 2\n"); 490696c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 4\n"); 490796c5ddc4Srjs if (((const uint32_t *) cl)[5] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 5\n"); 490896c5ddc4Srjs if (((const uint32_t *) cl)[8] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 8\n"); 490996c5ddc4Srjs if (((const uint32_t *) cl)[9] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 9\n"); 491096c5ddc4Srjs if (((const uint32_t *) cl)[10] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 10\n"); 491196c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 11\n"); 491296c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 12\n"); 491396c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 13\n"); 491496c5ddc4Srjs if (((const uint32_t *) cl)[14] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 14\n"); 491596c5ddc4Srjs if (((const uint32_t *) cl)[15] & 0xffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 15\n"); 491696c5ddc4Srjs if (((const uint32_t *) cl)[16] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 16\n"); 491796c5ddc4Srjs if (((const uint32_t *) cl)[17] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 17\n"); 491896c5ddc4Srjs if (((const uint32_t *) cl)[18] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 18\n"); 491996c5ddc4Srjs if (((const uint32_t *) cl)[19] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 19\n"); 492096c5ddc4Srjs if (((const uint32_t *) cl)[20] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 20\n"); 492196c5ddc4Srjs if (((const uint32_t *) cl)[21] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 21\n"); 492296c5ddc4Srjs if (((const uint32_t *) cl)[22] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 22\n"); 492396c5ddc4Srjs if (((const uint32_t *) cl)[23] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 23\n"); 492496c5ddc4Srjs if (((const uint32_t *) cl)[24] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 24\n"); 492596c5ddc4Srjs if (((const uint32_t *) cl)[25] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 25\n"); 492696c5ddc4Srjs if (((const uint32_t *) cl)[26] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 26\n"); 492796c5ddc4Srjs if (((const uint32_t *) cl)[27] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 27\n"); 492896c5ddc4Srjs if (((const uint32_t *) cl)[28] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 28\n"); 492996c5ddc4Srjs if (((const uint32_t *) cl)[29] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 29\n"); 493096c5ddc4Srjs if (((const uint32_t *) cl)[30] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 30\n"); 493196c5ddc4Srjs if (((const uint32_t *) cl)[31] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 31\n"); 493296c5ddc4Srjs values->polygon_list = __gen_unpack_uint(cl, 0, 63); 493396c5ddc4Srjs values->hierarchy_mask = __gen_unpack_uint(cl, 64, 76); 493496c5ddc4Srjs values->sample_pattern = (enum mali_sample_pattern)__gen_unpack_uint(cl, 77, 79); 493596c5ddc4Srjs values->update_cost_table = __gen_unpack_uint(cl, 80, 80); 493696c5ddc4Srjs values->fb_width = __gen_unpack_uint(cl, 96, 111) + 1; 493796c5ddc4Srjs values->fb_height = __gen_unpack_uint(cl, 112, 127) + 1; 493896c5ddc4Srjs values->heap = __gen_unpack_uint(cl, 192, 255); 493996c5ddc4Srjs values->weights.weight0 = __gen_unpack_uint(cl, 272, 287); 494096c5ddc4Srjs values->weights.weight1 = __gen_unpack_uint(cl, 304, 319); 494196c5ddc4Srjs values->weights.weight2 = __gen_unpack_uint(cl, 336, 351); 494296c5ddc4Srjs values->weights.weight3 = __gen_unpack_uint(cl, 368, 383); 494396c5ddc4Srjs values->weights.weight4 = __gen_unpack_uint(cl, 400, 415); 494496c5ddc4Srjs values->weights.weight5 = __gen_unpack_uint(cl, 432, 447); 494596c5ddc4Srjs values->weights.weight6 = __gen_unpack_uint(cl, 464, 479); 494696c5ddc4Srjs values->weights.weight7 = __gen_unpack_uint(cl, 496, 511); 494796c5ddc4Srjs values->state.word0 = __gen_unpack_uint(cl, 1024, 1055); 494896c5ddc4Srjs values->state.word1 = __gen_unpack_uint(cl, 1056, 1087); 494996c5ddc4Srjs values->state.word2 = __gen_unpack_uint(cl, 1088, 1119); 495096c5ddc4Srjs values->state.word3 = __gen_unpack_uint(cl, 1120, 1151); 495196c5ddc4Srjs values->state.word4 = __gen_unpack_uint(cl, 1152, 1183); 495296c5ddc4Srjs values->state.word5 = __gen_unpack_uint(cl, 1184, 1215); 495396c5ddc4Srjs values->state.word6 = __gen_unpack_uint(cl, 1216, 1247); 495496c5ddc4Srjs values->state.word7 = __gen_unpack_uint(cl, 1248, 1279); 495596c5ddc4Srjs values->state.word8 = __gen_unpack_uint(cl, 1280, 1311); 495696c5ddc4Srjs values->state.word9 = __gen_unpack_uint(cl, 1312, 1343); 495796c5ddc4Srjs values->state.word10 = __gen_unpack_uint(cl, 1344, 1375); 495896c5ddc4Srjs values->state.word11 = __gen_unpack_uint(cl, 1376, 1407); 495996c5ddc4Srjs values->state.word12 = __gen_unpack_uint(cl, 1408, 1439); 496096c5ddc4Srjs values->state.word13 = __gen_unpack_uint(cl, 1440, 1471); 496196c5ddc4Srjs values->state.word14 = __gen_unpack_uint(cl, 1472, 1503); 496296c5ddc4Srjs values->state.word15 = __gen_unpack_uint(cl, 1504, 1535); 496396c5ddc4Srjs} 496496c5ddc4Srjs 496596c5ddc4Srjsstatic inline void 496696c5ddc4SrjsMALI_TILER_CONTEXT_print(FILE *fp, const struct MALI_TILER_CONTEXT * values, unsigned indent) 496796c5ddc4Srjs{ 496896c5ddc4Srjs fprintf(fp, "%*sPolygon List: 0x%" PRIx64 "\n", indent, "", values->polygon_list); 496996c5ddc4Srjs fprintf(fp, "%*sHierarchy Mask: %u\n", indent, "", values->hierarchy_mask); 497096c5ddc4Srjs fprintf(fp, "%*sSample Pattern: %s\n", indent, "", mali_sample_pattern_as_str(values->sample_pattern)); 497196c5ddc4Srjs fprintf(fp, "%*sUpdate Cost Table: %s\n", indent, "", values->update_cost_table ? "true" : "false"); 497296c5ddc4Srjs fprintf(fp, "%*sFB Width: %u\n", indent, "", values->fb_width); 497396c5ddc4Srjs fprintf(fp, "%*sFB Height: %u\n", indent, "", values->fb_height); 497496c5ddc4Srjs fprintf(fp, "%*sHeap: 0x%" PRIx64 "\n", indent, "", values->heap); 497596c5ddc4Srjs fprintf(fp, "%*sWeights:\n", indent, ""); 497696c5ddc4Srjs MALI_TILER_WEIGHTS_print(fp, &values->weights, indent + 2); 497796c5ddc4Srjs fprintf(fp, "%*sState:\n", indent, ""); 497896c5ddc4Srjs MALI_TILER_STATE_print(fp, &values->state, indent + 2); 497996c5ddc4Srjs} 498096c5ddc4Srjs 498196c5ddc4Srjsstruct MALI_FRAMEBUFFER_PADDING { 498296c5ddc4Srjs int dummy; 498396c5ddc4Srjs}; 498496c5ddc4Srjs 498596c5ddc4Srjs#define MALI_FRAMEBUFFER_PADDING_header \ 498696c5ddc4Srjs 0 498796c5ddc4Srjs 498896c5ddc4Srjsstatic inline void 498996c5ddc4SrjsMALI_FRAMEBUFFER_PADDING_pack(uint32_t * restrict cl, 499096c5ddc4Srjs const struct MALI_FRAMEBUFFER_PADDING * restrict values) 499196c5ddc4Srjs{ 499296c5ddc4Srjs cl[ 0] = 0; 499396c5ddc4Srjs cl[ 1] = 0; 499496c5ddc4Srjs cl[ 2] = 0; 499596c5ddc4Srjs cl[ 3] = 0; 499696c5ddc4Srjs cl[ 4] = 0; 499796c5ddc4Srjs cl[ 5] = 0; 499896c5ddc4Srjs cl[ 6] = 0; 499996c5ddc4Srjs cl[ 7] = 0; 500096c5ddc4Srjs cl[ 8] = 0; 500196c5ddc4Srjs cl[ 9] = 0; 500296c5ddc4Srjs cl[10] = 0; 500396c5ddc4Srjs cl[11] = 0; 500496c5ddc4Srjs cl[12] = 0; 500596c5ddc4Srjs cl[13] = 0; 500696c5ddc4Srjs cl[14] = 0; 500796c5ddc4Srjs cl[15] = 0; 500896c5ddc4Srjs} 500996c5ddc4Srjs 501096c5ddc4Srjs 501196c5ddc4Srjs#define MALI_FRAMEBUFFER_PADDING_LENGTH 64 501296c5ddc4Srjsstruct mali_framebuffer_padding_packed { uint32_t opaque[16]; }; 501396c5ddc4Srjsstatic inline void 501496c5ddc4SrjsMALI_FRAMEBUFFER_PADDING_unpack(const uint8_t * restrict cl, 501596c5ddc4Srjs struct MALI_FRAMEBUFFER_PADDING * restrict values) 501696c5ddc4Srjs{ 501796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 0\n"); 501896c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 1\n"); 501996c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 2\n"); 502096c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 3\n"); 502196c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 4\n"); 502296c5ddc4Srjs if (((const uint32_t *) cl)[5] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 5\n"); 502396c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 6\n"); 502496c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 7\n"); 502596c5ddc4Srjs if (((const uint32_t *) cl)[8] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 8\n"); 502696c5ddc4Srjs if (((const uint32_t *) cl)[9] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 9\n"); 502796c5ddc4Srjs if (((const uint32_t *) cl)[10] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 10\n"); 502896c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 11\n"); 502996c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 12\n"); 503096c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 13\n"); 503196c5ddc4Srjs if (((const uint32_t *) cl)[14] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 14\n"); 503296c5ddc4Srjs if (((const uint32_t *) cl)[15] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Framebuffer Padding unpacked at word 15\n"); 503396c5ddc4Srjs} 503496c5ddc4Srjs 503596c5ddc4Srjsstatic inline void 503696c5ddc4SrjsMALI_FRAMEBUFFER_PADDING_print(FILE *fp, const struct MALI_FRAMEBUFFER_PADDING * values, unsigned indent) 503796c5ddc4Srjs{ 503896c5ddc4Srjs} 503996c5ddc4Srjs 504096c5ddc4Srjsstruct mali_framebuffer_packed { 504196c5ddc4Srjs uint32_t opaque[32]; 504296c5ddc4Srjs}; 504396c5ddc4Srjs 504496c5ddc4Srjs#define MALI_FRAMEBUFFER_LENGTH 128 504596c5ddc4Srjs#define MALI_FRAMEBUFFER_ALIGN 64 504696c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_TYPE struct MALI_FRAMEBUFFER_PARAMETERS 504796c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_header MALI_FRAMEBUFFER_PARAMETERS_header 504896c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_pack MALI_FRAMEBUFFER_PARAMETERS_pack 504996c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_unpack MALI_FRAMEBUFFER_PARAMETERS_unpack 505096c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_print MALI_FRAMEBUFFER_PARAMETERS_print 505196c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_OFFSET 0 505296c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PADDING_TYPE struct MALI_FRAMEBUFFER_PADDING 505396c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PADDING_header MALI_FRAMEBUFFER_PADDING_header 505496c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PADDING_pack MALI_FRAMEBUFFER_PADDING_pack 505596c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PADDING_unpack MALI_FRAMEBUFFER_PADDING_unpack 505696c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PADDING_print MALI_FRAMEBUFFER_PADDING_print 505796c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PADDING_OFFSET 64 505896c5ddc4Srjs 505996c5ddc4Srjsstruct MALI_JOB_HEADER { 506096c5ddc4Srjs uint32_t exception_status; 506196c5ddc4Srjs uint32_t first_incomplete_task; 506296c5ddc4Srjs uint64_t fault_pointer; 506396c5ddc4Srjs bool is_64b; 506496c5ddc4Srjs enum mali_job_type type; 506596c5ddc4Srjs bool barrier; 506696c5ddc4Srjs bool invalidate_cache; 506796c5ddc4Srjs bool suppress_prefetch; 506896c5ddc4Srjs bool enable_texture_mapper; 506996c5ddc4Srjs bool relax_dependency_1; 507096c5ddc4Srjs bool relax_dependency_2; 507196c5ddc4Srjs uint32_t index; 507296c5ddc4Srjs uint32_t dependency_1; 507396c5ddc4Srjs uint32_t dependency_2; 507496c5ddc4Srjs uint64_t next; 507596c5ddc4Srjs}; 507696c5ddc4Srjs 507796c5ddc4Srjs#define MALI_JOB_HEADER_header \ 507896c5ddc4Srjs .is_64b = true 507996c5ddc4Srjs 508096c5ddc4Srjsstatic inline void 508196c5ddc4SrjsMALI_JOB_HEADER_pack(uint32_t * restrict cl, 508296c5ddc4Srjs const struct MALI_JOB_HEADER * restrict values) 508396c5ddc4Srjs{ 508496c5ddc4Srjs cl[ 0] = __gen_uint(values->exception_status, 0, 31); 508596c5ddc4Srjs cl[ 1] = __gen_uint(values->first_incomplete_task, 0, 31); 508696c5ddc4Srjs cl[ 2] = __gen_uint(values->fault_pointer, 0, 63); 508796c5ddc4Srjs cl[ 3] = __gen_uint(values->fault_pointer, 0, 63) >> 32; 508896c5ddc4Srjs cl[ 4] = __gen_uint(values->is_64b, 0, 0) | 508996c5ddc4Srjs __gen_uint(values->type, 1, 7) | 509096c5ddc4Srjs __gen_uint(values->barrier, 8, 8) | 509196c5ddc4Srjs __gen_uint(values->invalidate_cache, 9, 9) | 509296c5ddc4Srjs __gen_uint(values->suppress_prefetch, 11, 11) | 509396c5ddc4Srjs __gen_uint(values->enable_texture_mapper, 12, 12) | 509496c5ddc4Srjs __gen_uint(values->relax_dependency_1, 14, 14) | 509596c5ddc4Srjs __gen_uint(values->relax_dependency_2, 15, 15) | 509696c5ddc4Srjs __gen_uint(values->index, 16, 31); 509796c5ddc4Srjs cl[ 5] = __gen_uint(values->dependency_1, 0, 15) | 509896c5ddc4Srjs __gen_uint(values->dependency_2, 16, 31); 509996c5ddc4Srjs cl[ 6] = __gen_uint(values->next, 0, 63); 510096c5ddc4Srjs cl[ 7] = __gen_uint(values->next, 0, 63) >> 32; 510196c5ddc4Srjs} 510296c5ddc4Srjs 510396c5ddc4Srjs 510496c5ddc4Srjs#define MALI_JOB_HEADER_LENGTH 32 510596c5ddc4Srjs#define MALI_JOB_HEADER_ALIGN 64 510696c5ddc4Srjsstruct mali_job_header_packed { uint32_t opaque[8]; }; 510796c5ddc4Srjsstatic inline void 510896c5ddc4SrjsMALI_JOB_HEADER_unpack(const uint8_t * restrict cl, 510996c5ddc4Srjs struct MALI_JOB_HEADER * restrict values) 511096c5ddc4Srjs{ 511196c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0x2400) fprintf(stderr, "XXX: Invalid field of Job Header unpacked at word 4\n"); 511296c5ddc4Srjs values->exception_status = __gen_unpack_uint(cl, 0, 31); 511396c5ddc4Srjs values->first_incomplete_task = __gen_unpack_uint(cl, 32, 63); 511496c5ddc4Srjs values->fault_pointer = __gen_unpack_uint(cl, 64, 127); 511596c5ddc4Srjs values->is_64b = __gen_unpack_uint(cl, 128, 128); 511696c5ddc4Srjs values->type = (enum mali_job_type)__gen_unpack_uint(cl, 129, 135); 511796c5ddc4Srjs values->barrier = __gen_unpack_uint(cl, 136, 136); 511896c5ddc4Srjs values->invalidate_cache = __gen_unpack_uint(cl, 137, 137); 511996c5ddc4Srjs values->suppress_prefetch = __gen_unpack_uint(cl, 139, 139); 512096c5ddc4Srjs values->enable_texture_mapper = __gen_unpack_uint(cl, 140, 140); 512196c5ddc4Srjs values->relax_dependency_1 = __gen_unpack_uint(cl, 142, 142); 512296c5ddc4Srjs values->relax_dependency_2 = __gen_unpack_uint(cl, 143, 143); 512396c5ddc4Srjs values->index = __gen_unpack_uint(cl, 144, 159); 512496c5ddc4Srjs values->dependency_1 = __gen_unpack_uint(cl, 160, 175); 512596c5ddc4Srjs values->dependency_2 = __gen_unpack_uint(cl, 176, 191); 512696c5ddc4Srjs values->next = __gen_unpack_uint(cl, 192, 255); 512796c5ddc4Srjs} 512896c5ddc4Srjs 512996c5ddc4Srjsstatic inline void 513096c5ddc4SrjsMALI_JOB_HEADER_print(FILE *fp, const struct MALI_JOB_HEADER * values, unsigned indent) 513196c5ddc4Srjs{ 513296c5ddc4Srjs fprintf(fp, "%*sException Status: %u\n", indent, "", values->exception_status); 513396c5ddc4Srjs fprintf(fp, "%*sFirst Incomplete Task: %u\n", indent, "", values->first_incomplete_task); 513496c5ddc4Srjs fprintf(fp, "%*sFault Pointer: 0x%" PRIx64 "\n", indent, "", values->fault_pointer); 513596c5ddc4Srjs fprintf(fp, "%*sIs 64b: %s\n", indent, "", values->is_64b ? "true" : "false"); 513696c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_job_type_as_str(values->type)); 513796c5ddc4Srjs fprintf(fp, "%*sBarrier: %s\n", indent, "", values->barrier ? "true" : "false"); 513896c5ddc4Srjs fprintf(fp, "%*sInvalidate Cache: %s\n", indent, "", values->invalidate_cache ? "true" : "false"); 513996c5ddc4Srjs fprintf(fp, "%*sSuppress Prefetch: %s\n", indent, "", values->suppress_prefetch ? "true" : "false"); 514096c5ddc4Srjs fprintf(fp, "%*sEnable Texture Mapper: %s\n", indent, "", values->enable_texture_mapper ? "true" : "false"); 514196c5ddc4Srjs fprintf(fp, "%*sRelax Dependency 1: %s\n", indent, "", values->relax_dependency_1 ? "true" : "false"); 514296c5ddc4Srjs fprintf(fp, "%*sRelax Dependency 2: %s\n", indent, "", values->relax_dependency_2 ? "true" : "false"); 514396c5ddc4Srjs fprintf(fp, "%*sIndex: %u\n", indent, "", values->index); 514496c5ddc4Srjs fprintf(fp, "%*sDependency 1: %u\n", indent, "", values->dependency_1); 514596c5ddc4Srjs fprintf(fp, "%*sDependency 2: %u\n", indent, "", values->dependency_2); 514696c5ddc4Srjs fprintf(fp, "%*sNext: 0x%" PRIx64 "\n", indent, "", values->next); 514796c5ddc4Srjs} 514896c5ddc4Srjs 514996c5ddc4Srjsstruct MALI_FRAGMENT_JOB_PAYLOAD { 515096c5ddc4Srjs uint32_t bound_min_x; 515196c5ddc4Srjs uint32_t bound_min_y; 515296c5ddc4Srjs uint32_t bound_max_x; 515396c5ddc4Srjs uint32_t bound_max_y; 515496c5ddc4Srjs bool has_tile_enable_map; 515596c5ddc4Srjs uint64_t framebuffer; 515696c5ddc4Srjs uint64_t tile_enable_map; 515796c5ddc4Srjs uint32_t tile_enable_map_row_stride; 515896c5ddc4Srjs}; 515996c5ddc4Srjs 516096c5ddc4Srjs#define MALI_FRAGMENT_JOB_PAYLOAD_header \ 516196c5ddc4Srjs 0 516296c5ddc4Srjs 516396c5ddc4Srjsstatic inline void 516496c5ddc4SrjsMALI_FRAGMENT_JOB_PAYLOAD_pack(uint32_t * restrict cl, 516596c5ddc4Srjs const struct MALI_FRAGMENT_JOB_PAYLOAD * restrict values) 516696c5ddc4Srjs{ 516796c5ddc4Srjs cl[ 0] = __gen_uint(values->bound_min_x, 0, 11) | 516896c5ddc4Srjs __gen_uint(values->bound_min_y, 16, 27); 516996c5ddc4Srjs cl[ 1] = __gen_uint(values->bound_max_x, 0, 11) | 517096c5ddc4Srjs __gen_uint(values->bound_max_y, 16, 27) | 517196c5ddc4Srjs __gen_uint(values->has_tile_enable_map, 31, 31); 517296c5ddc4Srjs cl[ 2] = __gen_uint(values->framebuffer, 0, 63); 517396c5ddc4Srjs cl[ 3] = __gen_uint(values->framebuffer, 0, 63) >> 32; 517496c5ddc4Srjs cl[ 4] = __gen_uint(values->tile_enable_map, 0, 63); 517596c5ddc4Srjs cl[ 5] = __gen_uint(values->tile_enable_map, 0, 63) >> 32; 517696c5ddc4Srjs cl[ 6] = __gen_uint(values->tile_enable_map_row_stride, 0, 7); 517796c5ddc4Srjs cl[ 7] = 0; 517896c5ddc4Srjs} 517996c5ddc4Srjs 518096c5ddc4Srjs 518196c5ddc4Srjs#define MALI_FRAGMENT_JOB_PAYLOAD_LENGTH 32 518296c5ddc4Srjsstruct mali_fragment_job_payload_packed { uint32_t opaque[8]; }; 518396c5ddc4Srjsstatic inline void 518496c5ddc4SrjsMALI_FRAGMENT_JOB_PAYLOAD_unpack(const uint8_t * restrict cl, 518596c5ddc4Srjs struct MALI_FRAGMENT_JOB_PAYLOAD * restrict values) 518696c5ddc4Srjs{ 518796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf000f000) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 0\n"); 518896c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0x7000f000) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 1\n"); 518996c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffff00) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 6\n"); 519096c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 7\n"); 519196c5ddc4Srjs values->bound_min_x = __gen_unpack_uint(cl, 0, 11); 519296c5ddc4Srjs values->bound_min_y = __gen_unpack_uint(cl, 16, 27); 519396c5ddc4Srjs values->bound_max_x = __gen_unpack_uint(cl, 32, 43); 519496c5ddc4Srjs values->bound_max_y = __gen_unpack_uint(cl, 48, 59); 519596c5ddc4Srjs values->has_tile_enable_map = __gen_unpack_uint(cl, 63, 63); 519696c5ddc4Srjs values->framebuffer = __gen_unpack_uint(cl, 64, 127); 519796c5ddc4Srjs values->tile_enable_map = __gen_unpack_uint(cl, 128, 191); 519896c5ddc4Srjs values->tile_enable_map_row_stride = __gen_unpack_uint(cl, 192, 199); 519996c5ddc4Srjs} 520096c5ddc4Srjs 520196c5ddc4Srjsstatic inline void 520296c5ddc4SrjsMALI_FRAGMENT_JOB_PAYLOAD_print(FILE *fp, const struct MALI_FRAGMENT_JOB_PAYLOAD * values, unsigned indent) 520396c5ddc4Srjs{ 520496c5ddc4Srjs fprintf(fp, "%*sBound Min X: %u\n", indent, "", values->bound_min_x); 520596c5ddc4Srjs fprintf(fp, "%*sBound Min Y: %u\n", indent, "", values->bound_min_y); 520696c5ddc4Srjs fprintf(fp, "%*sBound Max X: %u\n", indent, "", values->bound_max_x); 520796c5ddc4Srjs fprintf(fp, "%*sBound Max Y: %u\n", indent, "", values->bound_max_y); 520896c5ddc4Srjs fprintf(fp, "%*sHas Tile Enable Map: %s\n", indent, "", values->has_tile_enable_map ? "true" : "false"); 520996c5ddc4Srjs fprintf(fp, "%*sFramebuffer: 0x%" PRIx64 "\n", indent, "", values->framebuffer); 521096c5ddc4Srjs fprintf(fp, "%*sTile Enable Map: 0x%" PRIx64 "\n", indent, "", values->tile_enable_map); 521196c5ddc4Srjs fprintf(fp, "%*sTile Enable Map Row Stride: %u\n", indent, "", values->tile_enable_map_row_stride); 521296c5ddc4Srjs} 521396c5ddc4Srjs 521496c5ddc4Srjsstruct mali_fragment_job_packed { 521596c5ddc4Srjs uint32_t opaque[16]; 521696c5ddc4Srjs}; 521796c5ddc4Srjs 521896c5ddc4Srjs#define MALI_FRAGMENT_JOB_LENGTH 64 521996c5ddc4Srjs#define MALI_FRAGMENT_JOB_ALIGN 64 522096c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 522196c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 522296c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 522396c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 522496c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 522596c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_OFFSET 0 522696c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_TYPE struct MALI_FRAGMENT_JOB_PAYLOAD 522796c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_header MALI_FRAGMENT_JOB_PAYLOAD_header 522896c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_pack MALI_FRAGMENT_JOB_PAYLOAD_pack 522996c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_unpack MALI_FRAGMENT_JOB_PAYLOAD_unpack 523096c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_print MALI_FRAGMENT_JOB_PAYLOAD_print 523196c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_OFFSET 32 523296c5ddc4Srjs 523396c5ddc4Srjsenum mali_write_value_type { 523496c5ddc4Srjs MALI_WRITE_VALUE_TYPE_CYCLE_COUNTER = 1, 523596c5ddc4Srjs MALI_WRITE_VALUE_TYPE_SYSTEM_TIMESTAMP = 2, 523696c5ddc4Srjs MALI_WRITE_VALUE_TYPE_ZERO = 3, 523796c5ddc4Srjs MALI_WRITE_VALUE_TYPE_IMMEDIATE_8 = 4, 523896c5ddc4Srjs MALI_WRITE_VALUE_TYPE_IMMEDIATE_16 = 5, 523996c5ddc4Srjs MALI_WRITE_VALUE_TYPE_IMMEDIATE_32 = 6, 524096c5ddc4Srjs MALI_WRITE_VALUE_TYPE_IMMEDIATE_64 = 7, 524196c5ddc4Srjs}; 524296c5ddc4Srjs 524396c5ddc4Srjsstatic inline const char * 524496c5ddc4Srjsmali_write_value_type_as_str(enum mali_write_value_type imm) 524596c5ddc4Srjs{ 524696c5ddc4Srjs switch (imm) { 524796c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_CYCLE_COUNTER: return "Cycle Counter"; 524896c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_SYSTEM_TIMESTAMP: return "System Timestamp"; 524996c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_ZERO: return "Zero"; 525096c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_IMMEDIATE_8: return "Immediate 8"; 525196c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_IMMEDIATE_16: return "Immediate 16"; 525296c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_IMMEDIATE_32: return "Immediate 32"; 525396c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_IMMEDIATE_64: return "Immediate 64"; 525496c5ddc4Srjs default: return "XXX: INVALID"; 525596c5ddc4Srjs } 525696c5ddc4Srjs} 525796c5ddc4Srjs 525896c5ddc4Srjsstruct MALI_WRITE_VALUE_JOB_PAYLOAD { 525996c5ddc4Srjs uint64_t address; 526096c5ddc4Srjs enum mali_write_value_type type; 526196c5ddc4Srjs uint64_t immediate_value; 526296c5ddc4Srjs}; 526396c5ddc4Srjs 526496c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_PAYLOAD_header \ 526596c5ddc4Srjs 0 526696c5ddc4Srjs 526796c5ddc4Srjsstatic inline void 526896c5ddc4SrjsMALI_WRITE_VALUE_JOB_PAYLOAD_pack(uint32_t * restrict cl, 526996c5ddc4Srjs const struct MALI_WRITE_VALUE_JOB_PAYLOAD * restrict values) 527096c5ddc4Srjs{ 527196c5ddc4Srjs cl[ 0] = __gen_uint(values->address, 0, 63); 527296c5ddc4Srjs cl[ 1] = __gen_uint(values->address, 0, 63) >> 32; 527396c5ddc4Srjs cl[ 2] = __gen_uint(values->type, 0, 31); 527496c5ddc4Srjs cl[ 3] = 0; 527596c5ddc4Srjs cl[ 4] = __gen_uint(values->immediate_value, 0, 63); 527696c5ddc4Srjs cl[ 5] = __gen_uint(values->immediate_value, 0, 63) >> 32; 527796c5ddc4Srjs} 527896c5ddc4Srjs 527996c5ddc4Srjs 528096c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_PAYLOAD_LENGTH 24 528196c5ddc4Srjsstruct mali_write_value_job_payload_packed { uint32_t opaque[6]; }; 528296c5ddc4Srjsstatic inline void 528396c5ddc4SrjsMALI_WRITE_VALUE_JOB_PAYLOAD_unpack(const uint8_t * restrict cl, 528496c5ddc4Srjs struct MALI_WRITE_VALUE_JOB_PAYLOAD * restrict values) 528596c5ddc4Srjs{ 528696c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Write Value Job Payload unpacked at word 3\n"); 528796c5ddc4Srjs values->address = __gen_unpack_uint(cl, 0, 63); 528896c5ddc4Srjs values->type = (enum mali_write_value_type)__gen_unpack_uint(cl, 64, 95); 528996c5ddc4Srjs values->immediate_value = __gen_unpack_uint(cl, 128, 191); 529096c5ddc4Srjs} 529196c5ddc4Srjs 529296c5ddc4Srjsstatic inline void 529396c5ddc4SrjsMALI_WRITE_VALUE_JOB_PAYLOAD_print(FILE *fp, const struct MALI_WRITE_VALUE_JOB_PAYLOAD * values, unsigned indent) 529496c5ddc4Srjs{ 529596c5ddc4Srjs fprintf(fp, "%*sAddress: 0x%" PRIx64 "\n", indent, "", values->address); 529696c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_write_value_type_as_str(values->type)); 529796c5ddc4Srjs fprintf(fp, "%*sImmediate Value: 0x%" PRIx64 "\n", indent, "", values->immediate_value); 529896c5ddc4Srjs} 529996c5ddc4Srjs 530096c5ddc4Srjsstruct MALI_CACHE_FLUSH_JOB_PAYLOAD { 530196c5ddc4Srjs bool clean_shader_core_ls; 530296c5ddc4Srjs bool invalidate_shader_core_ls; 530396c5ddc4Srjs bool invalidate_shader_core_other; 530496c5ddc4Srjs bool job_manager_clean; 530596c5ddc4Srjs bool job_manager_invalidate; 530696c5ddc4Srjs bool tiler_clean; 530796c5ddc4Srjs bool tiler_invalidate; 530896c5ddc4Srjs bool l2_clean; 530996c5ddc4Srjs bool l2_invalidate; 531096c5ddc4Srjs}; 531196c5ddc4Srjs 531296c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_PAYLOAD_header \ 531396c5ddc4Srjs 0 531496c5ddc4Srjs 531596c5ddc4Srjsstatic inline void 531696c5ddc4SrjsMALI_CACHE_FLUSH_JOB_PAYLOAD_pack(uint32_t * restrict cl, 531796c5ddc4Srjs const struct MALI_CACHE_FLUSH_JOB_PAYLOAD * restrict values) 531896c5ddc4Srjs{ 531996c5ddc4Srjs cl[ 0] = __gen_uint(values->clean_shader_core_ls, 0, 0) | 532096c5ddc4Srjs __gen_uint(values->invalidate_shader_core_ls, 1, 1) | 532196c5ddc4Srjs __gen_uint(values->invalidate_shader_core_other, 2, 2) | 532296c5ddc4Srjs __gen_uint(values->job_manager_clean, 16, 16) | 532396c5ddc4Srjs __gen_uint(values->job_manager_invalidate, 17, 17) | 532496c5ddc4Srjs __gen_uint(values->tiler_clean, 24, 24) | 532596c5ddc4Srjs __gen_uint(values->tiler_invalidate, 25, 25); 532696c5ddc4Srjs cl[ 1] = __gen_uint(values->l2_clean, 0, 0) | 532796c5ddc4Srjs __gen_uint(values->l2_invalidate, 1, 1); 532896c5ddc4Srjs} 532996c5ddc4Srjs 533096c5ddc4Srjs 533196c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_PAYLOAD_LENGTH 8 533296c5ddc4Srjsstruct mali_cache_flush_job_payload_packed { uint32_t opaque[2]; }; 533396c5ddc4Srjsstatic inline void 533496c5ddc4SrjsMALI_CACHE_FLUSH_JOB_PAYLOAD_unpack(const uint8_t * restrict cl, 533596c5ddc4Srjs struct MALI_CACHE_FLUSH_JOB_PAYLOAD * restrict values) 533696c5ddc4Srjs{ 533796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xfcfcfff8) fprintf(stderr, "XXX: Invalid field of Cache Flush Job Payload unpacked at word 0\n"); 533896c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xfffffffc) fprintf(stderr, "XXX: Invalid field of Cache Flush Job Payload unpacked at word 1\n"); 533996c5ddc4Srjs values->clean_shader_core_ls = __gen_unpack_uint(cl, 0, 0); 534096c5ddc4Srjs values->invalidate_shader_core_ls = __gen_unpack_uint(cl, 1, 1); 534196c5ddc4Srjs values->invalidate_shader_core_other = __gen_unpack_uint(cl, 2, 2); 534296c5ddc4Srjs values->job_manager_clean = __gen_unpack_uint(cl, 16, 16); 534396c5ddc4Srjs values->job_manager_invalidate = __gen_unpack_uint(cl, 17, 17); 534496c5ddc4Srjs values->tiler_clean = __gen_unpack_uint(cl, 24, 24); 534596c5ddc4Srjs values->tiler_invalidate = __gen_unpack_uint(cl, 25, 25); 534696c5ddc4Srjs values->l2_clean = __gen_unpack_uint(cl, 32, 32); 534796c5ddc4Srjs values->l2_invalidate = __gen_unpack_uint(cl, 33, 33); 534896c5ddc4Srjs} 534996c5ddc4Srjs 535096c5ddc4Srjsstatic inline void 535196c5ddc4SrjsMALI_CACHE_FLUSH_JOB_PAYLOAD_print(FILE *fp, const struct MALI_CACHE_FLUSH_JOB_PAYLOAD * values, unsigned indent) 535296c5ddc4Srjs{ 535396c5ddc4Srjs fprintf(fp, "%*sClean Shader Core LS: %s\n", indent, "", values->clean_shader_core_ls ? "true" : "false"); 535496c5ddc4Srjs fprintf(fp, "%*sInvalidate Shader Core LS: %s\n", indent, "", values->invalidate_shader_core_ls ? "true" : "false"); 535596c5ddc4Srjs fprintf(fp, "%*sInvalidate Shader Core Other: %s\n", indent, "", values->invalidate_shader_core_other ? "true" : "false"); 535696c5ddc4Srjs fprintf(fp, "%*sJob Manager Clean: %s\n", indent, "", values->job_manager_clean ? "true" : "false"); 535796c5ddc4Srjs fprintf(fp, "%*sJob Manager Invalidate: %s\n", indent, "", values->job_manager_invalidate ? "true" : "false"); 535896c5ddc4Srjs fprintf(fp, "%*sTiler Clean: %s\n", indent, "", values->tiler_clean ? "true" : "false"); 535996c5ddc4Srjs fprintf(fp, "%*sTiler Invalidate: %s\n", indent, "", values->tiler_invalidate ? "true" : "false"); 536096c5ddc4Srjs fprintf(fp, "%*sL2 Clean: %s\n", indent, "", values->l2_clean ? "true" : "false"); 536196c5ddc4Srjs fprintf(fp, "%*sL2 Invalidate: %s\n", indent, "", values->l2_invalidate ? "true" : "false"); 536296c5ddc4Srjs} 536396c5ddc4Srjs 536496c5ddc4Srjsstruct mali_write_value_job_packed { 536596c5ddc4Srjs uint32_t opaque[14]; 536696c5ddc4Srjs}; 536796c5ddc4Srjs 536896c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_LENGTH 56 536996c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_ALIGN 64 537096c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 537196c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 537296c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 537396c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 537496c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 537596c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_OFFSET 0 537696c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_TYPE struct MALI_WRITE_VALUE_JOB_PAYLOAD 537796c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_header MALI_WRITE_VALUE_JOB_PAYLOAD_header 537896c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_pack MALI_WRITE_VALUE_JOB_PAYLOAD_pack 537996c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_unpack MALI_WRITE_VALUE_JOB_PAYLOAD_unpack 538096c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_print MALI_WRITE_VALUE_JOB_PAYLOAD_print 538196c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_OFFSET 32 538296c5ddc4Srjs 538396c5ddc4Srjsstruct mali_cache_flush_job_packed { 538496c5ddc4Srjs uint32_t opaque[10]; 538596c5ddc4Srjs}; 538696c5ddc4Srjs 538796c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_LENGTH 40 538896c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_ALIGN 64 538996c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 539096c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 539196c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 539296c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 539396c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 539496c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_OFFSET 0 539596c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_TYPE struct MALI_CACHE_FLUSH_JOB_PAYLOAD 539696c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_header MALI_CACHE_FLUSH_JOB_PAYLOAD_header 539796c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_pack MALI_CACHE_FLUSH_JOB_PAYLOAD_pack 539896c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_unpack MALI_CACHE_FLUSH_JOB_PAYLOAD_unpack 539996c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_print MALI_CACHE_FLUSH_JOB_PAYLOAD_print 540096c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_OFFSET 32 540196c5ddc4Srjs 540296c5ddc4Srjsstruct MALI_COMPUTE_JOB_PARAMETERS { 540396c5ddc4Srjs uint32_t job_task_split; 540496c5ddc4Srjs}; 540596c5ddc4Srjs 540696c5ddc4Srjs#define MALI_COMPUTE_JOB_PARAMETERS_header \ 540796c5ddc4Srjs 0 540896c5ddc4Srjs 540996c5ddc4Srjsstatic inline void 541096c5ddc4SrjsMALI_COMPUTE_JOB_PARAMETERS_pack(uint32_t * restrict cl, 541196c5ddc4Srjs const struct MALI_COMPUTE_JOB_PARAMETERS * restrict values) 541296c5ddc4Srjs{ 541396c5ddc4Srjs cl[ 0] = __gen_uint(values->job_task_split, 26, 29); 541496c5ddc4Srjs cl[ 1] = 0; 541596c5ddc4Srjs cl[ 2] = 0; 541696c5ddc4Srjs cl[ 3] = 0; 541796c5ddc4Srjs cl[ 4] = 0; 541896c5ddc4Srjs cl[ 5] = 0; 541996c5ddc4Srjs} 542096c5ddc4Srjs 542196c5ddc4Srjs 542296c5ddc4Srjs#define MALI_COMPUTE_JOB_PARAMETERS_LENGTH 24 542396c5ddc4Srjsstruct mali_compute_job_parameters_packed { uint32_t opaque[6]; }; 542496c5ddc4Srjsstatic inline void 542596c5ddc4SrjsMALI_COMPUTE_JOB_PARAMETERS_unpack(const uint8_t * restrict cl, 542696c5ddc4Srjs struct MALI_COMPUTE_JOB_PARAMETERS * restrict values) 542796c5ddc4Srjs{ 542896c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xc3ffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 0\n"); 542996c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 1\n"); 543096c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 2\n"); 543196c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 3\n"); 543296c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 4\n"); 543396c5ddc4Srjs if (((const uint32_t *) cl)[5] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 5\n"); 543496c5ddc4Srjs values->job_task_split = __gen_unpack_uint(cl, 26, 29); 543596c5ddc4Srjs} 543696c5ddc4Srjs 543796c5ddc4Srjsstatic inline void 543896c5ddc4SrjsMALI_COMPUTE_JOB_PARAMETERS_print(FILE *fp, const struct MALI_COMPUTE_JOB_PARAMETERS * values, unsigned indent) 543996c5ddc4Srjs{ 544096c5ddc4Srjs fprintf(fp, "%*sJob Task Split: %u\n", indent, "", values->job_task_split); 544196c5ddc4Srjs} 544296c5ddc4Srjs 544396c5ddc4Srjsstruct mali_compute_job_packed { 544496c5ddc4Srjs uint32_t opaque[48]; 544596c5ddc4Srjs}; 544696c5ddc4Srjs 544796c5ddc4Srjs#define MALI_COMPUTE_JOB_LENGTH 192 544896c5ddc4Srjs#define MALI_COMPUTE_JOB_ALIGN 64 544996c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 545096c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 545196c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 545296c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 545396c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 545496c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_OFFSET 0 545596c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_TYPE struct MALI_INVOCATION 545696c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_header MALI_INVOCATION_header 545796c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_pack MALI_INVOCATION_pack 545896c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_unpack MALI_INVOCATION_unpack 545996c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_print MALI_INVOCATION_print 546096c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_OFFSET 32 546196c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_TYPE struct MALI_COMPUTE_JOB_PARAMETERS 546296c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_header MALI_COMPUTE_JOB_PARAMETERS_header 546396c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_pack MALI_COMPUTE_JOB_PARAMETERS_pack 546496c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_unpack MALI_COMPUTE_JOB_PARAMETERS_unpack 546596c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_print MALI_COMPUTE_JOB_PARAMETERS_print 546696c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_OFFSET 40 546796c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_TYPE struct MALI_DRAW 546896c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_header MALI_DRAW_header 546996c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_pack MALI_DRAW_pack 547096c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_unpack MALI_DRAW_unpack 547196c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_print MALI_DRAW_print 547296c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_OFFSET 64 547396c5ddc4Srjs 547496c5ddc4Srjsstruct MALI_PRIMITIVE_SIZE { 547596c5ddc4Srjs float constant; 547696c5ddc4Srjs uint64_t size_array; 547796c5ddc4Srjs}; 547896c5ddc4Srjs 547996c5ddc4Srjs#define MALI_PRIMITIVE_SIZE_header \ 548096c5ddc4Srjs 0 548196c5ddc4Srjs 548296c5ddc4Srjsstatic inline void 548396c5ddc4SrjsMALI_PRIMITIVE_SIZE_pack(uint32_t * restrict cl, 548496c5ddc4Srjs const struct MALI_PRIMITIVE_SIZE * restrict values) 548596c5ddc4Srjs{ 548696c5ddc4Srjs cl[ 0] = __gen_uint(fui(values->constant), 0, 32) | 548796c5ddc4Srjs __gen_uint(values->size_array, 0, 63); 548896c5ddc4Srjs cl[ 1] = __gen_uint(values->size_array, 0, 63) >> 32; 548996c5ddc4Srjs} 549096c5ddc4Srjs 549196c5ddc4Srjs 549296c5ddc4Srjs#define MALI_PRIMITIVE_SIZE_LENGTH 8 549396c5ddc4Srjsstruct mali_primitive_size_packed { uint32_t opaque[2]; }; 549496c5ddc4Srjsstatic inline void 549596c5ddc4SrjsMALI_PRIMITIVE_SIZE_unpack(const uint8_t * restrict cl, 549696c5ddc4Srjs struct MALI_PRIMITIVE_SIZE * restrict values) 549796c5ddc4Srjs{ 549896c5ddc4Srjs values->constant = __gen_unpack_float(cl, 0, 31); 549996c5ddc4Srjs values->size_array = __gen_unpack_uint(cl, 0, 63); 550096c5ddc4Srjs} 550196c5ddc4Srjs 550296c5ddc4Srjsstatic inline void 550396c5ddc4SrjsMALI_PRIMITIVE_SIZE_print(FILE *fp, const struct MALI_PRIMITIVE_SIZE * values, unsigned indent) 550496c5ddc4Srjs{ 550596c5ddc4Srjs fprintf(fp, "%*sConstant: %f\n", indent, "", values->constant); 550696c5ddc4Srjs fprintf(fp, "%*sSize Array: 0x%" PRIx64 "\n", indent, "", values->size_array); 550796c5ddc4Srjs} 550896c5ddc4Srjs 550996c5ddc4Srjsstruct MALI_TILER_POINTER { 551096c5ddc4Srjs uint64_t address; 551196c5ddc4Srjs}; 551296c5ddc4Srjs 551396c5ddc4Srjs#define MALI_TILER_POINTER_header \ 551496c5ddc4Srjs 0 551596c5ddc4Srjs 551696c5ddc4Srjsstatic inline void 551796c5ddc4SrjsMALI_TILER_POINTER_pack(uint32_t * restrict cl, 551896c5ddc4Srjs const struct MALI_TILER_POINTER * restrict values) 551996c5ddc4Srjs{ 552096c5ddc4Srjs cl[ 0] = __gen_uint(values->address, 0, 63); 552196c5ddc4Srjs cl[ 1] = __gen_uint(values->address, 0, 63) >> 32; 552296c5ddc4Srjs} 552396c5ddc4Srjs 552496c5ddc4Srjs 552596c5ddc4Srjs#define MALI_TILER_POINTER_LENGTH 8 552696c5ddc4Srjsstruct mali_tiler_pointer_packed { uint32_t opaque[2]; }; 552796c5ddc4Srjsstatic inline void 552896c5ddc4SrjsMALI_TILER_POINTER_unpack(const uint8_t * restrict cl, 552996c5ddc4Srjs struct MALI_TILER_POINTER * restrict values) 553096c5ddc4Srjs{ 553196c5ddc4Srjs values->address = __gen_unpack_uint(cl, 0, 63); 553296c5ddc4Srjs} 553396c5ddc4Srjs 553496c5ddc4Srjsstatic inline void 553596c5ddc4SrjsMALI_TILER_POINTER_print(FILE *fp, const struct MALI_TILER_POINTER * values, unsigned indent) 553696c5ddc4Srjs{ 553796c5ddc4Srjs fprintf(fp, "%*sAddress: 0x%" PRIx64 "\n", indent, "", values->address); 553896c5ddc4Srjs} 553996c5ddc4Srjs 554096c5ddc4Srjsstruct MALI_TILER_JOB_PADDING { 554196c5ddc4Srjs int dummy; 554296c5ddc4Srjs}; 554396c5ddc4Srjs 554496c5ddc4Srjs#define MALI_TILER_JOB_PADDING_header \ 554596c5ddc4Srjs 0 554696c5ddc4Srjs 554796c5ddc4Srjsstatic inline void 554896c5ddc4SrjsMALI_TILER_JOB_PADDING_pack(uint32_t * restrict cl, 554996c5ddc4Srjs const struct MALI_TILER_JOB_PADDING * restrict values) 555096c5ddc4Srjs{ 555196c5ddc4Srjs cl[ 0] = 0; 555296c5ddc4Srjs cl[ 1] = 0; 555396c5ddc4Srjs cl[ 2] = 0; 555496c5ddc4Srjs cl[ 3] = 0; 555596c5ddc4Srjs cl[ 4] = 0; 555696c5ddc4Srjs cl[ 5] = 0; 555796c5ddc4Srjs cl[ 6] = 0; 555896c5ddc4Srjs cl[ 7] = 0; 555996c5ddc4Srjs cl[ 8] = 0; 556096c5ddc4Srjs cl[ 9] = 0; 556196c5ddc4Srjs cl[10] = 0; 556296c5ddc4Srjs cl[11] = 0; 556396c5ddc4Srjs} 556496c5ddc4Srjs 556596c5ddc4Srjs 556696c5ddc4Srjs#define MALI_TILER_JOB_PADDING_LENGTH 48 556796c5ddc4Srjsstruct mali_tiler_job_padding_packed { uint32_t opaque[12]; }; 556896c5ddc4Srjsstatic inline void 556996c5ddc4SrjsMALI_TILER_JOB_PADDING_unpack(const uint8_t * restrict cl, 557096c5ddc4Srjs struct MALI_TILER_JOB_PADDING * restrict values) 557196c5ddc4Srjs{ 557296c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 0\n"); 557396c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 1\n"); 557496c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 2\n"); 557596c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 3\n"); 557696c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 4\n"); 557796c5ddc4Srjs if (((const uint32_t *) cl)[5] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 5\n"); 557896c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 6\n"); 557996c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 7\n"); 558096c5ddc4Srjs if (((const uint32_t *) cl)[8] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 8\n"); 558196c5ddc4Srjs if (((const uint32_t *) cl)[9] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 9\n"); 558296c5ddc4Srjs if (((const uint32_t *) cl)[10] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 10\n"); 558396c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Tiler Job Padding unpacked at word 11\n"); 558496c5ddc4Srjs} 558596c5ddc4Srjs 558696c5ddc4Srjsstatic inline void 558796c5ddc4SrjsMALI_TILER_JOB_PADDING_print(FILE *fp, const struct MALI_TILER_JOB_PADDING * values, unsigned indent) 558896c5ddc4Srjs{ 558996c5ddc4Srjs} 559096c5ddc4Srjs 559196c5ddc4Srjsstruct mali_tiler_job_packed { 559296c5ddc4Srjs uint32_t opaque[64]; 559396c5ddc4Srjs}; 559496c5ddc4Srjs 559596c5ddc4Srjs#define MALI_TILER_JOB_LENGTH 256 559696c5ddc4Srjs#define MALI_TILER_JOB_ALIGN 64 559796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 559896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 559996c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 560096c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 560196c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 560296c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_OFFSET 0 560396c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_TYPE struct MALI_INVOCATION 560496c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_header MALI_INVOCATION_header 560596c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_pack MALI_INVOCATION_pack 560696c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_unpack MALI_INVOCATION_unpack 560796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_print MALI_INVOCATION_print 560896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_OFFSET 32 560996c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_TYPE struct MALI_PRIMITIVE 561096c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_header MALI_PRIMITIVE_header 561196c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_pack MALI_PRIMITIVE_pack 561296c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_unpack MALI_PRIMITIVE_unpack 561396c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_print MALI_PRIMITIVE_print 561496c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_OFFSET 40 561596c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_TYPE struct MALI_PRIMITIVE_SIZE 561696c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_header MALI_PRIMITIVE_SIZE_header 561796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_pack MALI_PRIMITIVE_SIZE_pack 561896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_unpack MALI_PRIMITIVE_SIZE_unpack 561996c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_print MALI_PRIMITIVE_SIZE_print 562096c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_OFFSET 64 562196c5ddc4Srjs#define MALI_TILER_JOB_SECTION_TILER_TYPE struct MALI_TILER_POINTER 562296c5ddc4Srjs#define MALI_TILER_JOB_SECTION_TILER_header MALI_TILER_POINTER_header 562396c5ddc4Srjs#define MALI_TILER_JOB_SECTION_TILER_pack MALI_TILER_POINTER_pack 562496c5ddc4Srjs#define MALI_TILER_JOB_SECTION_TILER_unpack MALI_TILER_POINTER_unpack 562596c5ddc4Srjs#define MALI_TILER_JOB_SECTION_TILER_print MALI_TILER_POINTER_print 562696c5ddc4Srjs#define MALI_TILER_JOB_SECTION_TILER_OFFSET 72 562796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PADDING_TYPE struct MALI_TILER_JOB_PADDING 562896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PADDING_header MALI_TILER_JOB_PADDING_header 562996c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PADDING_pack MALI_TILER_JOB_PADDING_pack 563096c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PADDING_unpack MALI_TILER_JOB_PADDING_unpack 563196c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PADDING_print MALI_TILER_JOB_PADDING_print 563296c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PADDING_OFFSET 80 563396c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_TYPE struct MALI_DRAW 563496c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_header MALI_DRAW_header 563596c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_pack MALI_DRAW_pack 563696c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_unpack MALI_DRAW_unpack 563796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_print MALI_DRAW_print 563896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_OFFSET 128 563996c5ddc4Srjs 564096c5ddc4Srjsstruct mali_indexed_vertex_job_packed { 564196c5ddc4Srjs uint32_t opaque[96]; 564296c5ddc4Srjs}; 564396c5ddc4Srjs 564496c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_LENGTH 384 564596c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_ALIGN 64 564696c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 564796c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 564896c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 564996c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 565096c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 565196c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_HEADER_OFFSET 0 565296c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_INVOCATION_TYPE struct MALI_INVOCATION 565396c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_INVOCATION_header MALI_INVOCATION_header 565496c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_INVOCATION_pack MALI_INVOCATION_pack 565596c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_INVOCATION_unpack MALI_INVOCATION_unpack 565696c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_INVOCATION_print MALI_INVOCATION_print 565796c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_INVOCATION_OFFSET 32 565896c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_TYPE struct MALI_PRIMITIVE 565996c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_header MALI_PRIMITIVE_header 566096c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_pack MALI_PRIMITIVE_pack 566196c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_unpack MALI_PRIMITIVE_unpack 566296c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_print MALI_PRIMITIVE_print 566396c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_OFFSET 40 566496c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_SIZE_TYPE struct MALI_PRIMITIVE_SIZE 566596c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_SIZE_header MALI_PRIMITIVE_SIZE_header 566696c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_SIZE_pack MALI_PRIMITIVE_SIZE_pack 566796c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_SIZE_unpack MALI_PRIMITIVE_SIZE_unpack 566896c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_SIZE_print MALI_PRIMITIVE_SIZE_print 566996c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PRIMITIVE_SIZE_OFFSET 64 567096c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_TILER_TYPE struct MALI_TILER_POINTER 567196c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_TILER_header MALI_TILER_POINTER_header 567296c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_TILER_pack MALI_TILER_POINTER_pack 567396c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_TILER_unpack MALI_TILER_POINTER_unpack 567496c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_TILER_print MALI_TILER_POINTER_print 567596c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_TILER_OFFSET 72 567696c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PADDING_TYPE struct MALI_TILER_JOB_PADDING 567796c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PADDING_header MALI_TILER_JOB_PADDING_header 567896c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PADDING_pack MALI_TILER_JOB_PADDING_pack 567996c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PADDING_unpack MALI_TILER_JOB_PADDING_unpack 568096c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PADDING_print MALI_TILER_JOB_PADDING_print 568196c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_PADDING_OFFSET 80 568296c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_FRAGMENT_DRAW_TYPE struct MALI_DRAW 568396c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_FRAGMENT_DRAW_header MALI_DRAW_header 568496c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_FRAGMENT_DRAW_pack MALI_DRAW_pack 568596c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_FRAGMENT_DRAW_unpack MALI_DRAW_unpack 568696c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_FRAGMENT_DRAW_print MALI_DRAW_print 568796c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_FRAGMENT_DRAW_OFFSET 128 568896c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_VERTEX_DRAW_TYPE struct MALI_DRAW 568996c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_VERTEX_DRAW_header MALI_DRAW_header 569096c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_VERTEX_DRAW_pack MALI_DRAW_pack 569196c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_VERTEX_DRAW_unpack MALI_DRAW_unpack 569296c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_VERTEX_DRAW_print MALI_DRAW_print 569396c5ddc4Srjs#define MALI_INDEXED_VERTEX_JOB_SECTION_VERTEX_DRAW_OFFSET 256 569496c5ddc4Srjs 569596c5ddc4Srjs#include "panfrost-job.h" 569696c5ddc4Srjs#endif 5697