Commit Graph

98365 Commits

Author SHA1 Message Date
Jason Ekstrand 843c192e2b spirv: Use offset_pointer_dereference to instead of get_vulkan_resource_index
There is no good reason why we should have the same logic repeated in
get_vulkan_resource_index and vtn_ssa_offset_pointer_dereference.  If
we're a bit more careful about how we do things, we can just use the one
function and get rid of the other entirely.  This also makes the push
constant special case a lot more clear.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
2017-12-05 22:01:53 -08:00
Jason Ekstrand 6dffef6308 spirv: Refactor a couple of pointer query helpers
This commit moves them both into vtn_variables.c towards the top, makes
them take a vtn_builder, and replaces a hand-rolled instance of
is_external_block with a function call.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
2017-12-05 20:56:16 -08:00
Jason Ekstrand 93646fb503 spirv: Refactor the base case of offset_pointer_dereference
This makes us key off of !offset instead of !block_index.  It also puts
the guts inside a switch statement so that we can handle more than just
UBOs and SSBOs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
2017-12-05 20:56:14 -08:00
Jason Ekstrand 98edf6bca4 spirv: Add a switch statement for the block store opcode
This parallels what we do for vtn_block_load except that we don't yet
support anything except SSBO loads through this path.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
2017-12-05 20:55:39 -08:00
Jason Ekstrand 91d91ce3e2 spirv: Use a dereference instead of vtn_variable_resource_index
This is equivalent and means we don't have resource index code scattered
about.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
2017-12-05 20:55:37 -08:00
Brian Paul dee936c805 mesa: add const qualifier on _mesa_is_renderable_texture_format()
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-12-05 15:32:25 -07:00
Brian Paul ca78b6b4f4 mesa: add const qualifier on _mesa_base_fbo_format()
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-12-05 15:32:25 -07:00
Brian Paul 08ba4a103f mesa: s/%u/%d/ in _mesa_error() call in check_layer()
The layer parameter is signed.  Fixes the error message seen when
running the arb_texture_multisample-errors test which checks a
negative layer value.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 15:32:25 -07:00
Brian Paul 323e6029a3 mesa: simplify/improve some _mesa_error() calls in teximage.c
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 15:32:25 -07:00
Brian Paul 726e495bbd mesa: trivial whitespace fixes in transformfeedback.c
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 15:32:25 -07:00
Brian Paul b2c3fd984a mesa: add const qualifier in test_attachment_completeness()
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 15:32:25 -07:00
Brian Paul 78dfbc30b6 st/mesa: remove unneeded #include in st_format.h
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 15:32:24 -07:00
Brian Paul 9c7840f93f st/mesa: rename a few vars to 'bindings'
To be consistent.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 15:32:24 -07:00
Brian Paul 067f6fc1af st/mesa: whitespace fixes in st_format.c
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 15:32:24 -07:00
Rob Clark e0c6769ef5 freedreno/a5xx: hide ARB_base_instance
Grrr..

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-12-05 16:16:18 -05:00
Rob Clark 77c595358f freedreno/ir3: handle input/output component
After the mesa/st nir linking support, we start to see inputs/outputs
like:

   decl_var shader_out INTERP_MODE_NONE float packed:uv (VARYING_SLOT_VAR9.x, 1, 0)
   decl_var shader_out INTERP_MODE_NONE float packed:uv@0 (VARYING_SLOT_VAR9.y, 1, 0)

(ie. were location_frac != .x)

Unfortunately I overlooked the addition of the component parameter to
load_input/store_output, so when we started encountering inputs/outputs
with component other than .x, we'd end up loading/storing the wrong
input/output.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-12-05 16:03:38 -05:00
Rob Clark fd6a96635e mesa/st: move cloning of NIR shader for compute
Since in the NIR case, driver takes ownership of the NIR shader, we need
to clone what is passed to the driver.  Normally this is done as part of
creating the shader variant (where is clone is anyways needed).  But
compute shaders have no variants, so we were cloning earlier.

The problem is that after the NIR linking optimizations, we ended up
cloning *before* all the lowering passes where done.

So move this into st_get_cp_variant(), to make compute shaders work more
like other shader stages.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-12-05 16:03:38 -05:00
Dave Airlie 12a96aaf90 r600: refactor and export some shader selector code for compute
This just moves some code around to make it easier to add compute.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:31:50 +00:00
Dave Airlie ca64281690 r600: add compute support to compressed resource handling.
This just adds support for decompressing compute resources.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:31:48 +00:00
Dave Airlie 5c78d000e6 r600: update max threads per block for evergreen compute
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:31:37 +00:00
Dave Airlie 5f15d35efc r600/shader: add local memory support to shader assembler.
This is needed for compute shaders.

v1.1: make work for vectors, fix missing lds ops.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:31:34 +00:00
Dave Airlie dd3630f71c r600/cs: add support for compute to image/buffers/atomics state
This just adds the compute paths to state handling for the
main objects

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:31:24 +00:00
Dave Airlie 84feb6c24a r600: handle compute null key shader state
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:31:13 +00:00
Dave Airlie 9b8b78b457 r600: add some missing cayman register defines
These are just taken from the kernel, and were seen in some fglrx dumps.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:09:43 +00:00
Dave Airlie 3a403a9797 r600: don't set EOP on pop or loop end
This appears to bad, compute shaders hang without it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:09:33 +00:00
Dave Airlie 2fdc21bcab r600/ssbo: refactor out buffer coord calcs and use for atomic path.
The atomic rat path has a bug in the ssbo path, refactor out the
address calcs from the load/store paths and reuse to fix the bug
in the buffer rat atomic path.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:07:08 +00:00
Dave Airlie a256506b76 r600/ssbo: fix multi-dword buffer loads.
This fixes loading from different channels.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:07:08 +00:00
Dave Airlie 989697eccc r600/ssbo: use r32ui format for ssbo resources.
This works best for returning the correct values and sizes in
tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:07:08 +00:00
Dave Airlie 275293b2b4 r600: refactor out the immediate setup code.
This just refactors the same code out of the images/buffers paths.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:07:07 +00:00
Dave Airlie df21cd5248 r600/shader: fix ssbo atomic operations formats.
Don't try and use the image format for ssbo, just 32-bit uint.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:07:07 +00:00
Dave Airlie 4ee2b7c452 r600/shader: fix thread id loading.
This just changes how thread id loading is done, it makes
smaller shaders if we don't use thread id gprs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 20:07:07 +00:00
Rob Herring 20d37da597 Android: enable noreturn and returns_nonnull attributes
Commit 94ca8e04ad ("spirv: Add vtn_fail and vtn_assert helpers") broke
Android builds which have -Werror enabled with the following errors:

external/mesa3d/src/compiler/spirv/spirv_to_nir.c:272:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
external/mesa3d/src/compiler/spirv/spirv_to_nir.c:810:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
...

The problem is the noreturn attribute is not enabled and we to define
HAVE_FUNC_ATTRIBUTE_NORETURN.

Auditing src/util/macros.h, we're also missing
HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL and HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT,
so add them too.

Fixes: 94ca8e04ad ("spirv: Add vtn_fail and vtn_assert helpers")
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-12-05 07:47:04 -06:00
Marek Olšák dbad0acfaf gallium/u_upload_mgr: allow drivers to specify pipe_resource::flags
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-12-05 13:30:35 +01:00
Marek Olšák c7f84f6513 winsys/amdgpu: add RADEON_FLAG_READ_ONLY
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-12-05 13:30:34 +01:00
Marek Olšák cccf09677f gallium/radeon: remove RADEON_HEAP_VRAM_GTT
Only winsyses can set VRAM|GTT. Drivers shouldn't if they want to use
winsys allocators.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-12-05 13:30:34 +01:00
Marek Olšák 9ac5504df5 gallium/radeon: move setting VRAM|GTT into winsyses
The combined VRAM|GTT heap will be removed.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-12-05 13:30:34 +01:00
Marek Olšák 5e805cc74b radeonsi: flush the context after resource_copy_region for buffer exports
Cc: 17.2 17.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-12-05 13:28:00 +01:00
Mauro Rossi cd8554502e Android: gallium/radeon: fix libmesa_amd_common dependency
libmesa_amd_common static dependency is added in Android build
to avoid the following building errors:

In file included from external/mesa/src/gallium/drivers/radeon/r600_buffer_common.c:24:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:26:
external/mesa/src/gallium/drivers/radeonsi/si_shader.h:138:10: fatal error: 'ac_binary.h' file not found
         ^~~~~~~~~~~~~
1 error generated.
...
In file included from external/mesa/src/gallium/drivers/radeon/r600_gpu_load.c:34:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:26:
external/mesa/src/gallium/drivers/radeonsi/si_shader.h:138:10: fatal error: 'ac_binary.h' file not found
         ^~~~~~~~~~~~~
1 error generated.

Fixes: 950221f923 ("radeonsi: remove r600_common_screen")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-12-05 12:05:21 +00:00
Dave Airlie b501ef164e st/mesa: handle compute atomics
Just reuse the cs atomics bit and emit the hw atomic state.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 10:38:35 +00:00
Dave Airlie 05f594f229 r600/atomic: add cayman version of atomic save/restore from GDS (v2)
On Cayman we don't use the append/consume counters (fglrx doesn't)
and they don't seem to work well with compute shaders.

This just uses GDS instead to do the atomic operations.

v1.1: remove unused line.
v2: use EOS on cayman, it appears to work.

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 10:38:07 +00:00
Dave Airlie cf6d3caee2 r600/atomic: refactor out evergreen atomic setup/save code.
For cayman we want to use different code paths.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-05 10:38:04 +00:00
Timothy Arceri e9e6476ae5 radeonsi: pass llvm type directly to buffer_load()
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-12-05 15:15:36 +11:00
Dylan Baker 6b4c7047d5 meson: build gallium nine state_tracker
v2: - set d3d_drivers_path instead of dri_drivers_path
    - Fix nine guard to check for all relavent gallium drivers
    - Link with libswdri and libswkmsdri when necessary
    - Fix pkg-config generation
    - Add missing comma

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:58 -08:00
Dylan Baker 0ba909f0f1 meson: build gallium xa state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:56 -08:00
Dylan Baker 5a785d51a6 meson: build gallium va state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:53 -08:00
Dylan Baker 1d36dc674d meson: build gallium omx state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:51 -08:00
Dylan Baker 22a817af8a meson: build gallium xvmc state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:48 -08:00
Dylan Baker 68076b8747 meson: build gallium vdpau state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:38 -08:00
Dylan Baker 085070a2c8 meson: drop gallium-media argument
This argument is the wrong approach for handling gallium media state
trackers, since it doesn't allow for an auto option. Instead we'll use
tristates, which do allow for auto.

This option has never been wired to anything anyway.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:35 -08:00
Dylan Baker f7f1b30f81 meson: extend install_megadrivers script to handle symmlinking
Which is required for the gallium media state trackers.

v2: - Make symlinks local instead of absolute

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-12-04 14:36:26 -08:00