etnaviv: use CPU-based tiling/untiling for small regions

Submitted by Boris Brezillon on Feb. 20, 2019, 5:01 p.m.

Details

Reviewer None
Submitted Feb. 20, 2019, 5:01 p.m.
Last Updated Feb. 21, 2019, 12:14 p.m.
Revision 1

Cover Letter(s)

Revision 1
      Hi,

This series aims at optimizing updates of small regions inside a
texture. This is particularly useful when updating a texture atlas one
bit at a time.

Before going for this CPU-based tiling/untiling approach we tried
optimizing things by keeping track of all updates triggered by the
transfer_map/unmap() calls to avoid GPU -> CPU syncs when new regions
are updated without touching other already written regions [1].
Unfortunately, because of the supertile+RS-alignment constraints this
led to almost all updates requiring such a sync (at least in our use
case where each element of the atlas is not properly aligned).

This led us to consider another approach: avoid GPU-based tiling for
small regions, especially when they're not properly aligned. This is
what this patchset implements.

Patch 1 add supports for super and multi tile untiling, and patch 2
makes use of the CPU-based tiling/untiling when the region is small
enough. Note that the thresholds used here have been chosen arbitrarily
but they seem to speed things up in our use case.

Future possible improvements involve supporting NEON-based
tiling/untiling (as started here[2]).

Another option we considered was keeping a shadow linear buffer
attached to the tiled resource so that we could update the linear
version without waiting for the GPU to finish rendering things on
the final BO, but this option will likely be more invasive.

Please let me know what you think of this CPU-based tiling approach,
and if you don't like it, feel free to propose other solution that
would be worth investigating.

Thanks,

Boris

[1]https://gitlab.collabora.com/bbrezillon/mesa/commits/etna-texture-atlas-18.2.4
[2]https://github.com/laanwj/mesa/commit/6d575b3094f17e29246be72dce8fbb6fe048db2c

Boris Brezillon (2):
  etnaviv: add support for CPU-based super/multi tile tiling/untiling
  etnaviv: try to use CPU to tile/untile when the region is small enough

 src/gallium/drivers/etnaviv/etnaviv_tiling.c  | 85 ++++++++++++++++---
 src/gallium/drivers/etnaviv/etnaviv_tiling.h  | 10 ++-
 .../drivers/etnaviv/etnaviv_transfer.c        | 83 ++++++++++++++----
 3 files changed, 145 insertions(+), 33 deletions(-)
    

Revisions