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_attribute_special { 20396c5ddc4Srjs MALI_ATTRIBUTE_SPECIAL_VERTEX_ID = 34, 20496c5ddc4Srjs MALI_ATTRIBUTE_SPECIAL_INSTANCE_ID = 36, 20596c5ddc4Srjs MALI_ATTRIBUTE_SPECIAL_FRAG_COORD = 37, 20696c5ddc4Srjs MALI_ATTRIBUTE_SPECIAL_FRONT_FACING = 38, 20796c5ddc4Srjs MALI_ATTRIBUTE_SPECIAL_POINT_COORD = 97, 20896c5ddc4Srjs}; 20996c5ddc4Srjs 21096c5ddc4Srjsstatic inline const char * 21196c5ddc4Srjsmali_attribute_special_as_str(enum mali_attribute_special imm) 21296c5ddc4Srjs{ 21396c5ddc4Srjs switch (imm) { 21496c5ddc4Srjs case MALI_ATTRIBUTE_SPECIAL_VERTEX_ID: return "Vertex ID"; 21596c5ddc4Srjs case MALI_ATTRIBUTE_SPECIAL_INSTANCE_ID: return "Instance ID"; 21696c5ddc4Srjs case MALI_ATTRIBUTE_SPECIAL_FRAG_COORD: return "Frag Coord"; 21796c5ddc4Srjs case MALI_ATTRIBUTE_SPECIAL_FRONT_FACING: return "Front Facing"; 21896c5ddc4Srjs case MALI_ATTRIBUTE_SPECIAL_POINT_COORD: return "Point Coord"; 21996c5ddc4Srjs default: return "XXX: INVALID"; 22096c5ddc4Srjs } 22196c5ddc4Srjs} 22296c5ddc4Srjs 22396c5ddc4Srjsenum mali_channel { 22496c5ddc4Srjs MALI_CHANNEL_R = 0, 22596c5ddc4Srjs MALI_CHANNEL_G = 1, 22696c5ddc4Srjs MALI_CHANNEL_B = 2, 22796c5ddc4Srjs MALI_CHANNEL_A = 3, 22896c5ddc4Srjs MALI_CHANNEL_0 = 4, 22996c5ddc4Srjs MALI_CHANNEL_1 = 5, 23096c5ddc4Srjs}; 23196c5ddc4Srjs 23296c5ddc4Srjsstatic inline const char * 23396c5ddc4Srjsmali_channel_as_str(enum mali_channel imm) 23496c5ddc4Srjs{ 23596c5ddc4Srjs switch (imm) { 23696c5ddc4Srjs case MALI_CHANNEL_R: return "R"; 23796c5ddc4Srjs case MALI_CHANNEL_G: return "G"; 23896c5ddc4Srjs case MALI_CHANNEL_B: return "B"; 23996c5ddc4Srjs case MALI_CHANNEL_A: return "A"; 24096c5ddc4Srjs case MALI_CHANNEL_0: return "0"; 24196c5ddc4Srjs case MALI_CHANNEL_1: return "1"; 24296c5ddc4Srjs default: return "XXX: INVALID"; 24396c5ddc4Srjs } 24496c5ddc4Srjs} 24596c5ddc4Srjs 24696c5ddc4Srjsenum mali_depth_source { 24796c5ddc4Srjs MALI_DEPTH_SOURCE_MINIMUM = 0, 24896c5ddc4Srjs MALI_DEPTH_SOURCE_MAXIMUM = 1, 24996c5ddc4Srjs MALI_DEPTH_SOURCE_FIXED_FUNCTION = 2, 25096c5ddc4Srjs MALI_DEPTH_SOURCE_SHADER = 3, 25196c5ddc4Srjs}; 25296c5ddc4Srjs 25396c5ddc4Srjsstatic inline const char * 25496c5ddc4Srjsmali_depth_source_as_str(enum mali_depth_source imm) 25596c5ddc4Srjs{ 25696c5ddc4Srjs switch (imm) { 25796c5ddc4Srjs case MALI_DEPTH_SOURCE_MINIMUM: return "Minimum"; 25896c5ddc4Srjs case MALI_DEPTH_SOURCE_MAXIMUM: return "Maximum"; 25996c5ddc4Srjs case MALI_DEPTH_SOURCE_FIXED_FUNCTION: return "Fixed function"; 26096c5ddc4Srjs case MALI_DEPTH_SOURCE_SHADER: return "Shader"; 26196c5ddc4Srjs default: return "XXX: INVALID"; 26296c5ddc4Srjs } 26396c5ddc4Srjs} 26496c5ddc4Srjs 26596c5ddc4Srjsenum mali_job_type { 26696c5ddc4Srjs MALI_JOB_TYPE_NOT_STARTED = 0, 26796c5ddc4Srjs MALI_JOB_TYPE_NULL = 1, 26896c5ddc4Srjs MALI_JOB_TYPE_WRITE_VALUE = 2, 26996c5ddc4Srjs MALI_JOB_TYPE_CACHE_FLUSH = 3, 27096c5ddc4Srjs MALI_JOB_TYPE_COMPUTE = 4, 27196c5ddc4Srjs MALI_JOB_TYPE_VERTEX = 5, 27296c5ddc4Srjs MALI_JOB_TYPE_GEOMETRY = 6, 27396c5ddc4Srjs MALI_JOB_TYPE_TILER = 7, 27496c5ddc4Srjs MALI_JOB_TYPE_FUSED = 8, 27596c5ddc4Srjs MALI_JOB_TYPE_FRAGMENT = 9, 27696c5ddc4Srjs}; 27796c5ddc4Srjs 27896c5ddc4Srjsstatic inline const char * 27996c5ddc4Srjsmali_job_type_as_str(enum mali_job_type imm) 28096c5ddc4Srjs{ 28196c5ddc4Srjs switch (imm) { 28296c5ddc4Srjs case MALI_JOB_TYPE_NOT_STARTED: return "Not started"; 28396c5ddc4Srjs case MALI_JOB_TYPE_NULL: return "Null"; 28496c5ddc4Srjs case MALI_JOB_TYPE_WRITE_VALUE: return "Write value"; 28596c5ddc4Srjs case MALI_JOB_TYPE_CACHE_FLUSH: return "Cache flush"; 28696c5ddc4Srjs case MALI_JOB_TYPE_COMPUTE: return "Compute"; 28796c5ddc4Srjs case MALI_JOB_TYPE_VERTEX: return "Vertex"; 28896c5ddc4Srjs case MALI_JOB_TYPE_GEOMETRY: return "Geometry"; 28996c5ddc4Srjs case MALI_JOB_TYPE_TILER: return "Tiler"; 29096c5ddc4Srjs case MALI_JOB_TYPE_FUSED: return "Fused"; 29196c5ddc4Srjs case MALI_JOB_TYPE_FRAGMENT: return "Fragment"; 29296c5ddc4Srjs default: return "XXX: INVALID"; 29396c5ddc4Srjs } 29496c5ddc4Srjs} 29596c5ddc4Srjs 29696c5ddc4Srjsenum mali_draw_mode { 29796c5ddc4Srjs MALI_DRAW_MODE_POINTS = 1, 29896c5ddc4Srjs MALI_DRAW_MODE_LINES = 2, 29996c5ddc4Srjs MALI_DRAW_MODE_LINES_WITH_ADJACENCY = 3, 30096c5ddc4Srjs MALI_DRAW_MODE_LINE_STRIP = 4, 30196c5ddc4Srjs MALI_DRAW_MODE_LINE_STRIP_WITH_ADJACENCY = 5, 30296c5ddc4Srjs MALI_DRAW_MODE_LINE_LOOP = 6, 30396c5ddc4Srjs MALI_DRAW_MODE_TRIANGLES = 8, 30496c5ddc4Srjs MALI_DRAW_MODE_TRIANGLES_WITH_ADJACENCY = 9, 30596c5ddc4Srjs MALI_DRAW_MODE_TRIANGLE_STRIP = 10, 30696c5ddc4Srjs MALI_DRAW_MODE_TRIANGLE_STRIP_WITH_ADJACENCY = 11, 30796c5ddc4Srjs MALI_DRAW_MODE_TRIANGLE_FAN = 12, 30896c5ddc4Srjs MALI_DRAW_MODE_POLYGON = 13, 30996c5ddc4Srjs MALI_DRAW_MODE_QUADS = 14, 31096c5ddc4Srjs MALI_DRAW_MODE_QUAD_STRIP = 15, 31196c5ddc4Srjs MALI_DRAW_MODE_PARALLELOGRAM = 16, 31296c5ddc4Srjs}; 31396c5ddc4Srjs 31496c5ddc4Srjsstatic inline const char * 31596c5ddc4Srjsmali_draw_mode_as_str(enum mali_draw_mode imm) 31696c5ddc4Srjs{ 31796c5ddc4Srjs switch (imm) { 31896c5ddc4Srjs case MALI_DRAW_MODE_POINTS: return "Points"; 31996c5ddc4Srjs case MALI_DRAW_MODE_LINES: return "Lines"; 32096c5ddc4Srjs case MALI_DRAW_MODE_LINES_WITH_ADJACENCY: return "Lines with adjacency"; 32196c5ddc4Srjs case MALI_DRAW_MODE_LINE_STRIP: return "Line strip"; 32296c5ddc4Srjs case MALI_DRAW_MODE_LINE_STRIP_WITH_ADJACENCY: return "Line strip with adjacency"; 32396c5ddc4Srjs case MALI_DRAW_MODE_LINE_LOOP: return "Line loop"; 32496c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLES: return "Triangles"; 32596c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLES_WITH_ADJACENCY: return "Triangles with adjacency"; 32696c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLE_STRIP: return "Triangle strip"; 32796c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLE_STRIP_WITH_ADJACENCY: return "Triangle strip with adjacency"; 32896c5ddc4Srjs case MALI_DRAW_MODE_TRIANGLE_FAN: return "Triangle fan"; 32996c5ddc4Srjs case MALI_DRAW_MODE_POLYGON: return "Polygon"; 33096c5ddc4Srjs case MALI_DRAW_MODE_QUADS: return "Quads"; 33196c5ddc4Srjs case MALI_DRAW_MODE_QUAD_STRIP: return "Quad strip"; 33296c5ddc4Srjs case MALI_DRAW_MODE_PARALLELOGRAM: return "Parallelogram"; 33396c5ddc4Srjs default: return "XXX: INVALID"; 33496c5ddc4Srjs } 33596c5ddc4Srjs} 33696c5ddc4Srjs 33796c5ddc4Srjsenum mali_exception_access { 33896c5ddc4Srjs MALI_EXCEPTION_ACCESS_NONE = 0, 33996c5ddc4Srjs MALI_EXCEPTION_ACCESS_EXECUTE = 2, 34096c5ddc4Srjs MALI_EXCEPTION_ACCESS_READ = 1, 34196c5ddc4Srjs MALI_EXCEPTION_ACCESS_WRITE = 3, 34296c5ddc4Srjs}; 34396c5ddc4Srjs 34496c5ddc4Srjsstatic inline const char * 34596c5ddc4Srjsmali_exception_access_as_str(enum mali_exception_access imm) 34696c5ddc4Srjs{ 34796c5ddc4Srjs switch (imm) { 34896c5ddc4Srjs case MALI_EXCEPTION_ACCESS_NONE: return "None"; 34996c5ddc4Srjs case MALI_EXCEPTION_ACCESS_EXECUTE: return "Execute"; 35096c5ddc4Srjs case MALI_EXCEPTION_ACCESS_READ: return "Read"; 35196c5ddc4Srjs case MALI_EXCEPTION_ACCESS_WRITE: return "Write"; 35296c5ddc4Srjs default: return "XXX: INVALID"; 35396c5ddc4Srjs } 35496c5ddc4Srjs} 35596c5ddc4Srjs 35696c5ddc4Srjsenum mali_func { 35796c5ddc4Srjs MALI_FUNC_NEVER = 0, 35896c5ddc4Srjs MALI_FUNC_LESS = 1, 35996c5ddc4Srjs MALI_FUNC_EQUAL = 2, 36096c5ddc4Srjs MALI_FUNC_LEQUAL = 3, 36196c5ddc4Srjs MALI_FUNC_GREATER = 4, 36296c5ddc4Srjs MALI_FUNC_NOT_EQUAL = 5, 36396c5ddc4Srjs MALI_FUNC_GEQUAL = 6, 36496c5ddc4Srjs MALI_FUNC_ALWAYS = 7, 36596c5ddc4Srjs}; 36696c5ddc4Srjs 36796c5ddc4Srjsstatic inline const char * 36896c5ddc4Srjsmali_func_as_str(enum mali_func imm) 36996c5ddc4Srjs{ 37096c5ddc4Srjs switch (imm) { 37196c5ddc4Srjs case MALI_FUNC_NEVER: return "Never"; 37296c5ddc4Srjs case MALI_FUNC_LESS: return "Less"; 37396c5ddc4Srjs case MALI_FUNC_EQUAL: return "Equal"; 37496c5ddc4Srjs case MALI_FUNC_LEQUAL: return "Lequal"; 37596c5ddc4Srjs case MALI_FUNC_GREATER: return "Greater"; 37696c5ddc4Srjs case MALI_FUNC_NOT_EQUAL: return "Not Equal"; 37796c5ddc4Srjs case MALI_FUNC_GEQUAL: return "Gequal"; 37896c5ddc4Srjs case MALI_FUNC_ALWAYS: return "Always"; 37996c5ddc4Srjs default: return "XXX: INVALID"; 38096c5ddc4Srjs } 38196c5ddc4Srjs} 38296c5ddc4Srjs 38396c5ddc4Srjsenum mali_format { 38496c5ddc4Srjs MALI_ETC2_RGB8 = 1, 38596c5ddc4Srjs MALI_ETC2_R11_UNORM = 2, 38696c5ddc4Srjs MALI_ETC2_RGBA8 = 3, 38796c5ddc4Srjs MALI_ETC2_RG11_UNORM = 4, 38896c5ddc4Srjs MALI_NXR = 6, 38996c5ddc4Srjs MALI_BC1_UNORM = 7, 39096c5ddc4Srjs MALI_BC2_UNORM = 8, 39196c5ddc4Srjs MALI_BC3_UNORM = 9, 39296c5ddc4Srjs MALI_BC4_UNORM = 10, 39396c5ddc4Srjs MALI_BC4_SNORM = 11, 39496c5ddc4Srjs MALI_BC5_UNORM = 12, 39596c5ddc4Srjs MALI_BC5_SNORM = 13, 39696c5ddc4Srjs MALI_BC6H_UF16 = 14, 39796c5ddc4Srjs MALI_BC6H_SF16 = 15, 39896c5ddc4Srjs MALI_BC7_UNORM = 16, 39996c5ddc4Srjs MALI_ETC2_R11_SNORM = 17, 40096c5ddc4Srjs MALI_ETC2_RG11_SNORM = 18, 40196c5ddc4Srjs MALI_ETC2_RGB8A1 = 19, 40296c5ddc4Srjs MALI_ASTC_3D_LDR = 20, 40396c5ddc4Srjs MALI_ASTC_3D_HDR = 21, 40496c5ddc4Srjs MALI_ASTC_2D_LDR = 22, 40596c5ddc4Srjs MALI_ASTC_2D_HDR = 23, 40696c5ddc4Srjs MALI_RGB565 = 64, 40796c5ddc4Srjs MALI_RGB5_A1_UNORM = 65, 40896c5ddc4Srjs MALI_A1_BGR5_UNORM = 66, 40996c5ddc4Srjs MALI_RGB10_A2_UNORM = 67, 41096c5ddc4Srjs MALI_A2_BGR10_UNORM = 68, 41196c5ddc4Srjs MALI_RGB10_A2_SNORM = 69, 41296c5ddc4Srjs MALI_A2_BGR10_SNORM = 70, 41396c5ddc4Srjs MALI_RGB10_A2UI = 71, 41496c5ddc4Srjs MALI_A2_BGR10UI = 72, 41596c5ddc4Srjs MALI_RGB10_A2I = 73, 41696c5ddc4Srjs MALI_A2_BGR10I = 74, 41796c5ddc4Srjs MALI_RGB332_UNORM = 75, 41896c5ddc4Srjs MALI_BGR233_UNORM = 76, 41996c5ddc4Srjs MALI_Z24X8_UNORM = 77, 42096c5ddc4Srjs MALI_X8Z24 = 78, 42196c5ddc4Srjs MALI_X32_S8X24 = 79, 42296c5ddc4Srjs MALI_X24S8_X32 = 80, 42396c5ddc4Srjs MALI_R32_FIXED = 81, 42496c5ddc4Srjs MALI_RG32_FIXED = 82, 42596c5ddc4Srjs MALI_RGB32_FIXED = 83, 42696c5ddc4Srjs MALI_RGBA32_FIXED = 84, 42796c5ddc4Srjs MALI_TILEBUFFER_NATIVE = 85, 42896c5ddc4Srjs MALI_R11F_G11F_B10F = 89, 42996c5ddc4Srjs MALI_B10F_G11F_R11F = 90, 43096c5ddc4Srjs MALI_R9F_G9F_B9F_E5F = 91, 43196c5ddc4Srjs MALI_E5F_B9F_G9F_R9F = 92, 43296c5ddc4Srjs MALI_SNAP_2 = 93, 43396c5ddc4Srjs MALI_SNAP_4 = 94, 43496c5ddc4Srjs MALI_CONSTANT = 95, 43596c5ddc4Srjs MALI_R1_SNORM = 96, 43696c5ddc4Srjs MALI_R2_SNORM = 97, 43796c5ddc4Srjs MALI_R4_SNORM = 98, 43896c5ddc4Srjs MALI_R8_SNORM = 99, 43996c5ddc4Srjs MALI_R16_SNORM = 100, 44096c5ddc4Srjs MALI_R32_SNORM = 101, 44196c5ddc4Srjs MALI_R64_SNORM = 102, 44296c5ddc4Srjs MALI_RG1_SNORM = 104, 44396c5ddc4Srjs MALI_RG2_SNORM = 105, 44496c5ddc4Srjs MALI_RG4_SNORM = 106, 44596c5ddc4Srjs MALI_RG8_SNORM = 107, 44696c5ddc4Srjs MALI_RG16_SNORM = 108, 44796c5ddc4Srjs MALI_RG32_SNORM = 109, 44896c5ddc4Srjs MALI_RG64_SNORM = 110, 44996c5ddc4Srjs MALI_RGB1_SNORM = 112, 45096c5ddc4Srjs MALI_RGB2_SNORM = 113, 45196c5ddc4Srjs MALI_RGB4_SNORM = 114, 45296c5ddc4Srjs MALI_RGB8_SNORM = 115, 45396c5ddc4Srjs MALI_RGB16_SNORM = 116, 45496c5ddc4Srjs MALI_RGB32_SNORM = 117, 45596c5ddc4Srjs MALI_RGB64_SNORM = 118, 45696c5ddc4Srjs MALI_RGBA1_SNORM = 120, 45796c5ddc4Srjs MALI_RGBA2_SNORM = 121, 45896c5ddc4Srjs MALI_RGBA4_SNORM = 122, 45996c5ddc4Srjs MALI_RGBA8_SNORM = 123, 46096c5ddc4Srjs MALI_RGBA16_SNORM = 124, 46196c5ddc4Srjs MALI_RGBA32_SNORM = 125, 46296c5ddc4Srjs MALI_RGBA64_SNORM = 126, 46396c5ddc4Srjs MALI_R1UI = 128, 46496c5ddc4Srjs MALI_R2UI = 129, 46596c5ddc4Srjs MALI_R4UI = 130, 46696c5ddc4Srjs MALI_R8UI = 131, 46796c5ddc4Srjs MALI_R16UI = 132, 46896c5ddc4Srjs MALI_R32UI = 133, 46996c5ddc4Srjs MALI_R64UI = 134, 47096c5ddc4Srjs MALI_R64F = 135, 47196c5ddc4Srjs MALI_RG1UI = 136, 47296c5ddc4Srjs MALI_RG2UI = 137, 47396c5ddc4Srjs MALI_RG4UI = 138, 47496c5ddc4Srjs MALI_RG8UI = 139, 47596c5ddc4Srjs MALI_RG16UI = 140, 47696c5ddc4Srjs MALI_RG32UI = 141, 47796c5ddc4Srjs MALI_RG64UI = 142, 47896c5ddc4Srjs MALI_RG64F = 143, 47996c5ddc4Srjs MALI_RGB1UI = 144, 48096c5ddc4Srjs MALI_RGB2UI = 145, 48196c5ddc4Srjs MALI_RGB4UI = 146, 48296c5ddc4Srjs MALI_RGB8UI = 147, 48396c5ddc4Srjs MALI_RGB16UI = 148, 48496c5ddc4Srjs MALI_RGB32UI = 149, 48596c5ddc4Srjs MALI_RGB64UI = 150, 48696c5ddc4Srjs MALI_RGB64F = 151, 48796c5ddc4Srjs MALI_RGBA1UI = 152, 48896c5ddc4Srjs MALI_RGBA2UI = 153, 48996c5ddc4Srjs MALI_RGBA4UI = 154, 49096c5ddc4Srjs MALI_RGBA8UI = 155, 49196c5ddc4Srjs MALI_RGBA16UI = 156, 49296c5ddc4Srjs MALI_RGBA32UI = 157, 49396c5ddc4Srjs MALI_RGBA64UI = 158, 49496c5ddc4Srjs MALI_RGBA64F = 159, 49596c5ddc4Srjs MALI_R1_UNORM = 160, 49696c5ddc4Srjs MALI_R2_UNORM = 161, 49796c5ddc4Srjs MALI_R4_UNORM = 162, 49896c5ddc4Srjs MALI_R8_UNORM = 163, 49996c5ddc4Srjs MALI_R16_UNORM = 164, 50096c5ddc4Srjs MALI_R32_UNORM = 165, 50196c5ddc4Srjs MALI_R64_UNORM = 166, 50296c5ddc4Srjs MALI_R32F = 167, 50396c5ddc4Srjs MALI_RG1_UNORM = 168, 50496c5ddc4Srjs MALI_RG2_UNORM = 169, 50596c5ddc4Srjs MALI_RG4_UNORM = 170, 50696c5ddc4Srjs MALI_RG8_UNORM = 171, 50796c5ddc4Srjs MALI_RG16_UNORM = 172, 50896c5ddc4Srjs MALI_RG32_UNORM = 173, 50996c5ddc4Srjs MALI_RG64_UNORM = 174, 51096c5ddc4Srjs MALI_RG32F = 175, 51196c5ddc4Srjs MALI_RGB1_UNORM = 176, 51296c5ddc4Srjs MALI_RGB2_UNORM = 177, 51396c5ddc4Srjs MALI_RGB4_UNORM = 178, 51496c5ddc4Srjs MALI_RGB8_UNORM = 179, 51596c5ddc4Srjs MALI_RGB16_UNORM = 180, 51696c5ddc4Srjs MALI_RGB32_UNORM = 181, 51796c5ddc4Srjs MALI_RGB64_UNORM = 182, 51896c5ddc4Srjs MALI_RGB32F = 183, 51996c5ddc4Srjs MALI_RGBA1_UNORM = 184, 52096c5ddc4Srjs MALI_RGBA2_UNORM = 185, 52196c5ddc4Srjs MALI_RGBA4_UNORM = 186, 52296c5ddc4Srjs MALI_RGBA8_UNORM = 187, 52396c5ddc4Srjs MALI_RGBA16_UNORM = 188, 52496c5ddc4Srjs MALI_RGBA32_UNORM = 189, 52596c5ddc4Srjs MALI_RGBA64_UNORM = 190, 52696c5ddc4Srjs MALI_RGBA32F = 191, 52796c5ddc4Srjs MALI_R1I = 192, 52896c5ddc4Srjs MALI_R2I = 193, 52996c5ddc4Srjs MALI_R4I = 194, 53096c5ddc4Srjs MALI_R8I = 195, 53196c5ddc4Srjs MALI_R16I = 196, 53296c5ddc4Srjs MALI_R32I = 197, 53396c5ddc4Srjs MALI_R64I = 198, 53496c5ddc4Srjs MALI_R16F = 199, 53596c5ddc4Srjs MALI_RG1I = 200, 53696c5ddc4Srjs MALI_RG2I = 201, 53796c5ddc4Srjs MALI_RG4I = 202, 53896c5ddc4Srjs MALI_RG8I = 203, 53996c5ddc4Srjs MALI_RG16I = 204, 54096c5ddc4Srjs MALI_RG32I = 205, 54196c5ddc4Srjs MALI_RG64I = 206, 54296c5ddc4Srjs MALI_RG16F = 207, 54396c5ddc4Srjs MALI_RGB1I = 208, 54496c5ddc4Srjs MALI_RGB2I = 209, 54596c5ddc4Srjs MALI_RGB4I = 210, 54696c5ddc4Srjs MALI_RGB8I = 211, 54796c5ddc4Srjs MALI_RGB16I = 212, 54896c5ddc4Srjs MALI_RGB32I = 213, 54996c5ddc4Srjs MALI_RGB64I = 214, 55096c5ddc4Srjs MALI_RGB16F = 215, 55196c5ddc4Srjs MALI_RGBA1I = 216, 55296c5ddc4Srjs MALI_RGBA2I = 217, 55396c5ddc4Srjs MALI_RGBA4I = 218, 55496c5ddc4Srjs MALI_RGBA8I = 219, 55596c5ddc4Srjs MALI_RGBA16I = 220, 55696c5ddc4Srjs MALI_RGBA32I = 221, 55796c5ddc4Srjs MALI_RGBA64I = 222, 55896c5ddc4Srjs MALI_RGBA16F = 223, 55996c5ddc4Srjs}; 56096c5ddc4Srjs 56196c5ddc4Srjsstatic inline const char * 56296c5ddc4Srjsmali_format_as_str(enum mali_format imm) 56396c5ddc4Srjs{ 56496c5ddc4Srjs switch (imm) { 56596c5ddc4Srjs case MALI_ETC2_RGB8: return "ETC2 RGB8"; 56696c5ddc4Srjs case MALI_ETC2_R11_UNORM: return "ETC2 R11 UNORM"; 56796c5ddc4Srjs case MALI_ETC2_RGBA8: return "ETC2 RGBA8"; 56896c5ddc4Srjs case MALI_ETC2_RG11_UNORM: return "ETC2 RG11 UNORM"; 56996c5ddc4Srjs case MALI_NXR: return "NXR"; 57096c5ddc4Srjs case MALI_BC1_UNORM: return "BC1 UNORM"; 57196c5ddc4Srjs case MALI_BC2_UNORM: return "BC2 UNORM"; 57296c5ddc4Srjs case MALI_BC3_UNORM: return "BC3 UNORM"; 57396c5ddc4Srjs case MALI_BC4_UNORM: return "BC4 UNORM"; 57496c5ddc4Srjs case MALI_BC4_SNORM: return "BC4 SNORM"; 57596c5ddc4Srjs case MALI_BC5_UNORM: return "BC5 UNORM"; 57696c5ddc4Srjs case MALI_BC5_SNORM: return "BC5 SNORM"; 57796c5ddc4Srjs case MALI_BC6H_UF16: return "BC6H UF16"; 57896c5ddc4Srjs case MALI_BC6H_SF16: return "BC6H SF16"; 57996c5ddc4Srjs case MALI_BC7_UNORM: return "BC7 UNORM"; 58096c5ddc4Srjs case MALI_ETC2_R11_SNORM: return "ETC2 R11 SNORM"; 58196c5ddc4Srjs case MALI_ETC2_RG11_SNORM: return "ETC2 RG11 SNORM"; 58296c5ddc4Srjs case MALI_ETC2_RGB8A1: return "ETC2 RGB8A1"; 58396c5ddc4Srjs case MALI_ASTC_3D_LDR: return "ASTC 3D LDR"; 58496c5ddc4Srjs case MALI_ASTC_3D_HDR: return "ASTC 3D HDR"; 58596c5ddc4Srjs case MALI_ASTC_2D_LDR: return "ASTC 2D LDR"; 58696c5ddc4Srjs case MALI_ASTC_2D_HDR: return "ASTC 2D HDR"; 58796c5ddc4Srjs case MALI_RGB565: return "RGB565"; 58896c5ddc4Srjs case MALI_RGB5_A1_UNORM: return "RGB5 A1 UNORM"; 58996c5ddc4Srjs case MALI_A1_BGR5_UNORM: return "A1 BGR5 UNORM"; 59096c5ddc4Srjs case MALI_RGB10_A2_UNORM: return "RGB10 A2 UNORM"; 59196c5ddc4Srjs case MALI_A2_BGR10_UNORM: return "A2 BGR10 UNORM"; 59296c5ddc4Srjs case MALI_RGB10_A2_SNORM: return "RGB10 A2 SNORM"; 59396c5ddc4Srjs case MALI_A2_BGR10_SNORM: return "A2 BGR10 SNORM"; 59496c5ddc4Srjs case MALI_RGB10_A2UI: return "RGB10 A2UI"; 59596c5ddc4Srjs case MALI_A2_BGR10UI: return "A2 BGR10UI"; 59696c5ddc4Srjs case MALI_RGB10_A2I: return "RGB10 A2I"; 59796c5ddc4Srjs case MALI_A2_BGR10I: return "A2 BGR10I"; 59896c5ddc4Srjs case MALI_RGB332_UNORM: return "RGB332 UNORM"; 59996c5ddc4Srjs case MALI_BGR233_UNORM: return "BGR233 UNORM"; 60096c5ddc4Srjs case MALI_Z24X8_UNORM: return "Z24X8 UNORM"; 60196c5ddc4Srjs case MALI_X8Z24: return "X8Z24"; 60296c5ddc4Srjs case MALI_X32_S8X24: return "X32 S8X24"; 60396c5ddc4Srjs case MALI_X24S8_X32: return "X24S8 X32"; 60496c5ddc4Srjs case MALI_R32_FIXED: return "R32 FIXED"; 60596c5ddc4Srjs case MALI_RG32_FIXED: return "RG32 FIXED"; 60696c5ddc4Srjs case MALI_RGB32_FIXED: return "RGB32 FIXED"; 60796c5ddc4Srjs case MALI_RGBA32_FIXED: return "RGBA32 FIXED"; 60896c5ddc4Srjs case MALI_TILEBUFFER_NATIVE: return "Tilebuffer Native"; 60996c5ddc4Srjs case MALI_R11F_G11F_B10F: return "R11F G11F B10F"; 61096c5ddc4Srjs case MALI_B10F_G11F_R11F: return "B10F G11F R11F"; 61196c5ddc4Srjs case MALI_R9F_G9F_B9F_E5F: return "R9F G9F B9F E5F"; 61296c5ddc4Srjs case MALI_E5F_B9F_G9F_R9F: return "E5F B9F G9F R9F"; 61396c5ddc4Srjs case MALI_SNAP_2: return "Snap 2"; 61496c5ddc4Srjs case MALI_SNAP_4: return "Snap 4"; 61596c5ddc4Srjs case MALI_CONSTANT: return "Constant"; 61696c5ddc4Srjs case MALI_R1_SNORM: return "R1 SNORM"; 61796c5ddc4Srjs case MALI_R2_SNORM: return "R2 SNORM"; 61896c5ddc4Srjs case MALI_R4_SNORM: return "R4 SNORM"; 61996c5ddc4Srjs case MALI_R8_SNORM: return "R8 SNORM"; 62096c5ddc4Srjs case MALI_R16_SNORM: return "R16 SNORM"; 62196c5ddc4Srjs case MALI_R32_SNORM: return "R32 SNORM"; 62296c5ddc4Srjs case MALI_R64_SNORM: return "R64 SNORM"; 62396c5ddc4Srjs case MALI_RG1_SNORM: return "RG1 SNORM"; 62496c5ddc4Srjs case MALI_RG2_SNORM: return "RG2 SNORM"; 62596c5ddc4Srjs case MALI_RG4_SNORM: return "RG4 SNORM"; 62696c5ddc4Srjs case MALI_RG8_SNORM: return "RG8 SNORM"; 62796c5ddc4Srjs case MALI_RG16_SNORM: return "RG16 SNORM"; 62896c5ddc4Srjs case MALI_RG32_SNORM: return "RG32 SNORM"; 62996c5ddc4Srjs case MALI_RG64_SNORM: return "RG64 SNORM"; 63096c5ddc4Srjs case MALI_RGB1_SNORM: return "RGB1 SNORM"; 63196c5ddc4Srjs case MALI_RGB2_SNORM: return "RGB2 SNORM"; 63296c5ddc4Srjs case MALI_RGB4_SNORM: return "RGB4 SNORM"; 63396c5ddc4Srjs case MALI_RGB8_SNORM: return "RGB8 SNORM"; 63496c5ddc4Srjs case MALI_RGB16_SNORM: return "RGB16 SNORM"; 63596c5ddc4Srjs case MALI_RGB32_SNORM: return "RGB32 SNORM"; 63696c5ddc4Srjs case MALI_RGB64_SNORM: return "RGB64 SNORM"; 63796c5ddc4Srjs case MALI_RGBA1_SNORM: return "RGBA1 SNORM"; 63896c5ddc4Srjs case MALI_RGBA2_SNORM: return "RGBA2 SNORM"; 63996c5ddc4Srjs case MALI_RGBA4_SNORM: return "RGBA4 SNORM"; 64096c5ddc4Srjs case MALI_RGBA8_SNORM: return "RGBA8 SNORM"; 64196c5ddc4Srjs case MALI_RGBA16_SNORM: return "RGBA16 SNORM"; 64296c5ddc4Srjs case MALI_RGBA32_SNORM: return "RGBA32 SNORM"; 64396c5ddc4Srjs case MALI_RGBA64_SNORM: return "RGBA64 SNORM"; 64496c5ddc4Srjs case MALI_R1UI: return "R1UI"; 64596c5ddc4Srjs case MALI_R2UI: return "R2UI"; 64696c5ddc4Srjs case MALI_R4UI: return "R4UI"; 64796c5ddc4Srjs case MALI_R8UI: return "R8UI"; 64896c5ddc4Srjs case MALI_R16UI: return "R16UI"; 64996c5ddc4Srjs case MALI_R32UI: return "R32UI"; 65096c5ddc4Srjs case MALI_R64UI: return "R64UI"; 65196c5ddc4Srjs case MALI_R64F: return "R64F"; 65296c5ddc4Srjs case MALI_RG1UI: return "RG1UI"; 65396c5ddc4Srjs case MALI_RG2UI: return "RG2UI"; 65496c5ddc4Srjs case MALI_RG4UI: return "RG4UI"; 65596c5ddc4Srjs case MALI_RG8UI: return "RG8UI"; 65696c5ddc4Srjs case MALI_RG16UI: return "RG16UI"; 65796c5ddc4Srjs case MALI_RG32UI: return "RG32UI"; 65896c5ddc4Srjs case MALI_RG64UI: return "RG64UI"; 65996c5ddc4Srjs case MALI_RG64F: return "RG64F"; 66096c5ddc4Srjs case MALI_RGB1UI: return "RGB1UI"; 66196c5ddc4Srjs case MALI_RGB2UI: return "RGB2UI"; 66296c5ddc4Srjs case MALI_RGB4UI: return "RGB4UI"; 66396c5ddc4Srjs case MALI_RGB8UI: return "RGB8UI"; 66496c5ddc4Srjs case MALI_RGB16UI: return "RGB16UI"; 66596c5ddc4Srjs case MALI_RGB32UI: return "RGB32UI"; 66696c5ddc4Srjs case MALI_RGB64UI: return "RGB64UI"; 66796c5ddc4Srjs case MALI_RGB64F: return "RGB64F"; 66896c5ddc4Srjs case MALI_RGBA1UI: return "RGBA1UI"; 66996c5ddc4Srjs case MALI_RGBA2UI: return "RGBA2UI"; 67096c5ddc4Srjs case MALI_RGBA4UI: return "RGBA4UI"; 67196c5ddc4Srjs case MALI_RGBA8UI: return "RGBA8UI"; 67296c5ddc4Srjs case MALI_RGBA16UI: return "RGBA16UI"; 67396c5ddc4Srjs case MALI_RGBA32UI: return "RGBA32UI"; 67496c5ddc4Srjs case MALI_RGBA64UI: return "RGBA64UI"; 67596c5ddc4Srjs case MALI_RGBA64F: return "RGBA64F"; 67696c5ddc4Srjs case MALI_R1_UNORM: return "R1 UNORM"; 67796c5ddc4Srjs case MALI_R2_UNORM: return "R2 UNORM"; 67896c5ddc4Srjs case MALI_R4_UNORM: return "R4 UNORM"; 67996c5ddc4Srjs case MALI_R8_UNORM: return "R8 UNORM"; 68096c5ddc4Srjs case MALI_R16_UNORM: return "R16 UNORM"; 68196c5ddc4Srjs case MALI_R32_UNORM: return "R32 UNORM"; 68296c5ddc4Srjs case MALI_R64_UNORM: return "R64 UNORM"; 68396c5ddc4Srjs case MALI_R32F: return "R32F"; 68496c5ddc4Srjs case MALI_RG1_UNORM: return "RG1 UNORM"; 68596c5ddc4Srjs case MALI_RG2_UNORM: return "RG2 UNORM"; 68696c5ddc4Srjs case MALI_RG4_UNORM: return "RG4 UNORM"; 68796c5ddc4Srjs case MALI_RG8_UNORM: return "RG8 UNORM"; 68896c5ddc4Srjs case MALI_RG16_UNORM: return "RG16 UNORM"; 68996c5ddc4Srjs case MALI_RG32_UNORM: return "RG32 UNORM"; 69096c5ddc4Srjs case MALI_RG64_UNORM: return "RG64 UNORM"; 69196c5ddc4Srjs case MALI_RG32F: return "RG32F"; 69296c5ddc4Srjs case MALI_RGB1_UNORM: return "RGB1 UNORM"; 69396c5ddc4Srjs case MALI_RGB2_UNORM: return "RGB2 UNORM"; 69496c5ddc4Srjs case MALI_RGB4_UNORM: return "RGB4 UNORM"; 69596c5ddc4Srjs case MALI_RGB8_UNORM: return "RGB8 UNORM"; 69696c5ddc4Srjs case MALI_RGB16_UNORM: return "RGB16 UNORM"; 69796c5ddc4Srjs case MALI_RGB32_UNORM: return "RGB32 UNORM"; 69896c5ddc4Srjs case MALI_RGB64_UNORM: return "RGB64 UNORM"; 69996c5ddc4Srjs case MALI_RGB32F: return "RGB32F"; 70096c5ddc4Srjs case MALI_RGBA1_UNORM: return "RGBA1 UNORM"; 70196c5ddc4Srjs case MALI_RGBA2_UNORM: return "RGBA2 UNORM"; 70296c5ddc4Srjs case MALI_RGBA4_UNORM: return "RGBA4 UNORM"; 70396c5ddc4Srjs case MALI_RGBA8_UNORM: return "RGBA8 UNORM"; 70496c5ddc4Srjs case MALI_RGBA16_UNORM: return "RGBA16 UNORM"; 70596c5ddc4Srjs case MALI_RGBA32_UNORM: return "RGBA32 UNORM"; 70696c5ddc4Srjs case MALI_RGBA64_UNORM: return "RGBA64 UNORM"; 70796c5ddc4Srjs case MALI_RGBA32F: return "RGBA32F"; 70896c5ddc4Srjs case MALI_R1I: return "R1I"; 70996c5ddc4Srjs case MALI_R2I: return "R2I"; 71096c5ddc4Srjs case MALI_R4I: return "R4I"; 71196c5ddc4Srjs case MALI_R8I: return "R8I"; 71296c5ddc4Srjs case MALI_R16I: return "R16I"; 71396c5ddc4Srjs case MALI_R32I: return "R32I"; 71496c5ddc4Srjs case MALI_R64I: return "R64I"; 71596c5ddc4Srjs case MALI_R16F: return "R16F"; 71696c5ddc4Srjs case MALI_RG1I: return "RG1I"; 71796c5ddc4Srjs case MALI_RG2I: return "RG2I"; 71896c5ddc4Srjs case MALI_RG4I: return "RG4I"; 71996c5ddc4Srjs case MALI_RG8I: return "RG8I"; 72096c5ddc4Srjs case MALI_RG16I: return "RG16I"; 72196c5ddc4Srjs case MALI_RG32I: return "RG32I"; 72296c5ddc4Srjs case MALI_RG64I: return "RG64I"; 72396c5ddc4Srjs case MALI_RG16F: return "RG16F"; 72496c5ddc4Srjs case MALI_RGB1I: return "RGB1I"; 72596c5ddc4Srjs case MALI_RGB2I: return "RGB2I"; 72696c5ddc4Srjs case MALI_RGB4I: return "RGB4I"; 72796c5ddc4Srjs case MALI_RGB8I: return "RGB8I"; 72896c5ddc4Srjs case MALI_RGB16I: return "RGB16I"; 72996c5ddc4Srjs case MALI_RGB32I: return "RGB32I"; 73096c5ddc4Srjs case MALI_RGB64I: return "RGB64I"; 73196c5ddc4Srjs case MALI_RGB16F: return "RGB16F"; 73296c5ddc4Srjs case MALI_RGBA1I: return "RGBA1I"; 73396c5ddc4Srjs case MALI_RGBA2I: return "RGBA2I"; 73496c5ddc4Srjs case MALI_RGBA4I: return "RGBA4I"; 73596c5ddc4Srjs case MALI_RGBA8I: return "RGBA8I"; 73696c5ddc4Srjs case MALI_RGBA16I: return "RGBA16I"; 73796c5ddc4Srjs case MALI_RGBA32I: return "RGBA32I"; 73896c5ddc4Srjs case MALI_RGBA64I: return "RGBA64I"; 73996c5ddc4Srjs case MALI_RGBA16F: return "RGBA16F"; 74096c5ddc4Srjs default: return "XXX: INVALID"; 74196c5ddc4Srjs } 74296c5ddc4Srjs} 74396c5ddc4Srjs 74496c5ddc4Srjsenum mali_yuv_swizzle { 74596c5ddc4Srjs MALI_YUV_SWIZZLE_YUVA = 0, 74696c5ddc4Srjs MALI_YUV_SWIZZLE_YVUA = 1, 74796c5ddc4Srjs MALI_YUV_SWIZZLE_UYVA = 2, 74896c5ddc4Srjs MALI_YUV_SWIZZLE_UVYA = 3, 74996c5ddc4Srjs MALI_YUV_SWIZZLE_VUYA = 4, 75096c5ddc4Srjs MALI_YUV_SWIZZLE_VYUA = 5, 75196c5ddc4Srjs MALI_YUV_SWIZZLE_Y00A = 6, 75296c5ddc4Srjs MALI_YUV_SWIZZLE_YXXA = 7, 75396c5ddc4Srjs}; 75496c5ddc4Srjs 75596c5ddc4Srjsstatic inline const char * 75696c5ddc4Srjsmali_yuv_swizzle_as_str(enum mali_yuv_swizzle imm) 75796c5ddc4Srjs{ 75896c5ddc4Srjs switch (imm) { 75996c5ddc4Srjs case MALI_YUV_SWIZZLE_YUVA: return "YUVA"; 76096c5ddc4Srjs case MALI_YUV_SWIZZLE_YVUA: return "YVUA"; 76196c5ddc4Srjs case MALI_YUV_SWIZZLE_UYVA: return "UYVA"; 76296c5ddc4Srjs case MALI_YUV_SWIZZLE_UVYA: return "UVYA"; 76396c5ddc4Srjs case MALI_YUV_SWIZZLE_VUYA: return "VUYA"; 76496c5ddc4Srjs case MALI_YUV_SWIZZLE_VYUA: return "VYUA"; 76596c5ddc4Srjs case MALI_YUV_SWIZZLE_Y00A: return "Y00A"; 76696c5ddc4Srjs case MALI_YUV_SWIZZLE_YXXA: return "YXXA"; 76796c5ddc4Srjs default: return "XXX: INVALID"; 76896c5ddc4Srjs } 76996c5ddc4Srjs} 77096c5ddc4Srjs 77196c5ddc4Srjsenum mali_yuv_conversion_mode { 77296c5ddc4Srjs MALI_YUV_CONVERSION_MODE_NO_CONVERSION = 0, 77396c5ddc4Srjs MALI_YUV_CONVERSION_MODE_BT_601 = 3, 77496c5ddc4Srjs MALI_YUV_CONVERSION_MODE_BT_709 = 4, 77596c5ddc4Srjs MALI_YUV_CONVERSION_MODE_BT_2020 = 6, 77696c5ddc4Srjs}; 77796c5ddc4Srjs 77896c5ddc4Srjsstatic inline const char * 77996c5ddc4Srjsmali_yuv_conversion_mode_as_str(enum mali_yuv_conversion_mode imm) 78096c5ddc4Srjs{ 78196c5ddc4Srjs switch (imm) { 78296c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_NO_CONVERSION: return "No Conversion"; 78396c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_BT_601: return "BT 601"; 78496c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_BT_709: return "BT 709"; 78596c5ddc4Srjs case MALI_YUV_CONVERSION_MODE_BT_2020: return "BT 2020"; 78696c5ddc4Srjs default: return "XXX: INVALID"; 78796c5ddc4Srjs } 78896c5ddc4Srjs} 78996c5ddc4Srjs 79096c5ddc4Srjsenum mali_yuv_cr_siting { 79196c5ddc4Srjs MALI_YUV_CR_SITING_CO_SITED = 0, 79296c5ddc4Srjs MALI_YUV_CR_SITING_CENTER_Y = 1, 79396c5ddc4Srjs MALI_YUV_CR_SITING_CENTER_X = 2, 79496c5ddc4Srjs MALI_YUV_CR_SITING_CENTER = 3, 79596c5ddc4Srjs MALI_YUV_CR_SITING_ONE_QUARTER = 4, 79696c5ddc4Srjs MALI_YUV_CR_SITING_THREE_QUARTERS = 5, 79796c5ddc4Srjs MALI_YUV_CR_SITING_REPLICATED = 7, 79896c5ddc4Srjs}; 79996c5ddc4Srjs 80096c5ddc4Srjsstatic inline const char * 80196c5ddc4Srjsmali_yuv_cr_siting_as_str(enum mali_yuv_cr_siting imm) 80296c5ddc4Srjs{ 80396c5ddc4Srjs switch (imm) { 80496c5ddc4Srjs case MALI_YUV_CR_SITING_CO_SITED: return "Co-Sited"; 80596c5ddc4Srjs case MALI_YUV_CR_SITING_CENTER_Y: return "Center Y"; 80696c5ddc4Srjs case MALI_YUV_CR_SITING_CENTER_X: return "Center X"; 80796c5ddc4Srjs case MALI_YUV_CR_SITING_CENTER: return "Center"; 80896c5ddc4Srjs case MALI_YUV_CR_SITING_ONE_QUARTER: return "One Quarter"; 80996c5ddc4Srjs case MALI_YUV_CR_SITING_THREE_QUARTERS: return "Three Quarters"; 81096c5ddc4Srjs case MALI_YUV_CR_SITING_REPLICATED: return "Replicated"; 81196c5ddc4Srjs default: return "XXX: INVALID"; 81296c5ddc4Srjs } 81396c5ddc4Srjs} 81496c5ddc4Srjs 81596c5ddc4Srjsenum mali_astc_2d_dimension { 81696c5ddc4Srjs MALI_ASTC_2D_DIMENSION_4 = 0, 81796c5ddc4Srjs MALI_ASTC_2D_DIMENSION_5 = 1, 81896c5ddc4Srjs MALI_ASTC_2D_DIMENSION_6 = 2, 81996c5ddc4Srjs MALI_ASTC_2D_DIMENSION_8 = 4, 82096c5ddc4Srjs MALI_ASTC_2D_DIMENSION_10 = 6, 82196c5ddc4Srjs MALI_ASTC_2D_DIMENSION_12 = 7, 82296c5ddc4Srjs}; 82396c5ddc4Srjs 82496c5ddc4Srjsstatic inline const char * 82596c5ddc4Srjsmali_astc_2d_dimension_as_str(enum mali_astc_2d_dimension imm) 82696c5ddc4Srjs{ 82796c5ddc4Srjs switch (imm) { 82896c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_4: return "4"; 82996c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_5: return "5"; 83096c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_6: return "6"; 83196c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_8: return "8"; 83296c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_10: return "10"; 83396c5ddc4Srjs case MALI_ASTC_2D_DIMENSION_12: return "12"; 83496c5ddc4Srjs default: return "XXX: INVALID"; 83596c5ddc4Srjs } 83696c5ddc4Srjs} 83796c5ddc4Srjs 83896c5ddc4Srjsenum mali_astc_3d_dimension { 83996c5ddc4Srjs MALI_ASTC_3D_DIMENSION_4 = 0, 84096c5ddc4Srjs MALI_ASTC_3D_DIMENSION_5 = 1, 84196c5ddc4Srjs MALI_ASTC_3D_DIMENSION_6 = 2, 84296c5ddc4Srjs MALI_ASTC_3D_DIMENSION_3 = 3, 84396c5ddc4Srjs}; 84496c5ddc4Srjs 84596c5ddc4Srjsstatic inline const char * 84696c5ddc4Srjsmali_astc_3d_dimension_as_str(enum mali_astc_3d_dimension imm) 84796c5ddc4Srjs{ 84896c5ddc4Srjs switch (imm) { 84996c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_4: return "4"; 85096c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_5: return "5"; 85196c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_6: return "6"; 85296c5ddc4Srjs case MALI_ASTC_3D_DIMENSION_3: return "3"; 85396c5ddc4Srjs default: return "XXX: INVALID"; 85496c5ddc4Srjs } 85596c5ddc4Srjs} 85696c5ddc4Srjs 85796c5ddc4Srjsenum mali_block_format { 85896c5ddc4Srjs MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED = 0, 85996c5ddc4Srjs MALI_BLOCK_FORMAT_TILED_LINEAR = 1, 86096c5ddc4Srjs MALI_BLOCK_FORMAT_LINEAR = 2, 86196c5ddc4Srjs MALI_BLOCK_FORMAT_AFBC = 3, 86296c5ddc4Srjs}; 86396c5ddc4Srjs 86496c5ddc4Srjsstatic inline const char * 86596c5ddc4Srjsmali_block_format_as_str(enum mali_block_format imm) 86696c5ddc4Srjs{ 86796c5ddc4Srjs switch (imm) { 86896c5ddc4Srjs case MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED: return "Tiled U-Interleaved"; 86996c5ddc4Srjs case MALI_BLOCK_FORMAT_TILED_LINEAR: return "Tiled Linear"; 87096c5ddc4Srjs case MALI_BLOCK_FORMAT_LINEAR: return "Linear"; 87196c5ddc4Srjs case MALI_BLOCK_FORMAT_AFBC: return "AFBC"; 87296c5ddc4Srjs default: return "XXX: INVALID"; 87396c5ddc4Srjs } 87496c5ddc4Srjs} 87596c5ddc4Srjs 87696c5ddc4Srjsenum mali_mipmap_mode { 87796c5ddc4Srjs MALI_MIPMAP_MODE_NEAREST = 0, 87896c5ddc4Srjs MALI_MIPMAP_MODE_PERFORMANCE_TRILINEAR = 2, 87996c5ddc4Srjs MALI_MIPMAP_MODE_TRILINEAR = 3, 88096c5ddc4Srjs}; 88196c5ddc4Srjs 88296c5ddc4Srjsstatic inline const char * 88396c5ddc4Srjsmali_mipmap_mode_as_str(enum mali_mipmap_mode imm) 88496c5ddc4Srjs{ 88596c5ddc4Srjs switch (imm) { 88696c5ddc4Srjs case MALI_MIPMAP_MODE_NEAREST: return "Nearest"; 88796c5ddc4Srjs case MALI_MIPMAP_MODE_PERFORMANCE_TRILINEAR: return "Performance Trilinear"; 88896c5ddc4Srjs case MALI_MIPMAP_MODE_TRILINEAR: return "Trilinear"; 88996c5ddc4Srjs default: return "XXX: INVALID"; 89096c5ddc4Srjs } 89196c5ddc4Srjs} 89296c5ddc4Srjs 89396c5ddc4Srjsenum mali_msaa { 89496c5ddc4Srjs MALI_MSAA_SINGLE = 0, 89596c5ddc4Srjs MALI_MSAA_AVERAGE = 1, 89696c5ddc4Srjs MALI_MSAA_MULTIPLE = 2, 89796c5ddc4Srjs MALI_MSAA_LAYERED = 3, 89896c5ddc4Srjs}; 89996c5ddc4Srjs 90096c5ddc4Srjsstatic inline const char * 90196c5ddc4Srjsmali_msaa_as_str(enum mali_msaa imm) 90296c5ddc4Srjs{ 90396c5ddc4Srjs switch (imm) { 90496c5ddc4Srjs case MALI_MSAA_SINGLE: return "Single"; 90596c5ddc4Srjs case MALI_MSAA_AVERAGE: return "Average"; 90696c5ddc4Srjs case MALI_MSAA_MULTIPLE: return "Multiple"; 90796c5ddc4Srjs case MALI_MSAA_LAYERED: return "Layered"; 90896c5ddc4Srjs default: return "XXX: INVALID"; 90996c5ddc4Srjs } 91096c5ddc4Srjs} 91196c5ddc4Srjs 91296c5ddc4Srjsenum mali_index_type { 91396c5ddc4Srjs MALI_INDEX_TYPE_NONE = 0, 91496c5ddc4Srjs MALI_INDEX_TYPE_UINT8 = 1, 91596c5ddc4Srjs MALI_INDEX_TYPE_UINT16 = 2, 91696c5ddc4Srjs MALI_INDEX_TYPE_UINT32 = 3, 91796c5ddc4Srjs}; 91896c5ddc4Srjs 91996c5ddc4Srjsstatic inline const char * 92096c5ddc4Srjsmali_index_type_as_str(enum mali_index_type imm) 92196c5ddc4Srjs{ 92296c5ddc4Srjs switch (imm) { 92396c5ddc4Srjs case MALI_INDEX_TYPE_NONE: return "None"; 92496c5ddc4Srjs case MALI_INDEX_TYPE_UINT8: return "UINT8"; 92596c5ddc4Srjs case MALI_INDEX_TYPE_UINT16: return "UINT16"; 92696c5ddc4Srjs case MALI_INDEX_TYPE_UINT32: return "UINT32"; 92796c5ddc4Srjs default: return "XXX: INVALID"; 92896c5ddc4Srjs } 92996c5ddc4Srjs} 93096c5ddc4Srjs 93196c5ddc4Srjsenum mali_occlusion_mode { 93296c5ddc4Srjs MALI_OCCLUSION_MODE_DISABLED = 0, 93396c5ddc4Srjs MALI_OCCLUSION_MODE_PREDICATE = 1, 93496c5ddc4Srjs MALI_OCCLUSION_MODE_COUNTER = 3, 93596c5ddc4Srjs}; 93696c5ddc4Srjs 93796c5ddc4Srjsstatic inline const char * 93896c5ddc4Srjsmali_occlusion_mode_as_str(enum mali_occlusion_mode imm) 93996c5ddc4Srjs{ 94096c5ddc4Srjs switch (imm) { 94196c5ddc4Srjs case MALI_OCCLUSION_MODE_DISABLED: return "Disabled"; 94296c5ddc4Srjs case MALI_OCCLUSION_MODE_PREDICATE: return "Predicate"; 94396c5ddc4Srjs case MALI_OCCLUSION_MODE_COUNTER: return "Counter"; 94496c5ddc4Srjs default: return "XXX: INVALID"; 94596c5ddc4Srjs } 94696c5ddc4Srjs} 94796c5ddc4Srjs 94896c5ddc4Srjsenum mali_stencil_op { 94996c5ddc4Srjs MALI_STENCIL_OP_KEEP = 0, 95096c5ddc4Srjs MALI_STENCIL_OP_REPLACE = 1, 95196c5ddc4Srjs MALI_STENCIL_OP_ZERO = 2, 95296c5ddc4Srjs MALI_STENCIL_OP_INVERT = 3, 95396c5ddc4Srjs MALI_STENCIL_OP_INCR_WRAP = 4, 95496c5ddc4Srjs MALI_STENCIL_OP_DECR_WRAP = 5, 95596c5ddc4Srjs MALI_STENCIL_OP_INCR_SAT = 6, 95696c5ddc4Srjs MALI_STENCIL_OP_DECR_SAT = 7, 95796c5ddc4Srjs}; 95896c5ddc4Srjs 95996c5ddc4Srjsstatic inline const char * 96096c5ddc4Srjsmali_stencil_op_as_str(enum mali_stencil_op imm) 96196c5ddc4Srjs{ 96296c5ddc4Srjs switch (imm) { 96396c5ddc4Srjs case MALI_STENCIL_OP_KEEP: return "Keep"; 96496c5ddc4Srjs case MALI_STENCIL_OP_REPLACE: return "Replace"; 96596c5ddc4Srjs case MALI_STENCIL_OP_ZERO: return "Zero"; 96696c5ddc4Srjs case MALI_STENCIL_OP_INVERT: return "Invert"; 96796c5ddc4Srjs case MALI_STENCIL_OP_INCR_WRAP: return "Incr Wrap"; 96896c5ddc4Srjs case MALI_STENCIL_OP_DECR_WRAP: return "Decr Wrap"; 96996c5ddc4Srjs case MALI_STENCIL_OP_INCR_SAT: return "Incr Sat"; 97096c5ddc4Srjs case MALI_STENCIL_OP_DECR_SAT: return "Decr Sat"; 97196c5ddc4Srjs default: return "XXX: INVALID"; 97296c5ddc4Srjs } 97396c5ddc4Srjs} 97496c5ddc4Srjs 97596c5ddc4Srjsenum mali_texture_dimension { 97696c5ddc4Srjs MALI_TEXTURE_DIMENSION_CUBE = 0, 97796c5ddc4Srjs MALI_TEXTURE_DIMENSION_1D = 1, 97896c5ddc4Srjs MALI_TEXTURE_DIMENSION_2D = 2, 97996c5ddc4Srjs MALI_TEXTURE_DIMENSION_3D = 3, 98096c5ddc4Srjs}; 98196c5ddc4Srjs 98296c5ddc4Srjsstatic inline const char * 98396c5ddc4Srjsmali_texture_dimension_as_str(enum mali_texture_dimension imm) 98496c5ddc4Srjs{ 98596c5ddc4Srjs switch (imm) { 98696c5ddc4Srjs case MALI_TEXTURE_DIMENSION_CUBE: return "Cube"; 98796c5ddc4Srjs case MALI_TEXTURE_DIMENSION_1D: return "1D"; 98896c5ddc4Srjs case MALI_TEXTURE_DIMENSION_2D: return "2D"; 98996c5ddc4Srjs case MALI_TEXTURE_DIMENSION_3D: return "3D"; 99096c5ddc4Srjs default: return "XXX: INVALID"; 99196c5ddc4Srjs } 99296c5ddc4Srjs} 99396c5ddc4Srjs 99496c5ddc4Srjsenum mali_texture_layout { 99596c5ddc4Srjs MALI_TEXTURE_LAYOUT_TILED = 1, 99696c5ddc4Srjs MALI_TEXTURE_LAYOUT_LINEAR = 2, 99796c5ddc4Srjs MALI_TEXTURE_LAYOUT_AFBC = 12, 99896c5ddc4Srjs}; 99996c5ddc4Srjs 100096c5ddc4Srjsstatic inline const char * 100196c5ddc4Srjsmali_texture_layout_as_str(enum mali_texture_layout imm) 100296c5ddc4Srjs{ 100396c5ddc4Srjs switch (imm) { 100496c5ddc4Srjs case MALI_TEXTURE_LAYOUT_TILED: return "Tiled"; 100596c5ddc4Srjs case MALI_TEXTURE_LAYOUT_LINEAR: return "Linear"; 100696c5ddc4Srjs case MALI_TEXTURE_LAYOUT_AFBC: return "AFBC"; 100796c5ddc4Srjs default: return "XXX: INVALID"; 100896c5ddc4Srjs } 100996c5ddc4Srjs} 101096c5ddc4Srjs 101196c5ddc4Srjsenum mali_afbc_surface_flag { 101296c5ddc4Srjs MALI_AFBC_SURFACE_FLAG_YTR = 1, 101396c5ddc4Srjs}; 101496c5ddc4Srjs 101596c5ddc4Srjsstatic inline const char * 101696c5ddc4Srjsmali_afbc_surface_flag_as_str(enum mali_afbc_surface_flag imm) 101796c5ddc4Srjs{ 101896c5ddc4Srjs switch (imm) { 101996c5ddc4Srjs case MALI_AFBC_SURFACE_FLAG_YTR: return "YTR"; 102096c5ddc4Srjs default: return "XXX: INVALID"; 102196c5ddc4Srjs } 102296c5ddc4Srjs} 102396c5ddc4Srjs 102496c5ddc4Srjsenum mali_wrap_mode { 102596c5ddc4Srjs MALI_WRAP_MODE_REPEAT = 8, 102696c5ddc4Srjs MALI_WRAP_MODE_CLAMP_TO_EDGE = 9, 102796c5ddc4Srjs MALI_WRAP_MODE_CLAMP = 10, 102896c5ddc4Srjs MALI_WRAP_MODE_CLAMP_TO_BORDER = 11, 102996c5ddc4Srjs MALI_WRAP_MODE_MIRRORED_REPEAT = 12, 103096c5ddc4Srjs MALI_WRAP_MODE_MIRRORED_CLAMP_TO_EDGE = 13, 103196c5ddc4Srjs MALI_WRAP_MODE_MIRRORED_CLAMP = 14, 103296c5ddc4Srjs MALI_WRAP_MODE_MIRRORED_CLAMP_TO_BORDER = 15, 103396c5ddc4Srjs}; 103496c5ddc4Srjs 103596c5ddc4Srjsstatic inline const char * 103696c5ddc4Srjsmali_wrap_mode_as_str(enum mali_wrap_mode imm) 103796c5ddc4Srjs{ 103896c5ddc4Srjs switch (imm) { 103996c5ddc4Srjs case MALI_WRAP_MODE_REPEAT: return "Repeat"; 104096c5ddc4Srjs case MALI_WRAP_MODE_CLAMP_TO_EDGE: return "Clamp to Edge"; 104196c5ddc4Srjs case MALI_WRAP_MODE_CLAMP: return "Clamp"; 104296c5ddc4Srjs case MALI_WRAP_MODE_CLAMP_TO_BORDER: return "Clamp to Border"; 104396c5ddc4Srjs case MALI_WRAP_MODE_MIRRORED_REPEAT: return "Mirrored Repeat"; 104496c5ddc4Srjs case MALI_WRAP_MODE_MIRRORED_CLAMP_TO_EDGE: return "Mirrored Clamp to Edge"; 104596c5ddc4Srjs case MALI_WRAP_MODE_MIRRORED_CLAMP: return "Mirrored Clamp"; 104696c5ddc4Srjs case MALI_WRAP_MODE_MIRRORED_CLAMP_TO_BORDER: return "Mirrored Clamp to Border"; 104796c5ddc4Srjs default: return "XXX: INVALID"; 104896c5ddc4Srjs } 104996c5ddc4Srjs} 105096c5ddc4Srjs 105196c5ddc4Srjsstruct MALI_ATTRIBUTE { 105296c5ddc4Srjs uint32_t buffer_index; 105396c5ddc4Srjs bool offset_enable; 105496c5ddc4Srjs uint32_t format; 105596c5ddc4Srjs int32_t offset; 105696c5ddc4Srjs}; 105796c5ddc4Srjs 105896c5ddc4Srjs#define MALI_ATTRIBUTE_header \ 105996c5ddc4Srjs .offset_enable = true 106096c5ddc4Srjs 106196c5ddc4Srjsstatic inline void 106296c5ddc4SrjsMALI_ATTRIBUTE_pack(uint32_t * restrict cl, 106396c5ddc4Srjs const struct MALI_ATTRIBUTE * restrict values) 106496c5ddc4Srjs{ 106596c5ddc4Srjs cl[ 0] = __gen_uint(values->buffer_index, 0, 8) | 106696c5ddc4Srjs __gen_uint(values->offset_enable, 9, 9) | 106796c5ddc4Srjs __gen_uint(values->format, 10, 31); 106896c5ddc4Srjs cl[ 1] = __gen_sint(values->offset, 0, 31); 106996c5ddc4Srjs} 107096c5ddc4Srjs 107196c5ddc4Srjs 107296c5ddc4Srjs#define MALI_ATTRIBUTE_LENGTH 8 107396c5ddc4Srjs#define MALI_ATTRIBUTE_ALIGN 8 107496c5ddc4Srjsstruct mali_attribute_packed { uint32_t opaque[2]; }; 107596c5ddc4Srjsstatic inline void 107696c5ddc4SrjsMALI_ATTRIBUTE_unpack(const uint8_t * restrict cl, 107796c5ddc4Srjs struct MALI_ATTRIBUTE * restrict values) 107896c5ddc4Srjs{ 107996c5ddc4Srjs values->buffer_index = __gen_unpack_uint(cl, 0, 8); 108096c5ddc4Srjs values->offset_enable = __gen_unpack_uint(cl, 9, 9); 108196c5ddc4Srjs values->format = __gen_unpack_uint(cl, 10, 31); 108296c5ddc4Srjs values->offset = __gen_unpack_sint(cl, 32, 63); 108396c5ddc4Srjs} 108496c5ddc4Srjs 108596c5ddc4Srjsstatic inline void 108696c5ddc4SrjsMALI_ATTRIBUTE_print(FILE *fp, const struct MALI_ATTRIBUTE * values, unsigned indent) 108796c5ddc4Srjs{ 108896c5ddc4Srjs fprintf(fp, "%*sBuffer index: %u\n", indent, "", values->buffer_index); 108996c5ddc4Srjs fprintf(fp, "%*sOffset enable: %s\n", indent, "", values->offset_enable ? "true" : "false"); 109096c5ddc4Srjs mali_pixel_format_print(fp, values->format); 109196c5ddc4Srjs fprintf(fp, "%*sOffset: %d\n", indent, "", values->offset); 109296c5ddc4Srjs} 109396c5ddc4Srjs 109496c5ddc4Srjsstruct MALI_ATTRIBUTE_VERTEX_ID { 109596c5ddc4Srjs enum mali_attribute_special type; 109696c5ddc4Srjs uint32_t divisor_r; 109796c5ddc4Srjs uint32_t divisor_p; 109896c5ddc4Srjs int32_t offset; 109996c5ddc4Srjs}; 110096c5ddc4Srjs 110196c5ddc4Srjs#define MALI_ATTRIBUTE_VERTEX_ID_header \ 110296c5ddc4Srjs .type = MALI_ATTRIBUTE_SPECIAL_VERTEX_ID 110396c5ddc4Srjs 110496c5ddc4Srjsstatic inline void 110596c5ddc4SrjsMALI_ATTRIBUTE_VERTEX_ID_pack(uint32_t * restrict cl, 110696c5ddc4Srjs const struct MALI_ATTRIBUTE_VERTEX_ID * restrict values) 110796c5ddc4Srjs{ 110896c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 7); 110996c5ddc4Srjs cl[ 1] = __gen_uint(values->divisor_r, 24, 28) | 111096c5ddc4Srjs __gen_uint(values->divisor_p, 29, 31); 111196c5ddc4Srjs cl[ 2] = 0; 111296c5ddc4Srjs cl[ 3] = __gen_sint(values->offset, 0, 31); 111396c5ddc4Srjs} 111496c5ddc4Srjs 111596c5ddc4Srjs 111696c5ddc4Srjs#define MALI_ATTRIBUTE_VERTEX_ID_LENGTH 16 111796c5ddc4Srjs#define MALI_ATTRIBUTE_VERTEX_ID_ALIGN 32 111896c5ddc4Srjsstruct mali_attribute_vertex_id_packed { uint32_t opaque[4]; }; 111996c5ddc4Srjsstatic inline void 112096c5ddc4SrjsMALI_ATTRIBUTE_VERTEX_ID_unpack(const uint8_t * restrict cl, 112196c5ddc4Srjs struct MALI_ATTRIBUTE_VERTEX_ID * restrict values) 112296c5ddc4Srjs{ 112396c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffff00) fprintf(stderr, "XXX: Invalid field of Attribute Vertex ID unpacked at word 0\n"); 112496c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffff) fprintf(stderr, "XXX: Invalid field of Attribute Vertex ID unpacked at word 1\n"); 112596c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Attribute Vertex ID unpacked at word 2\n"); 112696c5ddc4Srjs values->type = (enum mali_attribute_special)__gen_unpack_uint(cl, 0, 7); 112796c5ddc4Srjs values->divisor_r = __gen_unpack_uint(cl, 56, 60); 112896c5ddc4Srjs values->divisor_p = __gen_unpack_uint(cl, 61, 63); 112996c5ddc4Srjs values->offset = __gen_unpack_sint(cl, 96, 127); 113096c5ddc4Srjs} 113196c5ddc4Srjs 113296c5ddc4Srjsstatic inline void 113396c5ddc4SrjsMALI_ATTRIBUTE_VERTEX_ID_print(FILE *fp, const struct MALI_ATTRIBUTE_VERTEX_ID * values, unsigned indent) 113496c5ddc4Srjs{ 113596c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_special_as_str(values->type)); 113696c5ddc4Srjs fprintf(fp, "%*sDivisor R: %u\n", indent, "", values->divisor_r); 113796c5ddc4Srjs fprintf(fp, "%*sDivisor P: %u\n", indent, "", values->divisor_p); 113896c5ddc4Srjs fprintf(fp, "%*sOffset: %d\n", indent, "", values->offset); 113996c5ddc4Srjs} 114096c5ddc4Srjs 114196c5ddc4Srjsstruct MALI_ATTRIBUTE_INSTANCE_ID { 114296c5ddc4Srjs enum mali_attribute_special type; 114396c5ddc4Srjs uint32_t divisor_r; 114496c5ddc4Srjs uint32_t divisor_e; 114596c5ddc4Srjs uint32_t divisor_p; 114696c5ddc4Srjs int32_t offset; 114796c5ddc4Srjs}; 114896c5ddc4Srjs 114996c5ddc4Srjs#define MALI_ATTRIBUTE_INSTANCE_ID_header \ 115096c5ddc4Srjs .type = MALI_ATTRIBUTE_SPECIAL_INSTANCE_ID 115196c5ddc4Srjs 115296c5ddc4Srjsstatic inline void 115396c5ddc4SrjsMALI_ATTRIBUTE_INSTANCE_ID_pack(uint32_t * restrict cl, 115496c5ddc4Srjs const struct MALI_ATTRIBUTE_INSTANCE_ID * restrict values) 115596c5ddc4Srjs{ 115696c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 7); 115796c5ddc4Srjs cl[ 1] = __gen_uint(values->divisor_r, 24, 28) | 115896c5ddc4Srjs __gen_uint(values->divisor_e, 29, 29); 115996c5ddc4Srjs cl[ 2] = __gen_uint(values->divisor_p, 0, 31); 116096c5ddc4Srjs cl[ 3] = __gen_sint(values->offset, 0, 31); 116196c5ddc4Srjs} 116296c5ddc4Srjs 116396c5ddc4Srjs 116496c5ddc4Srjs#define MALI_ATTRIBUTE_INSTANCE_ID_LENGTH 16 116596c5ddc4Srjs#define MALI_ATTRIBUTE_INSTANCE_ID_ALIGN 32 116696c5ddc4Srjsstruct mali_attribute_instance_id_packed { uint32_t opaque[4]; }; 116796c5ddc4Srjsstatic inline void 116896c5ddc4SrjsMALI_ATTRIBUTE_INSTANCE_ID_unpack(const uint8_t * restrict cl, 116996c5ddc4Srjs struct MALI_ATTRIBUTE_INSTANCE_ID * restrict values) 117096c5ddc4Srjs{ 117196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffff00) fprintf(stderr, "XXX: Invalid field of Attribute Instance ID unpacked at word 0\n"); 117296c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xc0ffffff) fprintf(stderr, "XXX: Invalid field of Attribute Instance ID unpacked at word 1\n"); 117396c5ddc4Srjs values->type = (enum mali_attribute_special)__gen_unpack_uint(cl, 0, 7); 117496c5ddc4Srjs values->divisor_r = __gen_unpack_uint(cl, 56, 60); 117596c5ddc4Srjs values->divisor_e = __gen_unpack_uint(cl, 61, 61); 117696c5ddc4Srjs values->divisor_p = __gen_unpack_uint(cl, 64, 95); 117796c5ddc4Srjs values->offset = __gen_unpack_sint(cl, 96, 127); 117896c5ddc4Srjs} 117996c5ddc4Srjs 118096c5ddc4Srjsstatic inline void 118196c5ddc4SrjsMALI_ATTRIBUTE_INSTANCE_ID_print(FILE *fp, const struct MALI_ATTRIBUTE_INSTANCE_ID * values, unsigned indent) 118296c5ddc4Srjs{ 118396c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_special_as_str(values->type)); 118496c5ddc4Srjs fprintf(fp, "%*sDivisor R: %u\n", indent, "", values->divisor_r); 118596c5ddc4Srjs fprintf(fp, "%*sDivisor E: %u\n", indent, "", values->divisor_e); 118696c5ddc4Srjs fprintf(fp, "%*sDivisor P: %u\n", indent, "", values->divisor_p); 118796c5ddc4Srjs fprintf(fp, "%*sOffset: %d\n", indent, "", values->offset); 118896c5ddc4Srjs} 118996c5ddc4Srjs 119096c5ddc4Srjsstruct MALI_ATTRIBUTE_BUFFER { 119196c5ddc4Srjs enum mali_attribute_special special; 119296c5ddc4Srjs enum mali_attribute_type type; 119396c5ddc4Srjs uint64_t pointer; 119496c5ddc4Srjs uint32_t stride; 119596c5ddc4Srjs uint32_t size; 119696c5ddc4Srjs uint32_t divisor; 119796c5ddc4Srjs uint32_t divisor_r; 119896c5ddc4Srjs uint32_t divisor_p; 119996c5ddc4Srjs uint32_t divisor_e; 120096c5ddc4Srjs}; 120196c5ddc4Srjs 120296c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_header \ 120396c5ddc4Srjs .type = MALI_ATTRIBUTE_TYPE_1D, \ 120496c5ddc4Srjs .divisor = 1 120596c5ddc4Srjs 120696c5ddc4Srjsstatic inline void 120796c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_pack(uint32_t * restrict cl, 120896c5ddc4Srjs const struct MALI_ATTRIBUTE_BUFFER * restrict values) 120996c5ddc4Srjs{ 121096c5ddc4Srjs assert((values->pointer & 0x3f) == 0); 121196c5ddc4Srjs cl[ 0] = __gen_uint(values->special, 0, 7) | 121296c5ddc4Srjs __gen_uint(values->type, 0, 5) | 121396c5ddc4Srjs __gen_uint(values->pointer >> 6, 6, 55); 121496c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer >> 6, 6, 55) >> 32 | 121596c5ddc4Srjs __gen_padded(values->divisor, 24, 31) | 121696c5ddc4Srjs __gen_uint(values->divisor_r, 24, 28) | 121796c5ddc4Srjs __gen_uint(values->divisor_p, 29, 31) | 121896c5ddc4Srjs __gen_uint(values->divisor_e, 29, 29); 121996c5ddc4Srjs cl[ 2] = __gen_uint(values->stride, 0, 31); 122096c5ddc4Srjs cl[ 3] = __gen_uint(values->size, 0, 31); 122196c5ddc4Srjs} 122296c5ddc4Srjs 122396c5ddc4Srjs 122496c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_LENGTH 16 122596c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_ALIGN 32 122696c5ddc4Srjsstruct mali_attribute_buffer_packed { uint32_t opaque[4]; }; 122796c5ddc4Srjsstatic inline void 122896c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_unpack(const uint8_t * restrict cl, 122996c5ddc4Srjs struct MALI_ATTRIBUTE_BUFFER * restrict values) 123096c5ddc4Srjs{ 123196c5ddc4Srjs values->special = (enum mali_attribute_special)__gen_unpack_uint(cl, 0, 7); 123296c5ddc4Srjs values->type = (enum mali_attribute_type)__gen_unpack_uint(cl, 0, 5); 123396c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 6, 55) << 6; 123496c5ddc4Srjs values->stride = __gen_unpack_uint(cl, 64, 95); 123596c5ddc4Srjs values->size = __gen_unpack_uint(cl, 96, 127); 123696c5ddc4Srjs values->divisor = __gen_unpack_padded(cl, 56, 63); 123796c5ddc4Srjs values->divisor_r = __gen_unpack_uint(cl, 56, 60); 123896c5ddc4Srjs values->divisor_p = __gen_unpack_uint(cl, 61, 63); 123996c5ddc4Srjs values->divisor_e = __gen_unpack_uint(cl, 61, 61); 124096c5ddc4Srjs} 124196c5ddc4Srjs 124296c5ddc4Srjsstatic inline void 124396c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_print(FILE *fp, const struct MALI_ATTRIBUTE_BUFFER * values, unsigned indent) 124496c5ddc4Srjs{ 124596c5ddc4Srjs fprintf(fp, "%*sSpecial: %s\n", indent, "", mali_attribute_special_as_str(values->special)); 124696c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_type_as_str(values->type)); 124796c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 124896c5ddc4Srjs fprintf(fp, "%*sStride: %u\n", indent, "", values->stride); 124996c5ddc4Srjs fprintf(fp, "%*sSize: %u\n", indent, "", values->size); 125096c5ddc4Srjs fprintf(fp, "%*sDivisor: %u\n", indent, "", values->divisor); 125196c5ddc4Srjs fprintf(fp, "%*sDivisor R: %u\n", indent, "", values->divisor_r); 125296c5ddc4Srjs fprintf(fp, "%*sDivisor P: %u\n", indent, "", values->divisor_p); 125396c5ddc4Srjs fprintf(fp, "%*sDivisor E: %u\n", indent, "", values->divisor_e); 125496c5ddc4Srjs} 125596c5ddc4Srjs 125696c5ddc4Srjsstruct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT { 125796c5ddc4Srjs enum mali_attribute_type type; 125896c5ddc4Srjs uint32_t divisor_numerator; 125996c5ddc4Srjs uint32_t divisor; 126096c5ddc4Srjs}; 126196c5ddc4Srjs 126296c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_header\ 126396c5ddc4Srjs .type = MALI_ATTRIBUTE_TYPE_CONTINUATION 126496c5ddc4Srjs 126596c5ddc4Srjsstatic inline void 126696c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_pack(uint32_t * restrict cl, 126796c5ddc4Srjs const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT * restrict values) 126896c5ddc4Srjs{ 126996c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 5); 127096c5ddc4Srjs cl[ 1] = __gen_uint(values->divisor_numerator, 0, 31); 127196c5ddc4Srjs cl[ 2] = 0; 127296c5ddc4Srjs cl[ 3] = __gen_uint(values->divisor, 0, 31); 127396c5ddc4Srjs} 127496c5ddc4Srjs 127596c5ddc4Srjs 127696c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_LENGTH 16 127796c5ddc4Srjsstruct mali_attribute_buffer_continuation_npot_packed { uint32_t opaque[4]; }; 127896c5ddc4Srjsstatic inline void 127996c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_unpack(const uint8_t * restrict cl, 128096c5ddc4Srjs struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT * restrict values) 128196c5ddc4Srjs{ 128296c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffc0) fprintf(stderr, "XXX: Invalid field of Attribute Buffer Continuation NPOT unpacked at word 0\n"); 128396c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Attribute Buffer Continuation NPOT unpacked at word 2\n"); 128496c5ddc4Srjs values->type = (enum mali_attribute_type)__gen_unpack_uint(cl, 0, 5); 128596c5ddc4Srjs values->divisor_numerator = __gen_unpack_uint(cl, 32, 63); 128696c5ddc4Srjs values->divisor = __gen_unpack_uint(cl, 96, 127); 128796c5ddc4Srjs} 128896c5ddc4Srjs 128996c5ddc4Srjsstatic inline void 129096c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT_print(FILE *fp, const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_NPOT * values, unsigned indent) 129196c5ddc4Srjs{ 129296c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_type_as_str(values->type)); 129396c5ddc4Srjs fprintf(fp, "%*sDivisor Numerator: %u\n", indent, "", values->divisor_numerator); 129496c5ddc4Srjs fprintf(fp, "%*sDivisor: %u\n", indent, "", values->divisor); 129596c5ddc4Srjs} 129696c5ddc4Srjs 129796c5ddc4Srjsstruct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D { 129896c5ddc4Srjs enum mali_attribute_type type; 129996c5ddc4Srjs uint32_t s_dimension; 130096c5ddc4Srjs uint32_t t_dimension; 130196c5ddc4Srjs uint32_t r_dimension; 130296c5ddc4Srjs uint32_t row_stride; 130396c5ddc4Srjs uint32_t slice_stride; 130496c5ddc4Srjs}; 130596c5ddc4Srjs 130696c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_header\ 130796c5ddc4Srjs .type = MALI_ATTRIBUTE_TYPE_CONTINUATION 130896c5ddc4Srjs 130996c5ddc4Srjsstatic inline void 131096c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_pack(uint32_t * restrict cl, 131196c5ddc4Srjs const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D * restrict values) 131296c5ddc4Srjs{ 131396c5ddc4Srjs assert(values->s_dimension >= 1); 131496c5ddc4Srjs assert(values->t_dimension >= 1); 131596c5ddc4Srjs assert(values->r_dimension >= 1); 131696c5ddc4Srjs cl[ 0] = __gen_uint(values->type, 0, 5) | 131796c5ddc4Srjs __gen_uint(values->s_dimension - 1, 16, 31); 131896c5ddc4Srjs cl[ 1] = __gen_uint(values->t_dimension - 1, 0, 15) | 131996c5ddc4Srjs __gen_uint(values->r_dimension - 1, 16, 31); 132096c5ddc4Srjs cl[ 2] = __gen_uint(values->row_stride, 0, 31); 132196c5ddc4Srjs cl[ 3] = __gen_uint(values->slice_stride, 0, 31); 132296c5ddc4Srjs} 132396c5ddc4Srjs 132496c5ddc4Srjs 132596c5ddc4Srjs#define MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_LENGTH 16 132696c5ddc4Srjsstruct mali_attribute_buffer_continuation_3d_packed { uint32_t opaque[4]; }; 132796c5ddc4Srjsstatic inline void 132896c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_unpack(const uint8_t * restrict cl, 132996c5ddc4Srjs struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D * restrict values) 133096c5ddc4Srjs{ 133196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffc0) fprintf(stderr, "XXX: Invalid field of Attribute Buffer Continuation 3D unpacked at word 0\n"); 133296c5ddc4Srjs values->type = (enum mali_attribute_type)__gen_unpack_uint(cl, 0, 5); 133396c5ddc4Srjs values->s_dimension = __gen_unpack_uint(cl, 16, 31) + 1; 133496c5ddc4Srjs values->t_dimension = __gen_unpack_uint(cl, 32, 47) + 1; 133596c5ddc4Srjs values->r_dimension = __gen_unpack_uint(cl, 48, 63) + 1; 133696c5ddc4Srjs values->row_stride = __gen_unpack_uint(cl, 64, 95); 133796c5ddc4Srjs values->slice_stride = __gen_unpack_uint(cl, 96, 127); 133896c5ddc4Srjs} 133996c5ddc4Srjs 134096c5ddc4Srjsstatic inline void 134196c5ddc4SrjsMALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_print(FILE *fp, const struct MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D * values, unsigned indent) 134296c5ddc4Srjs{ 134396c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_attribute_type_as_str(values->type)); 134496c5ddc4Srjs fprintf(fp, "%*sS dimension: %u\n", indent, "", values->s_dimension); 134596c5ddc4Srjs fprintf(fp, "%*sT dimension: %u\n", indent, "", values->t_dimension); 134696c5ddc4Srjs fprintf(fp, "%*sR dimension: %u\n", indent, "", values->r_dimension); 134796c5ddc4Srjs fprintf(fp, "%*sRow Stride: %u\n", indent, "", values->row_stride); 134896c5ddc4Srjs fprintf(fp, "%*sSlice Stride: %u\n", indent, "", values->slice_stride); 134996c5ddc4Srjs} 135096c5ddc4Srjs 135196c5ddc4Srjsenum mali_blend_operand_a { 135296c5ddc4Srjs MALI_BLEND_OPERAND_A_ZERO = 1, 135396c5ddc4Srjs MALI_BLEND_OPERAND_A_SRC = 2, 135496c5ddc4Srjs MALI_BLEND_OPERAND_A_DEST = 3, 135596c5ddc4Srjs}; 135696c5ddc4Srjs 135796c5ddc4Srjsstatic inline const char * 135896c5ddc4Srjsmali_blend_operand_a_as_str(enum mali_blend_operand_a imm) 135996c5ddc4Srjs{ 136096c5ddc4Srjs switch (imm) { 136196c5ddc4Srjs case MALI_BLEND_OPERAND_A_ZERO: return "Zero"; 136296c5ddc4Srjs case MALI_BLEND_OPERAND_A_SRC: return "Src"; 136396c5ddc4Srjs case MALI_BLEND_OPERAND_A_DEST: return "Dest"; 136496c5ddc4Srjs default: return "XXX: INVALID"; 136596c5ddc4Srjs } 136696c5ddc4Srjs} 136796c5ddc4Srjs 136896c5ddc4Srjsenum mali_blend_operand_b { 136996c5ddc4Srjs MALI_BLEND_OPERAND_B_SRC_MINUS_DEST = 0, 137096c5ddc4Srjs MALI_BLEND_OPERAND_B_SRC_PLUS_DEST = 1, 137196c5ddc4Srjs MALI_BLEND_OPERAND_B_SRC = 2, 137296c5ddc4Srjs MALI_BLEND_OPERAND_B_DEST = 3, 137396c5ddc4Srjs}; 137496c5ddc4Srjs 137596c5ddc4Srjsstatic inline const char * 137696c5ddc4Srjsmali_blend_operand_b_as_str(enum mali_blend_operand_b imm) 137796c5ddc4Srjs{ 137896c5ddc4Srjs switch (imm) { 137996c5ddc4Srjs case MALI_BLEND_OPERAND_B_SRC_MINUS_DEST: return "Src Minus Dest"; 138096c5ddc4Srjs case MALI_BLEND_OPERAND_B_SRC_PLUS_DEST: return "Src Plus Dest"; 138196c5ddc4Srjs case MALI_BLEND_OPERAND_B_SRC: return "Src"; 138296c5ddc4Srjs case MALI_BLEND_OPERAND_B_DEST: return "Dest"; 138396c5ddc4Srjs default: return "XXX: INVALID"; 138496c5ddc4Srjs } 138596c5ddc4Srjs} 138696c5ddc4Srjs 138796c5ddc4Srjsenum mali_blend_operand_c { 138896c5ddc4Srjs MALI_BLEND_OPERAND_C_ZERO = 1, 138996c5ddc4Srjs MALI_BLEND_OPERAND_C_SRC = 2, 139096c5ddc4Srjs MALI_BLEND_OPERAND_C_DEST = 3, 139196c5ddc4Srjs MALI_BLEND_OPERAND_C_SRC_X_2 = 4, 139296c5ddc4Srjs MALI_BLEND_OPERAND_C_SRC_ALPHA = 5, 139396c5ddc4Srjs MALI_BLEND_OPERAND_C_DEST_ALPHA = 6, 139496c5ddc4Srjs MALI_BLEND_OPERAND_C_CONSTANT = 7, 139596c5ddc4Srjs}; 139696c5ddc4Srjs 139796c5ddc4Srjsstatic inline const char * 139896c5ddc4Srjsmali_blend_operand_c_as_str(enum mali_blend_operand_c imm) 139996c5ddc4Srjs{ 140096c5ddc4Srjs switch (imm) { 140196c5ddc4Srjs case MALI_BLEND_OPERAND_C_ZERO: return "Zero"; 140296c5ddc4Srjs case MALI_BLEND_OPERAND_C_SRC: return "Src"; 140396c5ddc4Srjs case MALI_BLEND_OPERAND_C_DEST: return "Dest"; 140496c5ddc4Srjs case MALI_BLEND_OPERAND_C_SRC_X_2: return "Src x 2"; 140596c5ddc4Srjs case MALI_BLEND_OPERAND_C_SRC_ALPHA: return "Src Alpha"; 140696c5ddc4Srjs case MALI_BLEND_OPERAND_C_DEST_ALPHA: return "Dest Alpha"; 140796c5ddc4Srjs case MALI_BLEND_OPERAND_C_CONSTANT: return "Constant"; 140896c5ddc4Srjs default: return "XXX: INVALID"; 140996c5ddc4Srjs } 141096c5ddc4Srjs} 141196c5ddc4Srjs 141296c5ddc4Srjsstruct MALI_BLEND_FUNCTION { 141396c5ddc4Srjs enum mali_blend_operand_a a; 141496c5ddc4Srjs bool negate_a; 141596c5ddc4Srjs enum mali_blend_operand_b b; 141696c5ddc4Srjs bool negate_b; 141796c5ddc4Srjs enum mali_blend_operand_c c; 141896c5ddc4Srjs bool invert_c; 141996c5ddc4Srjs}; 142096c5ddc4Srjs 142196c5ddc4Srjs#define MALI_BLEND_FUNCTION_header \ 142296c5ddc4Srjs 0 142396c5ddc4Srjs 142496c5ddc4Srjsstatic inline void 142596c5ddc4SrjsMALI_BLEND_FUNCTION_print(FILE *fp, const struct MALI_BLEND_FUNCTION * values, unsigned indent) 142696c5ddc4Srjs{ 142796c5ddc4Srjs fprintf(fp, "%*sA: %s\n", indent, "", mali_blend_operand_a_as_str(values->a)); 142896c5ddc4Srjs fprintf(fp, "%*sNegate A: %s\n", indent, "", values->negate_a ? "true" : "false"); 142996c5ddc4Srjs fprintf(fp, "%*sB: %s\n", indent, "", mali_blend_operand_b_as_str(values->b)); 143096c5ddc4Srjs fprintf(fp, "%*sNegate B: %s\n", indent, "", values->negate_b ? "true" : "false"); 143196c5ddc4Srjs fprintf(fp, "%*sC: %s\n", indent, "", mali_blend_operand_c_as_str(values->c)); 143296c5ddc4Srjs fprintf(fp, "%*sInvert C: %s\n", indent, "", values->invert_c ? "true" : "false"); 143396c5ddc4Srjs} 143496c5ddc4Srjs 143596c5ddc4Srjsstruct MALI_BLEND_EQUATION { 143696c5ddc4Srjs struct MALI_BLEND_FUNCTION rgb; 143796c5ddc4Srjs struct MALI_BLEND_FUNCTION alpha; 143896c5ddc4Srjs uint32_t color_mask; 143996c5ddc4Srjs}; 144096c5ddc4Srjs 144196c5ddc4Srjs#define MALI_BLEND_EQUATION_header \ 144296c5ddc4Srjs .rgb = { MALI_BLEND_FUNCTION_header }, \ 144396c5ddc4Srjs .alpha = { MALI_BLEND_FUNCTION_header } 144496c5ddc4Srjs 144596c5ddc4Srjsstatic inline void 144696c5ddc4SrjsMALI_BLEND_EQUATION_pack(uint32_t * restrict cl, 144796c5ddc4Srjs const struct MALI_BLEND_EQUATION * restrict values) 144896c5ddc4Srjs{ 144996c5ddc4Srjs cl[ 0] = __gen_uint(values->rgb.a, 0, 1) | 145096c5ddc4Srjs __gen_uint(values->rgb.negate_a, 3, 3) | 145196c5ddc4Srjs __gen_uint(values->rgb.b, 4, 5) | 145296c5ddc4Srjs __gen_uint(values->rgb.negate_b, 7, 7) | 145396c5ddc4Srjs __gen_uint(values->rgb.c, 8, 10) | 145496c5ddc4Srjs __gen_uint(values->rgb.invert_c, 11, 11) | 145596c5ddc4Srjs __gen_uint(values->alpha.a, 12, 13) | 145696c5ddc4Srjs __gen_uint(values->alpha.negate_a, 15, 15) | 145796c5ddc4Srjs __gen_uint(values->alpha.b, 16, 17) | 145896c5ddc4Srjs __gen_uint(values->alpha.negate_b, 19, 19) | 145996c5ddc4Srjs __gen_uint(values->alpha.c, 20, 22) | 146096c5ddc4Srjs __gen_uint(values->alpha.invert_c, 23, 23) | 146196c5ddc4Srjs __gen_uint(values->color_mask, 28, 31); 146296c5ddc4Srjs} 146396c5ddc4Srjs 146496c5ddc4Srjs 146596c5ddc4Srjs#define MALI_BLEND_EQUATION_LENGTH 4 146696c5ddc4Srjsstruct mali_blend_equation_packed { uint32_t opaque[1]; }; 146796c5ddc4Srjsstatic inline void 146896c5ddc4SrjsMALI_BLEND_EQUATION_unpack(const uint8_t * restrict cl, 146996c5ddc4Srjs struct MALI_BLEND_EQUATION * restrict values) 147096c5ddc4Srjs{ 147196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf044044) fprintf(stderr, "XXX: Invalid field of Blend Equation unpacked at word 0\n"); 147296c5ddc4Srjs values->rgb.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 0, 1); 147396c5ddc4Srjs values->rgb.negate_a = __gen_unpack_uint(cl, 3, 3); 147496c5ddc4Srjs values->rgb.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 4, 5); 147596c5ddc4Srjs values->rgb.negate_b = __gen_unpack_uint(cl, 7, 7); 147696c5ddc4Srjs values->rgb.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 8, 10); 147796c5ddc4Srjs values->rgb.invert_c = __gen_unpack_uint(cl, 11, 11); 147896c5ddc4Srjs values->alpha.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 12, 13); 147996c5ddc4Srjs values->alpha.negate_a = __gen_unpack_uint(cl, 15, 15); 148096c5ddc4Srjs values->alpha.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 16, 17); 148196c5ddc4Srjs values->alpha.negate_b = __gen_unpack_uint(cl, 19, 19); 148296c5ddc4Srjs values->alpha.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 20, 22); 148396c5ddc4Srjs values->alpha.invert_c = __gen_unpack_uint(cl, 23, 23); 148496c5ddc4Srjs values->color_mask = __gen_unpack_uint(cl, 28, 31); 148596c5ddc4Srjs} 148696c5ddc4Srjs 148796c5ddc4Srjsstatic inline void 148896c5ddc4SrjsMALI_BLEND_EQUATION_print(FILE *fp, const struct MALI_BLEND_EQUATION * values, unsigned indent) 148996c5ddc4Srjs{ 149096c5ddc4Srjs fprintf(fp, "%*sRGB:\n", indent, ""); 149196c5ddc4Srjs MALI_BLEND_FUNCTION_print(fp, &values->rgb, indent + 2); 149296c5ddc4Srjs fprintf(fp, "%*sAlpha:\n", indent, ""); 149396c5ddc4Srjs MALI_BLEND_FUNCTION_print(fp, &values->alpha, indent + 2); 149496c5ddc4Srjs fprintf(fp, "%*sColor Mask: %u\n", indent, "", values->color_mask); 149596c5ddc4Srjs} 149696c5ddc4Srjs 149796c5ddc4Srjsstruct MALI_BLEND { 149896c5ddc4Srjs bool load_destination; 149996c5ddc4Srjs bool blend_shader; 150096c5ddc4Srjs bool blend_shader_contains_discard; 150196c5ddc4Srjs bool alpha_to_one; 150296c5ddc4Srjs bool enable; 150396c5ddc4Srjs bool srgb; 150496c5ddc4Srjs bool round_to_fb_precision; 150596c5ddc4Srjs uint64_t shader_pc; 150696c5ddc4Srjs struct MALI_BLEND_EQUATION equation; 150796c5ddc4Srjs float constant; 150896c5ddc4Srjs}; 150996c5ddc4Srjs 151096c5ddc4Srjs#define MALI_BLEND_header \ 151196c5ddc4Srjs .load_destination = false, \ 151296c5ddc4Srjs .blend_shader = false, \ 151396c5ddc4Srjs .blend_shader_contains_discard = false, \ 151496c5ddc4Srjs .enable = true, \ 151596c5ddc4Srjs .srgb = false, \ 151696c5ddc4Srjs .round_to_fb_precision = false, \ 151796c5ddc4Srjs .equation = { MALI_BLEND_EQUATION_header } 151896c5ddc4Srjs 151996c5ddc4Srjsstatic inline void 152096c5ddc4SrjsMALI_BLEND_pack(uint32_t * restrict cl, 152196c5ddc4Srjs const struct MALI_BLEND * restrict values) 152296c5ddc4Srjs{ 152396c5ddc4Srjs cl[ 0] = __gen_uint(values->load_destination, 0, 0) | 152496c5ddc4Srjs __gen_uint(values->blend_shader, 1, 1) | 152596c5ddc4Srjs __gen_uint(values->blend_shader_contains_discard, 2, 2) | 152696c5ddc4Srjs __gen_uint(values->alpha_to_one, 8, 8) | 152796c5ddc4Srjs __gen_uint(values->enable, 9, 9) | 152896c5ddc4Srjs __gen_uint(values->srgb, 10, 10) | 152996c5ddc4Srjs __gen_uint(values->round_to_fb_precision, 11, 11); 153096c5ddc4Srjs cl[ 1] = 0; 153196c5ddc4Srjs cl[ 2] = __gen_uint(values->shader_pc, 0, 63) | 153296c5ddc4Srjs __gen_uint(values->equation.rgb.a, 0, 1) | 153396c5ddc4Srjs __gen_uint(values->equation.rgb.negate_a, 3, 3) | 153496c5ddc4Srjs __gen_uint(values->equation.rgb.b, 4, 5) | 153596c5ddc4Srjs __gen_uint(values->equation.rgb.negate_b, 7, 7) | 153696c5ddc4Srjs __gen_uint(values->equation.rgb.c, 8, 10) | 153796c5ddc4Srjs __gen_uint(values->equation.rgb.invert_c, 11, 11) | 153896c5ddc4Srjs __gen_uint(values->equation.alpha.a, 12, 13) | 153996c5ddc4Srjs __gen_uint(values->equation.alpha.negate_a, 15, 15) | 154096c5ddc4Srjs __gen_uint(values->equation.alpha.b, 16, 17) | 154196c5ddc4Srjs __gen_uint(values->equation.alpha.negate_b, 19, 19) | 154296c5ddc4Srjs __gen_uint(values->equation.alpha.c, 20, 22) | 154396c5ddc4Srjs __gen_uint(values->equation.alpha.invert_c, 23, 23) | 154496c5ddc4Srjs __gen_uint(values->equation.color_mask, 28, 31); 154596c5ddc4Srjs cl[ 3] = __gen_uint(values->shader_pc, 0, 63) >> 32 | 154696c5ddc4Srjs __gen_uint(fui(values->constant), 0, 32); 154796c5ddc4Srjs} 154896c5ddc4Srjs 154996c5ddc4Srjs 155096c5ddc4Srjs#define MALI_BLEND_LENGTH 16 155196c5ddc4Srjs#define MALI_BLEND_ALIGN 16 155296c5ddc4Srjsstruct mali_blend_packed { uint32_t opaque[4]; }; 155396c5ddc4Srjsstatic inline void 155496c5ddc4SrjsMALI_BLEND_unpack(const uint8_t * restrict cl, 155596c5ddc4Srjs struct MALI_BLEND * restrict values) 155696c5ddc4Srjs{ 155796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xfffff0f8) fprintf(stderr, "XXX: Invalid field of Blend unpacked at word 0\n"); 155896c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Blend unpacked at word 1\n"); 155996c5ddc4Srjs values->load_destination = __gen_unpack_uint(cl, 0, 0); 156096c5ddc4Srjs values->blend_shader = __gen_unpack_uint(cl, 1, 1); 156196c5ddc4Srjs values->blend_shader_contains_discard = __gen_unpack_uint(cl, 2, 2); 156296c5ddc4Srjs values->alpha_to_one = __gen_unpack_uint(cl, 8, 8); 156396c5ddc4Srjs values->enable = __gen_unpack_uint(cl, 9, 9); 156496c5ddc4Srjs values->srgb = __gen_unpack_uint(cl, 10, 10); 156596c5ddc4Srjs values->round_to_fb_precision = __gen_unpack_uint(cl, 11, 11); 156696c5ddc4Srjs values->shader_pc = __gen_unpack_uint(cl, 64, 127); 156796c5ddc4Srjs values->equation.rgb.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 64, 65); 156896c5ddc4Srjs values->equation.rgb.negate_a = __gen_unpack_uint(cl, 67, 67); 156996c5ddc4Srjs values->equation.rgb.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 68, 69); 157096c5ddc4Srjs values->equation.rgb.negate_b = __gen_unpack_uint(cl, 71, 71); 157196c5ddc4Srjs values->equation.rgb.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 72, 74); 157296c5ddc4Srjs values->equation.rgb.invert_c = __gen_unpack_uint(cl, 75, 75); 157396c5ddc4Srjs values->equation.alpha.a = (enum mali_blend_operand_a)__gen_unpack_uint(cl, 76, 77); 157496c5ddc4Srjs values->equation.alpha.negate_a = __gen_unpack_uint(cl, 79, 79); 157596c5ddc4Srjs values->equation.alpha.b = (enum mali_blend_operand_b)__gen_unpack_uint(cl, 80, 81); 157696c5ddc4Srjs values->equation.alpha.negate_b = __gen_unpack_uint(cl, 83, 83); 157796c5ddc4Srjs values->equation.alpha.c = (enum mali_blend_operand_c)__gen_unpack_uint(cl, 84, 86); 157896c5ddc4Srjs values->equation.alpha.invert_c = __gen_unpack_uint(cl, 87, 87); 157996c5ddc4Srjs values->equation.color_mask = __gen_unpack_uint(cl, 92, 95); 158096c5ddc4Srjs values->constant = __gen_unpack_float(cl, 96, 127); 158196c5ddc4Srjs} 158296c5ddc4Srjs 158396c5ddc4Srjsstatic inline void 158496c5ddc4SrjsMALI_BLEND_print(FILE *fp, const struct MALI_BLEND * values, unsigned indent) 158596c5ddc4Srjs{ 158696c5ddc4Srjs fprintf(fp, "%*sLoad Destination: %s\n", indent, "", values->load_destination ? "true" : "false"); 158796c5ddc4Srjs fprintf(fp, "%*sBlend Shader: %s\n", indent, "", values->blend_shader ? "true" : "false"); 158896c5ddc4Srjs fprintf(fp, "%*sBlend Shader Contains Discard: %s\n", indent, "", values->blend_shader_contains_discard ? "true" : "false"); 158996c5ddc4Srjs fprintf(fp, "%*sAlpha To One: %s\n", indent, "", values->alpha_to_one ? "true" : "false"); 159096c5ddc4Srjs fprintf(fp, "%*sEnable: %s\n", indent, "", values->enable ? "true" : "false"); 159196c5ddc4Srjs fprintf(fp, "%*ssRGB: %s\n", indent, "", values->srgb ? "true" : "false"); 159296c5ddc4Srjs fprintf(fp, "%*sRound to FB precision: %s\n", indent, "", values->round_to_fb_precision ? "true" : "false"); 159396c5ddc4Srjs fprintf(fp, "%*sShader PC: 0x%" PRIx64 "\n", indent, "", values->shader_pc); 159496c5ddc4Srjs fprintf(fp, "%*sEquation:\n", indent, ""); 159596c5ddc4Srjs MALI_BLEND_EQUATION_print(fp, &values->equation, indent + 2); 159696c5ddc4Srjs fprintf(fp, "%*sConstant: %f\n", indent, "", values->constant); 159796c5ddc4Srjs} 159896c5ddc4Srjs 159996c5ddc4Srjsstruct MALI_INVOCATION { 160096c5ddc4Srjs uint32_t invocations; 160196c5ddc4Srjs uint32_t size_y_shift; 160296c5ddc4Srjs uint32_t size_z_shift; 160396c5ddc4Srjs uint32_t workgroups_x_shift; 160496c5ddc4Srjs uint32_t workgroups_y_shift; 160596c5ddc4Srjs uint32_t workgroups_z_shift; 160696c5ddc4Srjs uint32_t thread_group_split; 160796c5ddc4Srjs#define MALI_SPLIT_MIN_EFFICIENT 2 160896c5ddc4Srjs}; 160996c5ddc4Srjs 161096c5ddc4Srjs#define MALI_INVOCATION_header \ 161196c5ddc4Srjs 0 161296c5ddc4Srjs 161396c5ddc4Srjsstatic inline void 161496c5ddc4SrjsMALI_INVOCATION_pack(uint32_t * restrict cl, 161596c5ddc4Srjs const struct MALI_INVOCATION * restrict values) 161696c5ddc4Srjs{ 161796c5ddc4Srjs cl[ 0] = __gen_uint(values->invocations, 0, 31); 161896c5ddc4Srjs cl[ 1] = __gen_uint(values->size_y_shift, 0, 4) | 161996c5ddc4Srjs __gen_uint(values->size_z_shift, 5, 9) | 162096c5ddc4Srjs __gen_uint(values->workgroups_x_shift, 10, 15) | 162196c5ddc4Srjs __gen_uint(values->workgroups_y_shift, 16, 21) | 162296c5ddc4Srjs __gen_uint(values->workgroups_z_shift, 22, 27) | 162396c5ddc4Srjs __gen_uint(values->thread_group_split, 28, 31); 162496c5ddc4Srjs} 162596c5ddc4Srjs 162696c5ddc4Srjs 162796c5ddc4Srjs#define MALI_INVOCATION_LENGTH 8 162896c5ddc4Srjsstruct mali_invocation_packed { uint32_t opaque[2]; }; 162996c5ddc4Srjsstatic inline void 163096c5ddc4SrjsMALI_INVOCATION_unpack(const uint8_t * restrict cl, 163196c5ddc4Srjs struct MALI_INVOCATION * restrict values) 163296c5ddc4Srjs{ 163396c5ddc4Srjs values->invocations = __gen_unpack_uint(cl, 0, 31); 163496c5ddc4Srjs values->size_y_shift = __gen_unpack_uint(cl, 32, 36); 163596c5ddc4Srjs values->size_z_shift = __gen_unpack_uint(cl, 37, 41); 163696c5ddc4Srjs values->workgroups_x_shift = __gen_unpack_uint(cl, 42, 47); 163796c5ddc4Srjs values->workgroups_y_shift = __gen_unpack_uint(cl, 48, 53); 163896c5ddc4Srjs values->workgroups_z_shift = __gen_unpack_uint(cl, 54, 59); 163996c5ddc4Srjs values->thread_group_split = __gen_unpack_uint(cl, 60, 63); 164096c5ddc4Srjs} 164196c5ddc4Srjs 164296c5ddc4Srjsstatic inline void 164396c5ddc4SrjsMALI_INVOCATION_print(FILE *fp, const struct MALI_INVOCATION * values, unsigned indent) 164496c5ddc4Srjs{ 164596c5ddc4Srjs fprintf(fp, "%*sInvocations: %u\n", indent, "", values->invocations); 164696c5ddc4Srjs fprintf(fp, "%*sSize Y shift: %u\n", indent, "", values->size_y_shift); 164796c5ddc4Srjs fprintf(fp, "%*sSize Z shift: %u\n", indent, "", values->size_z_shift); 164896c5ddc4Srjs fprintf(fp, "%*sWorkgroups X shift: %u\n", indent, "", values->workgroups_x_shift); 164996c5ddc4Srjs fprintf(fp, "%*sWorkgroups Y shift: %u\n", indent, "", values->workgroups_y_shift); 165096c5ddc4Srjs fprintf(fp, "%*sWorkgroups Z shift: %u\n", indent, "", values->workgroups_z_shift); 165196c5ddc4Srjs fprintf(fp, "%*sThread group split: %u\n", indent, "", values->thread_group_split); 165296c5ddc4Srjs} 165396c5ddc4Srjs 165496c5ddc4Srjsenum mali_point_size_array_format { 165596c5ddc4Srjs MALI_POINT_SIZE_ARRAY_FORMAT_NONE = 0, 165696c5ddc4Srjs MALI_POINT_SIZE_ARRAY_FORMAT_FP16 = 2, 165796c5ddc4Srjs MALI_POINT_SIZE_ARRAY_FORMAT_FP32 = 3, 165896c5ddc4Srjs}; 165996c5ddc4Srjs 166096c5ddc4Srjsstatic inline const char * 166196c5ddc4Srjsmali_point_size_array_format_as_str(enum mali_point_size_array_format imm) 166296c5ddc4Srjs{ 166396c5ddc4Srjs switch (imm) { 166496c5ddc4Srjs case MALI_POINT_SIZE_ARRAY_FORMAT_NONE: return "None"; 166596c5ddc4Srjs case MALI_POINT_SIZE_ARRAY_FORMAT_FP16: return "FP16"; 166696c5ddc4Srjs case MALI_POINT_SIZE_ARRAY_FORMAT_FP32: return "FP32"; 166796c5ddc4Srjs default: return "XXX: INVALID"; 166896c5ddc4Srjs } 166996c5ddc4Srjs} 167096c5ddc4Srjs 167196c5ddc4Srjsenum mali_primitive_restart { 167296c5ddc4Srjs MALI_PRIMITIVE_RESTART_NONE = 0, 167396c5ddc4Srjs MALI_PRIMITIVE_RESTART_IMPLICIT = 2, 167496c5ddc4Srjs MALI_PRIMITIVE_RESTART_EXPLICIT = 3, 167596c5ddc4Srjs}; 167696c5ddc4Srjs 167796c5ddc4Srjsstatic inline const char * 167896c5ddc4Srjsmali_primitive_restart_as_str(enum mali_primitive_restart imm) 167996c5ddc4Srjs{ 168096c5ddc4Srjs switch (imm) { 168196c5ddc4Srjs case MALI_PRIMITIVE_RESTART_NONE: return "None"; 168296c5ddc4Srjs case MALI_PRIMITIVE_RESTART_IMPLICIT: return "Implicit"; 168396c5ddc4Srjs case MALI_PRIMITIVE_RESTART_EXPLICIT: return "Explicit"; 168496c5ddc4Srjs default: return "XXX: INVALID"; 168596c5ddc4Srjs } 168696c5ddc4Srjs} 168796c5ddc4Srjs 168896c5ddc4Srjsstruct MALI_PRIMITIVE { 168996c5ddc4Srjs enum mali_draw_mode draw_mode; 169096c5ddc4Srjs enum mali_index_type index_type; 169196c5ddc4Srjs enum mali_point_size_array_format point_size_array_format; 169296c5ddc4Srjs bool primitive_index_enable; 169396c5ddc4Srjs bool primitive_index_writeback; 169496c5ddc4Srjs bool first_provoking_vertex; 169596c5ddc4Srjs bool low_depth_cull; 169696c5ddc4Srjs bool high_depth_cull; 169796c5ddc4Srjs enum mali_primitive_restart primitive_restart; 169896c5ddc4Srjs uint32_t job_task_split; 169996c5ddc4Srjs uint32_t base_vertex_offset; 170096c5ddc4Srjs uint32_t primitive_restart_index; 170196c5ddc4Srjs uint32_t index_count; 170296c5ddc4Srjs uint64_t indices; 170396c5ddc4Srjs}; 170496c5ddc4Srjs 170596c5ddc4Srjs#define MALI_PRIMITIVE_header \ 170696c5ddc4Srjs .index_type = MALI_INDEX_TYPE_NONE, \ 170796c5ddc4Srjs .first_provoking_vertex = true, \ 170896c5ddc4Srjs .low_depth_cull = true, \ 170996c5ddc4Srjs .high_depth_cull = true 171096c5ddc4Srjs 171196c5ddc4Srjsstatic inline void 171296c5ddc4SrjsMALI_PRIMITIVE_pack(uint32_t * restrict cl, 171396c5ddc4Srjs const struct MALI_PRIMITIVE * restrict values) 171496c5ddc4Srjs{ 171596c5ddc4Srjs assert(values->index_count >= 1); 171696c5ddc4Srjs cl[ 0] = __gen_uint(values->draw_mode, 0, 7) | 171796c5ddc4Srjs __gen_uint(values->index_type, 8, 10) | 171896c5ddc4Srjs __gen_uint(values->point_size_array_format, 11, 12) | 171996c5ddc4Srjs __gen_uint(values->primitive_index_enable, 13, 13) | 172096c5ddc4Srjs __gen_uint(values->primitive_index_writeback, 14, 14) | 172196c5ddc4Srjs __gen_uint(values->first_provoking_vertex, 15, 15) | 172296c5ddc4Srjs __gen_uint(values->low_depth_cull, 16, 16) | 172396c5ddc4Srjs __gen_uint(values->high_depth_cull, 17, 17) | 172496c5ddc4Srjs __gen_uint(values->primitive_restart, 19, 20) | 172596c5ddc4Srjs __gen_uint(values->job_task_split, 26, 31); 172696c5ddc4Srjs cl[ 1] = __gen_uint(values->base_vertex_offset, 0, 31); 172796c5ddc4Srjs cl[ 2] = __gen_uint(values->primitive_restart_index, 0, 31); 172896c5ddc4Srjs cl[ 3] = __gen_uint(values->index_count - 1, 0, 31); 172996c5ddc4Srjs cl[ 4] = __gen_uint(values->indices, 0, 63); 173096c5ddc4Srjs cl[ 5] = __gen_uint(values->indices, 0, 63) >> 32; 173196c5ddc4Srjs} 173296c5ddc4Srjs 173396c5ddc4Srjs 173496c5ddc4Srjs#define MALI_PRIMITIVE_LENGTH 24 173596c5ddc4Srjsstruct mali_primitive_packed { uint32_t opaque[6]; }; 173696c5ddc4Srjsstatic inline void 173796c5ddc4SrjsMALI_PRIMITIVE_unpack(const uint8_t * restrict cl, 173896c5ddc4Srjs struct MALI_PRIMITIVE * restrict values) 173996c5ddc4Srjs{ 174096c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0x3e40000) fprintf(stderr, "XXX: Invalid field of Primitive unpacked at word 0\n"); 174196c5ddc4Srjs values->draw_mode = (enum mali_draw_mode)__gen_unpack_uint(cl, 0, 7); 174296c5ddc4Srjs values->index_type = (enum mali_index_type)__gen_unpack_uint(cl, 8, 10); 174396c5ddc4Srjs values->point_size_array_format = (enum mali_point_size_array_format)__gen_unpack_uint(cl, 11, 12); 174496c5ddc4Srjs values->primitive_index_enable = __gen_unpack_uint(cl, 13, 13); 174596c5ddc4Srjs values->primitive_index_writeback = __gen_unpack_uint(cl, 14, 14); 174696c5ddc4Srjs values->first_provoking_vertex = __gen_unpack_uint(cl, 15, 15); 174796c5ddc4Srjs values->low_depth_cull = __gen_unpack_uint(cl, 16, 16); 174896c5ddc4Srjs values->high_depth_cull = __gen_unpack_uint(cl, 17, 17); 174996c5ddc4Srjs values->primitive_restart = (enum mali_primitive_restart)__gen_unpack_uint(cl, 19, 20); 175096c5ddc4Srjs values->job_task_split = __gen_unpack_uint(cl, 26, 31); 175196c5ddc4Srjs values->base_vertex_offset = __gen_unpack_uint(cl, 32, 63); 175296c5ddc4Srjs values->primitive_restart_index = __gen_unpack_uint(cl, 64, 95); 175396c5ddc4Srjs values->index_count = __gen_unpack_uint(cl, 96, 127) + 1; 175496c5ddc4Srjs values->indices = __gen_unpack_uint(cl, 128, 191); 175596c5ddc4Srjs} 175696c5ddc4Srjs 175796c5ddc4Srjsstatic inline void 175896c5ddc4SrjsMALI_PRIMITIVE_print(FILE *fp, const struct MALI_PRIMITIVE * values, unsigned indent) 175996c5ddc4Srjs{ 176096c5ddc4Srjs fprintf(fp, "%*sDraw mode: %s\n", indent, "", mali_draw_mode_as_str(values->draw_mode)); 176196c5ddc4Srjs fprintf(fp, "%*sIndex type: %s\n", indent, "", mali_index_type_as_str(values->index_type)); 176296c5ddc4Srjs fprintf(fp, "%*sPoint size array format: %s\n", indent, "", mali_point_size_array_format_as_str(values->point_size_array_format)); 176396c5ddc4Srjs fprintf(fp, "%*sPrimitive Index Enable: %s\n", indent, "", values->primitive_index_enable ? "true" : "false"); 176496c5ddc4Srjs fprintf(fp, "%*sPrimitive Index Writeback: %s\n", indent, "", values->primitive_index_writeback ? "true" : "false"); 176596c5ddc4Srjs fprintf(fp, "%*sFirst provoking vertex: %s\n", indent, "", values->first_provoking_vertex ? "true" : "false"); 176696c5ddc4Srjs fprintf(fp, "%*sLow Depth Cull: %s\n", indent, "", values->low_depth_cull ? "true" : "false"); 176796c5ddc4Srjs fprintf(fp, "%*sHigh Depth Cull: %s\n", indent, "", values->high_depth_cull ? "true" : "false"); 176896c5ddc4Srjs fprintf(fp, "%*sPrimitive restart: %s\n", indent, "", mali_primitive_restart_as_str(values->primitive_restart)); 176996c5ddc4Srjs fprintf(fp, "%*sJob Task Split: %u\n", indent, "", values->job_task_split); 177096c5ddc4Srjs fprintf(fp, "%*sBase vertex offset: %u\n", indent, "", values->base_vertex_offset); 177196c5ddc4Srjs fprintf(fp, "%*sPrimitive Restart Index: %u\n", indent, "", values->primitive_restart_index); 177296c5ddc4Srjs fprintf(fp, "%*sIndex count: %u\n", indent, "", values->index_count); 177396c5ddc4Srjs fprintf(fp, "%*sIndices: 0x%" PRIx64 "\n", indent, "", values->indices); 177496c5ddc4Srjs} 177596c5ddc4Srjs 177696c5ddc4Srjsstruct MALI_DRAW { 177796c5ddc4Srjs bool four_components_per_vertex; 177896c5ddc4Srjs bool draw_descriptor_is_64b; 177996c5ddc4Srjs bool texture_descriptor_is_64b; 178096c5ddc4Srjs enum mali_occlusion_mode occlusion_query; 178196c5ddc4Srjs bool front_face_ccw; 178296c5ddc4Srjs bool cull_front_face; 178396c5ddc4Srjs bool cull_back_face; 178496c5ddc4Srjs uint32_t flat_shading_vertex; 178596c5ddc4Srjs bool exclude_filtered_perf_counters; 178696c5ddc4Srjs bool primitive_barrier; 178796c5ddc4Srjs bool clean_fragment_write; 178896c5ddc4Srjs uint32_t instance_size; 178996c5ddc4Srjs uint32_t instance_primitive_size; 179096c5ddc4Srjs uint32_t offset_start; 179196c5ddc4Srjs uint32_t primitive_index_base; 179296c5ddc4Srjs uint64_t position; 179396c5ddc4Srjs uint64_t uniform_buffers; 179496c5ddc4Srjs uint64_t textures; 179596c5ddc4Srjs uint64_t samplers; 179696c5ddc4Srjs uint64_t push_uniforms; 179796c5ddc4Srjs uint64_t state; 179896c5ddc4Srjs uint64_t attribute_buffers; 179996c5ddc4Srjs uint64_t attributes; 180096c5ddc4Srjs uint64_t varying_buffers; 180196c5ddc4Srjs uint64_t varyings; 180296c5ddc4Srjs uint64_t viewport; 180396c5ddc4Srjs uint64_t occlusion; 180496c5ddc4Srjs uint64_t thread_storage; 180596c5ddc4Srjs uint64_t fbd; 180696c5ddc4Srjs}; 180796c5ddc4Srjs 180896c5ddc4Srjs#define MALI_DRAW_header \ 180996c5ddc4Srjs .texture_descriptor_is_64b = true, \ 181096c5ddc4Srjs .occlusion_query = MALI_OCCLUSION_MODE_DISABLED, \ 181196c5ddc4Srjs .instance_size = 1, \ 181296c5ddc4Srjs .instance_primitive_size = 1 181396c5ddc4Srjs 181496c5ddc4Srjsstatic inline void 181596c5ddc4SrjsMALI_DRAW_pack(uint32_t * restrict cl, 181696c5ddc4Srjs const struct MALI_DRAW * restrict values) 181796c5ddc4Srjs{ 181896c5ddc4Srjs cl[ 0] = __gen_uint(values->four_components_per_vertex, 0, 0) | 181996c5ddc4Srjs __gen_uint(values->draw_descriptor_is_64b, 1, 1) | 182096c5ddc4Srjs __gen_uint(values->texture_descriptor_is_64b, 2, 2) | 182196c5ddc4Srjs __gen_uint(values->occlusion_query, 3, 4) | 182296c5ddc4Srjs __gen_uint(values->front_face_ccw, 5, 5) | 182396c5ddc4Srjs __gen_uint(values->cull_front_face, 6, 6) | 182496c5ddc4Srjs __gen_uint(values->cull_back_face, 7, 7) | 182596c5ddc4Srjs __gen_uint(values->flat_shading_vertex, 8, 8) | 182696c5ddc4Srjs __gen_uint(values->exclude_filtered_perf_counters, 9, 9) | 182796c5ddc4Srjs __gen_uint(values->primitive_barrier, 10, 10) | 182896c5ddc4Srjs __gen_uint(values->clean_fragment_write, 11, 11) | 182996c5ddc4Srjs __gen_padded(values->instance_size, 16, 23) | 183096c5ddc4Srjs __gen_padded(values->instance_primitive_size, 24, 31); 183196c5ddc4Srjs cl[ 1] = __gen_uint(values->offset_start, 0, 31); 183296c5ddc4Srjs cl[ 2] = __gen_uint(values->primitive_index_base, 0, 31); 183396c5ddc4Srjs cl[ 3] = 0; 183496c5ddc4Srjs cl[ 4] = __gen_uint(values->position, 0, 63); 183596c5ddc4Srjs cl[ 5] = __gen_uint(values->position, 0, 63) >> 32; 183696c5ddc4Srjs cl[ 6] = __gen_uint(values->uniform_buffers, 0, 63); 183796c5ddc4Srjs cl[ 7] = __gen_uint(values->uniform_buffers, 0, 63) >> 32; 183896c5ddc4Srjs cl[ 8] = __gen_uint(values->textures, 0, 63); 183996c5ddc4Srjs cl[ 9] = __gen_uint(values->textures, 0, 63) >> 32; 184096c5ddc4Srjs cl[10] = __gen_uint(values->samplers, 0, 63); 184196c5ddc4Srjs cl[11] = __gen_uint(values->samplers, 0, 63) >> 32; 184296c5ddc4Srjs cl[12] = __gen_uint(values->push_uniforms, 0, 63); 184396c5ddc4Srjs cl[13] = __gen_uint(values->push_uniforms, 0, 63) >> 32; 184496c5ddc4Srjs cl[14] = __gen_uint(values->state, 0, 63); 184596c5ddc4Srjs cl[15] = __gen_uint(values->state, 0, 63) >> 32; 184696c5ddc4Srjs cl[16] = __gen_uint(values->attribute_buffers, 0, 63); 184796c5ddc4Srjs cl[17] = __gen_uint(values->attribute_buffers, 0, 63) >> 32; 184896c5ddc4Srjs cl[18] = __gen_uint(values->attributes, 0, 63); 184996c5ddc4Srjs cl[19] = __gen_uint(values->attributes, 0, 63) >> 32; 185096c5ddc4Srjs cl[20] = __gen_uint(values->varying_buffers, 0, 63); 185196c5ddc4Srjs cl[21] = __gen_uint(values->varying_buffers, 0, 63) >> 32; 185296c5ddc4Srjs cl[22] = __gen_uint(values->varyings, 0, 63); 185396c5ddc4Srjs cl[23] = __gen_uint(values->varyings, 0, 63) >> 32; 185496c5ddc4Srjs cl[24] = __gen_uint(values->viewport, 0, 63); 185596c5ddc4Srjs cl[25] = __gen_uint(values->viewport, 0, 63) >> 32; 185696c5ddc4Srjs cl[26] = __gen_uint(values->occlusion, 0, 63); 185796c5ddc4Srjs cl[27] = __gen_uint(values->occlusion, 0, 63) >> 32; 185896c5ddc4Srjs cl[28] = __gen_uint(values->thread_storage, 0, 63) | 185996c5ddc4Srjs __gen_uint(values->fbd, 0, 63); 186096c5ddc4Srjs cl[29] = __gen_uint(values->thread_storage, 0, 63) >> 32 | 186196c5ddc4Srjs __gen_uint(values->fbd, 0, 63) >> 32; 186296c5ddc4Srjs} 186396c5ddc4Srjs 186496c5ddc4Srjs 186596c5ddc4Srjs#define MALI_DRAW_LENGTH 120 186696c5ddc4Srjs#define MALI_DRAW_ALIGN 64 186796c5ddc4Srjsstruct mali_draw_packed { uint32_t opaque[30]; }; 186896c5ddc4Srjsstatic inline void 186996c5ddc4SrjsMALI_DRAW_unpack(const uint8_t * restrict cl, 187096c5ddc4Srjs struct MALI_DRAW * restrict values) 187196c5ddc4Srjs{ 187296c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf000) fprintf(stderr, "XXX: Invalid field of Draw unpacked at word 0\n"); 187396c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Draw unpacked at word 3\n"); 187496c5ddc4Srjs values->four_components_per_vertex = __gen_unpack_uint(cl, 0, 0); 187596c5ddc4Srjs values->draw_descriptor_is_64b = __gen_unpack_uint(cl, 1, 1); 187696c5ddc4Srjs values->texture_descriptor_is_64b = __gen_unpack_uint(cl, 2, 2); 187796c5ddc4Srjs values->occlusion_query = (enum mali_occlusion_mode)__gen_unpack_uint(cl, 3, 4); 187896c5ddc4Srjs values->front_face_ccw = __gen_unpack_uint(cl, 5, 5); 187996c5ddc4Srjs values->cull_front_face = __gen_unpack_uint(cl, 6, 6); 188096c5ddc4Srjs values->cull_back_face = __gen_unpack_uint(cl, 7, 7); 188196c5ddc4Srjs values->flat_shading_vertex = __gen_unpack_uint(cl, 8, 8); 188296c5ddc4Srjs values->exclude_filtered_perf_counters = __gen_unpack_uint(cl, 9, 9); 188396c5ddc4Srjs values->primitive_barrier = __gen_unpack_uint(cl, 10, 10); 188496c5ddc4Srjs values->clean_fragment_write = __gen_unpack_uint(cl, 11, 11); 188596c5ddc4Srjs values->instance_size = __gen_unpack_padded(cl, 16, 23); 188696c5ddc4Srjs values->instance_primitive_size = __gen_unpack_padded(cl, 24, 31); 188796c5ddc4Srjs values->offset_start = __gen_unpack_uint(cl, 32, 63); 188896c5ddc4Srjs values->primitive_index_base = __gen_unpack_uint(cl, 64, 95); 188996c5ddc4Srjs values->position = __gen_unpack_uint(cl, 128, 191); 189096c5ddc4Srjs values->uniform_buffers = __gen_unpack_uint(cl, 192, 255); 189196c5ddc4Srjs values->textures = __gen_unpack_uint(cl, 256, 319); 189296c5ddc4Srjs values->samplers = __gen_unpack_uint(cl, 320, 383); 189396c5ddc4Srjs values->push_uniforms = __gen_unpack_uint(cl, 384, 447); 189496c5ddc4Srjs values->state = __gen_unpack_uint(cl, 448, 511); 189596c5ddc4Srjs values->attribute_buffers = __gen_unpack_uint(cl, 512, 575); 189696c5ddc4Srjs values->attributes = __gen_unpack_uint(cl, 576, 639); 189796c5ddc4Srjs values->varying_buffers = __gen_unpack_uint(cl, 640, 703); 189896c5ddc4Srjs values->varyings = __gen_unpack_uint(cl, 704, 767); 189996c5ddc4Srjs values->viewport = __gen_unpack_uint(cl, 768, 831); 190096c5ddc4Srjs values->occlusion = __gen_unpack_uint(cl, 832, 895); 190196c5ddc4Srjs values->thread_storage = __gen_unpack_uint(cl, 896, 959); 190296c5ddc4Srjs values->fbd = __gen_unpack_uint(cl, 896, 959); 190396c5ddc4Srjs} 190496c5ddc4Srjs 190596c5ddc4Srjsstatic inline void 190696c5ddc4SrjsMALI_DRAW_print(FILE *fp, const struct MALI_DRAW * values, unsigned indent) 190796c5ddc4Srjs{ 190896c5ddc4Srjs fprintf(fp, "%*sFour Components Per Vertex: %s\n", indent, "", values->four_components_per_vertex ? "true" : "false"); 190996c5ddc4Srjs fprintf(fp, "%*sDraw Descriptor Is 64b: %s\n", indent, "", values->draw_descriptor_is_64b ? "true" : "false"); 191096c5ddc4Srjs fprintf(fp, "%*sTexture Descriptor Is 64b: %s\n", indent, "", values->texture_descriptor_is_64b ? "true" : "false"); 191196c5ddc4Srjs fprintf(fp, "%*sOcclusion query: %s\n", indent, "", mali_occlusion_mode_as_str(values->occlusion_query)); 191296c5ddc4Srjs fprintf(fp, "%*sFront face CCW: %s\n", indent, "", values->front_face_ccw ? "true" : "false"); 191396c5ddc4Srjs fprintf(fp, "%*sCull front face: %s\n", indent, "", values->cull_front_face ? "true" : "false"); 191496c5ddc4Srjs fprintf(fp, "%*sCull back face: %s\n", indent, "", values->cull_back_face ? "true" : "false"); 191596c5ddc4Srjs fprintf(fp, "%*sFlat Shading Vertex: %u\n", indent, "", values->flat_shading_vertex); 191696c5ddc4Srjs fprintf(fp, "%*sExclude Filtered Perf Counters: %s\n", indent, "", values->exclude_filtered_perf_counters ? "true" : "false"); 191796c5ddc4Srjs fprintf(fp, "%*sPrimitive Barrier: %s\n", indent, "", values->primitive_barrier ? "true" : "false"); 191896c5ddc4Srjs fprintf(fp, "%*sClean Fragment Write: %s\n", indent, "", values->clean_fragment_write ? "true" : "false"); 191996c5ddc4Srjs fprintf(fp, "%*sInstance Size: %u\n", indent, "", values->instance_size); 192096c5ddc4Srjs fprintf(fp, "%*sInstance Primitive Size: %u\n", indent, "", values->instance_primitive_size); 192196c5ddc4Srjs fprintf(fp, "%*sOffset start: %u\n", indent, "", values->offset_start); 192296c5ddc4Srjs fprintf(fp, "%*sPrimitive Index Base: %u\n", indent, "", values->primitive_index_base); 192396c5ddc4Srjs fprintf(fp, "%*sPosition: 0x%" PRIx64 "\n", indent, "", values->position); 192496c5ddc4Srjs fprintf(fp, "%*sUniform buffers: 0x%" PRIx64 "\n", indent, "", values->uniform_buffers); 192596c5ddc4Srjs fprintf(fp, "%*sTextures: 0x%" PRIx64 "\n", indent, "", values->textures); 192696c5ddc4Srjs fprintf(fp, "%*sSamplers: 0x%" PRIx64 "\n", indent, "", values->samplers); 192796c5ddc4Srjs fprintf(fp, "%*sPush uniforms: 0x%" PRIx64 "\n", indent, "", values->push_uniforms); 192896c5ddc4Srjs fprintf(fp, "%*sState: 0x%" PRIx64 "\n", indent, "", values->state); 192996c5ddc4Srjs fprintf(fp, "%*sAttribute buffers: 0x%" PRIx64 "\n", indent, "", values->attribute_buffers); 193096c5ddc4Srjs fprintf(fp, "%*sAttributes: 0x%" PRIx64 "\n", indent, "", values->attributes); 193196c5ddc4Srjs fprintf(fp, "%*sVarying buffers: 0x%" PRIx64 "\n", indent, "", values->varying_buffers); 193296c5ddc4Srjs fprintf(fp, "%*sVaryings: 0x%" PRIx64 "\n", indent, "", values->varyings); 193396c5ddc4Srjs fprintf(fp, "%*sViewport: 0x%" PRIx64 "\n", indent, "", values->viewport); 193496c5ddc4Srjs fprintf(fp, "%*sOcclusion: 0x%" PRIx64 "\n", indent, "", values->occlusion); 193596c5ddc4Srjs fprintf(fp, "%*sThread Storage: 0x%" PRIx64 "\n", indent, "", values->thread_storage); 193696c5ddc4Srjs fprintf(fp, "%*sFBD: 0x%" PRIx64 "\n", indent, "", values->fbd); 193796c5ddc4Srjs} 193896c5ddc4Srjs 193996c5ddc4Srjsstruct MALI_SURFACE { 194096c5ddc4Srjs uint64_t pointer; 194196c5ddc4Srjs}; 194296c5ddc4Srjs 194396c5ddc4Srjs#define MALI_SURFACE_header \ 194496c5ddc4Srjs 0 194596c5ddc4Srjs 194696c5ddc4Srjsstatic inline void 194796c5ddc4SrjsMALI_SURFACE_pack(uint32_t * restrict cl, 194896c5ddc4Srjs const struct MALI_SURFACE * restrict values) 194996c5ddc4Srjs{ 195096c5ddc4Srjs cl[ 0] = __gen_uint(values->pointer, 0, 63); 195196c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer, 0, 63) >> 32; 195296c5ddc4Srjs} 195396c5ddc4Srjs 195496c5ddc4Srjs 195596c5ddc4Srjs#define MALI_SURFACE_LENGTH 8 195696c5ddc4Srjs#define MALI_SURFACE_ALIGN 8 195796c5ddc4Srjsstruct mali_surface_packed { uint32_t opaque[2]; }; 195896c5ddc4Srjsstatic inline void 195996c5ddc4SrjsMALI_SURFACE_unpack(const uint8_t * restrict cl, 196096c5ddc4Srjs struct MALI_SURFACE * restrict values) 196196c5ddc4Srjs{ 196296c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 0, 63); 196396c5ddc4Srjs} 196496c5ddc4Srjs 196596c5ddc4Srjsstatic inline void 196696c5ddc4SrjsMALI_SURFACE_print(FILE *fp, const struct MALI_SURFACE * values, unsigned indent) 196796c5ddc4Srjs{ 196896c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 196996c5ddc4Srjs} 197096c5ddc4Srjs 197196c5ddc4Srjsstruct MALI_SURFACE_WITH_STRIDE { 197296c5ddc4Srjs uint64_t pointer; 197396c5ddc4Srjs int32_t row_stride; 197496c5ddc4Srjs int32_t surface_stride; 197596c5ddc4Srjs}; 197696c5ddc4Srjs 197796c5ddc4Srjs#define MALI_SURFACE_WITH_STRIDE_header \ 197896c5ddc4Srjs 0 197996c5ddc4Srjs 198096c5ddc4Srjsstatic inline void 198196c5ddc4SrjsMALI_SURFACE_WITH_STRIDE_pack(uint32_t * restrict cl, 198296c5ddc4Srjs const struct MALI_SURFACE_WITH_STRIDE * restrict values) 198396c5ddc4Srjs{ 198496c5ddc4Srjs cl[ 0] = __gen_uint(values->pointer, 0, 63); 198596c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer, 0, 63) >> 32; 198696c5ddc4Srjs cl[ 2] = __gen_sint(values->row_stride, 0, 31); 198796c5ddc4Srjs cl[ 3] = __gen_sint(values->surface_stride, 0, 31); 198896c5ddc4Srjs} 198996c5ddc4Srjs 199096c5ddc4Srjs 199196c5ddc4Srjs#define MALI_SURFACE_WITH_STRIDE_LENGTH 16 199296c5ddc4Srjs#define MALI_SURFACE_WITH_STRIDE_ALIGN 8 199396c5ddc4Srjsstruct mali_surface_with_stride_packed { uint32_t opaque[4]; }; 199496c5ddc4Srjsstatic inline void 199596c5ddc4SrjsMALI_SURFACE_WITH_STRIDE_unpack(const uint8_t * restrict cl, 199696c5ddc4Srjs struct MALI_SURFACE_WITH_STRIDE * restrict values) 199796c5ddc4Srjs{ 199896c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 0, 63); 199996c5ddc4Srjs values->row_stride = __gen_unpack_sint(cl, 64, 95); 200096c5ddc4Srjs values->surface_stride = __gen_unpack_sint(cl, 96, 127); 200196c5ddc4Srjs} 200296c5ddc4Srjs 200396c5ddc4Srjsstatic inline void 200496c5ddc4SrjsMALI_SURFACE_WITH_STRIDE_print(FILE *fp, const struct MALI_SURFACE_WITH_STRIDE * values, unsigned indent) 200596c5ddc4Srjs{ 200696c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 200796c5ddc4Srjs fprintf(fp, "%*sRow stride: %d\n", indent, "", values->row_stride); 200896c5ddc4Srjs fprintf(fp, "%*sSurface stride: %d\n", indent, "", values->surface_stride); 200996c5ddc4Srjs} 201096c5ddc4Srjs 201196c5ddc4Srjsstruct MALI_SAMPLER { 201296c5ddc4Srjs bool magnify_nearest; 201396c5ddc4Srjs bool minify_nearest; 201496c5ddc4Srjs enum mali_mipmap_mode mipmap_mode; 201596c5ddc4Srjs bool normalized_coordinates; 201696c5ddc4Srjs bool isotropic_lod; 201796c5ddc4Srjs int32_t lod_bias; 201896c5ddc4Srjs uint32_t minimum_lod; 201996c5ddc4Srjs uint32_t maximum_lod; 202096c5ddc4Srjs enum mali_wrap_mode wrap_mode_s; 202196c5ddc4Srjs enum mali_wrap_mode wrap_mode_t; 202296c5ddc4Srjs enum mali_wrap_mode wrap_mode_r; 202396c5ddc4Srjs enum mali_func compare_function; 202496c5ddc4Srjs bool seamless_cube_map; 202596c5ddc4Srjs uint32_t border_color_r; 202696c5ddc4Srjs uint32_t border_color_g; 202796c5ddc4Srjs uint32_t border_color_b; 202896c5ddc4Srjs uint32_t border_color_a; 202996c5ddc4Srjs}; 203096c5ddc4Srjs 203196c5ddc4Srjs#define MALI_SAMPLER_header \ 203296c5ddc4Srjs .magnify_nearest = true, \ 203396c5ddc4Srjs .minify_nearest = true, \ 203496c5ddc4Srjs .mipmap_mode = MALI_MIPMAP_MODE_NEAREST, \ 203596c5ddc4Srjs .normalized_coordinates = true, \ 203696c5ddc4Srjs .lod_bias = 0, \ 203796c5ddc4Srjs .minimum_lod = 0, \ 203896c5ddc4Srjs .maximum_lod = 1, \ 203996c5ddc4Srjs .wrap_mode_s = MALI_WRAP_MODE_CLAMP_TO_EDGE, \ 204096c5ddc4Srjs .wrap_mode_t = MALI_WRAP_MODE_CLAMP_TO_EDGE, \ 204196c5ddc4Srjs .wrap_mode_r = MALI_WRAP_MODE_CLAMP_TO_EDGE, \ 204296c5ddc4Srjs .compare_function = MALI_FUNC_NEVER, \ 204396c5ddc4Srjs .seamless_cube_map = true, \ 204496c5ddc4Srjs .border_color_r = 0.0, \ 204596c5ddc4Srjs .border_color_g = 0.0, \ 204696c5ddc4Srjs .border_color_b = 0.0, \ 204796c5ddc4Srjs .border_color_a = 0.0 204896c5ddc4Srjs 204996c5ddc4Srjsstatic inline void 205096c5ddc4SrjsMALI_SAMPLER_pack(uint32_t * restrict cl, 205196c5ddc4Srjs const struct MALI_SAMPLER * restrict values) 205296c5ddc4Srjs{ 205396c5ddc4Srjs cl[ 0] = __gen_uint(values->magnify_nearest, 0, 0) | 205496c5ddc4Srjs __gen_uint(values->minify_nearest, 1, 1) | 205596c5ddc4Srjs __gen_uint(values->mipmap_mode, 3, 4) | 205696c5ddc4Srjs __gen_uint(values->normalized_coordinates, 5, 5) | 205796c5ddc4Srjs __gen_uint(values->isotropic_lod, 6, 6) | 205896c5ddc4Srjs __gen_sint(values->lod_bias, 16, 31); 205996c5ddc4Srjs cl[ 1] = __gen_uint(values->minimum_lod, 0, 15) | 206096c5ddc4Srjs __gen_uint(values->maximum_lod, 16, 31); 206196c5ddc4Srjs cl[ 2] = __gen_uint(values->wrap_mode_s, 0, 3) | 206296c5ddc4Srjs __gen_uint(values->wrap_mode_t, 4, 7) | 206396c5ddc4Srjs __gen_uint(values->wrap_mode_r, 8, 11) | 206496c5ddc4Srjs __gen_uint(values->compare_function, 12, 14) | 206596c5ddc4Srjs __gen_uint(values->seamless_cube_map, 15, 15); 206696c5ddc4Srjs cl[ 3] = 0; 206796c5ddc4Srjs cl[ 4] = __gen_uint(values->border_color_r, 0, 31); 206896c5ddc4Srjs cl[ 5] = __gen_uint(values->border_color_g, 0, 31); 206996c5ddc4Srjs cl[ 6] = __gen_uint(values->border_color_b, 0, 31); 207096c5ddc4Srjs cl[ 7] = __gen_uint(values->border_color_a, 0, 31); 207196c5ddc4Srjs} 207296c5ddc4Srjs 207396c5ddc4Srjs 207496c5ddc4Srjs#define MALI_SAMPLER_LENGTH 32 207596c5ddc4Srjs#define MALI_SAMPLER_ALIGN 32 207696c5ddc4Srjsstruct mali_sampler_packed { uint32_t opaque[8]; }; 207796c5ddc4Srjsstatic inline void 207896c5ddc4SrjsMALI_SAMPLER_unpack(const uint8_t * restrict cl, 207996c5ddc4Srjs struct MALI_SAMPLER * restrict values) 208096c5ddc4Srjs{ 208196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xff84) fprintf(stderr, "XXX: Invalid field of Sampler unpacked at word 0\n"); 208296c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffff0000) fprintf(stderr, "XXX: Invalid field of Sampler unpacked at word 2\n"); 208396c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Sampler unpacked at word 3\n"); 208496c5ddc4Srjs values->magnify_nearest = __gen_unpack_uint(cl, 0, 0); 208596c5ddc4Srjs values->minify_nearest = __gen_unpack_uint(cl, 1, 1); 208696c5ddc4Srjs values->mipmap_mode = (enum mali_mipmap_mode)__gen_unpack_uint(cl, 3, 4); 208796c5ddc4Srjs values->normalized_coordinates = __gen_unpack_uint(cl, 5, 5); 208896c5ddc4Srjs values->isotropic_lod = __gen_unpack_uint(cl, 6, 6); 208996c5ddc4Srjs values->lod_bias = __gen_unpack_sint(cl, 16, 31); 209096c5ddc4Srjs values->minimum_lod = __gen_unpack_uint(cl, 32, 47); 209196c5ddc4Srjs values->maximum_lod = __gen_unpack_uint(cl, 48, 63); 209296c5ddc4Srjs values->wrap_mode_s = (enum mali_wrap_mode)__gen_unpack_uint(cl, 64, 67); 209396c5ddc4Srjs values->wrap_mode_t = (enum mali_wrap_mode)__gen_unpack_uint(cl, 68, 71); 209496c5ddc4Srjs values->wrap_mode_r = (enum mali_wrap_mode)__gen_unpack_uint(cl, 72, 75); 209596c5ddc4Srjs values->compare_function = (enum mali_func)__gen_unpack_uint(cl, 76, 78); 209696c5ddc4Srjs values->seamless_cube_map = __gen_unpack_uint(cl, 79, 79); 209796c5ddc4Srjs values->border_color_r = __gen_unpack_uint(cl, 128, 159); 209896c5ddc4Srjs values->border_color_g = __gen_unpack_uint(cl, 160, 191); 209996c5ddc4Srjs values->border_color_b = __gen_unpack_uint(cl, 192, 223); 210096c5ddc4Srjs values->border_color_a = __gen_unpack_uint(cl, 224, 255); 210196c5ddc4Srjs} 210296c5ddc4Srjs 210396c5ddc4Srjsstatic inline void 210496c5ddc4SrjsMALI_SAMPLER_print(FILE *fp, const struct MALI_SAMPLER * values, unsigned indent) 210596c5ddc4Srjs{ 210696c5ddc4Srjs fprintf(fp, "%*sMagnify Nearest: %s\n", indent, "", values->magnify_nearest ? "true" : "false"); 210796c5ddc4Srjs fprintf(fp, "%*sMinify Nearest: %s\n", indent, "", values->minify_nearest ? "true" : "false"); 210896c5ddc4Srjs fprintf(fp, "%*sMipmap Mode: %s\n", indent, "", mali_mipmap_mode_as_str(values->mipmap_mode)); 210996c5ddc4Srjs fprintf(fp, "%*sNormalized Coordinates: %s\n", indent, "", values->normalized_coordinates ? "true" : "false"); 211096c5ddc4Srjs fprintf(fp, "%*sIsotropic LOD: %s\n", indent, "", values->isotropic_lod ? "true" : "false"); 211196c5ddc4Srjs fprintf(fp, "%*sLOD Bias: %d\n", indent, "", values->lod_bias); 211296c5ddc4Srjs fprintf(fp, "%*sMinimum LOD: %u\n", indent, "", values->minimum_lod); 211396c5ddc4Srjs fprintf(fp, "%*sMaximum LOD: %u\n", indent, "", values->maximum_lod); 211496c5ddc4Srjs fprintf(fp, "%*sWrap Mode S: %s\n", indent, "", mali_wrap_mode_as_str(values->wrap_mode_s)); 211596c5ddc4Srjs fprintf(fp, "%*sWrap Mode T: %s\n", indent, "", mali_wrap_mode_as_str(values->wrap_mode_t)); 211696c5ddc4Srjs fprintf(fp, "%*sWrap Mode R: %s\n", indent, "", mali_wrap_mode_as_str(values->wrap_mode_r)); 211796c5ddc4Srjs fprintf(fp, "%*sCompare Function: %s\n", indent, "", mali_func_as_str(values->compare_function)); 211896c5ddc4Srjs fprintf(fp, "%*sSeamless Cube Map: %s\n", indent, "", values->seamless_cube_map ? "true" : "false"); 211996c5ddc4Srjs fprintf(fp, "%*sBorder Color R: 0x%X (%f)\n", indent, "", values->border_color_r, uif(values->border_color_r)); 212096c5ddc4Srjs fprintf(fp, "%*sBorder Color G: 0x%X (%f)\n", indent, "", values->border_color_g, uif(values->border_color_g)); 212196c5ddc4Srjs fprintf(fp, "%*sBorder Color B: 0x%X (%f)\n", indent, "", values->border_color_b, uif(values->border_color_b)); 212296c5ddc4Srjs fprintf(fp, "%*sBorder Color A: 0x%X (%f)\n", indent, "", values->border_color_a, uif(values->border_color_a)); 212396c5ddc4Srjs} 212496c5ddc4Srjs 212596c5ddc4Srjsstruct MALI_TEXTURE { 212696c5ddc4Srjs uint32_t width; 212796c5ddc4Srjs uint32_t height; 212896c5ddc4Srjs uint32_t depth; 212996c5ddc4Srjs uint32_t sample_count; 213096c5ddc4Srjs uint32_t array_size; 213196c5ddc4Srjs uint32_t format; 213296c5ddc4Srjs enum mali_texture_dimension dimension; 213396c5ddc4Srjs enum mali_texture_layout texel_ordering; 213496c5ddc4Srjs bool surface_pointer_is_64b; 213596c5ddc4Srjs bool manual_stride; 213696c5ddc4Srjs uint32_t levels; 213796c5ddc4Srjs uint32_t swizzle; 213896c5ddc4Srjs}; 213996c5ddc4Srjs 214096c5ddc4Srjs#define MALI_TEXTURE_header \ 214196c5ddc4Srjs .depth = 1, \ 214296c5ddc4Srjs .sample_count = 1, \ 214396c5ddc4Srjs .surface_pointer_is_64b = true, \ 214496c5ddc4Srjs .manual_stride = false, \ 214596c5ddc4Srjs .levels = 1 214696c5ddc4Srjs 214796c5ddc4Srjsstatic inline void 214896c5ddc4SrjsMALI_TEXTURE_pack(uint32_t * restrict cl, 214996c5ddc4Srjs const struct MALI_TEXTURE * restrict values) 215096c5ddc4Srjs{ 215196c5ddc4Srjs assert(values->width >= 1); 215296c5ddc4Srjs assert(values->height >= 1); 215396c5ddc4Srjs assert(values->depth >= 1); 215496c5ddc4Srjs assert(values->sample_count >= 1); 215596c5ddc4Srjs assert(values->array_size >= 1); 215696c5ddc4Srjs assert(values->levels >= 1); 215796c5ddc4Srjs cl[ 0] = __gen_uint(values->width - 1, 0, 15) | 215896c5ddc4Srjs __gen_uint(values->height - 1, 16, 31); 215996c5ddc4Srjs cl[ 1] = __gen_uint(values->depth - 1, 0, 15) | 216096c5ddc4Srjs __gen_uint(values->sample_count - 1, 0, 15) | 216196c5ddc4Srjs __gen_uint(values->array_size - 1, 16, 31); 216296c5ddc4Srjs cl[ 2] = __gen_uint(values->format, 0, 21) | 216396c5ddc4Srjs __gen_uint(values->dimension, 22, 23) | 216496c5ddc4Srjs __gen_uint(values->texel_ordering, 24, 27) | 216596c5ddc4Srjs __gen_uint(values->surface_pointer_is_64b, 28, 28) | 216696c5ddc4Srjs __gen_uint(values->manual_stride, 29, 29); 216796c5ddc4Srjs cl[ 3] = __gen_uint(values->levels - 1, 24, 31); 216896c5ddc4Srjs cl[ 4] = __gen_uint(values->swizzle, 0, 11); 216996c5ddc4Srjs cl[ 5] = 0; 217096c5ddc4Srjs cl[ 6] = 0; 217196c5ddc4Srjs cl[ 7] = 0; 217296c5ddc4Srjs} 217396c5ddc4Srjs 217496c5ddc4Srjs 217596c5ddc4Srjs#define MALI_TEXTURE_LENGTH 32 217696c5ddc4Srjs#define MALI_TEXTURE_ALIGN 64 217796c5ddc4Srjsstruct mali_texture_packed { uint32_t opaque[8]; }; 217896c5ddc4Srjsstatic inline void 217996c5ddc4SrjsMALI_TEXTURE_unpack(const uint8_t * restrict cl, 218096c5ddc4Srjs struct MALI_TEXTURE * restrict values) 218196c5ddc4Srjs{ 218296c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xc0000000) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 2\n"); 218396c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffff) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 3\n"); 218496c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xfffff000) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 4\n"); 218596c5ddc4Srjs if (((const uint32_t *) cl)[5] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 5\n"); 218696c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 6\n"); 218796c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Texture unpacked at word 7\n"); 218896c5ddc4Srjs values->width = __gen_unpack_uint(cl, 0, 15) + 1; 218996c5ddc4Srjs values->height = __gen_unpack_uint(cl, 16, 31) + 1; 219096c5ddc4Srjs values->depth = __gen_unpack_uint(cl, 32, 47) + 1; 219196c5ddc4Srjs values->sample_count = __gen_unpack_uint(cl, 32, 47) + 1; 219296c5ddc4Srjs values->array_size = __gen_unpack_uint(cl, 48, 63) + 1; 219396c5ddc4Srjs values->format = __gen_unpack_uint(cl, 64, 85); 219496c5ddc4Srjs values->dimension = (enum mali_texture_dimension)__gen_unpack_uint(cl, 86, 87); 219596c5ddc4Srjs values->texel_ordering = (enum mali_texture_layout)__gen_unpack_uint(cl, 88, 91); 219696c5ddc4Srjs values->surface_pointer_is_64b = __gen_unpack_uint(cl, 92, 92); 219796c5ddc4Srjs values->manual_stride = __gen_unpack_uint(cl, 93, 93); 219896c5ddc4Srjs values->levels = __gen_unpack_uint(cl, 120, 127) + 1; 219996c5ddc4Srjs values->swizzle = __gen_unpack_uint(cl, 128, 139); 220096c5ddc4Srjs} 220196c5ddc4Srjs 220296c5ddc4Srjsstatic inline void 220396c5ddc4SrjsMALI_TEXTURE_print(FILE *fp, const struct MALI_TEXTURE * values, unsigned indent) 220496c5ddc4Srjs{ 220596c5ddc4Srjs fprintf(fp, "%*sWidth: %u\n", indent, "", values->width); 220696c5ddc4Srjs fprintf(fp, "%*sHeight: %u\n", indent, "", values->height); 220796c5ddc4Srjs fprintf(fp, "%*sDepth: %u\n", indent, "", values->depth); 220896c5ddc4Srjs fprintf(fp, "%*sSample count: %u\n", indent, "", values->sample_count); 220996c5ddc4Srjs fprintf(fp, "%*sArray size: %u\n", indent, "", values->array_size); 221096c5ddc4Srjs mali_pixel_format_print(fp, values->format); 221196c5ddc4Srjs fprintf(fp, "%*sDimension: %s\n", indent, "", mali_texture_dimension_as_str(values->dimension)); 221296c5ddc4Srjs fprintf(fp, "%*sTexel ordering: %s\n", indent, "", mali_texture_layout_as_str(values->texel_ordering)); 221396c5ddc4Srjs fprintf(fp, "%*sSurface pointer is 64b: %s\n", indent, "", values->surface_pointer_is_64b ? "true" : "false"); 221496c5ddc4Srjs fprintf(fp, "%*sManual stride: %s\n", indent, "", values->manual_stride ? "true" : "false"); 221596c5ddc4Srjs fprintf(fp, "%*sLevels: %u\n", indent, "", values->levels); 221696c5ddc4Srjs fprintf(fp, "%*sSwizzle: %u\n", indent, "", values->swizzle); 221796c5ddc4Srjs} 221896c5ddc4Srjs 221996c5ddc4Srjsenum mali_fp_mode { 222096c5ddc4Srjs MALI_FP_MODE_GL_INF_NAN_ALLOWED = 0, 222196c5ddc4Srjs MALI_FP_MODE_GL_INF_NAN_SUPPRESSED = 1, 222296c5ddc4Srjs MALI_FP_MODE_CL = 2, 222396c5ddc4Srjs MALI_FP_MODE_D3D11 = 3, 222496c5ddc4Srjs}; 222596c5ddc4Srjs 222696c5ddc4Srjsstatic inline const char * 222796c5ddc4Srjsmali_fp_mode_as_str(enum mali_fp_mode imm) 222896c5ddc4Srjs{ 222996c5ddc4Srjs switch (imm) { 223096c5ddc4Srjs case MALI_FP_MODE_GL_INF_NAN_ALLOWED: return "GL Inf/NaN Allowed"; 223196c5ddc4Srjs case MALI_FP_MODE_GL_INF_NAN_SUPPRESSED: return "GL Inf/NaN Suppressed"; 223296c5ddc4Srjs case MALI_FP_MODE_CL: return "CL"; 223396c5ddc4Srjs case MALI_FP_MODE_D3D11: return "D3D11"; 223496c5ddc4Srjs default: return "XXX: INVALID"; 223596c5ddc4Srjs } 223696c5ddc4Srjs} 223796c5ddc4Srjs 223896c5ddc4Srjsstruct MALI_RENDERER_PROPERTIES { 223996c5ddc4Srjs uint32_t uniform_buffer_count; 224096c5ddc4Srjs enum mali_depth_source depth_source; 224196c5ddc4Srjs bool shader_contains_barrier; 224296c5ddc4Srjs bool force_early_z; 224396c5ddc4Srjs bool shader_contains_discard; 224496c5ddc4Srjs bool shader_has_side_effects; 224596c5ddc4Srjs bool shader_reads_tilebuffer; 224696c5ddc4Srjs bool forward_pixel_kill; 224796c5ddc4Srjs uint32_t work_register_count; 224896c5ddc4Srjs uint32_t uniform_count; 224996c5ddc4Srjs bool stencil_from_shader; 225096c5ddc4Srjs enum mali_fp_mode fp_mode; 225196c5ddc4Srjs}; 225296c5ddc4Srjs 225396c5ddc4Srjs#define MALI_RENDERER_PROPERTIES_header \ 225496c5ddc4Srjs .depth_source = MALI_DEPTH_SOURCE_MINIMUM 225596c5ddc4Srjs 225696c5ddc4Srjsstatic inline void 225796c5ddc4SrjsMALI_RENDERER_PROPERTIES_pack(uint32_t * restrict cl, 225896c5ddc4Srjs const struct MALI_RENDERER_PROPERTIES * restrict values) 225996c5ddc4Srjs{ 226096c5ddc4Srjs cl[ 0] = __gen_uint(values->uniform_buffer_count, 0, 7) | 226196c5ddc4Srjs __gen_uint(values->depth_source, 8, 9) | 226296c5ddc4Srjs __gen_uint(values->shader_contains_barrier, 11, 11) | 226396c5ddc4Srjs __gen_uint(values->force_early_z, 10, 10) | 226496c5ddc4Srjs __gen_uint(values->shader_contains_discard, 12, 12) | 226596c5ddc4Srjs __gen_uint(values->shader_has_side_effects, 13, 13) | 226696c5ddc4Srjs __gen_uint(values->shader_reads_tilebuffer, 14, 14) | 226796c5ddc4Srjs __gen_uint(values->forward_pixel_kill, 15, 15) | 226896c5ddc4Srjs __gen_uint(values->work_register_count, 16, 20) | 226996c5ddc4Srjs __gen_uint(values->uniform_count, 21, 25) | 227096c5ddc4Srjs __gen_uint(values->stencil_from_shader, 28, 28) | 227196c5ddc4Srjs __gen_uint(values->fp_mode, 29, 31); 227296c5ddc4Srjs} 227396c5ddc4Srjs 227496c5ddc4Srjs 227596c5ddc4Srjs#define MALI_RENDERER_PROPERTIES_LENGTH 4 227696c5ddc4Srjsstruct mali_renderer_properties_packed { uint32_t opaque[1]; }; 227796c5ddc4Srjsstatic inline void 227896c5ddc4SrjsMALI_RENDERER_PROPERTIES_unpack(const uint8_t * restrict cl, 227996c5ddc4Srjs struct MALI_RENDERER_PROPERTIES * restrict values) 228096c5ddc4Srjs{ 228196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xc000000) fprintf(stderr, "XXX: Invalid field of Renderer Properties unpacked at word 0\n"); 228296c5ddc4Srjs values->uniform_buffer_count = __gen_unpack_uint(cl, 0, 7); 228396c5ddc4Srjs values->depth_source = (enum mali_depth_source)__gen_unpack_uint(cl, 8, 9); 228496c5ddc4Srjs values->shader_contains_barrier = __gen_unpack_uint(cl, 11, 11); 228596c5ddc4Srjs values->force_early_z = __gen_unpack_uint(cl, 10, 10); 228696c5ddc4Srjs values->shader_contains_discard = __gen_unpack_uint(cl, 12, 12); 228796c5ddc4Srjs values->shader_has_side_effects = __gen_unpack_uint(cl, 13, 13); 228896c5ddc4Srjs values->shader_reads_tilebuffer = __gen_unpack_uint(cl, 14, 14); 228996c5ddc4Srjs values->forward_pixel_kill = __gen_unpack_uint(cl, 15, 15); 229096c5ddc4Srjs values->work_register_count = __gen_unpack_uint(cl, 16, 20); 229196c5ddc4Srjs values->uniform_count = __gen_unpack_uint(cl, 21, 25); 229296c5ddc4Srjs values->stencil_from_shader = __gen_unpack_uint(cl, 28, 28); 229396c5ddc4Srjs values->fp_mode = (enum mali_fp_mode)__gen_unpack_uint(cl, 29, 31); 229496c5ddc4Srjs} 229596c5ddc4Srjs 229696c5ddc4Srjsstatic inline void 229796c5ddc4SrjsMALI_RENDERER_PROPERTIES_print(FILE *fp, const struct MALI_RENDERER_PROPERTIES * values, unsigned indent) 229896c5ddc4Srjs{ 229996c5ddc4Srjs fprintf(fp, "%*sUniform buffer count: %u\n", indent, "", values->uniform_buffer_count); 230096c5ddc4Srjs fprintf(fp, "%*sDepth source: %s\n", indent, "", mali_depth_source_as_str(values->depth_source)); 230196c5ddc4Srjs fprintf(fp, "%*sShader contains barrier: %s\n", indent, "", values->shader_contains_barrier ? "true" : "false"); 230296c5ddc4Srjs fprintf(fp, "%*sForce early-z: %s\n", indent, "", values->force_early_z ? "true" : "false"); 230396c5ddc4Srjs fprintf(fp, "%*sShader contains discard: %s\n", indent, "", values->shader_contains_discard ? "true" : "false"); 230496c5ddc4Srjs fprintf(fp, "%*sShader has side-effects: %s\n", indent, "", values->shader_has_side_effects ? "true" : "false"); 230596c5ddc4Srjs fprintf(fp, "%*sShader reads tilebuffer: %s\n", indent, "", values->shader_reads_tilebuffer ? "true" : "false"); 230696c5ddc4Srjs fprintf(fp, "%*sForward pixel kill: %s\n", indent, "", values->forward_pixel_kill ? "true" : "false"); 230796c5ddc4Srjs fprintf(fp, "%*sWork register count: %u\n", indent, "", values->work_register_count); 230896c5ddc4Srjs fprintf(fp, "%*sUniform count: %u\n", indent, "", values->uniform_count); 230996c5ddc4Srjs fprintf(fp, "%*sStencil from shader: %s\n", indent, "", values->stencil_from_shader ? "true" : "false"); 231096c5ddc4Srjs fprintf(fp, "%*sFP mode: %s\n", indent, "", mali_fp_mode_as_str(values->fp_mode)); 231196c5ddc4Srjs} 231296c5ddc4Srjs 231396c5ddc4Srjsstruct MALI_SHADER { 231496c5ddc4Srjs uint64_t shader; 231596c5ddc4Srjs uint32_t sampler_count; 231696c5ddc4Srjs uint32_t texture_count; 231796c5ddc4Srjs uint32_t attribute_count; 231896c5ddc4Srjs uint32_t varying_count; 231996c5ddc4Srjs}; 232096c5ddc4Srjs 232196c5ddc4Srjs#define MALI_SHADER_header \ 232296c5ddc4Srjs 0 232396c5ddc4Srjs 232496c5ddc4Srjsstatic inline void 232596c5ddc4SrjsMALI_SHADER_pack(uint32_t * restrict cl, 232696c5ddc4Srjs const struct MALI_SHADER * restrict values) 232796c5ddc4Srjs{ 232896c5ddc4Srjs cl[ 0] = __gen_uint(values->shader, 0, 63); 232996c5ddc4Srjs cl[ 1] = __gen_uint(values->shader, 0, 63) >> 32; 233096c5ddc4Srjs cl[ 2] = __gen_uint(values->sampler_count, 0, 15) | 233196c5ddc4Srjs __gen_uint(values->texture_count, 16, 31); 233296c5ddc4Srjs cl[ 3] = __gen_uint(values->attribute_count, 0, 15) | 233396c5ddc4Srjs __gen_uint(values->varying_count, 16, 31); 233496c5ddc4Srjs} 233596c5ddc4Srjs 233696c5ddc4Srjs 233796c5ddc4Srjs#define MALI_SHADER_LENGTH 16 233896c5ddc4Srjsstruct mali_shader_packed { uint32_t opaque[4]; }; 233996c5ddc4Srjsstatic inline void 234096c5ddc4SrjsMALI_SHADER_unpack(const uint8_t * restrict cl, 234196c5ddc4Srjs struct MALI_SHADER * restrict values) 234296c5ddc4Srjs{ 234396c5ddc4Srjs values->shader = __gen_unpack_uint(cl, 0, 63); 234496c5ddc4Srjs values->sampler_count = __gen_unpack_uint(cl, 64, 79); 234596c5ddc4Srjs values->texture_count = __gen_unpack_uint(cl, 80, 95); 234696c5ddc4Srjs values->attribute_count = __gen_unpack_uint(cl, 96, 111); 234796c5ddc4Srjs values->varying_count = __gen_unpack_uint(cl, 112, 127); 234896c5ddc4Srjs} 234996c5ddc4Srjs 235096c5ddc4Srjsstatic inline void 235196c5ddc4SrjsMALI_SHADER_print(FILE *fp, const struct MALI_SHADER * values, unsigned indent) 235296c5ddc4Srjs{ 235396c5ddc4Srjs fprintf(fp, "%*sShader: 0x%" PRIx64 "\n", indent, "", values->shader); 235496c5ddc4Srjs fprintf(fp, "%*sSampler count: %u\n", indent, "", values->sampler_count); 235596c5ddc4Srjs fprintf(fp, "%*sTexture count: %u\n", indent, "", values->texture_count); 235696c5ddc4Srjs fprintf(fp, "%*sAttribute count: %u\n", indent, "", values->attribute_count); 235796c5ddc4Srjs fprintf(fp, "%*sVarying count: %u\n", indent, "", values->varying_count); 235896c5ddc4Srjs} 235996c5ddc4Srjs 236096c5ddc4Srjsstruct MALI_MULTISAMPLE_MISC { 236196c5ddc4Srjs uint32_t sample_mask; 236296c5ddc4Srjs bool multisample_enable; 236396c5ddc4Srjs bool multisample_late_coverage; 236496c5ddc4Srjs bool evaluate_per_sample; 236596c5ddc4Srjs bool fixed_function_depth_range_fixed; 236696c5ddc4Srjs bool shader_depth_range_fixed; 236796c5ddc4Srjs enum mali_func depth_function; 236896c5ddc4Srjs bool depth_write_mask; 236996c5ddc4Srjs bool fixed_function_near_discard; 237096c5ddc4Srjs bool fixed_function_far_discard; 237196c5ddc4Srjs bool fragment_near_discard; 237296c5ddc4Srjs bool fragment_far_discard; 237396c5ddc4Srjs}; 237496c5ddc4Srjs 237596c5ddc4Srjs#define MALI_MULTISAMPLE_MISC_header \ 237696c5ddc4Srjs 0 237796c5ddc4Srjs 237896c5ddc4Srjsstatic inline void 237996c5ddc4SrjsMALI_MULTISAMPLE_MISC_pack(uint32_t * restrict cl, 238096c5ddc4Srjs const struct MALI_MULTISAMPLE_MISC * restrict values) 238196c5ddc4Srjs{ 238296c5ddc4Srjs cl[ 0] = __gen_uint(values->sample_mask, 0, 15) | 238396c5ddc4Srjs __gen_uint(values->multisample_enable, 16, 16) | 238496c5ddc4Srjs __gen_uint(values->multisample_late_coverage, 17, 17) | 238596c5ddc4Srjs __gen_uint(values->evaluate_per_sample, 18, 18) | 238696c5ddc4Srjs __gen_uint(values->fixed_function_depth_range_fixed, 19, 19) | 238796c5ddc4Srjs __gen_uint(values->shader_depth_range_fixed, 20, 20) | 238896c5ddc4Srjs __gen_uint(values->depth_function, 24, 26) | 238996c5ddc4Srjs __gen_uint(values->depth_write_mask, 27, 27) | 239096c5ddc4Srjs __gen_uint(values->fixed_function_near_discard, 28, 28) | 239196c5ddc4Srjs __gen_uint(values->fixed_function_far_discard, 29, 29) | 239296c5ddc4Srjs __gen_uint(values->fragment_near_discard, 30, 30) | 239396c5ddc4Srjs __gen_uint(values->fragment_far_discard, 31, 31); 239496c5ddc4Srjs} 239596c5ddc4Srjs 239696c5ddc4Srjs 239796c5ddc4Srjs#define MALI_MULTISAMPLE_MISC_LENGTH 4 239896c5ddc4Srjsstruct mali_multisample_misc_packed { uint32_t opaque[1]; }; 239996c5ddc4Srjsstatic inline void 240096c5ddc4SrjsMALI_MULTISAMPLE_MISC_unpack(const uint8_t * restrict cl, 240196c5ddc4Srjs struct MALI_MULTISAMPLE_MISC * restrict values) 240296c5ddc4Srjs{ 240396c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xe00000) fprintf(stderr, "XXX: Invalid field of Multisample, Misc unpacked at word 0\n"); 240496c5ddc4Srjs values->sample_mask = __gen_unpack_uint(cl, 0, 15); 240596c5ddc4Srjs values->multisample_enable = __gen_unpack_uint(cl, 16, 16); 240696c5ddc4Srjs values->multisample_late_coverage = __gen_unpack_uint(cl, 17, 17); 240796c5ddc4Srjs values->evaluate_per_sample = __gen_unpack_uint(cl, 18, 18); 240896c5ddc4Srjs values->fixed_function_depth_range_fixed = __gen_unpack_uint(cl, 19, 19); 240996c5ddc4Srjs values->shader_depth_range_fixed = __gen_unpack_uint(cl, 20, 20); 241096c5ddc4Srjs values->depth_function = (enum mali_func)__gen_unpack_uint(cl, 24, 26); 241196c5ddc4Srjs values->depth_write_mask = __gen_unpack_uint(cl, 27, 27); 241296c5ddc4Srjs values->fixed_function_near_discard = __gen_unpack_uint(cl, 28, 28); 241396c5ddc4Srjs values->fixed_function_far_discard = __gen_unpack_uint(cl, 29, 29); 241496c5ddc4Srjs values->fragment_near_discard = __gen_unpack_uint(cl, 30, 30); 241596c5ddc4Srjs values->fragment_far_discard = __gen_unpack_uint(cl, 31, 31); 241696c5ddc4Srjs} 241796c5ddc4Srjs 241896c5ddc4Srjsstatic inline void 241996c5ddc4SrjsMALI_MULTISAMPLE_MISC_print(FILE *fp, const struct MALI_MULTISAMPLE_MISC * values, unsigned indent) 242096c5ddc4Srjs{ 242196c5ddc4Srjs fprintf(fp, "%*sSample mask: %u\n", indent, "", values->sample_mask); 242296c5ddc4Srjs fprintf(fp, "%*sMultisample enable: %s\n", indent, "", values->multisample_enable ? "true" : "false"); 242396c5ddc4Srjs fprintf(fp, "%*sMultisample late coverage: %s\n", indent, "", values->multisample_late_coverage ? "true" : "false"); 242496c5ddc4Srjs fprintf(fp, "%*sEvaluate per-sample: %s\n", indent, "", values->evaluate_per_sample ? "true" : "false"); 242596c5ddc4Srjs fprintf(fp, "%*sFixed-function depth range fixed: %s\n", indent, "", values->fixed_function_depth_range_fixed ? "true" : "false"); 242696c5ddc4Srjs fprintf(fp, "%*sShader depth range fixed: %s\n", indent, "", values->shader_depth_range_fixed ? "true" : "false"); 242796c5ddc4Srjs fprintf(fp, "%*sDepth function: %s\n", indent, "", mali_func_as_str(values->depth_function)); 242896c5ddc4Srjs fprintf(fp, "%*sDepth write mask: %s\n", indent, "", values->depth_write_mask ? "true" : "false"); 242996c5ddc4Srjs fprintf(fp, "%*sFixed-function near discard: %s\n", indent, "", values->fixed_function_near_discard ? "true" : "false"); 243096c5ddc4Srjs fprintf(fp, "%*sFixed-function far discard: %s\n", indent, "", values->fixed_function_far_discard ? "true" : "false"); 243196c5ddc4Srjs fprintf(fp, "%*sFragment near discard: %s\n", indent, "", values->fragment_near_discard ? "true" : "false"); 243296c5ddc4Srjs fprintf(fp, "%*sFragment far discard: %s\n", indent, "", values->fragment_far_discard ? "true" : "false"); 243396c5ddc4Srjs} 243496c5ddc4Srjs 243596c5ddc4Srjsstruct MALI_STENCIL_MASK_MISC { 243696c5ddc4Srjs uint32_t stencil_mask_front; 243796c5ddc4Srjs uint32_t stencil_mask_back; 243896c5ddc4Srjs bool stencil_enable; 243996c5ddc4Srjs bool alpha_to_coverage; 244096c5ddc4Srjs bool alpha_to_coverage_invert; 244196c5ddc4Srjs enum mali_func alpha_test_compare_function; 244296c5ddc4Srjs bool force_seamless_cubemaps; 244396c5ddc4Srjs bool depth_range_1; 244496c5ddc4Srjs bool depth_range_2; 244596c5ddc4Srjs bool single_sampled_lines; 244696c5ddc4Srjs bool point_snap; 244796c5ddc4Srjs}; 244896c5ddc4Srjs 244996c5ddc4Srjs#define MALI_STENCIL_MASK_MISC_header \ 245096c5ddc4Srjs 0 245196c5ddc4Srjs 245296c5ddc4Srjsstatic inline void 245396c5ddc4SrjsMALI_STENCIL_MASK_MISC_pack(uint32_t * restrict cl, 245496c5ddc4Srjs const struct MALI_STENCIL_MASK_MISC * restrict values) 245596c5ddc4Srjs{ 245696c5ddc4Srjs cl[ 0] = __gen_uint(values->stencil_mask_front, 0, 7) | 245796c5ddc4Srjs __gen_uint(values->stencil_mask_back, 8, 15) | 245896c5ddc4Srjs __gen_uint(values->stencil_enable, 16, 16) | 245996c5ddc4Srjs __gen_uint(values->alpha_to_coverage, 17, 17) | 246096c5ddc4Srjs __gen_uint(values->alpha_to_coverage_invert, 18, 18) | 246196c5ddc4Srjs __gen_uint(values->alpha_test_compare_function, 21, 23) | 246296c5ddc4Srjs __gen_uint(values->force_seamless_cubemaps, 26, 26) | 246396c5ddc4Srjs __gen_uint(values->depth_range_1, 28, 28) | 246496c5ddc4Srjs __gen_uint(values->depth_range_2, 29, 29) | 246596c5ddc4Srjs __gen_uint(values->single_sampled_lines, 30, 30) | 246696c5ddc4Srjs __gen_uint(values->point_snap, 31, 31); 246796c5ddc4Srjs} 246896c5ddc4Srjs 246996c5ddc4Srjs 247096c5ddc4Srjs#define MALI_STENCIL_MASK_MISC_LENGTH 4 247196c5ddc4Srjsstruct mali_stencil_mask_misc_packed { uint32_t opaque[1]; }; 247296c5ddc4Srjsstatic inline void 247396c5ddc4SrjsMALI_STENCIL_MASK_MISC_unpack(const uint8_t * restrict cl, 247496c5ddc4Srjs struct MALI_STENCIL_MASK_MISC * restrict values) 247596c5ddc4Srjs{ 247696c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xb180000) fprintf(stderr, "XXX: Invalid field of Stencil Mask, Misc unpacked at word 0\n"); 247796c5ddc4Srjs values->stencil_mask_front = __gen_unpack_uint(cl, 0, 7); 247896c5ddc4Srjs values->stencil_mask_back = __gen_unpack_uint(cl, 8, 15); 247996c5ddc4Srjs values->stencil_enable = __gen_unpack_uint(cl, 16, 16); 248096c5ddc4Srjs values->alpha_to_coverage = __gen_unpack_uint(cl, 17, 17); 248196c5ddc4Srjs values->alpha_to_coverage_invert = __gen_unpack_uint(cl, 18, 18); 248296c5ddc4Srjs values->alpha_test_compare_function = (enum mali_func)__gen_unpack_uint(cl, 21, 23); 248396c5ddc4Srjs values->force_seamless_cubemaps = __gen_unpack_uint(cl, 26, 26); 248496c5ddc4Srjs values->depth_range_1 = __gen_unpack_uint(cl, 28, 28); 248596c5ddc4Srjs values->depth_range_2 = __gen_unpack_uint(cl, 29, 29); 248696c5ddc4Srjs values->single_sampled_lines = __gen_unpack_uint(cl, 30, 30); 248796c5ddc4Srjs values->point_snap = __gen_unpack_uint(cl, 31, 31); 248896c5ddc4Srjs} 248996c5ddc4Srjs 249096c5ddc4Srjsstatic inline void 249196c5ddc4SrjsMALI_STENCIL_MASK_MISC_print(FILE *fp, const struct MALI_STENCIL_MASK_MISC * values, unsigned indent) 249296c5ddc4Srjs{ 249396c5ddc4Srjs fprintf(fp, "%*sStencil mask front: %u\n", indent, "", values->stencil_mask_front); 249496c5ddc4Srjs fprintf(fp, "%*sStencil mask back: %u\n", indent, "", values->stencil_mask_back); 249596c5ddc4Srjs fprintf(fp, "%*sStencil enable: %s\n", indent, "", values->stencil_enable ? "true" : "false"); 249696c5ddc4Srjs fprintf(fp, "%*sAlpha-to-coverage: %s\n", indent, "", values->alpha_to_coverage ? "true" : "false"); 249796c5ddc4Srjs fprintf(fp, "%*sAlpha-to-coverage Invert: %s\n", indent, "", values->alpha_to_coverage_invert ? "true" : "false"); 249896c5ddc4Srjs fprintf(fp, "%*sAlpha test compare function: %s\n", indent, "", mali_func_as_str(values->alpha_test_compare_function)); 249996c5ddc4Srjs fprintf(fp, "%*sForce seamless cubemaps: %s\n", indent, "", values->force_seamless_cubemaps ? "true" : "false"); 250096c5ddc4Srjs fprintf(fp, "%*sDepth Range 1: %s\n", indent, "", values->depth_range_1 ? "true" : "false"); 250196c5ddc4Srjs fprintf(fp, "%*sDepth Range 2: %s\n", indent, "", values->depth_range_2 ? "true" : "false"); 250296c5ddc4Srjs fprintf(fp, "%*sSingle-sampled lines: %s\n", indent, "", values->single_sampled_lines ? "true" : "false"); 250396c5ddc4Srjs fprintf(fp, "%*sPoint snap: %s\n", indent, "", values->point_snap ? "true" : "false"); 250496c5ddc4Srjs} 250596c5ddc4Srjs 250696c5ddc4Srjsstruct MALI_STENCIL { 250796c5ddc4Srjs uint32_t reference_value; 250896c5ddc4Srjs uint32_t mask; 250996c5ddc4Srjs enum mali_func compare_function; 251096c5ddc4Srjs enum mali_stencil_op stencil_fail; 251196c5ddc4Srjs enum mali_stencil_op depth_fail; 251296c5ddc4Srjs enum mali_stencil_op depth_pass; 251396c5ddc4Srjs}; 251496c5ddc4Srjs 251596c5ddc4Srjs#define MALI_STENCIL_header \ 251696c5ddc4Srjs 0 251796c5ddc4Srjs 251896c5ddc4Srjsstatic inline void 251996c5ddc4SrjsMALI_STENCIL_pack(uint32_t * restrict cl, 252096c5ddc4Srjs const struct MALI_STENCIL * restrict values) 252196c5ddc4Srjs{ 252296c5ddc4Srjs cl[ 0] = __gen_uint(values->reference_value, 0, 7) | 252396c5ddc4Srjs __gen_uint(values->mask, 8, 15) | 252496c5ddc4Srjs __gen_uint(values->compare_function, 16, 18) | 252596c5ddc4Srjs __gen_uint(values->stencil_fail, 19, 21) | 252696c5ddc4Srjs __gen_uint(values->depth_fail, 22, 24) | 252796c5ddc4Srjs __gen_uint(values->depth_pass, 25, 27); 252896c5ddc4Srjs} 252996c5ddc4Srjs 253096c5ddc4Srjs 253196c5ddc4Srjs#define MALI_STENCIL_LENGTH 4 253296c5ddc4Srjsstruct mali_stencil_packed { uint32_t opaque[1]; }; 253396c5ddc4Srjsstatic inline void 253496c5ddc4SrjsMALI_STENCIL_unpack(const uint8_t * restrict cl, 253596c5ddc4Srjs struct MALI_STENCIL * restrict values) 253696c5ddc4Srjs{ 253796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf0000000) fprintf(stderr, "XXX: Invalid field of Stencil unpacked at word 0\n"); 253896c5ddc4Srjs values->reference_value = __gen_unpack_uint(cl, 0, 7); 253996c5ddc4Srjs values->mask = __gen_unpack_uint(cl, 8, 15); 254096c5ddc4Srjs values->compare_function = (enum mali_func)__gen_unpack_uint(cl, 16, 18); 254196c5ddc4Srjs values->stencil_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 19, 21); 254296c5ddc4Srjs values->depth_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 22, 24); 254396c5ddc4Srjs values->depth_pass = (enum mali_stencil_op)__gen_unpack_uint(cl, 25, 27); 254496c5ddc4Srjs} 254596c5ddc4Srjs 254696c5ddc4Srjsstatic inline void 254796c5ddc4SrjsMALI_STENCIL_print(FILE *fp, const struct MALI_STENCIL * values, unsigned indent) 254896c5ddc4Srjs{ 254996c5ddc4Srjs fprintf(fp, "%*sReference Value: %u\n", indent, "", values->reference_value); 255096c5ddc4Srjs fprintf(fp, "%*sMask: %u\n", indent, "", values->mask); 255196c5ddc4Srjs fprintf(fp, "%*sCompare Function: %s\n", indent, "", mali_func_as_str(values->compare_function)); 255296c5ddc4Srjs fprintf(fp, "%*sStencil Fail: %s\n", indent, "", mali_stencil_op_as_str(values->stencil_fail)); 255396c5ddc4Srjs fprintf(fp, "%*sDepth Fail: %s\n", indent, "", mali_stencil_op_as_str(values->depth_fail)); 255496c5ddc4Srjs fprintf(fp, "%*sDepth Pass: %s\n", indent, "", mali_stencil_op_as_str(values->depth_pass)); 255596c5ddc4Srjs} 255696c5ddc4Srjs 255796c5ddc4Srjsstruct MALI_RENDERER_STATE { 255896c5ddc4Srjs struct MALI_SHADER shader; 255996c5ddc4Srjs struct MALI_RENDERER_PROPERTIES properties; 256096c5ddc4Srjs float depth_units; 256196c5ddc4Srjs float depth_factor; 256296c5ddc4Srjs float depth_bias_clamp; 256396c5ddc4Srjs struct MALI_MULTISAMPLE_MISC multisample_misc; 256496c5ddc4Srjs struct MALI_STENCIL_MASK_MISC stencil_mask_misc; 256596c5ddc4Srjs struct MALI_STENCIL stencil_front; 256696c5ddc4Srjs struct MALI_STENCIL stencil_back; 256796c5ddc4Srjs float alpha_reference; 256896c5ddc4Srjs uint32_t thread_balancing; 256996c5ddc4Srjs uint64_t legacy_blend_shader; 257096c5ddc4Srjs}; 257196c5ddc4Srjs 257296c5ddc4Srjs#define MALI_RENDERER_STATE_header \ 257396c5ddc4Srjs .shader = { MALI_SHADER_header }, \ 257496c5ddc4Srjs .properties = { MALI_RENDERER_PROPERTIES_header }, \ 257596c5ddc4Srjs .multisample_misc = { MALI_MULTISAMPLE_MISC_header }, \ 257696c5ddc4Srjs .stencil_mask_misc = { MALI_STENCIL_MASK_MISC_header }, \ 257796c5ddc4Srjs .stencil_front = { MALI_STENCIL_header }, \ 257896c5ddc4Srjs .stencil_back = { MALI_STENCIL_header } 257996c5ddc4Srjs 258096c5ddc4Srjsstatic inline void 258196c5ddc4SrjsMALI_RENDERER_STATE_pack(uint32_t * restrict cl, 258296c5ddc4Srjs const struct MALI_RENDERER_STATE * restrict values) 258396c5ddc4Srjs{ 258496c5ddc4Srjs cl[ 0] = __gen_uint(values->shader.shader, 0, 63); 258596c5ddc4Srjs cl[ 1] = __gen_uint(values->shader.shader, 0, 63) >> 32; 258696c5ddc4Srjs cl[ 2] = __gen_uint(values->shader.sampler_count, 0, 15) | 258796c5ddc4Srjs __gen_uint(values->shader.texture_count, 16, 31); 258896c5ddc4Srjs cl[ 3] = __gen_uint(values->shader.attribute_count, 0, 15) | 258996c5ddc4Srjs __gen_uint(values->shader.varying_count, 16, 31); 259096c5ddc4Srjs cl[ 4] = __gen_uint(values->properties.uniform_buffer_count, 0, 7) | 259196c5ddc4Srjs __gen_uint(values->properties.depth_source, 8, 9) | 259296c5ddc4Srjs __gen_uint(values->properties.shader_contains_barrier, 11, 11) | 259396c5ddc4Srjs __gen_uint(values->properties.force_early_z, 10, 10) | 259496c5ddc4Srjs __gen_uint(values->properties.shader_contains_discard, 12, 12) | 259596c5ddc4Srjs __gen_uint(values->properties.shader_has_side_effects, 13, 13) | 259696c5ddc4Srjs __gen_uint(values->properties.shader_reads_tilebuffer, 14, 14) | 259796c5ddc4Srjs __gen_uint(values->properties.forward_pixel_kill, 15, 15) | 259896c5ddc4Srjs __gen_uint(values->properties.work_register_count, 16, 20) | 259996c5ddc4Srjs __gen_uint(values->properties.uniform_count, 21, 25) | 260096c5ddc4Srjs __gen_uint(values->properties.stencil_from_shader, 28, 28) | 260196c5ddc4Srjs __gen_uint(values->properties.fp_mode, 29, 31); 260296c5ddc4Srjs cl[ 5] = __gen_uint(fui(values->depth_units), 0, 32); 260396c5ddc4Srjs cl[ 6] = __gen_uint(fui(values->depth_factor), 0, 32); 260496c5ddc4Srjs cl[ 7] = __gen_uint(fui(values->depth_bias_clamp), 0, 32); 260596c5ddc4Srjs cl[ 8] = __gen_uint(values->multisample_misc.sample_mask, 0, 15) | 260696c5ddc4Srjs __gen_uint(values->multisample_misc.multisample_enable, 16, 16) | 260796c5ddc4Srjs __gen_uint(values->multisample_misc.multisample_late_coverage, 17, 17) | 260896c5ddc4Srjs __gen_uint(values->multisample_misc.evaluate_per_sample, 18, 18) | 260996c5ddc4Srjs __gen_uint(values->multisample_misc.fixed_function_depth_range_fixed, 19, 19) | 261096c5ddc4Srjs __gen_uint(values->multisample_misc.shader_depth_range_fixed, 20, 20) | 261196c5ddc4Srjs __gen_uint(values->multisample_misc.depth_function, 24, 26) | 261296c5ddc4Srjs __gen_uint(values->multisample_misc.depth_write_mask, 27, 27) | 261396c5ddc4Srjs __gen_uint(values->multisample_misc.fixed_function_near_discard, 28, 28) | 261496c5ddc4Srjs __gen_uint(values->multisample_misc.fixed_function_far_discard, 29, 29) | 261596c5ddc4Srjs __gen_uint(values->multisample_misc.fragment_near_discard, 30, 30) | 261696c5ddc4Srjs __gen_uint(values->multisample_misc.fragment_far_discard, 31, 31); 261796c5ddc4Srjs cl[ 9] = __gen_uint(values->stencil_mask_misc.stencil_mask_front, 0, 7) | 261896c5ddc4Srjs __gen_uint(values->stencil_mask_misc.stencil_mask_back, 8, 15) | 261996c5ddc4Srjs __gen_uint(values->stencil_mask_misc.stencil_enable, 16, 16) | 262096c5ddc4Srjs __gen_uint(values->stencil_mask_misc.alpha_to_coverage, 17, 17) | 262196c5ddc4Srjs __gen_uint(values->stencil_mask_misc.alpha_to_coverage_invert, 18, 18) | 262296c5ddc4Srjs __gen_uint(values->stencil_mask_misc.alpha_test_compare_function, 21, 23) | 262396c5ddc4Srjs __gen_uint(values->stencil_mask_misc.force_seamless_cubemaps, 26, 26) | 262496c5ddc4Srjs __gen_uint(values->stencil_mask_misc.depth_range_1, 28, 28) | 262596c5ddc4Srjs __gen_uint(values->stencil_mask_misc.depth_range_2, 29, 29) | 262696c5ddc4Srjs __gen_uint(values->stencil_mask_misc.single_sampled_lines, 30, 30) | 262796c5ddc4Srjs __gen_uint(values->stencil_mask_misc.point_snap, 31, 31); 262896c5ddc4Srjs cl[10] = __gen_uint(values->stencil_front.reference_value, 0, 7) | 262996c5ddc4Srjs __gen_uint(values->stencil_front.mask, 8, 15) | 263096c5ddc4Srjs __gen_uint(values->stencil_front.compare_function, 16, 18) | 263196c5ddc4Srjs __gen_uint(values->stencil_front.stencil_fail, 19, 21) | 263296c5ddc4Srjs __gen_uint(values->stencil_front.depth_fail, 22, 24) | 263396c5ddc4Srjs __gen_uint(values->stencil_front.depth_pass, 25, 27); 263496c5ddc4Srjs cl[11] = __gen_uint(values->stencil_back.reference_value, 0, 7) | 263596c5ddc4Srjs __gen_uint(values->stencil_back.mask, 8, 15) | 263696c5ddc4Srjs __gen_uint(values->stencil_back.compare_function, 16, 18) | 263796c5ddc4Srjs __gen_uint(values->stencil_back.stencil_fail, 19, 21) | 263896c5ddc4Srjs __gen_uint(values->stencil_back.depth_fail, 22, 24) | 263996c5ddc4Srjs __gen_uint(values->stencil_back.depth_pass, 25, 27); 264096c5ddc4Srjs cl[12] = __gen_uint(fui(values->alpha_reference), 0, 32); 264196c5ddc4Srjs cl[13] = __gen_uint(values->thread_balancing, 0, 15); 264296c5ddc4Srjs cl[14] = __gen_uint(values->legacy_blend_shader, 0, 63); 264396c5ddc4Srjs cl[15] = __gen_uint(values->legacy_blend_shader, 0, 63) >> 32; 264496c5ddc4Srjs} 264596c5ddc4Srjs 264696c5ddc4Srjs 264796c5ddc4Srjs#define MALI_RENDERER_STATE_LENGTH 64 264896c5ddc4Srjs#define MALI_RENDERER_STATE_ALIGN 64 264996c5ddc4Srjsstruct mali_renderer_state_packed { uint32_t opaque[16]; }; 265096c5ddc4Srjsstatic inline void 265196c5ddc4SrjsMALI_RENDERER_STATE_unpack(const uint8_t * restrict cl, 265296c5ddc4Srjs struct MALI_RENDERER_STATE * restrict values) 265396c5ddc4Srjs{ 265496c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xc000000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 4\n"); 265596c5ddc4Srjs if (((const uint32_t *) cl)[8] & 0xe00000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 8\n"); 265696c5ddc4Srjs if (((const uint32_t *) cl)[9] & 0xb180000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 9\n"); 265796c5ddc4Srjs if (((const uint32_t *) cl)[10] & 0xf0000000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 10\n"); 265896c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0xf0000000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 11\n"); 265996c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffff0000) fprintf(stderr, "XXX: Invalid field of Renderer State unpacked at word 13\n"); 266096c5ddc4Srjs values->shader.shader = __gen_unpack_uint(cl, 0, 63); 266196c5ddc4Srjs values->shader.sampler_count = __gen_unpack_uint(cl, 64, 79); 266296c5ddc4Srjs values->shader.texture_count = __gen_unpack_uint(cl, 80, 95); 266396c5ddc4Srjs values->shader.attribute_count = __gen_unpack_uint(cl, 96, 111); 266496c5ddc4Srjs values->shader.varying_count = __gen_unpack_uint(cl, 112, 127); 266596c5ddc4Srjs values->properties.uniform_buffer_count = __gen_unpack_uint(cl, 128, 135); 266696c5ddc4Srjs values->properties.depth_source = (enum mali_depth_source)__gen_unpack_uint(cl, 136, 137); 266796c5ddc4Srjs values->properties.shader_contains_barrier = __gen_unpack_uint(cl, 139, 139); 266896c5ddc4Srjs values->properties.force_early_z = __gen_unpack_uint(cl, 138, 138); 266996c5ddc4Srjs values->properties.shader_contains_discard = __gen_unpack_uint(cl, 140, 140); 267096c5ddc4Srjs values->properties.shader_has_side_effects = __gen_unpack_uint(cl, 141, 141); 267196c5ddc4Srjs values->properties.shader_reads_tilebuffer = __gen_unpack_uint(cl, 142, 142); 267296c5ddc4Srjs values->properties.forward_pixel_kill = __gen_unpack_uint(cl, 143, 143); 267396c5ddc4Srjs values->properties.work_register_count = __gen_unpack_uint(cl, 144, 148); 267496c5ddc4Srjs values->properties.uniform_count = __gen_unpack_uint(cl, 149, 153); 267596c5ddc4Srjs values->properties.stencil_from_shader = __gen_unpack_uint(cl, 156, 156); 267696c5ddc4Srjs values->properties.fp_mode = (enum mali_fp_mode)__gen_unpack_uint(cl, 157, 159); 267796c5ddc4Srjs values->depth_units = __gen_unpack_float(cl, 160, 191); 267896c5ddc4Srjs values->depth_factor = __gen_unpack_float(cl, 192, 223); 267996c5ddc4Srjs values->depth_bias_clamp = __gen_unpack_float(cl, 224, 255); 268096c5ddc4Srjs values->multisample_misc.sample_mask = __gen_unpack_uint(cl, 256, 271); 268196c5ddc4Srjs values->multisample_misc.multisample_enable = __gen_unpack_uint(cl, 272, 272); 268296c5ddc4Srjs values->multisample_misc.multisample_late_coverage = __gen_unpack_uint(cl, 273, 273); 268396c5ddc4Srjs values->multisample_misc.evaluate_per_sample = __gen_unpack_uint(cl, 274, 274); 268496c5ddc4Srjs values->multisample_misc.fixed_function_depth_range_fixed = __gen_unpack_uint(cl, 275, 275); 268596c5ddc4Srjs values->multisample_misc.shader_depth_range_fixed = __gen_unpack_uint(cl, 276, 276); 268696c5ddc4Srjs values->multisample_misc.depth_function = (enum mali_func)__gen_unpack_uint(cl, 280, 282); 268796c5ddc4Srjs values->multisample_misc.depth_write_mask = __gen_unpack_uint(cl, 283, 283); 268896c5ddc4Srjs values->multisample_misc.fixed_function_near_discard = __gen_unpack_uint(cl, 284, 284); 268996c5ddc4Srjs values->multisample_misc.fixed_function_far_discard = __gen_unpack_uint(cl, 285, 285); 269096c5ddc4Srjs values->multisample_misc.fragment_near_discard = __gen_unpack_uint(cl, 286, 286); 269196c5ddc4Srjs values->multisample_misc.fragment_far_discard = __gen_unpack_uint(cl, 287, 287); 269296c5ddc4Srjs values->stencil_mask_misc.stencil_mask_front = __gen_unpack_uint(cl, 288, 295); 269396c5ddc4Srjs values->stencil_mask_misc.stencil_mask_back = __gen_unpack_uint(cl, 296, 303); 269496c5ddc4Srjs values->stencil_mask_misc.stencil_enable = __gen_unpack_uint(cl, 304, 304); 269596c5ddc4Srjs values->stencil_mask_misc.alpha_to_coverage = __gen_unpack_uint(cl, 305, 305); 269696c5ddc4Srjs values->stencil_mask_misc.alpha_to_coverage_invert = __gen_unpack_uint(cl, 306, 306); 269796c5ddc4Srjs values->stencil_mask_misc.alpha_test_compare_function = (enum mali_func)__gen_unpack_uint(cl, 309, 311); 269896c5ddc4Srjs values->stencil_mask_misc.force_seamless_cubemaps = __gen_unpack_uint(cl, 314, 314); 269996c5ddc4Srjs values->stencil_mask_misc.depth_range_1 = __gen_unpack_uint(cl, 316, 316); 270096c5ddc4Srjs values->stencil_mask_misc.depth_range_2 = __gen_unpack_uint(cl, 317, 317); 270196c5ddc4Srjs values->stencil_mask_misc.single_sampled_lines = __gen_unpack_uint(cl, 318, 318); 270296c5ddc4Srjs values->stencil_mask_misc.point_snap = __gen_unpack_uint(cl, 319, 319); 270396c5ddc4Srjs values->stencil_front.reference_value = __gen_unpack_uint(cl, 320, 327); 270496c5ddc4Srjs values->stencil_front.mask = __gen_unpack_uint(cl, 328, 335); 270596c5ddc4Srjs values->stencil_front.compare_function = (enum mali_func)__gen_unpack_uint(cl, 336, 338); 270696c5ddc4Srjs values->stencil_front.stencil_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 339, 341); 270796c5ddc4Srjs values->stencil_front.depth_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 342, 344); 270896c5ddc4Srjs values->stencil_front.depth_pass = (enum mali_stencil_op)__gen_unpack_uint(cl, 345, 347); 270996c5ddc4Srjs values->stencil_back.reference_value = __gen_unpack_uint(cl, 352, 359); 271096c5ddc4Srjs values->stencil_back.mask = __gen_unpack_uint(cl, 360, 367); 271196c5ddc4Srjs values->stencil_back.compare_function = (enum mali_func)__gen_unpack_uint(cl, 368, 370); 271296c5ddc4Srjs values->stencil_back.stencil_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 371, 373); 271396c5ddc4Srjs values->stencil_back.depth_fail = (enum mali_stencil_op)__gen_unpack_uint(cl, 374, 376); 271496c5ddc4Srjs values->stencil_back.depth_pass = (enum mali_stencil_op)__gen_unpack_uint(cl, 377, 379); 271596c5ddc4Srjs values->alpha_reference = __gen_unpack_float(cl, 384, 415); 271696c5ddc4Srjs values->thread_balancing = __gen_unpack_uint(cl, 416, 431); 271796c5ddc4Srjs values->legacy_blend_shader = __gen_unpack_uint(cl, 448, 511); 271896c5ddc4Srjs} 271996c5ddc4Srjs 272096c5ddc4Srjsstatic inline void 272196c5ddc4SrjsMALI_RENDERER_STATE_print(FILE *fp, const struct MALI_RENDERER_STATE * values, unsigned indent) 272296c5ddc4Srjs{ 272396c5ddc4Srjs fprintf(fp, "%*sShader:\n", indent, ""); 272496c5ddc4Srjs MALI_SHADER_print(fp, &values->shader, indent + 2); 272596c5ddc4Srjs fprintf(fp, "%*sProperties:\n", indent, ""); 272696c5ddc4Srjs MALI_RENDERER_PROPERTIES_print(fp, &values->properties, indent + 2); 272796c5ddc4Srjs fprintf(fp, "%*sDepth units: %f\n", indent, "", values->depth_units); 272896c5ddc4Srjs fprintf(fp, "%*sDepth factor: %f\n", indent, "", values->depth_factor); 272996c5ddc4Srjs fprintf(fp, "%*sDepth bias clamp: %f\n", indent, "", values->depth_bias_clamp); 273096c5ddc4Srjs fprintf(fp, "%*sMultisample, Misc:\n", indent, ""); 273196c5ddc4Srjs MALI_MULTISAMPLE_MISC_print(fp, &values->multisample_misc, indent + 2); 273296c5ddc4Srjs fprintf(fp, "%*sStencil Mask, Misc:\n", indent, ""); 273396c5ddc4Srjs MALI_STENCIL_MASK_MISC_print(fp, &values->stencil_mask_misc, indent + 2); 273496c5ddc4Srjs fprintf(fp, "%*sStencil front:\n", indent, ""); 273596c5ddc4Srjs MALI_STENCIL_print(fp, &values->stencil_front, indent + 2); 273696c5ddc4Srjs fprintf(fp, "%*sStencil back:\n", indent, ""); 273796c5ddc4Srjs MALI_STENCIL_print(fp, &values->stencil_back, indent + 2); 273896c5ddc4Srjs fprintf(fp, "%*sAlpha reference: %f\n", indent, "", values->alpha_reference); 273996c5ddc4Srjs fprintf(fp, "%*sThread Balancing: %u\n", indent, "", values->thread_balancing); 274096c5ddc4Srjs fprintf(fp, "%*sLegacy Blend Shader: 0x%" PRIx64 "\n", indent, "", values->legacy_blend_shader); 274196c5ddc4Srjs} 274296c5ddc4Srjs 274396c5ddc4Srjsstruct MALI_UNIFORM_BUFFER { 274496c5ddc4Srjs uint32_t entries; 274596c5ddc4Srjs uint64_t pointer; 274696c5ddc4Srjs}; 274796c5ddc4Srjs 274896c5ddc4Srjs#define MALI_UNIFORM_BUFFER_header \ 274996c5ddc4Srjs 0 275096c5ddc4Srjs 275196c5ddc4Srjsstatic inline void 275296c5ddc4SrjsMALI_UNIFORM_BUFFER_pack(uint32_t * restrict cl, 275396c5ddc4Srjs const struct MALI_UNIFORM_BUFFER * restrict values) 275496c5ddc4Srjs{ 275596c5ddc4Srjs assert(values->entries >= 1); 275696c5ddc4Srjs assert((values->pointer & 0xf) == 0); 275796c5ddc4Srjs cl[ 0] = __gen_uint(values->entries - 1, 0, 11) | 275896c5ddc4Srjs __gen_uint(values->pointer >> 4, 12, 63); 275996c5ddc4Srjs cl[ 1] = __gen_uint(values->pointer >> 4, 12, 63) >> 32; 276096c5ddc4Srjs} 276196c5ddc4Srjs 276296c5ddc4Srjs 276396c5ddc4Srjs#define MALI_UNIFORM_BUFFER_LENGTH 8 276496c5ddc4Srjs#define MALI_UNIFORM_BUFFER_ALIGN 8 276596c5ddc4Srjsstruct mali_uniform_buffer_packed { uint32_t opaque[2]; }; 276696c5ddc4Srjsstatic inline void 276796c5ddc4SrjsMALI_UNIFORM_BUFFER_unpack(const uint8_t * restrict cl, 276896c5ddc4Srjs struct MALI_UNIFORM_BUFFER * restrict values) 276996c5ddc4Srjs{ 277096c5ddc4Srjs values->entries = __gen_unpack_uint(cl, 0, 11) + 1; 277196c5ddc4Srjs values->pointer = __gen_unpack_uint(cl, 12, 63) << 4; 277296c5ddc4Srjs} 277396c5ddc4Srjs 277496c5ddc4Srjsstatic inline void 277596c5ddc4SrjsMALI_UNIFORM_BUFFER_print(FILE *fp, const struct MALI_UNIFORM_BUFFER * values, unsigned indent) 277696c5ddc4Srjs{ 277796c5ddc4Srjs fprintf(fp, "%*sEntries: %u\n", indent, "", values->entries); 277896c5ddc4Srjs fprintf(fp, "%*sPointer: 0x%" PRIx64 "\n", indent, "", values->pointer); 277996c5ddc4Srjs} 278096c5ddc4Srjs 278196c5ddc4Srjsstruct MALI_VIEWPORT { 278296c5ddc4Srjs float minimum_x; 278396c5ddc4Srjs float minimum_y; 278496c5ddc4Srjs float maximum_x; 278596c5ddc4Srjs float maximum_y; 278696c5ddc4Srjs float minimum_z; 278796c5ddc4Srjs float maximum_z; 278896c5ddc4Srjs uint32_t scissor_minimum_x; 278996c5ddc4Srjs uint32_t scissor_minimum_y; 279096c5ddc4Srjs uint32_t scissor_maximum_x; 279196c5ddc4Srjs uint32_t scissor_maximum_y; 279296c5ddc4Srjs}; 279396c5ddc4Srjs 279496c5ddc4Srjs#define MALI_VIEWPORT_header \ 279596c5ddc4Srjs .minimum_x = -INFINITY, \ 279696c5ddc4Srjs .minimum_y = -INFINITY, \ 279796c5ddc4Srjs .maximum_x = +INFINITY, \ 279896c5ddc4Srjs .maximum_y = +INFINITY, \ 279996c5ddc4Srjs .minimum_z = 0.0, \ 280096c5ddc4Srjs .maximum_z = 1.0, \ 280196c5ddc4Srjs .scissor_minimum_x = 0, \ 280296c5ddc4Srjs .scissor_minimum_y = 0 280396c5ddc4Srjs 280496c5ddc4Srjsstatic inline void 280596c5ddc4SrjsMALI_VIEWPORT_pack(uint32_t * restrict cl, 280696c5ddc4Srjs const struct MALI_VIEWPORT * restrict values) 280796c5ddc4Srjs{ 280896c5ddc4Srjs cl[ 0] = __gen_uint(fui(values->minimum_x), 0, 32); 280996c5ddc4Srjs cl[ 1] = __gen_uint(fui(values->minimum_y), 0, 32); 281096c5ddc4Srjs cl[ 2] = __gen_uint(fui(values->maximum_x), 0, 32); 281196c5ddc4Srjs cl[ 3] = __gen_uint(fui(values->maximum_y), 0, 32); 281296c5ddc4Srjs cl[ 4] = __gen_uint(fui(values->minimum_z), 0, 32); 281396c5ddc4Srjs cl[ 5] = __gen_uint(fui(values->maximum_z), 0, 32); 281496c5ddc4Srjs cl[ 6] = __gen_uint(values->scissor_minimum_x, 0, 15) | 281596c5ddc4Srjs __gen_uint(values->scissor_minimum_y, 16, 31); 281696c5ddc4Srjs cl[ 7] = __gen_uint(values->scissor_maximum_x, 0, 15) | 281796c5ddc4Srjs __gen_uint(values->scissor_maximum_y, 16, 31); 281896c5ddc4Srjs} 281996c5ddc4Srjs 282096c5ddc4Srjs 282196c5ddc4Srjs#define MALI_VIEWPORT_LENGTH 32 282296c5ddc4Srjs#define MALI_VIEWPORT_ALIGN 32 282396c5ddc4Srjsstruct mali_viewport_packed { uint32_t opaque[8]; }; 282496c5ddc4Srjsstatic inline void 282596c5ddc4SrjsMALI_VIEWPORT_unpack(const uint8_t * restrict cl, 282696c5ddc4Srjs struct MALI_VIEWPORT * restrict values) 282796c5ddc4Srjs{ 282896c5ddc4Srjs values->minimum_x = __gen_unpack_float(cl, 0, 31); 282996c5ddc4Srjs values->minimum_y = __gen_unpack_float(cl, 32, 63); 283096c5ddc4Srjs values->maximum_x = __gen_unpack_float(cl, 64, 95); 283196c5ddc4Srjs values->maximum_y = __gen_unpack_float(cl, 96, 127); 283296c5ddc4Srjs values->minimum_z = __gen_unpack_float(cl, 128, 159); 283396c5ddc4Srjs values->maximum_z = __gen_unpack_float(cl, 160, 191); 283496c5ddc4Srjs values->scissor_minimum_x = __gen_unpack_uint(cl, 192, 207); 283596c5ddc4Srjs values->scissor_minimum_y = __gen_unpack_uint(cl, 208, 223); 283696c5ddc4Srjs values->scissor_maximum_x = __gen_unpack_uint(cl, 224, 239); 283796c5ddc4Srjs values->scissor_maximum_y = __gen_unpack_uint(cl, 240, 255); 283896c5ddc4Srjs} 283996c5ddc4Srjs 284096c5ddc4Srjsstatic inline void 284196c5ddc4SrjsMALI_VIEWPORT_print(FILE *fp, const struct MALI_VIEWPORT * values, unsigned indent) 284296c5ddc4Srjs{ 284396c5ddc4Srjs fprintf(fp, "%*sMinimum X: %f\n", indent, "", values->minimum_x); 284496c5ddc4Srjs fprintf(fp, "%*sMinimum Y: %f\n", indent, "", values->minimum_y); 284596c5ddc4Srjs fprintf(fp, "%*sMaximum X: %f\n", indent, "", values->maximum_x); 284696c5ddc4Srjs fprintf(fp, "%*sMaximum Y: %f\n", indent, "", values->maximum_y); 284796c5ddc4Srjs fprintf(fp, "%*sMinimum Z: %f\n", indent, "", values->minimum_z); 284896c5ddc4Srjs fprintf(fp, "%*sMaximum Z: %f\n", indent, "", values->maximum_z); 284996c5ddc4Srjs fprintf(fp, "%*sScissor Minimum X: %u\n", indent, "", values->scissor_minimum_x); 285096c5ddc4Srjs fprintf(fp, "%*sScissor Minimum Y: %u\n", indent, "", values->scissor_minimum_y); 285196c5ddc4Srjs fprintf(fp, "%*sScissor Maximum X: %u\n", indent, "", values->scissor_maximum_x); 285296c5ddc4Srjs fprintf(fp, "%*sScissor Maximum Y: %u\n", indent, "", values->scissor_maximum_y); 285396c5ddc4Srjs} 285496c5ddc4Srjs 285596c5ddc4Srjsstruct MALI_LOCAL_STORAGE { 285696c5ddc4Srjs uint32_t tls_size; 285796c5ddc4Srjs uint32_t tls_initial_stack_pointer_offset; 285896c5ddc4Srjs uint32_t wls_instances; 285996c5ddc4Srjs#define MALI_LOCAL_STORAGE_NO_WORKGROUP_MEM 2147483648 286096c5ddc4Srjs uint32_t wls_size_base; 286196c5ddc4Srjs uint32_t wls_size_scale; 286296c5ddc4Srjs uint64_t tls_base_pointer; 286396c5ddc4Srjs uint64_t wls_base_pointer; 286496c5ddc4Srjs}; 286596c5ddc4Srjs 286696c5ddc4Srjs#define MALI_LOCAL_STORAGE_header \ 286796c5ddc4Srjs .wls_instances = MALI_LOCAL_STORAGE_NO_WORKGROUP_MEM 286896c5ddc4Srjs 286996c5ddc4Srjsstatic inline void 287096c5ddc4SrjsMALI_LOCAL_STORAGE_pack(uint32_t * restrict cl, 287196c5ddc4Srjs const struct MALI_LOCAL_STORAGE * restrict values) 287296c5ddc4Srjs{ 287396c5ddc4Srjs assert(util_is_power_of_two_nonzero(values->wls_instances)); 287496c5ddc4Srjs cl[ 0] = __gen_uint(values->tls_size, 0, 4) | 287596c5ddc4Srjs __gen_uint(values->tls_initial_stack_pointer_offset, 5, 31); 287696c5ddc4Srjs cl[ 1] = __gen_uint(util_logbase2(values->wls_instances), 0, 4) | 287796c5ddc4Srjs __gen_uint(values->wls_size_base, 5, 6) | 287896c5ddc4Srjs __gen_uint(values->wls_size_scale, 8, 12); 287996c5ddc4Srjs cl[ 2] = __gen_uint(values->tls_base_pointer, 0, 63); 288096c5ddc4Srjs cl[ 3] = __gen_uint(values->tls_base_pointer, 0, 63) >> 32; 288196c5ddc4Srjs cl[ 4] = __gen_uint(values->wls_base_pointer, 0, 63); 288296c5ddc4Srjs cl[ 5] = __gen_uint(values->wls_base_pointer, 0, 63) >> 32; 288396c5ddc4Srjs cl[ 6] = 0; 288496c5ddc4Srjs cl[ 7] = 0; 288596c5ddc4Srjs} 288696c5ddc4Srjs 288796c5ddc4Srjs 288896c5ddc4Srjs#define MALI_LOCAL_STORAGE_LENGTH 32 288996c5ddc4Srjs#define MALI_LOCAL_STORAGE_ALIGN 64 289096c5ddc4Srjsstruct mali_local_storage_packed { uint32_t opaque[8]; }; 289196c5ddc4Srjsstatic inline void 289296c5ddc4SrjsMALI_LOCAL_STORAGE_unpack(const uint8_t * restrict cl, 289396c5ddc4Srjs struct MALI_LOCAL_STORAGE * restrict values) 289496c5ddc4Srjs{ 289596c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffe080) fprintf(stderr, "XXX: Invalid field of Local Storage unpacked at word 1\n"); 289696c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Local Storage unpacked at word 6\n"); 289796c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Local Storage unpacked at word 7\n"); 289896c5ddc4Srjs values->tls_size = __gen_unpack_uint(cl, 0, 4); 289996c5ddc4Srjs values->tls_initial_stack_pointer_offset = __gen_unpack_uint(cl, 5, 31); 290096c5ddc4Srjs values->wls_instances = 1U << __gen_unpack_uint(cl, 32, 36); 290196c5ddc4Srjs values->wls_size_base = __gen_unpack_uint(cl, 37, 38); 290296c5ddc4Srjs values->wls_size_scale = __gen_unpack_uint(cl, 40, 44); 290396c5ddc4Srjs values->tls_base_pointer = __gen_unpack_uint(cl, 64, 127); 290496c5ddc4Srjs values->wls_base_pointer = __gen_unpack_uint(cl, 128, 191); 290596c5ddc4Srjs} 290696c5ddc4Srjs 290796c5ddc4Srjsstatic inline void 290896c5ddc4SrjsMALI_LOCAL_STORAGE_print(FILE *fp, const struct MALI_LOCAL_STORAGE * values, unsigned indent) 290996c5ddc4Srjs{ 291096c5ddc4Srjs fprintf(fp, "%*sTLS Size: %u\n", indent, "", values->tls_size); 291196c5ddc4Srjs fprintf(fp, "%*sTLS Initial Stack Pointer Offset: %u\n", indent, "", values->tls_initial_stack_pointer_offset); 291296c5ddc4Srjs fprintf(fp, "%*sWLS Instances: %u\n", indent, "", values->wls_instances); 291396c5ddc4Srjs fprintf(fp, "%*sWLS Size Base: %u\n", indent, "", values->wls_size_base); 291496c5ddc4Srjs fprintf(fp, "%*sWLS Size Scale: %u\n", indent, "", values->wls_size_scale); 291596c5ddc4Srjs fprintf(fp, "%*sTLS Base Pointer: 0x%" PRIx64 "\n", indent, "", values->tls_base_pointer); 291696c5ddc4Srjs fprintf(fp, "%*sWLS Base Pointer: 0x%" PRIx64 "\n", indent, "", values->wls_base_pointer); 291796c5ddc4Srjs} 291896c5ddc4Srjs 291996c5ddc4Srjsstruct MALI_TILER_CONTEXT { 292096c5ddc4Srjs uint32_t polygon_list_size; 292196c5ddc4Srjs#define MALI_MIDGARD_TILER_MINIMUM_HEADER_SIZE 512 292296c5ddc4Srjs uint32_t hierarchy_mask; 292396c5ddc4Srjs#define MALI_MIDGARD_TILER_DISABLED 4096 292496c5ddc4Srjs#define MALI_MIDGARD_TILER_USER 4095 292596c5ddc4Srjs#define MALI_MIDGARD_TILER_HIERARCHY_MASK 511 292696c5ddc4Srjs uint64_t polygon_list; 292796c5ddc4Srjs uint64_t polygon_list_body; 292896c5ddc4Srjs uint64_t heap_start; 292996c5ddc4Srjs uint64_t heap_end; 293096c5ddc4Srjs}; 293196c5ddc4Srjs 293296c5ddc4Srjs#define MALI_TILER_CONTEXT_header \ 293396c5ddc4Srjs 0 293496c5ddc4Srjs 293596c5ddc4Srjsstatic inline void 293696c5ddc4SrjsMALI_TILER_CONTEXT_pack(uint32_t * restrict cl, 293796c5ddc4Srjs const struct MALI_TILER_CONTEXT * restrict values) 293896c5ddc4Srjs{ 293996c5ddc4Srjs cl[ 0] = __gen_uint(values->polygon_list_size, 0, 31); 294096c5ddc4Srjs cl[ 1] = __gen_uint(values->hierarchy_mask, 0, 15); 294196c5ddc4Srjs cl[ 2] = __gen_uint(values->polygon_list, 0, 63); 294296c5ddc4Srjs cl[ 3] = __gen_uint(values->polygon_list, 0, 63) >> 32; 294396c5ddc4Srjs cl[ 4] = __gen_uint(values->polygon_list_body, 0, 63); 294496c5ddc4Srjs cl[ 5] = __gen_uint(values->polygon_list_body, 0, 63) >> 32; 294596c5ddc4Srjs cl[ 6] = __gen_uint(values->heap_start, 0, 63); 294696c5ddc4Srjs cl[ 7] = __gen_uint(values->heap_start, 0, 63) >> 32; 294796c5ddc4Srjs cl[ 8] = __gen_uint(values->heap_end, 0, 63); 294896c5ddc4Srjs cl[ 9] = __gen_uint(values->heap_end, 0, 63) >> 32; 294996c5ddc4Srjs} 295096c5ddc4Srjs 295196c5ddc4Srjs 295296c5ddc4Srjs#define MALI_TILER_CONTEXT_LENGTH 40 295396c5ddc4Srjsstruct mali_tiler_context_packed { uint32_t opaque[10]; }; 295496c5ddc4Srjsstatic inline void 295596c5ddc4SrjsMALI_TILER_CONTEXT_unpack(const uint8_t * restrict cl, 295696c5ddc4Srjs struct MALI_TILER_CONTEXT * restrict values) 295796c5ddc4Srjs{ 295896c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffff0000) fprintf(stderr, "XXX: Invalid field of Tiler Context unpacked at word 1\n"); 295996c5ddc4Srjs values->polygon_list_size = __gen_unpack_uint(cl, 0, 31); 296096c5ddc4Srjs values->hierarchy_mask = __gen_unpack_uint(cl, 32, 47); 296196c5ddc4Srjs values->polygon_list = __gen_unpack_uint(cl, 64, 127); 296296c5ddc4Srjs values->polygon_list_body = __gen_unpack_uint(cl, 128, 191); 296396c5ddc4Srjs values->heap_start = __gen_unpack_uint(cl, 192, 255); 296496c5ddc4Srjs values->heap_end = __gen_unpack_uint(cl, 256, 319); 296596c5ddc4Srjs} 296696c5ddc4Srjs 296796c5ddc4Srjsstatic inline void 296896c5ddc4SrjsMALI_TILER_CONTEXT_print(FILE *fp, const struct MALI_TILER_CONTEXT * values, unsigned indent) 296996c5ddc4Srjs{ 297096c5ddc4Srjs fprintf(fp, "%*sPolygon List Size: %u\n", indent, "", values->polygon_list_size); 297196c5ddc4Srjs fprintf(fp, "%*sHierarchy Mask: %u\n", indent, "", values->hierarchy_mask); 297296c5ddc4Srjs fprintf(fp, "%*sPolygon List: 0x%" PRIx64 "\n", indent, "", values->polygon_list); 297396c5ddc4Srjs fprintf(fp, "%*sPolygon List Body: 0x%" PRIx64 "\n", indent, "", values->polygon_list_body); 297496c5ddc4Srjs fprintf(fp, "%*sHeap Start: 0x%" PRIx64 "\n", indent, "", values->heap_start); 297596c5ddc4Srjs fprintf(fp, "%*sHeap End: 0x%" PRIx64 "\n", indent, "", values->heap_end); 297696c5ddc4Srjs} 297796c5ddc4Srjs 297896c5ddc4Srjsstruct MALI_TILER_WEIGHTS { 297996c5ddc4Srjs uint32_t weight0; 298096c5ddc4Srjs uint32_t weight1; 298196c5ddc4Srjs uint32_t weight2; 298296c5ddc4Srjs uint32_t weight3; 298396c5ddc4Srjs uint32_t weight4; 298496c5ddc4Srjs uint32_t weight5; 298596c5ddc4Srjs uint32_t weight6; 298696c5ddc4Srjs uint32_t weight7; 298796c5ddc4Srjs}; 298896c5ddc4Srjs 298996c5ddc4Srjs#define MALI_TILER_WEIGHTS_header \ 299096c5ddc4Srjs 0 299196c5ddc4Srjs 299296c5ddc4Srjsstatic inline void 299396c5ddc4SrjsMALI_TILER_WEIGHTS_pack(uint32_t * restrict cl, 299496c5ddc4Srjs const struct MALI_TILER_WEIGHTS * restrict values) 299596c5ddc4Srjs{ 299696c5ddc4Srjs cl[ 0] = __gen_uint(values->weight0, 0, 31); 299796c5ddc4Srjs cl[ 1] = __gen_uint(values->weight1, 0, 31); 299896c5ddc4Srjs cl[ 2] = __gen_uint(values->weight2, 0, 31); 299996c5ddc4Srjs cl[ 3] = __gen_uint(values->weight3, 0, 31); 300096c5ddc4Srjs cl[ 4] = __gen_uint(values->weight4, 0, 31); 300196c5ddc4Srjs cl[ 5] = __gen_uint(values->weight5, 0, 31); 300296c5ddc4Srjs cl[ 6] = __gen_uint(values->weight6, 0, 31); 300396c5ddc4Srjs cl[ 7] = __gen_uint(values->weight7, 0, 31); 300496c5ddc4Srjs} 300596c5ddc4Srjs 300696c5ddc4Srjs 300796c5ddc4Srjs#define MALI_TILER_WEIGHTS_LENGTH 32 300896c5ddc4Srjsstruct mali_tiler_weights_packed { uint32_t opaque[8]; }; 300996c5ddc4Srjsstatic inline void 301096c5ddc4SrjsMALI_TILER_WEIGHTS_unpack(const uint8_t * restrict cl, 301196c5ddc4Srjs struct MALI_TILER_WEIGHTS * restrict values) 301296c5ddc4Srjs{ 301396c5ddc4Srjs values->weight0 = __gen_unpack_uint(cl, 0, 31); 301496c5ddc4Srjs values->weight1 = __gen_unpack_uint(cl, 32, 63); 301596c5ddc4Srjs values->weight2 = __gen_unpack_uint(cl, 64, 95); 301696c5ddc4Srjs values->weight3 = __gen_unpack_uint(cl, 96, 127); 301796c5ddc4Srjs values->weight4 = __gen_unpack_uint(cl, 128, 159); 301896c5ddc4Srjs values->weight5 = __gen_unpack_uint(cl, 160, 191); 301996c5ddc4Srjs values->weight6 = __gen_unpack_uint(cl, 192, 223); 302096c5ddc4Srjs values->weight7 = __gen_unpack_uint(cl, 224, 255); 302196c5ddc4Srjs} 302296c5ddc4Srjs 302396c5ddc4Srjsstatic inline void 302496c5ddc4SrjsMALI_TILER_WEIGHTS_print(FILE *fp, const struct MALI_TILER_WEIGHTS * values, unsigned indent) 302596c5ddc4Srjs{ 302696c5ddc4Srjs fprintf(fp, "%*sWeight0: %u\n", indent, "", values->weight0); 302796c5ddc4Srjs fprintf(fp, "%*sWeight1: %u\n", indent, "", values->weight1); 302896c5ddc4Srjs fprintf(fp, "%*sWeight2: %u\n", indent, "", values->weight2); 302996c5ddc4Srjs fprintf(fp, "%*sWeight3: %u\n", indent, "", values->weight3); 303096c5ddc4Srjs fprintf(fp, "%*sWeight4: %u\n", indent, "", values->weight4); 303196c5ddc4Srjs fprintf(fp, "%*sWeight5: %u\n", indent, "", values->weight5); 303296c5ddc4Srjs fprintf(fp, "%*sWeight6: %u\n", indent, "", values->weight6); 303396c5ddc4Srjs fprintf(fp, "%*sWeight7: %u\n", indent, "", values->weight7); 303496c5ddc4Srjs} 303596c5ddc4Srjs 303696c5ddc4Srjsenum mali_color_buffer_internal_format { 303796c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW_VALUE = 0, 303896c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8 = 1, 303996c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2 = 2, 304096c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2 = 3, 304196c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R4G4B4A4 = 4, 304296c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G6B5A0 = 5, 304396c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G5B5A1 = 6, 304496c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW8 = 32, 304596c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW16 = 33, 304696c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW32 = 34, 304796c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW64 = 35, 304896c5ddc4Srjs MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW128 = 36, 304996c5ddc4Srjs}; 305096c5ddc4Srjs 305196c5ddc4Srjsstatic inline const char * 305296c5ddc4Srjsmali_color_buffer_internal_format_as_str(enum mali_color_buffer_internal_format imm) 305396c5ddc4Srjs{ 305496c5ddc4Srjs switch (imm) { 305596c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW_VALUE: return "Raw Value"; 305696c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8: return "R8G8B8A8"; 305796c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2: return "R10G10B10A2"; 305896c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2: return "R8G8B8A2"; 305996c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R4G4B4A4: return "R4G4B4A4"; 306096c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G6B5A0: return "R5G6B5A0"; 306196c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G5B5A1: return "R5G5B5A1"; 306296c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW8: return "RAW8"; 306396c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW16: return "RAW16"; 306496c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW32: return "RAW32"; 306596c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW64: return "RAW64"; 306696c5ddc4Srjs case MALI_COLOR_BUFFER_INTERNAL_FORMAT_RAW128: return "RAW128"; 306796c5ddc4Srjs default: return "XXX: INVALID"; 306896c5ddc4Srjs } 306996c5ddc4Srjs} 307096c5ddc4Srjs 307196c5ddc4Srjsenum mali_color_format { 307296c5ddc4Srjs MALI_COLOR_FORMAT_RAW8 = 0, 307396c5ddc4Srjs MALI_COLOR_FORMAT_RAW16 = 1, 307496c5ddc4Srjs MALI_COLOR_FORMAT_RAW24 = 2, 307596c5ddc4Srjs MALI_COLOR_FORMAT_RAW32 = 3, 307696c5ddc4Srjs MALI_COLOR_FORMAT_RAW48 = 4, 307796c5ddc4Srjs MALI_COLOR_FORMAT_RAW64 = 5, 307896c5ddc4Srjs MALI_COLOR_FORMAT_RAW96 = 6, 307996c5ddc4Srjs MALI_COLOR_FORMAT_RAW128 = 7, 308096c5ddc4Srjs MALI_COLOR_FORMAT_RAW192 = 8, 308196c5ddc4Srjs MALI_COLOR_FORMAT_RAW256 = 9, 308296c5ddc4Srjs MALI_COLOR_FORMAT_RAW384 = 10, 308396c5ddc4Srjs MALI_COLOR_FORMAT_RAW512 = 11, 308496c5ddc4Srjs MALI_COLOR_FORMAT_RAW768 = 12, 308596c5ddc4Srjs MALI_COLOR_FORMAT_RAW1024 = 13, 308696c5ddc4Srjs MALI_COLOR_FORMAT_RAW1536 = 14, 308796c5ddc4Srjs MALI_COLOR_FORMAT_RAW2048 = 15, 308896c5ddc4Srjs MALI_COLOR_FORMAT_R8 = 16, 308996c5ddc4Srjs MALI_COLOR_FORMAT_R8G8 = 17, 309096c5ddc4Srjs MALI_COLOR_FORMAT_R8G8B8 = 18, 309196c5ddc4Srjs MALI_COLOR_FORMAT_R8G8B8A8 = 19, 309296c5ddc4Srjs MALI_COLOR_FORMAT_R4G4B4A4 = 20, 309396c5ddc4Srjs MALI_COLOR_FORMAT_R5G6B5 = 21, 309496c5ddc4Srjs MALI_COLOR_FORMAT_R8G8B8_FROM_R8G8B8A2 = 22, 309596c5ddc4Srjs MALI_COLOR_FORMAT_R10G10B10A2 = 24, 309696c5ddc4Srjs MALI_COLOR_FORMAT_A2B10G10R10 = 25, 309796c5ddc4Srjs MALI_COLOR_FORMAT_R5G5B5A1 = 28, 309896c5ddc4Srjs MALI_COLOR_FORMAT_A1B5G5R5 = 29, 309996c5ddc4Srjs MALI_COLOR_FORMAT_NATIVE = 31, 310096c5ddc4Srjs}; 310196c5ddc4Srjs 310296c5ddc4Srjsstatic inline const char * 310396c5ddc4Srjsmali_color_format_as_str(enum mali_color_format imm) 310496c5ddc4Srjs{ 310596c5ddc4Srjs switch (imm) { 310696c5ddc4Srjs case MALI_COLOR_FORMAT_RAW8: return "RAW8"; 310796c5ddc4Srjs case MALI_COLOR_FORMAT_RAW16: return "RAW16"; 310896c5ddc4Srjs case MALI_COLOR_FORMAT_RAW24: return "RAW24"; 310996c5ddc4Srjs case MALI_COLOR_FORMAT_RAW32: return "RAW32"; 311096c5ddc4Srjs case MALI_COLOR_FORMAT_RAW48: return "RAW48"; 311196c5ddc4Srjs case MALI_COLOR_FORMAT_RAW64: return "RAW64"; 311296c5ddc4Srjs case MALI_COLOR_FORMAT_RAW96: return "RAW96"; 311396c5ddc4Srjs case MALI_COLOR_FORMAT_RAW128: return "RAW128"; 311496c5ddc4Srjs case MALI_COLOR_FORMAT_RAW192: return "RAW192"; 311596c5ddc4Srjs case MALI_COLOR_FORMAT_RAW256: return "RAW256"; 311696c5ddc4Srjs case MALI_COLOR_FORMAT_RAW384: return "RAW384"; 311796c5ddc4Srjs case MALI_COLOR_FORMAT_RAW512: return "RAW512"; 311896c5ddc4Srjs case MALI_COLOR_FORMAT_RAW768: return "RAW768"; 311996c5ddc4Srjs case MALI_COLOR_FORMAT_RAW1024: return "RAW1024"; 312096c5ddc4Srjs case MALI_COLOR_FORMAT_RAW1536: return "RAW1536"; 312196c5ddc4Srjs case MALI_COLOR_FORMAT_RAW2048: return "RAW2048"; 312296c5ddc4Srjs case MALI_COLOR_FORMAT_R8: return "R8"; 312396c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8: return "R8G8"; 312496c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8B8: return "R8G8B8"; 312596c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8B8A8: return "R8G8B8A8"; 312696c5ddc4Srjs case MALI_COLOR_FORMAT_R4G4B4A4: return "R4G4B4A4"; 312796c5ddc4Srjs case MALI_COLOR_FORMAT_R5G6B5: return "R5G6B5"; 312896c5ddc4Srjs case MALI_COLOR_FORMAT_R8G8B8_FROM_R8G8B8A2: return "R8G8B8_FROM_R8G8B8A2"; 312996c5ddc4Srjs case MALI_COLOR_FORMAT_R10G10B10A2: return "R10G10B10A2"; 313096c5ddc4Srjs case MALI_COLOR_FORMAT_A2B10G10R10: return "A2B10G10R10"; 313196c5ddc4Srjs case MALI_COLOR_FORMAT_R5G5B5A1: return "R5G5B5A1"; 313296c5ddc4Srjs case MALI_COLOR_FORMAT_A1B5G5R5: return "A1B5G5R5"; 313396c5ddc4Srjs case MALI_COLOR_FORMAT_NATIVE: return "NATIVE"; 313496c5ddc4Srjs default: return "XXX: INVALID"; 313596c5ddc4Srjs } 313696c5ddc4Srjs} 313796c5ddc4Srjs 313896c5ddc4Srjsenum mali_downsampling_accumulation_mode { 313996c5ddc4Srjs MALI_DOWNSAMPLING_ACCUMULATION_MODE_UNSIGNED_NORMALIZED_INTEGER = 0, 314096c5ddc4Srjs MALI_DOWNSAMPLING_ACCUMULATION_MODE_SIGNED_NORMALIZED_INTEGER = 1, 314196c5ddc4Srjs}; 314296c5ddc4Srjs 314396c5ddc4Srjsstatic inline const char * 314496c5ddc4Srjsmali_downsampling_accumulation_mode_as_str(enum mali_downsampling_accumulation_mode imm) 314596c5ddc4Srjs{ 314696c5ddc4Srjs switch (imm) { 314796c5ddc4Srjs case MALI_DOWNSAMPLING_ACCUMULATION_MODE_UNSIGNED_NORMALIZED_INTEGER: return "Unsigned normalized integer"; 314896c5ddc4Srjs case MALI_DOWNSAMPLING_ACCUMULATION_MODE_SIGNED_NORMALIZED_INTEGER: return "Signed normalized integer"; 314996c5ddc4Srjs default: return "XXX: INVALID"; 315096c5ddc4Srjs } 315196c5ddc4Srjs} 315296c5ddc4Srjs 315396c5ddc4Srjsenum mali_sample_layout { 315496c5ddc4Srjs MALI_SAMPLE_LAYOUT_ORDERED_4X_GRID = 0, 315596c5ddc4Srjs MALI_SAMPLE_LAYOUT_ROTATED_4X_GRID = 1, 315696c5ddc4Srjs MALI_SAMPLE_LAYOUT_D3D_8X_GRID = 2, 315796c5ddc4Srjs MALI_SAMPLE_LAYOUT_D3D_16X_GRID = 3, 315896c5ddc4Srjs}; 315996c5ddc4Srjs 316096c5ddc4Srjsstatic inline const char * 316196c5ddc4Srjsmali_sample_layout_as_str(enum mali_sample_layout imm) 316296c5ddc4Srjs{ 316396c5ddc4Srjs switch (imm) { 316496c5ddc4Srjs case MALI_SAMPLE_LAYOUT_ORDERED_4X_GRID: return "Ordered 4x Grid"; 316596c5ddc4Srjs case MALI_SAMPLE_LAYOUT_ROTATED_4X_GRID: return "Rotated 4x Grid"; 316696c5ddc4Srjs case MALI_SAMPLE_LAYOUT_D3D_8X_GRID: return "D3D 8x Grid"; 316796c5ddc4Srjs case MALI_SAMPLE_LAYOUT_D3D_16X_GRID: return "D3D 16x Grid"; 316896c5ddc4Srjs default: return "XXX: INVALID"; 316996c5ddc4Srjs } 317096c5ddc4Srjs} 317196c5ddc4Srjs 317296c5ddc4Srjsenum mali_zs_format { 317396c5ddc4Srjs MALI_ZS_FORMAT_D16 = 1, 317496c5ddc4Srjs MALI_ZS_FORMAT_D24 = 2, 317596c5ddc4Srjs MALI_ZS_FORMAT_D24X8 = 4, 317696c5ddc4Srjs MALI_ZS_FORMAT_D24S8 = 5, 317796c5ddc4Srjs MALI_ZS_FORMAT_X8D24 = 6, 317896c5ddc4Srjs MALI_ZS_FORMAT_S8D24 = 7, 317996c5ddc4Srjs MALI_ZS_FORMAT_D32 = 14, 318096c5ddc4Srjs MALI_ZS_FORMAT_D32_S8X24 = 15, 318196c5ddc4Srjs}; 318296c5ddc4Srjs 318396c5ddc4Srjsstatic inline const char * 318496c5ddc4Srjsmali_zs_format_as_str(enum mali_zs_format imm) 318596c5ddc4Srjs{ 318696c5ddc4Srjs switch (imm) { 318796c5ddc4Srjs case MALI_ZS_FORMAT_D16: return "D16"; 318896c5ddc4Srjs case MALI_ZS_FORMAT_D24: return "D24"; 318996c5ddc4Srjs case MALI_ZS_FORMAT_D24X8: return "D24X8"; 319096c5ddc4Srjs case MALI_ZS_FORMAT_D24S8: return "D24S8"; 319196c5ddc4Srjs case MALI_ZS_FORMAT_X8D24: return "X8D24"; 319296c5ddc4Srjs case MALI_ZS_FORMAT_S8D24: return "S8D24"; 319396c5ddc4Srjs case MALI_ZS_FORMAT_D32: return "D32"; 319496c5ddc4Srjs case MALI_ZS_FORMAT_D32_S8X24: return "D32_S8X24"; 319596c5ddc4Srjs default: return "XXX: INVALID"; 319696c5ddc4Srjs } 319796c5ddc4Srjs} 319896c5ddc4Srjs 319996c5ddc4Srjsenum mali_zs_preload_format { 320096c5ddc4Srjs MALI_ZS_PRELOAD_FORMAT_D32_S8X24 = 4, 320196c5ddc4Srjs}; 320296c5ddc4Srjs 320396c5ddc4Srjsstatic inline const char * 320496c5ddc4Srjsmali_zs_preload_format_as_str(enum mali_zs_preload_format imm) 320596c5ddc4Srjs{ 320696c5ddc4Srjs switch (imm) { 320796c5ddc4Srjs case MALI_ZS_PRELOAD_FORMAT_D32_S8X24: return "D32_S8X24"; 320896c5ddc4Srjs default: return "XXX: INVALID"; 320996c5ddc4Srjs } 321096c5ddc4Srjs} 321196c5ddc4Srjs 321296c5ddc4Srjsenum mali_s_format { 321396c5ddc4Srjs MALI_S_FORMAT_S8 = 1, 321496c5ddc4Srjs MALI_S_FORMAT_S8X8 = 2, 321596c5ddc4Srjs MALI_S_FORMAT_S8X24 = 3, 321696c5ddc4Srjs MALI_S_FORMAT_X24S8 = 4, 321796c5ddc4Srjs MALI_S_FORMAT_X8S8 = 5, 321896c5ddc4Srjs MALI_S_FORMAT_X32_S8X24 = 6, 321996c5ddc4Srjs}; 322096c5ddc4Srjs 322196c5ddc4Srjsstatic inline const char * 322296c5ddc4Srjsmali_s_format_as_str(enum mali_s_format imm) 322396c5ddc4Srjs{ 322496c5ddc4Srjs switch (imm) { 322596c5ddc4Srjs case MALI_S_FORMAT_S8: return "S8"; 322696c5ddc4Srjs case MALI_S_FORMAT_S8X8: return "S8X8"; 322796c5ddc4Srjs case MALI_S_FORMAT_S8X24: return "S8X24"; 322896c5ddc4Srjs case MALI_S_FORMAT_X24S8: return "X24S8"; 322996c5ddc4Srjs case MALI_S_FORMAT_X8S8: return "X8S8"; 323096c5ddc4Srjs case MALI_S_FORMAT_X32_S8X24: return "X32_S8X24"; 323196c5ddc4Srjs default: return "XXX: INVALID"; 323296c5ddc4Srjs } 323396c5ddc4Srjs} 323496c5ddc4Srjs 323596c5ddc4Srjsenum mali_tie_break_rule { 323696c5ddc4Srjs MALI_TIE_BREAK_RULE_0_IN_180_OUT = 0, 323796c5ddc4Srjs MALI_TIE_BREAK_RULE_0_OUT_180_IN = 1, 323896c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_180_IN_0_OUT = 2, 323996c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_180_OUT_0_IN = 3, 324096c5ddc4Srjs MALI_TIE_BREAK_RULE_90_IN_270_OUT = 4, 324196c5ddc4Srjs MALI_TIE_BREAK_RULE_90_OUT_270_IN = 5, 324296c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_90_IN_90_OUT = 6, 324396c5ddc4Srjs MALI_TIE_BREAK_RULE_MINUS_90_OUT_90_IN = 7, 324496c5ddc4Srjs}; 324596c5ddc4Srjs 324696c5ddc4Srjsstatic inline const char * 324796c5ddc4Srjsmali_tie_break_rule_as_str(enum mali_tie_break_rule imm) 324896c5ddc4Srjs{ 324996c5ddc4Srjs switch (imm) { 325096c5ddc4Srjs case MALI_TIE_BREAK_RULE_0_IN_180_OUT: return "0_IN_180_OUT"; 325196c5ddc4Srjs case MALI_TIE_BREAK_RULE_0_OUT_180_IN: return "0_OUT_180_IN"; 325296c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_180_IN_0_OUT: return "MINUS_180_IN_0_OUT"; 325396c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_180_OUT_0_IN: return "MINUS_180_OUT_0_IN"; 325496c5ddc4Srjs case MALI_TIE_BREAK_RULE_90_IN_270_OUT: return "90_IN_270_OUT"; 325596c5ddc4Srjs case MALI_TIE_BREAK_RULE_90_OUT_270_IN: return "90_OUT_270_IN"; 325696c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_90_IN_90_OUT: return "MINUS_90_IN_90_OUT"; 325796c5ddc4Srjs case MALI_TIE_BREAK_RULE_MINUS_90_OUT_90_IN: return "MINUS_90_OUT_90_IN"; 325896c5ddc4Srjs default: return "XXX: INVALID"; 325996c5ddc4Srjs } 326096c5ddc4Srjs} 326196c5ddc4Srjs 326296c5ddc4Srjsstruct MALI_RT_BUFFER { 326396c5ddc4Srjs uint64_t base; 326496c5ddc4Srjs uint32_t row_stride; 326596c5ddc4Srjs uint32_t surface_stride; 326696c5ddc4Srjs}; 326796c5ddc4Srjs 326896c5ddc4Srjs#define MALI_RT_BUFFER_header \ 326996c5ddc4Srjs 0 327096c5ddc4Srjs 327196c5ddc4Srjsstatic inline void 327296c5ddc4SrjsMALI_RT_BUFFER_pack(uint32_t * restrict cl, 327396c5ddc4Srjs const struct MALI_RT_BUFFER * restrict values) 327496c5ddc4Srjs{ 327596c5ddc4Srjs cl[ 0] = __gen_uint(values->base, 0, 63); 327696c5ddc4Srjs cl[ 1] = __gen_uint(values->base, 0, 63) >> 32; 327796c5ddc4Srjs cl[ 2] = __gen_uint(values->row_stride, 0, 31); 327896c5ddc4Srjs cl[ 3] = __gen_uint(values->surface_stride, 0, 31); 327996c5ddc4Srjs} 328096c5ddc4Srjs 328196c5ddc4Srjs 328296c5ddc4Srjs#define MALI_RT_BUFFER_LENGTH 16 328396c5ddc4Srjsstruct mali_rt_buffer_packed { uint32_t opaque[4]; }; 328496c5ddc4Srjsstatic inline void 328596c5ddc4SrjsMALI_RT_BUFFER_unpack(const uint8_t * restrict cl, 328696c5ddc4Srjs struct MALI_RT_BUFFER * restrict values) 328796c5ddc4Srjs{ 328896c5ddc4Srjs values->base = __gen_unpack_uint(cl, 0, 63); 328996c5ddc4Srjs values->row_stride = __gen_unpack_uint(cl, 64, 95); 329096c5ddc4Srjs values->surface_stride = __gen_unpack_uint(cl, 96, 127); 329196c5ddc4Srjs} 329296c5ddc4Srjs 329396c5ddc4Srjsstatic inline void 329496c5ddc4SrjsMALI_RT_BUFFER_print(FILE *fp, const struct MALI_RT_BUFFER * values, unsigned indent) 329596c5ddc4Srjs{ 329696c5ddc4Srjs fprintf(fp, "%*sBase: 0x%" PRIx64 "\n", indent, "", values->base); 329796c5ddc4Srjs fprintf(fp, "%*sRow Stride: %u\n", indent, "", values->row_stride); 329896c5ddc4Srjs fprintf(fp, "%*sSurface Stride: %u\n", indent, "", values->surface_stride); 329996c5ddc4Srjs} 330096c5ddc4Srjs 330196c5ddc4Srjsenum mali_sample_pattern { 330296c5ddc4Srjs MALI_SAMPLE_PATTERN_SINGLE_SAMPLED = 0, 330396c5ddc4Srjs MALI_SAMPLE_PATTERN_ORDERED_4X_GRID = 1, 330496c5ddc4Srjs MALI_SAMPLE_PATTERN_ROTATED_4X_GRID = 2, 330596c5ddc4Srjs MALI_SAMPLE_PATTERN_D3D_8X_GRID = 3, 330696c5ddc4Srjs MALI_SAMPLE_PATTERN_D3D_16X_GRID = 4, 330796c5ddc4Srjs}; 330896c5ddc4Srjs 330996c5ddc4Srjsstatic inline const char * 331096c5ddc4Srjsmali_sample_pattern_as_str(enum mali_sample_pattern imm) 331196c5ddc4Srjs{ 331296c5ddc4Srjs switch (imm) { 331396c5ddc4Srjs case MALI_SAMPLE_PATTERN_SINGLE_SAMPLED: return "Single-sampled"; 331496c5ddc4Srjs case MALI_SAMPLE_PATTERN_ORDERED_4X_GRID: return "Ordered 4x Grid"; 331596c5ddc4Srjs case MALI_SAMPLE_PATTERN_ROTATED_4X_GRID: return "Rotated 4x Grid"; 331696c5ddc4Srjs case MALI_SAMPLE_PATTERN_D3D_8X_GRID: return "D3D 8x Grid"; 331796c5ddc4Srjs case MALI_SAMPLE_PATTERN_D3D_16X_GRID: return "D3D 16x Grid"; 331896c5ddc4Srjs default: return "XXX: INVALID"; 331996c5ddc4Srjs } 332096c5ddc4Srjs} 332196c5ddc4Srjs 332296c5ddc4Srjsenum mali_z_internal_format { 332396c5ddc4Srjs MALI_Z_INTERNAL_FORMAT_D16 = 0, 332496c5ddc4Srjs MALI_Z_INTERNAL_FORMAT_D24 = 1, 332596c5ddc4Srjs MALI_Z_INTERNAL_FORMAT_D32 = 2, 332696c5ddc4Srjs}; 332796c5ddc4Srjs 332896c5ddc4Srjsstatic inline const char * 332996c5ddc4Srjsmali_z_internal_format_as_str(enum mali_z_internal_format imm) 333096c5ddc4Srjs{ 333196c5ddc4Srjs switch (imm) { 333296c5ddc4Srjs case MALI_Z_INTERNAL_FORMAT_D16: return "D16"; 333396c5ddc4Srjs case MALI_Z_INTERNAL_FORMAT_D24: return "D24"; 333496c5ddc4Srjs case MALI_Z_INTERNAL_FORMAT_D32: return "D32"; 333596c5ddc4Srjs default: return "XXX: INVALID"; 333696c5ddc4Srjs } 333796c5ddc4Srjs} 333896c5ddc4Srjs 333996c5ddc4Srjsenum mali_fbd_tag { 334096c5ddc4Srjs MALI_FBD_TAG_IS_MFBD = 1, 334196c5ddc4Srjs MALI_FBD_TAG_HAS_ZS_RT = 2, 334296c5ddc4Srjs MALI_FBD_TAG_MASK = 63, 334396c5ddc4Srjs}; 334496c5ddc4Srjs 334596c5ddc4Srjsstatic inline const char * 334696c5ddc4Srjsmali_fbd_tag_as_str(enum mali_fbd_tag imm) 334796c5ddc4Srjs{ 334896c5ddc4Srjs switch (imm) { 334996c5ddc4Srjs case MALI_FBD_TAG_IS_MFBD: return "IS_MFBD"; 335096c5ddc4Srjs case MALI_FBD_TAG_HAS_ZS_RT: return "HAS_ZS_RT"; 335196c5ddc4Srjs case MALI_FBD_TAG_MASK: return "MASK"; 335296c5ddc4Srjs default: return "XXX: INVALID"; 335396c5ddc4Srjs } 335496c5ddc4Srjs} 335596c5ddc4Srjs 335696c5ddc4Srjsstruct MALI_FRAMEBUFFER_PARAMETERS { 335796c5ddc4Srjs uint32_t width; 335896c5ddc4Srjs uint32_t height; 335996c5ddc4Srjs uint32_t bound_min_x; 336096c5ddc4Srjs uint32_t bound_min_y; 336196c5ddc4Srjs uint32_t bound_max_x; 336296c5ddc4Srjs uint32_t bound_max_y; 336396c5ddc4Srjs uint32_t sample_count; 336496c5ddc4Srjs enum mali_sample_pattern sample_pattern; 336596c5ddc4Srjs enum mali_tie_break_rule tie_break_rule; 336696c5ddc4Srjs uint32_t effective_tile_size; 336796c5ddc4Srjs uint32_t x_downsampling_scale; 336896c5ddc4Srjs uint32_t y_downsampling_scale; 336996c5ddc4Srjs uint32_t render_target_count; 337096c5ddc4Srjs uint32_t color_buffer_allocation; 337196c5ddc4Srjs uint32_t s_clear; 337296c5ddc4Srjs bool s_write_enable; 337396c5ddc4Srjs bool s_preload_enable; 337496c5ddc4Srjs bool s_unload_enable; 337596c5ddc4Srjs enum mali_z_internal_format z_internal_format; 337696c5ddc4Srjs bool z_write_enable; 337796c5ddc4Srjs bool z_preload_enable; 337896c5ddc4Srjs bool z_unload_enable; 337996c5ddc4Srjs bool has_zs_crc_extension; 338096c5ddc4Srjs bool crc_read_enable; 338196c5ddc4Srjs bool crc_write_enable; 338296c5ddc4Srjs float z_clear; 338396c5ddc4Srjs}; 338496c5ddc4Srjs 338596c5ddc4Srjs#define MALI_FRAMEBUFFER_PARAMETERS_header \ 338696c5ddc4Srjs .sample_count = 1 338796c5ddc4Srjs 338896c5ddc4Srjsstatic inline void 338996c5ddc4SrjsMALI_FRAMEBUFFER_PARAMETERS_pack(uint32_t * restrict cl, 339096c5ddc4Srjs const struct MALI_FRAMEBUFFER_PARAMETERS * restrict values) 339196c5ddc4Srjs{ 339296c5ddc4Srjs assert(values->width >= 1); 339396c5ddc4Srjs assert(values->height >= 1); 339496c5ddc4Srjs assert(util_is_power_of_two_nonzero(values->sample_count)); 339596c5ddc4Srjs assert(util_is_power_of_two_nonzero(values->effective_tile_size)); 339696c5ddc4Srjs assert(values->render_target_count >= 1); 339796c5ddc4Srjs assert((values->color_buffer_allocation & 0x3ff) == 0); 339896c5ddc4Srjs cl[ 0] = __gen_uint(values->width - 1, 0, 15) | 339996c5ddc4Srjs __gen_uint(values->height - 1, 16, 31); 340096c5ddc4Srjs cl[ 1] = __gen_uint(values->bound_min_x, 0, 15) | 340196c5ddc4Srjs __gen_uint(values->bound_min_y, 16, 31); 340296c5ddc4Srjs cl[ 2] = __gen_uint(values->bound_max_x, 0, 15) | 340396c5ddc4Srjs __gen_uint(values->bound_max_y, 16, 31); 340496c5ddc4Srjs cl[ 3] = __gen_uint(util_logbase2(values->sample_count), 0, 2) | 340596c5ddc4Srjs __gen_uint(values->sample_pattern, 3, 5) | 340696c5ddc4Srjs __gen_uint(values->tie_break_rule, 6, 8) | 340796c5ddc4Srjs __gen_uint(util_logbase2(values->effective_tile_size), 9, 12) | 340896c5ddc4Srjs __gen_uint(values->x_downsampling_scale, 13, 15) | 340996c5ddc4Srjs __gen_uint(values->y_downsampling_scale, 16, 18) | 341096c5ddc4Srjs __gen_uint(values->render_target_count - 1, 19, 22) | 341196c5ddc4Srjs __gen_uint(values->color_buffer_allocation >> 10, 24, 31); 341296c5ddc4Srjs cl[ 4] = __gen_uint(values->s_clear, 0, 7) | 341396c5ddc4Srjs __gen_uint(values->s_write_enable, 8, 8) | 341496c5ddc4Srjs __gen_uint(values->s_preload_enable, 9, 9) | 341596c5ddc4Srjs __gen_uint(values->s_unload_enable, 10, 10) | 341696c5ddc4Srjs __gen_uint(values->z_internal_format, 16, 17) | 341796c5ddc4Srjs __gen_uint(values->z_write_enable, 18, 18) | 341896c5ddc4Srjs __gen_uint(values->z_preload_enable, 19, 19) | 341996c5ddc4Srjs __gen_uint(values->z_unload_enable, 20, 20) | 342096c5ddc4Srjs __gen_uint(values->has_zs_crc_extension, 21, 21) | 342196c5ddc4Srjs __gen_uint(values->crc_read_enable, 30, 30) | 342296c5ddc4Srjs __gen_uint(values->crc_write_enable, 31, 31); 342396c5ddc4Srjs cl[ 5] = __gen_uint(fui(values->z_clear), 0, 32); 342496c5ddc4Srjs} 342596c5ddc4Srjs 342696c5ddc4Srjs 342796c5ddc4Srjs#define MALI_FRAMEBUFFER_PARAMETERS_LENGTH 24 342896c5ddc4Srjsstruct mali_framebuffer_parameters_packed { uint32_t opaque[6]; }; 342996c5ddc4Srjsstatic inline void 343096c5ddc4SrjsMALI_FRAMEBUFFER_PARAMETERS_unpack(const uint8_t * restrict cl, 343196c5ddc4Srjs struct MALI_FRAMEBUFFER_PARAMETERS * restrict values) 343296c5ddc4Srjs{ 343396c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0x800000) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 3\n"); 343496c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0x3fc0f800) fprintf(stderr, "XXX: Invalid field of Framebuffer Parameters unpacked at word 4\n"); 343596c5ddc4Srjs values->width = __gen_unpack_uint(cl, 0, 15) + 1; 343696c5ddc4Srjs values->height = __gen_unpack_uint(cl, 16, 31) + 1; 343796c5ddc4Srjs values->bound_min_x = __gen_unpack_uint(cl, 32, 47); 343896c5ddc4Srjs values->bound_min_y = __gen_unpack_uint(cl, 48, 63); 343996c5ddc4Srjs values->bound_max_x = __gen_unpack_uint(cl, 64, 79); 344096c5ddc4Srjs values->bound_max_y = __gen_unpack_uint(cl, 80, 95); 344196c5ddc4Srjs values->sample_count = 1U << __gen_unpack_uint(cl, 96, 98); 344296c5ddc4Srjs values->sample_pattern = (enum mali_sample_pattern)__gen_unpack_uint(cl, 99, 101); 344396c5ddc4Srjs values->tie_break_rule = (enum mali_tie_break_rule)__gen_unpack_uint(cl, 102, 104); 344496c5ddc4Srjs values->effective_tile_size = 1U << __gen_unpack_uint(cl, 105, 108); 344596c5ddc4Srjs values->x_downsampling_scale = __gen_unpack_uint(cl, 109, 111); 344696c5ddc4Srjs values->y_downsampling_scale = __gen_unpack_uint(cl, 112, 114); 344796c5ddc4Srjs values->render_target_count = __gen_unpack_uint(cl, 115, 118) + 1; 344896c5ddc4Srjs values->color_buffer_allocation = __gen_unpack_uint(cl, 120, 127) << 10; 344996c5ddc4Srjs values->s_clear = __gen_unpack_uint(cl, 128, 135); 345096c5ddc4Srjs values->s_write_enable = __gen_unpack_uint(cl, 136, 136); 345196c5ddc4Srjs values->s_preload_enable = __gen_unpack_uint(cl, 137, 137); 345296c5ddc4Srjs values->s_unload_enable = __gen_unpack_uint(cl, 138, 138); 345396c5ddc4Srjs values->z_internal_format = (enum mali_z_internal_format)__gen_unpack_uint(cl, 144, 145); 345496c5ddc4Srjs values->z_write_enable = __gen_unpack_uint(cl, 146, 146); 345596c5ddc4Srjs values->z_preload_enable = __gen_unpack_uint(cl, 147, 147); 345696c5ddc4Srjs values->z_unload_enable = __gen_unpack_uint(cl, 148, 148); 345796c5ddc4Srjs values->has_zs_crc_extension = __gen_unpack_uint(cl, 149, 149); 345896c5ddc4Srjs values->crc_read_enable = __gen_unpack_uint(cl, 158, 158); 345996c5ddc4Srjs values->crc_write_enable = __gen_unpack_uint(cl, 159, 159); 346096c5ddc4Srjs values->z_clear = __gen_unpack_float(cl, 160, 191); 346196c5ddc4Srjs} 346296c5ddc4Srjs 346396c5ddc4Srjsstatic inline void 346496c5ddc4SrjsMALI_FRAMEBUFFER_PARAMETERS_print(FILE *fp, const struct MALI_FRAMEBUFFER_PARAMETERS * values, unsigned indent) 346596c5ddc4Srjs{ 346696c5ddc4Srjs fprintf(fp, "%*sWidth: %u\n", indent, "", values->width); 346796c5ddc4Srjs fprintf(fp, "%*sHeight: %u\n", indent, "", values->height); 346896c5ddc4Srjs fprintf(fp, "%*sBound Min X: %u\n", indent, "", values->bound_min_x); 346996c5ddc4Srjs fprintf(fp, "%*sBound Min Y: %u\n", indent, "", values->bound_min_y); 347096c5ddc4Srjs fprintf(fp, "%*sBound Max X: %u\n", indent, "", values->bound_max_x); 347196c5ddc4Srjs fprintf(fp, "%*sBound Max Y: %u\n", indent, "", values->bound_max_y); 347296c5ddc4Srjs fprintf(fp, "%*sSample Count: %u\n", indent, "", values->sample_count); 347396c5ddc4Srjs fprintf(fp, "%*sSample Pattern: %s\n", indent, "", mali_sample_pattern_as_str(values->sample_pattern)); 347496c5ddc4Srjs fprintf(fp, "%*sTie-Break Rule: %s\n", indent, "", mali_tie_break_rule_as_str(values->tie_break_rule)); 347596c5ddc4Srjs fprintf(fp, "%*sEffective Tile Size: %u\n", indent, "", values->effective_tile_size); 347696c5ddc4Srjs fprintf(fp, "%*sX Downsampling Scale: %u\n", indent, "", values->x_downsampling_scale); 347796c5ddc4Srjs fprintf(fp, "%*sY Downsampling Scale: %u\n", indent, "", values->y_downsampling_scale); 347896c5ddc4Srjs fprintf(fp, "%*sRender Target Count: %u\n", indent, "", values->render_target_count); 347996c5ddc4Srjs fprintf(fp, "%*sColor Buffer Allocation: %u\n", indent, "", values->color_buffer_allocation); 348096c5ddc4Srjs fprintf(fp, "%*sS Clear: %u\n", indent, "", values->s_clear); 348196c5ddc4Srjs fprintf(fp, "%*sS Write Enable: %s\n", indent, "", values->s_write_enable ? "true" : "false"); 348296c5ddc4Srjs fprintf(fp, "%*sS Preload Enable: %s\n", indent, "", values->s_preload_enable ? "true" : "false"); 348396c5ddc4Srjs fprintf(fp, "%*sS Unload Enable: %s\n", indent, "", values->s_unload_enable ? "true" : "false"); 348496c5ddc4Srjs fprintf(fp, "%*sZ Internal Format: %s\n", indent, "", mali_z_internal_format_as_str(values->z_internal_format)); 348596c5ddc4Srjs fprintf(fp, "%*sZ Write Enable: %s\n", indent, "", values->z_write_enable ? "true" : "false"); 348696c5ddc4Srjs fprintf(fp, "%*sZ Preload Enable: %s\n", indent, "", values->z_preload_enable ? "true" : "false"); 348796c5ddc4Srjs fprintf(fp, "%*sZ Unload Enable: %s\n", indent, "", values->z_unload_enable ? "true" : "false"); 348896c5ddc4Srjs fprintf(fp, "%*sHas ZS CRC Extension: %s\n", indent, "", values->has_zs_crc_extension ? "true" : "false"); 348996c5ddc4Srjs fprintf(fp, "%*sCRC Read Enable: %s\n", indent, "", values->crc_read_enable ? "true" : "false"); 349096c5ddc4Srjs fprintf(fp, "%*sCRC Write Enable: %s\n", indent, "", values->crc_write_enable ? "true" : "false"); 349196c5ddc4Srjs fprintf(fp, "%*sZ Clear: %f\n", indent, "", values->z_clear); 349296c5ddc4Srjs} 349396c5ddc4Srjs 349496c5ddc4Srjsstruct MALI_ZS_CRC_EXTENSION { 349596c5ddc4Srjs uint64_t crc_base; 349696c5ddc4Srjs uint32_t crc_row_stride; 349796c5ddc4Srjs enum mali_zs_format zs_write_format; 349896c5ddc4Srjs enum mali_block_format zs_block_format; 349996c5ddc4Srjs enum mali_msaa zs_msaa; 350096c5ddc4Srjs bool zs_big_endian; 350196c5ddc4Srjs bool zs_clean_pixel_write_enable; 350296c5ddc4Srjs enum mali_s_format s_write_format; 350396c5ddc4Srjs enum mali_block_format s_block_format; 350496c5ddc4Srjs enum mali_msaa s_msaa; 350596c5ddc4Srjs enum mali_zs_preload_format zs_preload_format; 350696c5ddc4Srjs uint64_t zs_writeback_base; 350796c5ddc4Srjs uint32_t zs_writeback_row_stride; 350896c5ddc4Srjs uint32_t zs_writeback_surface_stride; 350996c5ddc4Srjs uint64_t s_writeback_base; 351096c5ddc4Srjs uint32_t s_writeback_row_stride; 351196c5ddc4Srjs uint32_t s_writeback_surface_stride; 351296c5ddc4Srjs uint64_t zs_afbc_header; 351396c5ddc4Srjs uint32_t zs_afbc_row_stride; 351496c5ddc4Srjs uint32_t zs_afbc_chunk_size; 351596c5ddc4Srjs bool zs_afbc_sparse; 351696c5ddc4Srjs uint64_t zs_afbc_body; 351796c5ddc4Srjs uint32_t zs_afbc_body_size; 351896c5ddc4Srjs uint64_t zs_preload_base; 351996c5ddc4Srjs uint32_t zs_preload_row_stride; 352096c5ddc4Srjs uint32_t zs_preload_surface_stride; 352196c5ddc4Srjs}; 352296c5ddc4Srjs 352396c5ddc4Srjs#define MALI_ZS_CRC_EXTENSION_header \ 352496c5ddc4Srjs .zs_msaa = MALI_MSAA_SINGLE, \ 352596c5ddc4Srjs .s_msaa = MALI_MSAA_SINGLE 352696c5ddc4Srjs 352796c5ddc4Srjsstatic inline void 352896c5ddc4SrjsMALI_ZS_CRC_EXTENSION_pack(uint32_t * restrict cl, 352996c5ddc4Srjs const struct MALI_ZS_CRC_EXTENSION * restrict values) 353096c5ddc4Srjs{ 353196c5ddc4Srjs cl[ 0] = __gen_uint(values->crc_base, 0, 63); 353296c5ddc4Srjs cl[ 1] = __gen_uint(values->crc_base, 0, 63) >> 32; 353396c5ddc4Srjs cl[ 2] = __gen_uint(values->crc_row_stride, 0, 31); 353496c5ddc4Srjs cl[ 3] = __gen_uint(values->zs_write_format, 0, 3) | 353596c5ddc4Srjs __gen_uint(values->zs_block_format, 4, 5) | 353696c5ddc4Srjs __gen_uint(values->zs_msaa, 6, 7) | 353796c5ddc4Srjs __gen_uint(values->zs_big_endian, 8, 8) | 353896c5ddc4Srjs __gen_uint(values->zs_clean_pixel_write_enable, 10, 10) | 353996c5ddc4Srjs __gen_uint(values->s_write_format, 16, 19) | 354096c5ddc4Srjs __gen_uint(values->s_block_format, 20, 21) | 354196c5ddc4Srjs __gen_uint(values->s_msaa, 22, 23) | 354296c5ddc4Srjs __gen_uint(values->zs_preload_format, 28, 31); 354396c5ddc4Srjs cl[ 4] = __gen_uint(values->zs_writeback_base, 0, 63) | 354496c5ddc4Srjs __gen_uint(values->zs_afbc_header, 0, 63); 354596c5ddc4Srjs cl[ 5] = __gen_uint(values->zs_writeback_base, 0, 63) >> 32 | 354696c5ddc4Srjs __gen_uint(values->zs_afbc_header, 0, 63) >> 32; 354796c5ddc4Srjs cl[ 6] = __gen_uint(values->zs_writeback_row_stride, 0, 31) | 354896c5ddc4Srjs __gen_uint(values->zs_afbc_row_stride, 0, 12); 354996c5ddc4Srjs cl[ 7] = __gen_uint(values->zs_writeback_surface_stride, 0, 31) | 355096c5ddc4Srjs __gen_uint(values->zs_afbc_chunk_size, 0, 11) | 355196c5ddc4Srjs __gen_uint(values->zs_afbc_sparse, 16, 16); 355296c5ddc4Srjs cl[ 8] = __gen_uint(values->s_writeback_base, 0, 63) | 355396c5ddc4Srjs __gen_uint(values->zs_afbc_body, 0, 63); 355496c5ddc4Srjs cl[ 9] = __gen_uint(values->s_writeback_base, 0, 63) >> 32 | 355596c5ddc4Srjs __gen_uint(values->zs_afbc_body, 0, 63) >> 32; 355696c5ddc4Srjs cl[10] = __gen_uint(values->s_writeback_row_stride, 0, 31) | 355796c5ddc4Srjs __gen_uint(values->zs_afbc_body_size, 0, 31); 355896c5ddc4Srjs cl[11] = __gen_uint(values->s_writeback_surface_stride, 0, 31); 355996c5ddc4Srjs cl[12] = __gen_uint(values->zs_preload_base, 0, 63); 356096c5ddc4Srjs cl[13] = __gen_uint(values->zs_preload_base, 0, 63) >> 32; 356196c5ddc4Srjs cl[14] = __gen_uint(values->zs_preload_row_stride, 0, 31); 356296c5ddc4Srjs cl[15] = __gen_uint(values->zs_preload_surface_stride, 0, 31); 356396c5ddc4Srjs} 356496c5ddc4Srjs 356596c5ddc4Srjs 356696c5ddc4Srjs#define MALI_ZS_CRC_EXTENSION_LENGTH 64 356796c5ddc4Srjs#define MALI_ZS_CRC_EXTENSION_ALIGN 64 356896c5ddc4Srjsstruct mali_zs_crc_extension_packed { uint32_t opaque[16]; }; 356996c5ddc4Srjsstatic inline void 357096c5ddc4SrjsMALI_ZS_CRC_EXTENSION_unpack(const uint8_t * restrict cl, 357196c5ddc4Srjs struct MALI_ZS_CRC_EXTENSION * restrict values) 357296c5ddc4Srjs{ 357396c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xf00fa00) fprintf(stderr, "XXX: Invalid field of ZS CRC Extension unpacked at word 3\n"); 357496c5ddc4Srjs values->crc_base = __gen_unpack_uint(cl, 0, 63); 357596c5ddc4Srjs values->crc_row_stride = __gen_unpack_uint(cl, 64, 95); 357696c5ddc4Srjs values->zs_write_format = (enum mali_zs_format)__gen_unpack_uint(cl, 96, 99); 357796c5ddc4Srjs values->zs_block_format = (enum mali_block_format)__gen_unpack_uint(cl, 100, 101); 357896c5ddc4Srjs values->zs_msaa = (enum mali_msaa)__gen_unpack_uint(cl, 102, 103); 357996c5ddc4Srjs values->zs_big_endian = __gen_unpack_uint(cl, 104, 104); 358096c5ddc4Srjs values->zs_clean_pixel_write_enable = __gen_unpack_uint(cl, 106, 106); 358196c5ddc4Srjs values->s_write_format = (enum mali_s_format)__gen_unpack_uint(cl, 112, 115); 358296c5ddc4Srjs values->s_block_format = (enum mali_block_format)__gen_unpack_uint(cl, 116, 117); 358396c5ddc4Srjs values->s_msaa = (enum mali_msaa)__gen_unpack_uint(cl, 118, 119); 358496c5ddc4Srjs values->zs_preload_format = (enum mali_zs_preload_format)__gen_unpack_uint(cl, 124, 127); 358596c5ddc4Srjs values->zs_writeback_base = __gen_unpack_uint(cl, 128, 191); 358696c5ddc4Srjs values->zs_writeback_row_stride = __gen_unpack_uint(cl, 192, 223); 358796c5ddc4Srjs values->zs_writeback_surface_stride = __gen_unpack_uint(cl, 224, 255); 358896c5ddc4Srjs values->s_writeback_base = __gen_unpack_uint(cl, 256, 319); 358996c5ddc4Srjs values->s_writeback_row_stride = __gen_unpack_uint(cl, 320, 351); 359096c5ddc4Srjs values->s_writeback_surface_stride = __gen_unpack_uint(cl, 352, 383); 359196c5ddc4Srjs values->zs_afbc_header = __gen_unpack_uint(cl, 128, 191); 359296c5ddc4Srjs values->zs_afbc_row_stride = __gen_unpack_uint(cl, 192, 204); 359396c5ddc4Srjs values->zs_afbc_chunk_size = __gen_unpack_uint(cl, 224, 235); 359496c5ddc4Srjs values->zs_afbc_sparse = __gen_unpack_uint(cl, 240, 240); 359596c5ddc4Srjs values->zs_afbc_body = __gen_unpack_uint(cl, 256, 319); 359696c5ddc4Srjs values->zs_afbc_body_size = __gen_unpack_uint(cl, 320, 351); 359796c5ddc4Srjs values->zs_preload_base = __gen_unpack_uint(cl, 384, 447); 359896c5ddc4Srjs values->zs_preload_row_stride = __gen_unpack_uint(cl, 448, 479); 359996c5ddc4Srjs values->zs_preload_surface_stride = __gen_unpack_uint(cl, 480, 511); 360096c5ddc4Srjs} 360196c5ddc4Srjs 360296c5ddc4Srjsstatic inline void 360396c5ddc4SrjsMALI_ZS_CRC_EXTENSION_print(FILE *fp, const struct MALI_ZS_CRC_EXTENSION * values, unsigned indent) 360496c5ddc4Srjs{ 360596c5ddc4Srjs fprintf(fp, "%*sCRC Base: 0x%" PRIx64 "\n", indent, "", values->crc_base); 360696c5ddc4Srjs fprintf(fp, "%*sCRC Row Stride: %u\n", indent, "", values->crc_row_stride); 360796c5ddc4Srjs fprintf(fp, "%*sZS Write Format: %s\n", indent, "", mali_zs_format_as_str(values->zs_write_format)); 360896c5ddc4Srjs fprintf(fp, "%*sZS Block Format: %s\n", indent, "", mali_block_format_as_str(values->zs_block_format)); 360996c5ddc4Srjs fprintf(fp, "%*sZS MSAA: %s\n", indent, "", mali_msaa_as_str(values->zs_msaa)); 361096c5ddc4Srjs fprintf(fp, "%*sZS Big Endian: %s\n", indent, "", values->zs_big_endian ? "true" : "false"); 361196c5ddc4Srjs fprintf(fp, "%*sZS Clean Pixel Write Enable: %s\n", indent, "", values->zs_clean_pixel_write_enable ? "true" : "false"); 361296c5ddc4Srjs fprintf(fp, "%*sS Write Format: %s\n", indent, "", mali_s_format_as_str(values->s_write_format)); 361396c5ddc4Srjs fprintf(fp, "%*sS Block Format: %s\n", indent, "", mali_block_format_as_str(values->s_block_format)); 361496c5ddc4Srjs fprintf(fp, "%*sS MSAA: %s\n", indent, "", mali_msaa_as_str(values->s_msaa)); 361596c5ddc4Srjs fprintf(fp, "%*sZS Preload Format: %s\n", indent, "", mali_zs_preload_format_as_str(values->zs_preload_format)); 361696c5ddc4Srjs fprintf(fp, "%*sZS Writeback Base: 0x%" PRIx64 "\n", indent, "", values->zs_writeback_base); 361796c5ddc4Srjs fprintf(fp, "%*sZS Writeback Row Stride: %u\n", indent, "", values->zs_writeback_row_stride); 361896c5ddc4Srjs fprintf(fp, "%*sZS Writeback Surface Stride: %u\n", indent, "", values->zs_writeback_surface_stride); 361996c5ddc4Srjs fprintf(fp, "%*sS Writeback Base: 0x%" PRIx64 "\n", indent, "", values->s_writeback_base); 362096c5ddc4Srjs fprintf(fp, "%*sS Writeback Row Stride: %u\n", indent, "", values->s_writeback_row_stride); 362196c5ddc4Srjs fprintf(fp, "%*sS Writeback Surface Stride: %u\n", indent, "", values->s_writeback_surface_stride); 362296c5ddc4Srjs fprintf(fp, "%*sZS AFBC Header: 0x%" PRIx64 "\n", indent, "", values->zs_afbc_header); 362396c5ddc4Srjs fprintf(fp, "%*sZS AFBC Row Stride: %u\n", indent, "", values->zs_afbc_row_stride); 362496c5ddc4Srjs fprintf(fp, "%*sZS AFBC Chunk Size: %u\n", indent, "", values->zs_afbc_chunk_size); 362596c5ddc4Srjs fprintf(fp, "%*sZS AFBC Sparse: %s\n", indent, "", values->zs_afbc_sparse ? "true" : "false"); 362696c5ddc4Srjs fprintf(fp, "%*sZS AFBC Body: 0x%" PRIx64 "\n", indent, "", values->zs_afbc_body); 362796c5ddc4Srjs fprintf(fp, "%*sZS AFBC Body Size: %u\n", indent, "", values->zs_afbc_body_size); 362896c5ddc4Srjs fprintf(fp, "%*sZS Preload Base: 0x%" PRIx64 "\n", indent, "", values->zs_preload_base); 362996c5ddc4Srjs fprintf(fp, "%*sZS Preload Row Stride: %u\n", indent, "", values->zs_preload_row_stride); 363096c5ddc4Srjs fprintf(fp, "%*sZS Preload Surface Stride: %u\n", indent, "", values->zs_preload_surface_stride); 363196c5ddc4Srjs} 363296c5ddc4Srjs 363396c5ddc4Srjsenum mali_rt_endianness { 363496c5ddc4Srjs MALI_RT_ENDIANNESS_LITTLE_ENDIAN = 0, 363596c5ddc4Srjs MALI_RT_ENDIANNESS_BIG_ENDIAN_2B = 1, 363696c5ddc4Srjs MALI_RT_ENDIANNESS_BIG_ENDIAN_4B = 2, 363796c5ddc4Srjs MALI_RT_ENDIANNESS_BIG_ENDIAN_8B = 3, 363896c5ddc4Srjs}; 363996c5ddc4Srjs 364096c5ddc4Srjsstatic inline const char * 364196c5ddc4Srjsmali_rt_endianness_as_str(enum mali_rt_endianness imm) 364296c5ddc4Srjs{ 364396c5ddc4Srjs switch (imm) { 364496c5ddc4Srjs case MALI_RT_ENDIANNESS_LITTLE_ENDIAN: return "Little Endian"; 364596c5ddc4Srjs case MALI_RT_ENDIANNESS_BIG_ENDIAN_2B: return "Big Endian 2B"; 364696c5ddc4Srjs case MALI_RT_ENDIANNESS_BIG_ENDIAN_4B: return "Big Endian 4B"; 364796c5ddc4Srjs case MALI_RT_ENDIANNESS_BIG_ENDIAN_8B: return "Big Endian 8B"; 364896c5ddc4Srjs default: return "XXX: INVALID"; 364996c5ddc4Srjs } 365096c5ddc4Srjs} 365196c5ddc4Srjs 365296c5ddc4Srjsenum mali_yuv_conv_k6 { 365396c5ddc4Srjs MALI_YUV_CONV_K6_0 = 0, 365496c5ddc4Srjs MALI_YUV_CONV_K6_16 = 1, 365596c5ddc4Srjs}; 365696c5ddc4Srjs 365796c5ddc4Srjsstatic inline const char * 365896c5ddc4Srjsmali_yuv_conv_k6_as_str(enum mali_yuv_conv_k6 imm) 365996c5ddc4Srjs{ 366096c5ddc4Srjs switch (imm) { 366196c5ddc4Srjs case MALI_YUV_CONV_K6_0: return "0"; 366296c5ddc4Srjs case MALI_YUV_CONV_K6_16: return "16"; 366396c5ddc4Srjs default: return "XXX: INVALID"; 366496c5ddc4Srjs } 366596c5ddc4Srjs} 366696c5ddc4Srjs 366796c5ddc4Srjsenum mali_yuv_conv_k7_clamp { 366896c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_MINUS_128_TO_127 = 0, 366996c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_MINUS_112_TO_111 = 1, 367096c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_0_TO_255 = 2, 367196c5ddc4Srjs MALI_YUV_CONV_K7_CLAMP_16_TO_239 = 3, 367296c5ddc4Srjs}; 367396c5ddc4Srjs 367496c5ddc4Srjsstatic inline const char * 367596c5ddc4Srjsmali_yuv_conv_k7_clamp_as_str(enum mali_yuv_conv_k7_clamp imm) 367696c5ddc4Srjs{ 367796c5ddc4Srjs switch (imm) { 367896c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_MINUS_128_TO_127: return "MINUS_128_TO_127"; 367996c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_MINUS_112_TO_111: return "MINUS_112_TO_111"; 368096c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_0_TO_255: return "0_TO_255"; 368196c5ddc4Srjs case MALI_YUV_CONV_K7_CLAMP_16_TO_239: return "16_TO_239"; 368296c5ddc4Srjs default: return "XXX: INVALID"; 368396c5ddc4Srjs } 368496c5ddc4Srjs} 368596c5ddc4Srjs 368696c5ddc4Srjsenum mali_yuv_conv_k8 { 368796c5ddc4Srjs MALI_YUV_CONV_K8_220 = 0, 368896c5ddc4Srjs MALI_YUV_CONV_K8_256 = 1, 368996c5ddc4Srjs}; 369096c5ddc4Srjs 369196c5ddc4Srjsstatic inline const char * 369296c5ddc4Srjsmali_yuv_conv_k8_as_str(enum mali_yuv_conv_k8 imm) 369396c5ddc4Srjs{ 369496c5ddc4Srjs switch (imm) { 369596c5ddc4Srjs case MALI_YUV_CONV_K8_220: return "220"; 369696c5ddc4Srjs case MALI_YUV_CONV_K8_256: return "256"; 369796c5ddc4Srjs default: return "XXX: INVALID"; 369896c5ddc4Srjs } 369996c5ddc4Srjs} 370096c5ddc4Srjs 370196c5ddc4Srjsstruct MALI_RENDER_TARGET_YUV_OVERLAY { 370296c5ddc4Srjs uint32_t conv_k5; 370396c5ddc4Srjs enum mali_yuv_conv_k6 conv_k6; 370496c5ddc4Srjs enum mali_yuv_conv_k7_clamp conv_k7_clamp; 370596c5ddc4Srjs enum mali_yuv_conv_k8 conv_k8; 370696c5ddc4Srjs bool conv_disable; 370796c5ddc4Srjs uint32_t conv_k1; 370896c5ddc4Srjs uint32_t conv_k2; 370996c5ddc4Srjs uint32_t conv_k3; 371096c5ddc4Srjs uint32_t conv_k4; 371196c5ddc4Srjs uint64_t plane_0_base; 371296c5ddc4Srjs uint64_t plane_1_base; 371396c5ddc4Srjs uint64_t plane_2_base; 371496c5ddc4Srjs uint32_t plane_0_stride; 371596c5ddc4Srjs uint32_t plane_1_2_stride; 371696c5ddc4Srjs}; 371796c5ddc4Srjs 371896c5ddc4Srjs#define MALI_RENDER_TARGET_YUV_OVERLAY_header \ 371996c5ddc4Srjs 0 372096c5ddc4Srjs 372196c5ddc4Srjsstatic inline void 372296c5ddc4SrjsMALI_RENDER_TARGET_YUV_OVERLAY_pack(uint32_t * restrict cl, 372396c5ddc4Srjs const struct MALI_RENDER_TARGET_YUV_OVERLAY * restrict values) 372496c5ddc4Srjs{ 372596c5ddc4Srjs cl[ 0] = 0; 372696c5ddc4Srjs cl[ 1] = 0; 372796c5ddc4Srjs cl[ 2] = __gen_uint(values->conv_k5, 16, 23) | 372896c5ddc4Srjs __gen_uint(values->conv_k6, 24, 24) | 372996c5ddc4Srjs __gen_uint(values->conv_k7_clamp, 25, 26) | 373096c5ddc4Srjs __gen_uint(values->conv_k8, 27, 27) | 373196c5ddc4Srjs __gen_uint(values->conv_disable, 31, 31); 373296c5ddc4Srjs cl[ 3] = __gen_uint(values->conv_k1, 0, 7) | 373396c5ddc4Srjs __gen_uint(values->conv_k2, 8, 15) | 373496c5ddc4Srjs __gen_uint(values->conv_k3, 16, 23) | 373596c5ddc4Srjs __gen_uint(values->conv_k4, 24, 31); 373696c5ddc4Srjs cl[ 4] = __gen_uint(values->plane_0_base, 0, 63); 373796c5ddc4Srjs cl[ 5] = __gen_uint(values->plane_0_base, 0, 63) >> 32; 373896c5ddc4Srjs cl[ 6] = __gen_uint(values->plane_1_base, 0, 63); 373996c5ddc4Srjs cl[ 7] = __gen_uint(values->plane_1_base, 0, 63) >> 32; 374096c5ddc4Srjs cl[ 8] = __gen_uint(values->plane_2_base, 0, 63); 374196c5ddc4Srjs cl[ 9] = __gen_uint(values->plane_2_base, 0, 63) >> 32; 374296c5ddc4Srjs cl[10] = __gen_uint(values->plane_0_stride, 0, 31); 374396c5ddc4Srjs cl[11] = __gen_uint(values->plane_1_2_stride, 0, 31); 374496c5ddc4Srjs cl[12] = 0; 374596c5ddc4Srjs cl[13] = 0; 374696c5ddc4Srjs cl[14] = 0; 374796c5ddc4Srjs cl[15] = 0; 374896c5ddc4Srjs} 374996c5ddc4Srjs 375096c5ddc4Srjs 375196c5ddc4Srjs#define MALI_RENDER_TARGET_YUV_OVERLAY_LENGTH 64 375296c5ddc4Srjsstruct mali_render_target_yuv_overlay_packed { uint32_t opaque[16]; }; 375396c5ddc4Srjsstatic inline void 375496c5ddc4SrjsMALI_RENDER_TARGET_YUV_OVERLAY_unpack(const uint8_t * restrict cl, 375596c5ddc4Srjs struct MALI_RENDER_TARGET_YUV_OVERLAY * restrict values) 375696c5ddc4Srjs{ 375796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 0\n"); 375896c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 1\n"); 375996c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0x7000ffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 2\n"); 376096c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 12\n"); 376196c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 13\n"); 376296c5ddc4Srjs if (((const uint32_t *) cl)[14] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 14\n"); 376396c5ddc4Srjs if (((const uint32_t *) cl)[15] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target YUV Overlay unpacked at word 15\n"); 376496c5ddc4Srjs values->conv_k5 = __gen_unpack_uint(cl, 80, 87); 376596c5ddc4Srjs values->conv_k6 = (enum mali_yuv_conv_k6)__gen_unpack_uint(cl, 88, 88); 376696c5ddc4Srjs values->conv_k7_clamp = (enum mali_yuv_conv_k7_clamp)__gen_unpack_uint(cl, 89, 90); 376796c5ddc4Srjs values->conv_k8 = (enum mali_yuv_conv_k8)__gen_unpack_uint(cl, 91, 91); 376896c5ddc4Srjs values->conv_disable = __gen_unpack_uint(cl, 95, 95); 376996c5ddc4Srjs values->conv_k1 = __gen_unpack_uint(cl, 96, 103); 377096c5ddc4Srjs values->conv_k2 = __gen_unpack_uint(cl, 104, 111); 377196c5ddc4Srjs values->conv_k3 = __gen_unpack_uint(cl, 112, 119); 377296c5ddc4Srjs values->conv_k4 = __gen_unpack_uint(cl, 120, 127); 377396c5ddc4Srjs values->plane_0_base = __gen_unpack_uint(cl, 128, 191); 377496c5ddc4Srjs values->plane_1_base = __gen_unpack_uint(cl, 192, 255); 377596c5ddc4Srjs values->plane_2_base = __gen_unpack_uint(cl, 256, 319); 377696c5ddc4Srjs values->plane_0_stride = __gen_unpack_uint(cl, 320, 351); 377796c5ddc4Srjs values->plane_1_2_stride = __gen_unpack_uint(cl, 352, 383); 377896c5ddc4Srjs} 377996c5ddc4Srjs 378096c5ddc4Srjsstatic inline void 378196c5ddc4SrjsMALI_RENDER_TARGET_YUV_OVERLAY_print(FILE *fp, const struct MALI_RENDER_TARGET_YUV_OVERLAY * values, unsigned indent) 378296c5ddc4Srjs{ 378396c5ddc4Srjs fprintf(fp, "%*sConv K5: %u\n", indent, "", values->conv_k5); 378496c5ddc4Srjs fprintf(fp, "%*sConv K6: %s\n", indent, "", mali_yuv_conv_k6_as_str(values->conv_k6)); 378596c5ddc4Srjs fprintf(fp, "%*sConv K7 Clamp: %s\n", indent, "", mali_yuv_conv_k7_clamp_as_str(values->conv_k7_clamp)); 378696c5ddc4Srjs fprintf(fp, "%*sConv K8: %s\n", indent, "", mali_yuv_conv_k8_as_str(values->conv_k8)); 378796c5ddc4Srjs fprintf(fp, "%*sConv Disable: %s\n", indent, "", values->conv_disable ? "true" : "false"); 378896c5ddc4Srjs fprintf(fp, "%*sConv K1: %u\n", indent, "", values->conv_k1); 378996c5ddc4Srjs fprintf(fp, "%*sConv K2: %u\n", indent, "", values->conv_k2); 379096c5ddc4Srjs fprintf(fp, "%*sConv K3: %u\n", indent, "", values->conv_k3); 379196c5ddc4Srjs fprintf(fp, "%*sConv K4: %u\n", indent, "", values->conv_k4); 379296c5ddc4Srjs fprintf(fp, "%*sPlane 0 Base: 0x%" PRIx64 "\n", indent, "", values->plane_0_base); 379396c5ddc4Srjs fprintf(fp, "%*sPlane 1 Base: 0x%" PRIx64 "\n", indent, "", values->plane_1_base); 379496c5ddc4Srjs fprintf(fp, "%*sPlane 2 Base: 0x%" PRIx64 "\n", indent, "", values->plane_2_base); 379596c5ddc4Srjs fprintf(fp, "%*sPlane 0 Stride: %u\n", indent, "", values->plane_0_stride); 379696c5ddc4Srjs fprintf(fp, "%*sPlane 1 2 Stride: %u\n", indent, "", values->plane_1_2_stride); 379796c5ddc4Srjs} 379896c5ddc4Srjs 379996c5ddc4Srjsstruct MALI_RENDER_TARGET_AFBC_OVERLAY { 380096c5ddc4Srjs uint64_t header; 380196c5ddc4Srjs uint32_t row_stride; 380296c5ddc4Srjs uint32_t chunk_size; 380396c5ddc4Srjs bool sparse; 380496c5ddc4Srjs bool yuv_transform_enable; 380596c5ddc4Srjs uint64_t body; 380696c5ddc4Srjs uint32_t body_size; 380796c5ddc4Srjs}; 380896c5ddc4Srjs 380996c5ddc4Srjs#define MALI_RENDER_TARGET_AFBC_OVERLAY_header \ 381096c5ddc4Srjs 0 381196c5ddc4Srjs 381296c5ddc4Srjsstatic inline void 381396c5ddc4SrjsMALI_RENDER_TARGET_AFBC_OVERLAY_pack(uint32_t * restrict cl, 381496c5ddc4Srjs const struct MALI_RENDER_TARGET_AFBC_OVERLAY * restrict values) 381596c5ddc4Srjs{ 381696c5ddc4Srjs cl[ 0] = 0; 381796c5ddc4Srjs cl[ 1] = 0; 381896c5ddc4Srjs cl[ 2] = 0; 381996c5ddc4Srjs cl[ 3] = 0; 382096c5ddc4Srjs cl[ 4] = __gen_uint(values->header, 0, 63); 382196c5ddc4Srjs cl[ 5] = __gen_uint(values->header, 0, 63) >> 32; 382296c5ddc4Srjs cl[ 6] = __gen_uint(values->row_stride, 0, 12); 382396c5ddc4Srjs cl[ 7] = __gen_uint(values->chunk_size, 0, 11) | 382496c5ddc4Srjs __gen_uint(values->sparse, 16, 16) | 382596c5ddc4Srjs __gen_uint(values->yuv_transform_enable, 17, 17); 382696c5ddc4Srjs cl[ 8] = __gen_uint(values->body, 0, 63); 382796c5ddc4Srjs cl[ 9] = __gen_uint(values->body, 0, 63) >> 32; 382896c5ddc4Srjs cl[10] = __gen_uint(values->body_size, 0, 31); 382996c5ddc4Srjs cl[11] = 0; 383096c5ddc4Srjs cl[12] = 0; 383196c5ddc4Srjs cl[13] = 0; 383296c5ddc4Srjs cl[14] = 0; 383396c5ddc4Srjs cl[15] = 0; 383496c5ddc4Srjs} 383596c5ddc4Srjs 383696c5ddc4Srjs 383796c5ddc4Srjs#define MALI_RENDER_TARGET_AFBC_OVERLAY_LENGTH 64 383896c5ddc4Srjsstruct mali_render_target_afbc_overlay_packed { uint32_t opaque[16]; }; 383996c5ddc4Srjsstatic inline void 384096c5ddc4SrjsMALI_RENDER_TARGET_AFBC_OVERLAY_unpack(const uint8_t * restrict cl, 384196c5ddc4Srjs struct MALI_RENDER_TARGET_AFBC_OVERLAY * restrict values) 384296c5ddc4Srjs{ 384396c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 0\n"); 384496c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 1\n"); 384596c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 2\n"); 384696c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 3\n"); 384796c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffe000) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 6\n"); 384896c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xfffcf000) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 7\n"); 384996c5ddc4Srjs if (((const uint32_t *) cl)[11] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 11\n"); 385096c5ddc4Srjs if (((const uint32_t *) cl)[12] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 12\n"); 385196c5ddc4Srjs if (((const uint32_t *) cl)[13] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 13\n"); 385296c5ddc4Srjs if (((const uint32_t *) cl)[14] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 14\n"); 385396c5ddc4Srjs if (((const uint32_t *) cl)[15] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Render Target AFBC Overlay unpacked at word 15\n"); 385496c5ddc4Srjs values->header = __gen_unpack_uint(cl, 128, 191); 385596c5ddc4Srjs values->row_stride = __gen_unpack_uint(cl, 192, 204); 385696c5ddc4Srjs values->chunk_size = __gen_unpack_uint(cl, 224, 235); 385796c5ddc4Srjs values->sparse = __gen_unpack_uint(cl, 240, 240); 385896c5ddc4Srjs values->yuv_transform_enable = __gen_unpack_uint(cl, 241, 241); 385996c5ddc4Srjs values->body = __gen_unpack_uint(cl, 256, 319); 386096c5ddc4Srjs values->body_size = __gen_unpack_uint(cl, 320, 351); 386196c5ddc4Srjs} 386296c5ddc4Srjs 386396c5ddc4Srjsstatic inline void 386496c5ddc4SrjsMALI_RENDER_TARGET_AFBC_OVERLAY_print(FILE *fp, const struct MALI_RENDER_TARGET_AFBC_OVERLAY * values, unsigned indent) 386596c5ddc4Srjs{ 386696c5ddc4Srjs fprintf(fp, "%*sHeader: 0x%" PRIx64 "\n", indent, "", values->header); 386796c5ddc4Srjs fprintf(fp, "%*sRow Stride: %u\n", indent, "", values->row_stride); 386896c5ddc4Srjs fprintf(fp, "%*sChunk Size: %u\n", indent, "", values->chunk_size); 386996c5ddc4Srjs fprintf(fp, "%*sSparse: %s\n", indent, "", values->sparse ? "true" : "false"); 387096c5ddc4Srjs fprintf(fp, "%*sYUV Transform Enable: %s\n", indent, "", values->yuv_transform_enable ? "true" : "false"); 387196c5ddc4Srjs fprintf(fp, "%*sBody: 0x%" PRIx64 "\n", indent, "", values->body); 387296c5ddc4Srjs fprintf(fp, "%*sBody Size: %u\n", indent, "", values->body_size); 387396c5ddc4Srjs} 387496c5ddc4Srjs 387596c5ddc4Srjsstruct MALI_RT_CLEAR { 387696c5ddc4Srjs uint32_t color_0; 387796c5ddc4Srjs uint32_t color_1; 387896c5ddc4Srjs uint32_t color_2; 387996c5ddc4Srjs uint32_t color_3; 388096c5ddc4Srjs}; 388196c5ddc4Srjs 388296c5ddc4Srjs#define MALI_RT_CLEAR_header \ 388396c5ddc4Srjs 0 388496c5ddc4Srjs 388596c5ddc4Srjsstatic inline void 388696c5ddc4SrjsMALI_RT_CLEAR_pack(uint32_t * restrict cl, 388796c5ddc4Srjs const struct MALI_RT_CLEAR * restrict values) 388896c5ddc4Srjs{ 388996c5ddc4Srjs cl[ 0] = __gen_uint(values->color_0, 0, 31); 389096c5ddc4Srjs cl[ 1] = __gen_uint(values->color_1, 0, 31); 389196c5ddc4Srjs cl[ 2] = __gen_uint(values->color_2, 0, 31); 389296c5ddc4Srjs cl[ 3] = __gen_uint(values->color_3, 0, 31); 389396c5ddc4Srjs} 389496c5ddc4Srjs 389596c5ddc4Srjs 389696c5ddc4Srjs#define MALI_RT_CLEAR_LENGTH 16 389796c5ddc4Srjsstruct mali_rt_clear_packed { uint32_t opaque[4]; }; 389896c5ddc4Srjsstatic inline void 389996c5ddc4SrjsMALI_RT_CLEAR_unpack(const uint8_t * restrict cl, 390096c5ddc4Srjs struct MALI_RT_CLEAR * restrict values) 390196c5ddc4Srjs{ 390296c5ddc4Srjs values->color_0 = __gen_unpack_uint(cl, 0, 31); 390396c5ddc4Srjs values->color_1 = __gen_unpack_uint(cl, 32, 63); 390496c5ddc4Srjs values->color_2 = __gen_unpack_uint(cl, 64, 95); 390596c5ddc4Srjs values->color_3 = __gen_unpack_uint(cl, 96, 127); 390696c5ddc4Srjs} 390796c5ddc4Srjs 390896c5ddc4Srjsstatic inline void 390996c5ddc4SrjsMALI_RT_CLEAR_print(FILE *fp, const struct MALI_RT_CLEAR * values, unsigned indent) 391096c5ddc4Srjs{ 391196c5ddc4Srjs fprintf(fp, "%*sColor 0: %u\n", indent, "", values->color_0); 391296c5ddc4Srjs fprintf(fp, "%*sColor 1: %u\n", indent, "", values->color_1); 391396c5ddc4Srjs fprintf(fp, "%*sColor 2: %u\n", indent, "", values->color_2); 391496c5ddc4Srjs fprintf(fp, "%*sColor 3: %u\n", indent, "", values->color_3); 391596c5ddc4Srjs} 391696c5ddc4Srjs 391796c5ddc4Srjsstruct MALI_RENDER_TARGET { 391896c5ddc4Srjs struct MALI_RENDER_TARGET_YUV_OVERLAY yuv; 391996c5ddc4Srjs struct MALI_RENDER_TARGET_AFBC_OVERLAY afbc; 392096c5ddc4Srjs uint32_t internal_buffer_offset; 392196c5ddc4Srjs bool yuv_enable; 392296c5ddc4Srjs enum mali_color_buffer_internal_format internal_format; 392396c5ddc4Srjs bool write_enable; 392496c5ddc4Srjs enum mali_color_format writeback_format; 392596c5ddc4Srjs enum mali_rt_endianness writeback_endianness; 392696c5ddc4Srjs enum mali_block_format writeback_block_format; 392796c5ddc4Srjs enum mali_msaa writeback_msaa; 392896c5ddc4Srjs bool srgb; 392996c5ddc4Srjs bool dithering_enable; 393096c5ddc4Srjs uint32_t swizzle; 393196c5ddc4Srjs enum mali_downsampling_accumulation_mode writeback_sampling_mode; 393296c5ddc4Srjs bool clean_pixel_write_enable; 393396c5ddc4Srjs bool preload_enable; 393496c5ddc4Srjs bool unload_enable; 393596c5ddc4Srjs enum mali_color_format preload_format; 393696c5ddc4Srjs enum mali_rt_endianness preload_endianness; 393796c5ddc4Srjs enum mali_block_format preload_block_format; 393896c5ddc4Srjs enum mali_msaa preload_msaa; 393996c5ddc4Srjs struct MALI_RT_BUFFER rgb; 394096c5ddc4Srjs struct MALI_RT_BUFFER preload_buffer; 394196c5ddc4Srjs struct MALI_RT_CLEAR clear; 394296c5ddc4Srjs}; 394396c5ddc4Srjs 394496c5ddc4Srjs#define MALI_RENDER_TARGET_header \ 394596c5ddc4Srjs .yuv = { MALI_RENDER_TARGET_YUV_OVERLAY_header }, \ 394696c5ddc4Srjs .afbc = { MALI_RENDER_TARGET_AFBC_OVERLAY_header }, \ 394796c5ddc4Srjs .rgb = { MALI_RT_BUFFER_header }, \ 394896c5ddc4Srjs .preload_buffer = { MALI_RT_BUFFER_header }, \ 394996c5ddc4Srjs .clear = { MALI_RT_CLEAR_header } 395096c5ddc4Srjs 395196c5ddc4Srjsstatic inline void 395296c5ddc4SrjsMALI_RENDER_TARGET_pack(uint32_t * restrict cl, 395396c5ddc4Srjs const struct MALI_RENDER_TARGET * restrict values) 395496c5ddc4Srjs{ 395596c5ddc4Srjs assert((values->internal_buffer_offset & 0xf) == 0); 395696c5ddc4Srjs cl[ 0] = __gen_uint(values->internal_buffer_offset >> 4, 4, 15) | 395796c5ddc4Srjs __gen_uint(values->yuv_enable, 24, 24) | 395896c5ddc4Srjs __gen_uint(values->internal_format, 26, 31); 395996c5ddc4Srjs cl[ 1] = __gen_uint(values->write_enable, 0, 0) | 396096c5ddc4Srjs __gen_uint(values->writeback_format, 3, 7) | 396196c5ddc4Srjs __gen_uint(values->writeback_endianness, 8, 9) | 396296c5ddc4Srjs __gen_uint(values->writeback_block_format, 10, 11) | 396396c5ddc4Srjs __gen_uint(values->writeback_msaa, 12, 13) | 396496c5ddc4Srjs __gen_uint(values->srgb, 14, 14) | 396596c5ddc4Srjs __gen_uint(values->dithering_enable, 15, 15) | 396696c5ddc4Srjs __gen_uint(values->swizzle, 16, 27) | 396796c5ddc4Srjs __gen_uint(values->writeback_sampling_mode, 29, 30) | 396896c5ddc4Srjs __gen_uint(values->clean_pixel_write_enable, 31, 31); 396996c5ddc4Srjs cl[ 2] = __gen_uint(values->yuv.conv_k5, 16, 23) | 397096c5ddc4Srjs __gen_uint(values->yuv.conv_k6, 24, 24) | 397196c5ddc4Srjs __gen_uint(values->yuv.conv_k7_clamp, 25, 26) | 397296c5ddc4Srjs __gen_uint(values->yuv.conv_k8, 27, 27) | 397396c5ddc4Srjs __gen_uint(values->yuv.conv_disable, 31, 31) | 397496c5ddc4Srjs __gen_uint(values->preload_enable, 0, 0) | 397596c5ddc4Srjs __gen_uint(values->unload_enable, 1, 1) | 397696c5ddc4Srjs __gen_uint(values->preload_format, 3, 7) | 397796c5ddc4Srjs __gen_uint(values->preload_endianness, 8, 9) | 397896c5ddc4Srjs __gen_uint(values->preload_block_format, 10, 13) | 397996c5ddc4Srjs __gen_uint(values->preload_msaa, 14, 15); 398096c5ddc4Srjs cl[ 3] = __gen_uint(values->yuv.conv_k1, 0, 7) | 398196c5ddc4Srjs __gen_uint(values->yuv.conv_k2, 8, 15) | 398296c5ddc4Srjs __gen_uint(values->yuv.conv_k3, 16, 23) | 398396c5ddc4Srjs __gen_uint(values->yuv.conv_k4, 24, 31); 398496c5ddc4Srjs cl[ 4] = __gen_uint(values->yuv.plane_0_base, 0, 63) | 398596c5ddc4Srjs __gen_uint(values->afbc.header, 0, 63); 398696c5ddc4Srjs cl[ 5] = __gen_uint(values->yuv.plane_0_base, 0, 63) >> 32 | 398796c5ddc4Srjs __gen_uint(values->afbc.header, 0, 63) >> 32; 398896c5ddc4Srjs cl[ 6] = __gen_uint(values->yuv.plane_1_base, 0, 63) | 398996c5ddc4Srjs __gen_uint(values->afbc.row_stride, 0, 12); 399096c5ddc4Srjs cl[ 7] = __gen_uint(values->yuv.plane_1_base, 0, 63) >> 32 | 399196c5ddc4Srjs __gen_uint(values->afbc.chunk_size, 0, 11) | 399296c5ddc4Srjs __gen_uint(values->afbc.sparse, 16, 16) | 399396c5ddc4Srjs __gen_uint(values->afbc.yuv_transform_enable, 17, 17); 399496c5ddc4Srjs cl[ 8] = __gen_uint(values->yuv.plane_2_base, 0, 63) | 399596c5ddc4Srjs __gen_uint(values->afbc.body, 0, 63) | 399696c5ddc4Srjs __gen_uint(values->rgb.base, 0, 63); 399796c5ddc4Srjs cl[ 9] = __gen_uint(values->yuv.plane_2_base, 0, 63) >> 32 | 399896c5ddc4Srjs __gen_uint(values->afbc.body, 0, 63) >> 32 | 399996c5ddc4Srjs __gen_uint(values->rgb.base, 0, 63) >> 32; 400096c5ddc4Srjs cl[10] = __gen_uint(values->yuv.plane_0_stride, 0, 31) | 400196c5ddc4Srjs __gen_uint(values->afbc.body_size, 0, 31) | 400296c5ddc4Srjs __gen_uint(values->rgb.row_stride, 0, 31); 400396c5ddc4Srjs cl[11] = __gen_uint(values->yuv.plane_1_2_stride, 0, 31) | 400496c5ddc4Srjs __gen_uint(values->rgb.surface_stride, 0, 31); 400596c5ddc4Srjs cl[12] = __gen_uint(values->preload_buffer.base, 0, 63) | 400696c5ddc4Srjs __gen_uint(values->clear.color_0, 0, 31); 400796c5ddc4Srjs cl[13] = __gen_uint(values->preload_buffer.base, 0, 63) >> 32 | 400896c5ddc4Srjs __gen_uint(values->clear.color_1, 0, 31); 400996c5ddc4Srjs cl[14] = __gen_uint(values->preload_buffer.row_stride, 0, 31) | 401096c5ddc4Srjs __gen_uint(values->clear.color_2, 0, 31); 401196c5ddc4Srjs cl[15] = __gen_uint(values->preload_buffer.surface_stride, 0, 31) | 401296c5ddc4Srjs __gen_uint(values->clear.color_3, 0, 31); 401396c5ddc4Srjs} 401496c5ddc4Srjs 401596c5ddc4Srjs 401696c5ddc4Srjs#define MALI_RENDER_TARGET_LENGTH 64 401796c5ddc4Srjs#define MALI_RENDER_TARGET_ALIGN 64 401896c5ddc4Srjsstruct mali_render_target_packed { uint32_t opaque[16]; }; 401996c5ddc4Srjsstatic inline void 402096c5ddc4SrjsMALI_RENDER_TARGET_unpack(const uint8_t * restrict cl, 402196c5ddc4Srjs struct MALI_RENDER_TARGET * restrict values) 402296c5ddc4Srjs{ 402396c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0x2ff000f) fprintf(stderr, "XXX: Invalid field of Render Target unpacked at word 0\n"); 402496c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0x10000006) fprintf(stderr, "XXX: Invalid field of Render Target unpacked at word 1\n"); 402596c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0x70000004) fprintf(stderr, "XXX: Invalid field of Render Target unpacked at word 2\n"); 402696c5ddc4Srjs values->yuv.conv_k5 = __gen_unpack_uint(cl, 80, 87); 402796c5ddc4Srjs values->yuv.conv_k6 = (enum mali_yuv_conv_k6)__gen_unpack_uint(cl, 88, 88); 402896c5ddc4Srjs values->yuv.conv_k7_clamp = (enum mali_yuv_conv_k7_clamp)__gen_unpack_uint(cl, 89, 90); 402996c5ddc4Srjs values->yuv.conv_k8 = (enum mali_yuv_conv_k8)__gen_unpack_uint(cl, 91, 91); 403096c5ddc4Srjs values->yuv.conv_disable = __gen_unpack_uint(cl, 95, 95); 403196c5ddc4Srjs values->yuv.conv_k1 = __gen_unpack_uint(cl, 96, 103); 403296c5ddc4Srjs values->yuv.conv_k2 = __gen_unpack_uint(cl, 104, 111); 403396c5ddc4Srjs values->yuv.conv_k3 = __gen_unpack_uint(cl, 112, 119); 403496c5ddc4Srjs values->yuv.conv_k4 = __gen_unpack_uint(cl, 120, 127); 403596c5ddc4Srjs values->yuv.plane_0_base = __gen_unpack_uint(cl, 128, 191); 403696c5ddc4Srjs values->yuv.plane_1_base = __gen_unpack_uint(cl, 192, 255); 403796c5ddc4Srjs values->yuv.plane_2_base = __gen_unpack_uint(cl, 256, 319); 403896c5ddc4Srjs values->yuv.plane_0_stride = __gen_unpack_uint(cl, 320, 351); 403996c5ddc4Srjs values->yuv.plane_1_2_stride = __gen_unpack_uint(cl, 352, 383); 404096c5ddc4Srjs values->afbc.header = __gen_unpack_uint(cl, 128, 191); 404196c5ddc4Srjs values->afbc.row_stride = __gen_unpack_uint(cl, 192, 204); 404296c5ddc4Srjs values->afbc.chunk_size = __gen_unpack_uint(cl, 224, 235); 404396c5ddc4Srjs values->afbc.sparse = __gen_unpack_uint(cl, 240, 240); 404496c5ddc4Srjs values->afbc.yuv_transform_enable = __gen_unpack_uint(cl, 241, 241); 404596c5ddc4Srjs values->afbc.body = __gen_unpack_uint(cl, 256, 319); 404696c5ddc4Srjs values->afbc.body_size = __gen_unpack_uint(cl, 320, 351); 404796c5ddc4Srjs values->internal_buffer_offset = __gen_unpack_uint(cl, 4, 15) << 4; 404896c5ddc4Srjs values->yuv_enable = __gen_unpack_uint(cl, 24, 24); 404996c5ddc4Srjs values->internal_format = (enum mali_color_buffer_internal_format)__gen_unpack_uint(cl, 26, 31); 405096c5ddc4Srjs values->write_enable = __gen_unpack_uint(cl, 32, 32); 405196c5ddc4Srjs values->writeback_format = (enum mali_color_format)__gen_unpack_uint(cl, 35, 39); 405296c5ddc4Srjs values->writeback_endianness = (enum mali_rt_endianness)__gen_unpack_uint(cl, 40, 41); 405396c5ddc4Srjs values->writeback_block_format = (enum mali_block_format)__gen_unpack_uint(cl, 42, 43); 405496c5ddc4Srjs values->writeback_msaa = (enum mali_msaa)__gen_unpack_uint(cl, 44, 45); 405596c5ddc4Srjs values->srgb = __gen_unpack_uint(cl, 46, 46); 405696c5ddc4Srjs values->dithering_enable = __gen_unpack_uint(cl, 47, 47); 405796c5ddc4Srjs values->swizzle = __gen_unpack_uint(cl, 48, 59); 405896c5ddc4Srjs values->writeback_sampling_mode = (enum mali_downsampling_accumulation_mode)__gen_unpack_uint(cl, 61, 62); 405996c5ddc4Srjs values->clean_pixel_write_enable = __gen_unpack_uint(cl, 63, 63); 406096c5ddc4Srjs values->preload_enable = __gen_unpack_uint(cl, 64, 64); 406196c5ddc4Srjs values->unload_enable = __gen_unpack_uint(cl, 65, 65); 406296c5ddc4Srjs values->preload_format = (enum mali_color_format)__gen_unpack_uint(cl, 67, 71); 406396c5ddc4Srjs values->preload_endianness = (enum mali_rt_endianness)__gen_unpack_uint(cl, 72, 73); 406496c5ddc4Srjs values->preload_block_format = (enum mali_block_format)__gen_unpack_uint(cl, 74, 77); 406596c5ddc4Srjs values->preload_msaa = (enum mali_msaa)__gen_unpack_uint(cl, 78, 79); 406696c5ddc4Srjs values->rgb.base = __gen_unpack_uint(cl, 256, 319); 406796c5ddc4Srjs values->rgb.row_stride = __gen_unpack_uint(cl, 320, 351); 406896c5ddc4Srjs values->rgb.surface_stride = __gen_unpack_uint(cl, 352, 383); 406996c5ddc4Srjs values->preload_buffer.base = __gen_unpack_uint(cl, 384, 447); 407096c5ddc4Srjs values->preload_buffer.row_stride = __gen_unpack_uint(cl, 448, 479); 407196c5ddc4Srjs values->preload_buffer.surface_stride = __gen_unpack_uint(cl, 480, 511); 407296c5ddc4Srjs values->clear.color_0 = __gen_unpack_uint(cl, 384, 415); 407396c5ddc4Srjs values->clear.color_1 = __gen_unpack_uint(cl, 416, 447); 407496c5ddc4Srjs values->clear.color_2 = __gen_unpack_uint(cl, 448, 479); 407596c5ddc4Srjs values->clear.color_3 = __gen_unpack_uint(cl, 480, 511); 407696c5ddc4Srjs} 407796c5ddc4Srjs 407896c5ddc4Srjsstatic inline void 407996c5ddc4SrjsMALI_RENDER_TARGET_print(FILE *fp, const struct MALI_RENDER_TARGET * values, unsigned indent) 408096c5ddc4Srjs{ 408196c5ddc4Srjs fprintf(fp, "%*sYUV:\n", indent, ""); 408296c5ddc4Srjs MALI_RENDER_TARGET_YUV_OVERLAY_print(fp, &values->yuv, indent + 2); 408396c5ddc4Srjs fprintf(fp, "%*sAFBC:\n", indent, ""); 408496c5ddc4Srjs MALI_RENDER_TARGET_AFBC_OVERLAY_print(fp, &values->afbc, indent + 2); 408596c5ddc4Srjs fprintf(fp, "%*sInternal Buffer Offset: %u\n", indent, "", values->internal_buffer_offset); 408696c5ddc4Srjs fprintf(fp, "%*sYUV Enable: %s\n", indent, "", values->yuv_enable ? "true" : "false"); 408796c5ddc4Srjs fprintf(fp, "%*sInternal Format: %s\n", indent, "", mali_color_buffer_internal_format_as_str(values->internal_format)); 408896c5ddc4Srjs fprintf(fp, "%*sWrite Enable: %s\n", indent, "", values->write_enable ? "true" : "false"); 408996c5ddc4Srjs fprintf(fp, "%*sWriteback Format: %s\n", indent, "", mali_color_format_as_str(values->writeback_format)); 409096c5ddc4Srjs fprintf(fp, "%*sWriteback Endianness: %s\n", indent, "", mali_rt_endianness_as_str(values->writeback_endianness)); 409196c5ddc4Srjs fprintf(fp, "%*sWriteback Block Format: %s\n", indent, "", mali_block_format_as_str(values->writeback_block_format)); 409296c5ddc4Srjs fprintf(fp, "%*sWriteback MSAA: %s\n", indent, "", mali_msaa_as_str(values->writeback_msaa)); 409396c5ddc4Srjs fprintf(fp, "%*ssRGB: %s\n", indent, "", values->srgb ? "true" : "false"); 409496c5ddc4Srjs fprintf(fp, "%*sDithering Enable: %s\n", indent, "", values->dithering_enable ? "true" : "false"); 409596c5ddc4Srjs fprintf(fp, "%*sSwizzle: %u\n", indent, "", values->swizzle); 409696c5ddc4Srjs fprintf(fp, "%*sWriteback Sampling Mode: %s\n", indent, "", mali_downsampling_accumulation_mode_as_str(values->writeback_sampling_mode)); 409796c5ddc4Srjs fprintf(fp, "%*sClean Pixel Write Enable: %s\n", indent, "", values->clean_pixel_write_enable ? "true" : "false"); 409896c5ddc4Srjs fprintf(fp, "%*sPreload Enable: %s\n", indent, "", values->preload_enable ? "true" : "false"); 409996c5ddc4Srjs fprintf(fp, "%*sUnload Enable: %s\n", indent, "", values->unload_enable ? "true" : "false"); 410096c5ddc4Srjs fprintf(fp, "%*sPreload Format: %s\n", indent, "", mali_color_format_as_str(values->preload_format)); 410196c5ddc4Srjs fprintf(fp, "%*sPreload Endianness: %s\n", indent, "", mali_rt_endianness_as_str(values->preload_endianness)); 410296c5ddc4Srjs fprintf(fp, "%*sPreload Block Format: %s\n", indent, "", mali_block_format_as_str(values->preload_block_format)); 410396c5ddc4Srjs fprintf(fp, "%*sPreload MSAA: %s\n", indent, "", mali_msaa_as_str(values->preload_msaa)); 410496c5ddc4Srjs fprintf(fp, "%*sRGB:\n", indent, ""); 410596c5ddc4Srjs MALI_RT_BUFFER_print(fp, &values->rgb, indent + 2); 410696c5ddc4Srjs fprintf(fp, "%*sPreload buffer:\n", indent, ""); 410796c5ddc4Srjs MALI_RT_BUFFER_print(fp, &values->preload_buffer, indent + 2); 410896c5ddc4Srjs fprintf(fp, "%*sClear:\n", indent, ""); 410996c5ddc4Srjs MALI_RT_CLEAR_print(fp, &values->clear, indent + 2); 411096c5ddc4Srjs} 411196c5ddc4Srjs 411296c5ddc4Srjsstruct mali_framebuffer_packed { 411396c5ddc4Srjs uint32_t opaque[32]; 411496c5ddc4Srjs}; 411596c5ddc4Srjs 411696c5ddc4Srjs#define MALI_FRAMEBUFFER_LENGTH 128 411796c5ddc4Srjs#define MALI_FRAMEBUFFER_ALIGN 64 411896c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_LOCAL_STORAGE_TYPE struct MALI_LOCAL_STORAGE 411996c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_LOCAL_STORAGE_header MALI_LOCAL_STORAGE_header 412096c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_LOCAL_STORAGE_pack MALI_LOCAL_STORAGE_pack 412196c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_LOCAL_STORAGE_unpack MALI_LOCAL_STORAGE_unpack 412296c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_LOCAL_STORAGE_print MALI_LOCAL_STORAGE_print 412396c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_LOCAL_STORAGE_OFFSET 0 412496c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_TYPE struct MALI_FRAMEBUFFER_PARAMETERS 412596c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_header MALI_FRAMEBUFFER_PARAMETERS_header 412696c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_pack MALI_FRAMEBUFFER_PARAMETERS_pack 412796c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_unpack MALI_FRAMEBUFFER_PARAMETERS_unpack 412896c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_print MALI_FRAMEBUFFER_PARAMETERS_print 412996c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_PARAMETERS_OFFSET 32 413096c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_TYPE struct MALI_TILER_CONTEXT 413196c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_header MALI_TILER_CONTEXT_header 413296c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_pack MALI_TILER_CONTEXT_pack 413396c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_unpack MALI_TILER_CONTEXT_unpack 413496c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_print MALI_TILER_CONTEXT_print 413596c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_OFFSET 56 413696c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_WEIGHTS_TYPE struct MALI_TILER_WEIGHTS 413796c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_WEIGHTS_header MALI_TILER_WEIGHTS_header 413896c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_WEIGHTS_pack MALI_TILER_WEIGHTS_pack 413996c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_WEIGHTS_unpack MALI_TILER_WEIGHTS_unpack 414096c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_WEIGHTS_print MALI_TILER_WEIGHTS_print 414196c5ddc4Srjs#define MALI_FRAMEBUFFER_SECTION_TILER_WEIGHTS_OFFSET 96 414296c5ddc4Srjs 414396c5ddc4Srjsstruct MALI_JOB_HEADER { 414496c5ddc4Srjs uint32_t exception_status; 414596c5ddc4Srjs uint32_t first_incomplete_task; 414696c5ddc4Srjs uint64_t fault_pointer; 414796c5ddc4Srjs bool is_64b; 414896c5ddc4Srjs enum mali_job_type type; 414996c5ddc4Srjs bool barrier; 415096c5ddc4Srjs bool invalidate_cache; 415196c5ddc4Srjs bool suppress_prefetch; 415296c5ddc4Srjs bool enable_texture_mapper; 415396c5ddc4Srjs bool relax_dependency_1; 415496c5ddc4Srjs bool relax_dependency_2; 415596c5ddc4Srjs uint32_t index; 415696c5ddc4Srjs uint32_t dependency_1; 415796c5ddc4Srjs uint32_t dependency_2; 415896c5ddc4Srjs uint64_t next; 415996c5ddc4Srjs}; 416096c5ddc4Srjs 416196c5ddc4Srjs#define MALI_JOB_HEADER_header \ 416296c5ddc4Srjs .is_64b = true 416396c5ddc4Srjs 416496c5ddc4Srjsstatic inline void 416596c5ddc4SrjsMALI_JOB_HEADER_pack(uint32_t * restrict cl, 416696c5ddc4Srjs const struct MALI_JOB_HEADER * restrict values) 416796c5ddc4Srjs{ 416896c5ddc4Srjs cl[ 0] = __gen_uint(values->exception_status, 0, 31); 416996c5ddc4Srjs cl[ 1] = __gen_uint(values->first_incomplete_task, 0, 31); 417096c5ddc4Srjs cl[ 2] = __gen_uint(values->fault_pointer, 0, 63); 417196c5ddc4Srjs cl[ 3] = __gen_uint(values->fault_pointer, 0, 63) >> 32; 417296c5ddc4Srjs cl[ 4] = __gen_uint(values->is_64b, 0, 0) | 417396c5ddc4Srjs __gen_uint(values->type, 1, 7) | 417496c5ddc4Srjs __gen_uint(values->barrier, 8, 8) | 417596c5ddc4Srjs __gen_uint(values->invalidate_cache, 9, 9) | 417696c5ddc4Srjs __gen_uint(values->suppress_prefetch, 11, 11) | 417796c5ddc4Srjs __gen_uint(values->enable_texture_mapper, 12, 12) | 417896c5ddc4Srjs __gen_uint(values->relax_dependency_1, 14, 14) | 417996c5ddc4Srjs __gen_uint(values->relax_dependency_2, 15, 15) | 418096c5ddc4Srjs __gen_uint(values->index, 16, 31); 418196c5ddc4Srjs cl[ 5] = __gen_uint(values->dependency_1, 0, 15) | 418296c5ddc4Srjs __gen_uint(values->dependency_2, 16, 31); 418396c5ddc4Srjs cl[ 6] = __gen_uint(values->next, 0, 63); 418496c5ddc4Srjs cl[ 7] = __gen_uint(values->next, 0, 63) >> 32; 418596c5ddc4Srjs} 418696c5ddc4Srjs 418796c5ddc4Srjs 418896c5ddc4Srjs#define MALI_JOB_HEADER_LENGTH 32 418996c5ddc4Srjs#define MALI_JOB_HEADER_ALIGN 64 419096c5ddc4Srjsstruct mali_job_header_packed { uint32_t opaque[8]; }; 419196c5ddc4Srjsstatic inline void 419296c5ddc4SrjsMALI_JOB_HEADER_unpack(const uint8_t * restrict cl, 419396c5ddc4Srjs struct MALI_JOB_HEADER * restrict values) 419496c5ddc4Srjs{ 419596c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0x2400) fprintf(stderr, "XXX: Invalid field of Job Header unpacked at word 4\n"); 419696c5ddc4Srjs values->exception_status = __gen_unpack_uint(cl, 0, 31); 419796c5ddc4Srjs values->first_incomplete_task = __gen_unpack_uint(cl, 32, 63); 419896c5ddc4Srjs values->fault_pointer = __gen_unpack_uint(cl, 64, 127); 419996c5ddc4Srjs values->is_64b = __gen_unpack_uint(cl, 128, 128); 420096c5ddc4Srjs values->type = (enum mali_job_type)__gen_unpack_uint(cl, 129, 135); 420196c5ddc4Srjs values->barrier = __gen_unpack_uint(cl, 136, 136); 420296c5ddc4Srjs values->invalidate_cache = __gen_unpack_uint(cl, 137, 137); 420396c5ddc4Srjs values->suppress_prefetch = __gen_unpack_uint(cl, 139, 139); 420496c5ddc4Srjs values->enable_texture_mapper = __gen_unpack_uint(cl, 140, 140); 420596c5ddc4Srjs values->relax_dependency_1 = __gen_unpack_uint(cl, 142, 142); 420696c5ddc4Srjs values->relax_dependency_2 = __gen_unpack_uint(cl, 143, 143); 420796c5ddc4Srjs values->index = __gen_unpack_uint(cl, 144, 159); 420896c5ddc4Srjs values->dependency_1 = __gen_unpack_uint(cl, 160, 175); 420996c5ddc4Srjs values->dependency_2 = __gen_unpack_uint(cl, 176, 191); 421096c5ddc4Srjs values->next = __gen_unpack_uint(cl, 192, 255); 421196c5ddc4Srjs} 421296c5ddc4Srjs 421396c5ddc4Srjsstatic inline void 421496c5ddc4SrjsMALI_JOB_HEADER_print(FILE *fp, const struct MALI_JOB_HEADER * values, unsigned indent) 421596c5ddc4Srjs{ 421696c5ddc4Srjs fprintf(fp, "%*sException Status: %u\n", indent, "", values->exception_status); 421796c5ddc4Srjs fprintf(fp, "%*sFirst Incomplete Task: %u\n", indent, "", values->first_incomplete_task); 421896c5ddc4Srjs fprintf(fp, "%*sFault Pointer: 0x%" PRIx64 "\n", indent, "", values->fault_pointer); 421996c5ddc4Srjs fprintf(fp, "%*sIs 64b: %s\n", indent, "", values->is_64b ? "true" : "false"); 422096c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_job_type_as_str(values->type)); 422196c5ddc4Srjs fprintf(fp, "%*sBarrier: %s\n", indent, "", values->barrier ? "true" : "false"); 422296c5ddc4Srjs fprintf(fp, "%*sInvalidate Cache: %s\n", indent, "", values->invalidate_cache ? "true" : "false"); 422396c5ddc4Srjs fprintf(fp, "%*sSuppress Prefetch: %s\n", indent, "", values->suppress_prefetch ? "true" : "false"); 422496c5ddc4Srjs fprintf(fp, "%*sEnable Texture Mapper: %s\n", indent, "", values->enable_texture_mapper ? "true" : "false"); 422596c5ddc4Srjs fprintf(fp, "%*sRelax Dependency 1: %s\n", indent, "", values->relax_dependency_1 ? "true" : "false"); 422696c5ddc4Srjs fprintf(fp, "%*sRelax Dependency 2: %s\n", indent, "", values->relax_dependency_2 ? "true" : "false"); 422796c5ddc4Srjs fprintf(fp, "%*sIndex: %u\n", indent, "", values->index); 422896c5ddc4Srjs fprintf(fp, "%*sDependency 1: %u\n", indent, "", values->dependency_1); 422996c5ddc4Srjs fprintf(fp, "%*sDependency 2: %u\n", indent, "", values->dependency_2); 423096c5ddc4Srjs fprintf(fp, "%*sNext: 0x%" PRIx64 "\n", indent, "", values->next); 423196c5ddc4Srjs} 423296c5ddc4Srjs 423396c5ddc4Srjsstruct MALI_FRAGMENT_JOB_PAYLOAD { 423496c5ddc4Srjs uint32_t bound_min_x; 423596c5ddc4Srjs uint32_t bound_min_y; 423696c5ddc4Srjs uint32_t bound_max_x; 423796c5ddc4Srjs uint32_t bound_max_y; 423896c5ddc4Srjs bool has_tile_enable_map; 423996c5ddc4Srjs uint64_t framebuffer; 424096c5ddc4Srjs uint64_t tile_enable_map; 424196c5ddc4Srjs uint32_t tile_enable_map_row_stride; 424296c5ddc4Srjs}; 424396c5ddc4Srjs 424496c5ddc4Srjs#define MALI_FRAGMENT_JOB_PAYLOAD_header \ 424596c5ddc4Srjs 0 424696c5ddc4Srjs 424796c5ddc4Srjsstatic inline void 424896c5ddc4SrjsMALI_FRAGMENT_JOB_PAYLOAD_pack(uint32_t * restrict cl, 424996c5ddc4Srjs const struct MALI_FRAGMENT_JOB_PAYLOAD * restrict values) 425096c5ddc4Srjs{ 425196c5ddc4Srjs cl[ 0] = __gen_uint(values->bound_min_x, 0, 11) | 425296c5ddc4Srjs __gen_uint(values->bound_min_y, 16, 27); 425396c5ddc4Srjs cl[ 1] = __gen_uint(values->bound_max_x, 0, 11) | 425496c5ddc4Srjs __gen_uint(values->bound_max_y, 16, 27) | 425596c5ddc4Srjs __gen_uint(values->has_tile_enable_map, 31, 31); 425696c5ddc4Srjs cl[ 2] = __gen_uint(values->framebuffer, 0, 63); 425796c5ddc4Srjs cl[ 3] = __gen_uint(values->framebuffer, 0, 63) >> 32; 425896c5ddc4Srjs cl[ 4] = __gen_uint(values->tile_enable_map, 0, 63); 425996c5ddc4Srjs cl[ 5] = __gen_uint(values->tile_enable_map, 0, 63) >> 32; 426096c5ddc4Srjs cl[ 6] = __gen_uint(values->tile_enable_map_row_stride, 0, 7); 426196c5ddc4Srjs cl[ 7] = 0; 426296c5ddc4Srjs} 426396c5ddc4Srjs 426496c5ddc4Srjs 426596c5ddc4Srjs#define MALI_FRAGMENT_JOB_PAYLOAD_LENGTH 32 426696c5ddc4Srjsstruct mali_fragment_job_payload_packed { uint32_t opaque[8]; }; 426796c5ddc4Srjsstatic inline void 426896c5ddc4SrjsMALI_FRAGMENT_JOB_PAYLOAD_unpack(const uint8_t * restrict cl, 426996c5ddc4Srjs struct MALI_FRAGMENT_JOB_PAYLOAD * restrict values) 427096c5ddc4Srjs{ 427196c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xf000f000) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 0\n"); 427296c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0x7000f000) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 1\n"); 427396c5ddc4Srjs if (((const uint32_t *) cl)[6] & 0xffffff00) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 6\n"); 427496c5ddc4Srjs if (((const uint32_t *) cl)[7] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Fragment Job Payload unpacked at word 7\n"); 427596c5ddc4Srjs values->bound_min_x = __gen_unpack_uint(cl, 0, 11); 427696c5ddc4Srjs values->bound_min_y = __gen_unpack_uint(cl, 16, 27); 427796c5ddc4Srjs values->bound_max_x = __gen_unpack_uint(cl, 32, 43); 427896c5ddc4Srjs values->bound_max_y = __gen_unpack_uint(cl, 48, 59); 427996c5ddc4Srjs values->has_tile_enable_map = __gen_unpack_uint(cl, 63, 63); 428096c5ddc4Srjs values->framebuffer = __gen_unpack_uint(cl, 64, 127); 428196c5ddc4Srjs values->tile_enable_map = __gen_unpack_uint(cl, 128, 191); 428296c5ddc4Srjs values->tile_enable_map_row_stride = __gen_unpack_uint(cl, 192, 199); 428396c5ddc4Srjs} 428496c5ddc4Srjs 428596c5ddc4Srjsstatic inline void 428696c5ddc4SrjsMALI_FRAGMENT_JOB_PAYLOAD_print(FILE *fp, const struct MALI_FRAGMENT_JOB_PAYLOAD * values, unsigned indent) 428796c5ddc4Srjs{ 428896c5ddc4Srjs fprintf(fp, "%*sBound Min X: %u\n", indent, "", values->bound_min_x); 428996c5ddc4Srjs fprintf(fp, "%*sBound Min Y: %u\n", indent, "", values->bound_min_y); 429096c5ddc4Srjs fprintf(fp, "%*sBound Max X: %u\n", indent, "", values->bound_max_x); 429196c5ddc4Srjs fprintf(fp, "%*sBound Max Y: %u\n", indent, "", values->bound_max_y); 429296c5ddc4Srjs fprintf(fp, "%*sHas Tile Enable Map: %s\n", indent, "", values->has_tile_enable_map ? "true" : "false"); 429396c5ddc4Srjs fprintf(fp, "%*sFramebuffer: 0x%" PRIx64 "\n", indent, "", values->framebuffer); 429496c5ddc4Srjs fprintf(fp, "%*sTile Enable Map: 0x%" PRIx64 "\n", indent, "", values->tile_enable_map); 429596c5ddc4Srjs fprintf(fp, "%*sTile Enable Map Row Stride: %u\n", indent, "", values->tile_enable_map_row_stride); 429696c5ddc4Srjs} 429796c5ddc4Srjs 429896c5ddc4Srjsstruct mali_fragment_job_packed { 429996c5ddc4Srjs uint32_t opaque[16]; 430096c5ddc4Srjs}; 430196c5ddc4Srjs 430296c5ddc4Srjs#define MALI_FRAGMENT_JOB_LENGTH 64 430396c5ddc4Srjs#define MALI_FRAGMENT_JOB_ALIGN 64 430496c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 430596c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 430696c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 430796c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 430896c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 430996c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_HEADER_OFFSET 0 431096c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_TYPE struct MALI_FRAGMENT_JOB_PAYLOAD 431196c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_header MALI_FRAGMENT_JOB_PAYLOAD_header 431296c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_pack MALI_FRAGMENT_JOB_PAYLOAD_pack 431396c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_unpack MALI_FRAGMENT_JOB_PAYLOAD_unpack 431496c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_print MALI_FRAGMENT_JOB_PAYLOAD_print 431596c5ddc4Srjs#define MALI_FRAGMENT_JOB_SECTION_PAYLOAD_OFFSET 32 431696c5ddc4Srjs 431796c5ddc4Srjsenum mali_write_value_type { 431896c5ddc4Srjs MALI_WRITE_VALUE_TYPE_CYCLE_COUNTER = 1, 431996c5ddc4Srjs MALI_WRITE_VALUE_TYPE_SYSTEM_TIMESTAMP = 2, 432096c5ddc4Srjs MALI_WRITE_VALUE_TYPE_ZERO = 3, 432196c5ddc4Srjs}; 432296c5ddc4Srjs 432396c5ddc4Srjsstatic inline const char * 432496c5ddc4Srjsmali_write_value_type_as_str(enum mali_write_value_type imm) 432596c5ddc4Srjs{ 432696c5ddc4Srjs switch (imm) { 432796c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_CYCLE_COUNTER: return "Cycle Counter"; 432896c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_SYSTEM_TIMESTAMP: return "System Timestamp"; 432996c5ddc4Srjs case MALI_WRITE_VALUE_TYPE_ZERO: return "Zero"; 433096c5ddc4Srjs default: return "XXX: INVALID"; 433196c5ddc4Srjs } 433296c5ddc4Srjs} 433396c5ddc4Srjs 433496c5ddc4Srjsstruct MALI_WRITE_VALUE_JOB_PAYLOAD { 433596c5ddc4Srjs uint64_t address; 433696c5ddc4Srjs enum mali_write_value_type type; 433796c5ddc4Srjs}; 433896c5ddc4Srjs 433996c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_PAYLOAD_header \ 434096c5ddc4Srjs 0 434196c5ddc4Srjs 434296c5ddc4Srjsstatic inline void 434396c5ddc4SrjsMALI_WRITE_VALUE_JOB_PAYLOAD_pack(uint32_t * restrict cl, 434496c5ddc4Srjs const struct MALI_WRITE_VALUE_JOB_PAYLOAD * restrict values) 434596c5ddc4Srjs{ 434696c5ddc4Srjs cl[ 0] = __gen_uint(values->address, 0, 63); 434796c5ddc4Srjs cl[ 1] = __gen_uint(values->address, 0, 63) >> 32; 434896c5ddc4Srjs cl[ 2] = __gen_uint(values->type, 0, 31); 434996c5ddc4Srjs} 435096c5ddc4Srjs 435196c5ddc4Srjs 435296c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_PAYLOAD_LENGTH 12 435396c5ddc4Srjsstruct mali_write_value_job_payload_packed { uint32_t opaque[3]; }; 435496c5ddc4Srjsstatic inline void 435596c5ddc4SrjsMALI_WRITE_VALUE_JOB_PAYLOAD_unpack(const uint8_t * restrict cl, 435696c5ddc4Srjs struct MALI_WRITE_VALUE_JOB_PAYLOAD * restrict values) 435796c5ddc4Srjs{ 435896c5ddc4Srjs values->address = __gen_unpack_uint(cl, 0, 63); 435996c5ddc4Srjs values->type = (enum mali_write_value_type)__gen_unpack_uint(cl, 64, 95); 436096c5ddc4Srjs} 436196c5ddc4Srjs 436296c5ddc4Srjsstatic inline void 436396c5ddc4SrjsMALI_WRITE_VALUE_JOB_PAYLOAD_print(FILE *fp, const struct MALI_WRITE_VALUE_JOB_PAYLOAD * values, unsigned indent) 436496c5ddc4Srjs{ 436596c5ddc4Srjs fprintf(fp, "%*sAddress: 0x%" PRIx64 "\n", indent, "", values->address); 436696c5ddc4Srjs fprintf(fp, "%*sType: %s\n", indent, "", mali_write_value_type_as_str(values->type)); 436796c5ddc4Srjs} 436896c5ddc4Srjs 436996c5ddc4Srjsstruct MALI_CACHE_FLUSH_JOB_PAYLOAD { 437096c5ddc4Srjs bool clean_shader_core_ls; 437196c5ddc4Srjs bool invalidate_shader_core_ls; 437296c5ddc4Srjs bool invalidate_shader_core_other; 437396c5ddc4Srjs bool job_manager_clean; 437496c5ddc4Srjs bool job_manager_invalidate; 437596c5ddc4Srjs bool tiler_clean; 437696c5ddc4Srjs bool tiler_invalidate; 437796c5ddc4Srjs bool l2_clean; 437896c5ddc4Srjs bool l2_invalidate; 437996c5ddc4Srjs}; 438096c5ddc4Srjs 438196c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_PAYLOAD_header \ 438296c5ddc4Srjs 0 438396c5ddc4Srjs 438496c5ddc4Srjsstatic inline void 438596c5ddc4SrjsMALI_CACHE_FLUSH_JOB_PAYLOAD_pack(uint32_t * restrict cl, 438696c5ddc4Srjs const struct MALI_CACHE_FLUSH_JOB_PAYLOAD * restrict values) 438796c5ddc4Srjs{ 438896c5ddc4Srjs cl[ 0] = __gen_uint(values->clean_shader_core_ls, 0, 0) | 438996c5ddc4Srjs __gen_uint(values->invalidate_shader_core_ls, 1, 1) | 439096c5ddc4Srjs __gen_uint(values->invalidate_shader_core_other, 2, 2) | 439196c5ddc4Srjs __gen_uint(values->job_manager_clean, 16, 16) | 439296c5ddc4Srjs __gen_uint(values->job_manager_invalidate, 17, 17) | 439396c5ddc4Srjs __gen_uint(values->tiler_clean, 24, 24) | 439496c5ddc4Srjs __gen_uint(values->tiler_invalidate, 25, 25); 439596c5ddc4Srjs cl[ 1] = __gen_uint(values->l2_clean, 0, 0) | 439696c5ddc4Srjs __gen_uint(values->l2_invalidate, 1, 1); 439796c5ddc4Srjs} 439896c5ddc4Srjs 439996c5ddc4Srjs 440096c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_PAYLOAD_LENGTH 8 440196c5ddc4Srjsstruct mali_cache_flush_job_payload_packed { uint32_t opaque[2]; }; 440296c5ddc4Srjsstatic inline void 440396c5ddc4SrjsMALI_CACHE_FLUSH_JOB_PAYLOAD_unpack(const uint8_t * restrict cl, 440496c5ddc4Srjs struct MALI_CACHE_FLUSH_JOB_PAYLOAD * restrict values) 440596c5ddc4Srjs{ 440696c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xfcfcfff8) fprintf(stderr, "XXX: Invalid field of Cache Flush Job Payload unpacked at word 0\n"); 440796c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xfffffffc) fprintf(stderr, "XXX: Invalid field of Cache Flush Job Payload unpacked at word 1\n"); 440896c5ddc4Srjs values->clean_shader_core_ls = __gen_unpack_uint(cl, 0, 0); 440996c5ddc4Srjs values->invalidate_shader_core_ls = __gen_unpack_uint(cl, 1, 1); 441096c5ddc4Srjs values->invalidate_shader_core_other = __gen_unpack_uint(cl, 2, 2); 441196c5ddc4Srjs values->job_manager_clean = __gen_unpack_uint(cl, 16, 16); 441296c5ddc4Srjs values->job_manager_invalidate = __gen_unpack_uint(cl, 17, 17); 441396c5ddc4Srjs values->tiler_clean = __gen_unpack_uint(cl, 24, 24); 441496c5ddc4Srjs values->tiler_invalidate = __gen_unpack_uint(cl, 25, 25); 441596c5ddc4Srjs values->l2_clean = __gen_unpack_uint(cl, 32, 32); 441696c5ddc4Srjs values->l2_invalidate = __gen_unpack_uint(cl, 33, 33); 441796c5ddc4Srjs} 441896c5ddc4Srjs 441996c5ddc4Srjsstatic inline void 442096c5ddc4SrjsMALI_CACHE_FLUSH_JOB_PAYLOAD_print(FILE *fp, const struct MALI_CACHE_FLUSH_JOB_PAYLOAD * values, unsigned indent) 442196c5ddc4Srjs{ 442296c5ddc4Srjs fprintf(fp, "%*sClean Shader Core LS: %s\n", indent, "", values->clean_shader_core_ls ? "true" : "false"); 442396c5ddc4Srjs fprintf(fp, "%*sInvalidate Shader Core LS: %s\n", indent, "", values->invalidate_shader_core_ls ? "true" : "false"); 442496c5ddc4Srjs fprintf(fp, "%*sInvalidate Shader Core Other: %s\n", indent, "", values->invalidate_shader_core_other ? "true" : "false"); 442596c5ddc4Srjs fprintf(fp, "%*sJob Manager Clean: %s\n", indent, "", values->job_manager_clean ? "true" : "false"); 442696c5ddc4Srjs fprintf(fp, "%*sJob Manager Invalidate: %s\n", indent, "", values->job_manager_invalidate ? "true" : "false"); 442796c5ddc4Srjs fprintf(fp, "%*sTiler Clean: %s\n", indent, "", values->tiler_clean ? "true" : "false"); 442896c5ddc4Srjs fprintf(fp, "%*sTiler Invalidate: %s\n", indent, "", values->tiler_invalidate ? "true" : "false"); 442996c5ddc4Srjs fprintf(fp, "%*sL2 Clean: %s\n", indent, "", values->l2_clean ? "true" : "false"); 443096c5ddc4Srjs fprintf(fp, "%*sL2 Invalidate: %s\n", indent, "", values->l2_invalidate ? "true" : "false"); 443196c5ddc4Srjs} 443296c5ddc4Srjs 443396c5ddc4Srjsstruct mali_write_value_job_packed { 443496c5ddc4Srjs uint32_t opaque[11]; 443596c5ddc4Srjs}; 443696c5ddc4Srjs 443796c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_LENGTH 44 443896c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_ALIGN 64 443996c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 444096c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 444196c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 444296c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 444396c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 444496c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_HEADER_OFFSET 0 444596c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_TYPE struct MALI_WRITE_VALUE_JOB_PAYLOAD 444696c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_header MALI_WRITE_VALUE_JOB_PAYLOAD_header 444796c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_pack MALI_WRITE_VALUE_JOB_PAYLOAD_pack 444896c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_unpack MALI_WRITE_VALUE_JOB_PAYLOAD_unpack 444996c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_print MALI_WRITE_VALUE_JOB_PAYLOAD_print 445096c5ddc4Srjs#define MALI_WRITE_VALUE_JOB_SECTION_PAYLOAD_OFFSET 32 445196c5ddc4Srjs 445296c5ddc4Srjsstruct mali_cache_flush_job_packed { 445396c5ddc4Srjs uint32_t opaque[10]; 445496c5ddc4Srjs}; 445596c5ddc4Srjs 445696c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_LENGTH 40 445796c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_ALIGN 64 445896c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 445996c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 446096c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 446196c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 446296c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 446396c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_HEADER_OFFSET 0 446496c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_TYPE struct MALI_CACHE_FLUSH_JOB_PAYLOAD 446596c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_header MALI_CACHE_FLUSH_JOB_PAYLOAD_header 446696c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_pack MALI_CACHE_FLUSH_JOB_PAYLOAD_pack 446796c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_unpack MALI_CACHE_FLUSH_JOB_PAYLOAD_unpack 446896c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_print MALI_CACHE_FLUSH_JOB_PAYLOAD_print 446996c5ddc4Srjs#define MALI_CACHE_FLUSH_JOB_SECTION_PAYLOAD_OFFSET 32 447096c5ddc4Srjs 447196c5ddc4Srjsstruct MALI_COMPUTE_JOB_PARAMETERS { 447296c5ddc4Srjs uint32_t job_task_split; 447396c5ddc4Srjs}; 447496c5ddc4Srjs 447596c5ddc4Srjs#define MALI_COMPUTE_JOB_PARAMETERS_header \ 447696c5ddc4Srjs 0 447796c5ddc4Srjs 447896c5ddc4Srjsstatic inline void 447996c5ddc4SrjsMALI_COMPUTE_JOB_PARAMETERS_pack(uint32_t * restrict cl, 448096c5ddc4Srjs const struct MALI_COMPUTE_JOB_PARAMETERS * restrict values) 448196c5ddc4Srjs{ 448296c5ddc4Srjs cl[ 0] = __gen_uint(values->job_task_split, 26, 29); 448396c5ddc4Srjs cl[ 1] = 0; 448496c5ddc4Srjs cl[ 2] = 0; 448596c5ddc4Srjs cl[ 3] = 0; 448696c5ddc4Srjs cl[ 4] = 0; 448796c5ddc4Srjs cl[ 5] = 0; 448896c5ddc4Srjs} 448996c5ddc4Srjs 449096c5ddc4Srjs 449196c5ddc4Srjs#define MALI_COMPUTE_JOB_PARAMETERS_LENGTH 24 449296c5ddc4Srjsstruct mali_compute_job_parameters_packed { uint32_t opaque[6]; }; 449396c5ddc4Srjsstatic inline void 449496c5ddc4SrjsMALI_COMPUTE_JOB_PARAMETERS_unpack(const uint8_t * restrict cl, 449596c5ddc4Srjs struct MALI_COMPUTE_JOB_PARAMETERS * restrict values) 449696c5ddc4Srjs{ 449796c5ddc4Srjs if (((const uint32_t *) cl)[0] & 0xc3ffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 0\n"); 449896c5ddc4Srjs if (((const uint32_t *) cl)[1] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 1\n"); 449996c5ddc4Srjs if (((const uint32_t *) cl)[2] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 2\n"); 450096c5ddc4Srjs if (((const uint32_t *) cl)[3] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 3\n"); 450196c5ddc4Srjs if (((const uint32_t *) cl)[4] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 4\n"); 450296c5ddc4Srjs if (((const uint32_t *) cl)[5] & 0xffffffff) fprintf(stderr, "XXX: Invalid field of Compute Job Parameters unpacked at word 5\n"); 450396c5ddc4Srjs values->job_task_split = __gen_unpack_uint(cl, 26, 29); 450496c5ddc4Srjs} 450596c5ddc4Srjs 450696c5ddc4Srjsstatic inline void 450796c5ddc4SrjsMALI_COMPUTE_JOB_PARAMETERS_print(FILE *fp, const struct MALI_COMPUTE_JOB_PARAMETERS * values, unsigned indent) 450896c5ddc4Srjs{ 450996c5ddc4Srjs fprintf(fp, "%*sJob Task Split: %u\n", indent, "", values->job_task_split); 451096c5ddc4Srjs} 451196c5ddc4Srjs 451296c5ddc4Srjsstruct mali_compute_job_packed { 451396c5ddc4Srjs uint32_t opaque[46]; 451496c5ddc4Srjs}; 451596c5ddc4Srjs 451696c5ddc4Srjs#define MALI_COMPUTE_JOB_LENGTH 184 451796c5ddc4Srjs#define MALI_COMPUTE_JOB_ALIGN 64 451896c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 451996c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 452096c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 452196c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 452296c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 452396c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_HEADER_OFFSET 0 452496c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_TYPE struct MALI_INVOCATION 452596c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_header MALI_INVOCATION_header 452696c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_pack MALI_INVOCATION_pack 452796c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_unpack MALI_INVOCATION_unpack 452896c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_print MALI_INVOCATION_print 452996c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_INVOCATION_OFFSET 32 453096c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_TYPE struct MALI_COMPUTE_JOB_PARAMETERS 453196c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_header MALI_COMPUTE_JOB_PARAMETERS_header 453296c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_pack MALI_COMPUTE_JOB_PARAMETERS_pack 453396c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_unpack MALI_COMPUTE_JOB_PARAMETERS_unpack 453496c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_print MALI_COMPUTE_JOB_PARAMETERS_print 453596c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_PARAMETERS_OFFSET 40 453696c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_TYPE struct MALI_DRAW 453796c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_header MALI_DRAW_header 453896c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_pack MALI_DRAW_pack 453996c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_unpack MALI_DRAW_unpack 454096c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_print MALI_DRAW_print 454196c5ddc4Srjs#define MALI_COMPUTE_JOB_SECTION_DRAW_OFFSET 64 454296c5ddc4Srjs 454396c5ddc4Srjsstruct MALI_PRIMITIVE_SIZE { 454496c5ddc4Srjs float constant; 454596c5ddc4Srjs uint64_t size_array; 454696c5ddc4Srjs}; 454796c5ddc4Srjs 454896c5ddc4Srjs#define MALI_PRIMITIVE_SIZE_header \ 454996c5ddc4Srjs 0 455096c5ddc4Srjs 455196c5ddc4Srjsstatic inline void 455296c5ddc4SrjsMALI_PRIMITIVE_SIZE_pack(uint32_t * restrict cl, 455396c5ddc4Srjs const struct MALI_PRIMITIVE_SIZE * restrict values) 455496c5ddc4Srjs{ 455596c5ddc4Srjs cl[ 0] = __gen_uint(fui(values->constant), 0, 32) | 455696c5ddc4Srjs __gen_uint(values->size_array, 0, 63); 455796c5ddc4Srjs cl[ 1] = __gen_uint(values->size_array, 0, 63) >> 32; 455896c5ddc4Srjs} 455996c5ddc4Srjs 456096c5ddc4Srjs 456196c5ddc4Srjs#define MALI_PRIMITIVE_SIZE_LENGTH 8 456296c5ddc4Srjsstruct mali_primitive_size_packed { uint32_t opaque[2]; }; 456396c5ddc4Srjsstatic inline void 456496c5ddc4SrjsMALI_PRIMITIVE_SIZE_unpack(const uint8_t * restrict cl, 456596c5ddc4Srjs struct MALI_PRIMITIVE_SIZE * restrict values) 456696c5ddc4Srjs{ 456796c5ddc4Srjs values->constant = __gen_unpack_float(cl, 0, 31); 456896c5ddc4Srjs values->size_array = __gen_unpack_uint(cl, 0, 63); 456996c5ddc4Srjs} 457096c5ddc4Srjs 457196c5ddc4Srjsstatic inline void 457296c5ddc4SrjsMALI_PRIMITIVE_SIZE_print(FILE *fp, const struct MALI_PRIMITIVE_SIZE * values, unsigned indent) 457396c5ddc4Srjs{ 457496c5ddc4Srjs fprintf(fp, "%*sConstant: %f\n", indent, "", values->constant); 457596c5ddc4Srjs fprintf(fp, "%*sSize Array: 0x%" PRIx64 "\n", indent, "", values->size_array); 457696c5ddc4Srjs} 457796c5ddc4Srjs 457896c5ddc4Srjsstruct mali_tiler_job_packed { 457996c5ddc4Srjs uint32_t opaque[48]; 458096c5ddc4Srjs}; 458196c5ddc4Srjs 458296c5ddc4Srjs#define MALI_TILER_JOB_LENGTH 192 458396c5ddc4Srjs#define MALI_TILER_JOB_ALIGN 64 458496c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_TYPE struct MALI_JOB_HEADER 458596c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_header MALI_JOB_HEADER_header 458696c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_pack MALI_JOB_HEADER_pack 458796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_unpack MALI_JOB_HEADER_unpack 458896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_print MALI_JOB_HEADER_print 458996c5ddc4Srjs#define MALI_TILER_JOB_SECTION_HEADER_OFFSET 0 459096c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_TYPE struct MALI_INVOCATION 459196c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_header MALI_INVOCATION_header 459296c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_pack MALI_INVOCATION_pack 459396c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_unpack MALI_INVOCATION_unpack 459496c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_print MALI_INVOCATION_print 459596c5ddc4Srjs#define MALI_TILER_JOB_SECTION_INVOCATION_OFFSET 32 459696c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_TYPE struct MALI_PRIMITIVE 459796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_header MALI_PRIMITIVE_header 459896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_pack MALI_PRIMITIVE_pack 459996c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_unpack MALI_PRIMITIVE_unpack 460096c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_print MALI_PRIMITIVE_print 460196c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_OFFSET 40 460296c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_TYPE struct MALI_DRAW 460396c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_header MALI_DRAW_header 460496c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_pack MALI_DRAW_pack 460596c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_unpack MALI_DRAW_unpack 460696c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_print MALI_DRAW_print 460796c5ddc4Srjs#define MALI_TILER_JOB_SECTION_DRAW_OFFSET 64 460896c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_TYPE struct MALI_PRIMITIVE_SIZE 460996c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_header MALI_PRIMITIVE_SIZE_header 461096c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_pack MALI_PRIMITIVE_SIZE_pack 461196c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_unpack MALI_PRIMITIVE_SIZE_unpack 461296c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_print MALI_PRIMITIVE_SIZE_print 461396c5ddc4Srjs#define MALI_TILER_JOB_SECTION_PRIMITIVE_SIZE_OFFSET 184 461496c5ddc4Srjs 461596c5ddc4Srjs#include "panfrost-job.h" 461696c5ddc4Srjs#endif 4617