pan/format: Make pan_format::bind a 5-bit field

This way, a pan_format instance fits into a single u32. This forces us
to have an explicit translation in pipe_to_pan_bind_flags(), which is
probably a good thing anyway.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Ryan Mckeever <ryan.mckeever@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34767>
This commit is contained in:
Boris Brezillon 2025-05-07 15:12:31 +02:00
parent 8b2e57aaf6
commit 022e3cb66a
2 changed files with 17 additions and 12 deletions

View file

@ -125,13 +125,18 @@ from_kmod_group_allow_priority_flags(
static uint32_t
pipe_to_pan_bind_flags(uint32_t pipe_bind_flags)
{
static_assert(PIPE_BIND_DEPTH_STENCIL == PAN_BIND_DEPTH_STENCIL, "");
static_assert(PIPE_BIND_RENDER_TARGET == PAN_BIND_RENDER_TARGET, "");
static_assert(PIPE_BIND_SAMPLER_VIEW == PAN_BIND_SAMPLER_VIEW, "");
static_assert(PIPE_BIND_VERTEX_BUFFER == PAN_BIND_VERTEX_BUFFER, "");
uint32_t pan_bind_flags = 0;
return pipe_bind_flags & (PAN_BIND_DEPTH_STENCIL | PAN_BIND_RENDER_TARGET |
PAN_BIND_VERTEX_BUFFER | PAN_BIND_SAMPLER_VIEW);
if (pipe_bind_flags & PIPE_BIND_DEPTH_STENCIL)
pan_bind_flags |= PAN_BIND_DEPTH_STENCIL;
if (pipe_bind_flags & PIPE_BIND_RENDER_TARGET)
pan_bind_flags |= PAN_BIND_RENDER_TARGET;
if (pipe_bind_flags & PIPE_BIND_VERTEX_BUFFER)
pan_bind_flags |= PAN_BIND_VERTEX_BUFFER;
if (pipe_bind_flags & PIPE_BIND_SAMPLER_VIEW)
pan_bind_flags |= PAN_BIND_SAMPLER_VIEW;
return pan_bind_flags;
}
/**

View file

@ -37,16 +37,16 @@
typedef uint32_t mali_pixel_format;
/* pan bind flags */
#define PAN_BIND_DEPTH_STENCIL (1 << 0)
#define PAN_BIND_RENDER_TARGET (1 << 1)
#define PAN_BIND_SAMPLER_VIEW (1 << 3)
#define PAN_BIND_VERTEX_BUFFER (1 << 4)
#define PAN_BIND_STORAGE_IMAGE (1 << 15) /* == PIPE_BIND_SHADER_IMAGE */
#define PAN_BIND_DEPTH_STENCIL BITFIELD_BIT(0)
#define PAN_BIND_RENDER_TARGET BITFIELD_BIT(1)
#define PAN_BIND_SAMPLER_VIEW BITFIELD_BIT(2)
#define PAN_BIND_VERTEX_BUFFER BITFIELD_BIT(3)
#define PAN_BIND_STORAGE_IMAGE BITFIELD_BIT(4)
struct panfrost_format {
uint32_t hw : 22;
uint32_t texfeat_bit : 5;
unsigned bind;
uint32_t bind : 5;
};
struct pan_blendable_format {