llvmpipe: Unmap DMA buffer to release all resources

If the buffer is not unmapped then a reference to the DMA buffer
is still kept. The DRM device is then not properly cleaned up.
This can cause the application to keep a DRM device open which is
still DRM master without any visible open file descriptors.

Fixes: d74ea2c117 ("llvmpipe: Implement dmabuf handling")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31022>
This commit is contained in:
Thomas Wagner 2024-07-09 16:56:05 +02:00 committed by Marge Bot
parent af16ec6e0c
commit 39156b6cd4

View file

@ -557,6 +557,8 @@ llvmpipe_resource_destroy(struct pipe_screen *pscreen,
if (lpr->dt) {
/* display target */
struct sw_winsys *winsys = screen->winsys;
if (lpr->dmabuf)
winsys->displaytarget_unmap(winsys, lpr->dt);
winsys->displaytarget_destroy(winsys, lpr->dt);
} else if (llvmpipe_resource_is_texture(pt)) {
/* free linear image data */
@ -1611,7 +1613,10 @@ llvmpipe_resource_bind_backing(struct pipe_screen *pscreen,
if (lpr->dmabuf) {
if (lpr->dt)
{
winsys->displaytarget_unmap(winsys, lpr->dt);
winsys->displaytarget_destroy(winsys, lpr->dt);
}
if (pmem) {
/* Round up the surface size to a multiple of the tile size to
* avoid tile clipping.