Commit Graph

117224 Commits

Author SHA1 Message Date
Eric Anholt 51acfe2230 freedreno/ir3: Simpify the immediates from an array of vec4 to array of dwords.
We usually had to split the idx/swiz out of the dword index anyway.  Note
that incidentally, immediates_size now increments in vec4s instad of
4*vec4s.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5990>
2020-08-05 23:06:55 +00:00
Eric Anholt e873c4da08 freedreno/ir3: Merge the redundant immediate_idx/immediates_count fields
I got tripped up again with the index vs count vs size fields and I'd
rather we didn't store the redundant info.  Settle on immediates_count as
"how many dwords of immediates we have"

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5990>
2020-08-05 23:06:55 +00:00
Rob Clark 5e922fbc16 glsl_to_nir: fix bitfield_extract with 16-bit operands
These are defined to explicitly take 32b values.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Marek Olšák 92f5e94a93 glsl: improve precision determination for calls
Don't leave the precision as NONE for non-lowerable calls. Set it to HIGH
if a function really returns highp.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Marek Olšák 282a1e6288 glsl: don't lower to mediump for desktop OpenGL
Desktop OpenGL ignores all precision qualifiers.

Also, the lowering pass doesn't work if precision qualifiers are not set,
which is only possible with desktop OpenGL, causing random behavior.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Marek Olšák 01e0085637 glsl: don't create conversion opcodes for array types
Instead, convert all elements one by one.
This fixes piglit shaders@glsl-bug-110796.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Marek Olšák 5020403c70 glsl: don't lower atomic functions to mediump
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Rob Clark 93076f60d3 glsl: don't inline intrinsics for mediump
They have an empty fxn body, trying to handle them results in the
intrinsic call being expanded into a no-op.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Marek Olšák 48a6255186 glsl: fix constant expression evaluation for 16-bit types
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Marek Olšák f2d5f4851a glsl: lower_precision - fix assertion failure with dereferences of constants
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6073>
2020-08-05 22:04:47 +00:00
Rob Clark a4c4e0103a glsl: remove LowerPrecisionTemporaries
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6189>
2020-08-05 21:00:44 +00:00
Rob Clark c4e0cae90c gallium: replace 16BIT_TEMPS cap with 16BIT_CONSTS
All drivers that support mediump lowering should support 16BIT_TEMPS,
but some do not also want 16b consts to be lowered.  Replace the pipe
cap in preperation to remove LowerPrecisionTemporaries.

Note: also updates reference checksums for the arm64_a630_traces job,
due to lowering more to 16b

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6189>
2020-08-05 21:00:44 +00:00
Rob Clark 0a763c0c86 glsl/lower_precision: split out const lowering
Some hw can narrow 32b const/uniform to 16b on load.. and in particular
lowering constants to 16b would break const->uniform lowering.  Allow
them to lower temps to 16b, while skipping consts.

Initially it is set to the same value as LowerPrecisionTemporaries, to
preserve the current behavior.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6189>
2020-08-05 21:00:44 +00:00
Rob Clark 4f060549be freedreno/ir3: lower local_index using local_id
Somehow this works ok with the full compiler stack, but not in
ir3_cmdline.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6189>
2020-08-05 21:00:44 +00:00
Rob Clark e0947903fc freedreno/ir3: ir3_cmdline updates
1) convert to getopt, and drop most variant related options since
   they aren't super-useful these days.. and easy enough to add
   back if/when needed.  (Also, none of the newer shader variant
   options where covered before.)
2) covert to dynamically allocated shader/variant, to get things
   working again after ir3_shader/_variant converted to ralloc
3) few small cleanups

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6189>
2020-08-05 21:00:44 +00:00
Marek Olšák 283ad85944 radeonsi: call nir_split_array_vars/shrink_vec_array_vars/opt_find_array_copies
Loosely based on RADV and https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5668

54793 shaders in 33659 tests
Totals:
SGPRS: 2739498 -> 2739474 (-0.00 %)
VGPRS: 1534120 -> 1534256 (0.01 %)
Spilled SGPRs: 2579 -> 2579 (0.00 %)
Spilled VGPRs: 29 -> 29 (0.00 %)
Private memory VGPRs: 2176 -> 256 (-88.24 %)
Scratch size: 2220 -> 288 (-87.03 %) dwords per thread
Code Size: 55572924 -> 55584592 (0.02 %) bytes
LDS: 92 -> 92 (0.00 %) blocks
Max Waves: 966044 -> 966021 (-0.00 %)
Wait states: 0 -> 0 (0.00 %)

Totals from affected shaders:
SGPRS: 7272 -> 7248 (-0.33 %)
VGPRS: 4848 -> 4984 (2.81 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 2176 -> 256 (-88.24 %)
Scratch size: 2188 -> 256 (-88.30 %) dwords per thread
Code Size: 336332 -> 348000 (3.47 %) bytes
LDS: 18 -> 18 (0.00 %) blocks
Max Waves: 2659 -> 2636 (-0.86 %)
Wait states: 0 -> 0 (0.00 %)

|   PERCENTAGE DELTAS    |  Shaders |    SGPRs |    VGPRs |SpillSGPR |SpillVGPR | PrivVGPR |  Scratch | CodeSize | MaxWaves |    Waits |
|------------------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| 0ad                    |         6|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| alien_isolation        |      2936|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| anholt                 |        10|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| antichamber            |       180|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| batman_arkham_origins  |       589|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| bioshock-infinite      |      1769|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| borderlands2           |      3968|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| borderlands_presequel  |      1326|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| brutal-legend          |       338|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| chromeos               |        86|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| chromium               |         2|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| civilization_beyond..  |       116|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| company_of_heroes2     |       240|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| counter_strike_glob..  |      1142|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| deadcore               |        76|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| deus_ex_mankind_div..  |      1410|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| dirt-showdown          |       533|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| dirt_rally             |       364|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| divinity               |      1052|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| dolphin                |        22|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| dota2                  |      1747|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| europa_universalis_4   |        76|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| f1-2015                |       775|    0.02 %|    0.12 %|    .     |    .     | -100.00 %| -100.00 %|    0.19 %|   -0.04 %|    .     |
| furmark-0.7.0          |         4|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| gimark-0.7.0           |        10|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| glamor                 |        16|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| glmark                 |        96|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| grid_autosport         |      1767|   -0.03 %|    0.17 %|    .     |    .     |  -85.52 %|  -84.44 %|    0.40 %|   -0.03 %|    .     |
| hitman                 |      1413|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| humus-celshading       |         4|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| humus-domino           |         6|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| humus-dynamicbranching |        24|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| humus-hdr              |        10|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| humus-portals          |         2|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| humus-volumetricfog..  |         6|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| left_4_dead_2          |      1762|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| legend_of_grimrock     |       100|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| life_is_strange        |      1296|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| mad_max                |       358|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| many-spheres           |         6|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| metro_2033_redux       |      2670|    .     |    0.02 %|    .     |    .     |    .     |    .     |    .     |   -0.02 %|    .     |
| nexuiz                 |        80|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| payday2                |      1362|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| pixmark-julia-fp32     |         2|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| pixmark-julia-fp64     |         2|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| pixmark-piano-0.7.0    |         2|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| pixmark-volplosion-..  |         2|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| plot3d-0.7.0           |         8|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| portal                 |       474|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| reflections_subway     |        98|    .     |    .     |    .     |    .     |    .     |    .     |    0.02 %|    .     |    .     |
| rocket_league          |       494|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| saints_row_iv          |      1704|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| saints_row_the_third   |       671|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| sauerbraten            |         7|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| scifi_hallway          |        98|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| serious_sam_3_bfe      |       392|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| shadow_of_mordor       |      1410|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| shadow_warrior         |      3956|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| skia                   |      6094|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| sun_temple             |       109|    .     |    .     |    .     |    .     |    .     |    .     |    0.01 %|    .     |    .     |
| supertuxkart           |         4|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| talos_principle        |       324|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| team_fortress_2        |       808|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| tesseract              |       430|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| tessmark-0.7.0         |         6|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| thea                   |       172|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| tomb_raider            |      1448|   -0.02 %|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| total_war_warhammer    |       242|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| ubershaders            |        54|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| ue4_effects_cave       |       290|    .     |    .     |    .     |    .     |    .     |    .     |    0.02 %|    .     |    .     |
| ue4_elemental          |       561|    .     |    .     |    .     |    .     |    .     |    .     |    0.02 %|    .     |    .     |
| ue4_lightroom_inter..  |        64|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| ue4_realistic_rende..  |        86|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| unigine_heaven         |       322|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| unigine_sanctuary      |       264|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| unigine_tropics        |       210|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| unigine_valley         |       278|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| unity                  |        72|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| victor_vran            |      1262|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| warsow                 |       176|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| warzone2100            |         4|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| wasteland2             |        76|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| wavelet-volume         |         4|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| witcher2               |      1040|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| xcom_enemy_within      |      1236|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
| yofrankie              |        82|    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |    .     |
|------------------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| All affected           |       157|   -0.33 %|    2.81 %|    .     |    .     |  -88.24 %|  -88.30 %|    3.47 %|   -0.86 %|    .     |
|------------------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|
| Total                  |     54793|    .     |    .     |    .     |    .     |  -88.24 %|  -87.03 %|    0.02 %|    .     |    .     |

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5750>
2020-08-05 20:41:07 +00:00
Marek Olšák 47beee2eb3 radeonsi: reorder NIR optimizations
Based on https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5668

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5750>
2020-08-05 20:41:07 +00:00
Pierre-Eric Pelloux-Prayer 0294eaed80 radeonsi: extend workaround for KHR-GL45.texture_view.view_classes on gfx9
This is a followup of 19db1a540c.
This commit fixed KHR-GL45.texture_view.view_classes on gfx9 but the test
still failed when using AMD_DEBUG=nodma or AMD_DEBUG=nodcc,nodma.

The workaround is now used from si_resource_copy_region so it covers the
previous call site (si_texture_transfer_map) and the sctx->dma_copy
fallback code.

Fixes: 19db1a540c ("radeonsi: add a workaround to fix KHR-GL45.texture_view.view_classes on gfx9")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6115>
2020-08-05 19:45:32 +00:00
Indrajit Kumar Das caa98246a0 st/mesa: optimize DEPTH_STENCIL copies using fragment shader
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6088>
2020-08-05 19:25:14 +00:00
Rob Clark 141b295311 freedreno: allow fence_fd fences to be recycled
This allows us to avoid a no-op flush if there has been no rendering,
but we hit pctx->flush(PIPE_FLUSH_FENCE_FD).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6177>
2020-08-05 19:05:29 +00:00
Marek Olšák 07a49bf597 radeonsi: disable SDMA on gfx9
Fixes: 9680a75489 "radeonsi/gfx9: enable SDMA buffer copying & clearing"
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4895>
2020-08-05 18:48:35 +00:00
Kristian H. Kristensen db504c464f radv/android: Remove unused variable
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:07 +00:00
Kristian H. Kristensen a7fe711a30 vulkan: Allow global symbol HMI for Android
Android looks for this symbol when loading HAL modules.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:07 +00:00
Kristian H. Kristensen 6b3f56f099 anv: Add stub for anv_gem_get_tiling() for Android
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:07 +00:00
Kristian H. Kristensen ff0dbf2096 anv: Pass device to setup_gralloc0_usage for error reporting
Otherwise it doesn't compile.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: aba57b11ee ("anv: support GetSwapchainGrallocUsage2ANDROID for Android")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:07 +00:00
Kristian H. Kristensen e05e60b230 turnip: Make tu_android.c compile again
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:07 +00:00
Kristian H. Kristensen a725899c3f mapi: Mark TLS symbols as optional in glapi-symbols.txt
Presence of these depends on whether or not we're using ELF TLS.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:07 +00:00
Kristian H. Kristensen 932f51d593 ci: Include enough Android headers to let us compile test EGL
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:07 +00:00
Kristian H. Kristensen 5ae7098eba gallium/android: Rewrite backtrace helper for android
The previous implementation kept a hashtable of a Backtrace object per
thread.  debug_backtrace_capture is supposed to store a backtrace in
the passed in debug_stack_frame array, but instead overwrote the
per-thread Backtrace object.

This new version works more like the libunwind based capture. We hash
the file and symbol names and store pointers in the debug_stack_frame
struct.  This way debug_backtrace_capture doesn't overwrite previous
captures or allocate memory that needs to be freed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:06 +00:00
Kristian H. Kristensen d0d14f3f64 util: Add unit test for stack backtrace caputure
First test never fails, but exercises the code and is useful for
manual inspection.  Second test exposes the android implementation
bug.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:06 +00:00
Kristian H. Kristensen 848e7b947d util: Move stack debug functions to src/util
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:06 +00:00
Kristian H. Kristensen e487043fd0 gallium: Switch u_debug_stack/symbol.c to util/hash_table.h
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:06 +00:00
Kristian H. Kristensen e1a58ae7c4 mapi/test: Change type to unsigned for offset
Quiets this warning:

../../master/src/mapi/glapi/tests/check_table.cpp:576:20: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
   { "glColor3dv", _O(Color3dv) },
                   ^~~~~~~~~~~~

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:06 +00:00
Kristian H. Kristensen c8749305f2 egl/android: Remove unused variable
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
2020-08-05 18:08:06 +00:00
James Park 24b80f8bb9 amd/llvm: Reorder LLVM headers
LLVM uses __declspec(restrict) which breaks because Mesa define restrict
as __restrict. Move the LLVM headerse up to dodge the macro.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6180>
2020-08-05 17:15:18 +00:00
Samuel Pitoiset 8fab7d738e radv: set BYPASS_VTX_RATE_COMBINER_GFX103 on GFX 10.3
Based on RadeonSI.

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/6168>
2020-08-05 12:57:50 +02:00
Samuel Pitoiset 05b09d6549 radv: fix sample shading on GFX 10.3
Based on RadeonSI.

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/6168>
2020-08-05 12:57:48 +02:00
Samuel Pitoiset 8b3682310c radv: increase minimum NGG vertex count requirement per workgroup on GFX 10.3
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/6168>
2020-08-05 12:57:46 +02:00
Samuel Pitoiset 22c8079829 radv: do not honor a user-specified pitch on GFX 10.3
According to RadeonSI, it breaks mipmapping.

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/6168>
2020-08-05 12:57:44 +02:00
Alejandro Piñeiro 7f25f1f106 nir/lower_tex: handle query lod with nir_lower_tex_packing_16 at lower_tex_packing
packing_16 with floats assumed 1 (shadow) or 4 components. But query
lod operations return 2.

Fixes the following test with v3dv:
dEQP-VK.ycbcr.query.lod.fragment.r8g8b8a8_unorm

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5863>
2020-08-05 10:10:12 +00:00
Rhys Perry 6e2e77557e radv/llvm: enable VK_KHR_memory_model
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/6063>
2020-08-05 09:45:54 +00:00
Rhys Perry 4f3630b36a ac/nir: fix coherent global loads/stores
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/6063>
2020-08-05 09:45:54 +00:00
Rhys Perry 4640e7da04 ac/nir: consider an image load/store intrinsic's access
ACCESS_COHERENT may be set for a specific load/store in the case of
atomic loads/stores.

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/6063>
2020-08-05 09:45:54 +00:00
Rhys Perry da38e99eda radv/aco: enable VK_KHR_memory_model
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/6063>
2020-08-05 09:45:54 +00:00
Rhys Perry 389c95a889 spirv: set ACCESS_COHERENT for ssbo/global/image atomic load/store
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/6063>
2020-08-05 09:45:54 +00:00
Iago Toral Quiroga 71572ebb32 nir/lower_tex: skip lower_tex_packing for the texture samples query
Similar to other skips for texture queries that don't actually sample
the texture and which results are not packed.

We can't use nir_tex_instr_is_query() here to skip the lowering for all
queries since that causes regressions in Piglit. Apparently, we do want
to lower some of the query results. In particularly, the LOD query.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6169>
2020-08-05 08:39:52 +02:00
Eric Anholt 1938e2596f freedreno/computerator: Set SP_MODE_CONTROL to the same value as vulkan/GL
This gets us consistent hcN access with our drivers, for experimenting.
We don't know what the other bit does yet, but let's not have to debug
that later.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>
2020-08-05 04:35:05 +00:00
Eric Anholt c92ae9d3ef freedreno/a6xx: Document the bit for the magic 32bit-uniforms-as-16b mode.
Trying to figure out how uniforms were working, I found that computerator
had different behavior from our GL fragment shaders.  Given that 3xx had
an SP_ bit for this (thanks flto@ for the note), it was a matter of
pasting bits of SP_* setup into computerator until I got the GL behavior.
I named it the same as the a3xx register.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>
2020-08-05 04:35:05 +00:00
Eric Anholt db25c18f33 freedreno/ir3: Fix the type of half-float indirect uniform loads.
We would be making a MOV from a u32, when we should be loading from a
16-bit value.  This likely didn't bite us because we only do mediump in FS
and CS so far, and indirect uniforms are usually in a VS (and usually
highp).

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>
2020-08-05 04:35:05 +00:00
Eric Anholt 13b3c401a4 nir: Print the constant data size associated with a shader.
We should probably dump the constants, too, but this is useful to me for
now.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>
2020-08-05 04:35:05 +00:00
Eric Anholt 041bae28c6 nir: Add a little more docs about NIR's constant_data.
I think everyone trips over "how does this relate to nir_const", and I was
curious if I could redefine the units of the constant_data_size / indirect
offsets.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>
2020-08-05 04:35:05 +00:00
Eric Anholt 2e833b16bc nir/lower_amul: Use num_ubos/ssbos instead of recomputing it.
Now that num_ubos is correctly maintained, we can just trust it.  Fixes an
assertion failure in freedreno I triggered on
dEQP-GLES31.functional.ubo.random.all_per_block_buffers.1 for reasons I
don't really understand.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6179>
2020-08-05 04:35:05 +00:00
Kristian H. Kristensen add2b44ab6 turnip: Only include msm_drm in tu_drm.c
We copy the definition for struct drm_msm_gem_submit_bo and flags to
keep the bo list code working for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5999>
2020-08-05 01:19:22 +00:00
Kristian H. Kristensen 4b9c0cd821 turnip: Move remaining drm code to tu_drm.c
This moves the semaphore implementation and tu_QueueSubmit to
tu_drm.c, such that that's the only file including xf86drm.h and
msm_drm.h.  This way, the entire kernel interface is contained in
tu_drm.c

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5999>
2020-08-05 01:19:22 +00:00
Kristian H. Kristensen 7dfeae1a45 turnip: Collapse some tu_drm wrappers
These are all internal to tu_drm.c, we can skip a couple of
abstraction layers now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5999>
2020-08-05 01:19:22 +00:00
Kristian H. Kristensen 59e5f95bdc turnip: Move tu_bo functions to tu_drm.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5999>
2020-08-05 01:19:22 +00:00
Kristian H. Kristensen 270599cc1e turnip: Move device enumeration and feature discovery to tu_drm.c
These steps are all drm specific.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5999>
2020-08-05 01:19:22 +00:00
Iván Briano d33f46e08b anv: fix allocation of custom border color pool
Turns out that respecting the order of parameters is important.

Reported-by: Michael Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Fixes: 5425968d2e ("anv: Implement VK_EXT_custom_border_color")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6175>
2020-08-04 15:30:33 -07:00
Rhys Perry fea3e498c3 aco: replace MADs in isel with FMA on GFX10.3
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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry 41c901b7df aco: disable SMEM stores on GFX10.3
These are removed in GFX10.3

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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry b811b1d083 aco: update aco_opcodes.py for GFX10.3
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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry 07250a92da aco: implement subgroup shader_clock on GFX10.3
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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry a5303a3cbe aco: update vgpr_alloc_granule for GFX10.3
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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry 37988b5b8e aco: fix max_waves_per_simd on Polaris, VegaM and GFX10.3
fossil-db (Polaris):
Totals from 20263 (14.75% of 137414) affected shaders:
SGPRs: 871407 -> 871679 (+0.03%); split: -0.00%, +0.03%
VGPRs: 513828 -> 550028 (+7.05%); split: -1.68%, +8.72%
CodeSize: 18869680 -> 18828148 (-0.22%); split: -0.23%, +0.01%
MaxWaves: 162012 -> 162030 (+0.01%); split: +0.01%, -0.00%
Instrs: 3629172 -> 3618817 (-0.29%); split: -0.30%, +0.02%
Cycles: 15682244 -> 15638244 (-0.28%); split: -0.30%, +0.02%
VMEM: 10675942 -> 10673344 (-0.02%); split: +0.18%, -0.21%
SMEM: 1209717 -> 1206088 (-0.30%); split: +0.03%, -0.33%
VClause: 81780 -> 81227 (-0.68%); split: -0.73%, +0.06%
SClause: 231724 -> 231561 (-0.07%); split: -0.07%, +0.00%
Copies: 187126 -> 180831 (-3.36%); split: -3.62%, +0.26%
Branches: 26841 -> 26837 (-0.01%); split: -0.03%, +0.01%

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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry c68fba9bba aco: update bug workarounds for GFX10_3
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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry 4f1242a4d8 aco: don't create v_mad_f32 on GFX10.3
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/5546>
2020-08-04 20:39:33 +01:00
Rhys Perry 5718f7c8a7 aco: fix waitcnt insertion on GFX10.3
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/5546>
2020-08-04 20:39:32 +01:00
Alyssa Rosenzweig b75427cc31 panfrost: Implement EXT_multisampled_render_to_texture
Significantly helps WebGL performance with Chromium's OpenGL ES backend.
Also update docs/features.txt

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6161>
2020-08-04 18:39:24 +00:00
Alyssa Rosenzweig 2c47993b69 panfrost: Add MSAA mode selection field
This field enables MSAA, either writing samples to separate surfaces, to
a single large-bpp surface, or implicitly resolved and to a single
surface.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6161>
2020-08-04 18:39:24 +00:00
Samuel Pitoiset 0c569e22d1 radv: print warnings for famous RADV_PERFTEST options that no longer exist
RADV_PERFTEST=aco no longer exists, ACO is the default compiler.
RADV_PERFTEST=llvm is deprecated, use RADV_DEBUG=llvm instead.

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/5662>
2020-08-04 19:09:57 +02:00
SureshGuttula 65d23e7fb1 radeon/vcn: Corrected vp9 ref associated data incase of target->codec is NULL
This patch fixes the case where less number of reference surfaces created and destoyed
on need basis. The problem comes when we are refereing old assoiciated data for newly
created target buffer with same address. Here old target buffer destroyed as that
surface is no more used as reference for next frames and when we create a new surface
for the next frame to process we will get the surfaceid and same target address
of destroyed surface.

When new surface/surface->buffer/target ,target->codec is null as we cleared when we
destroy this surface, but per ref_mapping logic, it was taking null associated data
i.e.0 as curr_ref_idx. Hence total reference mapping table goes wrong with wrong data.
Beacuse of this, we have seen corrupted vp9 decoded frames.

Signed-off-by: SureshGuttula <suresh.guttula@amd.corp-partner.google.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5452>
2020-08-04 17:01:20 +00:00
Caio Marcelo de Oliveira Filho b98dd70489 spirv: Propagate explicit layout only in types that need it
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5511>
2020-08-04 07:53:37 -07:00
Roman Stratiienko 9a9b35a3bb lima: Fix lima_screen_query_dmabuf_modifiers()
Incorrect implementation has been found during code surfing.
v3d implementation used for reference.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Icenowy Zheng <icenowy@aosc.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6076>
2020-08-04 13:58:33 +00:00
Connor Abbott ee2c58dde4 tu: Implement VK_EXT_conditional_rendering
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6009>
2020-08-04 15:38:17 +02:00
Connor Abbott f226b198f5 tu: Reset has_tess after renderpass
Don't force sysmem for render passes after the one that uses
tessellation.

Also, move this into tu_cmd_state as that's where it belongs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6009>
2020-08-04 15:37:51 +02:00
Connor Abbott 06332ef60e freedreno: Document draw predication packets
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6009>
2020-08-04 15:37:51 +02:00
Connor Abbott 9e48e31fa5 tu: Fix DST_INCOHERENT_FLUSH copy/paste error
This was meant to handle incoherent accesses by always flushing them,
but it accidentally checked for the coherent variant instead. As a
result e.g. a vkCmdClearImage() followed by a renderpass using the image
didn't get any flushes, resulting in the same sort of corruption seen
with sysmem renderpass clears. This happened to be exposed via some
tests that used multiview.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6009>
2020-08-04 15:37:51 +02:00
Jonathan Marek 95db96d75b turnip: implement VK_EXT_4444_formats
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6164>
2020-08-04 13:15:23 +00:00
Jonathan Marek 036ff53143 util/format: translate A4R4G4B4_UNORM and A4B4G4R4_UNORM vulkan formats
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6164>
2020-08-04 13:15:23 +00:00
Jonathan Marek 35f8f355f3 turnip: rework extended formats to allow more extended formats
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6164>
2020-08-04 13:15:23 +00:00
Jonathan Marek 67b1163f9f turnip: add support for D32_SFLOAT_S8_UINT
Add support for D32_SFLOAT_S8_UINT, which requires special handling because
it is actually two images.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5537>
2020-08-04 11:40:18 +00:00
Jason Ekstrand 4816f6f8d8 spirv: Do more complex unwrapping in get_nir_type
The OpenGL flavor of SPIR-V allows for samplers inside structs.  This
means that our simple array-of-array handling isn't sufficient and we
need something substantially more complex for generating NIR types.

Fixes: 14a12b771d "spirv: Rework our handling of images and samplers"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6065>
2020-08-04 03:05:34 +00:00
Jason Ekstrand 140a5492e0 compiler/types: Add a struct_type_is_packed wrapper
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6065>
2020-08-04 03:05:34 +00:00
Eric Anholt 66d8bbd822 freedreno: Fix "Offset of packed bitfield changed" warnings:
Example:

../src/freedreno/ir2/instr-a2xx.h:384:1: note: offset of packed bit-field
‘const_index’ has changed in GCC 4.4
  384 | } instr_fetch_vtx_t;

It's apparently due to bitfields that would cross the width of their type.
Just expand the types of the affected fields so that the compiler quiets
down.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6165>
2020-08-03 23:28:49 +00:00
Jonathan Marek ba6cdb275c turnip: delete tu_clear_sysmem_attachments_2d
2D path is using the same hardware as the 3D path, with the advantage of
separate register state, but here it requires WFI and extra cache flushing
and invalidating, so it should be better to just use the 3D path. There are
also some cases where the 3D path would be much faster, since it can clear
multiple attachments at once.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5775>
2020-08-03 22:38:22 +00:00
Jonathan Marek 9b6486bd3d turnip: fix sysmem CmdClearAttachments 3D fallback breaking GMEM path flush
It was clearing the flush bits, which are used by both GMEM/SYSMEM paths,
but emitting the flushes inside the cond_exec, where they would only run
for the sysmem path.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5775>
2020-08-03 22:38:22 +00:00
Jason Ekstrand 611f654fcf nir/deref: Don't try to compare derefs containing casts
One day, we may want copy_prop_vars or other passes to be able to see
through certain types of casts such as when someone casts a uint64_t to
a uvec2.  However, for now we should just avoid casts all together.

Fixes: d8e3edb784 "nir/deref: Support casts and ptr_as_array in..."
Tested-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6072>
2020-08-03 21:49:25 +00:00
Eric Anholt ee2f21b10d nir: Remove the old nir_opt_shrink_load.
The old pass only handled intrinsic load_constant, while the new
nir_opt_shrink_vectors handles ALU ops, nir load_consts, along with all
the load intrinsics.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6050>
2020-08-03 21:26:45 +00:00
Eric Anholt d8c2f896db amd: Swap from nir_opt_shrink_load() to nir_opt_shrink_vectors().
This should do much more trimming than shrink_load, and is a win on i965's
vec4 and nir-to-tgsi.  For scalar backends like this that don't need ALU
shrinking, it still gets more load intrinsics covered.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6050>
2020-08-03 21:26:45 +00:00
Eric Anholt 023e6669cc i965: Enable vector shrinking in the vec4 backend.
This manages to make some extra vec operations that would turn into movs
go away.

brw shader-db:
total instructions in shared programs: 3895037 -> 3893221 (-0.05%)
total cycles in shared programs: 113832759 -> 113792154 (-0.04%)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6050>
2020-08-03 21:26:45 +00:00
Eric Anholt 1c9906d5ff nir: Add a pass to cut the trailing ends of vectors.
Ideally we'd also handle unused middles of vectors and reswizzle ALU-only
uses of it so we could write fewer channels, but that's future work/

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6050>
2020-08-03 21:26:45 +00:00
Jonathan Marek 5afaec3741 turnip: workaround for a630 d24_unorm_s8_uint fails
A630 doesn't have the HW format we use to sample stencil, so it needs a
workaround. It also has a bug around the AS_R8G8B8A8 format, which doesn't
work when UBWC is disabled, so use 8_8_8_8_UNORM instead when UBWC is
disabled (using AS_R8G8B8A8 or 8_8_8_8_UNORM should only matter with UBWC)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5438>
2020-08-03 21:07:30 +00:00
Christian Gmeiner 6fc52739bb etnaviv: fix nir validation problem
Fixes the following validation problem:
  error: nir_intrinsic_align_offset(instr) < nir_intrinsic_align_mul(instr)

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Lukas F. Hartmann <lukas@mntmn.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6127>
2020-08-03 20:05:20 +00:00
Rob Clark caa107cb8d freedreno/decode: move dependencies up a level
This is mainly for the benefit of automated syncing of changes from mesa
back to envytools, where the same subdir meson.build's are used, but the
toplevel meson.build is different.  In the envytools case, we want these
depenendencies to be required.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6154>
2020-08-03 19:46:49 +00:00
Rob Clark 9c33c53898 freedreno/registers: install gzip'd register database
The decode tools aren't too useful to install without the xml.  But
since libxml2 can read compressed xml, we'll gzip them for installation.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6154>
2020-08-03 19:46:49 +00:00
Rob Clark 62ebd342e6 freedreno/registers: split header build into subdirs
Instead of building the adreno/foo.xml headers from the toplevel, split
out a subdir().  This fits better with how meson likes things to be
structured.  But it does require fixing a bit about how gen_header.py
resolves imports, ie. it cannot assume the src file is at the root of
the $RNN_PATH.

This is needed for the next patch, to add support for installing the
register database for use with installed tools.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6154>
2020-08-03 19:46:49 +00:00
Rob Clark e59b241213 freedreno/registers: add .gitignore
Testing headergen2 will create .xml.h in the same location as the .xml.
But we don't want this to get accidentially committed.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6154>
2020-08-03 19:46:49 +00:00
Rob Clark 24f55eb6e8 freedreno/rnn: rework RNN_DEF_PATH construction
No need for rnn_path.h, just construct the whole thing in meson and pass
via c_args.  Also move where the path is constructed up one level.  This
will be needed for syncing back to envytools, where the path will be
different.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6154>
2020-08-03 19:46:49 +00:00
Rob Clark bf425b7e51 freedreno/rnn: also look for .xml.gz
libxml2 can load gzip compressed files, so lets look for these too.
This will be useful for installing the register database so that an
installed cffdump/crashdec can use them.  But it isn't too useful
to be able to edit the installed register database, so we can gzip
them to use less disk space.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6154>
2020-08-03 19:46:49 +00:00
Joshua Ashton 8efdd388e0 radv: Implement VK_EXT_4444_formats
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6160>
2020-08-03 19:27:37 +01:00
Jason Ekstrand 3c2a1af660 anv: Implement VK_EXT_4444_formats
We only support the ARGB format, not the ABGR one.  Fortunately, the
ARGB is the one required by D3D11.

Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6158>
2020-08-03 17:50:03 +00:00
Jason Ekstrand b44139ef36 vulkan: Update Vulkan XML and headers to 1.2.149
Reviewed-by Joshua Ashton <joshua@froggi.es>

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6158>
2020-08-03 17:50:03 +00:00
Mike Blumenkrantz 070fd2b66f u_prim_restart: add inline function for getting restart index based on index size
handy to have this available for drivers to reuse

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6147>
2020-08-03 16:58:48 +00:00
Nanley Chery 1f24c54458 iris: Zero the add-on clear color BO on import
When iris imports an I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS surface, it
allocates a buffer to hold the indirect clear color. When the import is
complete, iris_resource::aux::clear_color is set to zero but the
indirect buffer is filled with garbage values. This could break certain
texture view use-cases, so zero the allocated buffer to fix those.

Fixes: c19492bcdb ("iris: Handle importing aux-enabled surfaces on TGL")
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6092>
2020-08-03 16:24:16 +00:00
Mike Blumenkrantz cd1c21f8e5 zink: implement handling for VK_EXT_calibrated_timestamps
just the extension setup; we need this to handle device timestamp
queries outside of batches

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5913>
2020-08-03 14:22:39 +00:00
Mike Blumenkrantz 8930b19676 zink: store valid timestamp bits onto zink_screen
we need this for converting timestamp ticks to nonoseconds

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5913>
2020-08-03 14:22:39 +00:00
Mike Blumenkrantz 3e6366be68 zink: handle VK_EXT_vertex_attribute_divisor setup
this just enables the extension

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5913>
2020-08-03 14:22:39 +00:00
Mike Blumenkrantz 99b44536bf zink: clamp PIPE_SHADER_CAP_MAX_SHADER_BUFFERS to PIPE_MAX_SHADER_BUFFERS
this value gets split between ssbos and abos, so clamping to 8 here causes
a number of tests to fail just because there's not enough buffers available

other gallium drivers return 32 here, so this seems pretty safe

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5913>
2020-08-03 14:22:39 +00:00
Mike Blumenkrantz 01d6220cff zink: implement VK_EXT_robustness2
this adds support for null descriptors, which is necessary for full
compliance with ARB_texture_buffer_object

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5913>
2020-08-03 14:22:39 +00:00
Alyssa Rosenzweig b2f475251e pan/mdg: Test for SSA before chasing addresses
It's possible an SSA value depends on a register; in this case, chasing
the source would result in a crash as the chase helper in NIR asserts
is_ssa. Instead we should check a priori that all the argments are in
fact SSA, bailing otherwise.

In the piglit shader exhibiting this bug (by looping over the index),
bailing on the ishl instruction is -necessary-. This is not merely us
being cowardly to avoid seeing through the registers; indeed, if we
wrote away the ishl instruction, the shift itself would have to be
stored in a load/store register (r26/r27) which would preclude reading
it in the loop, creating a register allocation failure later in the
compile. So this is the correct solution due to the restricted
semantics.

Closes #3286

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Icecream95 <ixn@keemail.me>
Fixes: f5401cb886 ("pan/midgard: Add address analysis framework")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6144>
2020-08-03 09:43:47 -04:00
Alyssa Rosenzweig b4de9e035a pan/mdg: Mask spills from texture write
This prevents RA failures the results of reading multiple textures that
require less than 4 channels, as seen in a number of GL 3 WebRender shaders.

Closes: #3342

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Icecream95 <ixn@keemail.me>
Tested-by: Icecream95 <ixn@keemail.me>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6144>
2020-08-03 09:43:37 -04:00
jzielins 26dd8f8045 swr: Bump maximum 2D texture size to 16kx16k
This may be required by some applications, even though
not all texture formats will be below 2GB limit.

This change also increases the maximum size of render target,
that was inadvertently lowered some time ago.

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6139>
2020-08-03 13:46:51 +02:00
Bas Nieuwenhuizen 99cf910834 mesa/st: Actually free the driver part of memory objects on destruction.
_mesa_delete_memory_object(ctx, obj) == free(obj) but doesn't free the
part of the gallium driver.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1206
Fixes: 49f4ecc677 "mesa/st: start adding memory object support"
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6148>
2020-08-03 10:33:00 +00:00
Gert Wollny 63bff6a9f8 gallivm/nir: Lower uniforms to UBOs in llvm draw if the driver didn't request this already
When the llvm draw engine is used for draw shaders in st_program the driver
may not enable the cap PIPE_CAP_PACKED_UNIFORMS, so uniforms are not
be lowered to UBOs. However, llvm doesn't support nir_load_uniform, so lower
the uniforms to UBO now. The multiplier is set to 16 to be the same like in
the TGSI code path.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5681>
2020-08-03 06:43:34 +02:00
Mauro Rossi b54afde3ad android: freedreno: move a2xx disasm out of gallium
Fixes the following building errors:

clang: error: no such file or directory: 'external/mesa/src/gallium/drivers/freedreno/a2xx/disasm-a2xx.c'
clang: error: no input files

FAILED: out/target/product/x86_64/obj/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so
ld.lld: error: undefined symbol: disasm_a2xx
>>> referenced by ir2_assemble.c:546 (external/mesa/src/gallium/drivers/freedreno/a2xx/ir2_assemble.c:546)
>>>               ir2_assemble.o:(assemble) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_pipe_freedreno_intermediates/libmesa_pipe_freedreno.a
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

Fixes: f39afda1a7 ("freedreno: move a2xx disasm out of gallium")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6151>
2020-08-02 21:40:21 +02:00
Mauro Rossi ca114e6273 android: freedreno/common: add support for libfreedreno_common static
Porting of meson build rules to Android

Fixes: 9623debf48 ("freedreno: Centralize UUID generation into new files freedreno_uuid.c/h")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6151>
2020-08-02 21:40:21 +02:00
Mauro Rossi f065ec43ab android: freedreno/ir3: fix include paths
Fixes the following building error:

external/mesa/src/freedreno/ir3/disasm-a3xx.c:33:10: fatal error: 'disasm.h' file not found
#include "disasm.h"
         ^~~~~~~~~~
1 error generated.

Fixes: f7bd3456d7 ("freedreno: deduplicate a3xx+ disasm")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6151>
2020-08-02 21:40:21 +02:00
Mauro Rossi 711c30b764 android: freedreno/registers: fix generated headers rules
Fixes the following building errors:

FAILED: ninja: 'external/mesa/src/freedreno/registers/a2xx.xml',
needed by 'out/target/product/x86_64/gen/STATIC_LIBRARIES/libfreedreno_registers_intermediates/registers/a2xx.xml.h',
missing and no known rule to make it
...
FAILED: ninja: 'external/mesa/src/freedreno/registers/adreno-pm4-pack.xml.h',
needed by 'out/target/product/x86_64/gen/STATIC_LIBRARIES/libfreedreno_registers_intermediates/registers/adreno-pm4-pack.xml.h',
missing and no known rule to make it

Fixes: b721d336da ("freedreno: slurp in rnndb")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6151>
2020-08-02 21:40:21 +02:00
Tapani Pälli 32e0f7e097 anv: toggle on VK_EXT_extended_dynamic_state
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli b9a05447a1 anv: dynamic vertex input binding stride and size support
If pStrides or Psizes are NULL we should use the values defined by the
pipeline.

v2: fix commit message and fix the code to set explicitly if we are
    using dynamic stride/size

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli e4590c0750 anv: depth/stencil dynamic state support
v2: code cleanup, remove extra spaces (Lionel)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli f6fa4a8000 anv: add support for dynamic primitive topology change
This is done using 3DSTATE_VF_TOPOLOGY packet that overrides topology
used in subsequent 3DPRIMITIVE commands. For gen7[5] we override the
pipeline topology when emitting draw commands.

v2: fix the way gen7[5] is handled (Lionel)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli f426663f9c anv: add support for dynamic viewport and scissor with count
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli 9220598b36 anv: add support for dynamic cull mode and winding order
v2: cleanup, white space issues (Lionel)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli c34d8ac26e anv: handle dynamic viewport count
Emit 3DSTATE_CLIP during cmd_buffer_flush_state so that we can change
the max viewport count dynamically.

v2: use one common clip state as size is the same for all gens (Lionel)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli 11f3fb9a4e anv: consider dynamic state when creating pipeline
Leave default state values as zero so that when we OR them later
it is only the dynamic state value that matters.

v2: code cleanup + skip topology emit in base batch
    when topology is dynamic (Lionel)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli 65de778e0b anv: add new dynamic states
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Tapani Pälli 2260ce6d0c anv: add VK_EXT_extended_dynamic_state but leave it disabled
This is needed to ensure the function prototypes are declared.

v2: tweak commit message (Jason)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5604>
2020-08-02 17:44:54 +00:00
Eric Engestrom c1476044b5 egl: consistently use dri2_egl_display() helper macro
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6133>
2020-08-02 01:13:48 +02:00
Connor Abbott 27eea627ef freedreno/afuc: Fix PM4 enum parsing
We were open-coding it, and getting variant parsing wrong for things
like "A4XX-" which don't explicitly include the version being
disassembled. Use the rnn function instead. This makes CP_INDIRECT show
up again. Also propagate const-ness to users.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6140>
2020-08-01 17:51:01 +00:00
Connor Abbott a5daaed587 freedreno/afuc: Add missing rnn_prepdb()
It's totally not obvious, but this runs extra error checking and is
necessary for correct variant handling, and variant handling will
silently not work if it's not enabled. Add it asm.c even though it's not
strictly necessary, to prevent anyone from missing this in the future.

Missing this really should be an error.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6140>
2020-08-01 17:51:01 +00:00
Connor Abbott 8d0e5e0626 freedreno/cffdec: Stop open-coding enum parsing
Now that rnndec_decode_enum() has been fixed, it does the same thing as
this function.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6140>
2020-08-01 17:51:01 +00:00
Connor Abbott 73241ca53e freedreno/rnn: Make rnn_decode_enum() respect variants
We'll need this for afuc, and we're currently also open-coding the same
thing in rnnutils. It seems this function was added to decode pm4 packet
names, but it currently has no users, so make it useful for what it
was intended to do.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6140>
2020-08-01 17:51:01 +00:00
Eric Engestrom b67695d597 egl/haiku: drop overwritten preset of EGL version
`init_haiku()` is called by `eglInitialize()`, which then calls
`_eglComputeVersion()` (without even anything in between). The latter
sets the EGL version based on the extensions supported, and since Haiku
doesn't support any it will end up overwriting the same `1.4` value.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6131>
2020-08-01 17:31:33 +00:00
Eric Engestrom 9c6fa9421d egl: const _eglDriver
Converted using `s/_EGLDriver/const _EGLDriver/g` and dropped a couple
of irrelevant changes in comments, in the `_EGL_DRIVER_TYPECAST()` macro
and the typedef itself.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6129>
2020-08-01 17:12:20 +00:00
Lepton Wu 81c0e2ab63 egl: Allow software rendering for vgem/virtio_gpu in platform_device
Then user could explicitly choose the underlying device for software
rendering when both vgem/virtio_vga are there.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5830>
2020-08-01 10:07:25 +00:00
Matt Turner eaf27eb512 intel/tools: Test notification subregisters
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner ac7ecd205b intel/tools: Simplify notification register handling
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 63181df09b intel/tools: Don't hardcode notification register
Previously we parsed a src non-terminal but did nothing with it. Since
the WAIT instruction is kind of weird, in that you have to give it the
same notification subregister for both destination and source, and it
always has an exec size of 1, let's parse a destination instead of a
source. This way, we can parse a writemask rather than a swizzle in
align16 mode, and easily convert the writemask to a swizzle to create
the source register.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 90c18ec8db intel/tools: Manually set ARF register file/nr/subnr
brw_reg::subnr is in bytes, like the subnr field in the instruction
word, but we disassemble the subregister number in units of the type.
For example g0.3<1>F would have a subnr=12.

These non-terminals produce a brw_reg and feed into other non-terminals
that call brw_reg(), where they are passed the subnr that we set here.
brw_reg()'s subnr parameter is expected to be in terms of the register
type, and it is multiplied by the type size to calculate the subnr in
bytes.

In these non-terminals, we don't know the register type yet, so we
must store the subregister number as it was given to us in the .subnr
field and let the brw_reg() constructor handle the conversion to the
canonical byte-based subnr form when it knows the type.

Before this patch, subregister numbers applied to these registers would
be multiplied with the type size twice.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner af6d6f5c43 intel/tools: Pass integers, not enums, to stride()
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner c883c482be intel/compiler: Relax SENDS regioning assertions
The next commit fixes a mistake in the assembler and ends up running
afoul of this assertion.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 363e5ef5a5 intel/tools: Simplify dstregion
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 3d9c673c0f intel/tools: Simplify immediate handling
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 59801f07e7 intel/tools: Make writemask an integer
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner e115c499da intel/tools: Make swizzle an integer
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 3e1602cc4f intel/tools: Simplify register type handling
Produce a brw_reg_type rather than a whole brw_reg and rename a few
non-terminals.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 2851c218e2 intel/tools: Don't allow empty type specifier
It's preferable to require an explicit type.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner 6809b93411 intel/tools: Remove stray newline
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Matt Turner fdfbb1ed26 intel/tools: Fix typos
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5956>
2020-07-31 12:59:24 -07:00
Alyssa Rosenzweig 2dec9092be pan/bit: Remove BI_SHIFT stub
Fixes compile error with -Dtools=panfrost

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 946ff9b439 ("bifrost: Add support for nir_op_ishl")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6142>
2020-07-31 10:15:00 -04:00
Alyssa Rosenzweig aa989aed6d pan/bit: Update f32->f16 convert test
Needs a second argument to be consistent with the real IR and the
hardware instruction.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 8a4efe2d73 ("pan/bi: Pack second argument of F32_TO_F16")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6142>
2020-07-31 10:14:59 -04:00
Connor Abbott 8e626879dd freedreno/a6xx: Fix CP_BIN_SIZE_ADDRESS name
Also document some other registers gleaned from looking at the context
switch save/restore routines and fix CP_SDS_REM_SIZE, and make the names
line up with the CP perfcntr names. Note that the CP reads the draw
stream size in CP_SET_BIN_DATA5 using MEM_READ_ADDR, which is probably
why this was mistaken for the draw stream size address.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6123>
2020-07-31 07:44:02 +00:00
David Stevens 6c11a7994d i965/i915: Add colorspace support to YUV sampling
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6122>
2020-07-31 07:27:03 +00:00
David Stevens d8fdb8dab4 nir: Add colorspace support to YUV lowering pass
This change adds support for BT709 and BT2020 colorspace to the YUV
lowering pass. The default remains BT601.

This change also fixes minor imprecision in the last digits of the BT601
offsets due to computation from rounded values when the math was
simplified.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6122>
2020-07-31 07:27:03 +00:00
Mike Blumenkrantz f3509c0766 zink: add extension loading framework for spirv builder
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5969>
2020-07-31 06:53:01 +00:00
Italo Nicola a91011c9ec pan/mdg: emit REGISTER_UNUSED on unused ALU src2
This saves power and time by skipping a roundtrip to the register file.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6128>
2020-07-31 00:25:21 +00:00
Lepton Wu a2065917cc mapi: Return NULL function pointers for GL_EXT_debug_marker
Mesa returns a stub function pointer to glAnything for years.
Android framework till API level 30 just uses function pointers
returned from eglGetProcAddress without checking if the underlying
extension is supported. If we return stub pointers for functions
in GL_EXT_debug_marker, Android just uses our stub functions instead
of its own stubs and then fail the dEQP. In the past, the issue
didn't show up because mesa only has limited slots and run out of slots
before Android calls eglGetProcAddress on functions inside
GL_EXT_debug_marker.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5652>
2020-07-30 23:45:56 +00:00
Eric Engestrom 258165bed4 egl: drop left-over function prototype
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6037>
2020-07-30 23:24:30 +00:00
Eric Engestrom ed3f1e04c7 egl: rename _eglMatchDriver() to _eglInitializeDisplay()
... and fix the comment to better reflect what this really does.

The whole "match a driver at runtime" thing has been gone for years.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6037>
2020-07-30 23:24:30 +00:00
Eric Engestrom 6d6b82a159 egl: inline _eglMatchAndInitialize() and refactor _eglMatchDriver()
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6037>
2020-07-30 23:24:30 +00:00
Eric Engestrom a77050c034 egl: fix _eglMatchDriver() return type
The one caller only ever checks if the return value is NULL or not, so
let's simplify the function by only returning that information.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6037>
2020-07-30 23:24:30 +00:00
Eric Engestrom f91851e615 egl: drop unnecessary _eglGetDriver()
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6037>
2020-07-30 23:24:30 +00:00
Eric Engestrom d24e3ea8cb egl: replace _eglInitDriver() with a simple variable
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6037>
2020-07-30 23:24:30 +00:00
Italo Nicola 3d4deb659e pan/mdg: remove ins->br_compact and ins->branch_extended
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 8150c1d632 pan/mdg: defer branch packing
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 140185eb04 pan/mdg: refactor emit_alu_bundle
This refactor prepares emit_alu_bundle() for the next commit that
reconstructs branch instructions right before emission.
It also simplifies the code since the previous control flow was only
better when we had the prepacked fields in midgard_instruction.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 0f0f9ee710 pan/mdg: remove ins->alu
This commit removes the `ins->alu` field from midgard_instruction,
simplifying the code by just recreating midgard_vector_alu later when we
have to emit it.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 5299239c2e pan/mdg: externalize mir_pack_mod
midgard_print.c requires mir_pack_mod to remove references to ins->alu.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 1a4d165683 pan/mdg: defer register packing
This commit moves the packing of registers and other things from
install_registers_instr() to midgard_emit.c, right before emitting the
binary.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola bea6a652db pan/mdg: eliminate references to ins->load_store.op
This commit makes `ins->op` the correct field to use with load_store
instructions.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 92c808cd47 pan/mdg: eliminate references to ins->texture.op
This commit makes the `ins->op` the correct field to use with texture
instructions.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 83592de7ad pan/mdg: apply float outmods to textures
Texture instructions in midgard support float outmods, this commit makes
it so these instructions are emitted when the conditions are met.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 5011373e2b pan/mdg: eliminate references to ins->alu.outmod
In an effort to simplify MIR by not prepacking instructions, this commit
removes references to `ins->alu.outmod` so that we can later remove the
`ins->alu` field from midgard_instruction.
Every place that was using `ins->alu.outmod` was changed to now use the
generic `ins->outmod` field instead.
We then reconstruct the outmod field right before emission.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola f34815c6be pan/mdg: fix comment
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 5f7e0185cd pan/mdg: eliminate references to ins->alu.reg_mode
In an effort to simplify MIR by not prepacking instructions, this commit
removes references to `ins->alu.reg_mode` so that we can later remove
the `ins->alu` field from midgard_instruction.
Every place that was using reg_mode was changed to now use the generic
`ins->src_type` field instead.
We then reconstruct the reg_mode field right before emission.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola f4c89bf9bd pan/mdg: eliminate references to ins->alu.op
In an effort to simplify MIR by not prepacking instructions, this commit
removes references to `ins->alu.op` so that we can later remove the
`ins->alu` field from midgard_instruction.
Every place that was using ins->op was changed to now use the generic
`ins->op` field instead.
We then reconstruct the `alu.op` field right before emission.
This new field is generic and can contain opcodes for ALU, texture or
load/store instructions. It should be used in conjunction with
`ins->type`, just like the current prepacked `op` field.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola 598527f2fe pan/mdg: prepare effective_writemask()
In the next commits we will be removing the `alu` field from
midgard_instruction in order to simplify the code.
effective_writemask() doesn't actually use `alu` for anything, it only
needs to know the opcode.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Italo Nicola b1b0ce04b3 pan/mdg: fix src_type in instructions that need a implicit zero
We were incorrectly assuming uint32 for src_type[1] regardless of
src_type[0].

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5933>
2020-07-30 22:55:36 +00:00
Eric Anholt 75b1f3d39d drm-shim: Return -EINVAL instead of abort()ing on unknown ioctls.
I had this as abort() in my original implementation since I was doing
drm-shim and my kernel driver in parallel based around using a SW
simulator, and I wanted to always update both, but it means that people's
new feature detection code can easily end up breaing their drm-shim
shader-db runs (such as intel's kernel_has_dynamic_config_support()
checking for -ENOENT instead of -EINVAL for a feature, which showed up on
my personal runner but not fd.o's for reasons I'm unclear on).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5994>
2020-07-30 19:59:20 +00:00
Mike Blumenkrantz c77a414ec2 u_prim_restart: handle indirect draws
this is pretty gross, but we need to map the indirect buffer to get the
index info and then use that for mapping the index buffer and translating
the restart index

Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5886>
2020-07-30 19:34:03 +00:00
Roman Stratiienko a58081f97c panfrost: Android build fixes 2020 week 31
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6109>
2020-07-30 18:21:53 +00:00
Rhys Perry 75a68eee28 aco: optimize swizzled SALU 8/16-bit conversions
We only need one s_bfe for a conversion with a swizzled source.

shader-db (parallel-rdp, Navi):
Totals from 487 (71.30% of 683) affected shaders:
SpillSGPRs: 3284 -> 3233 (-1.55%); split: -2.71%, +1.16%
SpillVGPRs: 2174 -> 2150 (-1.10%); split: -1.24%, +0.14%
CodeSize: 2497864 -> 2445544 (-2.09%); split: -2.11%, +0.01%
Instrs: 450613 -> 445104 (-1.22%); split: -1.27%, +0.05%

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/5259>
2020-07-30 17:34:51 +00:00
Mauro Rossi 80c135e6a6 radv: fix build on Android 7 (v2)
Fixes the following building error:

external/mesa/src/amd/vulkan/radv_android.c:28:10: fatal error:
'vndk/hardware_buffer.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~

(v2) use the existing preprocessor condition #if ANDROID_API_LEVEL >= 26

Fixes: f36b527 "radv/android: Add android hardware buffer queries."
Reported-and-tested-by: youling 257 <youling257@gmail.com>
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6051>
2020-07-30 17:10:31 +00:00
Boris Brezillon e1b114868a nir: Get rid of __[u]int64_to_fp32() and __fp32_to_[u]int64()
Those are now handled by nir_lower_int64() which has native NIR
implementations.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>
2020-07-30 16:54:24 +00:00
Boris Brezillon 025988f818 intel: Set int64_options to ~0 when lowering 64b ops
That's more future proof than setting each bit manually. Looks like we
already miss nir_lower_ufind_msb64 because of that.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>
2020-07-30 16:54:24 +00:00
Boris Brezillon 936c58c8fc nir: Extend nir_lower_int64() to support i2f/f2i lowering
That's an attempt at replacing the complex __int64_to_float() and
__float_to_int64() implementations found in float64.glsl by a simpler
native NIR equivalent.

Thanks to that, we can have lower those conversion without having to
compile a GLSL shader, which would be quite annoying for OpenCL
kernels.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>
2020-07-30 16:54:24 +00:00
Boris Brezillon bfee35b45c nir: Stop passing an options arg to nir_lower_int64()
This information is exposed through shader->options->lower_int64_options.
Removing the extra arg forces drivers to initialize this field correctly.

This also allows us to check the int64 lowering options from each int64
lowering helper and decide if we should lower the instructions we
introduce.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>
2020-07-30 16:54:24 +00:00
Boris Brezillon 9e23925991 freedreno: Initialize lower_int64_options to a proper value
We're trying to get rid of the options argument passed to
nir_lower_int64() and use the nir_options.lower_int64_options instead.
But before we can do that we must patch nir_lower_int64() callers
that don't have this field properly set.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5588>
2020-07-30 16:54:24 +00:00
Daniel Schürmann f1f9fdb8a6 aco: add GFX6/7 subdword lowering tests
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>
2020-07-30 16:13:08 +00:00
Rhys Perry 000530ea68 aco/tests: add tests for sub-dword swaps
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>
2020-07-30 16:13:08 +00:00
Rhys Perry d488d0fd7b aco: add framework for testing isel and integration tests
And add some simple tests to demonstrate/test the pipeline builder and
glsl_scraper.py.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>
2020-07-30 16:13:08 +00:00
Rhys Perry bb7d7755f5 aco: add a few tests for the assembler and optimizer
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>
2020-07-30 16:13:08 +00:00
Rhys Perry e6366f9094 aco: add framework for unit testing
And add some "tests" to test and document currently unused features of the
framework.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3521>
2020-07-30 16:13:08 +00:00
Boris Brezillon dd155aef44 nir: Allow casts in nir_deref_instr_get[_const]_offset()
Allow casts in a deref chain so we can calculate an offset from
a base pointer dereference or have pointer type casts in the
middle of the chain (both are pretty common in CL).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5682>
2020-07-30 17:11:43 +02:00
Boris Brezillon 6a1382399c nir: Use a switch in build_deref_offset()/deref_instr_get_const_offset()
We are about to add support for casts when calculating offset, but let's
first turn the if()/else if()/else block into a switch() statement to
ease addition of new cases.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5682>
2020-07-30 17:11:35 +02:00
Marcin Ślusarz cb19fe24d3 intel/vec4: fix out of bounds read
NIR_MAX_VEC_COMPONENTS was bumped from 4 to 16 in a8ec4082
(2019.03.09, merged 2019.12.21)

float[4] array was added in acd7796a
(2019.06.11, merged 2019.07.11)

Found by Coverity.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3014

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: a8ec4082a4 ("nir+vtn: vec8+vec16 support")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
2020-07-30 10:41:00 +00:00
Marcin Ślusarz 56228b0393 iris: quiet down static analyzers
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/6067>
2020-07-30 10:41:00 +00:00
Marcin Ślusarz c3a251f254 mesa: quiet down static analyzers
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
2020-07-30 10:41:00 +00:00
Marcin Ślusarz 0906d5d504 mesa: fix out of bounds access in glGetFramebufferParameterivEXT
ColorDrawBuffer is an array of MAX_DRAW_BUFFERS == 8.

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: 7534c536ca ("mesa: add EXT_dsa (Named)Framebuffer functions")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
2020-07-30 10:41:00 +00:00
Marcin Ślusarz 28f2585365 util/format: initialize non-important components to 0
Avoids copying random garbage from the stack.

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
2020-07-30 10:41:00 +00:00
Marcin Ślusarz f13042ec7e util: fix possible buffer overflow in util_get_process_exec_path
Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: f8f1413070 ("util/u_process: add util_get_process_exec_path")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
2020-07-30 10:41:00 +00:00
Marcin Ślusarz 59bb0ff945 glsl: catch out of bounds access in the debug version
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
2020-07-30 10:41:00 +00:00
Marcin Ślusarz eac0ba7fc1 util: fix possible fd leaks in os_socket_listen_abstract
Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: ef5266ebd5 ("util/os_socket: Add socket related functions.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
2020-07-30 10:41:00 +00:00
Alejandro Piñeiro 62bfc700f7 vulkan/util: add struct vk_pipeline_cache_header
Header is defined at vkGetPipelineCacheData spec, in any vulkan
version, and anv, tu and radv were using the same struct, and v3dv was
about to do the same.

Defining the same struct four times seemed odd, so let's define on a
common place.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6058>
2020-07-30 11:44:21 +02:00
Rob Clark b5558f2d2a freedreno/a6xx: fixup draw state earlier
`fixup_draw_state()` was updating `ctx->dirty` after it had already been
copied into the emit struct, which had the result that we were not re-
emitting the rast state when primitive_restart changes.

Fixes: 4d8f42c851 ("freedreno/a6xx: separate rast stateobj for prim restart")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3067
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6117>
2020-07-29 20:22:05 +00:00
Rob Clark 82b419fefd freedreno/a6xx: don't emit a bogus size for empty cb slots
Noticed that asphalt9 had no uniforms bound, so cb[0] is null.  In
theory shouldn't cause a problem, since nothing is doing `ldc` against
cb[0], but to be safe we should use SIZE=0.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6117>
2020-07-29 20:22:05 +00:00
Rob Clark ba9d502d24 freedreno/ir3: add missing track_ubo_use()
We could lower *some* accesses to a UBO but not others.  In this case,
we would have a valid range, but would have skipped tracking that the
UBO is accessed as a UBO rather than push constants.

Fixes one issue with asphalt9, that was a result of having `ldc` without
having emit UBO state.

See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3067
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6117>
2020-07-29 20:22:05 +00:00
Frank Binns d0e32e5f81 egl/dri2: only take a dri2_dpy reference when binding a new context/surfaces
This effectively reverts part of 2907faee, which changed dri2_make_current() to
always take a dri2_dpy reference regardless of whether or not a new context or
surface(s) were being bound. This led to a reference count imbalance as there
was no corresponding code added to drop a reference on the dri2_dpy. As a
consequence, any application that called eglInitialize() on a default/native
display after having called eglTerminate() would always get back the old
dri2_dpy, inheriting its previous state.

As the reference count is there to prevent the dri2_dpy from being destroyed
between eglTerminate() and eglInitialize() calls when a context is still bound,
a reference should only be taken when a successful call to
dri2_dpy->core->bindContext() has been made. Fix the issue by restoring the old
reference counting behaviour.

Fixes: 4e8f95f64d ("egl_dri2: Always unbind old contexts")
Fixes: 2907faee7a ("egl/dri2: try to bind old context if bindContext failed")
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Nicolas Cortes <nicolas.g.cortes@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3328
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6105>
2020-07-29 20:01:14 +00:00
Rob Clark b9391c1d50 freedreno/decode: cffdec warnings cleanup
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6118>
2020-07-29 19:32:51 +00:00
Rob Clark 20e703b7e6 freedreno/rnn: headergen2 warnings cleanup
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6118>
2020-07-29 19:32:51 +00:00
Kenneth Graunke 128cbcd3a7 iris: Delete shader variants when deleting the API-facing shader
We were space-leaking iris_compiled_shader objects, leaving them around
basically forever - long after the associated iris_uncompiled_shader was
deleted.  Perhaps even more importantly, this left the BO containing the
assembly referenced, meaning those were never reclaimed either.  For
long running applications, this can leak quite a bit of memory.

Now, when freeing iris_uncompiled_shader, we hunt down any associated
iris_compiled_shader objects and pitch those (and their BO) as well.

One issue is that the shader variants can still be bound, because we
haven't done a draw that updates the compiled shaders yet.  This can
cause issues because state changes want to look at the old program to
know what to flag dirty.  It's a bit tricky to get right, so instead
we defer variant deletion until the shaders are properly unbound, by
stashing them on a "dead" list and tidying that each time we try and
delete some shader variants.

This ensures long running programs delete their shaders eventually.

Fixes: ed4ffb9715 ("iris: rework program cache interface")
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6075>
2020-07-29 11:34:01 -07:00
Rhys Perry 9a49d4c2db aco: remove isel for GLSL-style barriers
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/5980>
2020-07-29 17:57:13 +00:00
Rhys Perry cc3bc9493c radv: use scoped barriers
fossil-db (LLVM, Navi):
Totals from 843 (0.62% of 135820) affected shaders:
SGPRs: 40456 -> 40480 (+0.06%); split: -0.10%, +0.16%
VGPRs: 39648 -> 39688 (+0.10%); split: -0.01%, +0.11%
CodeSize: 2936164 -> 2932508 (-0.12%); split: -0.21%, +0.09%
MaxWaves: 10828 -> 10827 (-0.01%)

fossil-db changes seem to be due to SPIR-V -> NIR emitting a workgroup
scope shared memory barrier instead of a group_memory_barrier.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>
2020-07-29 17:57:13 +00:00
Rhys Perry a8f8c02e7e ac/nir: implement scoped_barrier
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/5980>
2020-07-29 17:57:13 +00:00
Rhys Perry 6b99cf6064 nir/load_store_vectorize: fix indentation
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/5980>
2020-07-29 17:57:13 +00:00
Caio Marcelo de Oliveira Filho 1a42e7dae9 nir: Filter modes of scoped memory barrier in nir_opt_load_store_vectorize
Otherwise a scoped memory barrier containing nir_var_mem_ubo (which
memoryBarrier() does lower to) would incorrectly prevent the
optimization to happen in UBOs.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>
2020-07-29 17:57:13 +00:00
Jason Ekstrand 5c5555a862 nir: Add a find_variable_with_[driver_]location helper
We've hand-rolled this loop 10 places and those are just the ones I
found easily.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand fc1363cc60 nir/gl_nir_linker: Call add_vars_with_modes once for GL_PROGRAM_INPUT
Now that nir_foreach_variable_with_modes can handle multiple modes at
one time, we can simplify things a bit and only walk the list once.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 789ec95dcd nir/split_per_member_structs: Inline split_variables_in_list
This lets us do one list walk instead of three.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand d70fff99c5 nir: Use a single list for all shader variables
Instead of having separate lists of variables, roughly sorted by mode,
use a single list for all shader-level NIR variables.  This makes a few
list walks a bit longer here and there but list walks aren't a very
common thing in NIR at all.  On the other hand, it makes a lot of things
like validation, printing, etc. way simpler.  Also, there are a number
of cases where we move variables from inputs/outputs to globals and this
makes it way easier because we no longer have to move them between
lists.  We only have to deal with that if moving them from the shader to
a nir_function_impl.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 473b0fc25d gallium/ttn: Use variable create/add helpers
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand a41a84d362 mesa/ptn: Use nir_variable_create
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand e5536e4a78 aco: Use nir_foreach_variable_with_modes to walk SSBOs
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand a61be312e2 panfrost: Use nir_foreach_variable_with_modes in pan_compile
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 94f0bae4de panfrost/midgard: Make search_var take a nir_shader and mode
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 568022be75 r600/sfn: Use nir_foreach_variable_with_modes in IO vectorization
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand cc51cec9c0 r600/sfn/lower_tex: Get rid of the lower_sampler vector
We can get the result type information easily from nir_tex_instr itself
by looking at dest_type.  There's no reason to construct a vector and
try to index into it.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 929673077c r600/sfn/lower_tess_io: Rework get_tcs_varying_offset
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand e4d812db10 freedreno/ir3_cmdline: Rework i/o variable fixup
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand ce6e59b3d3 lima/standalone: Rework i/o variable fixup
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 52dd84a12e freedreno/ir3_lower_tess: Rework var list helpers
They now take a nir_shader and a nir_variable_mode

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 77c41ce04b nir/gl_nir_linker: Use nir_foreach_variable_with_modes
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand c256cd900e nir/lower_variable_initializers: Restrict the modes we lower
This is not a functional change because these are the only modes we
handle.  All others get silently ignored.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 4d7e064623 nir/split_per_member_structs: Use nir_variable_with_modes_safe
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 90cf4709d9 nir/lower_uniforms_to_ubo: Use nir_foreach_variable_with_modes
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand d0d5ef6139 nir/lower_two_sided_color: Use nir_variable_create
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand bb3994cfe7 nir/io_to_vector: Use nir_foreach_variable_with_modes
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 0a77c67442 nir/lower_io_to_temporaries: Use a separate list for new inputs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand cd66005b23 nir: Use a nir_shader and mode in lower_clip_cull_distance_arrays
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand d5d15c301e nir/lower_amul: Add a variable mode check
This loop should only apply to UBOs and SSBOs because max_slot is never
used for normal uniforms.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 3be0be7d54 nir: Split nir_index_vars into two functions
We also very slightly change the semantics.  It no longer is one index
per list for global variables and is a single index over-all.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 86c9303814 nir/split_vars: Add mode checks to list walks
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 2f6c263cc3 st/nir: Rework fixup_varying_slots
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 4c3a30393d nir/linking: Rework some internal helpers
Instead of taking a variable list, take a nir_shader and mode.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand caab46c1e9 nir: Take a shader and variable mode in nir_assign_io_var_locations
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 964c1c4b87 nir: Take a nir_shader and variable mode in assign_var_locations
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand 6f6f7a34c5 nir: Add and use a nir_variable_list_for_mode helper
We also add a new list iterator which takes a modes bitfield and
automatically figures out which list to use.  In the future, this
iterator will work for multiple modes but today it assumes a single mode
thanks to the behavior of nir_variable_list_for_mode.  This also doesn't
work for function_temp variables.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand e3e1c50067 nir: Add a nir_foreach_gl_uniform_variable helper for GL linking
There are a bunch of cases where we really do want to walk the list that
is nir->uniforms because we want all things declared "uniform" in the
GLSL.  Add a helper for this but restrict it to the GL linking code.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00
Jason Ekstrand feb32f898c nir: Add a nir_foreach_uniform_variable helper
This one's a bit more complex because it filters off only those
variables with mode == nir_var_uniform.  As such, it's not exactly a
drop-in replacement for nir_foreach_variable(var, &nir->uniforms).

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
2020-07-29 17:38:58 +00:00