svga, winsys/svga: Fix persistent memory discard maps
authorThomas Hellstrom <thellstrom@vmware.com>
Sat, 28 Mar 2020 17:02:25 +0000 (18:02 +0100)
committerThomas Hellstrom (VMware) <thomas_os@shipmail.org>
Wed, 1 Apr 2020 06:38:04 +0000 (08:38 +0200)
commit46fdc288fb52345134fd9aacd6d7ff71c7b747bb
tree3d1a381738634955e77541a39520fe38e3e393be
parent1b16d6354bc9f64ed97fc400977e3ffcb4c09268
svga, winsys/svga: Fix persistent memory discard maps

The kernel driver requires immediate notification using a
BindGBSurface command when a graphics coherent memory resource changes
backing MOB, so that it can start dirty-tracking the new MOB.
Since we always use graphics coherent memory for persistent memory, enqueue
and flush a BindGBSurface commmand at map time rather than at unmap time.
Since we're dealing with persistent memory, It's OK to flush while mapped.

This fixes an issue with gnome-shell / Wayland which uses persistent
memory together with discard maps when we advertise ARB_buffer_storage.
XWayland clients will render incorrectly.

Fixes: 71b43490dd ("svga: Support ARB_buffer_storage")
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4399>
src/gallium/drivers/svga/svga_resource_buffer.h
src/gallium/drivers/svga/svga_resource_texture.c
src/gallium/drivers/svga/svga_winsys.h
src/gallium/winsys/svga/drm/vmw_surface.c
src/gallium/winsys/svga/drm/vmw_surface.h