llvmpipe: unmap display target of shader image/sampler
authorHeinrich Fink <hfink@snap.com>
Wed, 30 Jun 2021 11:28:17 +0000 (13:28 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 9 Jul 2021 15:58:53 +0000 (15:58 +0000)
commit21864bdaaef65ebb7677e75501d3a08144889bf4
tree79324cf36e9be57c2b378cc5e8c8d9c6cb547761
parenta195ef123ea31ea89a0994d95b5c1f20462bfb6f
llvmpipe: unmap display target of shader image/sampler

Revive hooks for cleaning up shader sampler and image data and when
finalizing llvmpipe_draw_vbo. In cleanup routines, for any sampler or
image that was set up with displaytarget_map, call displaytarget_unmap.

This fixes leaks of mmap calls of the underlying displaytarget
resources.

v2 (Daniel Stone):
    - Use a single cleanup function for sampler/image to simplify patchset

v3 (Emil Velikov):
    - use llvmpipe_resource_[un]map instead of open-coding through
    winsys

v4:
    - check tex/image for NULL before calling into
    llvmpipe_resource_unmap (fixes dEQP crash of llvmpipe runner)

Signed-off-by: Heinrich Fink <hfink@snap.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11741>
src/gallium/drivers/llvmpipe/lp_draw_arrays.c
src/gallium/drivers/llvmpipe/lp_state.h
src/gallium/drivers/llvmpipe/lp_state_sampler.c