platform/upstream/mesa.git
3 years agonir,radeonsi: move ffma fusing to late optimizations for better codegen
Marek Olšák [Fri, 4 Sep 2020 09:55:25 +0000 (05:55 -0400)]
nir,radeonsi: move ffma fusing to late optimizations for better codegen

The freedreno trace changes were suggested by Rob Clark.

ALU performance is higher, because ffma is used more often, but so is
register usage, because trinary opcodes (such as ffma) usually need
at least 3 live registers.

54793 shaders in 33659 tests
Totals:
SGPRS: 2639746 -> 2642938 (0.12 %)
VGPRS: 1534120 -> 1536392 (0.15 %)
Spilled SGPRs: 3541 -> 3618 (2.17 %)
Spilled VGPRs: 33 -> 44 (33.33 %)
Scratch size: 292 -> 312 (6.85 %) dwords per thread
Code Size: 55639836 -> 55620116 (-0.04 %) bytes
Max Waves: 964785 -> 963977 (-0.08 %)

Totals from affected shaders:
SGPRS: 1105800 -> 1108992 (0.29 %)
VGPRS: 635292 -> 637564 (0.36 %)
Spilled SGPRs: 3193 -> 3270 (2.41 %)
Spilled VGPRs: 33 -> 44 (33.33 %)
Scratch size: 36 -> 56 (55.56 %) dwords per thread
Code Size: 31568708 -> 31548988 (-0.06 %) bytes
Max Waves: 319991 -> 319183 (-0.25 %)

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6596>

3 years agost/mesa: don't enable NV_copy_depth_to_color if NIR doesn't support FP64
Marek Olšák [Tue, 1 Sep 2020 01:00:01 +0000 (21:00 -0400)]
st/mesa: don't enable NV_copy_depth_to_color if NIR doesn't support FP64

Fixes: e512f2cef92 - mesa: add NV_copy_depth_to_color support for nir
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3459

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6467>

3 years agolibgl-gdi: Fix unused-variable warnings.
Vinson Lee [Mon, 31 Aug 2020 00:22:17 +0000 (17:22 -0700)]
libgl-gdi: Fix unused-variable warnings.

src/gallium/targets/libgl-gdi/libgl_gdi.c:59:16: warning: ‘use_swr’ defined but not used [-Wunused-variable]
   59 | static boolean use_swr = FALSE;
      |                ^~~~~~~
src/gallium/targets/libgl-gdi/libgl_gdi.c:58:16: warning: ‘use_llvmpipe’ defined but not used [-Wunused-variable]
   58 | static boolean use_llvmpipe = FALSE;
      |                ^~~~~~~~~~~~

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6508>

3 years agospirv: Handle OpTypeOpaque
Jesse Natalie [Mon, 14 Sep 2020 21:59:12 +0000 (14:59 -0700)]
spirv: Handle OpTypeOpaque

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6715>

3 years agoturnip: multiViewport and VK_EXT_shader_viewport_index_layer
Jonathan Marek [Tue, 14 Jul 2020 14:38:09 +0000 (10:38 -0400)]
turnip: multiViewport and VK_EXT_shader_viewport_index_layer

Passes at least:
dEQP-VK.dynamic_state.vp_state.viewport_array
dEQP-VK.draw.shader_viewport_index.*
dEQP-VK.draw.shader_layer.*

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5832>

3 years agofreedreno/ir3: add view_zero to shader key
Jonathan Marek [Thu, 9 Jul 2020 20:15:18 +0000 (16:15 -0400)]
freedreno/ir3: add view_zero to shader key

Does the same thing as layer_zero, but for VARYING_SLOT_VIEWPORT.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5832>

3 years agofreedreno/ir3: allow layer/viewport output for VS/GS/DS
Jonathan Marek [Thu, 9 Jul 2020 18:22:12 +0000 (14:22 -0400)]
freedreno/ir3: allow layer/viewport output for VS/GS/DS

With VK_EXT_shader_viewport_index_layer, these stages can all output the
viewport or layer id, and not just GS anymore.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5832>

3 years agofrontends/va: Derive image from interlaced buffers in some cases
Thong Thai [Sat, 15 Aug 2020 18:36:45 +0000 (14:36 -0400)]
frontends/va: Derive image from interlaced buffers in some cases

Add an allowlist to make an exception when deriving images from
interlaced buffers. Normally, the function should fail if the surface
needs to be modified to derive the image. But some applications do not
follow the fall-back method of using vaCreateImage + vaPutImage as
mentioned in the VAAPI documentation, so we have to make an exception.

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5942>

3 years agofrontends/va: Derive image from interlaced buffers
Thong Thai [Thu, 16 Jul 2020 20:57:54 +0000 (16:57 -0400)]
frontends/va: Derive image from interlaced buffers

Allow vaDriveImage to derive a vaImage from interlaced buffers
by creating a new progressive buffer.

v2: Keeps the surface used by DeriveImage untouched (Pierre-Eric)
v3: Fixed a segfault reported by Roman Elshin

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1428
Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5942>

3 years agofrontends/va: Add support for NV12/P010/P016 to vaDeriveImage
Thong Thai [Sat, 15 Aug 2020 18:09:01 +0000 (14:09 -0400)]
frontends/va: Add support for NV12/P010/P016 to vaDeriveImage

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5942>

3 years agoaco: pass -fno-exceptions and -fno-rtti
Rhys Perry [Fri, 14 Aug 2020 10:26:44 +0000 (11:26 +0100)]
aco: pass -fno-exceptions and -fno-rtti

We don't use exceptions or RTTI at all, so pass this flag to the compiler
to allow it to create better code.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6315>

3 years agoiris: remove additional pipe control done before hiz for older gens
Tapani Pälli [Fri, 4 Sep 2020 06:56:19 +0000 (09:56 +0300)]
iris: remove additional pipe control done before hiz for older gens

The restriction found in removed comment is not found on new specs.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6593>

3 years agointel/genxml: make sure test assert are compiled in
Lionel Landwerlin [Mon, 7 Sep 2020 11:59:17 +0000 (14:59 +0300)]
intel/genxml: make sure test assert are compiled in

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat anuj.phogat@gmail.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6678>

3 years agonv50/ir: Initialize Converter members.
Vinson Lee [Fri, 11 Sep 2020 22:49:50 +0000 (15:49 -0700)]
nv50/ir: Initialize Converter members.

Fix defects reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
Non-static class member exit is not initialized in this
constructor nor in any functions that it calls
Non-static class member immInsertPos is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6695>

3 years agofreedreno: Check file descriptor before write.
Vinson Lee [Fri, 11 Sep 2020 23:00:07 +0000 (16:00 -0700)]
freedreno: Check file descriptor before write.

Fix defect reported by Coverity Scan.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be
negative.

Fixes: 1ea4ef0d3be8 ("freedreno: slurp in decode tools")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6696>

3 years agoac/llvm: Fix nonportable sizeof.
Vinson Lee [Fri, 11 Sep 2020 00:52:16 +0000 (17:52 -0700)]
ac/llvm: Fix nonportable sizeof.

Fix defect reported by Coverity.

Sizeof not portable (SIZEOF_MISMATCH)
suspicious_sizeof: Passing argument vec_size * 8UL /* sizeof
(LLVMValueRef *) */ to function __builtin_alloca and then casting
the return value to LLVMValueRef * is suspicious. In this
particular case sizeof (LLVMValueRef *) happens to be equal to
sizeof (LLVMValueRef), but this is not a portable assumption.

Fixes: ca74603b4f6e ("ac/llvm: add better code for isign")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6682>

3 years agoandroid: aco/isel: Move context initialization code to a dedicated file
Mauro Rossi [Sun, 13 Sep 2020 12:18:15 +0000 (14:18 +0200)]
android: aco/isel: Move context initialization code to a dedicated file

Changes are necessary to properly build libmesa_aco static library for Android.
was removed in 47de55328 "aco/isel: Move context initialization code to a dedicated file"
so filter-out of aco_instruction_selection_setup.cpp in Android is removed.

Fixes the following building errors:

FAILED: out/target/product/x86_64/obj/SHARED_LIBRARIES/vulkan.radv_intermediates/LINKED/vulkan.radv.so
...
ld.lld: error: undefined symbol: aco::setup_isel_context(aco::Program*, unsigned int, nir_shader* const*, ac_shader_config*, radv_shader_args*, bool)
>>> referenced by aco_instruction_selection.cpp:10879 (external/mesa/src/amd/compiler/aco_instruction_selection.cpp:10879)
>>>               aco_instruction_selection.o:(aco::select_program(aco::Program*, unsigned int, nir_shader* const*, ac_shader_config*, radv_shader_args*)) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_aco_intermediates/libmesa_aco.a
...
ld.lld: error: undefined symbol: aco::init_context(aco::isel_context*, nir_shader*)
>>> referenced by aco_instruction_selection.cpp:10885 (external/mesa/src/amd/compiler/aco_instruction_selection.cpp:10885)
>>>               aco_instruction_selection.o:(aco::select_program(aco::Program*, unsigned int, nir_shader* const*, ac_shader_config*, radv_shader_args*)) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_aco_intermediates/libmesa_aco.a

Fixes: 47de55328 ("aco/isel: Move context initialization code to a dedicated file")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6703>

3 years agoetnaviv: call nir_opt_shrink_vectors(..) in opt loop
Christian Gmeiner [Fri, 21 Aug 2020 22:01:49 +0000 (00:01 +0200)]
etnaviv: call nir_opt_shrink_vectors(..) in opt loop

total instructions in shared programs: 105044 -> 103312 (-1.65%)
instructions in affected programs: 27328 -> 25596 (-6.34%)
helped: 55
HURT: 0
helped stats (abs) min: 4 max: 96 x̄: 31.49 x̃: 24
helped stats (rel) min: 1.18% max: 23.08% x̄: 8.26% x̃: 6.88%
95% mean confidence interval for instructions value: -37.81 -25.18
95% mean confidence interval for instructions %-change: -9.66% -6.85%
Instructions are helped.

total temps in shared programs: 2960 -> 2917 (-1.45%)
temps in affected programs: 425 -> 382 (-10.12%)
helped: 41
HURT: 6
helped stats (abs) min: 1 max: 3 x̄: 1.20 x̃: 1
helped stats (rel) min: 7.14% max: 25.00% x̄: 13.79% x̃: 12.50%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 12.50% max: 25.00% x̄: 17.52% x̃: 16.67%
95% mean confidence interval for temps value: -1.17 -0.66
95% mean confidence interval for temps %-change: -13.30% -6.29%
Temps are helped.

total immediates in shared programs: 16772 -> 16468 (-1.81%)
immediates in affected programs: 4304 -> 4000 (-7.06%)
helped: 59
HURT: 0
helped stats (abs) min: 4 max: 16 x̄: 5.15 x̃: 4
helped stats (rel) min: 2.22% max: 33.33% x̄: 9.31% x̃: 7.14%
95% mean confidence interval for immediates value: -5.88 -4.43
95% mean confidence interval for immediates %-change: -11.14% -7.49%
Immediates are helped.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6572>

3 years agopan/bit: Fix unit tests
Alyssa Rosenzweig [Wed, 9 Sep 2020 20:29:41 +0000 (16:29 -0400)]
pan/bit: Fix unit tests

Broken by the various GenXML refactors, oops!

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6712>

3 years agopan/bit: Set d3d=true for CMP tests
Alyssa Rosenzweig [Fri, 31 Jul 2020 17:12:34 +0000 (13:12 -0400)]
pan/bit: Set d3d=true for CMP tests

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: ec37c7126dc ("bifrost: Emit "d3d" variant of comparison instructions")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6712>

3 years agopanfrost: Fix nonzero stencil mask on vertex/compute
Alyssa Rosenzweig [Wed, 9 Sep 2020 20:29:04 +0000 (16:29 -0400)]
panfrost: Fix nonzero stencil mask on vertex/compute

Probably harmless but looks funny in the decode.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6712>

3 years agoturnip: avoid heap allocations in QueueSubmit when semaphores are used
Jonathan Marek [Fri, 11 Sep 2020 12:55:23 +0000 (08:55 -0400)]
turnip: avoid heap allocations in QueueSubmit when semaphores are used

Use the stack. (note: we already do for drm_msm_gem_submit_cmd array, and
using calloc() for heap allocations in a VK driver is wrong

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6687>

3 years agonir/algebraic: fold some nested comparisons with ball and bany
Italo Nicola [Fri, 4 Sep 2020 18:26:01 +0000 (18:26 +0000)]
nir/algebraic: fold some nested comparisons with ball and bany

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6604>

3 years agoglsl: fix per_vertex_accumulator::fields size
Pierre-Eric Pelloux-Prayer [Fri, 11 Sep 2020 13:45:48 +0000 (15:45 +0200)]
glsl: fix per_vertex_accumulator::fields size

49d35f3d882bd0f4418a1ce056344b8f06bd75dd moved gl_Layer/gl_ViewportIndex/gl_ViewportMask
as builtins but fields size wasn't increased.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3508
Fixes: 49d35f3d882 ("glsl: declare gl_Layer/gl_ViewportIndex/gl_ViewportMask as vs builtins")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6688>

3 years agoaco: Add base argument to emit_mbcnt.
Timur Kristóf [Sun, 13 Sep 2020 14:33:35 +0000 (16:33 +0200)]
aco: Add base argument to emit_mbcnt.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6699>

3 years agoaco: Clean up emit_mbcnt.
Timur Kristóf [Sat, 12 Sep 2020 11:18:23 +0000 (13:18 +0200)]
aco: Clean up emit_mbcnt.

Make it less error-prone and more consistent with other helpers.
Pass the masks as a single argument rather than two.
In wave64 mode, split the argument into low and high halves in
emit_mbcnt rather than where it is called.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6699>

3 years agoaco: Fix emit_boolean_exclusive_scan in wave32 mode.
Timur Kristóf [Sat, 12 Sep 2020 11:20:06 +0000 (13:20 +0200)]
aco: Fix emit_boolean_exclusive_scan in wave32 mode.

Use the lane mask instead of s2 for the register class.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6699>

3 years agoglsl: mark some builtins with correct glsl(es) version check
Tapani Pälli [Tue, 25 Aug 2020 08:28:06 +0000 (11:28 +0300)]
glsl: mark some builtins with correct glsl(es) version check

GLSL Desktop spec 1.30.x:
   "New built-ins: trunc(), round(), roundEven(), isnan(), isinf(), modf()"

For ES, 3.00.x is the first ES spec that mentions the builtins.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6455>

3 years agolima: dont split vec3 unaligned load inputs
Erico Nunes [Sun, 30 Aug 2020 20:12:23 +0000 (22:12 +0200)]
lima: dont split vec3 unaligned load inputs

It seems that the mali400 pp is unable to load vec3 unaligned varyings.
This can happen in the current state with mesa if a varying float is put
into the first component of a vec4 and a vec3 is packed right after it.
This would be fine as by default nir would create a vec4 load followed
by a mov with swizzle to realign the components into a vec3.
In lima_nir_split_load_input, this becomes a separate vec3 load
expecting the unaligned load.
Since this can't happen, skip the load input splitting for this special
case.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6507>

3 years agoturnip: device global bo list
Jonathan Marek [Fri, 11 Sep 2020 14:26:40 +0000 (10:26 -0400)]
turnip: device global bo list

Avoid having to deal with BO tracking. However, the kernel still requires a
bo list, so keep a global one which can be re-used for every submit.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6686>

3 years agoanv, iris: Set MediaSamplerDOPClockGateEnable for gen12+
Jordan Justen [Sun, 29 Mar 2020 09:16:06 +0000 (02:16 -0700)]
anv, iris: Set MediaSamplerDOPClockGateEnable for gen12+

This has been shown to help performance on TGL and DG1. This could be
applied to gen9+, but we still need to show if it helps with those
platforms.

Rework:
 * Make change in src/intel/vulkan/genX_cmd_buffer.c too. (Ken)
 * Keep mask as 3 for gen < 12

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6684>

3 years agoanv/image: Disable multi-layer CCS_E on TGL+
Nanley Chery [Mon, 31 Aug 2020 21:59:44 +0000 (14:59 -0700)]
anv/image: Disable multi-layer CCS_E on TGL+

Anv doesn't do multi-layer fast-clear tracking, but TGL may add
fast-clears to multiple layers. Disable CCS_E for image arrays on TGL+
until anv gets more clear color tracking abilities.

With this change, anv+TGL now passes:
* dEQP-VK.multiview.readback_implicit_clear.15_15_15_15
* dEQP-VK.multiview.readback_implicit_clear.8_1_1_8
* dEQP-VK.multiview.readback_implicit_clear.1_2_4_8_16_32
* dEQP-VK.multiview.renderpass2.readback_implicit_clear.15_15_15_15
* dEQP-VK.multiview.renderpass2.readback_implicit_clear.8_1_1_8
* dEQP-VK.multiview.renderpass2.readback_implicit_clear.1_2_4_8_16_32

v2. Mention HSD 14010672564. (Sagar)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6528>

3 years agonir/opt_vectorize: don't lose exact and no_*_wrap flags
Marek Olšák [Fri, 11 Sep 2020 18:55:28 +0000 (14:55 -0400)]
nir/opt_vectorize: don't lose exact and no_*_wrap flags

This fixes a bunch of dEQP GLES tests.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6694>

3 years agofreedreno: fix fence-fd leak
Rob Clark [Fri, 11 Sep 2020 20:11:52 +0000 (13:11 -0700)]
freedreno: fix fence-fd leak

sync_accumulate() does not take ownership.

Fixes: bf23ff83e69 ("freedreno: fence_server_sync() fixes")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6692>

3 years agoradeonsi: fix max syncobj wait timeout
Qiang Yu [Thu, 10 Sep 2020 02:08:41 +0000 (10:08 +0800)]
radeonsi: fix max syncobj wait timeout

syncobj wait takes int64_t timeout and won't clamp it
in kernel code, so we have to pass in INT64_MAX instead
of OS_TIMEOUT_INFINITE which is UINT64_MAX. Otherwise
syncobj wait with OS_TIMEOUT_INFINITE case just return
fail.

Fixes: c638301b42b "radeonsi: fix syncobj wait timeout"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6676>

3 years agov3d/compiler: fix V3D double-rounding of .8 fixed-point XY coordinates
Iago Toral Quiroga [Thu, 10 Sep 2020 08:36:27 +0000 (10:36 +0200)]
v3d/compiler: fix V3D double-rounding of .8 fixed-point XY coordinates

Pre-V3D 4.3 hardware has a quirk where it expects XY coordinates in
.8 fixed-point format, but then it will internally round it to .6 fixed-point,
introducing a double rounding. The double rounding can cause very slight
differences in triangle raterization coverage that can actually be noticed by
some CTS tests.

The correct fix for this as recommended by Broadcom is to convert to
.8 fixed-point with ffloor().

Fixes:
dEQP-VK.renderpass.suballocation.subpass_dependencies.late_fragment_tests.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6677>

3 years agodisk_cache: move cache item loading code into disk_cache_load_item() helper
Timothy Arceri [Thu, 6 Aug 2020 00:24:21 +0000 (10:24 +1000)]
disk_cache: move cache item loading code into disk_cache_load_item() helper

This should be helpful if someone chooses to implement cache support on
windows. Also providing this greater level of abstraction makes it easier
to implement alterative cache layouts in future.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: add new OS specific helper disk_cache_evict_item()
Timothy Arceri [Wed, 5 Aug 2020 04:46:42 +0000 (14:46 +1000)]
disk_cache: add new OS specific helper disk_cache_evict_item()

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: move get_cache_file() to an OS specific helper
Timothy Arceri [Wed, 5 Aug 2020 04:35:12 +0000 (14:35 +1000)]
disk_cache: move get_cache_file() to an OS specific helper

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: create new helper for writing cache items to disk
Timothy Arceri [Wed, 5 Aug 2020 04:21:24 +0000 (14:21 +1000)]
disk_cache: create new helper for writing cache items to disk

This pulls out the cache item writing code from cache_put() into
a new helper. In this patch we also move various functions called
by this code into the new disk_cache_os.c file.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: move evict_lru_item() to an OS specific helper
Timothy Arceri [Wed, 5 Aug 2020 03:35:39 +0000 (13:35 +1000)]
disk_cache: move evict_lru_item() to an OS specific helper

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: move munmap into an OS specific helper
Timothy Arceri [Fri, 31 Jul 2020 04:29:12 +0000 (14:29 +1000)]
disk_cache: move munmap into an OS specific helper

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: move index mmap into OS specific helper
Timothy Arceri [Fri, 31 Jul 2020 04:23:56 +0000 (14:23 +1000)]
disk_cache: move index mmap into OS specific helper

This will make windows support easier to add in future.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: add disk_cache_enabled() helper
Timothy Arceri [Fri, 31 Jul 2020 01:16:43 +0000 (11:16 +1000)]
disk_cache: add disk_cache_enabled() helper

This will make windows support easier to add in future.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agodisk_cache: move cache dir generation into OS specific helper file
Timothy Arceri [Thu, 30 Jul 2020 04:50:02 +0000 (14:50 +1000)]
disk_cache: move cache dir generation into OS specific helper file

This will make windows support easier to add in future. To avoid code
churn this temporarily duplicates the mkdir_if_needed() function, we
will delete the duplicate in a following patch.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197>

3 years agonv50/ir: Remove duplicate mask assignment.
Vinson Lee [Wed, 9 Sep 2020 22:08:55 +0000 (15:08 -0700)]
nv50/ir: Remove duplicate mask assignment.

A duplicate assignment was added in f2924994bd3e ("nv50/ir: add
nv50_ir_prog_info_out").

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6674>

3 years agonv50/ir: Add fallthrough statement.
Vinson Lee [Tue, 8 Sep 2020 04:15:03 +0000 (21:15 -0700)]
nv50/ir: Add fallthrough statement.

Fix defect reported by Coverity Scan.

Missing break in switch (MISSING_BREAK)
unterminated_case: The case for value
nir_intrinsic_bindless_image_samples is not terminated by a 'break'
statement.

Suggested-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6645>

3 years agonir/algebraic: add late optimizations that optimize out mediump conversions (v3)
Marek Olšák [Sun, 6 Sep 2020 01:09:38 +0000 (21:09 -0400)]
nir/algebraic: add late optimizations that optimize out mediump conversions (v3)

v2: move *2*mp patterns to the end of late_optimizations
v3: remove ftrunc from the optimizations to fix:
    dEQP-GLES3.functional.shaders.builtin_functions.common.modf.vec2_lowp_vertex

Reviewed-by: Rob Clark <robdclark@chromium.org> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agonir/algebraic: collapse conversion opcodes (many patterns)
Marek Olšák [Fri, 4 Sep 2020 05:48:35 +0000 (01:48 -0400)]
nir/algebraic: collapse conversion opcodes (many patterns)

mediump inserts a lot of conversions. This cleans up the IR.
All other combinations are covered too.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agonir: add new mediump opcodes f2[ui]mp, i2fmp, u2fmp
Marek Olšák [Fri, 4 Sep 2020 03:47:32 +0000 (23:47 -0400)]
nir: add new mediump opcodes f2[ui]mp, i2fmp, u2fmp

Algebraic optimizations will select them.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agonir: enforce 32-bit src type requirement for f2fmp and i2imp
Marek Olšák [Fri, 4 Sep 2020 06:07:43 +0000 (02:07 -0400)]
nir: enforce 32-bit src type requirement for f2fmp and i2imp

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agonir: remove redundant opcode u2ump
Marek Olšák [Fri, 4 Sep 2020 05:51:49 +0000 (01:51 -0400)]
nir: remove redundant opcode u2ump

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agonir/algebraic: expand existing 32-bit patterns to all bit sizes using loops
Marek Olšák [Tue, 1 Sep 2020 06:20:34 +0000 (02:20 -0400)]
nir/algebraic: expand existing 32-bit patterns to all bit sizes using loops

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agonir/algebraic: add flrp patterns for 16 and 64 bits
Marek Olšák [Tue, 1 Sep 2020 04:12:08 +0000 (00:12 -0400)]
nir/algebraic: add flrp patterns for 16 and 64 bits

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agopan/mdg: Obey f2fmp size restriction in fuse_io_16
Alyssa Rosenzweig [Thu, 10 Sep 2020 20:47:37 +0000 (16:47 -0400)]
pan/mdg: Obey f2fmp size restriction in fuse_io_16

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

3 years agoblorp: Drop trailing whitespace in blorp_clear.c
Nanley Chery [Tue, 8 Sep 2020 14:34:50 +0000 (07:34 -0700)]
blorp: Drop trailing whitespace in blorp_clear.c

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6650>

3 years agoblorp: Fix alignment test for HIZ_CCS_WT fast-clears
Nanley Chery [Tue, 8 Sep 2020 14:33:59 +0000 (07:33 -0700)]
blorp: Fix alignment test for HIZ_CCS_WT fast-clears

Remove the extra logical ORs in the ternary operation.

Fixes: 5425fcf2cb3 ("intel/blorp: Satisfy HIZ_CCS fast-clear alignments")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6650>

3 years agonir: fix lower_mediump_outputs to not require variables
Marek Olšák [Sun, 6 Sep 2020 04:25:05 +0000 (00:25 -0400)]
nir: fix lower_mediump_outputs to not require variables

If IO is lowered, NIR doesn't have to contain any IO variables
(and in fact radeonsi removes them and other drivers should too).

This makes the pass work without variables.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6621>

3 years agonir: add mediump flag to IO semantics
Marek Olšák [Sun, 6 Sep 2020 04:24:31 +0000 (00:24 -0400)]
nir: add mediump flag to IO semantics

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6621>

3 years agoglx/dri3: Implement GLX_EXT_swap_control_tear
Adam Jackson [Wed, 9 Sep 2020 19:14:30 +0000 (15:14 -0400)]
glx/dri3: Implement GLX_EXT_swap_control_tear

Not wired up for DRI2 because it would require server-side support,
which I'm not especially interested in writing.

Fixes: mesa/mesa#96
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Implement GLX_EXT_swap_control for DRI2 and DRI3
Adam Jackson [Wed, 9 Sep 2020 18:00:35 +0000 (14:00 -0400)]
glx: Implement GLX_EXT_swap_control for DRI2 and DRI3

This is a slight generalization of the existing SGI and MESA swap
control extensions, and a prerequisite for GLX_EXT_swap_control_tear.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Reject glXSwapIntervalMESA greater than INT_MAX
Adam Jackson [Wed, 9 Sep 2020 19:54:21 +0000 (15:54 -0400)]
glx: Reject glXSwapIntervalMESA greater than INT_MAX

It wouldn't work in any case, as the internal API only stores a signed
int, and GLX_EXT_swap_control_tear will overload the meaning of negative
values so we should avoid ambiguity.

If your application needs a swap interval in excess of ~414.25 days, I'm
very sorry.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Collect all the non-applegl extensions in the GetProcAddress table
Adam Jackson [Wed, 9 Sep 2020 17:28:02 +0000 (13:28 -0400)]
glx: Collect all the non-applegl extensions in the GetProcAddress table

No functional change, just reducing #ifdef clutter.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agoglx: Use GLX_FUNCTION2 only for actually aliased function names
Adam Jackson [Wed, 9 Sep 2020 16:40:19 +0000 (12:40 -0400)]
glx: Use GLX_FUNCTION2 only for actually aliased function names

I find the __glX naming convention distasteful for a bunch of reasons,
not least that I expect "vi -t glXBindTexImageEXT" to take me someplace
useful. The functions we're referencing here should not be exported from
libGL (hence the static / _X_HIDDEN) but that's no reason not to name
them correctly.

This does have one possible, very minor, correct functional change,
glXGetMscRateOML now returns Bool (unsigned int) instead of GLboolean
(unsigned char); if your psABI really only writes to a single byte of
the return register when the return type is char-like, then we probably
would not have returned false when we meant to. At least for amd64 this
does not seem to be an issue; the old code wrote 0 to %eax, the new code
does a zero-extended load from %al to %eax (since the internal function
still returns GLboolean).

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>

3 years agowsi/x11: Hook up VK_PRESENT_MODE_FIFO_RELAXED_KHR
Adam Jackson [Wed, 9 Sep 2020 21:03:11 +0000 (17:03 -0400)]
wsi/x11: Hook up VK_PRESENT_MODE_FIFO_RELAXED_KHR

This is just PresentOptionAsync.

Fixes: mesa/mesa#3483
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6673>

3 years agoci: do not build libdrm for vc4, reedreno and etnaviv
Christian Gmeiner [Wed, 9 Sep 2020 20:21:14 +0000 (22:21 +0200)]
ci: do not build libdrm for vc4, reedreno and etnaviv

They are using a in source tree version of the needed libdrm
functionality or are shipping all needed headers in the source tree.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6672>

3 years agoturnip: rework vertex buffers draw state handling
Jonathan Marek [Wed, 9 Sep 2020 13:26:59 +0000 (09:26 -0400)]
turnip: rework vertex buffers draw state handling

This exploits a HW optimization for when only the size of a draw state is
changed, to make things simpler and more optimal (assuming a well behaved
user which doesn't unecessarily call CmdBindVertexBuffers many times)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6665>

3 years agointel/tools: fix possible randomly increased verbosity of error2aub
Marcin Ślusarz [Wed, 9 Sep 2020 17:42:52 +0000 (19:42 +0200)]
intel/tools: fix possible randomly increased verbosity of error2aub

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

3 years agointel/compiler: quiet Coverity warnings
Marcin Ślusarz [Wed, 9 Sep 2020 17:01:49 +0000 (19:01 +0200)]
intel/compiler: quiet Coverity warnings

Coverity complains about possible out-of-bounds write & read, because
it thinks that "loc + i" can be bigger than sizes of the 2 used arrays.

It's not obvious from the code it cannot happen, so add asserts here.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

3 years agointel/tools: handle ftell errors
Marcin Ślusarz [Wed, 9 Sep 2020 16:48:16 +0000 (18:48 +0200)]
intel/tools: handle ftell errors

Found by Coverity, as "argument cannot be negative", referring to
fread's 2nd argument.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

3 years agointel/tools: fix possible memory leak in the error path
Marcin Ślusarz [Wed, 9 Sep 2020 16:45:08 +0000 (18:45 +0200)]
intel/tools: fix possible memory leak in the error path

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

3 years agointel/compiler: initialize remaining fields of various classes
Marcin Ślusarz [Wed, 9 Sep 2020 16:13:43 +0000 (18:13 +0200)]
intel/compiler: initialize remaining fields of various classes

These variables seem to be initialized before being used, so this
patch is not fixing any bug, but leaving them unitialized may become
a bug after some refactoring.

These classes were affected: fs_reg_alloc, fs_visitor, fs_generator,
instruction_scheduler.

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

3 years agointel/compiler: remove unused fs_validator::param_size
Marcin Ślusarz [Wed, 9 Sep 2020 16:26:56 +0000 (18:26 +0200)]
intel/compiler: remove unused fs_validator::param_size

Found by Coverity as unitialized variable.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

3 years agoanv: fix minor gen_ioctl(I915_PERF_IOCTL_CONFIG) error handling issue
Marcin Ślusarz [Wed, 9 Sep 2020 15:59:41 +0000 (17:59 +0200)]
anv: fix minor gen_ioctl(I915_PERF_IOCTL_CONFIG) error handling issue

Found by Coverity.

Fixes: 2001a80d4a8 ("anv: Implement VK_KHR_performance_query")
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

3 years agodriconf: add option to reuse GL names
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 14:20:17 +0000 (16:20 +0200)]
driconf: add option to reuse GL names

Fix apps expecting name recycling.
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3144 is an example
of such issue, SPECviewperf13 has this problem too.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agomesa: use _mesa_HashFindFreeKeys for GL functions
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 13:12:03 +0000 (15:12 +0200)]
mesa: use _mesa_HashFindFreeKeys for GL functions

This allows to implement name reuse if we want to.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agomesa: add _mesa_HashFindFreeKeys
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 13:10:31 +0000 (15:10 +0200)]
mesa: add _mesa_HashFindFreeKeys

_mesa_HashFindFreeKeyBlock function returns a name range, so it cannot be
used to recycle non-consecutive names.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agomesa: add GL name reuse support
Pierre-Eric Pelloux-Prayer [Mon, 17 Aug 2020 14:18:50 +0000 (16:18 +0200)]
mesa: add GL name reuse support

This will allow drivers to adopt the behavior of proprietary drivers that seem
to return the lowest available name (while Mesa returns max_seen_name + 1).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agomesa: add a isGenName parameter to _mesa_HashInsert
Pierre-Eric Pelloux-Prayer [Fri, 4 Sep 2020 12:07:04 +0000 (14:07 +0200)]
mesa: add a isGenName parameter to _mesa_HashInsert

Indicates if the given name has been returned by _mesa_HashFindFreeKeyBlock.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agoutil/idalloc: add lowest_free_idx to avoid iterating from 0
Pierre-Eric Pelloux-Prayer [Mon, 7 Sep 2020 13:15:50 +0000 (15:15 +0200)]
util/idalloc: add lowest_free_idx to avoid iterating from 0

lowest_free_idx is a conservative estimation of the lowest index
where a free id can be found.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agoutil/idalloc: add util_idalloc_reserve
Pierre-Eric Pelloux-Prayer [Mon, 7 Sep 2020 12:47:47 +0000 (14:47 +0200)]
util/idalloc: add util_idalloc_reserve

Can be used to mark an id as used (if it was reclaimed without using
util_idalloc_alloc).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agomesa: move u_idalloc from gallium/aux/util to util
Pierre-Eric Pelloux-Prayer [Tue, 8 Sep 2020 18:41:14 +0000 (20:41 +0200)]
mesa: move u_idalloc from gallium/aux/util to util

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

3 years agofreedreno/a6xx: Fix MSAA clear
Rob Clark [Tue, 8 Sep 2020 16:12:23 +0000 (09:12 -0700)]
freedreno/a6xx: Fix MSAA clear

We need to do MSAA clear on the 3d pipe, it seems to not work out
properly on 2d pipe (at least for 4x MSAA and heights that are not
multiple of 16).

This matches what blob and tu seem to do.  Fixes the following with
DEQP_CONFIG=rgba8888d24s8ms4

dEQP-GLES31.functional.primitive_bounding_box.depth.builtin_depth.per_primitive_bbox_equal
dEQP-GLES31.functional.primitive_bounding_box.depth.builtin_depth.per_primitive_bbox_larger
dEQP-GLES31.functional.primitive_bounding_box.depth.user_defined_depth.per_primitive_bbox_equal
dEQP-GLES31.functional.primitive_bounding_box.depth.user_defined_depth.per_primitive_bbox_larger

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

3 years agofreedreno: Clear gs/tcs/tes state for clear blits
Rob Clark [Wed, 9 Sep 2020 21:03:43 +0000 (14:03 -0700)]
freedreno: Clear gs/tcs/tes state for clear blits

Otherwise we could emit a clear blit that is trying to use some random
GS stage, which doesn't go well.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

3 years agofreedreno/a6xx: Fix fd6_draw_vbo() return
Rob Clark [Wed, 9 Sep 2020 21:03:15 +0000 (14:03 -0700)]
freedreno/a6xx: Fix fd6_draw_vbo() return

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

3 years agofreedreno/a6xx: Skip empty tile_setup
Rob Clark [Wed, 9 Sep 2020 16:08:02 +0000 (09:08 -0700)]
freedreno/a6xx: Skip empty tile_setup

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

3 years agofreedreno: Don't bypass fd_draw_vbo() in clear fallback
Rob Clark [Tue, 8 Sep 2020 23:27:54 +0000 (16:27 -0700)]
freedreno: Don't bypass fd_draw_vbo() in clear fallback

Otherwise we bypass all the resource-usage tacking.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

3 years agofreedreno: Fix rast state for multisample clear
Rob Clark [Tue, 8 Sep 2020 21:56:55 +0000 (14:56 -0700)]
freedreno: Fix rast state for multisample clear

a6xx in particular cares about the multisample bit.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6649>

3 years agogallivm: disable brilinear for lod bias and explicit lod.
Dave Airlie [Mon, 7 Sep 2020 19:37:36 +0000 (05:37 +1000)]
gallivm: disable brilinear for lod bias and explicit lod.

This allows GL 4.5 CTS to pass in full with no flags, other than
that I'm not sure if it's a good or bad idea.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6638>

3 years agofreedreno/fdl: Add layout test for the Android CTS's MSAA mustpass surface.
Eric Anholt [Thu, 3 Sep 2020 20:11:37 +0000 (13:11 -0700)]
freedreno/fdl: Add layout test for the Android CTS's MSAA mustpass surface.

Rob had a question of if we were laying things out the same as the blob.
This doesn't detect any difference in our layout, though.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6589>

3 years agofreedreno/cffdec: Add support for texturator's 2DMS layout setup.
Eric Anholt [Thu, 3 Sep 2020 20:04:29 +0000 (13:04 -0700)]
freedreno/cffdec: Add support for texturator's 2DMS layout setup.

We can't initialize our MSAA texture with glTexImage2D(), so we have to do
a draw to get its slice's layout into the cmdstream.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6589>

3 years agofreedreno/cffdec: Fix up texturator parsing scripts for XML changes.
Eric Anholt [Thu, 3 Sep 2020 18:24:01 +0000 (11:24 -0700)]
freedreno/cffdec: Fix up texturator parsing scripts for XML changes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6589>

3 years agofreedreno: Add another new sysmem flake.
Eric Anholt [Wed, 9 Sep 2020 20:10:05 +0000 (13:10 -0700)]
freedreno: Add another new sysmem flake.

This one blocked a marge merge a few minutes ago.

Fixes: b4317fccdd7f ("ci/bare-metal: Update the kernel to msm-next-pgtables")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6670>

3 years agospirv: Initialize spirv_test member shader.
Vinson Lee [Mon, 7 Sep 2020 23:44:07 +0000 (16:44 -0700)]
spirv: Initialize spirv_test member shader.

Fix defect reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member shader is not initialized in this
constructor nor in any functions that it calls

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6640>

3 years agosvga: Fix unused printf argument.
Vinson Lee [Tue, 8 Sep 2020 02:31:38 +0000 (19:31 -0700)]
svga: Fix unused printf argument.

Fix defect reported by Coverity Scan.

Extra argument to printf format specifier (PRINTF_ARGS)
extra_argument: This argument was not used by the format string:
info->num_outputs.

Fixes: ccb4ea5a43e8 ("svga: Add GL4.1(compatibility profile) support in svga driver")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6644>

3 years agofreedreno: Fix file descriptor leak.
Vinson Lee [Tue, 8 Sep 2020 00:23:35 +0000 (17:23 -0700)]
freedreno: Fix file descriptor leak.

Fix defects reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_handle: Handle variable fd going out of scope leaks the handle.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be negative.

Fixes: 1ea4ef0d3be8 ("freedreno: slurp in decode tools")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6642>

3 years agopan/mdg: Fix spilling of non-32-bit types
Icecream95 [Wed, 9 Sep 2020 06:22:00 +0000 (18:22 +1200)]
pan/mdg: Fix spilling of non-32-bit types

The source argument for mov has index 1, not 0.

Fixes a vertex shader in SuperTuxKart.

Fixes: b4de9e035ac ("pan/mdg: Mask spills from texture write")
Reported-by: macc24
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>~
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6659>

3 years agonir: More NIR_MAX_VEC_COMPONENTS fixes
Jesse Natalie [Wed, 9 Sep 2020 00:56:54 +0000 (17:56 -0700)]
nir: More NIR_MAX_VEC_COMPONENTS fixes

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6655>

3 years agonir/idiv_const: Use the modern nir_src_as_* constant helpers
Jason Ekstrand [Tue, 8 Sep 2020 23:37:05 +0000 (18:37 -0500)]
nir/idiv_const: Use the modern nir_src_as_* constant helpers

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6655>

3 years agonir: More NIR_MAX_VEC_COMPONENTS fixes
Jason Ekstrand [Tue, 8 Sep 2020 23:36:47 +0000 (18:36 -0500)]
nir: More NIR_MAX_VEC_COMPONENTS fixes

A couple of these probably aren't strictly necessary but they won't
hurt.  The one that's particularly tricky is a fixed-length array in
nir_search.h.  However, to avoid blowing up the binary size of
nir_opt_algebraic by about 2x, we just assert that only small ops are
used.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6655>