Skip to content

freedreno: Move the batch cache to the context

Emma Anholt requested to merge anholt/mesa:fd-bc-rebase into main

The batch cache being in the screen makes for a bunch of extra required locking during state-change draw calls (accessing the shared cache from the context), and some really fragile locking code around flushing other contexts' batches while they might be working on them.

Reduce complexity by moving the batch cache to the context. The increased cost in hash table tracking instead of u32 mask checks is beat by the decreased cost of locking:

drawoverhead throughput:

 1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change:        11.4618% +/- 5.96697% (n=15)
 7, DrawElements ( 1 VBO| 8 UBO|  8 Tex) w/ vertex attrib change,:  3.52418% +/- 0.761026% (n=15)
 8, DrawElements ( 1 VBO| 8 UBO|  8 Tex) w/ 1 texture change,:      3.25372% +/- 0.491197% (n=20)
 9, DrawElements ( 1 VBO| 8 UBO|  8 Tex) w/ 8 textures change,:     3.21557% +/- 0.739326% (n=20)
17, DrawElements ( 1 VBO| 8 UBO|  8 Tex) w/ 8 UBOs change,:         3.6687% +/- 0.742198% (n=15)
Edited by Emma Anholt

Merge request reports