aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_resource_texture.c
Commit message (Collapse)AuthorAgeFilesLines
* gallium: switch boolean -> bool at the interface definitionsIlia Mirkin2019-07-221-7/+7
| | | | | | | | | | | | | | | | | | This is a relatively minimal change to adjust all the gallium interfaces to use bool instead of boolean. I tried to avoid making unrelated changes inside of drivers to flip boolean -> bool to reduce the risk of regressions (the compiler will much more easily allow "dirty" values inside a char-based boolean than a C99 _Bool). This has been build-tested on amd64 with: Gallium drivers: nouveau r300 r600 radeonsi freedreno swrast etnaviv v3d vc4 i915 svga virgl swr panfrost iris lima kmsro Gallium st: mesa xa xvmc xvmc vdpau va Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]>
* svga: Support ARB_buffer_storageThomas Hellstrom2019-06-201-0/+3
| | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* svga: Add an environment variable to force coherent surface memoryThomas Hellstrom2019-05-171-22/+36
| | | | | | | | | | 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 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* svga: Set the rendered-to flag for dma transfers to surfacesThomas Hellstrom2019-05-171-0/+4
| | | | | | | | | | The rendered-to flag indicates that the HW surface content is more recent than the content of the mob. That's the case after a SurfaceDMA transfer to the surface. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Avoid bouncing buffer data in malloced buffersThomas Hellstrom2019-05-021-1/+1
| | | | | | | | | | | | | | Some constant- and texture upload buffer data may bounce in malloced buffers before being transferred to hardware buffers. In the case of texture upload buffers this seems to be an oversight. In the case of constant buffers, code comments indicate that we want to avoid mapping hardware buffers for reading when copying out of buffers that need modification before being passed to hardware. In this case we avoid data bouncing for upload manager buffers but make sure buffers that we read out from stay in malloced memory. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* svga: assorted whitespace and formatting fixesBrian Paul2019-02-261-9/+10
| | | | | | Remove trailing whitespace, etc. Trivial.
* svga: fix texture array layer index in transfer mapCharmaine Lee2018-09-201-66/+41
| | | | | | | | | | | | | | | | | | | | | In gallium, the layer index of a texture array to be mapped is specified in the z component, whereas in svga device, the index is specified in a separate argument. Currently in svga_texture_transfer_map(), we explicitly modify the z value in the base transfer map to 0 so the layer offset will not be applied twice, but this causes problem when state tracker later refers to the base transfer map and expects the slice index to be specified in z (commit 463b0ea1f6762b7e0536cfadc4e384840af3e8e0). To fix the problem, this patch makes a local copy of the box in svga_transfer and modifies the z value in this copy instead. Fixes spec@khr_texture_compression-astc piglit test crashes. Fixes regression in the dma path with commit 1fdd3dd94a. Tested with mtt glretrace, piglit on Windows VM and Linux VM. Reviewed-by: Brian Paul <[email protected]>
* svga: no dma on multisample surfaceCharmaine Lee2018-09-101-0/+7
| | | | | | | | | | Force direct map on multisample surface. Fixes SVGA Driver Errors running multisample piglit tests on Linux VM v2: use texture for the check. Reviewed-by: Neha Bhende <[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-9/+26
| | | | | | | | | 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]>
* gallium: add storage_sample_count parameter into is_format_supportedMarek Olšák2018-07-311-0/+3
| | | | Tested-by: Dieter Nützel <[email protected]>
* gallium/u_upload_mgr: allow drivers to specify pipe_resource::flagsMarek Olšák2017-12-051-1/+1
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* svga: if we get nr_samples==1, store nr_samples=0Brian Paul2017-10-031-4/+7
| | | | | | | | | | We need to be more careful not to treat nr_samples=1 as an msaa surface. This patch prevents us from errantly declaring an MSAA shader resource with 1 sample. No Piglit regressions, fixes the above-described errors. Reviewed-by: Neha Bhende <[email protected]>
* drivers/svga, winsys/svga/drm: Thread through timeout for fence_finishSinclair Yeh2017-07-171-2/+2
| | | | | | | | | | | | The timeout parameter is required to implement EGL_ANDROID_native_fence_sync. v2 * Replaced default timeout from 0 to PIPE_TIMEOUT_INFINITE * Add more documentation to the new timeout parameter Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: don't call svga_texture_device_format_has_alpha() for PIPE_BUFFERBrian Paul2017-07-031-0/+3
| | | | | | | | | | | svga_texture_device_format_has_alpha() is only intended to work for texture resources, not buffer resources. This fixes a failed assertion in the svga_texture() cast function when running texture buffer tests. Also, add an assertion in svga_texture_device_format_has_alpha() to catch the issue sooner. Reviewed-by: Charmaine Lee <[email protected]>
* svga: add texture size/levels sanity check code in svga_texture_create()Brian Paul2017-06-301-0/+33
| | | | | | | | | The state tracker should never ask us to create a texture with invalid dimensions / mipmap levels. Do some assertions to check that. No Piglit regressions. Reviewed-by: Charmaine Lee <[email protected]>
* svga: loop over box.depth for ReadBack_image on each sliceNeha Bhende2017-06-301-7/+8
| | | | | | | | piglit test ext_texture_array-gen-mipmap is fixed with this patch. Tested with mtt piglit, glretrace, viewperf and conform. No regression. Reviewed-by: Brian Paul <[email protected]>
* svga: pass tobind_flags to svga_buffer_handleCharmaine Lee2017-06-271-1/+1
| | | | | | | | This is to prepare for more bind_flags optimization in subsequent patches. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* svga: Fix imported surface view creationThomas Hellstrom2017-06-071-0/+22
| | | | | | | | | | When deciding to create a view with or without an alpha channel we need to look at the SVGA3D format and not the PIPE format. This fixes the glx-tfp piglit test for dri3/xa. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Add a more elaborate format compatibility determination v2Thomas Hellstrom2017-04-281-41/+17
| | | | | | | | | | | | | | dri3 is a bit sloppy about its format compatibility requirements, so add a possibility to import xrgb surfaces as argb textures and vice versa. At the same time, make the svga_texture_from_handle() function a bit more readable and fix the error path where we leaked a winsys surface. v2: Addressed review comments by Brian. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: cache the backing surface handle in the texture objectCharmaine Lee2017-04-261-0/+7
| | | | | | | | | | | | | | | | | | 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: invalidate new surface before it is bound to a render target viewCharmaine Lee2016-11-031-1/+2
| | | | | | | | | 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]>
* Revert "svga: use untyped surface formats in most cases"Charmaine Lee2016-11-031-7/+4
| | | | | | Using untyped surface formats causes huge performance degradation on Fusion. This reverts commit eb0ced74f6decd1bf1e111b162e1389bede89af6 until the backend has a better solution to address typeless surface formats.
* svga: add can_use_upload flagCharmaine Lee2016-11-031-29/+30
| | | | | | | | | This patch adds a flag "can_use_upload" to svga_texture structure to avoid some checking of the upload availability at each transfer map time. Tested with Lightsmark2008, Tropics, MTT glretrace, piglit. Reviewed-by: Brian Paul <[email protected]>
* svga: fix texture upload path conditionCharmaine Lee2016-11-031-30/+60
| | | | | | | | | | | | As Thomas suggested, we'll first try to map directly to a GB surface. If it is blocked, then we'll use texture upload buffer. Also if a texture is already "rendered to", that is, the GB surface is already out of sync, then we'll use the texture upload buffer to avoid syncing the GB surface. Tested with Lightsmark2008, Tropics, MTT piglit, glretrace. Reviewed-by: Brian Paul <[email protected]>
* svga: set rendered_to flag with texture uploaded using TransferFromBuffer ↵Charmaine Lee2016-11-031-0/+4
| | | | | | | | | | | | command This patch sets the rendered_to flag for the texture subresource that is uploaded using the TransferFromBuffer command. This is to ensure that the subresource will be read back or invalidated before it will be directly mapped to. This makes sure that the content of the GB surface will not be accidentally overwritten by the device at suspend/resume time. Reviewed-by: Brian Paul <[email protected]>
* svga: set PIPE_BIND_DEPTH_STENCIL flag for new resources when possibleBrian Paul2016-09-231-1/+11
| | | | | | | | When we create a depth/stencil texture, also check if we can render to it and set the PIPE_BIND_DEPTH_STENCIL flag. We were previously doing this for color textures (PIPE_BIND_RENDER_TARGET). Reviewed-by: Charmaine Lee <[email protected]>
* svga: relax restriction of compressed formats for texture uploadCharmaine Lee2016-09-171-3/+22
| | | | | | | | | | | | | | | This patch relaxes the restriction of compressed formats for texture upload buffer. For now, 3D texture with compressed format is still not supported in the texture upload buffer path. As Brian noted, ETQW does many texture updates with glCompressedTexSubImage. This patch greatly improves the performance of the ETQW trace. Tested with ETQW, MTT piglit, glretrace, conform, viewperf v2: Per Brian's suggestion, removed the subregion boundary check. Reviewed-by: Brian Paul <[email protected]>
* svga: use upload buffer for upload texture.Charmaine Lee2016-09-171-26/+232
| | | | | | | | | | | | | With this patch, when running with vgpu10, instead of mapping directly to the guest backed memory for texture update, we'll use the texture upload buffer and use the transfer from buffer command to update the host side texture memory. This optimization yields about 20% performance improvement with Lightsmark2008 and about 40% with Tropics. Tested with Lightsmark2008, Tropics, Heaven, MTT piglit, glretrace, conform. Reviewed-by: Brian Paul <[email protected]>
* svga: refactor svga_texture_transfer_map/unmap functionsCharmaine Lee2016-09-171-217/+272
| | | | | | | | | Split the functions into separate functions for dma and direct map to make the code more readable. Tested with MTT piglit, glretrace, viewperf, conform, various OpenGL apps Reviewed-by: Brian Paul <[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: split the num-resources-mapped hud to textures & buffersCharmaine Lee2016-09-171-1/+2
| | | | | | | | Replace the num-resources-mapped hud with num-textures-mapped and num-buffers-mapped, so we can differentiate the map counts for these two different resources. Reviewed-by: Brian Paul <[email protected]>
* svga: minor code simplification in svga_texture_transfer_unmap()Brian Paul2016-08-261-2/+1
| | | | | | Use the tex variable instead of using svga_texture() again. Reviewed-by: Neha Bhende <[email protected]>
* svga: reformat some expressions in svga_texture_transfer_map()Brian Paul2016-08-261-3/+3
| | | | Reviewed-by: Neha Bhende <[email protected]>
* svga: remove duplicated variable in svga_texture_transfer_map()Brian Paul2016-08-261-1/+0
| | | | | | tex was already declared at the function body scope. Reviewed-by: Neha Bhende <[email protected]>
* svga: move some assignments in svga_texture_transfer_map()Brian Paul2016-08-261-4/+4
| | | | | | Put near other assignments to the svga_transfer variable. Reviewed-by: Neha Bhende <[email protected]>
* svga: minor simplifications in svga_texture_transfer_map()Brian Paul2016-08-261-9/+9
| | | | | | Use local vars instead of jumping through a pointer. Reviewed-by: Neha Bhende <[email protected]>
* svga: add guest statistic gathering interfaceCharmaine Lee2016-08-261-10/+27
| | | | | | | | | | | | 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: don't call os_get_time() when not needed by Gallium HUDBrian Paul2016-08-161-3/+2
| | | | | | | The calls to os_get_time() were showing up higher than expected in profiles. Reviewed-by: Charmaine Lee <[email protected]>
* gallium: split transfer_inline_write into buffer and texture callbacksMarek Olšák2016-07-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | to reduce the call indirections with u_resource_vtbl. The worst call tree you could get was: - u_transfer_inline_write_vtbl - u_default_transfer_inline_write - u_transfer_map_vtbl - driver_transfer_map - u_transfer_unmap_vtbl - driver_transfer_unmap That's 6 indirect calls. Some drivers only had 5. The goal is to have 1 indirect call for drivers that care. The resource type can be determined statically at most call sites. The new interface is: pipe_context::buffer_subdata(ctx, resource, usage, offset, size, data) pipe_context::texture_subdata(ctx, resource, level, usage, box, data, stride, layer_stride) v2: fix whitespace, correct ilo's behavior Reviewed-by: Nicolai Hähnle <[email protected]> Acked-by: Roland Scheidegger <[email protected]>
* svga: set render target flag for snorm surfacesBrian Paul2016-06-301-0/+10
| | | | | | | | | We don't normally support rendering to SNORM surfaces, but with GL_ARB_copy_image we can copy to them if we treat them as typeless and use a UNORM surface view. Acked-by: Roland Scheidegger <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: use untyped surface formats in most casesBrian Paul2016-06-301-4/+7
| | | | | | | | | This allows us to do copies between different, but compatible, surface formats such as RGBA8_UNORM, RGBA8_SINT, RGBA8_UINT, etc. for GL_ARB_copy_image. Acked-by: Roland Scheidegger <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: force direct map for transfering multiple slicesCharmaine Lee2016-06-281-15/+24
| | | | | | | | | | | | | With commit fb9fe35, we start using transfer_inline_write for memcpy of TexSubImage. But SurfaceDMA command does not work well with texture array. This patch forces direct map when transfering multiple slices of a texture array. Fixes piglit regression "texelFetch fs sampler1DArray" Tested with MTT piglit, glretrace, conform. Reviewed-by: Sinclair Yeh <[email protected]>
* svga: fix texture array update regressionCharmaine Lee2016-06-231-6/+27
| | | | | | | | | | | | | | | With commit fb9fe35, we start using transfer_inline_write for memcpy TexSubImage path, but that triggers a regression with texture array in the svga driver. With this patch, the direct map code will update the texture array correctly. Fixes VMware bug 1679293. Tested with MTT piglit, glretrace, conform. Reviewed-by: Brian Paul <[email protected]>
* svga: allow copy box in svga_transfer_dma_band()Charmaine Lee2016-06-021-13/+20
| | | | | | | | | | | | | Instead of just allow copy of a rectangle in svga_transfer_dma_band(), this patch allows it to copy a box, hence allows copy a 3d texture in one transfer. Fixes black screen in running Heaven after commit fb9fe35. (Bug 1663282) Tested with Heaven, glretrace, piglit. Reviewed-by: Sinclair Yeh <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* svga: try to flag surfaces for sampling, in addition to renderingBrian Paul2016-05-031-0/+11
| | | | | | | | | This silences some warnings when we try to sample from surfaces that were created for drawing, such as when blitting from one of the framebuffer surfaces. We were already doing the opposite situation (adding a bind flag for rendering to surfaces declared as texture sources). Reviewed-by: Charmaine Lee <[email protected]>
* svga: mark the texture dirty for write transfer map onlyCharmaine Lee2016-04-251-2/+4
| | | | | | | | | Instead of unconditionally mark the texture subresource dirty at transfer map, we'll set the dirty bit for write transfer only. Tested with lightsmark2008 and glretrace. Reviewed-by: Brian Paul <[email protected]>
* svga: minimize surface flushCharmaine Lee2016-04-251-15/+56
| | | | | | | | | | | | Currently, we always do a surface flush when we try to establish a synchronized write transfer map. But if the subresource has not been modified, we can skip the surface flush. In other words, we only need to do a surface flush if the to-be-mapped subresource has been modified in this command buffer. With this patch, lightsmark2008 shows about 15% performance improvement. Reviewed-by: Brian Paul <[email protected]>
* svga: add a few more resource updates HUD queryCharmaine Lee2016-03-211-0/+2
| | | | | | | | | | | | This patch adds the following HUD queries: .num-resource-updates -- number of resource update. Commands include UPDATE_SUBRESOURCE, UPDATE_GB_IMAGE. .num-buffer-uploads -- number of buffer uploads. .num-const-buf-updates -- number of set constant buffer. .num-const-updates -- number of set shader constant. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
* svga: add new num-readbacks HUD queryCharmaine Lee2016-03-211-0/+2
| | | | | | | To find out how many image readback command is issued. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>