Commit Graph

143233 Commits

Author SHA1 Message Date
Alyssa Rosenzweig 0149dee377 pan/bi: Remove redundant check in clamp fusing
Already checked above.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig 07b259defc pan/bi: Add instruction unit test macro
Checks for instruction equality.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig 6053741610 pan/bi: Add instruction equality helper
Useful for unit testing.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig 0394cc7c1d pan/bi: Add helpers for unit testing
At some point I should stop reinventing GTest but, look, writing tests
at all is big for me, one thing at a time, ok? 😋

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig cdc79d2a03 pan/bi: Output binaries from standalone compiler
Useful for shader replacement.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig 8cbabbd532 pan/bi: Only call clause code on Bifrost
Valhall will have its own simpler code path.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig dc569585a6 pan/bi: Add quirks for Mali G78
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig 18dedd80db pan/bi: Do more mesa/st stuff in standalone compiler
From freedreno.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig f01f5e7168 pan/bi: Zero initialize shader_info
Fixes the following assert with the standalone compiler

bifrost_compiler: ../src/panfrost/bifrost/bi_opt_push_ubo.c:134: bi_opt_push_ubo: Assertion `ctx->info->push.count == 0' failed.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig 027a8bf82c pan/bi: Parse file names in standalone compiler
Would like to compile compute shaders too.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig e5b5132c63 pan/bi: Remove unused option
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Alyssa Rosenzweig 1b85dfb6a5 pan/bi: Remove unused pointer from bi_instr
Yikes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
2021-07-28 00:26:06 +00:00
Mike Blumenkrantz 59951b6f24 zink: use dynamic line stipple
save those pipeline bits!

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12011>
2021-07-27 23:22:19 +00:00
Mike Blumenkrantz b61c96b692 ci: add another zink job with timelines disabled
this codepath needs to be maintained for *vague handwaving*

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12089>
2021-07-27 23:09:47 +00:00
Mike Blumenkrantz 64785df389 zink: add env var to disable timelines
for ci use only

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12089>
2021-07-27 23:09:47 +00:00
Mike Blumenkrantz 627371fe01 zink: export PIPE_CAP_TGSI_BALLOT
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11990>
2021-07-27 22:44:59 +00:00
Mike Blumenkrantz 410d4dc529 zink: remove VK_EXT_shader_subgroup_ballot from device info
restrict this to 1.2 only

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11990>
2021-07-27 22:44:59 +00:00
Mike Blumenkrantz a05693d332 zink: implement compiler handling for subgroup ballot builtins/intrinsics
these are all lowered and unremarkable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11990>
2021-07-27 22:44:59 +00:00
Mike Blumenkrantz 252165d925 zink: lower subgroup ballot instructions
this handles rewrites of ballot-related instructions/builtins to spirv
vec4 types from the native GLSL U64 type

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11990>
2021-07-27 22:44:59 +00:00
Mike Blumenkrantz 4bd6a0299b zink: change descriptor flushing to assert
there should never be flushing due to pool depletion; instead, trigger an
oom flush and stall to replenish the pool after the draw/compute

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12012>
2021-07-27 22:34:21 +00:00
Philipp Zabel 8ba44103b3 etnaviv: fix gbm_bo_get_handle_for_plane for multiplanar images
Implement resource_get_param for PIPE_RESOURCE_PARAM_NPLANES and fix
resource_get_handle to walk to the correct linked resource for
multiplanar images, allowing gbm_bo_get_handle_for_plane to be called
with plane > 0.

This fixes an assert that is triggered when a wayland client tries
to send weston an NV12 dmabuf, for example:

  weston: .../mesa/src/gbm/backends/dri/gbm_dri.c:752: gbm_dri_bo_get_handle_for_plane: Assertion `plane == 0' failed.

Fixes: 788f6dc857 ('Revert "gallium/dri: fix dri2_from_planar for multiplanar images"')
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12037>
2021-07-27 23:13:57 +02:00
Rohan Garg f1cd56cdc1 virgl: Enable caching for sampler views and render targets
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/11241>
2021-07-27 20:34:38 +00:00
Rohan Garg 8cb795b477 Revert "Revert "virgl: Cache depth and stencil buffers""
This reverts commit a8e75bb73c.

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/11241>
2021-07-27 20:34:38 +00:00
Rohan Garg a425c5df78 virgl: Add more meta data to cached resources
By expanding the meta data about resources in the cache we can match more
resources such as 3D textures, samplers and render targets.

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/11241>
2021-07-27 20:34:38 +00:00
Alyssa Rosenzweig 8d104a387a pan/va: Integrate the tests into meson test
This way we will get testing in CI. Invoke as

   meson test --suite=panfrost

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig b2046750c4 pan/va: Add disassembler test harness
Uses the same set of cases. This is a standalone C program because the
easy way of hooking into the disassembler from Python with subprocesses
was slow. This seems cleaner anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig f917fb63e7 pan/va: Add assembler test harness
Integration regression testing. Nothing fancy.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig 372879cf6c pan/va: Add negative test cases for the assembler
These are lines of assembly that look valid but are not, and should
raise a parser error but not otherwise crash the assembler or produce
invalid code.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig 70430d322f pan/va: Add dis/assembler test cases
These are valid pairs of hexdumped assembled instructions and the
corresponding disassembly, to be used to regression test both the
assembler and the disassembler.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig 688827f3c5 pan/va: Add disassembler generator
When we bring up the Valhall compiler in Mesa, we will like to have a
disassembler in native code, so we shouldn't write our disassembler in
Python. Instead, we write a disassembler generator in Python with mako
templates, which will produce a va_disasm_instr entrypoint from the
architecture defined in ISA.xml and valhall.py.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig 227547db48 pan/va: Check for FAU conflicts in the assembler
Logic described in the "Uniform/constant restrictions" section of the
Valhall specification. (You know, my Valhall specification. Is there
another one?)

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig 508dfba913 pan/va: Add Valhall assembler
This Python script acts as a standalone assembler. It takes Valhall
instructions with Mesa-flavour syntax, parses them, errors out if there
are syntax errors, and writes out an assembled binary if there are not.
It also is available as a programmatic interface for automated testing.

While this attempts to handle syntax errors, it does not check
semantics. It will happily compile programs that fault, provided each
instruction locally 'looks' plausible.

The code itself is quite small, despite supporting most of the known
ISA, because the syntax is regular and the heavylifting is done by
ISA.xml and valhall.py.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig c43327c049 pan/va: Assert no instructions are duplicated
Caught a bug in the published PDF. Whoops!

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig 02e378b628 pan/va: Add ISA.xml parser and support code
This Python module parses the ISA.xml file added in the previous
commits, extracts all the useful information, and combines it with
extra annotations. In total, it provides a programmatic way to interface
with the Valhall instruction set.

   from valhall import instructions, enums

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
Alyssa Rosenzweig 316486dd9f pan/va: Add initial ISA.xml for Valhall
This handwritten file is the product of over a hundred hours of
reverse-engineering and represents the sum of what I've learned about
the Valhall architecture. It will be used in the next commits as the
backbone of a Valhall toolchain.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12025>
2021-07-27 20:20:32 +00:00
suijingfeng 44aa7e25dd llvmpipe: correct the debug information printed with GALLIVM_PERF=nopt
GALLIVM_PERF_NO_OPT is "belond" to GALLIVM_PERF environment variable,
not GALLIVM_DEBUG. when GALLIVM_PERF=nopt is passed to llvmpipe,
"-sroa -early-cse -simplifycfg -reassociate -constprop -instcombine -gvn"
should not be printed. Those llvm optimation techniques should only be
printed when the default(-O2) optimation is enabled.

$ GALLIVM_PERF=nopt GALLIVM_DEBUG=dumpbc glmark2

Before apply this patch:

  Invoke as "opt -sroa -early-cse -simplifycfg -reassociate -mem2reg -constprop -instcombine -gvn ir_setup_variant_0.bc | llc -O2 [-mcpu=<-mcpu option>] [-mattr=<-mattr option(s)>]"

After apply this patch:

  Invoke as "opt -mem2reg ir_fs304_variant0.bc | llc -O0 [-mcpu=<-mcpu option>] [-mattr=<-mattr option(s)>]"

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: suijingfeng <suijingfeng@loongson.cn>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11994>
2021-07-27 19:57:21 +00:00
Lepton Wu 7ff30a0499 gallium: Reset {d,r}Priv in dri_unbind_context
The code in dri_make_current just checks the value of the pointers
to decide to update texture_stamp or not. This is buggy since a new
allocated drawable could share the same address with the previous
released drawable. Fix the stale pointer issue by always resetting
these pointers to NULL in dri_unbind_context.

v2:
   Move the reset codes to the end of the function.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Cc: mesa-stable
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12050>
2021-07-27 18:40:11 +00:00
Jason Ekstrand 49908c602f anv/android: Rework our handling of AHardwareBuffer imports
The current code we have for this is a bit of a mess, likely due to
trying too hard to put it in anv_android.c.  The external_format bit in
anv_image, for instance, really means "quit creation early" which is
something we want to do for AHardwareBuffer imports regardless of
whether or not they use a native format.  It gets set both by declaring
an AHardwareBuffer external handle type and by VkExternalFormatANDROID.
However, VkExternalFormatANDROID is only allowed for AHardwareBuffer
imports.  If we ever did get an external format outside the context of
an AHardwareBuffer import, we would end up with a useless partially
created image.

When we detect an AHardwareBuffer import, we punt off to a function in
anv_android.c that does nothing interesting but call anv_create_image
with AUX disabled and external_format = true.  The aux disable here is
useless because the actual isl_surf layout is done by resolve_ahw_image
which also sets ISL_SURF_USAGE_DISABLE_AUX_BIT.  As far as external
formats go, anv_image_from_external() sets it regardless of whether or
not there is actually an external format.

This commit replaces anv_image::external_format with anv_image::from_ahb
which is the thing we actually want to track for this.  We delete
anv_image_from_external and a bunch of the external_format handling
because it's all useless.  The end result is massively simpler and,
while it appears to blur the boundary between Android code and the rest
of the driver, it makes the whole flow more obvious.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12040>
2021-07-27 14:45:28 +00:00
Connor Abbott d903f51631 tu: Triage some CTS failures
These should be fixed by the linked VK-GL-CTS change. I couldn't
reproduce the other renderpass failure on a650 though.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12065>
2021-07-27 13:55:46 +00:00
Tomeu Vizoso 59c2337f22 panvk: Implement vkCmdClearAttachments
For now it only supports one RT and color attachments.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12019>
2021-07-27 15:18:35 +02:00
Tomeu Vizoso cd97eb123e panvk: Expose panvk_cmd_alloc_fb_desc and panvk_cmd_alloc_tls_desc
For use in panvk_meta.c.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12019>
2021-07-27 15:18:35 +02:00
Tomeu Vizoso f295e7f1d9 panvk: A pipeline might not be bound when the render pass is ended
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12019>
2021-07-27 15:18:34 +02:00
Tomeu Vizoso 7a0acc35af panvk: Move check for fragment requirement up to the draw
As the panvk_cmd_alloc_fb_desc function might be called outside a draw,
without a pipeline having been bound to the command buffer.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12019>
2021-07-27 15:18:34 +02:00
Tomeu Vizoso cef56d5824 panvk: Close batch when ending a command buffer
In some cases, there will be an open batch because an event operation
has been recorded, or a non-rendering command.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12019>
2021-07-27 15:18:34 +02:00
Tomeu Vizoso 616aa3f138 panvk: Start a new batch when the job index gets above the limit
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12019>
2021-07-27 15:18:34 +02:00
Tomeu Vizoso 498e5f44fa panvk: Don't try to update samplers if they are immutable
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12019>
2021-07-27 15:18:34 +02:00
Juan A. Suarez Romero 15ac51f758 ci/v3dv: update vulkan expected results
Add a couple of flakes.

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12068>
2021-07-27 12:44:50 +00:00
Yevhenii Kolesnikov c3f47f6e30 glsl: Properly handle .length() of an unsized array
There are two distinct cases:
- The last member of a shader storage block (length determined at run-time)
- Implicitly-sized array (length determined at link-time)

Fixes: 273f61a005 ("glsl: Add parser/compiler support for unsized array's length()")
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11952>
2021-07-27 10:02:50 +00:00
Yevhenii Kolesnikov 441826aaaa glsl: Add operator for .length() method on implicitly-sized arrays
ARB_shader_storage_buffer_object extension (promoted to core in 4.3) allows us
to call .length() method on arrays declared without an explicit size. The length is
determined at link time as a maximum array access.

Fixes: 273f61a005 ("glsl: Add parser/compiler support for unsized array's length()")
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11952>
2021-07-27 10:02:50 +00:00
Erico Nunes e6cdb01c51 lima: avoid crash with negative viewport values
The viewport value computations done in lima_set_viewport_states
can result in a negative value for viewport.
These could end up converted to unsigned values in
lima_clip_scissor_to_viewport causing crashes from invalid
scissor commands.
Prevent this by limiting the minimum value to zero as is already
done for the left and bottom values.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2938
Cc: mesa-stable

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12055>
2021-07-27 08:48:28 +00:00