diff options
author | Yonggang Luo <luoyonggang@gmail.com> | 2023-06-02 00:02:48 +0800 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-06-10 14:54:11 +0000 |
commit | 1555f4125695846bb37a4703eaed06a12924305b (patch) | |
tree | e439ee4ff6a61dd350bc805c0068678ec60ca9cb | |
parent | 51cd2965c71986d904997c15981217a6270943c0 (diff) | |
download | mesa-1555f4125695846bb37a4703eaed06a12924305b.tar.gz mesa-1555f4125695846bb37a4703eaed06a12924305b.tar.bz2 mesa-1555f4125695846bb37a4703eaed06a12924305b.zip |
panfrost: Replace the usage of PIPE_BIND_* with PAN_BIND_*
PIPE_BIND_* belongs to gallium, do not use it in panvk
As pan_format.h also used ban panfrost gallium driver, so static_assert it equal
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23526>
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.c | 18 | ||||
-rw-r--r-- | src/panfrost/lib/pan_format.c | 8 | ||||
-rw-r--r-- | src/panfrost/lib/pan_format.h | 6 | ||||
-rw-r--r-- | src/panfrost/vulkan/panvk_formats.c | 8 |
4 files changed, 28 insertions, 12 deletions
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 25e5ca9dc90..fa468d15e49 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -529,6 +529,18 @@ panfrost_get_paramf(struct pipe_screen *screen, enum pipe_capf param) } } +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, ""); + + return pipe_bind_flags & (PAN_BIND_DEPTH_STENCIL | PAN_BIND_RENDER_TARGET | + PAN_BIND_VERTEX_BUFFER | PAN_BIND_SAMPLER_VIEW); +} + /** * Query format support for creating a texture, drawing surface, etc. * \param format the format to test @@ -576,9 +588,7 @@ panfrost_is_format_supported(struct pipe_screen *screen, /* Check we support the format with the given bind */ - unsigned relevant_bind = - bind & (PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_RENDER_TARGET | - PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_SAMPLER_VIEW); + unsigned pan_bind_flags = pipe_to_pan_bind_flags(bind); struct panfrost_format fmt = dev->formats[format]; @@ -592,7 +602,7 @@ panfrost_is_format_supported(struct pipe_screen *screen, if (!supported) return false; - return MALI_EXTRACT_INDEX(fmt.hw) && ((relevant_bind & ~fmt.bind) == 0); + return MALI_EXTRACT_INDEX(fmt.hw) && ((pan_bind_flags & ~fmt.bind) == 0); } /* We always support linear and tiled operations, both external and internal. diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c index 35b91cd65e1..7c758c2ec5f 100644 --- a/src/panfrost/lib/pan_format.c +++ b/src/panfrost/lib/pan_format.c @@ -112,10 +112,10 @@ const struct pan_blendable_format /* Convenience */ -#define _V PIPE_BIND_VERTEX_BUFFER -#define _T PIPE_BIND_SAMPLER_VIEW -#define _R PIPE_BIND_RENDER_TARGET -#define _Z PIPE_BIND_DEPTH_STENCIL +#define _V PAN_BIND_VERTEX_BUFFER +#define _T PAN_BIND_SAMPLER_VIEW +#define _R PAN_BIND_RENDER_TARGET +#define _Z PAN_BIND_DEPTH_STENCIL #define FLAGS_V___ (_V) #define FLAGS__T__ (_T) diff --git a/src/panfrost/lib/pan_format.h b/src/panfrost/lib/pan_format.h index babf6d637c4..afa7ccfd6a7 100644 --- a/src/panfrost/lib/pan_format.h +++ b/src/panfrost/lib/pan_format.h @@ -36,6 +36,12 @@ 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) + struct panfrost_format { mali_pixel_format hw; unsigned bind; diff --git a/src/panfrost/vulkan/panvk_formats.c b/src/panfrost/vulkan/panvk_formats.c index 7d41da6f7dc..956d4691677 100644 --- a/src/panfrost/vulkan/panvk_formats.c +++ b/src/panfrost/vulkan/panvk_formats.c @@ -61,10 +61,10 @@ get_format_properties(struct panvk_physical_device *physical_device, buffer |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT; - if (fmt.bind & PIPE_BIND_VERTEX_BUFFER) + if (fmt.bind & PAN_BIND_VERTEX_BUFFER) buffer |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT; - if (fmt.bind & PIPE_BIND_SAMPLER_VIEW) { + if (fmt.bind & PAN_BIND_SAMPLER_VIEW) { tex |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | @@ -81,7 +81,7 @@ get_format_properties(struct panvk_physical_device *physical_device, } /* SNORM rendering isn't working yet, disable */ - if (fmt.bind & PIPE_BIND_RENDER_TARGET && !util_format_is_snorm(pfmt)) { + if (fmt.bind & PAN_BIND_RENDER_TARGET && !util_format_is_snorm(pfmt)) { tex |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT; @@ -92,7 +92,7 @@ get_format_properties(struct panvk_physical_device *physical_device, tex |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT; } - if (fmt.bind & PIPE_BIND_DEPTH_STENCIL) + if (fmt.bind & PAN_BIND_DEPTH_STENCIL) tex |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; end: |