winsys/svga: fix display corruption after surface_init When we initialize the buffer surface, do not map the existing storage with DONTBLOCK, leave it as a synchronized map. This patch also sets the surface rebind flag after it is bound to a new buffer and sets the surface buffer pointer accordingly. This fixes display corruption issue seen with running steam. Reviewed-by: Neha Bhende <bhenden@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6415>
svga: Performance fixes This is a squash commit of in house performance fixes and misc bug fixes for GL4.1 support. Performance fixes: * started using system memory for constant buffer to gain 3X performance boost with metro redux Misc bug fixes: * fixed usage of vertexid in shader * added empty control point phase in hull shader for zero ouput control point * misc shader signature fixes * fixed clip_distance input declaration * clearing the dirty bit for the surface while using direct map if surface is already flushed and there is no pending primitive This patch also uses SVGA_RETRY macro for commands retries. Part of it is already used in previous patch. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com> Signed-off-by: Neha Bhende <bhenden@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5317>
svga: Add GL4.1(compatibility profile) support in svga driver This patch is a squash commit of a very long in-house patch series. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com> Signed-off-by: Neha Bhende <bhenden@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5317>
util: remove LIST_DEL macro Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <eric@engestrom.ch>
util: remove LIST_ADD macro Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <eric@engestrom.ch>
util: remove LIST_ADDTAIL macro Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <eric@engestrom.ch>
svga: Support ARB_buffer_storage This basically boils down to supporting persistent and coherent buffer storage. We chose to use coherent buffer storage for all persistent buffers even if it's not explicitly specified, since using glMemoryBarrier to obtain coherency would be particularly expensive in our driver stack, and require a lot of additional bookkeeping. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
svga: Add an environment variable to force coherent surface memory The vmwgfx driver supports emulated coherent surface memory as of version 2.16. Add en environtment variable to enable this functionality for texture- and buffer maps: SVGA_FORCE_COHERENT. This environment variable should be used for testing only. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
svga: set buffer bind_flags in svga_buffer_add_host_surface() To match the in-house VMware code. Signed-off-by: Brian Paul <brianp@vmware.com>
svga: enable MSAA for SM4_1 device The SVGA device is deprecating the DX9 MSAA support. This patch enables MSAA for SM4_1 device by explicitly setting the SVGA3D_SURFACE_MULTISAMPLE bit. For SM4_1 device, only 4 samples is supported. Reviewed-by: Brian Paul <brianp@vmware.com>
svga: fix incompatible bind flags at buffer validation time At buffer resource validation time, if the resource handle is not yet created and if the initial buffer bind flags and the tobind flags are incompatible, just use the tobind flags to create the resource handle. On the other hand, if the bind flags are compatible, we can combine the bind flags for the resource handle creation. Fixes piglit gl-3.1-buffer-bindings crash. Reviewed-by: Brian Paul <brianp@vmware.com>
svga: fix buffer binding flags initialization If a buffer is created/initialized with glNamedBufferData we will have no target (GL_ARRAY_BUFFER, GL_UNIFORM_BUFFER, etc) so the svga_buffer::bind_flags will be zero until we try to get the buffer handle. This patch initializes the svga_buffer::bind_flags field when it's zero. This fixes the Piglit arb_uniform_buffer_object-rendering-dsa test. Note that there's still issues in this area that'll have to be addressed in the future. For example, creating a buffer object as GL_UNIFORM_BUFFER and later using it as a vertex buffer will fail. Reviewed-by: Charmaine Lee <charmainel@vmware.com>
svga: whitespace fixes in svga_resource_buffer_upload.c Trivial.
svga: create buffer surfaces for incompatible bind flags In cases where certain bind flags cannot be enabled together, such as CONSTANT_BUFFER cannot be combined with any other flags, a separate host surface will be created. For example, if a stream output buffer is reused as a constant buffer, two host surfaces will be created, one for stream output, and another one for constant buffer. Data will be copied from the stream output surface to the constant buffer surface. Fixes piglit test ext_transform_feedback-immediate-reuse-index-buffer, ext_transform_feedback-immediate-reuse-uniform-buffer Tested with MTT piglit, MTT glretrace, Nature, NobelClinician Viewer, Tropics. v2: Fix bind flags compatibility check as suggested by Brian. v3: Use the list utility to maintain the buffer surface list. v4: Use the SAFE rev of LIST_FOR_EACH_ENTRY Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
svga: do not unconditionally enable streamout bind flag Currently we unconditionally enable streamout bind flag at buffer resource creation time. This is not necessary if the buffer is never used as a streamout buffer. With this patch, we enable streamout bind flag as indicated by the state tracker. If the buffer is later bound to streamout and does not already has streamout bind flag enabled, we will recreate the buffer with the new set of bind flags. Buffer content will be copied from the old buffer to the new one. Tested with MTT piglit, Nature, Tropics, Lightsmark. v2: Fix bind flags check as suggested by Brian. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
svga: pass tobind_flags to svga_buffer_handle This is to prepare for more bind_flags optimization in subsequent patches. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
svga: pass bind_flags to surface create functions This is to prepare for other bind_flags optimization in subsequent patches. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
svga: add a few minor comments Trivial.
gallium/util: replace pipe_mutex_unlock() with mtx_unlock() pipe_mutex_unlock() was made unnecessary with fd33a6bcd7f12. Replaced using: find ./src -type f -exec sed -i -- \ 's:pipe_mutex_unlock(\([^)]*\)):mtx_unlock(\&\1):g' {} \; Reviewed-by: Marek Olšák <marek.olsak@amd.com>
gallium/util: replace pipe_mutex_lock() with mtx_lock() replace pipe_mutex_lock() was made unnecessary with fd33a6bcd7f12. Replaced using: find ./src -type f -exec sed -i -- \ 's:pipe_mutex_lock(\([^)]*\)):mtx_lock(\&\1):g' {} \; Reviewed-by: Marek Olšák <marek.olsak@amd.com>