platform/upstream/mesa.git
3 years agoanv: Make anv_image derive from vk_image
Jason Ekstrand [Thu, 22 Jul 2021 01:42:00 +0000 (20:42 -0500)]
anv: Make anv_image derive from vk_image

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12023>

3 years agovulkan: Add a vk_image struct
Jason Ekstrand [Wed, 21 Jul 2021 23:35:22 +0000 (18:35 -0500)]
vulkan: Add a vk_image struct

Currently, this is optional for drivers to carry around but it scrapes
up most of VkImageCreateInfo for you and parses a couple of extension
structs.  We also add a few useful little helpers copied over from ANV.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12023>

3 years agoanv: Delete anv_image::format
Jason Ekstrand [Wed, 21 Jul 2021 23:11:39 +0000 (18:11 -0500)]
anv: Delete anv_image::format

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12023>

3 years agoanv/image: Use planes[i]->primary_surface.isl.format in check_drm_format_mod
Jason Ekstrand [Wed, 21 Jul 2021 23:06:14 +0000 (18:06 -0500)]
anv/image: Use planes[i]->primary_surface.isl.format in check_drm_format_mod

In theory, with linear vs. tiled differences, it could be different
(RGBA vs. RGB etc.) but it won't matter for the two checks we do with
it.  Also, we probably want to be checking the real format here anyway.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12023>

3 years agozink: handle map failures more effectively
Mike Blumenkrantz [Fri, 30 Jul 2021 14:28:32 +0000 (10:28 -0400)]
zink: handle map failures more effectively

the transfer object needs to be destroyed

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422>

3 years agozink: break out transfer map destroy
Mike Blumenkrantz [Fri, 30 Jul 2021 14:25:28 +0000 (10:25 -0400)]
zink: break out transfer map destroy

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422>

3 years agozink: remove unused variable from image map
Mike Blumenkrantz [Fri, 30 Jul 2021 14:23:48 +0000 (10:23 -0400)]
zink: remove unused variable from image map

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422>

3 years agozink: split buffer and image map functions
Mike Blumenkrantz [Fri, 30 Jul 2021 14:22:55 +0000 (10:22 -0400)]
zink: split buffer and image map functions

this is a bit nicer to read

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422>

3 years agozink: split out zink_transfer allocation
Mike Blumenkrantz [Fri, 30 Jul 2021 14:19:00 +0000 (10:19 -0400)]
zink: split out zink_transfer allocation

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422>

3 years agozink: remove duplicated zink_resource_object::mem member
Mike Blumenkrantz [Fri, 30 Jul 2021 14:12:57 +0000 (10:12 -0400)]
zink: remove duplicated zink_resource_object::mem member

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12421>

3 years agozink: collapse 'dedicated' allocation into zink_bo
Mike Blumenkrantz [Fri, 30 Jul 2021 14:09:23 +0000 (10:09 -0400)]
zink: collapse 'dedicated' allocation into zink_bo

this simplifies all the map and memory management code

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12421>

3 years agozink: flake out some tests for now
Mike Blumenkrantz [Tue, 17 Aug 2021 19:59:46 +0000 (15:59 -0400)]
zink: flake out some tests for now

I can't repro these on any branch, so I'll just disable them and see if they get fixed
by some upcoming refactors

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

3 years agofreedreno/a6xx: Apply the cube image size lowering to GL, too.
Emma Anholt [Thu, 5 Aug 2021 19:57:13 +0000 (12:57 -0700)]
freedreno/a6xx: Apply the cube image size lowering to GL, too.

Fixes KHR-GLES31.core.texture_cube_map_array.texture_size_compute_sh.

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

3 years agoci/freedreno: Move freedreno's deqp testing to suite support.
Emma Anholt [Wed, 28 Jul 2021 23:30:19 +0000 (16:30 -0700)]
ci/freedreno: Move freedreno's deqp testing to suite support.

Using suites makes load-balancing our jobs much easier, keeps the CPU busy
handling the a630_gles_others.sh test sets (and improves the output and
baseline handling for them), and makes it trivial to add in more short
test sets.

a306: still 5 jobs, and we add KHR-GLES2 (KHR-GLES3 is unstable)
a530: still 5 jobs, added KHR-GLES*
a630_gl: 5 jobs becomes 4, and we add KHR-GLES*
a630_vk: still 3 jobs, now 1/3 of all VK instead of 1/4.
a630_vk_full: still 2 jobs, now includes full bypass testing, partial
              no-force testing, and testing of pre-merge-skipped tests.

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

3 years agoci/turnip: Add a new flake from running more of the CTS.
Emma Anholt [Tue, 17 Aug 2021 19:00:01 +0000 (12:00 -0700)]
ci/turnip: Add a new flake from running more of the CTS.

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

3 years agozink: rejigger PIPE_MAP_ONCE for internal qbo reads
Mike Blumenkrantz [Fri, 30 Jul 2021 15:34:40 +0000 (11:34 -0400)]
zink: rejigger PIPE_MAP_ONCE for internal qbo reads

DONTBLOCK is only used internally for this case, and promoting it over
the staging buffer case ensures that it's always reached when it should be

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>

3 years agozink: remove PIPE_MAP_ONCE from subdata
Mike Blumenkrantz [Fri, 30 Jul 2021 13:22:09 +0000 (09:22 -0400)]
zink: remove PIPE_MAP_ONCE from subdata

subdata calls that happen once for a buffer are likely to happen again,
so just leave them mapped

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>

3 years agozink: make map_count useful for dedicated image allocations
Mike Blumenkrantz [Thu, 29 Jul 2021 17:34:43 +0000 (13:34 -0400)]
zink: make map_count useful for dedicated image allocations

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>

3 years agozink: split mem unmap logic for images and buffers
Mike Blumenkrantz [Thu, 29 Jul 2021 17:31:38 +0000 (13:31 -0400)]
zink: split mem unmap logic for images and buffers

buffers should only be unmapped if they're explicitly marked for unmap,
but images should only be unmapped when running in 32bit, in which case
they need to always be unmapped

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>

3 years agozink: split transfer_unmap for images and buffers
Mike Blumenkrantz [Thu, 29 Jul 2021 17:02:22 +0000 (13:02 -0400)]
zink: split transfer_unmap for images and buffers

these should be separate

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>

3 years agozink: stop zeroing structs during resource allocation
Mike Blumenkrantz [Tue, 8 Jun 2021 14:33:35 +0000 (10:33 -0400)]
zink: stop zeroing structs during resource allocation

some of these show up in profiling

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>

3 years agozink: repack zink_resource_object struct
Mike Blumenkrantz [Fri, 11 Jun 2021 13:33:43 +0000 (09:33 -0400)]
zink: repack zink_resource_object struct

this makes better use of cachelines and eliminates holes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>

3 years agoturnip: provide dummy CmdSetLogicOpEXT and CmdSetPatchControlPointsEXT
Danylo Piliaiev [Tue, 17 Aug 2021 16:46:38 +0000 (19:46 +0300)]
turnip: provide dummy CmdSetLogicOpEXT and CmdSetPatchControlPointsEXT

Fixes: fd62e0b7996afde22447fd929a55b0cc89e9ab36 "tu: enable VK_EXT_extended_dynamic_state2"

Fixes dEQP-VK.api.version_check.entry_points

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

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

3 years agotu: Consider depth/stencil for implicit dependencies
Connor Abbott [Mon, 16 Aug 2021 10:04:47 +0000 (12:04 +0200)]
tu: Consider depth/stencil for implicit dependencies

Noticed by inspection.

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

3 years agotu: Fix logic errors with subpass implicit dependencies
Connor Abbott [Mon, 16 Aug 2021 09:59:03 +0000 (11:59 +0200)]
tu: Fix logic errors with subpass implicit dependencies

We were adding them if there was an external dep instead of if there
wasn't, and we were skipping the entire subpass which would've resulted
in attachments not getting marked as used.

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

3 years agoutil: Replace recursive DFS with iterative implementation
Matt Turner [Thu, 5 Aug 2021 01:47:02 +0000 (18:47 -0700)]
util: Replace recursive DFS with iterative implementation

Doesn't fix, but improves the situation in issue #5163. The
VK.spirv_assembly.instruction.graphics.spirv_ids_abuse.lots_ids_* tests
emit about 160k instructions. ir3_sched blows out the stack after
dag_traverse_bottom_up_node reaches a depth of about 130k frames.

This patch replaces the recursively-implemented post-order traversal
with an iterative implementation using a stack, allowing us to process
DAGs as large as memory can hold.

Definitely makes you appreciate the elegance of recursion...

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12232>

3 years agoutil: Add unit tests for dag
Matt Turner [Tue, 10 Aug 2021 19:10:22 +0000 (12:10 -0700)]
util: Add unit tests for dag

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12232>

3 years agofreedreno: Decode a650+ CP_START_BIN/CP_END_BIN packets
Connor Abbott [Tue, 3 Aug 2021 13:34:56 +0000 (15:34 +0200)]
freedreno: Decode a650+ CP_START_BIN/CP_END_BIN packets

The blob uses them for GMEM renderpasses.

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

3 years agost/mesa: correct point_tri_clip for gles2
Erik Faye-Lund [Thu, 12 Aug 2021 13:59:55 +0000 (15:59 +0200)]
st/mesa: correct point_tri_clip for gles2

The OpenGL ES 2.0 (and later) specifications, section 2.13 (Primitive
Clipping) say the following about point-clipping:

> If the primitive under consideration is a point, then clipping
> discards it if it lies outside the near or far clip plane; otherwise
> it is passed unchanged.

This matches the D3D convention, and we already have a rasterizer-state
bit for it. So let's set that bit when the API is OpenGL ES 2.

We can set this inside the PointSprite-conditional block, because that's
always enabled on GLES 2, and it's undefined to enable this state
without also enabling point_quad_rasterization.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12350>

3 years agollvmpipe: take intersection with bbox for non-legacy points
Erik Faye-Lund [Thu, 12 Aug 2021 18:50:58 +0000 (20:50 +0200)]
llvmpipe: take intersection with bbox for non-legacy points

When I updated this code for multi-sampling, I missed one detail; if we
want to be able to support pipe_rasterizer_state::point_tri_clip, we
need to use the intersection of the bbox (clipped to the viewport
rectangle) and the generated primitive, otherwise we won't end up doing
x/y viewport clipping at all.

Because we've adjusted some of the parts of the bbox when adjusting for
inclusiveness/exclusiveness and fill-rule, we also need to reverse the
adjustment.

Fixes: f530e72ea05 ("llvmpipe: do not always use pixel-rounded coordinates for points")
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12350>

3 years agointel/isl: Use uint64_t for computed byte offsets
Jason Ekstrand [Wed, 7 Jul 2021 16:28:05 +0000 (11:28 -0500)]
intel/isl: Use uint64_t for computed byte offsets

This is mostly a bit of future-proofing.  We never end up with offsets
that don't fit in 32 bits today because, thanks to driver limitations
caused by relocations, we don't allocate buffers bigger than 2GB today.
However, if we ever did, it's possible to create a surface on modern
platforms that consumes more than 4GB and we would end up with wrapping
in our offset calculations.

Acked-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11765>

3 years agointel/isl: Add a missing assert in isl_tiling_get_intratile_offset_sa
Jason Ekstrand [Wed, 7 Jul 2021 16:33:49 +0000 (11:33 -0500)]
intel/isl: Add a missing assert in isl_tiling_get_intratile_offset_sa

Fixes: a4dafe1faddb "intel/isl: Make the offset helpers four dimensional"
Acked-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11765>

3 years agointel/isl: Better document isl_tiling_get_intratile_offset_*
Jason Ekstrand [Wed, 7 Jul 2021 16:06:59 +0000 (11:06 -0500)]
intel/isl: Better document isl_tiling_get_intratile_offset_*

The docs weren't updated when we switched it to 4D.  Also, the new docs
are way better.  While we're here, use the parameter name offset_B to be
more consistent.

Acked-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11765>

3 years agointel/isl: Add units to view dimensions in isl_surf_get_uncompressed_surf
Jason Ekstrand [Mon, 5 Mar 2018 23:06:58 +0000 (15:06 -0800)]
intel/isl: Add units to view dimensions in isl_surf_get_uncompressed_surf

This makes things a bit more clear.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11765>

3 years agointel/isl: Explicitly set offset_B = 0 in get_uncomp_surf for arrays
Jason Ekstrand [Wed, 7 Jul 2021 15:52:09 +0000 (10:52 -0500)]
intel/isl: Explicitly set offset_B = 0 in get_uncomp_surf for arrays

The only user of this case is iris which initializes offset_B to 0 so
there's no real bug here.  However, it is unexpected from an API PoV.

Fixes: 9946120d2b4e "intel/isl: Add more cases to isl_surf_get_uncompressed_surf"
Acked-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11765>

3 years agozink: add a suballocator
Mike Blumenkrantz [Thu, 13 May 2021 11:33:44 +0000 (07:33 -0400)]
zink: add a suballocator

this is an aux/pipebuffer implementation borrowing heavily from the
one in radeonsi. it currently has the following limitations, which
will be resolved in a followup series:
* 32bit address space still explodes
* swapchain images still have separate memory handling

performance in games like Tomb Raider has been observed to increase by
over 1000%

SQUASHED: simplify get_memory_type_index()

now that the heaps are enumerated, this can be reduced to a simple
array index with a fallback

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12146>

3 years agolima: CI: Enable GL_R8 and GL_RG8 texture formats
Andreas Baierl [Tue, 17 Aug 2021 10:47:55 +0000 (12:47 +0200)]
lima: CI: Enable GL_R8 and GL_RG8 texture formats

This is fixed in deqp now. See https://github.com/KhronosGroup/VK-GL-CTS/pull/241
Since CI is using deqp version > vulkan-cts-1.2.6.0, this isn't an issue anymore.

Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12409>

3 years agoci: enable CI for lima again
Erico Nunes [Wed, 7 Jul 2021 20:54:43 +0000 (22:54 +0200)]
ci: enable CI for lima again

Enable CI for lima again on meson-gxl-s805x-libretech-ac boards
with Mali-450.
These boards are managed by a LAVA instance and so follow the LAVA CI
workflow in Mesa.
The goal is to have coverage for deqp-gles2, as lima is a GLES2-only
driver.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11789>

3 years agoradv: improve rounding of zmin
Filip Gawin [Mon, 16 Aug 2021 11:02:50 +0000 (13:02 +0200)]
radv: improve rounding of zmin

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12388>

3 years agolima: Implement lima_resource_get_param() callback
Roman Stratiienko [Fri, 13 Aug 2021 17:04:51 +0000 (20:04 +0300)]
lima: Implement lima_resource_get_param() callback

Currently stride, offset, modifier is obtained by invoking
lima_resource_get_handle() with WINSYS_HANDLE_TYPE_KMS.

Before commit 47f000c170cc this path was working. Obtained handle
was simply ignored by DRI frontend and only requested data used.

After commit 47f000c170cc such requests started to fail when
DRI is initialized using KMSRO and resource has no scanout data.

When lima_resource_get_param() is implemented, it will be used in
a first place to obtain resource data.

Fixes: 47f000c170cc ("lima: fail in get_handle(TYPE_KMS) without a scanout resource")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12362>

3 years agomeson: Search for python3 before python for bin/meson_get_version.py
Jordan Justen [Tue, 17 Aug 2021 08:01:40 +0000 (01:01 -0700)]
meson: Search for python3 before python for bin/meson_get_version.py

Most systems have either dropped the python executable, or made it
python3.

But it is still possible to configure a system such that python runs
python2. https://www.python.org/dev/peps/pep-0394/

Or, some developers may still be running older distributions where
python is python2.

Since bin/meson_get_version.py now requires python3, we should search
for python3 before python.

Fixes: f1eae2f8bbe ("python: drop python2 support")
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12400>

3 years agov3d/ci: add piglit flake
Juan A. Suarez Romero [Tue, 17 Aug 2021 07:50:10 +0000 (09:50 +0200)]
v3d/ci: add piglit flake

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12401>

3 years agoglsl/opt_algebraic: disable invalid optimization
Marcin Åšlusarz [Fri, 13 Aug 2021 14:39:09 +0000 (16:39 +0200)]
glsl/opt_algebraic: disable invalid optimization

When operators other than eq and ne are involved we can't really
move operands around and negate them because such transformation
may change the value of the whole expression.

Some examples:

For unsigned var:
0 >= 1u + var would eventually become 0xffffffff >= var,
which would always evaluate to true, when original expression
was true only for var == 0xffffffff.

For signed var:
0 >= 1 + var would become -1 >= var, which would evaluate to
false for var == 2147483647, when original expression evaluated
to true (because signed overflow is defined to wrap around in
glsl, 1 + 2147483647 == -2147483648, so 0 >= -2147483648).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5226
Fixes: 34ec1a24d61 ("glsl: Optimize (x + y cmp 0) into (x cmp -y).")
Signed-off-by: Marcin Åšlusarz <marcin.slusarz@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12359>

3 years agointel/error-decode: printout INSTDONE_GEOM register for Gfx12.5
Marcin Åšlusarz [Mon, 19 Jul 2021 15:53:14 +0000 (17:53 +0200)]
intel/error-decode: printout INSTDONE_GEOM register for Gfx12.5

Signed-off-by: Marcin Åšlusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12392>

3 years agogenxml: add INSTDONE_GEOM register for Gfx12.5
Marcin Åšlusarz [Mon, 19 Jul 2021 15:52:24 +0000 (17:52 +0200)]
genxml: add INSTDONE_GEOM register for Gfx12.5

Signed-off-by: Marcin Åšlusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12392>

3 years agointel/error-decode: printout more registers
Lionel Landwerlin [Thu, 20 May 2021 06:54:18 +0000 (06:54 +0000)]
intel/error-decode: printout more registers

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Marcin Åšlusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12392>

3 years agogenxml: add more INSTDONE registers for Gfx12.5
Lionel Landwerlin [Mon, 17 May 2021 07:20:30 +0000 (10:20 +0300)]
genxml: add more INSTDONE registers for Gfx12.5

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Marcin Åšlusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12392>

3 years agov3dv: Implement VK_EXT_provoking_vertex
Ella-0 [Sun, 15 Aug 2021 14:50:39 +0000 (14:50 +0000)]
v3dv: Implement VK_EXT_provoking_vertex

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

3 years agoradv: fix pre-computing viewport xform when setting new viewports
Samuel Pitoiset [Fri, 13 Aug 2021 10:04:42 +0000 (12:04 +0200)]
radv: fix pre-computing viewport xform when setting new viewports

viewportCount is the number of viewports in pViewports while
firstViewport is the index.

Fixes new CTS dEQP-VK.draw.depth_clamp.*_clamp_four_viewports

Fixes: a2ef92d7a58 ("radv: pre-calculate viewport transforms")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12353>

3 years agonir: fix GCM when GVN enabled
Timothy Arceri [Fri, 6 Aug 2021 13:39:06 +0000 (23:39 +1000)]
nir: fix GCM when GVN enabled

Enabling GVN uncovered a bug where we would crash if the pass
thinking about pushing something into a loop.

Fixes: 6538b3e56614 ("nir: add heuristic for instructions in loops with GCM")

Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12242>

3 years agonv50/ir: Add FlatteningPass constructor.
Vinson Lee [Tue, 10 Aug 2021 00:42:47 +0000 (17:42 -0700)]
nv50/ir: Add FlatteningPass constructor.

Fix defect reported by Coverity Scan.

Uninitialized scalar field (UNINIT_CTOR)
member_not_init_in_gen_ctor: The compiler-generated constructor for this
class does not initialize gpr_unit.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12295>

3 years agozink: Remove unnecessary null checks.
Vinson Lee [Tue, 10 Aug 2021 03:40:31 +0000 (20:40 -0700)]
zink: Remove unnecessary null checks.

Fix defects reported by Coverity Scan.

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking sa suggests that it may be null,
but it has already been dereferenced on all paths leading to the
check.
check_after_deref: Null-checking sb suggests that it may be null,
but it has already been dereferenced on all paths leading to the
check.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12298>

3 years agoradeonsi: improve rounding of zmin
Filip Gawin [Mon, 16 Aug 2021 11:13:43 +0000 (13:13 +0200)]
radeonsi: improve rounding of zmin

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

3 years agollvmpipe: init renderer string once to avoid races.
Dave Airlie [Mon, 9 Aug 2021 04:06:12 +0000 (14:06 +1000)]
llvmpipe: init renderer string once to avoid races.

In a multithreads clover run the get_name call would race against
itself and sometimes an empty device name would occur.

Just init it once.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12285>

3 years agogallivm: fix non-32 bit popcounts.
Dave Airlie [Thu, 26 Nov 2020 07:24:15 +0000 (17:24 +1000)]
gallivm: fix non-32 bit popcounts.

Fixes
OpenCL CTS integer_ops popcount

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12285>

3 years agogallivm: fix idiv/irem for 8/16/64-bit and 32-bit INT_MIN/-1
Dave Airlie [Wed, 25 Nov 2020 20:16:39 +0000 (06:16 +1000)]
gallivm: fix idiv/irem for 8/16/64-bit and 32-bit INT_MIN/-1

This fixes integer division for non-32bit but also fixes the
32-bit case where INT_MIN/-1 causes an exception.

Fixes CL CTS
./integer_ops/test_integer_ops quick_long_math

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12285>

3 years agollvmpipe/cl: limit kernel input size.
Dave Airlie [Thu, 5 Nov 2020 03:24:27 +0000 (13:24 +1000)]
llvmpipe/cl: limit kernel input size.

Fixes:
api min_max_parameter_size

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12285>

3 years agogallivm: don't lower local invocation index in frontend
Dave Airlie [Mon, 9 Nov 2020 06:16:01 +0000 (16:16 +1000)]
gallivm: don't lower local invocation index in frontend

The frontend can't handle variable block sizes properly,
so just lower it here in the backend.

Fixes CTS basic local_linear_id + get_linear_ids

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12285>

3 years agoi915g: Implement cube/3d texture_subdata() as a series of per-layer maps.
Emma Anholt [Mon, 16 Aug 2021 05:03:59 +0000 (22:03 -0700)]
i915g: Implement cube/3d texture_subdata() as a series of per-layer maps.

i915 doesn't lay out the images such that one could use a layer_stride to
step between them, and the individual maps should be just as good at
uploading.

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

3 years agoi915g: Fix 3D texture layouts for width != height.
Emma Anholt [Mon, 16 Aug 2021 17:24:47 +0000 (10:24 -0700)]
i915g: Fix 3D texture layouts for width != height.

Obvious typo here.

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

3 years agov3dv: Implement VK_EXT_pipeline_creation_cache_control
Ella-0 [Sat, 14 Aug 2021 14:09:23 +0000 (14:09 +0000)]
v3dv: Implement VK_EXT_pipeline_creation_cache_control

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

3 years agollvmpipe: enable GL compatibility profiles
Dave Airlie [Sat, 14 Aug 2021 20:22:34 +0000 (06:22 +1000)]
llvmpipe: enable GL compatibility profiles

The two rasterpos fails looks related to GLSL linking, the vertex
shader is linked with the geometry shader which doesn't use any
of it's outputs so they seem to get removed, which stops the rasterpos
from working.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12374>

3 years agodraw: add vertex color clamping to gs/tes
Dave Airlie [Sun, 15 Aug 2021 04:41:06 +0000 (14:41 +1000)]
draw: add vertex color clamping to gs/tes

This refactors out the vertex color clamping from the VS shader,
and adds calls to it for the tes/gs stages. It also conditionalised
they key on having later stages as clamping should only happen in
the last stage.

This is needed for GL compatibility profiles

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12374>

3 years agodraw/tess: add clipvertex support for compatibility
Dave Airlie [Sat, 14 Aug 2021 20:21:51 +0000 (06:21 +1000)]
draw/tess: add clipvertex support for compatibility

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12374>

3 years agodraw/gs: add clipvertex support for compatibility
Dave Airlie [Sat, 14 Aug 2021 20:19:52 +0000 (06:19 +1000)]
draw/gs: add clipvertex support for compatibility

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12374>

3 years agodraw: handle primitive ID for quads/quad strips.
Dave Airlie [Fri, 13 Aug 2021 05:00:13 +0000 (15:00 +1000)]
draw: handle primitive ID for quads/quad strips.

In order to enable compat contexts QUADS/QUAD_STRIPS need
to support primitive ID. There are some piglit tests for this.

This adds support to the decomposer to pass quads so the prim
assembler can pick them up and add primitive IDs.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12374>

3 years agov3dv: initialize CL submission structure
Juan A. Suarez Romero [Mon, 16 Aug 2021 10:48:37 +0000 (12:48 +0200)]
v3dv: initialize CL submission structure

This fixes an issue related with testing this with a kernel with the
performance counters enabled: it introduces a "pad" field that in the CL
submission structure that is not initialized.

Fixes: ca13868098e ("drm-uapi: add v3d performance counters")
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12390>

3 years agoci: update trace hashes
Rhys Perry [Mon, 16 Aug 2021 12:24:52 +0000 (13:24 +0100)]
ci: update trace hashes

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir,glsl_to_nir: use nir_fdot()
Rhys Perry [Wed, 13 Jan 2021 15:11:57 +0000 (15:11 +0000)]
nir,glsl_to_nir: use nir_fdot()

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agospirv: create ffma more often
Rhys Perry [Tue, 16 Jun 2020 13:28:18 +0000 (14:28 +0100)]
spirv: create ffma more often

We will not be able to combine instructions into ffma later if they are
exact, so create them from the start. They can be lowered later if they
are unwanted.

fossil-db (GFX10.3):
Totals from 14697 (10.05% of 146267) affected shaders:
VGPRs: 645736 -> 614168 (-4.89%)
CodeSize: 59312768 -> 58735352 (-0.97%); split: -0.97%, +0.00%
MaxWaves: 372900 -> 376666 (+1.01%)
Instrs: 11339280 -> 11120882 (-1.93%); split: -1.93%, +0.00%
Latency: 284874519 -> 285277327 (+0.14%); split: -0.10%, +0.24%
InvThroughput: 68791374 -> 68526739 (-0.38%); split: -0.49%, +0.10%

fossil-db (GFX10):
Totals from 11039 (7.55% of 146267) affected shaders:
CodeSize: 54785444 -> 54785268 (-0.00%); split: -0.00%, +0.00%
Instrs: 10401349 -> 10401396 (+0.00%); split: -0.00%, +0.00%
Latency: 277781803 -> 278572890 (+0.28%); split: -0.00%, +0.29%
InvThroughput: 65035902 -> 65100855 (+0.10%); split: -0.00%, +0.10%

fossil-db (GFX9):
Totals from 24055 (16.43% of 146401) affected shaders:
SGPRs: 1790704 -> 1790640 (-0.00%)
VGPRs: 1105736 -> 1105716 (-0.00%)
CodeSize: 110944732 -> 110948812 (+0.00%); split: -0.00%, +0.01%
Instrs: 21609095 -> 21610227 (+0.01%); split: -0.00%, +0.01%
Latency: 756137596 -> 756145812 (+0.00%); split: -0.02%, +0.02%
InvThroughput: 344103825 -> 344112245 (+0.00%); split: -0.00%, +0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir: lower fdot to ffma if lower_ffma=false
Rhys Perry [Fri, 5 Mar 2021 17:28:36 +0000 (17:28 +0000)]
nir: lower fdot to ffma if lower_ffma=false

fossil-db (GFX10.3):
Totals from 57689 (39.44% of 146267) affected shaders:
VGPRs: 2873712 -> 2873432 (-0.01%); split: -0.01%, +0.00%
CodeSize: 227661100 -> 227583572 (-0.03%); split: -0.08%, +0.04%
MaxWaves: 1289562 -> 1289598 (+0.00%); split: +0.01%, -0.00%
Instrs: 43115433 -> 43083308 (-0.07%); split: -0.12%, +0.05%
Latency: 869947191 -> 870279826 (+0.04%); split: -0.06%, +0.10%
InvThroughput: 199425811 -> 199434448 (+0.00%); split: -0.04%, +0.05%

fossil-db (GFX10):
Totals from 2 (0.00% of 146267) affected shaders:
Latency: 8123 -> 8107 (-0.20%)

fossil-db (GFX9):
Totals from 2 (0.00% of 146401) affected shaders:
(no stat changes)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir: create ffma from builders more often
Rhys Perry [Thu, 23 Jul 2020 10:40:11 +0000 (11:40 +0100)]
nir: create ffma from builders more often

We will not be able to combine instructions into ffma later if they are
exact, so create them from the start. They can be lowered later if they
are unwanted.

fossil-db (GFX10.3):
Totals from 16589 (11.34% of 146267) affected shaders:
VGPRs: 938872 -> 938704 (-0.02%)
SpillSGPRs: 11334 -> 10785 (-4.84%)
CodeSize: 96551964 -> 96498040 (-0.06%); split: -0.08%, +0.02%
MaxWaves: 338760 -> 338772 (+0.00%)
Instrs: 18356857 -> 18350486 (-0.03%); split: -0.06%, +0.02%
Latency: 561563310 -> 561414360 (-0.03%); split: -0.08%, +0.05%
InvThroughput: 145629673 -> 145594740 (-0.02%); split: -0.04%, +0.01%

fossil-db (GFX10):
Totals from 16252 (11.11% of 146267) affected shaders:
VGPRs: 893820 -> 893744 (-0.01%)
SpillSGPRs: 11334 -> 10785 (-4.84%)
CodeSize: 95890244 -> 95839124 (-0.05%); split: -0.08%, +0.02%
MaxWaves: 367704 -> 367734 (+0.01%)
Instrs: 18199741 -> 18194437 (-0.03%); split: -0.06%, +0.03%
Latency: 560912971 -> 560854179 (-0.01%); split: -0.07%, +0.06%
InvThroughput: 142899814 -> 142877939 (-0.02%); split: -0.03%, +0.02%

fossil-db (GFX9):
Totals from 16287 (11.12% of 146401) affected shaders:
SGPRs: 1312784 -> 1312768 (-0.00%); split: -0.05%, +0.05%
VGPRs: 931440 -> 931444 (+0.00%); split: -0.00%, +0.00%
SpillSGPRs: 14623 -> 14597 (-0.18%)
CodeSize: 94428788 -> 94344404 (-0.09%); split: -0.10%, +0.01%
MaxWaves: 90105 -> 90109 (+0.00%)
Instrs: 18486905 -> 18473434 (-0.07%); split: -0.08%, +0.01%
Latency: 720947295 -> 720818323 (-0.02%); split: -0.07%, +0.05%
InvThroughput: 365240104 -> 365224659 (-0.00%); split: -0.02%, +0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir: add ffma creation helpers
Rhys Perry [Wed, 2 Jun 2021 14:14:41 +0000 (15:14 +0100)]
nir: add ffma creation helpers

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir/algebraic: add is_used_once to dot product reassociation optimization
Rhys Perry [Thu, 13 May 2021 11:50:09 +0000 (12:50 +0100)]
nir/algebraic: add is_used_once to dot product reassociation optimization

This improves register usage.

fossil-db (Sienna Cichlid, on top of !9805):
Totals from 4317 (2.88% of 149839) affected shaders:
VGPRs: 352592 -> 351704 (-0.25%); split: -1.48%, +1.23%
SpillSGPRs: 182 -> 248 (+36.26%)
CodeSize: 31601192 -> 31587624 (-0.04%); split: -0.09%, +0.04%
MaxWaves: 56964 -> 57298 (+0.59%); split: +2.48%, -1.90%
Instrs: 5973557 -> 5974122 (+0.01%); split: -0.05%, +0.06%
Latency: 72088175 -> 72253033 (+0.23%); split: -0.36%, +0.59%
InvThroughput: 14978160 -> 14798919 (-1.20%); split: -1.29%, +0.09%
VClause: 100994 -> 98645 (-2.33%); split: -3.05%, +0.73%
SClause: 278206 -> 276820 (-0.50%); split: -0.54%, +0.04%
Copies: 200264 -> 199556 (-0.35%); split: -1.17%, +0.82%
Branches: 86410 -> 85930 (-0.56%); split: -0.56%, +0.01%
PreSGPRs: 207355 -> 207759 (+0.19%); split: -0.00%, +0.20%
PreVGPRs: 314646 -> 310911 (-1.19%); split: -1.35%, +0.17%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir/algebraic: reassociate add chains for more MAD/FMA-friendly code
Rhys Perry [Wed, 17 Mar 2021 19:54:38 +0000 (19:54 +0000)]
nir/algebraic: reassociate add chains for more MAD/FMA-friendly code

fossil-db (GFX10.3):
Totals from 25866 (17.68% of 146267) affected shaders:
VGPRs: 1625456 -> 1644936 (+1.20%); split: -0.05%, +1.24%
SpillSGPRs: 11729 -> 11725 (-0.03%); split: -0.07%, +0.03%
CodeSize: 161604460 -> 161458052 (-0.09%); split: -0.11%, +0.02%
MaxWaves: 454842 -> 452160 (-0.59%); split: +0.04%, -0.63%
Instrs: 30652596 -> 30456446 (-0.64%); split: -0.65%, +0.01%
Latency: 723098749 -> 722084247 (-0.14%); split: -0.21%, +0.07%
InvThroughput: 166023468 -> 165506875 (-0.31%); split: -0.36%, +0.05%

fossil-db (GFX10):
Totals from 25866 (17.68% of 146267) affected shaders:
VGPRs: 1593576 -> 1611976 (+1.15%); split: -0.09%, +1.25%
SpillSGPRs: 11729 -> 11725 (-0.03%); split: -0.07%, +0.03%
CodeSize: 162294468 -> 162154456 (-0.09%); split: -0.11%, +0.02%
MaxWaves: 477448 -> 474166 (-0.69%); split: +0.10%, -0.79%
Instrs: 30820164 -> 30625805 (-0.63%); split: -0.65%, +0.02%
Latency: 723190249 -> 722273445 (-0.13%); split: -0.20%, +0.08%
InvThroughput: 163114872 -> 162582966 (-0.33%); split: -0.37%, +0.04%

fossil-db (GFX9):
Totals from 25866 (17.67% of 146401) affected shaders:
SGPRs: 2167808 -> 2169920 (+0.10%); split: -0.09%, +0.19%
VGPRs: 1649404 -> 1667592 (+1.10%); split: -0.43%, +1.53%
CodeSize: 161273556 -> 161281996 (+0.01%); split: -0.07%, +0.08%
MaxWaves: 114910 -> 113519 (-1.21%); split: +0.10%, -1.31%
Instrs: 31557180 -> 31403708 (-0.49%); split: -0.50%, +0.02%
Latency: 899594793 -> 898786283 (-0.09%); split: -0.19%, +0.10%
InvThroughput: 412265691 -> 411551698 (-0.17%); split: -0.28%, +0.11%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir/algebraic: add various ffma optimizations
Rhys Perry [Fri, 5 Mar 2021 18:41:13 +0000 (18:41 +0000)]
nir/algebraic: add various ffma optimizations

fossil-db (GFX10.3):
Totals from 7532 (5.15% of 146267) affected shaders:
VGPRs: 414696 -> 414304 (-0.09%); split: -0.18%, +0.08%
CodeSize: 33393444 -> 33375908 (-0.05%); split: -0.13%, +0.08%
MaxWaves: 149854 -> 150094 (+0.16%); split: +0.27%, -0.11%
Instrs: 6279823 -> 6271364 (-0.13%); split: -0.18%, +0.05%
Latency: 60308898 -> 60296025 (-0.02%); split: -0.13%, +0.11%
InvThroughput: 13770542 -> 13745192 (-0.18%); split: -0.24%, +0.06%

fossil-db (GFX10):
Totals from 7532 (5.15% of 146267) affected shaders:
VGPRs: 406664 -> 405564 (-0.27%); split: -0.39%, +0.12%
CodeSize: 33544656 -> 33527568 (-0.05%); split: -0.13%, +0.08%
MaxWaves: 158584 -> 158858 (+0.17%); split: +0.30%, -0.13%
Instrs: 6316242 -> 6307913 (-0.13%); split: -0.18%, +0.05%
Latency: 60243290 -> 60232844 (-0.02%); split: -0.13%, +0.11%
InvThroughput: 13643345 -> 13620171 (-0.17%); split: -0.24%, +0.07%

fossil-db (GFX9):
Totals from 7543 (5.15% of 146401) affected shaders:
SGPRs: 546384 -> 547472 (+0.20%); split: -0.08%, +0.28%
VGPRs: 412636 -> 411896 (-0.18%); split: -0.27%, +0.09%
CodeSize: 33216196 -> 33210564 (-0.02%); split: -0.12%, +0.11%
MaxWaves: 38771 -> 38789 (+0.05%); split: +0.17%, -0.12%
Instrs: 6419878 -> 6414891 (-0.08%); split: -0.18%, +0.11%
Latency: 70972327 -> 70922754 (-0.07%); split: -0.15%, +0.08%
InvThroughput: 33949039 -> 33909258 (-0.12%); split: -0.20%, +0.08%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agospirv: swap fadd operands in build_asin() and matrix_multiply()
Rhys Perry [Wed, 17 Jun 2020 11:07:13 +0000 (12:07 +0100)]
spirv: swap fadd operands in build_asin() and matrix_multiply()

This shouldn't do anything but will make testing a later patch easier.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agonir: swap fadd operands in nir_atan()
Rhys Perry [Wed, 17 Jun 2020 10:53:13 +0000 (11:53 +0100)]
nir: swap fadd operands in nir_atan()

This shouldn't do anything but will make testing a later patch easier.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>

3 years agopanfrost: Unit test clear colour packing
Alyssa Rosenzweig [Fri, 13 Aug 2021 19:09:50 +0000 (19:09 +0000)]
panfrost: Unit test clear colour packing

dEQP has poor coverage of clear colours with odd formats, and doesn't
check that we dither as expected. This functionality is trivial to unit
test, so there's no excuse not to. Nontrivial reference values are
captured from pandecode of the Mali G52 DDK but should be valid for all
Midgard/Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12365>

3 years agopanfrost: Mark R5G6B5 as blendable
Alyssa Rosenzweig [Fri, 13 Aug 2021 20:20:28 +0000 (20:20 +0000)]
panfrost: Mark R5G6B5 as blendable

We support B5G6R5 as blendable, this is just a swizzle away. Reduces the
amount we hit blend shaders, and will fix a clear colour packing unit
test in a moment.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12365>

3 years agopanvk: Use pan_pack_color
Alyssa Rosenzweig [Fri, 13 Aug 2021 21:10:55 +0000 (21:10 +0000)]
panvk: Use pan_pack_color

This is in common code now. Inherit all the bug fixes from panfrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12365>

3 years agopanfrost: Rewrite the clear colour packing code
Alyssa Rosenzweig [Fri, 13 Aug 2021 17:36:59 +0000 (17:36 +0000)]
panfrost: Rewrite the clear colour packing code

At the beginning of a render pass, the hardware will fill the tilebuffer
with an arbitrary 128-bit word. To implement colour clears, the driver
must pack the API-specific clear colour according to the 128-bit layout
of the tilebuffer. This layout depends only on the render target format.

The existing code to handle this was based on loose guesswork. It works
for the format / clear colour combinations tested in dEQP-GLES3, but it
is severely deficient in the general case.  It works by matching on the
PIPE format of the render target (not the layout of the tilebuffer). For
special cased PIPE formats, it open codes a buggy pack routine.
Otherwise, it defaults to util_pack_color in the hope that will work.
Since util_pack_color doesn't know anything about Mali tilebuffer
layouts, that means it's defaulting to wrong behaviour.

Now that we understand internal tilebuffer layouts, let's rewrite the
packing code. Instead of matching PIPE formats, map the PIPE format to
the internal tilebuffer layout using the common table, ensuring the
mapping remains in sync with the render target descriptor. Then for
blendable tilebuffer formats, pack using a common float -> fixed point
path supporting optional sRGB translation. Raw formats use
util_pack_color as before.

For formats with less than 8 bits per channel, the new code uses the
fractional bits of the fixed-point representation. This is required for
correct dithering if the clear colour is not exactly representable in
the final low precision format.

In summary, at least the following bugs in the old code are fixed:

   * Swapped R/B channels with sRGB
   * Swapped R/B channels with some missing formats
   * Incorrect dithering with RGB565, RGB5_A1

Fixes the following test cases:

   dEQP-EGL.functional.wide_color.window_8888_colorspace_srgb
   dEQP-EGL.functional.wide_color.pbuffer_8888_colorspace_srgb
   dEQP-EGL.functional.wide_color.window_888_colorspace_srgb
   dEQP-EGL.functional.wide_color.pbuffer_888_colorspace_srgb

Later in the series, unit tests are added for the new implementation.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12365>

3 years agopanfrost: Only allow colour blit shaders to be killed
Icecream95 [Sun, 8 Aug 2021 02:08:08 +0000 (14:08 +1200)]
panfrost: Only allow colour blit shaders to be killed

Fixes timeouts in SuperTuxKart with the advanced rendering pipeline.

Fixes: d0344619214 ("panfrost: Set allow_forward_pixel_to_be_killed for blit")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12267>

3 years agopanfrost: Fix leak of render node fd
Alyssa Rosenzweig [Thu, 12 Aug 2021 17:39:15 +0000 (17:39 +0000)]
panfrost: Fix leak of render node fd

Transfer ownership of the render node fd to the panfrost_device (minor
change to panvk), and then close the file descriptor for the render node
bound to the panfrost_device when destroying the panfrost_device. Of all
the users of panfrost_open_device, panvk is the only one that correctly
closed the fd before. Accordingly, this fixes an fd leak in the Gallium
driver (and performance counter utilities).

This fix still applies to the Gallium driver when renderonly is in use--
although renderonly closes its own fd, the fd is _duplicated_ in
panfrost_drm_winsys.c, so renderonly and panfrost must _both_ close
their respective fd to fix the leak.

This fixes a crash when running dEQP-EGL for more than two hours.
dEQP-EGL creates a new screen for every test case and then immediately
destroys it. If destroying a screen leaks the fd, this causes the number
of open file descriptors to increase monotonically until the process
ends. This will eventually hit the system limit for number of open files
and abort the process.

This bug was identified while attempting to run the OpenGL ES
conformance tests via cts-runner, and then confirmed with `lsof`. With
the fix, the number of file descriptors reported by `lsof | wc -l` is
now constant while running dEQP-EGL as expected.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12346>

3 years agopanfrost: Add nocache debug flag for disabling the BO cache
Icecream95 [Sat, 14 Aug 2021 11:45:52 +0000 (23:45 +1200)]
panfrost: Add nocache debug flag for disabling the BO cache

Useful for making execution more deterministic.

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

3 years agopanfrost: Fill tiler job padding again
Icecream95 [Sun, 15 Aug 2021 04:26:25 +0000 (16:26 +1200)]
panfrost: Fill tiler job padding again

Fixes: 3d0f6592b2a ("panfrost: Use PAN_ARCH for the rest of pan_cmdstream")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12377>

3 years agopan/mdg: Reduce size of tex_opcode_props
Icecream95 [Sat, 14 Aug 2021 11:14:43 +0000 (23:14 +1200)]
pan/mdg: Reduce size of tex_opcode_props

Also include midgard_ops.h to prevent the definitions from going out
of sync again.

Found by compiling with LTO enabled.

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

3 years agopanfrost: Free NIR when deleting shader state
Icecream95 [Sat, 14 Aug 2021 11:13:09 +0000 (23:13 +1200)]
panfrost: Free NIR when deleting shader state

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

3 years agopanfrost: Free TGSI tokens
Icecream95 [Sat, 14 Aug 2021 11:11:10 +0000 (23:11 +1200)]
panfrost: Free TGSI tokens

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

3 years agopanfrost: Fix memory leaks for compute state
Icecream95 [Sat, 14 Aug 2021 11:09:57 +0000 (23:09 +1200)]
panfrost: Fix memory leaks for compute state

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

3 years agopan/bi,pan/mdg: Fix memory leak of hash tables
Icecream95 [Sat, 14 Aug 2021 11:04:43 +0000 (23:04 +1200)]
pan/bi,pan/mdg: Fix memory leak of hash tables

Despite being created with a ralloc context, some memory is still
leaked when not manually destroying hash tables.

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

3 years agopanfrost: Call primconvert and u_transfer_helper destroy functions
Icecream95 [Sat, 14 Aug 2021 11:01:42 +0000 (23:01 +1200)]
panfrost: Call primconvert and u_transfer_helper destroy functions

Fixes a couple of small memory leaks.

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

3 years agoCI: Update Windows quick_gl baseline for mysterious new passes
Jesse Natalie [Mon, 16 Aug 2021 13:51:30 +0000 (06:51 -0700)]
CI: Update Windows quick_gl baseline for mysterious new passes

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12391>

3 years agotu: Fix xfb when there is a hole at the end
Connor Abbott [Tue, 10 Aug 2021 16:07:51 +0000 (18:07 +0200)]
tu: Fix xfb when there is a hole at the end

We were handling the case where we had an unassigned output in the
middle of the outputs array, but v->outputs can be smaller than the
shader's info.num_outputs when an output at the end isn't assigned. This
lead to us reading garbage after the end, and assuming that it
corresponded to r0.x and overwriting the xfb entry for some other random
output with the unassigned output's entry.

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

3 years agoAOSP: Add panfrost vulkan library suffix
Roman Stratiienko [Wed, 11 Aug 2021 08:07:41 +0000 (11:07 +0300)]
AOSP: Add panfrost vulkan library suffix

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12304>

3 years agoAOSP: Update timestamps of target binaries
Roman Stratiienko [Tue, 10 Aug 2021 17:22:36 +0000 (20:22 +0300)]
AOSP: Update timestamps of target binaries

Fixes warning during the build and unnecessary rule execution:
***
ninja: Missing `restat`? An output file is older than the most recent input:
***

Fixes: 8621bd8d5e67 ("android: Add scripts to build using meson")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Tested-by: Mauro Rossi <issor.oruam@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12304>

3 years agoAOSP: Upgrade libLLVM dependency to v12
Roman Stratiienko [Tue, 10 Aug 2021 10:14:22 +0000 (13:14 +0300)]
AOSP: Upgrade libLLVM dependency to v12

Now LLVMv12 seems to be stable enough, so we can upgrade to it.

Version adapted for AOSP can be found here [1]

[1]: https://github.com/maurossi/llvm-project/tree/release_12.x

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Tested-by: Mauro Rossi <issor.oruam@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12304>

3 years agoAOSP: Extract version from libdrm instead of hardcoding it.
Roman Stratiienko [Tue, 10 Aug 2021 10:10:44 +0000 (13:10 +0300)]
AOSP: Extract version from libdrm instead of hardcoding it.

mesa3d require up-to-date version of libdrm.
Hardcoding it to 2.4.105 is wrong.

Fixes: 8621bd8d5e67 ("android: Add scripts to build using meson")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Tested-by: Mauro Rossi <issor.oruam@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12304>

3 years agotu: Fix feedback loops in sysmem mode
Connor Abbott [Fri, 13 Aug 2021 14:24:01 +0000 (16:24 +0200)]
tu: Fix feedback loops in sysmem mode

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

3 years agofreedreno/a6xx: Document GRAS_SC_CNTL::SINGLE_PRIM_MODE
Connor Abbott [Fri, 13 Aug 2021 13:37:23 +0000 (15:37 +0200)]
freedreno/a6xx: Document GRAS_SC_CNTL::SINGLE_PRIM_MODE

Add a value discovered when investigating how the blob implements
GL_KHR_blend_equation_advanced.

Note that everything added here is a bit speculative, because it's
assuming the blob's implementation of GL_KHR_blend_equation_advanced is
sane. In particular a value of 0x3 seems to solve the UBWC problem as
well, so I'm not sure whether my description of the difference between
0x1 and 0x3 is correct. I'm also surprised that it uses the same value
for the coherent and non-coherent cases when forcing sysmem.

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