v3d_args += '-DUSE_V3D_SIMULATOR'
endif
-v3d_versions = ['33', '42']
+v3d_versions = ['33', '42', '71']
per_version_libs = []
foreach ver : v3d_versions
/* 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; \
})
# 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 */
#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;
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)"
*
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);
/* 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 ?
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;
/* 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) {
} 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;
}
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 =
* 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 */
}
}
}
-#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)
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)
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);
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);
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++) {
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 ||
}
#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];
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,
}
#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) {
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]);
* 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);