iris: Make an iris_foreach_batch macro that skips unsupported batches
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 28 Jan 2022 11:23:34 +0000 (03:23 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Feb 2022 08:06:12 +0000 (08:06 +0000)
commitfd0e4aedeb276b64bb58bc0ecfa68db228c3857d
tree656ae43e148b48c8636f21925f2f24e7812c5585
parentc4b400285ac011f337023b13270e02fbb337fc85
iris: Make an iris_foreach_batch macro that skips unsupported batches

IRIS_BATCH_BLITTER isn't supported prior to Tigerlake; in general,
batches may not be supported on all hardware.  In most cases, querying
them is harmless (if useless): they reference nothing, have no commands
to flush, and so on.  However, the fence code does need to know that
certain batches don't exist, so it can avoid adding inter-batch fences
involving them.

This patch introduces a new iris_foreach_batch() iterator macro that
walks over all batches that are actually supported on the platform,
while skipping the others.  It provides a central place to update should
we add or reorder more batches in the future.

Fixes various tests in the piglit.spec.ext_external_objects.* category.

Thanks to Tapani Pälli for catching this.

Fixes: a90a1f15 ("iris: Create an IRIS_BATCH_BLITTER for using the BLT command streamer")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14834>
src/gallium/drivers/iris/iris_batch.c
src/gallium/drivers/iris/iris_batch.h
src/gallium/drivers/iris/iris_border_color.c
src/gallium/drivers/iris/iris_context.c
src/gallium/drivers/iris/iris_fence.c
src/gallium/drivers/iris/iris_pipe_control.c
src/gallium/drivers/iris/iris_resource.c