Commit Graph

153184 Commits

Author SHA1 Message Date
Rob Clark f3fb1d6632 drm-shim: Cleanup on device file close
Avoid leaking memory when the device file is closed, dropping bo
references and freeing the shim_fd.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>
2022-05-02 19:50:33 +00:00
Rob Clark 409b76511c freedreno/drm-shim: Better iova handling
We actually want to use util_vma to handle this.  But fortunately core
drm-shim alredy does this for mem offset, we can just delete a bunch of
code and re-use that.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>
2022-05-02 19:50:33 +00:00
Rob Clark 6c465ad6c7 drm-shim: Add error handling for bo_init()
Don't assert, return an error.  If we are fuzzing something using
drm-shim, we want to be more like the kernel and return an error
for OoM situation, rather than falling over.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>
2022-05-02 19:50:33 +00:00
Rob Clark c4b5ebe1fc drm-shim: Better mmap offsets
Using the bo pointer address as the offset doesn't go over well when
someone is fuzzing you.  But we already have the mem_addr, we can simply
use that instead.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>
2022-05-02 19:50:33 +00:00
Rob Clark 97f4e48717 freedreno/drm-shim: Robustify error handling
We can't be so sloppy if we are using drm-shim for fuzzing.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>
2022-05-02 19:50:33 +00:00
Rob Clark d06fc7bb4f freedreno/drm-shim: Update to latest uapi version
Needed for fuzzing virgl drm native context.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>
2022-05-02 19:50:33 +00:00
Rob Clark a922997ffd drm-shim: Add GET_UNIQUE support
Needed by drmOpenWithType(), which is used by virgl drm native context.
(We want to use drm-shim for fuzzing.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16250>
2022-05-02 19:50:33 +00:00
Iván Briano bf04be17f7 vulkan/wsi/wayland: Fix double free on error condition
If wsi_configure_native_image() fails, it will call
wsi_destroy_image_info() itself, so let's try to not call it again from
wsi_wl_swapchain_destroy().

Fixes the CTS tests:
dEQP-VK.wsi.wayland.swapchain.simulate_oom.*

Fixes: b626a5be43 ("vulkan/wsi/wayland: Split image creation")

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16257>
2022-05-02 19:26:27 +00:00
Lionel Landwerlin 1e7ea18026 vulkan/runtime: 0-out pipeline cache object
I'm running into crashes because cache->cache_object is uninitialized.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 591da98779 ("vulkan: Add a common VkPipelineCache implementation")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16275>
2022-05-02 19:02:42 +00:00
Caio Oliveira 7cd9adeb41 intel/compiler: In XeHP prefer <1;1,0> regions before compacting
Ken performed some tests with shader-db to evaluate the effects

```
Across all 145,848 shaders generated, the results were:

Total bytes compacted before: 3,326,224
Total bytes compacted after: 60,963,280
```

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15399>
2022-05-02 18:03:01 +00:00
Mike Blumenkrantz 562fd98998 llvmpipe: add a ci flake
not able to repro locally

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16280>
2022-05-02 17:46:08 +00:00
Jesse Natalie 2505afc430 d3d12: Destroy empty residency bo set during early-return
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 1e940f2ccf d3d12: Fix a couple over-releases from incorrect take-ownership flag
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 32c1b5fd05 d3d12: Fix leaks in map with do-not-wait
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 5b46ef9857 d3d12: Use a pipe_reference in d3d12_bo
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 8de1e310a7 u_primconvert: Handle take_index_buffer_ownership
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 12d88d500d u_primconvert: Refactor to remove recursion from util_primconvert_draw_vbo
This prevents having unused copies of pipe_draw_info and
pipe_draw_start_count_bias on the stack, and makes it easier to do
things once for a multi-draw, which will matter in the next patch.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 0474bbcfb9 u_debug_stack: Lock around stack dumps to prevent interleaving
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 303c2754a3 u_debug_symbol: Allow re-init of DbgHelp to work around already-initialized issues
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie f51840d87c u_debug_symbol: Use correct sizeof for DbgHelp
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie d8024b2504 u_debug_refcnt: Don't loop for initial refcounts if the initial value is huge
Some components use very large refcounts to bypass atomics in single-threaded
cases, and this produces near-infinite loops when these resources are created.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 0bcb5f919e bin: Add a script for filtering/sorting refcount logs
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16182>
2022-05-02 16:58:20 +00:00
Jesse Natalie 53a94fbdd5 mesa: Ensure ARB programs end in a newline
If the last line of an ARB program has a comment, the program will
fail to parse, because the lexer only considers a comment valid if
it ends in a newline, not EOF. The parser then fails on the '#'.

Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16230>
2022-05-02 16:02:54 +00:00
Jesse Natalie 9f37579e1b d3d12: Correctly key off of polygon stipple enable cap
Apparently we were only keying off the presence of a real stipple pattern
being set, and completely ignoring when the app does glDisable().

Add in the actual enable bit as an additional discriminator to determine
if we should be doing polygon stippling.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16254>
2022-05-02 15:56:05 +00:00
Alyssa Rosenzweig ce6d5094c8 pan/va: Add non-IDVS VAR_TEX instructions
Used in blit shaders.

Icecream95 supplied the test cases.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:25 -04:00
Alyssa Rosenzweig 030e00dea2 pan/va: Add VAR_TEX_BUF_GRADIENT instruction
Probably useful for ... something.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:25 -04:00
Icecream95 0b17ea7536 pan/va: Improve texture instructions
[Alyssa: Related improvements.]

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Icecream95 2bfcfa005d pan/va: Add absneg modifier to V2F32_TO_V2F16
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Icecream95 35c3073fc2 pan/va: Add SEG_ADD/SEG_SUB operation
[Alyssa: Fixes to the instruction.]

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Icecream95 822dfb76de pan/va: Add more transcendental operations
TODO: Make the secondary opcode field wider so that FATAN_ASSIST can
be split into two instructions

[Alyssa: Fixes to the hardware behaviour.]

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Icecream95 1015e527cd pan/va: Improvements to LEA_TEX instructions
[Alyssa: Fixes to match hardware.]

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Alyssa Rosenzweig d831a13c70 pan/va: Mark NOT instructions as deprecated
The inverters on the bitwise ops should be used instead.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Alyssa Rosenzweig 06562fd78b pan/va: Add missing TABLE (SFU) instructions
Equivalent to their Bifrost predecessors.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Alyssa Rosenzweig e6ea15a73a pan/va: Generalize message? check for asm
Allows passing more uniforms in more places. We'll use this in a test case in a
moment.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>
2022-05-02 11:11:08 -04:00
Alyssa Rosenzweig 3641dfe436 panfrost: Flip point coords in hardware
On Bifrost, this is very easy: there's an RSD bit to Y-flip gl_PointCoord. It
should map perfectly to the Gallium bit. With this change, we no longer use
lower_pntc_ytransform on Bifrost, saving a bit of ALU when reading point
coordinates.

On Valhall, this is quite hard: the bit is in the framebuffer descriptor now!
That means it can't be changed in a batch. This is expected to be ok: on GLES
and VK, the origin is controlled only by the framebuffer orientation. It's a
bigger problem on big GL, where GL_POINT_SPRITE_COORD_ORIGIN can be set freely.
To cope, a tri-state data structure is used for the state tracking. This has a
failure case on Valhall: every draw toggling the coord origin. However, the
intention of the ORIGIN state bit is smoothing over coordinate system
differences; it should never /actually/ change once set. Until we see an app
doing something so stupid, I don't think we should worry about.

We need all the Valhall tri-state infrastructure for handling provoking vertices
on big GL anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:56:25 -04:00
Alyssa Rosenzweig 5bab8e6cbe panfrost: Lower user clip planes
Since we don't export the relevant CAP, the state tracker calls
nir_lower_clip_vs for us. However, for some reason we're still responsible for
calling nir_lower_clip_fs. Now that we have sane shader key infrastructure,
let's do so.

Fixes the floor rendering wrong in the title screen of Neverball.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig 013bb50168 panfrost: Lower point sprites on Bifrost
Use the common pass. This only should trigger when drawing points, so we need
some extra tracking to ensure this.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig b6909ebb36 panfrost: Refactor variant rebind code
For point sprite lowering on Bifrost and Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig 39788ac703 panfrost: Refactor variant selection code
Extract the "compile a new variant" routine from the "select and bind a variant"
routine. This allows us to simplify the control flow, eliminating the `compiled`
boolean on the shader structure.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig 755f30fb18 panfrost: Simplify shader key architecture
Rather than clever key compare/initialize code, let's make the shader keys plain
old data. This makes it easier both to extend and to optimize the shader keys.

Keys are compared with a simple memcmp(). I considered a hash table but I don't
think we have enough variants (or large enough keys) to justify the overhead.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig 2c3ed7af53 panfrost: Use s->info.stage instead of tgsi stage
Now that we have the NIR handy.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig 1c5adbb3df panfrost: Don't subclass pipe_compute_state
Just copy the bit we need so the NIR doesn't hang around. This is simpler.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig b834dea889 panfrost: Call tgsi_to_nir earlier
This ensures we always have NIR available in the shader state. It also saves a
(trivial) amount of recomputation if multiple TGSI variants are needed.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig 3f505a8bc1 panfrost: Remove ancient unused code
Leftover scraps.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
2022-05-02 09:55:49 -04:00
Alyssa Rosenzweig 7864f653ad panvk: Emit fragment RSDs even with no shader
In Vulkan, it's possible to create a pipeline with no fragment shader that's
still expected to rasterize. This is useful for depth/stencil side effects, and
is closely related to the "fragment shader required" optimization we do in the
GLES driver. Refactor the RSD emit code to handle this case.

Fixes dEQP-VK.pipeline.stencil.nocolor.*

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>
2022-05-02 13:12:31 +00:00
Alyssa Rosenzweig dcf8cdde68 panvk: Gate rasterization on !discard, not fs req
The "fragment shader required?" computed state is about fragment shader side
effects. There may be no fragment shader required but depth/stencil side effects
meaning that rasterization is nonoptional. What actually gates rasterization is
the rasterizer discard bit. Use that instead.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>
2022-05-02 13:12:31 +00:00
Alyssa Rosenzweig 6d779412e5 panvk: Streamline no shader RSD case
Noticed by inspection.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>
2022-05-02 13:12:31 +00:00
Alyssa Rosenzweig db7d8519f9 panfrost: Only flip point sprites for GL
Fixes dEQP-VK.glsl.builtin_var.simple.pointcoord

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>
2022-05-02 13:12:31 +00:00
Alyssa Rosenzweig ba29cdecab panvk: Use correct point size limits
As determined by Icecream95. Fixes:

dEQP-VK.rasterization.primitive_size.points.point_size_*

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>
2022-05-02 13:12:31 +00:00
Alyssa Rosenzweig 9d84caa4d5 panvk: Ignore point size for !points
Otherwise wide lines break. The alternative approach is to eliminate the points
writes when not drawing points since we do have topology information at compile
time. I'm admittedly stuck in my GL mindset. That's the approach we'll need for
Valhall anyway.

Fixes dEQP-VK.rasterization.interpolation.basic.lines_wide

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>
2022-05-02 13:12:31 +00:00