1 /* 2 * Copyright © 2025 Igalia S.L. 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #include "freedreno_lrz_layout.h" 7 #include "util/compiler.h" 8 9 void fdl5_lrz_layout_init(struct fdl_lrz_layout * lrz_layout,uint32_t width,uint32_t height,uint32_t nr_samples)10fdl5_lrz_layout_init(struct fdl_lrz_layout *lrz_layout, uint32_t width, 11 uint32_t height, uint32_t nr_samples) 12 { 13 uint32_t lrz_pitch = align(DIV_ROUND_UP(width, 8), 64); 14 uint32_t lrz_height = DIV_ROUND_UP(height, 8); 15 16 /* LRZ buffer is super-sampled: */ 17 switch (nr_samples) { 18 case 4: 19 lrz_pitch *= 2; 20 FALLTHROUGH; 21 case 2: 22 lrz_height *= 2; 23 } 24 25 uint32_t lrz_size = lrz_pitch * lrz_height * 2; 26 lrz_size += 0x1000; /* for GRAS_LRZ_FAST_CLEAR_BUFFER */ 27 28 lrz_layout->lrz_offset = 0; 29 lrz_layout->lrz_pitch = lrz_pitch; 30 lrz_layout->lrz_height = lrz_height; 31 lrz_layout->lrz_layer_size = 0; 32 lrz_layout->lrz_fc_offset = 0; 33 lrz_layout->lrz_fc_size = 0; 34 lrz_layout->lrz_total_size = lrz_size; 35 } 36