Commit Graph

122338 Commits

Author SHA1 Message Date
Hyunjun Ko 19a7a915ca turnip/kgsl: support VK_KHR_performance_query
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Hyunjun Ko 3d90909837 turnip: enable VK_KHR_performance_query with new debug flag
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Hyunjun Ko c921a6e98d turnip: support multipass for performance query.
To support multipass, querying perf counters happens in several steps
below.

0) There's a scratch reg to set pass indices for perf counters query.
   Prepare cmd streams to set each pass index to the reg at device
   creation time. See tu_CreateDevice in tu_device.c
1) Emit command streams to read all requested perf counters at all
   passes in begin/end query with CP_REG_TEST/CP_COND_REG_EXEC, which
   reads the scratch reg where pass index is set.
2) Pick the right cs setting proper pass index to the reg and prepend it
   to the command buffer at each submit time.
3) If the pass index in the reg is true, then executes the command
   stream below CP_COND_REG_EXEC.

Would need to implement for kgsl in the future.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Hyunjun Ko 937dd76426 turnip: Implement VK_KHR_performance_query
There are still some commands unimplemented yet.

- vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR:
  The following patch supports this.

- vkAcquireProfilingLockKHR / vkReleaseProfilingLock
  This patch supports only monitoring perf counters for each submit.
  To reserve/configure counters across submits we would need a kernel
  interface to be able to do that.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Icecream95 a250f3620c panfrost: Fix panfrost_small_padded_vertex_count for 17 vertices
All odd numbers above 10 need to be rounded up to an even number, so
add one and mask off the least significant bit instead of maintaining
a list of special cases.

Fixes crashes in SuperTuxKart.

Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8191>
2020-12-22 01:54:24 +00:00
Icecream95 fdcb03c2d7 panfrost: Expose ARB_texture_filter_anisotropic on supported GPUs
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8149>
2020-12-21 22:49:28 +00:00
Icecream95 48c676c501 panfrost: Add a gpu_revision argument to panfrost_get_quirks
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8149>
2020-12-21 22:49:28 +00:00
Icecream95 0322653b71 panfrost: Set the anisotropy level when cso->max_anisotropy is set
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8149>
2020-12-21 22:49:28 +00:00
Icecream95 601dfd0093 panfrost: Fix the Maximum anisotropy field in the XML
It needs a a minus(1) modifier.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8149>
2020-12-21 22:49:28 +00:00
Alyssa Rosenzweig 9c042b6976 panfrost: Fix LOD mode field on Bifrost
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8149>
2020-12-21 22:49:28 +00:00
Alyssa Rosenzweig 8db0775f45 pan/bi: Minor styling cleanup in disasm
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8139>
2020-12-21 21:54:50 +00:00
Alyssa Rosenzweig 15558873f4 pan/bi: Remove all-0's termination condition
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8139>
2020-12-21 21:54:50 +00:00
Alyssa Rosenzweig b18855a0a1 pan/bi: Space out disassembly
Makes things much more legible with some "room to breathe".

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8139>
2020-12-21 21:54:50 +00:00
Alyssa Rosenzweig 3071f36cfb pan/bi: Allow toggling disassembly verbosity
Verbose mode is especially useful for debugging packing, but otherwise
just gets in the way I find.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8139>
2020-12-21 21:54:50 +00:00
Yevhenii Kolesnikov 5ad54d498c intel/fs: don't spill a register, set by undef
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3941
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8185>
2020-12-21 21:18:01 +00:00
Eric Anholt bb4ade40e4 lvp: Fix vtn warnings about unsupported image read/write without format.
These are just warnings printed to the console and don't affect testcase
pass/fail, but clog up the deqp-runner job logs.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8188>
2020-12-21 20:33:35 +00:00
Bas Nieuwenhuizen 9339ed2f85 radv: Enable DCC in the GENERAL layout on GFX10+.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7004>
2020-12-21 18:32:24 +00:00
Bas Nieuwenhuizen 18ddd48e70 radv: Disable DCC explicitly for incompatible copies.
If we enable DCC for GENERAL we cannot set the layout to GENERAL to
disable DCC, so do it explicitly.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7004>
2020-12-21 18:32:24 +00:00
Bas Nieuwenhuizen f23eaf0db6 radv: Add option to disable DCC in renderpasses without layout.
If DCC is enabled for GENERAL then we cannot disable DCC by going
to the GENERAL layout.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7004>
2020-12-21 18:32:24 +00:00
Bas Nieuwenhuizen 88f392f6f8 radv: Never allow fast clears on DCC images that are not compressed.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7004>
2020-12-21 18:32:24 +00:00
Bas Nieuwenhuizen da36577558 radv: Don't skip layout transitions that only differ in render loop.
This can result in meaningful compression changes so we shouldn't skip.

Fixes: 66131ceb8b "radv: Pass through render loop detection to internal layout decisions."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7004>
2020-12-21 18:32:24 +00:00
Samuel Pitoiset 909e06075d radv: ignore the mutable bit for TC-compatible HTILE
All depth/stencil formats are incompatible each others, so the
mutable bit and the image format list can be ignored.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8126>
2020-12-21 17:46:03 +00:00
cheyang ffe87c2689 glsl: remove unused state variable
Because compile_shader function state variable
not determine whether the compilation is successful.

Signed-off-by: cheyang <cheyang@bytedance.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8178>
2020-12-21 14:49:53 +00:00
Danylo Piliaiev 972e9ca294 freedreno/a6xx: bump varyings limit
GL_MAX_VARYING_COMPONENTS is bumped to 124 since it should
not include the components of gl_Position. (Same as in blob)

GL_MAX_*_OUTPUT_COMPONENTS is bumped to 128, only
GL_MAX_GEOMETRY_INPUT_COMPONENTS is 64. (Same as in blob)

Per GL 3.2 spec the minimum of:
 - GL_MAX_GEOMETRY_OUTPUT_COMPONENTS is 128
 - GL_MAX_FRAGMENT_INPUT_COMPONENTS is 128
 - others is 64

Per ARB_tessellation_shader the minimum of:
 - GL_MAX_TESS_CONTROL_*_COMPONENTS to be 128
 - GL_MAX_TESS_EVALUATION_*_COMPONENTS to be 128

Allows passing of:
 gl-3.2-minmax
 arb_tessellation_shader-minmax

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7917>
2020-12-21 16:25:39 +02:00
Danylo Piliaiev e5499ca2bf freedreno/a6xx: Fix SP_HS_UNKNOWN_A831 value and document it
It appears that storage for varyings in a wave has an upper
limit of wavesize * max_a831 where max_a831 is 64.
Exceeding the limit seam to force gpu to reduce primitives
processed per wave, at least calculations make sense with
such interpretation.

With blob SP_HS_UNKNOWN_A831 never exceeds 64 and setting
it to 65 in freedreno leads to a hang.

On A630 tests (patch_size=3 + gl_Position + array of vec4)
have shown such relation:

| Num of vec4 | A831 | PC_HS_INPUT_SIZE |
|-------------|------|------------------|
| 1           | 0x10 | 0xc              |
| 2           | 0x14 | 0xf              |
| 3           | 0x18 | 0x12             |
| 4           | 0x1c | 0x15             |
| 5           | 0x20 | 0x18             |
| 6           | 0x24 | 0x1b             |
| 7           | 0x28 | 0x1e             |
| 8           | 0x2c | 0x21             |
| 9           | 0x30 | 0x24             |
| 10          | 0x34 | 0x27             |
| 11          | 0x38 | 0x2a             |
| 12          | 0x3c | 0x2d             |
| 13          | 0x3f | 0x30             |
| 14          | 0x40 | 0x33             |
| 15          | 0x3d | 0x36             |
| 16          | 0x3d | 0x39             |
| 17          | 0x40 | 0x3c             |
| 18          | 0x3f | 0x3f             |
| 19          | 0x3e | 0x42             |
| 20          | 0x3d | 0x45             |
| 21          | 0x3f | 0x48             |
| 22          | 0x3d | 0x4b             |
| 23          | 0x40 | 0x4e             |
| 24          | 0x3d | 0x51             |
| 25          | 0x3f | 0x54             |
| 26          | 0x3c | 0x57             |
| 27          | 0x3e | 0x5a             |
| 28          | 0x40 | 0x5d             |
| 29          | 0x3c | 0x60             |
| 30          | 0x3e | 0x63             |
| 31          | 0x40 | 0x66             |
|-------------|------|------------------|

Brief tests with high patch sizes also confirm that formula
matches blob behaviour.

A831 is not a limit for storage available for one thread, so
naming it as SP_HS_WAVE_INPUT_SIZE would make more sense.

Fixes: 47e2c195 "freedreno/a6xx: Program state for tessellation stages"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7917>
2020-12-21 16:25:34 +02:00
Danylo Piliaiev 22180137e9 ir3: Allow tesselation to use all 32 varying slots
POS, PSIZE, CLIP_DIST0, and CLIP_DIST1 have their own predefined
indices, map's size should take this into account.

Fixes: 9e063b01 "ir3: Switch tess lowering to use location"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7917>
2020-12-21 16:06:20 +02:00
Danylo Piliaiev 4b208fa36b freedreno/a6xx: Fix assert which checks the count of shader outputs
The actual max count is 32 which corresponds to 128 output components.

Fixes: 2251a434 "freedreno/a6xx: Write multiple regs for SP_VS_OUT_REG and SP_VS_VPC_DST_REG"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7917>
2020-12-21 16:06:20 +02:00
Tapani Pälli 296d8662dc mesa: fix layered framebuffer attachment target check
Current code was making the layer target checking for depth and stencil
attachments as well while the check in spec is specified only for color.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3980
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8102>
2020-12-21 07:47:44 +00:00
Dave Airlie 448e60314a lavapipe: add transform feedback support
This adds support for EXT_transform_feedback which can be used by
zink to enable more CI

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7981>
2020-12-21 01:12:42 +00:00
Dave Airlie 29955cbbc0 llvmpipe: handle SO statistics multi value query copy. (v2)
This is hard to abstract using the vulkan interface, so just
add support for copying both values in the llvmpipe backend
for the lavapipe frontend.

v2: use a loop

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7981>
2020-12-21 01:12:41 +00:00
Dave Airlie 7f849d1375 llvmpipe: add support for vulkan streamout offset hook
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7981>
2020-12-21 01:12:41 +00:00
Dave Airlie 46734a02fc gallium: add an api to retrieve pipe offsets
This is needed to implement the vulkan transform feedback pause
resume functionality

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7981>
2020-12-21 01:12:41 +00:00
Vinson Lee 3df7c9bf54 d3d12: Fix memory leak if create_root_signature failed.
Fix defect reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable data going out of scope leaks the storage it points to.

Fixes: 2ea15cd661 ("d3d12: introduce d3d12 gallium driver")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8170>
2020-12-20 23:33:20 +00:00
Vinson Lee 1ff5463ff8 d3d12: Fix memory leak if create_gfx_pipeline_state failed.
Fix defect reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable data going out of scope leaks the storage it points to.

Fixes: 2ea15cd661 ("d3d12: introduce d3d12 gallium driver")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8150>
2020-12-20 15:18:03 -08:00
Icecream95 f9ceab7b23 panfrost: Fix CLAMP wrap mode
MALI_WRAP_MODE_CLAMP doesn't work fully on either GPU generation, so
use other wrap modes instead in some cases.

With nearest filtering, Midgard only clamps to the edge for two of the
edges, and uses the border colour for the other two. Using the clamp
mode on Bifrost causes broken rendering and/or GPU faults.

Fixes piglit test "texwrap" on both Midgard and Bifrost, and fixes
Chromium B.S.U. rendering on Bifrost.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8176>
2020-12-20 02:31:39 +00:00
Icecream95 ac265c0a96 panfrost: Fix precise occlusion queries on Bifrost
Bifrost doesn't need the sample count to be divided by four for
non-MSAA framebuffers.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8172>
2020-12-20 01:22:13 +00:00
Vinson Lee b9fccafed6 vc4: Fix typos.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8120>
2020-12-18 13:23:18 -08:00
Samuel Pitoiset 19e96d4566 radv: remove useless push constants data when resolving ds attachments
Depth/stencil resolves are only allowed inside a subpass, which means
the offset is always 0 and the draw/dispatch covers the whole image.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8127>
2020-12-18 17:58:54 +00:00
Caio Marcelo de Oliveira Filho c4c9c780b1 spirv: Remove more dead variables
SPIR-V modules can have multiple shaders (including of the same
stage), but the global variables are all declared for the whole
module.  This can result in variables with same Binding but
incompatible types, so those need to be removed before we use.

Previously, a similar issue but with a narrower scope was fixed by
6775665e5e ("spirv: Eliminate dead input/output variables after
translation.").

This patch depends on the previous patch that prevents variables used
only in pointer initializers to be considered dead.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3686
Fixes: 3a266a18 ("nir/spirv: Add support for declaring variables")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8133>
2020-12-18 17:41:02 +00:00
Caio Marcelo de Oliveira Filho acce4ce04e nir: Consider pointer initializers in nir_remove_dead_variables
Between the creation of a shader (from GLSL or SPIRV frontends) and
nir_lower_variable_initializers is called, variables may refer to
other variables for initialization.  Those referred variables need to
be kept alive, so consider that in the pass.

Fixes: 7acc81056f ("compiler/nir: Add support for variable initialization from a pointer")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8133>
2020-12-18 17:41:02 +00:00
Caio Marcelo de Oliveira Filho 577bfba959 nir: Remove unused parameter in remove_dead_var_writes
And destroy the live set earlier in nir_remove_dead_variables.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8133>
2020-12-18 17:41:02 +00:00
Caio Marcelo de Oliveira Filho 617d8d3788 nir: Fix outdated name in comment
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8133>
2020-12-18 17:41:02 +00:00
Caio Marcelo de Oliveira Filho f65750d221 spirv: Implement OpArrayLength for OpenGL
Uses same NIR intrinsic as glsl_to_nir.  Make it an option so it is
easy later to move Vulkan drivers incrementally to use it.

Fixes piglit test spec/arb_gl_spirv/execution/ssbo/unsized-array-length.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3691
Fixes: 15e43907 ("iris: Enable ARB_gl_spirv and ARB_spirv_extensions")
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8136>
2020-12-18 17:13:46 +00:00
Mike Blumenkrantz e9ab35ad4f zink: fix gl_SampleMaskIn handling
this is an array[1], so we need to do some extra legwork here even though
probably it'd work fine even without it

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7490>
2020-12-18 16:52:44 +00:00
Mike Blumenkrantz 354b2f7f75 zink: fix rp hash table
hash table keys for inserted items have to be valid memory ranges for the
lifetime of the corresponding entry, so using a stack-allocated key like this
is broken and doesn't accurately return the correct renderpass

Fixes a872f4636924: ("zink: cache render-passes")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8011>
2020-12-18 16:45:52 +00:00
Mike Blumenkrantz ec34b3f117 zink: move rp hash functions further up in file
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8011>
2020-12-18 16:45:52 +00:00
Mike Blumenkrantz f9a8d51f46 zink: handle nir_op_find_lsb and nir_op_ifind_msb in ntv
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8153>
2020-12-18 16:34:33 +00:00
Mike Blumenkrantz a83002ceda zink: handle nir_op_ibitfield_extract: in ntv
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8153>
2020-12-18 16:34:33 +00:00
Mike Blumenkrantz 99d890f599 zink: add nir_op_bit_count to ntv
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8153>
2020-12-18 16:34:33 +00:00
Mike Blumenkrantz c768c5297a zink: force stencil format for stencil-only samplers and swizzle the right component
packed buffers will still return the full format when we're using only the
stencil aspect, so we need to explicitly set the format here

also due to 7ca72f1726 we can't use the provided
swizzle for this case and have to force y -> x component swizzle

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7491>
2020-12-18 16:23:01 +00:00
Mike Blumenkrantz ad0037fcfe mesa/st: set lower_point_size for tes/gs during program update
these may not reach the other callsite in st_precompile_shader_variant(),
so we need to ensure that we get psiz if we need it

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5885>
2020-12-18 16:06:05 +00:00
Mike Blumenkrantz 6669d6ff0a mesa/st: flag ST_NEW_CONSTANTS upon running nir_lower_point_size_mov
this reduces to a load_ubo after optimization, so we need to ensure that
the constant data is put in a buffer instead of relying on it happening
coincidentally

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5885>
2020-12-18 16:06:05 +00:00
Mike Blumenkrantz 7eb5fd98fd mesa/st: handle running nir lower passes for ucp and psiz in tess stage
if tess is the last shader program to run then we need to perform these
lowering passes at that time rather than during the vs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5885>
2020-12-18 16:06:05 +00:00
Mike Blumenkrantz db165e9db3 mesa/st: tabs -> spaces in st_program
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5885>
2020-12-18 16:06:05 +00:00
Mike Blumenkrantz 7c302c2def mesa/st: do not run lower_psiz_mov on vertex shader if geometry shader is present
this only needs to be changed on the last stage between the two

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5885>
2020-12-18 16:06:05 +00:00
Mike Blumenkrantz 6a87b61e63 mesa/st: run nir_lower_point_size_mov on geometry shaders based on cap
geometry shaders need to output this variable as well, and the variable
added using the pass on the vertex shader won't be passed through here

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5885>
2020-12-18 16:06:05 +00:00
Samuel Pitoiset 30852b5b49 radv: fix maxFragmentShadingRateRasterizationSamples
It's not a bitfield. This limit is purely informational.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8100>
2020-12-18 14:15:28 +01:00
Samuel Pitoiset c9e1264ec7 radv: adjust the maximum number of coverage samples for VRS
It should actually be 4 because the maximum fragment size supported
by the hardware is 2x2.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8100>
2020-12-18 14:15:25 +01:00
jzielins 2c9bc0d20e swr: Fix crashes on Windows
SWR is missing implementation of pipe_context::flush_resource
function, which is now in the execution path on Windows.
This change adds an empty implementation (flush_resource
is NOOP in SWR) to prevent crashes

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8159>
2020-12-18 11:25:45 +00:00
Rhys Perry 271dd1837a ac/llvm: insert phis before demote kill
LLVM (like NIR) requires phi instructions to be before any other
instructions in the block. ac_branch_exited() can insert non-phi
instructions before visit_block() adds phis, so visit_block() should add
phi instructions before the non-phi instructions ac_branch_exited()
inserts.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Fixes: aa757f4f8c ("ac/llvm: fix demote inside conditional branches")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8054>
2020-12-18 09:56:43 +00:00
Samuel Pitoiset 81a6ee7a9b radv: enable TC-compat HTILE for D32_SFLOAT+MSAA on GFX10+
This was disabled due to some depth/stencil resolve CTS failures
which are now fixed.

I figured that disabling TC-compat HTILE for D32_SFLOAT+MSAA reduced
performance in Control by -11% on Vega10. In fact, the game only uses
D32_SFLOAT for depth rendering.

This gives a huge boost in Control on Navi10 (eg. +17% in MSAA4x).
Note that the game is still slower than PRO without MSAA on Navi10,
but as fast (or even a bit faster) on Vega10.

I think TC-compat HILE could also be enabled for D32_SFLOAT_S8_UINT
but it needs more testing first.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8143>
2020-12-18 07:57:03 +01:00
Samuel Iglesias Gonsálvez 84136d78e6 turnip: fix cube map array image size calculation
imageSize() expects the last component of the return value to be the
number of layers in the texture array. In the case of cube map array,
it will return a ivec3, with the third component being the number of
layer-faces.

Fixes: dEQP-VK.image.image_size.cube_array.*

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8087>
2020-12-18 06:43:07 +01:00
Marek Olšák 8c5c133741 mesa: call Driver.TexParameter in glPopAttrib to fix r100, r200, old nouveau
The glPopAttrib optimizations incorrectly removed it.

Use GL_ALL_ATTRIB_BITS to mean "all texture parameters have changed" to
make it more efficient.

Fixes: d0e18550e2 - mesa: optimize saving/restoring bound textures for glPush/PopAttrib

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
2020-12-18 04:53:44 +00:00
Marek Olšák a6164ab48c mesa: don't restore texture state into unbound textures in glPopAttrib
It was a typo, or thinko, sort of.

Fixes: d0e18550e2 - mesa: optimize saving/restoring bound textures for glPush/PopAttrib

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
2020-12-18 04:53:44 +00:00
Marek Olšák 593dac8028 mesa: overallocate program parameter values
See the comment. This is something I spotted in the code. There is
no known bug caused by this.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
2020-12-18 04:53:44 +00:00
Marek Olšák 884e84035e mesa: remove unused LastUniformIndex
This is now dead code.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
2020-12-18 04:53:44 +00:00
Marek Olšák 23dc21b9d6 mesa: fix assertion paramList->LastUniformIndex < paramList->FirstStateVarIndex
This changes the code so that program parameters no longer have to be
sorted (meaning uniforms and constants are before state variables).

Instead of checking if the parameter is a state variable for every element,
teach all functions to handle non-state parameters safely. This is better
for the most common case where parameters are sorted or semi-sorted.

The new enum STATE_NOT_STATE_VAR identifes that a parameter is not
a state variable.

Fixes: 63f7d7dd - mesa: take advantage of sorted parameters in _mesa_load_state_parameters
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3914

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
2020-12-18 04:53:44 +00:00
Marek Olšák 2c92df435d draw: fix incorrect NIR support code
"state" contains NIR, while "vs->base.state" contains TGSI generated
from NIR. It was a typo.

This fixes the arb_vp subtest of: DRAW_USE_LLVM=1 piglit/bin/rasterpos

Fixes: df11ceaaaf - draw: add NIR support to draw_create_vertex_shader

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
2020-12-18 04:53:44 +00:00
Marek Olšák 311064419d nir_to_tgsi: fix NIR options instead of asserting
Drivers can return any NIR options, but nir_to_tgsi doesn't support
any options because it was written to assume certain options are set.

This fixes a regression caused when st/mesa switched to NIR for passing
shaders to the draw module.

Fixes: 44b7e1497f - st/mesa: don't generate TGSI for the draw VS because it now supports NIR too
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3949
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3965

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
2020-12-18 04:53:44 +00:00
Eric Anholt e4cdbeab81 freedreno/a6xx: Flush depth at the end of bypass rendering, too.
We apparently don't have anything else making sure that it's flushed in
between use as a render target and use as a texture source, so bypass-mode
depth texture sampling could get stale data.

Fixes consistent (as far as I could see) failures in FD_MESA_DEBUG=nogmem
on:

dEQP-GLES31.functional.texture.multisample.samples_*.use_texture_depth_2d
dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_draw

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8146>
2020-12-18 02:22:45 +00:00
Eric Anholt f740af2796 mesa/st: Finalize the texture before BlitFramebuffer from it.
If the texture hasn't yet been validated, the current tex image contents
may have been ignored in favor of the texture's main miptree.  Fixes test
failure on softpipe and intermittent failures on radeonsi in:

https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/428

Cc: mesa-stable
Tested-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8091>
2020-12-18 02:05:40 +00:00
Marcin Ślusarz 5f2166525f util/list: use helper function in list_is_singular
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz a9bcb10ec4 omx: use list_is_linked
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz 240322fad2 r600: use list_is_linked
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz 1d2077c3d6 iris: use list_is_linked
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz aa7b497d9a gallium: use list_is_linked
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz c5ecb59d97 nine: use list_is_linked
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz 55a072cb16 util/list: add list_is_linked
v2: verify node is valid in list_is_linked (Timothy)

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz 8f438f646c iris: remove redundant check
list_del dereferences both next and prev, so if only one of them could
be NULL we would get crashes already.

Should fix "Dereference after null check" reported by Coverity.

Code was added in: 64b73b770b ("iris: Fix bad external BO hash table and zombie list interactions")

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Marcin Ślusarz bec3463977 svga: remove duplicated code
list_del unconditionally sets "next" and "prev" to NULL.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
2020-12-18 01:46:00 +00:00
Daniel Schürmann 8513b12590 nir/opt_if: split ALU from Phi more aggressively
If the only user is a trivial bcsel which in a second step
can be turned into a phi, this conversion is also worth it
even if the previous result is not undefined or constant.
Allows for some more loop unrolling or saves a few instructions.

Totals from 62 (0.04% of 139391) affected shaders (NAVI10):
SGPRs: 4976 -> 4992 (+0.32%)
VGPRs: 4408 -> 4472 (+1.45%); split: -0.45%, +1.91%
CodeSize: 453632 -> 464000 (+2.29%); split: -0.32%, +2.60%
MaxWaves: 527 -> 511 (-3.04%); split: +0.38%, -3.42%
Instrs: 84940 -> 86681 (+2.05%); split: -0.36%, +2.41%
Cycles: 11946844 -> 11783708 (-1.37%); split: -1.40%, +0.04%
VMEM: 9403 -> 10357 (+10.15%); split: +11.59%, -1.45%
SMEM: 3003 -> 3025 (+0.73%); split: +1.07%, -0.33%
VClause: 1756 -> 1997 (+13.72%); split: -0.11%, +13.84%
SClause: 2914 -> 2915 (+0.03%); split: -0.10%, +0.14%
Copies: 6426 -> 6768 (+5.32%); split: -4.14%, +9.46%
Branches: 2105 -> 2102 (-0.14%); split: -1.66%, +1.52%
PreSGPRs: 2921 -> 2909 (-0.41%); split: -0.55%, +0.14%
PreVGPRs: 4151 -> 4179 (+0.67%); split: -0.24%, +0.92%

cc: mesa-stable

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8123>
2020-12-18 01:29:10 +00:00
Pierre Moreau 7192362531 clover/api: Add extended versioning query for OpenCL C
The cl_khr_extended_versioning extension differs from the OpenCL 3.0
version on this specific as it only reports a single supported OpenCL C
version, whereas the OpenCL 3.0 equivalent will report all of them.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7590>
2020-12-18 01:18:00 +00:00
Pierre Moreau b47981304c clover/api: Add extended versioning query for built-in kernels
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7590>
2020-12-18 01:18:00 +00:00
Mike Blumenkrantz 55e2d836f3 zink: enable 64bit pipe caps
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz f779af2d10 zink: set nir options for 64bit handling based on feature presence
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz 30a2eff302 zink: split ubo loading for 64bit types into 2x32bit loads
this loads 2x32 for each 64bit value and then zips it back into 64bit
for storage

Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Erik Faye-Lund 21d89adfb8 zink: more conversion ALUs
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz fb4a2490d8 zink: handle 64bit constant loading in ntv
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz bb326973fc zink: add 64bit glsl basetype handling in ntv
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz 11ff452aa1 zink: change function params and asserts to permit 64bit types in ntv
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz a658e815a4 zink: set 64bit shader caps in ntv
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz 3ab0e6303b zink: add handlers for some bitfield ops in ntv
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Erik Faye-Lund d8ee1fa341 zink: nir_op_b2f64 implementation
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Dave Airlie 98a73027e1 zink: add some 64-bit conversion ALUs
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz 2108e4fa8f zink: support nir_op_f2f32
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Mike Blumenkrantz 536863eeea zink: add handling for 64bit values in spirv_builder
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Jesse Natalie 4a3b42a717 drisw: Prefer hardware-layered sw-winsys drivers over pure sw
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8128>
2020-12-18 00:14:04 +00:00
Jesse Natalie 27ed515c05 drisw: Add fallback logic for choosing a driver to use
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8128>
2020-12-18 00:14:04 +00:00
Rhys Perry 661922f6ac aco: add block to worklist in mark_block_wqm()
Since we're requiring the branch condition to be in WQM, we have to ensure
that the block is in the worklist.

Fixes Trials Fusion hang at 4K and High settings.

fossil-db (Sienna):
Totals from 216 (0.15% of 139391) affected shaders:
SGPRs: 13392 -> 13360 (-0.24%)
CodeSize: 1321184 -> 1318592 (-0.20%)
Instrs: 255310 -> 254662 (-0.25%)
Cycles: 2178360 -> 2174652 (-0.17%)

Affected fossils in fossil-db are dirt4, nier and youngblood.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3863
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8145>
2020-12-17 19:22:55 +00:00
Mike Blumenkrantz 6d7ea0f020 zink: add struct type support for ntv
also interface types since they're the same

Erik Faye-Lund <erik.faye-lund@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8142>
2020-12-17 19:10:41 +00:00
Mike Blumenkrantz 26a955959e zink: ntv formatting
Erik Faye-Lund <erik.faye-lund@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8142>
2020-12-17 19:10:41 +00:00
Mike Blumenkrantz 02fd562e65 zink: handle struct derefs in ntv
Erik Faye-Lund <erik.faye-lund@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8142>
2020-12-17 19:10:41 +00:00
Mike Blumenkrantz d4748913fc zink: add get_storage_class() ntv util
Erik Faye-Lund <erik.faye-lund@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8142>
2020-12-17 19:10:41 +00:00
Mike Blumenkrantz f9bc320c61 zink: be more paranoid about array strides in ntv
arraystride is a required decoration for arrays of scalars, so ensure that
we put in some effort on this for the case where an array doesn't specify
an explicit stride

Erik Faye-Lund <erik.faye-lund@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8142>
2020-12-17 19:10:41 +00:00
Mike Blumenkrantz 2cb9e3b8e1 zink: add nir pass for splitting 64bit vertex attribs which cross slot boundaries
according to spec, dvec3 and dvec4 vertex attribs require 2 slots (locations),
and so the shader loads have to be explicitly split to reflect this

helpfully, gallium already gives us the vertex element state in a split format,
so no other changes are necessary to have this work as expected

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8141>
2020-12-17 18:16:23 +00:00
Mike Blumenkrantz ec65021771 zink: support frem shader op
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8144>
2020-12-17 17:21:23 +00:00
Danylo Piliaiev b34bc3db67 tu: pCounterBuffers can be NULL in vkCmd*TransformFeedbackEXT()
According to the spec:

"pCounterBuffers is an optional array of buffer handles [...]
 If pCounterBuffers is NULL, then transform feedback will start
 capturing vertex data to byte offset zero in all bound transform
 feedback buffers."

"If counterBufferCount is not 0, and pCounterBuffers is not NULL,
 pCounterBuffers must be a valid pointer to an array [...]"

So counterBufferCount could be non-zero with pCounterBuffers
being NULL.

Fixes crash in RenderDoc when inspecting draw call with tesselation
or geometry shader present.

Fixes: 98b0d900 "turnip: rework streamout state and add missing counter buffer read/writes"
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8140>
2020-12-17 16:33:33 +00:00
Danylo Piliaiev 6aec3c9a23 tu: Ignore pTessellationState if there is no tesselation shaders
According to the spec:

"pTessellationState [...] is ignored if the pipeline does not
 include a tessellation control shader stage and tessellation
 evaluation shader stage."

Fixes crash in RenderDoc when inspecting draw call with
geometry shader but without tesselation shaders.

Fixes: eefdca2e "turnip: Parse tess state and support PATCH primtype"
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8140>
2020-12-17 16:33:33 +00:00
Mike Blumenkrantz 4d47b22bf0 glsl/float64: make this compatible with glsl 330
just a minor tweak

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7483>
2020-12-17 15:47:30 +00:00
Samuel Pitoiset 7880faccc5 radv: add missing DB flush after depth/stencil resolve operations
I thought this was a bug in CTS but the Vulkan spec says:

    "VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT specifies write access
     to a color, resolve, or depth/stencil resolve attachment during
     a render pass or via certain subpass load and store operations."

So, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT is used to synchronize
depth/stencil resolve attachments. Yes, it's counterintuitive.

This can't actually be fixed properly for now because RADV performs
the end subpass barrier *before* resolve attachments instead of after.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8138>
2020-12-17 15:19:57 +00:00
Daniel Schürmann b50d3e5760 aco/ra: fix phi operand renaming
In case one operand was renamed and another operand came
from an incomplete phi, it could happen, that the original
name was not restored.

This has no impact on the code, but ensures correct SSA
is maintained during RA.

Cc: mesa-stable
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8109>
2020-12-17 15:00:59 +00:00
Pierre-Eric Pelloux-Prayer 663e06faa6 egl: fix EGL_EXT_protected_content/surface mixup
EGL_EXT_protected_surface introduces EGL_PROTECTED_CONTENT_EXT,
while EGL_EXT_protected_content is about protected context.

When I implemented EGL_EXT_protected_surface I mixed up the 2
names, so this commit fixes it.

Fixes: bd182777c8 ("egl: implement EGL_EXT_protected_surface support")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8122>
2020-12-17 10:05:42 +01:00
Erik Faye-Lund 6526e6d11b lavapipe: implement VK_EXT_index_type_uint8
Since Gallium supports 8 bit indices, this extension is a simple matter
of plumbing a value through, exposing a feature and flipping the switch
for the extension. This lets zink avoid up-converting the index-buffer
before drawing.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8082>
2020-12-17 08:48:16 +00:00
Iago Toral Quiroga 2832cbea7a v3dv: fix BO list for TFU jobs
Instead of checking whether the source and destination are the same,
we should check if the underlying BOs are the same, since we may
be suballocating resources from the same allocation and the kernel
will fail to execute jobs if the BO list has duplicated entries.

Fixes aborts with Unreal Engine due to failed TFU jobs.

Fixes: 30f1fc25ce ('v3dv: implement TFU blits')
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8098>
2020-12-17 09:24:36 +01:00
Iago Toral Quiroga 9f2afe4170 v3dv: fix incorrect slice selection for TFU jobs
Fixes: 30f1fc25ce ('v3dv: implement TFU blits')
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8098>
2020-12-17 09:24:36 +01:00
cheyang e6a66201a7 symbol_table:fix mesa symbol table return scope error
According to the comment of this function,return a non-negative
number for the number of scopes between the current scope and
the scope where a symbol was defined.

Signed-off-by: cheyang <cheyang@bytedance.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8084>
2020-12-17 04:48:27 +00:00
Vinson Lee 193888fd75 glsl: Initialize glsl_type member name.
Fix defect reported by Coverity Scan.

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

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7766>
2020-12-16 19:31:25 -08:00
Michael Forney 434da21a7c meson: add missing dependency on generated git_sha1.h
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8121>
2020-12-17 00:03:22 +00:00
Icecream95 2a627e7a03 pan/decode: Fix "Access to unknown memory" message formatting
The format string was missing a newline.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8130>
2020-12-16 21:47:09 +00:00
Icecream95 1baddfcff6 panfrost: Fix negative LOD bias support on Bifrost
The LOD bias can be negative, so mark it as signed in the XML.

The code in pan_cmdstream.c already calls FIXED_16 with
'allow_negative' set to true, so doesn't need to be adjusted.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8130>
2020-12-16 21:47:09 +00:00
Icecream95 3a2a005404 pan/gen_pack: Fix signed integer packing
Any excess sign-extend bits would spill into adjacent fields, so mask
off anything after the end bit.

Shift from 2 instead of 1, because there needs to be one extra bit in
the mask as 'end' is inclusive.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8130>
2020-12-16 21:47:09 +00:00
Icecream95 e541aa76e2 panfrost: Split up batches with many jobs
If there are too many jobs in a batch, split it. Although the GPU
theoretically supports 65536 jobs in a batch, set the threshold lower
to avoid GPU timeouts.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8130>
2020-12-16 21:47:09 +00:00
Erik Faye-Lund 720a2d8f29 zink: map some more formats
These formats correspond to missing vk_format_to_pipe_format formats, so
let's add support for them as well.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7982>
2020-12-16 20:51:33 +00:00
Erik Faye-Lund 74132b761c zink: add format test
This will help avoid future mistakes when mapping formats.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7982>
2020-12-16 20:51:33 +00:00
Erik Faye-Lund d788a1d6f4 zink: fix format-mapping
These formats are incorrectly mapped, and should be reversed.

Fixes: 8d46e35d16 ("zink: introduce opengl over vulkan")

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7982>
2020-12-16 20:51:33 +00:00
Erik Faye-Lund 123f3d0d64 zink: make zink_format all about raw format-translation
This moves the parts of zink_format.c that also operates on zink_screen
into zink_screen.c. This has the benefit that we can start testing the
enum-translation code separately from the state.

This will make the next commit a bit cleaner.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7982>
2020-12-16 20:51:33 +00:00
Erik Faye-Lund d66df61bf7 zink: convert x8-formats in zink_get_format
This allows us to make zink_pipe_format_to_vk_format a perfectly
roudtripable function.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7982>
2020-12-16 20:51:33 +00:00
Jesse Natalie 2d78e28ba7 d3d12: Flush and wait in flush_frontbuffer
If we have a context, make sure any work on it's done before
reading from the render target. There may even be pending
MSAA resolves that haven't been submitted yet.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie 0507da62c4 gallium/dri: Add D3D12 software driver option
This lets you use GALLIUM_DRIVER=d3d12 to choose the d3d12
backend with a software winsys.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie eb4353838d d3d12: Don't require DXIL for WSL
Always use the experimental shader models feature, which allows
unsigned DXIL to be used, so we don't need a libdxil for WSL.

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie 0b60d6a24d d3d12: Support Linux eventfds for fences
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie ee4c80f77d d3d12: Only support DXGI and GDI APIs on Windows
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie ed286325a0 d3d12: Only play DLL path tricks on Windows
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie dfeb5ecd4a d3d12: Use u_dl instead of Windows DLL APIs
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie 29ccbd9b1e d3d12: Add forward declaration for LUID
This is needed so that the driver can be initialized by
external code without windows.h or winadapter.h.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie 738564a753 d3d12: Scope down wrl includes to just client.h
We only use wrl for ComPtr, and the DirectX-Headers project
only includes client.h and implements.h.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie af2e212c59 d3d12: Use IID_PPV_ARGS instead of __uuidof
We've been inconsistent between IID_PPV_ARGS,
__uuidof(var), and __uuidof(type). Since Linux doesn't
support the latter of these, they need to be changed.
While we're at it, switch all __uuidof to the more terse
IIV_PPV_ARGS option.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie e1e05ad772 d3d12: Include dxguids/dxguids.h in files that need __uuidof
MSVC has an extension for getting IIDs (GUIDs) from types. Other
compilers can support this extension when targeting Windows, but
don't support it when targeting Linux. Instead, winadapter.h
defines __uuidof(var) to uuidof<decltype(var)>. Then dxguids.h
provides inline specialized definitions for the known D3D types.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie da9b6a21f4 d3d12: Include wsl/winadapter.h when not compiling for Windows
The winadapter.h provides typedefs and defines to enable the
D3D/DXCore headers to be included as-is when targeting non-
Windows platforms.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie 8fc2676e47 winsys_handle: Change D3D12 resource handle type to void*
This lets us include it in Linux builds as well, without needing
to pull in IUnknown.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie 4ee55769d6 microsoft/compiler: Pick up new dxcapi.h
This is more up-to-date with what's on GitHub, and more importantly,
it embeds some of the non-Windows support logic in the header, instead
of shelling out to a nonexistent header.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie f673648003 d3d12: Add DXCore screen variation
Not all Windows platforms have DXGI, and neither does WSL.
Instead, we can use the DXCore API for adapter enumeration.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie 50fab5da93 d3d12: Refactor screen to abstract DXGI details
The next commit will add an alternative that can be dropped in instead.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Jesse Natalie bc5f69faee d3d12: Use DirectX-Headers wrap for d3d12.h
This does 2 things for us:
1. Allows us to compile-time depend on any features from new headers,
   instead of having to conditionally compile based on Windows SDK version.
2. Allows us to reference d3d12.h when compiling for non-Windows.

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
2020-12-16 16:25:54 +00:00
Simon Ser c37d8ae82b egl/wayland: add a NULL guard for the authenticate callback
On some platforms, the authenticate callback may be NULL, e.g. on
surfaceless. If a client tries to send a wl_drm.authenticate request
the handler tries to dereference the NULL pointer.

This can be reproduced with libva which unconditionally tries to use
wl_drm.authenticate even with render nodes [1]. Run a compositor with
a surfaceless context, then try to start e.g. mpv to trigger the
segfault.

[1]: https://github.com/intel/libva/pull/476

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7992>
2020-12-16 13:48:48 +00:00
Mike Blumenkrantz a709d99bfd st/mesa: set drawpixels swizzle before creating sampler view
(some) drivers need to have the swizzle set prior to create_sampler_view
being called in order to actually apply it

Fixes: d11fefa961 ("st/mesa: optimize 4-component ubyte glDrawPixels")
Acked-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8107>
2020-12-16 13:25:05 +00:00
Erik Faye-Lund ba74e1be22 zink: fix 8 bit index handling code
index_size is specified in bytes, not bits.

Fixes: f4583b4086 ("zink: move 8bit index handling out of u_primconvert path")

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8081>
2020-12-16 10:43:34 +00:00
Erik Faye-Lund 008bf6ca61 zink: ralloc spirv_shader
This uses ralloc for spirv_shader and it's data-payload, which seems a
bit neater than having to remember to free twice. We can now also easily
piggy back on more sophisticated ralloc usage as well.

No need to use rzalloc here, as we'll write all memory in the struct,
and the struct isn't used as a hashmap key, so padding shouldn't matter.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8049>
2020-12-16 10:37:10 +00:00
Erik Faye-Lund 03ccd3c468 zink: use emit_bitcast helper
We already have this helper, so let's use it. It makes the code
*slightly* shorter and easier to follow IMO.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8049>
2020-12-16 10:37:10 +00:00
Erik Faye-Lund 134df0069f zink: use shader-read-only-optimal for samplers
Using the general layout for samplers can have terrible performance, so
let's use shader-read-only-optimal instead.

This is fairly straight-forward if we use conservative bounds for the
barriers, and assume they are being used in all stages.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7655>
2020-12-16 10:27:52 +00:00
Pierre-Eric Pelloux-Prayer 1a4c4cd110 driconf: add workaround for Enter The Gungeon
Quoting a comment on the bug report:

   I suspect the shader is incorrect.

   When a (conditional) discard is executed then control flow
   becomes non-uniform, meaning that subsequent implicit
   derivatives required for the texture operation are not
   computed correctly.

Using glsl_correct_derivatives_after_discard fixes it. Note
that for radeonsi this requires LLVM master to work properly.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1386
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8005>
2020-12-16 10:52:54 +01:00
Pierre-Eric Pelloux-Prayer 296316b5de st/mesa: disable line stippling if pattern is all 1's
The spec says:
  When disabled, it is as if theline stipple has its default value
(the default value being all 1's)

So treat pattern=0xffff as line stippling = off.

This improves performance in specviewperf13 snx lines tests.
For instance in the last test I get:
  * master: 260 fps, gpu-load: ~92%
  * with this commit: 280 fps, gpu-load: ~72%

(both tested with d60930c017 reverted)

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8105>
2020-12-16 09:33:06 +00:00
Erik Faye-Lund 967ae12931 Revert "st/dri: make sure software color-buffers are linear"
This reverts commit 040a2643c0.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8115>
2020-12-16 09:25:59 +00:00
Erik Faye-Lund 1fd5e7b14e zink: force display-targets to be linear
This is close to a revert of commit
b5b25ee032, but it limits the scope a bit
to avoid needless performance degregation.

In the long run, we should really allow using tiled resources here, and
instead detile while presenting.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8115>
2020-12-16 09:25:59 +00:00
jzielins 87d7568d69 swr: Fix building with LLVM12
Updates SWR code to match recent changes
in StructType and VectorType APIs

Fixes: #3917

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8041>
2020-12-16 10:10:53 +01:00
Marek Olšák 27097ca6b5 radeonsi: improve a comment about an MSAA bug workaround
It doesn't make complete sense to me, but it's copied from the commit
message that made this change.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8022>
2020-12-16 00:43:51 -05:00
Marek Olšák 3b9fb98c4b radeonsi: disable NGG fast launch with indexed triangle strips to fix a hang
This will be added to our TODO list.

Fixes: aaed7a29be - radeonsi: implement GS fast launch for indexed triangle strips

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8022>
2020-12-16 00:43:48 -05:00
Marek Olšák dffc27e5e1 radeonsi: fix small primitive culling with MSAA force-disabled and smoothing
The problem was that the shader constants were based on the framebuffer
sample count and ignored the multisample enable state and the line/polygon
smoothing state, which uses MSAA rasterization that only sets SampleMaskIn
to get the coverage for alpha-blended smoothing (the PS epilog computes
the alpha channel from SampleMaskIn and blending generates the AA results).

- This is a complete rework that adds a new state for NGG cull constants.
- It fixes the same thing for the prim discard compute shader.
- It documents how VS_STATE.SMALL_PRIM_PRECISION is encoded.

It fixes blue corruption in Unigine Heaven with MSAA and Medium details
or better.

Fixes: 7648060dc0 - radeonsi: enable NGG culling by default on gfx10.3 dGPUs

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8022>
2020-12-16 00:43:45 -05:00
Vinson Lee 836b9e1d88 glsl: Fix typos in comments.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7767>
2020-12-16 02:19:56 +00:00
Erico Nunes 001411774d lima: adjust pp and gp max const buffer size
According to the mali driver output, the Mali-400 GP provides space for
304 vec4 uniforms, globals and temporary variables.

The Mali-PP supports a uniform table up to size 32768 total.
However, indirect access to an uniform only supports indices up to 8192
(a 2048 vec4 array). Trying to access beyond that currently causes a pp
job timeout with both lima and the mali driver. To prevent indices
bigger than that in application uniforms, limit to 8192 for now.

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/8079>
2020-12-16 01:04:41 +00:00
jzielins 9ed50cba6e gallium/swr: Fix Windows build
Fixing small mistake in the swr code that caused
compilation issues on Windows

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>

Fixes: 9ac8f8f490
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8117>
2020-12-15 20:39:06 +00:00
Jesse Natalie 0e215ff487 d3d12: Fix incorrect fence timeout calculation
Fixes: 2ea15cd6 ("d3d12: introduce d3d12 gallium driver")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8114>
2020-12-15 20:15:22 +00:00
Eric Anholt 6f52386544 amd: Fix leak in ac_surface_modifier_test.
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt 26198e875a driconf: Fix memory leak in the unit test.
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt 0d23f4e56f glsl/standalone: Fix memory leaks
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt 39dbf47bfe glsl/uniform_initializer_tests: Fix memory leak
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt 49c22c2155 glsl/general_ir_test: Fix leaks.
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt 1d026e2275 disk_cache: Fix memory leaks in the unit test.
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt f6665eb053 freedreno/ir3: Free the compiler at the end of the unit tests.
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt ba8ce62d3c glx/tests: Fix leaks in the unit tests.
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt a3a1a65c09 glx/tests: Remove unused teardown function.
If you called it, it would be full of double frees because deleting some
of the objects cleans up their owned stuff.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt 867e7f7cf4 util/vma: Fix leak of the heap in the unit test.
Needed for unit testing with asan enabled.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt e640a9ca79 util: Fix memory leak in a hash table unit test.
Needed for unit testing with asan enabled.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Eric Anholt 547d11de54 etnaviv, v3d: Fix valgrind include paths.
dep_valgrind gives you -I/usr/include/valgrind (or whatever) so if
valgrind/ wasn't in the search path anyway, these includes would fail.
Found in CI when adding valgrind to the build images.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Tony Wasserka ada9be1ec9 radv,aco: Compile with -Wimplicit-fallthrough when available
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7847>
2020-12-15 18:22:46 +00:00
Tony Wasserka 6ba83d820c aco: Annotate switch fallthroughs
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7847>
2020-12-15 18:22:46 +00:00
Samuel Pitoiset 22790ef3d4 radv: add support for resolving layered depth/stencil images
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8025>
2020-12-15 18:04:39 +00:00
Adam Jackson 0e9c231aef glx/xlib: Build fix
Helgrind support missed a spot.

Fixes: 53f7d539cd ("util: Add helgrind support for simple_mtx")
Acked-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8108>
2020-12-15 17:30:56 +00:00
Adam Jackson 78c7edf962 zink: Simplify MoltenVK support a bit
There's no harm in checking for the extension on non-macOS, just do it.
Nor can I see any point in checking for both the layer and the
extension, since you're never going to see the extension if the layer
isn't available, so just check for the extension instead of the reduced
boolean. Simplify some variable naming while we're at it.

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Adam Jackson 0781808935 zink: Factor out zink_create_logical_device
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Adam Jackson aa93673d9d zink: Factor out zink_get_loader_version()
This result isn't actually used within zink_create_instance, so don't do
it there.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Adam Jackson 5f7a8f6fc1 zink: Factor out winsys awareness from zink_internal_create_screen
Magic parameters are gross, this makes zink_internal_create_screen a bit
more reusable.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Adam Jackson a2f1354bdc zink: Fix indentation in zink_create_instance
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Erik Faye-Lund c314893988 gallium/util: add bitcast helpers for double and uint
This complements u_bitcast_f2u and u_bitcast_u2f with similar helpers
to cast between double and unsigned integers as well.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8034>
2020-12-15 15:12:41 +00:00
Erik Faye-Lund 615c4610bb gallium/util: make bitcast-helpers explicitly sized
These always work on 32-bit variables, so let's make that assumption
explicit.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8034>
2020-12-15 15:12:41 +00:00
Lucas Stach 0ba788d73b etnaviv: tex_state: fix miplevel selection
Fixes the piglit tex-miplevel-selection test by:
1. properly taking texture baselevel and maxlevel into account
2. only enable lodbias when mipmapping is enabled

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7634>
2020-12-15 15:43:23 +01:00
Lionel Landwerlin d21cc94201 gallium/dri2: Don't forget protected content flag
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: bd182777c8 ("egl: implement EGL_EXT_protected_surface support")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8094>
2020-12-15 10:10:17 +00:00
Robin Ole Heinemann df76963a5c anv: Add DRM_RDWR flag in anv_gem_handle_to_fd
The DRM_RDWR flag is needed for mmap with PROT_WRITE to work.

Cc: mesa-stable
Signed-off-by: Robin Ole Heinemann <robin.ole.heinemann@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8075>
2020-12-15 08:20:34 +00:00
Lionel Landwerlin 94687ee59f vulkan/overlay: add new options to display device/swapchain-format
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3973
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8080>
2020-12-15 08:05:38 +00:00
Lionel Landwerlin af9481cb89 vulkan/overlay: don't display frame numbers unless required
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3972
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8080>
2020-12-15 08:05:38 +00:00
David Stevens a2fb87eea6 egl/android: implement image cleanup callback
According to ANDROID_get_native_client_buffer, EGL implementations must
guarantee that the lifetime of an EGLClientBuffer returned by
eglGetNativeClientBufferANDROID is at least as long as that of the
EGLImage which is bound to. Do this by acquiring a reference to the
underlying AHardwareBuffer for all ANativeWindowBuffers which are bound
to an _EGLImage.

Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7805>
2020-12-15 06:05:27 +00:00
David Stevens a1cf065e0a i965: plumb loader image cleanup callback
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7805>
2020-12-15 06:05:27 +00:00
David Stevens d7814d6e0c frontend/dri: plumb loader image cleanup callback
Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7805>
2020-12-15 06:05:27 +00:00
David Stevens 80a028d830 egl/android: don't pass loaderPriv in get_front_bo
This is a noop, as no loader extensions pass a __DRIimage's
loader_private data back to the loader.

Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7805>
2020-12-15 06:05:27 +00:00
Vinson Lee c0f2a19aee zink: Fix typos.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8071>
2020-12-14 20:13:47 -08:00
Jesse Natalie 9ac8f8f490 gallium: Add optional pipe_context to flush_frontbuffer
It's hooked up in all the pipe wrapper drivers, and all the
frontends except a couple places in glx/xlib.

This enables a more efficient path for drivers which use
swrast's Present, but hardware rendering (e.g. d3d12, zink).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8045>
2020-12-14 23:31:37 +00:00
Rhys Perry 23488c3515 aco: allow divergent mbcnt_amd masks
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8085>
2020-12-14 20:35:21 +00:00
Rhys Perry feee375db9 aco: fix mbcnt_amd with wave32
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8085>
2020-12-14 20:35:21 +00:00
James Park 2ffae5a439 xmlconfig: Disable WITH_XMLCONFIG on Windows
This change was stomped by recent refactor.

Fixes: 1618bd1bee ("xmlconfig: Add unit tests for recent bugs in the driconf rewrite.")
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7975>
2020-12-14 17:28:04 +00:00
Andrii Simiklit a7fb3954a1 glx: fix spelling issues
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7965>
2020-12-14 16:57:00 +00:00