aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_surface.c
Commit message (Collapse)AuthorAgeFilesLines
* svga: Performance fixesNeha Bhende2020-06-051-44/+17
| | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Signed-off-by: Neha Bhende <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5317>
* svga: Add GL4.1(compatibility profile) support in svga driverNeha Bhende2020-06-051-0/+10
| | | | | | | | | This patch is a squash commit of a very long in-house patch series. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Signed-off-by: Neha Bhende <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5317>
* util: Move gallium's PIPE_FORMAT utils to /util/format/Eric Anholt2019-11-141-1/+1
| | | | | | | | | | | | | | | To make PIPE_FORMATs usable from non-gallium parts of Mesa, I want to move their helpers out of gallium. Since u_format used util_copy_rect(), I moved that in there, too. I've put it in a separate directory in util/ because it's a big chunk of related code, and it's not clear to me whether we might want it as a separate library from libmesa_util at some point. Closes: #1905 Acked-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
* svga: Remove the surface_invalidate winsys functionThomas Hellstrom2019-05-171-2/+2
| | | | | | | | | | | Instead unconditionally call SVGA3D_InvalidateGBSurface() since it's needed also for Linux for dirty buffers and operation without SurfaceDMA. For non-guest-backed operation, remove the surface cache surface invalidation altogether. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Use texture_copy_region instead of texture_copy_handle for multisamplingNeha Bhende2018-09-101-9/+18
| | | | | | | | | | | | | This fixes some of tests cases in arb_copy_image-formats and also fixes SurfaceCopy related errors in vmware.log when multi sampled surfaces are used. Tested with piglit, glretrace on windows and linux VM. v2: As per Brian's comment Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: add sample positions for 2 samplesCharmaine Lee2018-09-101-0/+7
| | | | | | | Fixes piglit tests spec@arb_sample_shading@builtin-gl-sample-position 2 spec@arb_texture_multisample@fb-completeness@2 Reviewed-by: Brian Paul <[email protected]>
* svga: fix a typo in svga_texture_copy_region()Charmaine Lee2018-09-101-1/+1
| | | | Trivial.
* svga: fix cubemap array rendering with backed surface viewCharmaine Lee2018-09-101-12/+74
| | | | | | | | | This patch fixes the layer index when rendering to a backed surface view of a cubemap array. Fixes piglit test fbo-generatemipmap-cubemap array. Reviewed-by: Brian Paul <[email protected]>
* svga: enable MSAA for SM4_1 deviceBrian Paul2018-09-101-1/+2
| | | | | | | | | 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 <[email protected]>
* svga: add support for cubemap arrayCharmaine Lee2018-09-101-1/+5
| | | | | | | | | This patch adds support for cubemap array for SM4_1. Fixes piglit test arb_texture_cube_map_array-cubemap Reviewed-by: Neha Bhende <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* svga: sync with upstream changes to surface flagsCharmaine Lee2018-09-051-2/+2
| | | | | | | | | SVGA device now supports 64 bits surface flags. This patch updates the winsys interface to allow 64 bits surface flags. The linux winsys layer will for now only honor the lower 32 bits of the surface flags. Reviewed-by: Brian Paul <[email protected]>
* svga: update device header files from upstreamBrian Paul2018-09-051-2/+2
| | | | | | This is a squash commit of several earlier patches. Signed-off-by: Brian Paul <[email protected]>
* svga: fix breakage in create_backed_surface_view()Brian Paul2017-07-101-4/+3
| | | | | | | | This fixes a regression in some piglit tests since commit 5e5d5f1a2eb. I think I mis-resolved the merge conflict when cherry-picking that commit to master. Reviewed-by: Charmaine Lee <[email protected]>
* svga: add mksstats for surface view emulationCharmaine Lee2017-06-301-10/+17
| | | | | | | Add mksstats for surface view emulation and also tighten the stat CreateBackedView for the actual creation of backed view. Reviewed-by: Brian Paul <[email protected]>
* svga: fix pre-mature flushing of the command bufferCharmaine Lee2017-06-221-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | When surface_invalidate is called to invalidate a newly created surface in svga_validate_surface_view(), it is possible that the command buffer is already full, and in this case, currently, the associated wddm winsys function will flush the command buffer and resend the invalidate surface command. However, this can pre-maturely flush the command buffer if there is still pending image updates to be patched. To fix the problem, this patch will add a return status to the surface_invalidate interface and if it returns FALSE, the caller will call svga_context_flush() to do the proper context flush. Note, we don't call svga_context_flush() if surface_invalidate() fails when flushing the screen surface cache though, because it is already in the process of context flush, all the image updates are already patched, calling svga_context_flush() can trigger a deadlock. So in this case, we call the winsys context flush interface directly to flush the command buffer. Fixes driver errors and graphics corruption running Tropics. VMware bug 1891975. Also tested with MTT glretrace, piglit and various OpenGL apps such as Heaven, CinebenchR15, NobelClinicianViewer, Lightsmark, GoogleEarth. cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* svga: implement sRGB rendering for imported surfacesNeha Bhende2017-04-281-2/+9
| | | | | | | | | | If texture is imported and templ format is sRGB, use compatible sRGB format to the imported texture format while creating surface view. tested with MTT piglit, glretrace, viewperf and conform Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Removed the unused label 'done' in svga_validate_surface_view()Charmaine Lee2017-04-261-1/+0
| | | | Trivial fix
* svga: use the winsys interface to invalidate surfaceCharmaine Lee2017-04-261-5/+1
| | | | | | | | | | Instead of directly sending the InvalidateGBSurface command, this patch uses the invalidate_surface interface. Fixes Linux VM piglit failures including ext_texture_array-gen-mipmap, fbo-generatemipmap-array S3TC_DXT1 Reviewed-by: Brian Paul <[email protected]>
* svga: cache the backing surface handle in the texture objectCharmaine Lee2017-04-261-9/+38
| | | | | | | | | | | | | | | | | | CinebenchR15 not only binds the same texture for rendering and sampling, it actually changes the framebuffer buffer attachment very often, causing a lot of backed surface view to be created and a lot of surface copies to be done. This patch caches the backed surface handle in the texture resource and allows the backed surface view to reuse the backed surface handle. With this patch, the number of backed surface view reduces from 1312 to 3. Unfortunately, this does not eliminate all the surface copies. There are still surface copies involved when we switch from original to backed surface handle for rendering. Tested with CinebenchR15, NobelClinicianViewer, Turbine, Lightsmark2008, MTT glretrace, MTT piglit. Reviewed-by: Brian Paul <[email protected]>
* svga: Update the backing resource only if neededCharmaine Lee2017-04-261-3/+11
| | | | | | | | | | | | | | This patch adds a timestamp in svga_surface structure to keep track of when the backing surface is last sync with the original resource. This helps to avoid unnecessary surface copy from the original resource to the backing surface if the original resource has not since been modified. This reduces the amount of surface copy with CinebenchR15. Tested with CinebenchR15, mtt glretrace. Reviewed-by: Brian Paul <[email protected]>
* svga: Set the surface dirty bit for the right surface viewCharmaine Lee2017-04-261-5/+19
| | | | | | | | For VGPU10, we will render to a backed surface view when the same resource is used for rendering and sampling. In this case, we will mark the dirty bit for the backed surface view. Reviewed-by: Brian Paul <[email protected]>
* svga: Move rendertarget view related fields to hw_clear stateCharmaine Lee2017-04-261-4/+4
| | | | | | | | This patch moves the rendertarget view related fields from svga_hw_draw_state to svga_hw_clear_state where all the hw framebuffer related state resides. Reviewed-by: Brian Paul <[email protected]>
* svga: improve surface view debug messagesBrian Paul2017-04-261-4/+5
| | | | | | The old ones were somewhat cryptic. Reviewed-by: Charmaine Lee <[email protected]>
* svga: Fix zslice index to svga_texture_copy_handle_resource()Charmaine Lee2017-04-071-7/+10
| | | | | | | | | | | The zslice index to svga_texture_copy_handle_resource() is not adjusted and should be a signed integer. This patch fixes piglit tests for non-vgpu10 including spec@arb_framebuffer_object@fbo-generatemipmap-3d [email protected]@execution@tex-miplevel-selection gl2:texture* 3d Tested with MTT piglit and glretrace
* svga: Fix out-of-sync backing surfaceCharmaine Lee2017-04-071-21/+70
| | | | | | | | | | | | | | | When a backing surface is reused, it is possible that the original surface has been changed. So before the backing surface is bound again, we need to sync up the surface. This patch creates a new helper function svga_texture_copy_handle_resource() to sync up the backing surface resource. This patch, together with the backing surface dirty bit fix, fixes the rendering corruption in NobelClinicianViewer when rotating the model. Also tested with MTT glretrace, piglit, Cinebench, Turbine. Reviewed-by: Brian Paul <[email protected]>
* svga: add a reset flag to svga_propagate_surface()Charmaine Lee2017-04-071-4/+12
| | | | | | | | | The reset flag specifies if the dirty bit needs to be reset after the surface is propagated to the texture. This is used to make sure that the dirty bit is not reset and stay unset before the surface is unbound. Reviewed-by: Brian Paul <[email protected]>
* svga: add the has_backed_views flagCharmaine Lee2017-04-071-0/+8
| | | | | | | | | The new has_backed_views flag specifies if any of the render target views or depth stencil view is a backing surface view. The flag is used in svga_propagate_rendertargets() so it can return early if there is no surface to propagate. Reviewed-by: Brian Paul <[email protected]>
* svga: only destroy render target view from a context that created itCharmaine Lee2017-04-071-12/+23
| | | | | | | | | | | | | | A texture can be destroyed from a different context from which it is created, but destroying the render target view from a different context will cause svga device errors. Similar to shader resource view, this patch skips destroying render target view or depth stencil view from a non-parent context. Fixes driver errors running NobelClinician Viewer application. Tested with NobelClinician Viewer, MTT piglit, glretrace. Reviewed-by: Brian Paul <[email protected]>
* svga: invalidate new surface before it is bound to a render target viewCharmaine Lee2016-11-031-1/+21
| | | | | | | | | Invalidate a "new" surface before it is bound to a render target view or depth stencil view in order to avoid the unnecessary host side copy of the surface data before it is rendered to. Note that, recycled surface is already invalidated before it is reused. Reviewed-by: Brian Paul <[email protected]>
* svga: create BGRX render target view for BGRX_UNORM surfaceCharmaine Lee2016-11-031-1/+2
| | | | | | | | | | Currently we adjust the view format when we are asked to create a BGRA render target view for BGRX surface. But we only look for SVGA3D_B8G8R8X8_TYPELESS surface format. With this patch, we will also check for SVGA3D_B8G8R8X8_UNORM surface format, and use SVGA3D_B8G8R8X8_UNORM as the view format for that case. Reviewed-by: Brian Paul <[email protected]>
* svga: eliminate unneeded gotos in svga_validate_surface_view()Brian Paul2016-09-231-7/+4
| | | | Reviewed-by: Charmaine Lee <[email protected]>
* svga: minor simplification in svga_validate_surface_view()Brian Paul2016-09-211-3/+2
| | | | | | Get rid of unneeded local var. Reviewed-by: Charmaine Lee <[email protected]>
* svga: single sample surface can be created as non-multisamples surfaceCharmaine Lee2016-09-171-1/+3
| | | | | | | | | With this patch, single sample surface will be created as non-multisamples surface. Tested with piglit, glretrace. Reviewed-by: Brian Paul <[email protected]>
* svga: Add function svga_resource_type()Neha Bhende2016-09-171-19/+1
| | | | | | | This function returns svga texture type for corresponding pipe texture. Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* svga: fix a texture readback bugBrian Paul2016-08-291-6/+10
| | | | | | | | | | | | | | | | | | | | Backing views/surfaces are used to handle the case when a resource is bound both as a render target and as a sampler source (such as when doing auto mipmap generation). This patch fixes a bug where mapping a resource (to do a glReadPixels) was reading the stale data in the original surface rather than the backing surface which was rendered to. We need to propagate the backing resource (which we rendered to) back to the original resource before we read from it. The problem was the svga_propagate_rendertargets() function was examining the wrong surface views. This fixes the "poc9" test described in VMware bug 1686661. Also tested with Piglit, Cinebench, Lightsmark, etc. Reviewed-by: Charmaine Lee <[email protected]>
* svga: move surface propagation code into new functionBrian Paul2016-08-291-0/+22
| | | | | | | Put new svga_propagate_rendertargets() function where all the other surface propagation code lives. Reviewed-by: Charmaine Lee <[email protected]>
* svga: s/unsigned/enum pipe_shader_type/Brian Paul2016-08-291-1/+1
| | | | Reviewed-by: Charmaine Lee <[email protected]>
* svga: move some code in svga_propagate_surface()Brian Paul2016-08-261-18/+19
| | | | | | | Move computation of zslice, layer inside the conditional where they're used. Reviewed-by: Neha Bhende <[email protected]>
* svga: remove local variable in create_backed_surface_view()Brian Paul2016-08-261-7/+4
| | | | | | To simplify the code a bit. Reviewed-by: Neha Bhende <[email protected]>
* svga: add guest statistic gathering interfaceCharmaine Lee2016-08-261-6/+40
| | | | | | | | | | | | With this patch, guest statistic gathering interface is added to svga winsys interface that can be used to gather svga driver statistic. The winsys module can then share the statistic info with the VMX host via the mksstats interface. The statistic enums used in the svga driver are defined in svga_stats_count and svga_stats_time in svga_winsys.h Reviewed-by: Brian Paul <[email protected]>
* svga: remove unused var in svga_mark_surfaces_dirty()Brian Paul2016-08-161-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* svga: reduce looping in svga_mark_surfaces_dirty()Brian Paul2016-08-161-1/+1
| | | | | | | | | We don't need to loop over the max number of color buffers, just the current number (which is usually one). Tested with full Piglit run, Heaven 4.0, etc. Reviewed-by: Charmaine Lee <[email protected]>
* svga: adjust render target view format for RGBXBrian Paul2016-06-301-1/+13
| | | | | | | | For GL_ARB_copy_image we may be asked to create an RGBA view of a RGBX surface. Use an RGBX view format for that case. Acked-by: Roland Scheidegger <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: whitespace, line wrapping fixes in svga_surface.cBrian Paul2016-06-281-11/+16
|
* gallium/drivers: Sanitize NULL checks into canonical formEdward O'Callaghan2015-12-061-1/+1
| | | | | | | | | | Use NULL tests of the form `if (ptr)' or `if (!ptr)'. They do not depend on the definition of the symbol NULL. Further, they provide the opportunity for the accidental assignment, are clear and succinct. Signed-off-by: Edward O'Callaghan <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* svga: add new GALLIUM_HUD queriesNeha Bhende2015-10-161-0/+4
| | | | | | | | | | | | | | | | | | Add new GALLIUM_HUD queries for: num-shaders num-resources num-state-objects num-validations map-buffer-time num-surface-views num-resources-mapped num-flushes Most of this patch was originally written by Neha. Additional clean-ups and num-flushes counter added by Brian Paul. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Fix surface view error handlingThomas Hellstrom2015-09-071-22/+26
| | | | | | | | | Make sure errors are correcly propagated. Also don't flush during state emission if emission fails. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* svga: increment texture age when surface is to be marked as dirtyCharmaine Lee2015-09-021-7/+6
| | | | | | | | | | | | | | | | Commit b9ba8492 removes an unneeded pipe_surface_release() from st_render_texture(). This implies a surface can now be reused for a render buffer. Currently, when we render to a texture, we mark the surface as dirty. But in svga_mark_surface_dirty(), if the surface is already marked as dirty, it does not increment the texture age. Any view to this texture might not be updated properly then. With this patch, the texture age is incremented regardless of whether the surface is already marked as dirty or not. Fix bug 1499181. Reviewed-by: Sinclair Yeh <[email protected]>
* svga: fix backed surface view regressionCharmaine Lee2015-09-021-5/+9
| | | | | | | | | | | | | | | | | | Commit b9ba8492 removes an unneeded pipe_surface_release() from st_render_texture() and exposes a bug in the backed surface view creation. Currently a backed surface view for a conflicted surface view is created at framebuffer emit time. But if shader sampler views are changed but framebuffer surface views remain unchanged, emit_framebuffer() will not be called and conflicted surface views will not be detected. To fix this, also check for conflicted surface views when setting sampler views. If there is any conflicted surface views, enable the framebuffer dirty bit so that the framebuffer emit code has a chance to create a backed surface view for the conflicted surface view. Fix cinebench-r11-test regression. Reviewed-by: Brian Paul <[email protected]>
* svga: update driver for version 10 GPU interfaceBrian Paul2015-09-021-66/+353
| | | | | | | | | | | | | | | | | This is a squash commit of roughly two years of development work. Authors include: Brian Paul Charmaine Lee Thomas Hellstrom Jakob Bornecrantz Sinclair Yeh Mingcheng Chen Kai Ninomiya MengLin Wu The driver supports OpenGL 3.3. Signed-off-by: Brian Paul <[email protected]>