v3d: add v71 hw generation

Starting point for v71 version inclusion:
 * Adds as one of the versions to be compiled on meson
 * Updated the v3d_X and v3dX macros to include version 71
 * Update the code enough to get it building when using v71.

Any real v71 support will be implemented on following commits.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
This commit is contained in:
Alejandro Piñeiro 2023-05-23 23:32:37 +02:00 committed by Marge Bot
parent 48383668a7
commit 4dfe17a762
6 changed files with 88 additions and 15 deletions

View file

@ -58,7 +58,7 @@ if dep_v3dv3.found()
v3d_args += '-DUSE_V3D_SIMULATOR'
endif
v3d_versions = ['33', '42']
v3d_versions = ['33', '42', '71']
per_version_libs = []
foreach ver : v3d_versions

View file

@ -823,13 +823,21 @@ void v3d_disk_cache_store(struct v3d_context *v3d,
/* Helper to call hw ver specific functions */
#define v3d_X(devinfo, thing) ({ \
__typeof(&v3d42_##thing) v3d_X_thing; \
if ((devinfo)->ver >= 42) \
v3d_X_thing = &v3d42_##thing; \
else if ((devinfo)->ver >= 33) \
__typeof(&v3d33_##thing) v3d_X_thing; \
switch (devinfo->ver) { \
case 33: \
case 40: \
v3d_X_thing = &v3d33_##thing; \
else \
break; \
case 42: \
v3d_X_thing = &v3d42_##thing; \
break; \
case 71: \
v3d_X_thing = &v3d71_##thing; \
break; \
default: \
unreachable("Unsupported hardware generation"); \
} \
v3d_X_thing; \
})
@ -843,6 +851,10 @@ void v3d_disk_cache_store(struct v3d_context *v3d,
# define v3dX(x) v3d42_##x
# include "v3dx_context.h"
# undef v3dX
# define v3dX(x) v3d71_##x
# include "v3dx_context.h"
# undef v3dX
#endif
#endif /* V3D_CONTEXT_H */

View file

@ -95,7 +95,11 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job)
#endif
assert(!job->msaa || !job->double_buffer);
#if V3D_VERSION >= 40
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
#if V3D_VERSION >= 40 && V3D_VERSION <= 42
cl_emit(&job->bcl, TILE_BINNING_MODE_CFG, config) {
config.width_in_pixels = job->draw_width;
config.height_in_pixels = job->draw_height;
@ -107,7 +111,8 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job)
config.maximum_bpp_of_all_render_targets = job->internal_bpp;
}
#else /* V3D_VERSION < 40 */
#endif
#if V3D_VERSION < 40
/* "Binning mode lists start with a Tile Binning Mode Configuration
* item (120)"
*
@ -134,7 +139,7 @@ v3dX(start_binning)(struct v3d_context *v3d, struct v3d_job *job)
config.maximum_bpp_of_all_render_targets = job->internal_bpp;
}
#endif /* V3D_VERSION < 40 */
#endif
/* There's definitely nothing in the VCD cache we want. */
cl_emit(&job->bcl, FLUSH_VCD_CACHE, bin);
@ -655,10 +660,15 @@ v3d_emit_gl_shader_state(struct v3d_context *v3d,
/* XXX: Use combined input/output size flag in the common
* case.
*/
#if V3D_VERSION <= 42
shader.coordinate_shader_has_separate_input_and_output_vpm_blocks =
v3d->prog.cs->prog_data.vs->separate_segments;
shader.vertex_shader_has_separate_input_and_output_vpm_blocks =
v3d->prog.vs->prog_data.vs->separate_segments;
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
shader.coordinate_shader_input_vpm_segment_size =
v3d->prog.cs->prog_data.vs->separate_segments ?
@ -724,9 +734,14 @@ v3d_emit_gl_shader_state(struct v3d_context *v3d,
shader.instance_id_read_by_vertex_shader =
v3d->prog.vs->prog_data.vs->uses_iid;
#if V3D_VERSION <= 42
shader.address_of_default_attribute_values =
cl_address(v3d_resource(vtx->defaults)->bo,
vtx->defaults_offset);
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
}
bool cs_loaded_any = false;

View file

@ -512,6 +512,7 @@ v3dX(emit_state)(struct pipe_context *pctx)
/* Note: EZ state may update based on the compiled FS,
* along with ZSA
*/
#if V3D_VERSION <= 42
config.early_z_updates_enable =
(job->ez_state != V3D_EZ_DISABLED);
if (v3d->zsa->base.depth_enabled) {
@ -524,6 +525,10 @@ v3dX(emit_state)(struct pipe_context *pctx)
} else {
config.depth_test_function = PIPE_FUNC_ALWAYS;
}
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
config.stencil_enable =
v3d->zsa->base.stencil[0].enabled;
@ -564,12 +569,18 @@ v3dX(emit_state)(struct pipe_context *pctx)
}
if (v3d->dirty & V3D_DIRTY_VIEWPORT) {
#if V3D_VERSION <= 42
cl_emit(&job->bcl, CLIPPER_XY_SCALING, clip) {
clip.viewport_half_width_in_1_256th_of_pixel =
v3d->viewport.scale[0] * 256.0f;
clip.viewport_half_height_in_1_256th_of_pixel =
v3d->viewport.scale[1] * 256.0f;
}
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
cl_emit(&job->bcl, CLIPPER_Z_SCALE_AND_OFFSET, clip) {
clip.viewport_z_offset_zc_to_zs =

View file

@ -420,10 +420,16 @@ v3d_rcl_emit_stores(struct v3d_job *job, struct v3d_cl *cl, int layer)
* clearing Z/S.
*/
if (job->clear) {
#if V3D_VERSION <= 42
cl_emit(cl, CLEAR_TILE_BUFFERS, clear) {
clear.clear_z_stencil_buffer = !job->early_zs_clear;
clear.clear_all_render_targets = true;
}
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
}
#endif /* V3D_VERSION >= 40 */
}
@ -484,7 +490,7 @@ v3d_rcl_emit_generic_per_tile_list(struct v3d_job *job, int layer)
}
}
#if V3D_VERSION >= 40
#if V3D_VERSION >= 40 && V3D_VERSION <= 42
static void
v3d_setup_render_target(struct v3d_job *job, int cbuf,
uint32_t *rt_bpp, uint32_t *rt_type, uint32_t *rt_clamp)
@ -508,9 +514,9 @@ v3d_setup_render_target(struct v3d_job *job, int cbuf,
else
*rt_clamp = V3D_RENDER_TARGET_CLAMP_NONE;
}
#endif
#else /* V3D_VERSION < 40 */
#if V3D_VERSION < 40
static void
v3d_emit_z_stencil_config(struct v3d_job *job, struct v3d_surface *surf,
struct v3d_resource *rsc, bool is_separate_stencil)
@ -655,7 +661,8 @@ emit_render_layer(struct v3d_job *job, uint32_t layer)
cl_emit(&job->rcl, STORE_TILE_BUFFER_GENERAL, store) {
store.buffer_to_store = NONE;
}
#else
#endif
#if V3D_VERSION >= 40 && V3D_VERSION <= 42
for (int i = 0; i < 2; i++) {
if (i > 0)
cl_emit(&job->rcl, TILE_COORDINATES, coords);
@ -672,6 +679,10 @@ emit_render_layer(struct v3d_job *job, uint32_t layer)
cl_emit(&job->rcl, END_OF_TILE_MARKER, end);
}
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
cl_emit(&job->rcl, FLUSH_VCD_CACHE, flush);
@ -774,7 +785,13 @@ v3dX(emit_rcl)(struct v3d_job *job)
config.multisample_mode_4x = job->msaa;
config.double_buffer_in_non_ms_mode = job->double_buffer;
#if V3D_VERSION <= 42
config.maximum_bpp_of_all_render_targets = job->internal_bpp;
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
}
for (int i = 0; i < job->nr_cbufs; i++) {
@ -785,7 +802,7 @@ v3dX(emit_rcl)(struct v3d_job *job)
struct v3d_resource *rsc = v3d_resource(psurf->texture);
UNUSED uint32_t config_pad = 0;
uint32_t clear_pad = 0;
UNUSED uint32_t clear_pad = 0;
/* XXX: Set the pad for raster. */
if (surf->tiling == V3D_TILING_UIF_NO_XOR ||
@ -818,6 +835,7 @@ v3dX(emit_rcl)(struct v3d_job *job)
}
#endif /* V3D_VERSION < 40 */
#if V3D_VERSION <= 42
cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_CLEAR_COLORS_PART1,
clear) {
clear.clear_color_low_32_bits = job->clear_color[i][0];
@ -846,9 +864,10 @@ v3dX(emit_rcl)(struct v3d_job *job)
clear.render_target_number = i;
};
}
#endif
}
#if V3D_VERSION >= 40
#if V3D_VERSION >= 40 && V3D_VERSION <= 42
cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_COLOR, rt) {
v3d_setup_render_target(job, 0,
&rt.render_target_0_internal_bpp,
@ -869,6 +888,10 @@ v3dX(emit_rcl)(struct v3d_job *job)
}
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
#if V3D_VERSION < 40
/* FIXME: Don't bother emitting if we don't load/clear Z/S. */
if (job->zsbuf) {

View file

@ -989,7 +989,13 @@ v3dX(create_texture_shader_state_bo)(struct v3d_context *v3d,
cso->u.buf.size);
}
#if V3D_VERSION <= 42
tex.srgb = util_format_is_srgb(cso->format);
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
#if V3D_VERSION >= 40
tex.swizzle_r = v3d_translate_pipe_swizzle(so->swizzle[0]);
@ -1039,7 +1045,13 @@ v3dX(create_texture_shader_state_bo)(struct v3d_context *v3d,
* shader code if we wanted to read an MSAA sRGB
* texture without sRGB decode.
*/
#if V3D_VERSION <= 42
tex.srgb = false;
#endif
#if V3D_VERSION >= 71
unreachable("HW generation 71 not supported yet.");
#endif
} else {
tex.texture_type = v3d_get_tex_format(&screen->devinfo,
cso->format);