mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 03:28:09 +02:00
broadcom/common: add some common v71 helpers
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
This commit is contained in:
parent
04f16574e6
commit
453b817cfd
2 changed files with 54 additions and 0 deletions
|
|
@ -170,3 +170,30 @@ v3d_hw_prim_type(enum mesa_prim prim_type)
|
|||
unreachable("Unsupported primitive type");
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
v3d_internal_bpp_words(uint32_t internal_bpp)
|
||||
{
|
||||
switch (internal_bpp) {
|
||||
case 0 /* V3D_INTERNAL_BPP_32 */:
|
||||
return 1;
|
||||
case 1 /* V3D_INTERNAL_BPP_64 */:
|
||||
return 2;
|
||||
case 2 /* V3D_INTERNAL_BPP_128 */:
|
||||
return 4;
|
||||
default:
|
||||
unreachable("Unsupported internal BPP");
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
v3d_compute_rt_row_row_stride_128_bits(uint32_t tile_width,
|
||||
uint32_t bpp)
|
||||
{
|
||||
/* stride in multiples of 128 bits, and covers 2 rows. This is the
|
||||
* reason we divide by 2 instead of 4, as we divide number of 32-bit
|
||||
* words per row by 2.
|
||||
*/
|
||||
|
||||
return (tile_width * bpp) / 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#ifndef V3D_UTIL_H
|
||||
#define V3D_UTIL_H
|
||||
|
||||
#include "util/macros.h"
|
||||
#include "common/v3d_device_info.h"
|
||||
#include "compiler/shader_enums.h"
|
||||
#include "util/format/u_formats.h"
|
||||
|
|
@ -47,4 +48,30 @@ v3d_translate_pipe_swizzle(enum pipe_swizzle swizzle);
|
|||
uint32_t
|
||||
v3d_hw_prim_type(enum mesa_prim prim_type);
|
||||
|
||||
uint32_t
|
||||
v3d_internal_bpp_words(uint32_t internal_bpp);
|
||||
|
||||
/* Some configuration packets want the size on log2, but starting at 0 for
|
||||
* size 8.
|
||||
*/
|
||||
static inline uint8_t
|
||||
log2_tile_size(uint32_t size)
|
||||
{
|
||||
switch(size) {
|
||||
case 8:
|
||||
return 0;
|
||||
case 16:
|
||||
return 1;
|
||||
case 32:
|
||||
return 2;
|
||||
case 64:
|
||||
return 3;
|
||||
default:
|
||||
unreachable("Unsupported tile width/height");
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
v3d_compute_rt_row_row_stride_128_bits(uint32_t tile_width,
|
||||
uint32_t bpp);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue