freedreno: Fix missing rsc->seqno updates There were a couple paths where we weren't getting valid seqno's, which are supposed to be updated whenever the backing bo is set/changed. So wrap that up in a helper to make it harder to mess up. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6575>
freedreno/a6xx: move ubwc clear to blitter Avoid having to mmap() unnecessarily by moving UBWC clear/init to blitter. Because we don't have a context when the bo is allocated, we need to lazily initialize UBWC data, so hook into the resource_written() tracking to do this. Don't bother with resource_read() because that would be undefined anyways. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6475>
freedreno: add debug helper to dump buffers Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6434>
freedreno: Implement memory object create/destroy for GL_EXT_memory_object v2: Add implementation of fd_memobj_destroy() virtual func, which was newly added. v3: The memobj bo must be non-NULL and destroyed as part of memobj destruction (instead of its reference being stolen). (Rob Clark) Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4565>
freedreno/layout: layout simplifications and pitch from level 0 pitch This updates a3xx/a4xx/a5xx to fix the fetchsize to "PITCHALIGN" (called "MINLINEOFFSET" by the a3xx docs), and some simplifications to make things more like a6xx. Also similar simplifications for a2xx layout code. The pitch can always be determined using a simple calculation from the base level pitch, so don't pre-calculate a pitch for each mipmap level. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5796>
freedreno: add a fd_resource_pitch helper Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5796>
freedreno/a6xx: re-work LRZ state tracking In particular, properly detect reversal of depth-test direction. With that we can remove a lot of cases where we were unnecessarily invalidating LRZ, which was simply papering over the direction- reversal issue in deqp. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5298>
freedreno: Skip taking the lock for resource usage if it's already flagged. Improves nohw drawoverhead 8-ubos update throughput by 13.493% +/- 0.391444% (n=15). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5011>
freedreno: Move the resource_read early out to an inline. Looking at perf, the drawoverhead test case was now spending 13% CPU (89% in that function) on stack management. nohw drawoverhead throughput 1.03902% +/- 0.380257% (n=13). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4996>
freedreno: optimize rebind_resource() Track how resources are used, ie. which state they may potentially dirty if the backing bo is changed/reallocated, to optimize rebind_resource(). This will be more important in a later patch when we hook up eviction of entries in a6xx tex state cache. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4744>
freedreno: don't realloc idle bo's The `DISCARD_WHOLE_RESOURCE` is just a hint. And `rebind_resource()` is a bunch of faffing about (and going to get worse in a later patch), so let's not bother when the bo is already idle. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4744>
freedreno: Allow UBWC on textures with multiple mipmap levels. This is a backport of Jonathan Marek's UBWC work on turnip to GL. Performance highlights from our trace set (320 frames sampled) traces/glmark2/texture-texture-filter=mipmap.rdc: +9.1% +/- 2.2% traces/android/trex.rdc: +8.7% +/- 0.4% traces/glmark2/desktop-effect=shadow:windows=4.rdc: +4.2% +/- 2.5% Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3059> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3059>
freedreno/a5xx+a6xx: split LRZ layout to per-gen Seems to be a bit different for a6xx, so let's split this out. Signed-off-by: Rob Clark <robdclark@chromium.org>
freedreno: switch to layout helper The slices table and most of the other layout fields in the freedreno_resource moves into fdl_layout. v2: Changes by anholt to not have duplicate fields, which was introducing a surprising behavior change in resource layout (using the level_linear helper before the setup of the shadowed fields) Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Rob Clark <robdclark@chromium.org>
freedreno: Convert the slice struct to the new resource header. This gets the worst of the sed required for shared resource layout out of the way. The texture layout comment is dropped now that we're referencing the shared header, which has a more complete description. Acked-by: Rob Clark <robdclark@chromium.org>
freedreno: Introduce a fd_resource_tile_mode() helper. Multiple places were doing the same thing to get the tile mode of a level, so refactor it out. This will make the shared resource helper transition cleaner. Acked-by: Rob Clark <robdclark@chromium.org>
freedreno: Introduce a fd_resource_layer_stride() helper. This factors out a bit of duplicated code, but will also make the shared resource layout transition process clearer. Acked-by: Rob Clark <robdclark@chromium.org>
freedreno: fix compiler warning fd6_blitter.c:724:31: warning: passing argument 1 of ‘fd_resource_level_linear’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Eric Anholt <eric@anholt.net>
freedreno: enable tiled textures for debug builds
freedreno: add helper to uncompress UBWC resource We'll need this for a few edge cases, like image/sampler view that uses a format that UBWC does not support with a resource originally created in a format that UBWC does support. NOTE we *could* in some cases do an in-place uncompress. But that has a couple potential sharp edges: 1) the uncompressed buffer could have different layout, ie. a5xx with meta and pixel data of layers/levels interleaved. 2) if it comes mid-batch, it would force flush, or somehow fixing up cmdstream for draws already emitted. But with the resource shadowing approach we can rely on batch re-ordering to avoid splitting things.. older draws see the older compressed version, newer draws see the new uncompressed version of the rsc. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>