platform/upstream/mesa.git
3 years agopan/decode: Free mapped memory objects on BO unreference
Icecream95 [Tue, 19 Jan 2021 21:46:05 +0000 (10:46 +1300)]
pan/decode: Free mapped memory objects on BO unreference

Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8583>

3 years agomesa: simplify terminating display list loops
Marek Olšák [Wed, 23 Dec 2020 21:51:01 +0000 (16:51 -0500)]
mesa: simplify terminating display list loops

Remove the done variable and return directly from switches.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agomesa: simplify handling OPCODE_CONTINUE for display lists
Marek Olšák [Wed, 23 Dec 2020 21:42:39 +0000 (16:42 -0500)]
mesa: simplify handling OPCODE_CONTINUE for display lists

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agomesa: optimize glCallLists by using loops inside a switch
Marek Olšák [Wed, 23 Dec 2020 19:06:02 +0000 (14:06 -0500)]
mesa: optimize glCallLists by using loops inside a switch

This changes glCallLists from using a switch inside a loop to using loops
inside a switch.

Also fix the comments that didn't tell WHY something was important.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agomesa: remove redundant glRect functions for display lists
Marek Olšák [Wed, 23 Dec 2020 12:16:51 +0000 (07:16 -0500)]
mesa: remove redundant glRect functions for display lists

vbo_save implements this better by putting the vertices into a VBO.
The SET functions removed here were overriding it to use the slower
version that uploads the vertices on every call.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agomesa: remove _mesa_initialize_exec_dispatch from draw.c by autogenerating it
Marek Olšák [Wed, 23 Dec 2020 12:10:06 +0000 (07:10 -0500)]
mesa: remove _mesa_initialize_exec_dispatch from draw.c by autogenerating it

The glapi scripts are fully capable of generating this correctly for all
GL APIs if we don't set exec="dynamic".

exec="dynamic" should only be used for glBegin, glEnd, and all functions
that are legal inside Begin/End.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: add display list support to fix state tracking with display lists
Marek Olšák [Wed, 23 Dec 2020 22:19:14 +0000 (17:19 -0500)]
glthread: add display list support to fix state tracking with display lists

The existing display list code is reused to call display lists from the app
thread. The util_queue_fence_wait call waits for the last call that modifies
display lists (such as glEndList and glDeleteLists), which ensures that
accessing display lists from a non-mesa thread is thread safe because
the wait guarantees that display lists are immutable during the asynchronous
display list execution.

Display lists are executed just like normal display lists except that they
call glthread functions instead of the default GL dispatch. Many calls in
display lists are skipped because glthread only tracks a few states.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agomesa: add _mesa_get_list helper
Marek Olšák [Wed, 23 Dec 2020 22:18:08 +0000 (17:18 -0500)]
mesa: add _mesa_get_list helper

glthread will use it.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: remove if (COMPAT) conditions from functions that are GL-compat-only
Marek Olšák [Wed, 23 Dec 2020 17:30:13 +0000 (12:30 -0500)]
glthread: remove if (COMPAT) conditions from functions that are GL-compat-only

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: rename inside_dlist to ListMode for future use
Marek Olšák [Wed, 23 Dec 2020 17:29:24 +0000 (12:29 -0500)]
glthread: rename inside_dlist to ListMode for future use

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: implement glGetIntegerv for states that glthread tracks
Marek Olšák [Sat, 3 Oct 2020 03:14:13 +0000 (23:14 -0400)]
glthread: implement glGetIntegerv for states that glthread tracks

for viewperf

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: track all matrix stack depths
Marek Olšák [Sat, 3 Oct 2020 03:12:52 +0000 (23:12 -0400)]
glthread: track all matrix stack depths

This just tracks matrix stack depths in MatrixStackDepth and everything
else here is needed to make it correct.

Matrix stack depths will be returned by glGetIntegerv without synchronizing.

Display lists will be handled by a separate commit.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: add specialized versions of unmarshal_Draw funcs without user buffers
Marek Olšák [Wed, 23 Dec 2020 11:21:57 +0000 (06:21 -0500)]
glthread: add specialized versions of unmarshal_Draw funcs without user buffers

This decreases CPU time spent in the unmarshal_DrawElements function
from 0.44% to 0.26% if no user buffers are present.

Instead of converting all calls to either unmarshal_DrawArraysInstanced-
BaseInstance or unmarshal_DrawElementsInstancedBaseVertexBaseInstance,
which both also conditionally bind uploaded user buffers if needed and
call one of:
- DrawArraysInstancedBaseInstance
- DrawElementsInstancedBaseVertexBaseInstance
- DrawRangeElementsBaseVertex,
add 3 unmarshal draw variants that are specialized version of the above that
never bind uploaded user buffers. This removes all conditionals from
the unmarshal functions for the common case when there are no user buffers.

Unused function enums are used for the various draw variants. For example,
CMD_DrawArrays is used to dispatch DrawArraysInstacedBaseInstance without
user buffers, while CMD_DrawArraysInstacedBaseInstance is used to dispatch
the same with user buffers. glthread isn't flexible enough to do it cleanly.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: don't sync with NV_half_float vertex attrib functions
Marek Olšák [Mon, 4 Jan 2021 01:23:07 +0000 (20:23 -0500)]
glthread: don't sync with NV_half_float vertex attrib functions

Set the pointer sizes, so that glthread knows how much data needs to be
copied.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agoglthread: remove marshal="draw" because it doesn't do much
Marek Olšák [Wed, 23 Dec 2020 07:42:04 +0000 (02:42 -0500)]
glthread: remove marshal="draw" because it doesn't do much

It only checked whether the pointer was indices or indirect, but we can
just determine the same thing manually for each draw call.

Simplify it as follows:
- if a call contains a pointer without count and it's either indirect or
  indices, set marshal="async". The marshal_sync attribute still determines
  when it syncs.
- if a call doesn't contain any pointer without count, remove the marshal
  attribute

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

3 years agopanfrost: Fix the tile size assertion
Icecream95 [Thu, 17 Dec 2020 11:27:14 +0000 (00:27 +1300)]
panfrost: Fix the tile size assertion

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

3 years agopanfrost: Transaction elimination support
Icecream95 [Mon, 9 Nov 2020 10:13:21 +0000 (23:13 +1300)]
panfrost: Transaction elimination support

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

3 years agopanfrost: Add a debug flag to disable checksumming
Icecream95 [Wed, 20 Jan 2021 06:42:12 +0000 (19:42 +1300)]
panfrost: Add a debug flag to disable checksumming

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

3 years agopanfrost: Only checksum resources when it makes sense to
Icecream95 [Sat, 12 Dec 2020 05:41:16 +0000 (18:41 +1300)]
panfrost: Only checksum resources when it makes sense to

To simplify tracking the checksum validity, only checksum 2D
resources.

The GPU cannot do checksumming when there is too much data to be
written out, so limit the number of bytes per pixel to an architecture
specific value.

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

3 years agopanfrost: Add a function to determine if a resource is 2D
Icecream95 [Mon, 9 Nov 2020 10:13:43 +0000 (23:13 +1300)]
panfrost: Add a function to determine if a resource is 2D

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

3 years agoradeonsi: Use util_writes_stencil() helper
Rob Clark [Wed, 20 Jan 2021 19:04:31 +0000 (11:04 -0800)]
radeonsi: Use util_writes_stencil() helper

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8598>

3 years agor300: Use util_writes_depth_stencil() helper
Rob Clark [Wed, 20 Jan 2021 19:04:09 +0000 (11:04 -0800)]
r300: Use util_writes_depth_stencil() helper

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8598>

3 years agofreedreno/a6xx: Don't early-z if there are stencil writes
Rob Clark [Wed, 20 Jan 2021 18:44:20 +0000 (10:44 -0800)]
freedreno/a6xx: Don't early-z if there are stencil writes

Fixes a similar stencil related misrendering in a couple "RV AppStudios"
titles.

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

3 years agogallium/util: Add helpers to determine if z/s is written
Rob Clark [Wed, 20 Jan 2021 18:27:55 +0000 (10:27 -0800)]
gallium/util: Add helpers to determine if z/s is written

For drivers that must control various 'early-z'-like state, it is easy
enough to get this wrong.  So add helpers so we don't have to duplicate
the logic in each driver.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8598>

3 years agoradeonsi: allow instance_count == 0 on chips that handle it correctly
Marek Olšák [Mon, 11 Jan 2021 11:35:43 +0000 (06:35 -0500)]
radeonsi: allow instance_count == 0 on chips that handle it correctly

Let's remove this overhead.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: don't validate inlinable uniforms at draw time
Marek Olšák [Tue, 12 Jan 2021 03:57:32 +0000 (22:57 -0500)]
radeonsi: don't validate inlinable uniforms at draw time

Let's trust the state tracker that it sets inlinable uniforms only
when shaders can use them.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: move variables closer to their use in most draw state functions
Marek Olšák [Sun, 10 Jan 2021 02:33:35 +0000 (21:33 -0500)]
radeonsi: move variables closer to their use in most draw state functions

for lower register pressure, though I haven't measured this.

si_draw_vbo will be handled in a future commit.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: clear dirty_atoms and dirty_states only if we entered the emit loop
Marek Olšák [Sun, 10 Jan 2021 00:48:54 +0000 (19:48 -0500)]
radeonsi: clear dirty_atoms and dirty_states only if we entered the emit loop

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: enable the GS tri strip adj workaround with primitive_restart
Marek Olšák [Sat, 9 Jan 2021 21:24:42 +0000 (16:24 -0500)]
radeonsi: enable the GS tri strip adj workaround with primitive_restart

If a primitive restart index occurs after an even number of triangles,
the workaround works.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: evaluate si_get_vs in si_draw_vbo at compile time
Marek Olšák [Sat, 9 Jan 2021 12:31:49 +0000 (07:31 -0500)]
radeonsi: evaluate si_get_vs in si_draw_vbo at compile time

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: inline the last use of si_get_vs_state
Marek Olšák [Sat, 9 Jan 2021 12:26:39 +0000 (07:26 -0500)]
radeonsi: inline the last use of si_get_vs_state

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: evaluate sh_base in si_emit_vs_state at compile time
Marek Olšák [Sat, 9 Jan 2021 11:48:54 +0000 (06:48 -0500)]
radeonsi: evaluate sh_base in si_emit_vs_state at compile time

This computes the value at compile time because si_get_user_data_base is
always inlined.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: add si_get_user_data_base selecting user data registers
Marek Olšák [Sat, 9 Jan 2021 11:42:55 +0000 (06:42 -0500)]
radeonsi: add si_get_user_data_base selecting user data registers

This will be used in templated si_draw_vbo in place of sh_base.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: don't set context_roll for non-gfx9 in templated functions
Marek Olšák [Sat, 9 Jan 2021 10:48:28 +0000 (05:48 -0500)]
radeonsi: don't set context_roll for non-gfx9 in templated functions

It's not needed by other chips.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: don't pass pipe_draw_info into si_emit_draw_registers
Marek Olšák [Sun, 27 Dec 2020 02:34:15 +0000 (21:34 -0500)]
radeonsi: don't pass pipe_draw_info into si_emit_draw_registers

Only two fields are used. It's probably better this way.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agoradeonsi: unify uploaders on APUs too
Marek Olšák [Mon, 21 Dec 2020 06:34:38 +0000 (01:34 -0500)]
radeonsi: unify uploaders on APUs too

const_uploader and stream_uploader point to the same uploader.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>

3 years agodocs/freedreno: Fix a few typos
Matt Turner [Wed, 20 Jan 2021 19:40:42 +0000 (14:40 -0500)]
docs/freedreno: Fix a few typos

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

3 years agonir: Work around MSVC x86 internal compiler error
Jesse Natalie [Tue, 19 Jan 2021 19:23:39 +0000 (11:23 -0800)]
nir: Work around MSVC x86 internal compiler error

Fixes: 1fd8b466 ("nir,spirv: add sparse image loads")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4108
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8581>

3 years agoanv: Fix stencil layout in render passes
Lionel Landwerlin [Wed, 13 Jan 2021 14:09:18 +0000 (16:09 +0200)]
anv: Fix stencil layout in render passes

We incorrectly utilize the stencil layouts structures even if we
should stick to the depth_stencil ones if the layout includes stencil.

v2: Don't forget stencil only layout (Nanley)
    Simplify callers of new helper functions (Nanley)

v3: Store VK_IMAGE_LAYOUT_UNDEFINED when no stencil is available (Nanley)
    Use a switch statement (Nanley)

v4: Consider all layouts but depth only to be potential stencil layouts (Lionel)

v5: Refactor helper in vk_image_layout_depth_only() and discard
    VkAttachmentDescriptionStencilLayoutKHR in
    VkAttachmentDescription2KHR if format is not depth/stencil.

v5: s/LAYOUT_COLOR_ATTACHMENT_OPTIMAL/LAYOUT_DEPTH_ATTACHMENT_OPTIMAL/ (Nanley)

v6: Fix overly harsh assert()

Fixes: c1c346f1667375 ("anv: implement VK_KHR_separate_depth_stencil_layouts")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4084
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8475>

3 years agonir_to_tgsi: Store directly to TGSI outputs when possible.
Eric Anholt [Wed, 9 Dec 2020 23:49:16 +0000 (15:49 -0800)]
nir_to_tgsi: Store directly to TGSI outputs when possible.

Saves emitting a MOV at the end of the program to store the output.

softpipe glmark2 -b buffer +9.73451% +/- 3.17924% (n=6)
softpipe glmark2 -b build +5.57621% +/- 1.35074% (n=9)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8023>

3 years agoci/freedreno: Fix xfail setup for sampler3d_float_vertex.
Eric Anholt [Wed, 20 Jan 2021 17:49:50 +0000 (09:49 -0800)]
ci/freedreno: Fix xfail setup for sampler3d_float_vertex.

I mised the ",Fail" status, so it just wasn't interpreted.  I should make
the runner throw an error instead.

Fixes: 22bf4831b8ae ("ci/freedreno: Fix up the xfail/flake handling of a3xx texture functions.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8596>

3 years agoradv,aco: don't use MUBUF for multi-channel loads on GFX8 with robustness2
Rhys Perry [Mon, 30 Nov 2020 15:29:31 +0000 (15:29 +0000)]
radv,aco: don't use MUBUF for multi-channel loads on GFX8 with robustness2

Fixes several dEQP-VK.robustness.robustness2.* tests on GFX8. Generations
other than GFX8 don't fail the tests because bounds-checking is done using
the index (making it per-vertex).

fossil-db (Polaris):
Totals from 1387 (0.99% of 140385) affected shaders:
(no statistics affected)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 03a0d39366d ("aco: use MUBUF in some situations instead of splitting vertex fetches")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7834>

3 years agoradv: remove redundant check in depth_view_can_fast_clear()
Samuel Pitoiset [Tue, 19 Jan 2021 16:54:13 +0000 (17:54 +0100)]
radv: remove redundant check in depth_view_can_fast_clear()

We check below if HTILE is in compressed state, so checking if
the image has HTILE is useless because radv_layout_is_htile_compressed()
will return FALSE if no HTILE.

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/8579>

3 years agoradv: remove unnecessary radv_image::tc_compatible_htile
Samuel Pitoiset [Tue, 19 Jan 2021 16:49:06 +0000 (17:49 +0100)]
radv: remove unnecessary radv_image::tc_compatible_htile

Use the surface flags directly 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/8579>

3 years agoradv: remove redundant check in radv_process_depth_stencil()
Samuel Pitoiset [Tue, 19 Jan 2021 16:48:18 +0000 (17:48 +0100)]
radv: remove redundant check in radv_process_depth_stencil()

This is already checked in radv_handle_depth_image_transition().

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/8579>

3 years agovirgl: Cache depth and stencil buffers
Rohan Garg [Mon, 18 Jan 2021 13:21:28 +0000 (14:21 +0100)]
virgl: Cache depth and stencil buffers

Expand the list of bind flags to cache depth and stencil
buffers.

Extensive testing shows the following performance improvements:

Game           |    % difference in FPS
Plague Inc     |             7
Portal 2       |             21
Overcooked 2   |             1.2
Hollow Knight  |            -1.1
Civilization V |             3.8

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8560>

3 years agoaco: add affinity for non-sequential MIMG operands
Rhys Perry [Wed, 9 Dec 2020 16:32:58 +0000 (16:32 +0000)]
aco: add affinity for non-sequential MIMG operands

fossil-db (GFX10.3):
Totals from 42008 (30.14% of 139391) affected shaders:
VGPRs: 2139116 -> 2147696 (+0.40%); split: -0.06%, +0.46%
CodeSize: 199109120 -> 198637852 (-0.24%); split: -0.24%, +0.01%
Instrs: 37713901 -> 37714574 (+0.00%); split: -0.02%, +0.03%
Cycles: 1621911328 -> 1621634168 (-0.02%); split: -0.02%, +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/8523>

3 years agoaco: only require texture coordinates to be in WQM if NSA is used
Rhys Perry [Thu, 14 Jan 2021 20:00:12 +0000 (20:00 +0000)]
aco: only require texture coordinates to be in WQM if NSA is used

From comment in emit_mimg():
We don't need the bias, sample index, compare value or offset to be
computed in WQM but if the p_create_vector copies the coordinates, then it
needs to be in WQM.

fossil-db (GFX10.3):
Totals from 1778 (1.28% of 139391) affected shaders:
SGPRs: 105080 -> 105072 (-0.01%); split: -0.02%, +0.01%
VGPRs: 96800 -> 96776 (-0.02%); split: -0.07%, +0.05%
CodeSize: 10001120 -> 10001384 (+0.00%); split: -0.04%, +0.04%
MaxWaves: 18164 -> 18163 (-0.01%)
Instrs: 1883750 -> 1883598 (-0.01%); split: -0.06%, +0.05%
Cycles: 34800176 -> 34767840 (-0.09%); split: -0.10%, +0.01%

We don't have a p_create_vector if we use NSA.

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/8523>

3 years agoaco: use non-sequential addressing
Rhys Perry [Thu, 14 Jan 2021 19:58:13 +0000 (19:58 +0000)]
aco: use non-sequential addressing

fossil-db (GFX10.3):
Totals from 70493 (50.57% of 139391) affected shaders:
SGPRs: 4232624 -> 4231808 (-0.02%); split: -0.09%, +0.07%
VGPRs: 2831772 -> 2764740 (-2.37%); split: -2.53%, +0.17%
CodeSize: 225584412 -> 225048740 (-0.24%); split: -0.44%, +0.21%
MaxWaves: 875319 -> 878837 (+0.40%); split: +0.44%, -0.04%
Instrs: 43157803 -> 42496421 (-1.53%); split: -1.54%, +0.01%
Cycles: 1656380132 -> 1641532056 (-0.90%); split: -0.94%, +0.04%

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/8523>

3 years agoaco: move VADDR to the end of the operand list
Rhys Perry [Thu, 14 Jan 2021 17:46:50 +0000 (17:46 +0000)]
aco: move VADDR to the end of the operand list

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/8523>

3 years agoaco: add emit_mimg() helper
Rhys Perry [Thu, 14 Jan 2021 17:33:43 +0000 (17:33 +0000)]
aco: add emit_mimg() helper

Some fossil-db noise from slightly different order of instructions.

fossil-db (GFX10.3):
Totals from 73 (0.05% of 139391) affected shaders:
SGPRs: 3424 -> 3440 (+0.47%)
CodeSize: 199076 -> 199064 (-0.01%); split: -0.01%, +0.00%
Instrs: 37303 -> 37300 (-0.01%); split: -0.01%, +0.00%
Cycles: 786328 -> 786316 (-0.00%); split: -0.00%, +0.00%
VMEM: 19448 -> 19454 (+0.03%); split: +0.04%, -0.01%
SMEM: 5241 -> 5305 (+1.22%); split: +1.70%, -0.48%
SClause: 1282 -> 1281 (-0.08%)

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/8523>

3 years agoaco: have emit_wqm() take Builder instead of isel_context
Rhys Perry [Thu, 14 Jan 2021 17:35:16 +0000 (17:35 +0000)]
aco: have emit_wqm() take Builder instead of isel_context

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/8523>

3 years agoaco: fix num_waves on GFX10+
Rhys Perry [Tue, 19 Jan 2021 11:37:52 +0000 (11:37 +0000)]
aco: fix num_waves on GFX10+

There are half the SIMDs per CU and physical_vgprs should be 512 instead
of 256.

fossil-db (GFX10.3):
Totals from 3622 (2.60% of 139391) affected shaders:
VGPRs: 298192 -> 289732 (-2.84%); split: -3.43%, +0.59%
CodeSize: 29443432 -> 29458388 (+0.05%); split: -0.00%, +0.06%
MaxWaves: 21703 -> 23395 (+7.80%); split: +7.84%, -0.05%
Instrs: 5677920 -> 5681438 (+0.06%); split: -0.01%, +0.07%
Cycles: 280715524 -> 280895676 (+0.06%); split: -0.00%, +0.07%
VMEM: 981142 -> 981894 (+0.08%); split: +0.18%, -0.10%
SMEM: 243315 -> 243454 (+0.06%); split: +0.07%, -0.02%
VClause: 88991 -> 89767 (+0.87%); split: -0.02%, +0.89%
SClause: 200660 -> 200659 (-0.00%); split: -0.00%, +0.00%
Copies: 430729 -> 434160 (+0.80%); split: -0.07%, +0.86%
Branches: 158004 -> 158021 (+0.01%); split: -0.01%, +0.02%

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/8523>

3 years agoradv: fix max_waves estimation on GFX10.3
Rhys Perry [Tue, 19 Jan 2021 10:59:47 +0000 (10:59 +0000)]
radv: fix max_waves estimation 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/8523>

3 years agozink: enable WSI-faking for RADV too
Mike Blumenkrantz [Thu, 31 Dec 2020 17:47:58 +0000 (12:47 -0500)]
zink: enable WSI-faking for RADV too

temporary until we get real WSI support

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

3 years agozink: add VK_KHR_driver_properties
Mike Blumenkrantz [Wed, 20 Jan 2021 14:24:43 +0000 (09:24 -0500)]
zink: add VK_KHR_driver_properties

yet another extension that breaks naming conventions for structs/enums,
even if it does so in a very sensible way

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

3 years agost/mesa: fix pbo upload/download for arrays of textures with only 1 layer
Andrii Simiklit [Mon, 18 Jan 2021 12:42:05 +0000 (14:42 +0200)]
st/mesa: fix pbo upload/download for arrays of textures with only 1 layer

Having only one layer we can put 0 as third texture coordinate

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4115
Fixes: 36097fc7 ("st/pbo: fix pbo uploads without PIPE_CAP_TGSI_VS_LAYER_VIEWPORT and skip gs")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8576>

3 years agoci: exclude one CTS test that timeout most of the time for RADV CI
Samuel Pitoiset [Wed, 20 Jan 2021 09:09:33 +0000 (10:09 +0100)]
ci: exclude one CTS test that timeout most of the time for RADV CI

dEQP is too slow.

Cc: <mesa-stable@lists.freedesktop.org>
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/8587>

3 years agoturnip: don't emit tess consts if they are not used
Danylo Piliaiev [Tue, 19 Jan 2021 16:29:03 +0000 (18:29 +0200)]
turnip: don't emit tess consts if they are not used

If tess consts aren't used they don't get included in constlen,
and we risk overrunning consts of the next stage.

Fixes:
 dEQP-VK.tessellation.invariance.outer_edge_index_independence.quads_fractional_even_spacing_ccw
 dEQP-VK.tessellation.invariance.outer_triangle_set.quads_fractional_odd_spacing
 dEQP-VK.tessellation.invariance.primitive_set.isolines_fractional_odd_spacing_ccw
 dEQP-VK.tessellation.invariance.primitive_set.quads_fractional_odd_spacing_cw

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4117

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8578>

3 years agov3d/compiler: enable lower_add_sat NIR option
Alejandro Piñeiro [Wed, 20 Jan 2021 09:50:07 +0000 (10:50 +0100)]
v3d/compiler: enable lower_add_sat NIR option

We are enabling this option for the Vulkan driver, so it makes sense
to enable it for the OpenGL one.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8582>

3 years agov3dv/pipeline: enable lower_add_sat NIR option
Alejandro Piñeiro [Tue, 19 Jan 2021 12:48:46 +0000 (13:48 +0100)]
v3dv/pipeline: enable lower_add_sat NIR option

We don't support them by hw, so we would need to get them
lowered. This fix some crashes while using renderdoc with UE4 shooter
demo traces.

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

3 years agor600: Enable sb also for NIR
Gert Wollny [Mon, 18 Jan 2021 12:03:57 +0000 (13:03 +0100)]
r600: Enable sb also for NIR

Currently, r600/nir doens't have a proper scheduler or optimizer backend,
to be able to make use of this code path without performance regressions,
we enable the sb optimizer also for NIR.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/sb: fall back to un-optimized byte code when ra_init fails
Gert Wollny [Mon, 18 Jan 2021 16:28:49 +0000 (17:28 +0100)]
r600/sb: fall back to un-optimized byte code when ra_init fails

Some emulated fp64 piglit create code that seems to make the register
allocation with sb worse than the original shader created from NIR, so
fall back to using the un-optimized shader.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/sb: fix boundary assert for mem-instruction decoding
Gert Wollny [Mon, 18 Jan 2021 16:09:07 +0000 (17:09 +0100)]
r600/sb: fix boundary assert for mem-instruction decoding

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/sfn: Keep array registers alive for the whole shader
Gert Wollny [Mon, 18 Jan 2021 12:02:44 +0000 (13:02 +0100)]
r600/sfn: Keep array registers alive for the whole shader

This is needed when using sb as a post-optimizer.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/sfn: update shader array info
Gert Wollny [Sun, 17 Jan 2021 19:58:32 +0000 (20:58 +0100)]
r600/sfn: update shader array info

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/nir: pass array info to r600_shader for sb
Gert Wollny [Sun, 17 Jan 2021 18:10:36 +0000 (19:10 +0100)]
r600/nir: pass array info to r600_shader for sb

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/sb: Add support for INTERP_X and INTERP_Z ops
Gert Wollny [Mon, 18 Jan 2021 17:04:16 +0000 (18:04 +0100)]
r600/sb: Add support for INTERP_X and INTERP_Z ops

v2: Fix parsing the 2-slot instructions

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600: Add flags to INTERP_X and INTERP_Z two-slot ops
Gert Wollny [Mon, 18 Jan 2021 17:03:39 +0000 (18:03 +0100)]
r600: Add flags to INTERP_X and INTERP_Z two-slot ops

v2: use the gap in the enum bit field to add the 2-slot bit

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/sfn: fix use of b32all/and
Gert Wollny [Sun, 17 Jan 2021 16:55:56 +0000 (17:55 +0100)]
r600/sfn: fix use of b32all/and

Fixes: f79b7fcf7c7f5db626efdb63f27e8bc64d0aed77
       r600/sfn: use 32 bit bools

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agor600/nir: clone shader before first query to shader key
Gert Wollny [Tue, 19 Jan 2021 20:04:00 +0000 (21:04 +0100)]
r600/nir: clone shader before first query to shader key

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>

3 years agov3d: use a compatible supported format for TFU-based blit
Juan A. Suarez Romero [Thu, 14 Jan 2021 12:56:32 +0000 (13:56 +0100)]
v3d: use a compatible supported format for TFU-based blit

When trying to blit using the TFU, as we are doing an exact copy with no
conversions, we can choose a supported format that is compatible with the
underlying format's texel size.

This allows to use the TFU to blit formats that are not supported, like
r8ui or r16ui.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8495>

3 years agoRevert "mesa: allow half float textures based on ARB_half_float_pixel"
Kenneth Graunke [Tue, 12 Jan 2021 21:59:14 +0000 (13:59 -0800)]
Revert "mesa: allow half float textures based on ARB_half_float_pixel"

This reverts commit aca67a555c011f59c37b05544eecbeea9aa42f3e, which
regressed the following Piglit test on i915 (and presumably r200):

   piglit/spec/!opengl 1.1/sized-texture-format-channels

Specifically, it begins testing glTexImage2D with format GL_RGBA,
type GL_FLOAT, and internalFormat GL_RGB16F, which leads to the
following error:

   Mesa 21.0.0-devel implementation error: unexpected format GL_RGB16F in _mesa_choose_tex_format()
   Please report at https://gitlab.freedesktop.org/mesa/mesa/-/issues
   sized-texture-format-channels: ../../src/mesa/main/teximage.c:2836: _mesa_choose_texture_format: Assertion `f != MESA_FORMAT_NONE' failed.

i915 and r200 unconditionally support ARB_half_float_pixel, but neither
support RGB16F as an internal format.  According to Ian's rationale
in the commit message for 1edca151a00134778b959366d5e7c0a3b63cc8f7
(which enabled that extension for all drivers):

    "This extension only adds data types that can be passed to, for
     example, glTexImage2D.  It does not add internal formats.  Since
     you can already pass GL_FLOAT to glTexImage2D this shouldn't pose
     any additional issues with those drivers.  Note that r200 and i915
     already supported this extension, and they don't support
     floating-point textures either."

So, commit aca67a55c011 enabled half-float internal formats on hardware
that cannot support them.  We should revert the change.

v2: Don't reintroduce the _mesa_is_gles3() condition, as that shouldn't
    be necessary (feedback from Erik Faye-Lund).

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8458>

3 years agotnl: Reset nr_bos to 0 between map/unmap cycles.
Kenneth Graunke [Fri, 15 Jan 2021 09:02:35 +0000 (01:02 -0800)]
tnl: Reset nr_bos to 0 between map/unmap cycles.

_tnl_draw_prims loops over the prims, and for each one, maps the VBOs,
draws, and unmaps them.  But it failed to reset nr_bos = 0 between each
loop iteration, which meant that when processing prim[n], the BO list
had all BOs for prior primitives too.  Assuming each primitive used the
same VBOs, that means the same VBO would appear in the list multiple
times, and it would try to unmap the same BO multiple times.  This
triggered asserts on the second unmap, as it had already been unmapped.

Fixes Piglit's oes_draw_elements_base_vertex-multidrawelements on i915.

Fixes: e99e7aa4c1d ("mesa: switch Draw(Range)Elements(BaseVertex) calls to DrawGallium")
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8522>

3 years agotnl: Respect `start` when converting indices to GLuint
Kenneth Graunke [Fri, 15 Jan 2021 08:40:18 +0000 (00:40 -0800)]
tnl: Respect `start` when converting indices to GLuint

Prior to commit e99e7aa4c1ddd7b8c2c4388f4f8e4fa1955ca771 (mesa: switch
Draw(Range)Elements(BaseVertex) calls to DrawGallium), the indices
parameter of glDrawElements (an offset into the VBO) was handled by
setting ib->ptr.  With that commit, it instead began binding the
index buffer with offset 0, and adding the offset to draw->start,
which eventually becomes prim->start.

t_draw.c's bind_indices() was trying to convert the relevant section of
the index buffer to GLuints, but was failing to account for start, so
it nabbed the wrong portion of the index buffer.

Fixes: e99e7aa4c1d ("mesa: switch Draw(Range)Elements(BaseVertex) calls to DrawGallium")
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8522>

3 years agotnl: Try not to botch index buffer munging when start > 0.
Kenneth Graunke [Thu, 14 Jan 2021 23:45:20 +0000 (15:45 -0800)]
tnl: Try not to botch index buffer munging when start > 0.

Commit 4c751ad67aa2bbde5897030495f86e31c9e1fda7 (vbo/dlist: use a shared
index buffer) caused multiple draws to use the same index buffer, and
began setting the primitive's `start` field to the offset needed to
access the right portion of the index buffer.

Unfortunately, t_rebase_prims completely botches handling this case.
Say for example we had start = 40, min_index = 6, max_index = 11.
The actual indexes in the buffer are ib[40..45].  t_rebase_prims,
however, would allocate an index buffer containing only 6 elements,
and populate them with <ib[0..5] - min_index>.  For one, this reads
the wrong source data, leading to garbage index values.  For another,
it stores the new index buffer in the wrong spot, so drawing will try
and read elements [40..45] of an array of length 6, and crash.

This patch makes t_rebase_prims allocate a larger index buffer, with
the blank space at the beginning, and try to copy the correct section
of index buffer data over.  This only works if `start` is the same for
all primitives, however, so if we detect different ones, we recurse
to rebase and call draw() separately for each different start value.

Fixes: 4c751ad67aa ("vbo/dlist: use a shared index buffer")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4082
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8522>

3 years agovbo: Only mark merged line strips as lines when actually converting them
Kenneth Graunke [Fri, 15 Jan 2021 01:29:14 +0000 (17:29 -0800)]
vbo: Only mark merged line strips as lines when actually converting them

We only convert line strips to lines in certain cases, but were flagging
node->merged.prim as GL_LINES even if we simply copied a GL_LINE_STRIP
prim[0] over without modifying it.

Fixes Piglit's lineloop test (which triggers loop -> strip conversion
earlier in this path, then was incorrectly triggering strip -> list
mode modification with no changes to the underlying data).

Fixes: 310991415ee ("vbo/dlist: implement primitive merging")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8522>

3 years agovbo: Don't set node->min_index = max_index = indices_offset when merging
Kenneth Graunke [Thu, 14 Jan 2021 23:42:01 +0000 (15:42 -0800)]
vbo: Don't set node->min_index = max_index = indices_offset when merging

I'm can't see why this is necessary.  There are already new fields
(node->merged.{min,max}_index) for the new values in the merged case.
But in vbo_save_draw.c, in the !draw_using_merged_prim case, we would
try and use the original node...with the now destroyed min/max index.

Fixes some assert failures when running with swtnl and forcing the
non-merged path (though it takes the merged path by default).

Fixes: 4c751ad67aa ("vbo/dlist: use a shared index buffer")
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8522>

3 years agor600/sfn: Remove StoreMerger unused member b.
Vinson Lee [Sun, 17 Jan 2021 01:28:03 +0000 (17:28 -0800)]
r600/sfn: Remove StoreMerger unused member b.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8540>

3 years agoci/piglit: Upgrade to a newer piglit in our containers.
Eric Anholt [Thu, 14 Jan 2021 00:58:50 +0000 (16:58 -0800)]
ci/piglit: Upgrade to a newer piglit in our containers.

Pulls in test fixes for rasterpos on softpipe and for
simple-barrier-atomics on freedreno.  Note that many xfail-vs-xskips end
up changing, because apparently the

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

3 years agointel/fs: Separate SLM size calculation from encoding
Caio Marcelo de Oliveira Filho [Thu, 25 Jun 2020 20:58:36 +0000 (13:58 -0700)]
intel/fs: Separate SLM size calculation from encoding

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8486>

3 years agomesa/main: Replace the uint format packing code with util/format's.
Eric Anholt [Fri, 15 Jan 2021 20:51:17 +0000 (12:51 -0800)]
mesa/main: Replace the uint format packing code with util/format's.

Cuts another 60kb of generated code from Mesa drivers.

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

3 years agomesa/main: Replace float pack function with util_format_pack_rgba().
Eric Anholt [Fri, 15 Jan 2021 20:22:48 +0000 (12:22 -0800)]
mesa/main: Replace float pack function with util_format_pack_rgba().

Less main-specific code when we're pulling in util/ formats anyway.  Drops
about 20kb from Mesa drivers.

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

3 years agoswrast: Use util_format_write_4/4ub for the scattered pixel writes.
Eric Anholt [Fri, 15 Jan 2021 20:33:45 +0000 (12:33 -0800)]
swrast: Use util_format_write_4/4ub for the scattered pixel writes.

This was the only code using the "get a pack-a-pixel function pointer"
generated code, switch it over to using util/format's.

This does mean some more format desc lookups in the loop, but this code is
only accessible from classic driver swrast fallbacks at this point, where
GPU read perf completely dominates the profile anyway.

basically no change to driver size.

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

3 years agoradv: flush L2 for images affected by the pipe misaligned issue on GFX10+
Samuel Pitoiset [Mon, 18 Jan 2021 10:19:20 +0000 (11:19 +0100)]
radv: flush L2 for images affected by the pipe misaligned issue on GFX10+

In some rare cases, L2 needs to be flushed if an image is affected
by the pipe misaligned issue. This is roughly based on AMDVLK.

I confirmed that disabling TC-compat HTILE, and respectively DCC,
for the relevant images also fixes the regressions below.

This fixes some regressions introduced with L2 coherency for
dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_* and for
dEQP-VK.renderpass2.suballocation.multisample_resolve.*.

Fixes: 4a783a3c784 ("radv: Use L2 coherency on GFX9+.")
Co-Authored-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
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/8557>

3 years agoradv: restore invalidating the vector cache for internal meta operations
Samuel Pitoiset [Tue, 19 Jan 2021 09:16:37 +0000 (10:16 +0100)]
radv: restore invalidating the vector cache for internal meta operations

The driver used to invalidate the vector cache for meta operations
but this has been removed and I think it should be restored to fix
a bunch of regressions on GFX8.

This probably needs to be cleaned up but this is a hotfix.

This fixes a bunch of regressions and flakes on GFX8 like
dEQP-VK.pipeline.multisample.sample_locations_ext.draw.color.samples_4.*.

Fixes: 8f8d72af555 ("radv: Use access helpers for flushing with meta operations.")
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/8573>

3 years agoradv: enable TC-compat HTILE for D16S8 on GFX9+
Samuel Pitoiset [Mon, 18 Jan 2021 15:04:54 +0000 (16:04 +0100)]
radv: enable TC-compat HTILE for D16S8 on GFX9+

I don't know why this wasn't enabled but I think it should be.

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/8562>

3 years agoradv: enable TC-compat HTILE with D32S8 and MSAA on GFX9+
Samuel Pitoiset [Mon, 18 Jan 2021 15:02:56 +0000 (16:02 +0100)]
radv: enable TC-compat HTILE with D32S8 and MSAA on GFX9+

Only GFX8 has some depth/stencil resolve failures.

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/8562>

3 years agoradv: add a comment explaining the micro tile mode resolve
Samuel Pitoiset [Tue, 19 Jan 2021 07:26:42 +0000 (08:26 +0100)]
radv: add a comment explaining the micro tile mode resolve

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/8558>

3 years agofrontend/dri: fix doesn't support RGBA ordering still expose RGBA in config
cheyang [Mon, 18 Jan 2021 06:20:16 +0000 (14:20 +0800)]
frontend/dri: fix doesn't support RGBA ordering still expose RGBA in config

Signed-off-by: cheyang <cheyang@bytedance.com>
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8553>

3 years agoaco: add test for incorrect convert_to_SDWA() check
Rhys Perry [Tue, 19 Jan 2021 14:50:33 +0000 (14:50 +0000)]
aco: add test for incorrect convert_to_SDWA() check

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/8577>

3 years agoaco: fix convert_to_SDWA() check in add_subdword_definition()
Rhys Perry [Tue, 19 Jan 2021 14:34:40 +0000 (14:34 +0000)]
aco: fix convert_to_SDWA() check in add_subdword_definition()

v_or_b32 with a v2b definition should use SDWA if is_partial=true.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 56345b8c610 ("aco: allow reading/writing upper halves/bytes when possible")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8577>

3 years agozink: process ubos with location values set as long as they're actually ubos
Mike Blumenkrantz [Fri, 14 Aug 2020 21:37:41 +0000 (17:37 -0400)]
zink: process ubos with location values set as long as they're actually ubos

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8514>

3 years agozink: tweak xfb slot mapping in ntv
Mike Blumenkrantz [Fri, 14 Aug 2020 21:34:17 +0000 (17:34 -0400)]
zink: tweak xfb slot mapping in ntv

ARB_enhanced_layouts allows specifying overlapping variable locations
for xfb outputs, so we need to explode the arrays here to a full 128
components so we can do per-component mapping

sometimes this fails though, as in the case where xfb is just selecting
a single component from a vec but still considering the whole slot, and
so for those cases we just decrement our array index until we get to the
base, which will be within 3 components

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8515>

3 years agointel: change urb max shader geometry for CML GT1
Abhishek Kumar [Mon, 18 Jan 2021 04:54:23 +0000 (10:24 +0530)]
intel: change urb max shader geometry for CML GT1

Below deqp cts failure is seen on CML GT1 only , GT2 all test
passes, changing the max shader geometry to 256 (previous 640)
fixes all failure tests.Similar issue on BDW GT1
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3173

dEQP-GLES31.functional.geometry_shading.layered.
render_with_default_layer_cubemap
render_with_default_layer_3d
render_with_default_layer_2d_array

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4102

Signed-off-by: Abhishek Kumar <abhishek4.kumar@intel.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8550>

3 years agov3dv: use PIPE_TIMEOUT_INFINITE
Iago Toral Quiroga [Tue, 19 Jan 2021 07:24:04 +0000 (08:24 +0100)]
v3dv: use PIPE_TIMEOUT_INFINITE

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8554>

3 years agov3dv: don't wait for idle on occlusion query pool resets
Iago Toral Quiroga [Fri, 18 Dec 2020 11:51:08 +0000 (12:51 +0100)]
v3dv: don't wait for idle on occlusion query pool resets

Instead, wait for the specific queries being reset to
not be in use by the GPU.

This takes query pool resets in the UE4 Shooter demo from
50-60ms down to 0.5-2ms.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8554>

3 years agov3dv: disable early Z writes if Z writes are disabled
Iago Toral Quiroga [Tue, 19 Jan 2021 07:54:52 +0000 (08:54 +0100)]
v3dv: disable early Z writes if Z writes are disabled

I saw this while inspecting CL dumps from the UE Shooter demo,
where they disable Z writes for occlusion queries. The hardware
is probably doing this internally, but it doesn't hurt
to do this explicitly and make CL traces consistent with intended
behavior.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8571>

3 years agoradeonsi: inhibit clockgating when using SQTT
Pierre-Eric Pelloux-Prayer [Wed, 13 Jan 2021 20:20:42 +0000 (21:20 +0100)]
radeonsi: inhibit clockgating when using SQTT

Ported from PAL.

Fixes: 07c1504d1b0 ("radeonsi: implement SQTT support")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8480>

3 years agov3dv: only update uniforms for dirty descriptors if stage has descriptors
Iago Toral Quiroga [Tue, 5 Jan 2021 08:02:13 +0000 (09:02 +0100)]
v3dv: only update uniforms for dirty descriptors if stage has descriptors

If we have dirty descriptor set state we have to update our uniform
data to reference the new resources such as addresses for textures
or UBOs. This is known to have a high CPU cost, so we want to limit
this as much as we can.

It is a common rendering pattern in applications to render many objects
using the same pipeline, but modifying the descriptor sets bound to update
textures, UBOs, etc. In this scenario, we would be incurring in unnecessary
uniform stream updates for stages that don't access descriptor sets at all.

This change makes it so we track which shader stages in a pipeline
use descriptor set state and skips updating uniform streams for them
when dirty descriptor set state is the only reason requiring us to
generate new uniform streams for a draw call.

v2: reuse shader stage information from the pipeline set layouts
    to track shader stages that use descriptor state.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8555>