aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_meta.c
Commit message (Collapse)AuthorAgeFilesLines
* radv: Only save the descriptor set if we have one.Bas Nieuwenhuizen2019-07-181-1/+1
| | | | | | | | After reset, if valid does not contain the relevant bit the descriptor can be != NULL but still not be valid. CC: <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* radv: allow to save/restore sample locations during meta operationsSamuel Pitoiset2019-06-071-0/+12
| | | | | | | | This will be used for the depth decompress pass that might need to emit variable sample locations during layout transitions. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-By: Bas Nieuwenhuizen <[email protected]>
* radv: use RADV_CMD_DIRTY_DYNAMIC_* when restoring viewport/scissorSamuel Pitoiset2019-05-311-2/+2
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: use CmdPushConstants when restoring constants after meta operationsSamuel Pitoiset2019-05-311-6/+8
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: add support for FMASK expandSamuel Pitoiset2018-12-201-0/+8
| | | | | | | Original patch by Dave Airlie. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: use different builtin shader cache for 32bitGrazvydas Ignotas2018-08-231-9/+7
| | | | | | | | Currently if 64bit and 32bit programs are used interchangeably, radv will keep overwriting the cache. Use separate cache files to avoid that. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: fix memory leaks in radv_load_meta_pipeline()Samuel Pitoiset2018-08-151-2/+3
| | | | | | | | Reported by Coverity. Fixes: fbcd167314 ("radv: Add on-demand compilation of built-in shaders.") Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: Add on-demand compilation of built-in shaders.Bas Nieuwenhuizen2018-08-141-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | In environments where we cannot cache, e.g. Android (no homedir), ChromeOS (readonly rootfs) or sandboxes (cannot open cache), the startup cost of creating a device in radv is rather high, due to compiling all possible built-in pipelines up front. This meant depending on the CPU a 1-4 sec cost of creating a Device. For CTS this cost is unacceptable, and likely for starting random apps too. So if there is no cache, with this patch radv will compile shaders on demand. Once there is a cache from the first run, even if incomplete, the driver knows that it can likely write the cache and precompiles everything. Note that I did not switch the buffer and itob/btoi compute pipelines to on-demand, since you cannot really do anything in Vulkan without them and there are only a few. This reduces the CTS runtime for the no caches scenario on my threadripper from 32 minutes to 8 minutes. Reviewed-by: Dave Airlie <[email protected]>
* radv/meta: do not restore a NULL descriptorSamuel Pitoiset2018-07-121-4/+3
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: Use deref instructions for tex derefs in meta shaders.Bas Nieuwenhuizen2018-06-221-9/+11
| | | | | | | Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* radv: use separate bindings for graphics and compute descriptorsSamuel Pitoiset2018-02-011-3/+16
| | | | | | | | | | | | | The Vulkan spec says: "pipelineBindPoint is a VkPipelineBindPoint indicating whether the descriptors will be used by graphics pipelines or compute pipelines. There is a separate set of bind points for each of graphics and compute, so binding one does not disturb the other." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104732 Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: Fix ordering issue in meta memory allocation failure path.Bas Nieuwenhuizen2018-01-221-2/+2
| | | | | CC: <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* radv: Invert condition for all samples identical during resolve.Bas Nieuwenhuizen2017-12-281-1/+1
| | | | | | | | the samples_identical instruction returns 0 if they are differet, so we have to do the extra work if the result is 0, not if it is != 0. Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver" Reviewed-by: Dave Airlie <[email protected]>
* radv: do not emit the framebuffer when restoring a passSamuel Pitoiset2017-11-131-1/+1
| | | | | | | | Instead just dirty RADV_CMD_DIRTY_FRAMEBUFFER and it will be re-emitted if necessary before the next draw. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: move descriptor sets out of cmd_state.Dave Airlie2017-11-061-1/+4
| | | | | | | | | | | Instead of storing all the pointers and zeroing them all out, just store a valid bitmask in the state. This also moves the CmdBindPipeline path down the cpu usage path for the multithreading demo as it no longer has to traverse MAX_SETS to find the active descriptor sets. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv: add helper for setting a descriptor.Dave Airlie2017-11-061-2/+1
| | | | | | | This is just a simple refactor. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv: convert all COMPUTE operations to the RADV_META_SAVE_XXX flagsSamuel Pitoiset2017-10-061-31/+0
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: add RADV_META_SAVE_COMPUTE_PIPELINE flagSamuel Pitoiset2017-10-061-2/+22
| | | | | | | This will allow use to merge the compute save/restore helpers. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: add radv_meta_save() helperSamuel Pitoiset2017-10-061-21/+12
| | | | | | | | And merge radv_meta_save_novertex() with radv_meta_save_graphics_reset_vport_scissor_novertex(). Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: merge radv_meta_{save,restore}_pass() with RADV_META_SAVE_PASSSamuel Pitoiset2017-10-061-23/+17
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: introduce the concept of meta save flagsSamuel Pitoiset2017-10-061-38/+61
| | | | | | | | | | | This will allow us to save/restore the different states on-demand based on the meta operation. For now, this saves/restores all states. Compute will follow once the graphics part is done. The main idea is to merge all save/restore helpers. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: store the amount of saved constants in the compute stateSamuel Pitoiset2017-09-271-6/+9
| | | | | | | It's safer and more elegant. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: save/restore all viewports/scissors for meta operationsSamuel Pitoiset2017-09-251-11/+29
| | | | | | | | | | | | | | | | | | | | This is needed since we don't update the number of viewports/scissors when they are set dynamically (according to the spec). In the following scenario: * vkCmdSetViewport() * vkCmdClearColorImage() (or any other meta operations) The viewports/scissors weren't saved correctly because no pipeline was bound before, and thus the number of viewports/scissors were 0. This fixes a regression with: dEQP-VK.draw.negative_viewport_height.front_ccw_cull_back Fixes: 60878dd00c ("radv: do not update the number of viewports in vkCmdSetViewport()") Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: remove unused radv_meta_saved_state::vertex_saved fieldSamuel Pitoiset2017-09-071-6/+0
| | | | | | | It's always false. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv: Only convert linear->srgb in compute resolves.Bas Nieuwenhuizen2017-08-061-46/+0
| | | | | | | | | It justs works with the fragment shader resolve, so no need to do a custom conversion. In fact with SRGB dest, it actually gives wrong results. Fixes: 69136f4e633 "radv/meta: add resolve pass using fragment/vertex shaders" Reviewed-by: Dave Airlie <[email protected]>
* radv: Dirty all descriptors sets when changing the pipeline.Bas Nieuwenhuizen2017-06-031-3/+2
| | | | | | | | | Sets could have been ignored during previous descriptor set flush due to the shader not using them and therefore no SGPR being assigned. Signed-off-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Fixes: ae61ddabe8c "radv: move userdata sgpr ownership to compiler side."
* radv: Save descriptor set even if vertex buffers are not saved.Bas Nieuwenhuizen2017-05-131-2/+3
| | | | | | | | Totally independent. Signed-off-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Fixes: 0e6d532d327 "radv/meta: add support for save/restore meta without vertex data."
* nir: Embed the shader_info in the nir_shader againJason Ekstrand2017-05-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b changed the shader_info from being embedded into being just a pointer. The idea was that sharing the shader_info between NIR and GLSL would be easier if it were a pointer pointing to the same shader_info struct. This, however, has caused a few problems: 1) There are many things which generate NIR without GLSL. This means we have to support both NIR shaders which come from GLSL and ones that don't and need to have an info elsewhere. 2) The solution to (1) raises all sorts of ownership issues which have to be resolved with ralloc_parent checks. 3) Ever since 00620782c92100d77c660f9783504c6d80fa1d58, we've been using nir_gather_info to fill out the final shader_info. Thanks to cloning and the above ownership issues, the nir_shader::info may not point back to the gl_shader anymore and so we have to do a copy of the shader_info from NIR back to GLSL anyway. All of these issues go away if we just embed the shader_info in the nir_shader. There's a little downside of having to copy it back after calling nir_gather_info but, as explained above, we have to do that anyway. Acked-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* radv/meta: cleanup some unused code pathDave Airlie2017-05-081-24/+1
| | | | | | | | After moving everything to using push constants, these paths are no longer needed. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv/meta: add resolve pass using fragment/vertex shadersDave Airlie2017-05-071-0/+7
| | | | | | | | | | | In order to resolve into DCC enabled dests we need to use the fragment shader. This reuses the code from the compute path and implements a resolve path in vertex/fragment shader. This code isn't used until later. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv/meta: split out core part of resolve shaderDave Airlie2017-05-071-0/+127
| | | | | | | | I want to reuse the same code for the fragment shader version of the resolve shaders. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv/meta: fix restoring a push descriptor setFredrik Höglund2017-05-061-2/+5
| | | | | | | | | | | radv_bind_descriptor_set cannot be used to bind a push descriptor set since a push descriptor set does not have a buffer list. However, there is no need to add the buffers again when restoring a set, so this fix is also an optimization. Cc: "17.1" <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radv/meta: refactor out some common shaders.Dave Airlie2017-04-191-0/+35
| | | | | | | | The vs vertex generate and fs noop shaders are used in a few places, so refactor them out. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv/meta: reduce vertex buffer usage in clear shadersDave Airlie2017-04-191-2/+7
| | | | | | | | | For depth clears we have to pass the depth in the 2nd component, we can use push constants for some of this later to drop the vertex buffer completely Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv/meta: add common shader vertex generation functionDave Airlie2017-04-191-0/+33
| | | | | | | | | | Instead of passing in the same 1.0, -1.0 combinations via vertex buffers, we can just use vertex id to have the vertex shader build them. This function introduces the generator code needed, later patches will use this. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv/meta: add support for save/restore meta without vertex data.Dave Airlie2017-04-191-8/+31
| | | | | | | | Some of the shaders could just generate the vertex data in the shader, so add helpers to allow us to move to doing that. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* radv: Add occlusion query shader.Bas Nieuwenhuizen2017-04-111-0/+7
| | | | | | | | | Adds a shader for writing occlusion query results to a buffer, as the CP packet isn't support on SI or secondary buffers, and doesn't handle the availability bit (or partial results) nor truncation to 32-bit. Signed-off-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* radv: add initial non-conformant radv vulkan driverDave Airlie2016-10-071-0/+388
This squashes all the radv development up until now into one for merging. History can be found: https://github.com/airlied/mesa/tree/semi-interesting This requires llvm 3.9 and is in no way considered a conformant vulkan implementation. It can run a number of vulkan applications, and supports all GPUs using the amdgpu kernel driver. Thanks to Intel for providing anv and spirv->nir, and Emil Velikov for reviewing build integration. Parts of this are: Reviewed-by: Nicolai Hähnle <[email protected]> Acked-by: Edward O'Callaghan <[email protected]> Authors: Bas Nieuwenhuizen and Dave Airlie Signed-off-by: Dave Airlie <[email protected]>