v3d: move format helpers to v3dx_format_table.h

Move tfu_supports_tex_format(),
get_internal_type_bpp_for_output_format(), v3d_get_tex_format(),
and v3d_get_rt_format() from v3dx_context.h into
a new header, v3dx_format_table.h.

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36858>
This commit is contained in:
Daivik Bhatia 2025-09-07 17:27:50 +05:30 committed by Marge Bot
parent b8864ef03b
commit 6e5f68662d
10 changed files with 59 additions and 20 deletions

View file

@ -31,6 +31,9 @@
#include "broadcom/common/v3d_tiling.h"
#include "broadcom/common/v3d_tfu.h"
#define V3D_VERSION 42
#include "v3dx_format_table.h"
/**
* The param @op_blit is used to tell if we are saving state for blitter_blit
* (if true) or blitter_clear (if false). If other blitter functions are used

View file

@ -837,8 +837,7 @@ bool v3d_rt_format_supported(const struct v3d_device_info *devinfo,
enum pipe_format f);
bool v3d_tex_format_supported(const struct v3d_device_info *devinfo,
enum pipe_format f);
uint8_t v3d_get_rt_format(const struct v3d_device_info *devinfo, enum pipe_format f);
uint8_t v3d_get_tex_format(const struct v3d_device_info *devinfo, enum pipe_format f);
uint8_t v3d_get_tex_return_size(const struct v3d_device_info *devinfo,
enum pipe_format f);
uint8_t v3d_get_tex_return_channels(const struct v3d_device_info *devinfo,

View file

@ -26,6 +26,19 @@
#include <stdbool.h>
#include <stdint.h>
#ifdef v3dX
# include "v3dx_context.h"
# include "broadcom/cle/v3dx_pack.h"
#else
# define v3dX(x) v3d42_##x
# include "v3dx_format_table.h"
# undef v3dX
# define v3dX(x) v3d71_##x
# include "v3dx_format_table.h"
# undef v3dX
#endif
struct v3d_format {
/** Set if the pipe format is defined in the table. */
bool present;

View file

@ -35,11 +35,10 @@
#include "util/macros.h"
#include "v3d_context.h"
#include "v3d_format_table.h"
/* The format internal types are the same across V3D versions */
#define V3D_VERSION 42
#include "broadcom/cle/v3dx_pack.h"
#include "v3d_format_table.h"
bool
v3d_rt_format_supported(const struct v3d_device_info *devinfo,

View file

@ -42,16 +42,6 @@ void v3dX(bcl_epilogue)(struct v3d_context *v3d, struct v3d_job *job);
void v3dX(job_emit_enable_double_buffer)(struct v3d_job *job);
const struct v3d_format *v3dX(get_format_desc)(enum pipe_format f);
void v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
uint32_t *type,
uint32_t *bpp);
/* FIXME: tex_format should be `enum V3DX(Texture_Data_Formats)`, but using
* that enum type in the header requires including v3dx_pack.h, which triggers
* circular include dependencies issues, so we're using a `uint32_t` for now.
*/
bool v3dX(tfu_supports_tex_format)(uint32_t tex_format,
bool for_mipmap);
bool v3dX(tfu)(struct pipe_context *pctx,
struct pipe_resource *pdst,

View file

@ -24,9 +24,8 @@
#include "util/format/u_format.h"
#include "v3d_context.h"
#include "broadcom/cle/v3dx_pack.h"
#include "broadcom/common/v3d_macros.h"
#include "v3d_format_table.h"
#include "v3dx_format_table.h"
#define SWIZ(x,y,z,w) { \
PIPE_SWIZZLE_##x, \

View file

@ -0,0 +1,37 @@
/*
* Copyright © 2025 Broadcom
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "broadcom/common/v3d_macros.h"
#include "broadcom/cle/v3dx_pack.h"
uint8_t v3d_get_tex_format(const struct v3d_device_info *devinfo, enum pipe_format f);
uint8_t v3d_get_rt_format(const struct v3d_device_info *devinfo, enum pipe_format f);
bool v3dX(tfu_supports_tex_format)(uint32_t tex_format,
bool for_mipmap);
void v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
uint32_t *type,
uint32_t *bpp);

View file

@ -24,10 +24,9 @@
#include "util/format/u_format.h"
#include "util/macros.h"
#include "v3d_context.h"
#include "broadcom/common/v3d_macros.h"
#include "broadcom/common/v3d_tiling.h"
#include "broadcom/common/v3d_util.h"
#include "broadcom/cle/v3dx_pack.h"
#include "v3dx_format_table.h"
#define PIPE_CLEAR_COLOR_BUFFERS (PIPE_CLEAR_COLOR0 | \
PIPE_CLEAR_COLOR1 | \

View file

@ -35,10 +35,9 @@
#include "v3d_context.h"
#include "broadcom/common/v3d_tiling.h"
#include "broadcom/common/v3d_macros.h"
#include "broadcom/common/v3d_util.h"
#include "broadcom/compiler/v3d_compiler.h"
#include "broadcom/cle/v3dx_pack.h"
#include "v3dx_format_table.h"
static void
v3d_generic_cso_state_delete(struct pipe_context *pctx, void *hwcso)

View file

@ -24,6 +24,7 @@
#include "v3d_context.h"
#include "broadcom/common/v3d_tfu.h"
#include "util/perf/cpu_trace.h"
#include "v3dx_format_table.h"
bool
v3dX(tfu)(struct pipe_context *pctx,