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: handle case of shadowing current render target If you have a sequence where there is a single buffer associated with the current render target, and then you end up shadowing it on the 3d pipe (u_blitter), because of how we swap the new shadow and rsc before the back-blit, you could end up confusing things into thinking that the blitters framebuffer state is the same as the current framebuffer state. Re-organizing the sequence to swap after the blit is complicated when also having to deal with CPU memcpy blit path, and the batch/rsc accounting. So instead just detect this case and flush if we need to. Fixes: dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_clear dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_draw Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6434>
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 pipe screen's resource_from_memobj v2: Use 'prsc' and 'rsc', 'pmemobj' and 'memobj' for consistency with rest of the code. (Rob Clark) v3: - Use the existing flag PIPE_BIND_LINEAR instead (Marek Olšák) - Assert that the resource is not intended for scanout (Rob Clark) - Use the fd_resource_allocate_and_resolve() helper (Rob Clark) - Check that bo's resolved size fit into memobj's bo size (Rob Clark) v4: Don't steal memobj's bo, but share it instead by getting a new ref. (Rob Clark) Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4565>
freedreno: Refactor fd_resource_create_with_modifiers() into a helper The helper just allocates and resolves layout, but does not deal with scanout buffers nor allocation of the actual bo. The resolved bo size is returned as an output argument. Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4565>
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: fix layout pitchalign field not being set for imported buffers The pitchalign value was being left to 0 and then wrapping around when the base offset was subtracted in texture state. Fixes: 979e7e3680792 ("freedreno/layout: layout simplifications and pitch from level 0 pitch") Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5864>
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: Handle DRM_FORMAT_MOD_INVALID in shared code layout_resource_for_modifier() needs to handle DRM_FORMAT_MOD_INVALID as well, since src/gallium/frontends/dri/dri2.c uses this to indicate "no modifier" when it's called through the older non-modifier entry points. This is similar to 334788d4 ("freedreno: allow INVALID modifier") but for the generic implementation. Fixes: 98910626 ("freedreno/a6xx: Implement layout for DRM_FORMAT_MOD_QCOM_COMPRESSED") Closes: #3154 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5611>
freedreno/fdl6: rework layout code a bit (reduce linear align to 64 bytes) Reduce linear alignment, and rework the layout code a bit. This rework has a side effect of also increasing the alignment on linear levels of tiled (non-ubwc) cpp=1 and cpp=2 layouts. Since we should be UBWC for those cases anyway, its not a big loss. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5013>
freedreno: handle PIPE_TRANSFER_MAP_DIRECTLY Just something I noticed in the process of debugging the issue fixed in the previous commit. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5188>
freedreno/a6xx: don't use gmem_alignw for imported buffers Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4611>
freedreno: move a4xx specific layout code to a4xx code Every other gen has its own setup_slices Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4611>
gallium: change comments to remove 'state tracker' Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4902>
gallium: rename 'state tracker' to 'frontend' Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4902>
freedreno: fix buffer import `rsc->layout.cpp` is zero until we `fd_resource_layout_init()` Fixes: 5a8718f01b3 ("freedreno: Make the slice pitch be bytes, not pixels.") Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4818>
freedreno: add screen lock wrappers This will make it easier to swap out to simple_mtx_t Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4810>
freedreno/a6xx: invalidate tex state cache entries on rebind When a resource's backing bo changes, its seqno will be incremented. Which would result in a new tex state cache key, and nothing to clean up the old tex state until the sampler view/state is destroyed. But in some games, that may never happen, or at least not happen before we run out of memory. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2830 Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4744>