Skip to content

tc: implement renderpass info tracking

Mike Blumenkrantz requested to merge zmike/mesa:tc-readahead into main

Problem

on tiling gpus, it's crucial for performance to be able to determine how renderpass attachments will be utilized

gallium, however, does not provide any of the info needed to make these determinations, and the mechanics to manage the tracking for it in-driver is prohibitive to both cost and complexity

to solve this problem, threaded context can be augmented to track usage for framebuffer attachments and then make that usage available to drivers

Implementation

when drivers opt-in to this behavior, tc will track metadata for framebuffer attachments into this struct:

struct {
   uint8_t cbuf_clear;
   uint8_t cbuf_load;
   uint8_t cbuf_invalidate;
   bool zsbuf_clear : 1;
   bool zsbuf_clear_partial : 1;
   bool zsbuf_load : 1;
   bool zsbuf_invalidate : 1;
   bool has_draw : 1;
   uint8_t pad : 3;
   uint8_t cbuf_fbfetch;
   bool zsbuf_write_fs : 1;
   bool zsbuf_write_dsa : 1;
   bool zsbuf_read_dsa : 1;
   bool zsbuf_fbfetch : 1;
   uint8_t pad2 : 4;
   uint16_t pad3;
};

drivers can then access this data at any point outside of internal meta operations to know exactly how all framebuffer attachments will be used

Performance

this has been observed to yield ~10% performance gains on turnip for some glmark2 cases (with some variant of !18762 (closed) or !18736 (closed) also applied)

when inactive, this yields no observable changes to drawoverhead (tested on radeonsi)

when active, causes ~5% perf loss on base drawoverhead draw cases

Merge request reports