mesa.git
5 years agonir: make nir_const_value scalar
Karol Herbst [Tue, 26 Mar 2019 23:59:03 +0000 (00:59 +0100)]
nir: make nir_const_value scalar

v2: remove & operator in a couple of memsets
    add some memsets
v3: fixup lima

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v2)
5 years agospirv: reduce array size in vtn_handle_constant
Karol Herbst [Wed, 10 Apr 2019 14:46:50 +0000 (16:46 +0200)]
spirv: reduce array size in vtn_handle_constant

we already assert above that there are no more than 3 sources, so it
doesn't make sense to use an array of 4 sources

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/loop_analyze: use nir_const_value.b for boolean results, not u32
Karol Herbst [Tue, 2 Apr 2019 12:12:06 +0000 (14:12 +0200)]
nir/loop_analyze: use nir_const_value.b for boolean results, not u32

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir/print: Use nir_src_as_int for array indices
Jason Ekstrand [Tue, 2 Apr 2019 02:36:12 +0000 (21:36 -0500)]
nir/print: Use nir_src_as_int for array indices

Reviewed-by: Karol Herbst <kherbst@redhat.com>
5 years agonir/builder: Add a nir_imm_zero helper
Jason Ekstrand [Tue, 2 Apr 2019 02:31:26 +0000 (21:31 -0500)]
nir/builder: Add a nir_imm_zero helper

v2: replace nir_zero_vec with nir_imm_zero (Karol Herbst)

Reviewed-by: Karol Herbst <kherbst@redhat.com>
5 years agonir/builder: Move nir_imm_vec2 from blorp into the builder
Karol Herbst [Fri, 29 Mar 2019 23:53:42 +0000 (00:53 +0100)]
nir/builder: Move nir_imm_vec2 from blorp into the builder

While we're here, fix a typo which caused it to actually return a vec4
with the third and fourth components zero.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agolima: use nir_src_as_float
Karol Herbst [Sat, 13 Apr 2019 17:33:41 +0000 (19:33 +0200)]
lima: use nir_src_as_float

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
5 years agofreedreno/ir3: use nir_src_as_uint in a few places
Karol Herbst [Fri, 29 Mar 2019 19:57:52 +0000 (20:57 +0100)]
freedreno/ir3: use nir_src_as_uint in a few places

v2 (Jason Ekstrand):
 - Add even more places

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/nir: use nir_src_is_const and nir_src_as_uint
Karol Herbst [Sun, 31 Mar 2019 01:54:21 +0000 (03:54 +0200)]
intel/nir: use nir_src_is_const and nir_src_as_uint

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/nir: Take a nir_tex_instr and src index in brw_texture_offset
Jason Ekstrand [Wed, 27 Mar 2019 22:34:10 +0000 (17:34 -0500)]
intel/nir: Take a nir_tex_instr and src index in brw_texture_offset

This makes things a bit simpler and it's also more robust because it no
longer has a hard dependency on the offset being a 32-bit value.

5 years agoradv: use nir constant helpers
Karol Herbst [Thu, 28 Mar 2019 15:53:47 +0000 (16:53 +0100)]
radv: use nir constant helpers

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoamd/nir: some cleanups
Karol Herbst [Thu, 28 Mar 2019 15:46:30 +0000 (16:46 +0100)]
amd/nir: some cleanups

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agopanfrost/midgard: Use shared nir_lower_viewport_transform
Alyssa Rosenzweig [Sun, 7 Apr 2019 16:37:28 +0000 (16:37 +0000)]
panfrost/midgard: Use shared nir_lower_viewport_transform

v2: Run before lowering I/O.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
5 years agonir: Add nir_lower_viewport_transform
Alyssa Rosenzweig [Sun, 14 Apr 2019 15:43:13 +0000 (15:43 +0000)]
nir: Add nir_lower_viewport_transform

On Mali hardware (supported by Panfrost and Lima), the fixed-function
transformation from world-space to screen-space coordinates is done in
the vertex shader prior to writing out the gl_Position varying, rather
than in dedicated hardware. This commit adds a shared NIR pass for
implementing coordinate transformation and lowering gl_Position writes
into screen-space gl_Position writes.

v2: Run directly on derefs before io/vars are lowered to cleanup the
code substantially. Thank you to Qiang for this suggestion!

v3: Bikeshed continues.

v4: Add to Makefile.sources (per Jason's comment). Bikeshed comment.

Ian and Qiang's reviews are from v3, but no real functional changes from
v4. Rob's review is from v4.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Suggested-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agopanfrost: Cleanup indexed draw handling
Alyssa Rosenzweig [Sat, 13 Apr 2019 00:10:20 +0000 (00:10 +0000)]
panfrost: Cleanup indexed draw handling

As part of this cleanup, we use the newly-exposed
u_vbuf_get_minmax_index, deduplicating quite a bit of bookkeeping. We
also centralize the draw_flags tracking to make this code cleaner /
futureproofed; we have already had bugs regarding this field so we might
as well get it right now.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost/midgard: Drop dependence on mesa/st
Alyssa Rosenzweig [Sat, 13 Apr 2019 00:04:52 +0000 (00:04 +0000)]
panfrost/midgard: Drop dependence on mesa/st

This was used as a workaround for uniform sizing which was fixed in
771adffe ("st: Lower uniforms in st in the...")

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agodraw: fix building error in draw_gs_init()
Mauro Rossi [Sat, 13 Apr 2019 16:34:53 +0000 (18:34 +0200)]
draw: fix building error in draw_gs_init()

Fixes the following building error happening with Android build system:

external/mesa/src/gallium/auxiliary/draw/draw_gs.c:740:79:
error: address of array 'draw->gs.tgsi.machine->PrimitiveOffsets' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
         if (!draw->gs.tgsi.machine->Primitives[i] || !draw->gs.tgsi.machine->PrimitiveOffsets)
                                                      ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
1 error generated.

Fixes: 7720ce3 ("draw: add support to tgsi paths for geometry streams. (v2)")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agolima/gpir: fix alu check miss last store slot
Qiang Yu [Fri, 12 Apr 2019 03:35:34 +0000 (11:35 +0800)]
lima/gpir: fix alu check miss last store slot

Fixes: 92d7ca4b1cd "gallium: add lima driver"
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
5 years agolima/gpir: fix compile fail when two slot node
Qiang Yu [Thu, 11 Apr 2019 07:42:59 +0000 (15:42 +0800)]
lima/gpir: fix compile fail when two slot node

Come from glmark2-es2 jellyfish test.

Fixes: 92d7ca4b1cd "gallium: add lima driver"
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
5 years agolima: add support for depth/stencil fbo attachments and textures
Vasily Khoruzhick [Sun, 7 Apr 2019 05:55:36 +0000 (22:55 -0700)]
lima: add support for depth/stencil fbo attachments and textures

Hardware supports writing back Z/S buffers and sampling from them,
so add support for that.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Tested-by: Icenowy Zheng <icenowy@aosc.io>
5 years agolima: use individual tile heap for each GP job.
Vasily Khoruzhick [Sun, 7 Apr 2019 05:48:16 +0000 (22:48 -0700)]
lima: use individual tile heap for each GP job.

Looks like it's somehow used by subsequent PP job, so we have to
preserve its contents until PP job is done.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Tested-by: Icenowy Zheng <icenowy@aosc.io>
5 years agonir: add lower_ftrunc
Christian Gmeiner [Fri, 12 Apr 2019 08:12:27 +0000 (10:12 +0200)]
nir: add lower_ftrunc

Port TGSI TRUNC lowering to nir

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoandroid: fix LLVM version string related building errors
Mauro Rossi [Sat, 13 Apr 2019 16:56:14 +0000 (18:56 +0200)]
android: fix LLVM version string related building errors

Adding \ prior to " in llvm version string fixes the following building errors:

external/mesa/src/gallium/drivers/r600/r600_pipe_common.c:1290:14:
error: expected ')'
                 ", LLVM " MESA_LLVM_VERSION_STRING
                           ^
<command line>:8:34: note: expanded from here
                                 ^
external/mesa/src/gallium/drivers/r600/r600_pipe_common.c:1287:10:
note: to match this '('
        snprintf(rscreen->renderer_string, sizeof(rscreen->renderer_string),
                ^
1 error generated.

Fixes: 05b114e ("simplify LLVM version string printing")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
5 years agoanv: leave the top 4Gb of the high heap VMA unused
Lionel Landwerlin [Fri, 12 Apr 2019 10:05:33 +0000 (11:05 +0100)]
anv: leave the top 4Gb of the high heap VMA unused

In 628c9ca9089789 I forgot to apply the same -4Gb of the high address
of the high heap VMA. This was previously computed in the
HIGH_HEAP_MAX_ADDRESS.

Many thanks to James for pointing this out.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reported-by: Xiong, James <james.xiong@intel.com>
Fixes: 628c9ca9089789 ("anv: store heap address bounds when initializing physical device")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agov3d: Use the new lower_to_scratch implementation for indirects on temps.
Eric Anholt [Thu, 11 Apr 2019 18:12:01 +0000 (11:12 -0700)]
v3d: Use the new lower_to_scratch implementation for indirects on temps.

We can use the same register spilling infrastructure for our loads/stores
of indirect access of temp variables, instead of doing an if ladder.

Cuts 50% of instructions and max-temps from 2 KSP shaders in shader-db.
Also causes several other KSP shaders with large bodies and large loop
counts to not be force-unrolled.

The change was originally motivated by NOLTIS slightly modifying register
pressure in piglit temp mat4 array read/write tests, triggering register
allocation failures.

5 years agonir: Add a pass for selectively lowering variables to scratch space
Jason Ekstrand [Fri, 2 Dec 2016 19:36:42 +0000 (11:36 -0800)]
nir: Add a pass for selectively lowering variables to scratch space

This commit adds new nir_load/store_scratch opcodes which read and write
a virtual scratch space.  It's up to the back-end to figure out what to
do with it and where to put the actual scratch data.

v2: Drop const_index comments (by anholt)

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: Detect the correct number of QPUs and use it to fix the spill size.
Eric Anholt [Thu, 11 Apr 2019 19:28:30 +0000 (12:28 -0700)]
v3d: Detect the correct number of QPUs and use it to fix the spill size.

We were missing a * 4 even if the particular hardware matched our
assumption.

5 years agov3d: Add missing dumping for the spill offset/size uniforms.
Eric Anholt [Thu, 11 Apr 2019 18:46:47 +0000 (11:46 -0700)]
v3d: Add missing dumping for the spill offset/size uniforms.

5 years agov3d: Add missing base offset to CS shared memory accesses.
Eric Anholt [Thu, 11 Apr 2019 19:04:41 +0000 (12:04 -0700)]
v3d: Add missing base offset to CS shared memory accesses.

This code is so touchy, trying to emit the minimum amount of address math.
Some day we'll move it all to NIR, I hope.

5 years agov3d: Add Compute Shader compilation support.
Eric Anholt [Wed, 5 Dec 2018 23:41:35 +0000 (15:41 -0800)]
v3d: Add Compute Shader compilation support.

While waiting for the CSD UABI to get reviewed, I keep having to rebase
the CS patch.  Just land the compiler side for now to keep it from
diverging.

For now this covers just GLES 3.1 compute shaders, not CL kernels.

5 years agov3d: Replace the old shader-db env var output with the ARB_debug_output.
Eric Anholt [Thu, 14 Mar 2019 20:59:13 +0000 (13:59 -0700)]
v3d: Replace the old shader-db env var output with the ARB_debug_output.

We're using ARB_debug_output for the main shader-db, but I had this env
var left around from the shader-db-2 support (vc4 apitrace-based).  Keep
the env var around since it's nice sometimes to get the stats on a shader
you're optimizing without having to do a shader-db run, but drop the old
formatting that's not useful and keeps tricking me when I go to add
another measurement to the shader-db output.

5 years agov3d: Include the number of max temps used in the shader-db output.
Eric Anholt [Wed, 13 Mar 2019 21:19:02 +0000 (14:19 -0700)]
v3d: Include the number of max temps used in the shader-db output.

This gives us finer-grained feedback on how we're doing on register
pressure than "did we trigger a new shader to spill or drop thread count?"

5 years agov3d: Drop a note for the future about PIPE_CAP_PACKED_UNIFORMS.
Eric Anholt [Thu, 11 Apr 2019 18:26:30 +0000 (11:26 -0700)]
v3d: Drop a note for the future about PIPE_CAP_PACKED_UNIFORMS.

5 years agov3d: Add and use a define for the number of channels in a QPU invocation.
Eric Anholt [Thu, 11 Apr 2019 20:27:22 +0000 (13:27 -0700)]
v3d: Add and use a define for the number of channels in a QPU invocation.

A shader invocation always executes 16 channels together, so we often end
up multiplying things by this magic 16 number.  Give it a name.

5 years agonir: Add a comment about how intrinsic definitions work.
Eric Anholt [Thu, 11 Apr 2019 16:49:13 +0000 (09:49 -0700)]
nir: Add a comment about how intrinsic definitions work.

I was thinking about a refactor, and needed to read this first.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Drop remaining references to const_index in favor of the call to use.
Eric Anholt [Thu, 11 Apr 2019 16:52:27 +0000 (09:52 -0700)]
nir: Drop remaining references to const_index in favor of the call to use.

Please don't make me read a const_index[] expression ever again.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Drop comments about the constant_index slots for load/stores.
Eric Anholt [Thu, 11 Apr 2019 16:29:17 +0000 (09:29 -0700)]
nir: Drop comments about the constant_index slots for load/stores.

The constant_index slots are named right there in the intrinsic
definition, and the comment is just a chance to get out of sync.  Noticed
while reviewing the lower_to_scratch changes that copy-and-pasted wrong
comments, and load_ubo and load_per_vertex_output had incorrect comments
currently.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/fs: Remove unused condition from opt_algebraic case
Sagar Ghuge [Wed, 10 Apr 2019 22:37:31 +0000 (15:37 -0700)]
intel/fs: Remove unused condition from opt_algebraic case

We will never hit a condition where we have src1 and src2 as immediate
operands.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoglsl: Set location on structure-split sampler uniform variables
Kenneth Graunke [Thu, 11 Apr 2019 14:04:58 +0000 (07:04 -0700)]
glsl: Set location on structure-split sampler uniform variables

gl_nir_lower_samplers_as_deref splits structure uniform variables,
creating new variables for individual fields.  As part of that, it
calculates a new location.  It then never set this on the new variables.

Thanks to Michael Fiano for finding this bug.  Fixes crashes on i965
with Piglit's new tests/spec/glsl-1.10/execution/samplers/uniform-struct
test, which was reduced from the failing case in Michael's app.

Fixes: f003859f97c nir: Make gl_nir_lower_samplers use gl_nir_lower_samplers_as_deref
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agopanfrost: use os_mmap and os_munmap
Mateusz Krzak [Sun, 7 Apr 2019 21:25:49 +0000 (23:25 +0200)]
panfrost: use os_mmap and os_munmap

32-bit needs mmap64 for 64-bit offsets. We get 64-bit offsets from kernel.

Signed-off-by: Mateusz Krzak <kszaquitto@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: cast bo_handles pointer to uintptr_t first
Mateusz Krzak [Sun, 7 Apr 2019 07:26:15 +0000 (09:26 +0200)]
panfrost: cast bo_handles pointer to uintptr_t first

Required for 64-bit kernel to interpret the pointer from 32-bit userspace.

Signed-off-by: Mateusz Krzak <kszaquitto@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agoanv/pipeline: Fix MEDIA_VFE_STATE::PerThreadScratchSpace on gen7
Jason Ekstrand [Wed, 10 Apr 2019 19:47:12 +0000 (14:47 -0500)]
anv/pipeline: Fix MEDIA_VFE_STATE::PerThreadScratchSpace on gen7

We were always programming it with the Broadwell convention which is too
large by a factor of two on Haswell and just plain wrong on IVB and BYT.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable@lists.freedesktop.org
5 years agogitlab-ci: add lima to the build
Eric Engestrom [Fri, 12 Apr 2019 14:52:00 +0000 (15:52 +0100)]
gitlab-ci: add lima to the build

Suggested-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoac: use the common helper ac_apply_fmask_to_sample
Marek Olšák [Thu, 11 Apr 2019 01:24:57 +0000 (21:24 -0400)]
ac: use the common helper ac_apply_fmask_to_sample

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradeonsi: set AC_FUNC_ATTR_READNONE for image opcodes where it was missing
Marek Olšák [Thu, 11 Apr 2019 01:24:18 +0000 (21:24 -0400)]
radeonsi: set AC_FUNC_ATTR_READNONE for image opcodes where it was missing

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agomesa: don't overwrite existing shader files with MESA_SHADER_CAPTURE_PATH
Marek Olšák [Thu, 11 Apr 2019 00:31:40 +0000 (20:31 -0400)]
mesa: don't overwrite existing shader files with MESA_SHADER_CAPTURE_PATH

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agoglsl: allow the #extension directive within code blocks for the dri option
Marek Olšák [Tue, 9 Apr 2019 22:15:34 +0000 (18:15 -0400)]
glsl: allow the #extension directive within code blocks for the dri option

for Viewperf 13

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoac/nir: remove some useless integer casts for ALU operations
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:55 +0000 (17:16 +0200)]
ac/nir: remove some useless integer casts for ALU operations

Sources are always casted to integers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir: remove useless integer cast in visit_image_load()
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:54 +0000 (17:16 +0200)]
ac/nir: remove useless integer cast in visit_image_load()

ac_build_image_opcode() casts if necessary and buffer images
are casted too.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir: remove useless integer cast in adjust_sample_index_using_fmask()
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:53 +0000 (17:16 +0200)]
ac/nir: remove useless integer cast in adjust_sample_index_using_fmask()

It's already casted if necessary in ac_build_image_opcode().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir: remove useles LLVMGetUndef for nir_op_pack_64_2x32_split
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:52 +0000 (17:16 +0200)]
ac/nir: remove useles LLVMGetUndef for nir_op_pack_64_2x32_split

Trivial.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac: add ac_build_load_helper_invocation() helper
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:51 +0000 (17:16 +0200)]
ac: add ac_build_load_helper_invocation() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac: add ac_build_ddxy_interp() helper
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:50 +0000 (17:16 +0200)]
ac: add ac_build_ddxy_interp() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac: add ac_build_umax() and use it where possible
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:49 +0000 (17:16 +0200)]
ac: add ac_build_umax() and use it where possible

This changes the predicate from LessThan to Equal.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir: make use of ac_build_umin() where possible
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:48 +0000 (17:16 +0200)]
ac/nir: make use of ac_build_umin() where possible

This changes the predicate from LessThan to Equal.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir: make use of ac_build_imin() where possible
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:47 +0000 (17:16 +0200)]
ac/nir: make use of ac_build_imin() where possible

This changes the predicate from LessThan to Equal.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir: make use of ac_build_imax() where possible
Samuel Pitoiset [Wed, 10 Apr 2019 15:16:46 +0000 (17:16 +0200)]
ac/nir: make use of ac_build_imax() where possible

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agolima: add bool parameter to type_size function
Karol Herbst [Fri, 12 Apr 2019 14:51:52 +0000 (16:51 +0200)]
lima: add bool parameter to type_size function

Fixes: 035759b61ba1778d5143cdf3a8795a62dd5d8a60
       ("nir/i965/freedreno/vc4: add a bindless bool to type size functions")

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Tested-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agonvc0/nir: enable bindless texture
Karol Herbst [Sun, 24 Mar 2019 03:23:38 +0000 (04:23 +0100)]
nvc0/nir: enable bindless texture

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: add support for bindless images
Karol Herbst [Sun, 24 Mar 2019 23:36:07 +0000 (00:36 +0100)]
nv50/ir/nir: add support for bindless images

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: handle bindless texture
Karol Herbst [Sun, 24 Mar 2019 03:24:39 +0000 (04:24 +0100)]
nv50/ir/nir: handle bindless texture

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agoac/nir_to_llvm: add image bindless support
Timothy Arceri [Sun, 31 Mar 2019 09:30:12 +0000 (20:30 +1100)]
ac/nir_to_llvm: add image bindless support

With this all piglit bindless image tests pass on radeonsi.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir_to_llvm: make get_sampler_desc() more generic and pass it the image intrinsic
Timothy Arceri [Fri, 29 Mar 2019 05:03:01 +0000 (16:03 +1100)]
ac/nir_to_llvm: make get_sampler_desc() more generic and pass it the image intrinsic

This will be required by the bindless support in the following patches.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoglsl/nir: add support for lowering bindless images_derefs
Karol Herbst [Sun, 24 Mar 2019 19:43:55 +0000 (20:43 +0100)]
glsl/nir: add support for lowering bindless images_derefs

v2: handle atomics as well
    make use of nir_rewrite_image_intrinsic
v3: remove call to nir_remove_dead_derefs
v4: (Timothy Arceri) dont actually call lowering yet

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v3)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoglsl/nir: fetch the type for images from the deref instruction
Karol Herbst [Thu, 28 Mar 2019 22:47:07 +0000 (23:47 +0100)]
glsl/nir: fetch the type for images from the deref instruction

fixes retrieving the sampler type for bindless images stored inside structs.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoglsl_to_nir: handle bindless textures
Karol Herbst [Sun, 24 Mar 2019 16:11:34 +0000 (17:11 +0100)]
glsl_to_nir: handle bindless textures

v2: add support for AMD

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v1)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agonir/i965/freedreno/vc4: add a bindless bool to type size functions
Timothy Arceri [Fri, 29 Mar 2019 01:39:48 +0000 (12:39 +1100)]
nir/i965/freedreno/vc4: add a bindless bool to type size functions

This required to calculate sizes correctly when we have bindless
samplers/images.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agonir: move brw_nir_rewrite_image_intrinsic into common code
Karol Herbst [Thu, 28 Mar 2019 21:21:46 +0000 (22:21 +0100)]
nir: move brw_nir_rewrite_image_intrinsic into common code

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agolima: lower bool to float when building shaders
Icenowy Zheng [Thu, 11 Apr 2019 15:54:03 +0000 (23:54 +0800)]
lima: lower bool to float when building shaders

Both processors of Mali Utgard are float-only, so bool are not
acceptable data type of them. Fortunately the NIR compiler
infrastructure has a lower pass to lower bool to float.

Call this lower pass to lower bool to float for both GP and PP. This
makes Glamor on Xorg server 1.20.3 at least doesn't hang when starting
gtk3-demo.

The old map of nir op bcsel is changed to fcsel, and the map of b2f32 in
PP is dropped because it's not needed now (it's originally only mapped
to ppir_op_mov).

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
5 years agopanfrost: Guard against reading past end of buffer
Tomeu Vizoso [Thu, 11 Apr 2019 07:09:59 +0000 (09:09 +0200)]
panfrost: Guard against reading past end of buffer

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: split asserts in pandecode
Tomeu Vizoso [Thu, 11 Apr 2019 07:09:17 +0000 (09:09 +0200)]
panfrost: split asserts in pandecode

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agollvmpipe: fix undefined shift 1 << 31.
Dave Airlie [Thu, 11 Apr 2019 10:37:43 +0000 (20:37 +1000)]
llvmpipe: fix undefined shift 1 << 31.

Pointed out by coverity.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agoswrast: fix undefined shift of 1 << 31
Dave Airlie [Thu, 11 Apr 2019 10:36:03 +0000 (20:36 +1000)]
swrast: fix undefined shift of 1 << 31

Pointed out by coverity

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agodraw: fix undefined shift of (1 << 31)
Dave Airlie [Thu, 11 Apr 2019 10:27:01 +0000 (20:27 +1000)]
draw: fix undefined shift of (1 << 31)

Pointed out by a coverity scan.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agoiris: Actually pin the scratch BO.
Kenneth Graunke [Thu, 11 Apr 2019 18:51:26 +0000 (11:51 -0700)]
iris: Actually pin the scratch BO.

We were pinning it for compute shaders, and pinning it when restoring
saved buffers, but we never actually pinned it in the original batch
for VS/TCS/TES/GS/FS.

Fixes rendering in GFXBench5's Tessellation demo and a bunch of Piglit
geometry shader tests.

5 years agoanv: store heap address bounds when initializing physical device
Lionel Landwerlin [Thu, 11 Apr 2019 12:01:46 +0000 (13:01 +0100)]
anv: store heap address bounds when initializing physical device

We can then reuse those bounds to initialize the VMA heaps at logical
device creation.

This fixes an issue on EHL which has only 36bits of VMA. We were
incorrectly using the fixed 48bits upper bound to initialize the
logical device heap, resulting in addresses beyong the device's
limits.

v2: Don't confuse heap size (limited by system memory) and VMA size
   (limited by number of addressing bits the platform has)

v3: Fix low heap vma_size :( (Lionel)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reported-by: James Xiong <james.xiong@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v2)
5 years agointel/common: Support bigger right-shifts with mi_builder
Jason Ekstrand [Wed, 3 Apr 2019 19:59:20 +0000 (14:59 -0500)]
intel/common: Support bigger right-shifts with mi_builder

Because why not?

5 years agoanv/cmd_buffer: Use gen_mi_sub instead of gen_mi_add with a negative
Jason Ekstrand [Sun, 31 Mar 2019 22:27:13 +0000 (17:27 -0500)]
anv/cmd_buffer: Use gen_mi_sub instead of gen_mi_add with a negative

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Move mi_memcpy and mi_memset to gen_mi_builder
Jason Ekstrand [Sun, 31 Mar 2019 02:00:26 +0000 (21:00 -0500)]
anv: Move mi_memcpy and mi_memset to gen_mi_builder

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Use gen_mi_builder for queries
Jason Ekstrand [Sun, 31 Mar 2019 01:43:36 +0000 (20:43 -0500)]
anv: Use gen_mi_builder for queries

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Use gen_mi_builder for conditional rendering
Jason Ekstrand [Sat, 30 Mar 2019 23:11:48 +0000 (18:11 -0500)]
anv: Use gen_mi_builder for conditional rendering

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Use gen_mi_builder for indirect dispatch
Jason Ekstrand [Sat, 30 Mar 2019 23:17:56 +0000 (18:17 -0500)]
anv: Use gen_mi_builder for indirect dispatch

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Use gen_mi_builder for indirect draw parameters
Jason Ekstrand [Sat, 30 Mar 2019 22:30:00 +0000 (17:30 -0500)]
anv: Use gen_mi_builder for indirect draw parameters

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Use gen_mi_builder for computing resolve predicates
Jason Ekstrand [Sat, 30 Mar 2019 22:21:12 +0000 (17:21 -0500)]
anv: Use gen_mi_builder for computing resolve predicates

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv: Use gen_mi_builder for CmdDrawIndirectByteCount
Jason Ekstrand [Sat, 30 Mar 2019 21:08:13 +0000 (16:08 -0500)]
anv: Use gen_mi_builder for CmdDrawIndirectByteCount

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel/common: Add unit tests for gen_mi_builder
Jason Ekstrand [Tue, 2 Apr 2019 15:26:09 +0000 (10:26 -0500)]
intel/common: Add unit tests for gen_mi_builder

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel/common: Add a MI command builder
Jason Ekstrand [Sat, 30 Mar 2019 18:09:10 +0000 (13:09 -0500)]
intel/common: Add a MI command builder

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agov3d: Add an optimization pass for redundant flags updates.
Eric Anholt [Fri, 22 Feb 2019 22:26:26 +0000 (14:26 -0800)]
v3d: Add an optimization pass for redundant flags updates.

Our exec masking introduces lots of redundant flags updates, and even
without that there will be cases where NIR comparisons on the same sources
for different reasons may generate the same comparison instruction before
the selection.

total instructions in shared programs: 6492930 -> 6460934 (-0.49%)
total uniforms in shared programs: 2117460 -> 2115106 (-0.11%)
total spills in shared programs: 4983 -> 4987 (0.08%)
total fills in shared programs: 6408 -> 6416 (0.12%)

5 years agokmsro: Extend to include armada-drm
Lubomir Rintel [Thu, 21 Mar 2019 21:19:34 +0000 (22:19 +0100)]
kmsro: Extend to include armada-drm

This allows using the Marvell Armada display controllers (with the
armada drm modesetting driver) along with the render-only drivers,
such as Etnaviv on an OLPC XO-1.75 laptop.

v2:
- Add to Android.mk too

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agolima: implement blit with util_blitter
Icenowy Zheng [Thu, 11 Apr 2019 07:26:12 +0000 (15:26 +0800)]
lima: implement blit with util_blitter

As we have already prepared for using util_blitter, use it to implement
lima_blit.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
5 years agolima: make lima_context_framebuffer subtype of pipe_framebuffer_state
Icenowy Zheng [Thu, 11 Apr 2019 07:24:59 +0000 (15:24 +0800)]
lima: make lima_context_framebuffer subtype of pipe_framebuffer_state

Currently the lima driver saves the framebuffer state in its
from-scratch struct lima_context_framebuffer. However, util_blitter
requires to save framebuffer with standard struct
pipe_framebuffer_state.

Make the lima_context_framebuffer a subtype of the standard
pipe_framebuffer_state, thus the standard part can be used for
util_blitter framebuffer state saving.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
5 years agolima: add dummy set_sample_mask function
Icenowy Zheng [Thu, 11 Apr 2019 07:24:01 +0000 (15:24 +0800)]
lima: add dummy set_sample_mask function

The set_sample_mask function is required in util_blitter.

Add a dummy one to make util_blitter work.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
5 years agogitlab-ci: build gallium extra hud
Eric Engestrom [Tue, 19 Mar 2019 14:23:59 +0000 (14:23 +0000)]
gitlab-ci: build gallium extra hud

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agomeson: remove meson-created megadrivers symlinks
Eric Engestrom [Tue, 9 Apr 2019 08:28:17 +0000 (09:28 +0100)]
meson: remove meson-created megadrivers symlinks

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110356
Fixes: aa7afe324c2092fb31f9 "meson: strip rpath from megadrivers"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir: initialise some variables in opt_if_loop_last_continue()
Timothy Arceri [Wed, 10 Apr 2019 23:38:02 +0000 (09:38 +1000)]
nir: initialise some variables in opt_if_loop_last_continue()

Fixes a couple of Coverity warnings CID 1444626.

Fixes: e30804c6024f ("nir/radv: remove restrictions on opt_if_loop_last_continue()")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agonir/xfb: do not use bare interface type
Juan A. Suarez Romero [Wed, 10 Apr 2019 15:13:19 +0000 (17:13 +0200)]
nir/xfb: do not use bare interface type

In commit 3b3653c4cfb we decided not to use bare types; hence do not use
bare type when comparing with interface type to find out if the xfb
variable is an array block.

This fixes dEQP-VK.transform_feedback.* tests.

Fixes: 3b3653c4cfb ("nir/spirv: don't use bare types, remove assert in
                     split vars for testing")
CC: Dave Airlie <airlied@redhat.com>
CC: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agogitlab-ci: Run CI pipeline for all branches in the main repository
Michel Dänzer [Wed, 10 Apr 2019 08:33:13 +0000 (10:33 +0200)]
gitlab-ci: Run CI pipeline for all branches in the main repository

In turn, do not run the pipeline for the master branch in forked
repositories.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agovirgl: use debug_printf instead of fprintf
Erik Faye-Lund [Wed, 10 Apr 2019 11:40:56 +0000 (13:40 +0200)]
virgl: use debug_printf instead of fprintf

While we're at it, prefix the string with "VIRGL: ", to match similar
code elsewhere in virgl.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agovirgl: do not warn about display-target binding
Erik Faye-Lund [Wed, 10 Apr 2019 10:22:34 +0000 (12:22 +0200)]
virgl: do not warn about display-target binding

We never want to display a transfer-temp surface, so let's ignore that
flag when calculating the new binding flags.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agovirgl: only warn about unchecked flags
Erik Faye-Lund [Wed, 10 Apr 2019 10:18:33 +0000 (12:18 +0200)]
virgl: only warn about unchecked flags

The other flags are already vetted, so there's no point in reporting
them.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>