Commit Graph

156074 Commits

Author SHA1 Message Date
Boris Brezillon d4630b703d dzn: Add a generic cached blob wrapper
Basically what vk_pipeline_cache's raw_data_object abstraction provides,
but I'm not sure it makes sense to make it generic so I copied it here.
Might be more appropriate to make raw_data_object public.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:23 +00:00
Boris Brezillon 06f37025f1 dzn: Hash pipeline layout stages
DXIL shaders depend on the vulkan -> d3d12 binding translation done in
adjust_var_bindings(). In order to maximize our chances to re-use those
shaders, we need to hash the binding translation information and take
this hash into account when computing the DXIL shader hash.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:23 +00:00
Boris Brezillon 391d3251fa dzn: Don't delegate binding translation to dxil_spirv_nir_passes()
We will need to hash var bindings if we want to cache DXIL shaders.
Let's move this pass to dzn_pipeline.c to prepare this transition.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:23 +00:00
Boris Brezillon c7b43711f3 dzn: Save a few indentation levels in graphics_pipeline_compile_shaders()
We can compute the yz_flip_mode and force_sample_rate_shading outside
of the foreach_shader loop.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon 84770a90bb dzn: Use vk_to_mesa_shader_stage()
Use vk_to_mesa_shader_stage() to convert a VkShaderStageFlagBits into
its gl_shader_stage counterpart.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon f4a96675ec dzn: Fix potential nir_shader leak
We leak the nir_shader object f a failure happens between the NIR
shader creation and the DXIL compilation. Let's drop the local
nir_shader pointer and use the one in the graphics_pipeline object
to avoid that.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon af83f104da dzn: Let dzn_pipeline_init() initialize the root signature in the stream
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon 301fb478fe dzn: Drop unused allocator passed to dzn_graphics_pipeline_create()
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon b886619313 dzn: Drop useless while(link_mask != 0)
That's not a `do {} while();`, just a simple `while() {}`, the second
while statement is a NOP.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon 31357f3cf4 dzn: Pass the maximum stream size to d3d12_pipeline_state_stream_new_desc()
This way we can use d3d12_pipeline_state_stream_new_desc() directly
without doing

   if (type == GRAPHICS)
      d3d12_gfx_pipeline_state_stream_new_desc()
   else
      d3d12_compute_pipeline_state_stream_new_desc()

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon e4e531732b dzn: Use d3d12_compute_pipeline_state_stream_new_desc() in the compute path
Fixes: 9feda65a83 ("dzn: Use CreatePipelineState()")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon d3e6ef195a dzn: Fix assertion in d3d12_pipeline_state_stream_new_desc()
Fixes: 9feda65a83 ("dzn: Use CreatePipelineState()")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon 26ca9a4344 dzn: Add missing D3D12_CACHED_PIPELINE_STATE to MAX_COMPUTE_PIPELINE_STATE_STREAM_SIZE
Fixes: 9feda65a83 ("dzn: Use CreatePipelineState()")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon c66caa1d58 dzn: Drop dzn_pipeline_cache.c
The core provides a conformant pipeline cache implementation, let's
use it.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon b59abbe3d5 dzn: Initialize UUIDs
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Boris Brezillon be019e69e2 dzn: Fix indentation
Replace tabs by spaces

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
2022-06-28 13:02:22 +00:00
Matti Hamalainen aab5d176b8 pytracediff: implement pager ('less') invocation internally
In order to get rid of the ntracediff.sh wrapper script, implement
invocation of 'less' internally, if the stdout is determined to
be a tty. Otherwise just print out normally.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17135>
2022-06-28 11:40:58 +00:00
Matti Hamalainen 95fc0e1b7c pytracediff: change how 'junk' calls are handled
Instead of discarding them at parsing phase, let the difflib
SequenceMatcher always ignore them, and optionally suppress
them from output if -I/--ignore-junk option is given.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17135>
2022-06-28 11:40:58 +00:00
Matti Hamalainen cf4d1c1fed pytracediff: make -M ("method only") option print arguments for differing calls
Basically implement the last item on the original feature request list of #4609.

Example: ./pytracediff.py good.xml bad.xml -NM

Or suppress common calls completely via -C, e.g. -NC etc.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17135>
2022-06-28 11:40:58 +00:00
Matti Hamalainen 8819d372e5 pytracediff: add per-line difference highlighting for blocks
Highlight differing _lines_ in the differing blocks, with somewhat
different ANSI colors.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17135>
2022-06-28 11:40:58 +00:00
Matti Hamalainen 3421d9ecad gallium/tools: reimplement tracediff completely in Python
The limitations of current approach for Gallium trace diffing via
'tracediff.sh' are becoming all too apparent, as we are first dumping
both trace to text and performing plain line-based sdiff on them.

This obviously loses the context of calls and sometimes results in
confusing diffs when subsequent calls are similar enough. It also
prevents us from formatting the diff output in ways that would
benefit readability.

In attempt to rectify the situation, reimplement the diffing completely
in Python, using difflib and adding the necessary plumbing into the trace
model objects etc.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17135>
2022-06-28 11:40:58 +00:00
Matti Hamalainen 6f70a1cd14 gallium/tools: add option for ignoring junk calls in trace dumper
Previously tracediff.sh used postprocessing sed-script to remove unwanted
calls from the dump output. Instead of that, add option to parse.py to
ignore a list of calls at parsing phase. Currently this list is hardcoded
in parse.py.

Also clean up the trace model code and pointer tracking a bit to avoid
static state in Pointer class.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17135>
2022-06-28 11:40:58 +00:00
Jose Fonseca 5f00b54873 trace: Allow to control nir dumping via an environment variable.
As requested by Mike Blumenkrantz.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>
2022-06-28 09:54:29 +00:00
Jose Fonseca c5ddb95953 trace: Bring state dump up to speed.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>
2022-06-28 09:54:29 +00:00
Jose Fonseca 0296050c0e trace: Parse character data more efficiently.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>
2022-06-28 09:54:29 +00:00
Jose Fonseca 69fbcdb568 trace: Dump NIR.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>
2022-06-28 09:54:29 +00:00
Jose Fonseca 382c6d395c lavapipe: Prevent mapping buffers beyond their size.
This was breaking trace driver serialization, since it relies upon the
transfer box to know what to serialize.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>
2022-06-28 09:54:29 +00:00
Jose Fonseca b78caa7f7d trace: Fix framebuffer state serialization.
Ensure the argument name is serialized "state" not, "&tr_ctx->unwrapped_state".

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17107>
2022-06-28 09:54:29 +00:00
Boris Brezillon 0371b1707b dzn: Hook-up device-lost detection
Provide a vk_device::check_status() implementation so the code can
call it at key moments to detect when a device-lost event (device-removed
in D3D12) has been received.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17249>
2022-06-28 09:38:27 +00:00
Boris Brezillon 6a491d1628 radv: Use vk_pipeline_hash_shader_stage()
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon d2bb3b11e5 radv: Kill unused fs_m local var in radv_create_shaders()
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon 02384ca13c tu: Use vk_pipeline_hash_shader_stage()
Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon a8cd159538 v3dv: Use vk_pipeline_hash_shader_stage()
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon 863b6317a3 v3dv: Fix nir_shader leaks in v3dv_meta_{clear,copy}()
Reported-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon 17dff363ce anv: Use vk_pipeline_hash_shader_stage()
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon 542538cf02 vulkan: Add a vk_pipeline_hash_shader_stage() helper
All drivers implement some sort of shader hashing, but each of
them does it slightly differently. Let's provide a generic helper
to avoid new copies of the same logic and encourage new drivers
to use one of the already implemented function.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon 5e5b54c9d1 nir/serialize: Silence integer-overflow false positive
Use util_sign_extend() to silence the following integer-overflow
error.

src/compiler/nir/nir_serialize.c:1333:40: runtime error: left shift of 1000165000 by 13 places cannot be represented in type 'int'

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Boris Brezillon 370ca07482 nir/serialize: Support texop >= 16
Extend the packed_instr struct to support texops above
nir_texop_fragment_fetch_amd.

Fixes: 603e6ba972 ("nir: add two new texture ops for multisample fragment color/mask fetches")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17186>
2022-06-28 09:07:32 +00:00
Iago Toral Quiroga cfccd93efc broadcom/compiler: don't predicate postponed spills
The postponed spill is predicated using the condition from the
last write, but this is only correct if the register was only
written once in the TMU sequence, or if it is always written with
the same predication.

While we could try to track whether this is the case or not, it
would make the postponed spill path even more complex than it
already is, so let's just avoid predicating these. We are already
discouraging TMU spilling of registers in the middle of TMU
sequences, so this should not be a very common case.

Cc: mesa-stable
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17201>
2022-06-28 05:49:51 +00:00
Iago Toral Quiroga 98420408d0 broadcom/compiler: fix postponed TMU spills with multiple writes
If we are spilling a register that is used in the middle of a TMU
sequence, we postpone the spill until the TMU sequence finishes,
at which point we inject the spill and rewrite the original
instruction to write to the new temp.

However, this doesn't work if the register is written multiple
times during the TMU sequence. In that scenario, we need to ensure
that all writes are rewritten to use the new temp, not just the last
one.

Cc: mesa-stable
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17201>
2022-06-28 05:49:51 +00:00
Iago Toral Quiroga 0bc65b1d81 v3dv: fix leak
Cc: mesa-stable
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17201>
2022-06-28 05:49:51 +00:00
Mike Blumenkrantz 1951065a16 zink: delete zink_resource_object::dt_has_data
this should be on the swapchain image

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz 314a24998a zink: use kopper_displaytarget type directly
casting this all over is super annoying and unnecessary

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz 6786e508a2 zink: acquire swapchain images on image map
this is a weird one

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz b400f1defc zink: no-op pixmap frontbuffer flush calls
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz 5c5ab9e173 zink: delete zink_resource_object::acquire
this was duplicated from the swapchain object for convenience, but really
it just leads to desync if a swapchain is shared, so use the swapchain
one instead

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz 8ab8b729d6 zink: ensure pending present flushes are handled during frontbuffer flush
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz fbaca89cd9 zink: flag batch as having work during frontbuffer flush
avoids having the flush deferred

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz 8606e5cff8 zink: improve no-op acquire detection
the swapchain may have successfully completed the acquire in a previous
batch, in which case a new acquire is not needed

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00
Mike Blumenkrantz 49d9a3605b zink: remove unnecessary code in kopper readback acquire
this used to be important but no longer is, so modify the loop
code to handle this case implicitly

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17149>
2022-06-28 02:42:02 +00:00