platform/upstream/mesa.git
21 months agoail: Introduce layer_alignment flag
Asahi Lina [Mon, 28 Nov 2022 08:29:17 +0000 (17:29 +0900)]
ail: Introduce layer_alignment flag

The hardware uses this flag to determine whether layer strides are
implicitly aligned to the page size or not.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20031>

21 months agoradv/llvm: add clip distance outputs manually if they're missing
Rhys Perry [Thu, 20 Oct 2022 13:54:18 +0000 (14:54 +0100)]
radv/llvm: add clip distance outputs manually if they're missing

It's possible that undef is written to clip/cull distance outputs and
they're eliminated, and we never set any position export to done=1 because
outinfo->pos_exports was calculated with the expectation that clip/cull is
exported.

Eliminating the export and fixing the done=1 bit hangs because the
hardware is still expecting clip/cull distances.

Fixes dEQP-VK.rasterization.provoking_vertex.transform_feedback.first.line_list
hang with LLVM.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19200>

21 months agoaco: Combine constant bit test to s_bitcmp.
Georg Lehmann [Tue, 18 Oct 2022 13:48:21 +0000 (15:48 +0200)]
aco: Combine constant bit test to s_bitcmp.

Foz-DB Navi21:
Totals from 73988 (54.84% of 134913) affected shaders:
VGPRs: 2959768 -> 2959752 (-0.00%)
SpillSGPRs: 10250 -> 10697 (+4.36%); split: -0.64%, +5.00%
SpillVGPRs: 2326 -> 2291 (-1.50%); split: -2.24%, +0.73%
CodeSize: 261339476 -> 261045912 (-0.11%); split: -0.12%, +0.00%
Scratch: 239616 -> 238592 (-0.43%)
Instrs: 49214044 -> 49188242 (-0.05%); split: -0.06%, +0.00%
Latency: 413214139 -> 413296229 (+0.02%); split: -0.03%, +0.05%
InvThroughput: 71741622 -> 71786300 (+0.06%); split: -0.07%, +0.13%
VClause: 856838 -> 856973 (+0.02%); split: -0.01%, +0.02%
SClause: 1504502 -> 1504567 (+0.00%); split: -0.01%, +0.02%
Copies: 4058433 -> 4060424 (+0.05%); split: -0.03%, +0.08%
Branches: 1502953 -> 1502945 (-0.00%); split: -0.00%, +0.00%
PreSGPRs: 3081927 -> 3081531 (-0.01%); split: -0.02%, +0.01%
PreVGPRs: 2513990 -> 2513992 (+0.00%)

The vast majority of instruction count regressions are caused by parallel-rdp.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18870>

21 months agoaco: Combine bit test to s_bitcmp.
Georg Lehmann [Sat, 24 Sep 2022 16:49:10 +0000 (18:49 +0200)]
aco: Combine bit test to s_bitcmp.

Foz-DB Navi21:
Totals from 6396 (4.74% of 134913) affected shaders:
VGPRs: 483280 -> 483152 (-0.03%); split: -0.03%, +0.01%
SpillSGPRs: 8119 -> 7941 (-2.19%)
CodeSize: 63377880 -> 63268556 (-0.17%); split: -0.20%, +0.03%
MaxWaves: 86778 -> 86810 (+0.04%)
Instrs: 11745621 -> 11725857 (-0.17%); split: -0.20%, +0.03%
Latency: 162400148 -> 162282230 (-0.07%); split: -0.08%, +0.01%
InvThroughput: 29179429 -> 29133173 (-0.16%); split: -0.16%, +0.00%
VClause: 208032 -> 208100 (+0.03%); split: -0.01%, +0.05%
SClause: 431390 -> 430849 (-0.13%); split: -0.24%, +0.11%
Copies: 896222 -> 893285 (-0.33%); split: -0.62%, +0.30%
Branches: 349806 -> 348770 (-0.30%); split: -0.90%, +0.60%
PreSGPRs: 618908 -> 613773 (-0.83%); split: -0.83%, +0.00%
PreVGPRs: 482901 -> 482893 (-0.00%)

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18870>

21 months agoaco: Combine s_abs and s_sub/s_add to s_absdiff.
Georg Lehmann [Fri, 23 Sep 2022 17:00:36 +0000 (19:00 +0200)]
aco: Combine s_abs and s_sub/s_add to s_absdiff.

Totals from 2 (0.00% of 134913) affected shaders:
CodeSize: 1344 -> 1336 (-0.60%)
Instrs: 277 -> 275 (-0.72%)

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18870>

21 months agoaco: Ignore instructions with exec operands in follow_operand.
Georg Lehmann [Wed, 28 Sep 2022 12:37:19 +0000 (14:37 +0200)]
aco: Ignore instructions with exec operands in follow_operand.

No Foz-DB changes.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18870>

21 months agoaco/optimizer: Cleanup ctx.uses handling for patterns which use follow_operand(....
Georg Lehmann [Wed, 28 Sep 2022 11:45:25 +0000 (13:45 +0200)]
aco/optimizer: Cleanup ctx.uses handling for patterns which use follow_operand(..., true).

No Foz-DB changes.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18870>

21 months agor600/sfn: always use four slots for Cayman trans ops
Gert Wollny [Mon, 28 Nov 2022 10:43:16 +0000 (11:43 +0100)]
r600/sfn: always use four slots for Cayman trans ops

This is a partial revert of
  ed6204eb0 (r600/sfn: only use 3 channels on Cayman for trans ops)

The scheduler and/or optimizer passes generate faulty code when
we use only three slots as decribed in the spec. So for now disable
this optimization.

Fixes: ed6204eb0 (r600/sfn: only use 3 channels on Cayman for trans ops)
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7774

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

21 months agoradv: reduce CPU overhead when emitting streamout descriptors
Samuel Pitoiset [Mon, 14 Nov 2022 09:44:35 +0000 (10:44 +0100)]
radv: reduce CPU overhead when emitting streamout descriptors

Only the last VGT stage can have streamout.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19723>

21 months agoasahi: Implement DISCARD_WHOLE_RESOURCE
Alyssa Rosenzweig [Thu, 24 Nov 2022 01:37:45 +0000 (20:37 -0500)]
asahi: Implement DISCARD_WHOLE_RESOURCE

We can reallocate to avoid a flush.

Scrolling rosenzweig.io in Firefox with WebRender enabled is now vsyncing at
60fps instead of being capped around 50fps. SuperTuxKart is noticeably faster as
well, though this was prompted by WebRender.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20013>

21 months agoagx: Don't depend sampler view on BO
Alyssa Rosenzweig [Thu, 24 Nov 2022 02:34:22 +0000 (21:34 -0500)]
agx: Don't depend sampler view on BO

The BO can change when shadowing, fix up at drawtime.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20013>

21 months agoagx: Add merge helpers to GenXML
Alyssa Rosenzweig [Thu, 24 Nov 2022 02:34:03 +0000 (21:34 -0500)]
agx: Add merge helpers to GenXML

From panfrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20013>

21 months agoagx: Make empty texture pack to all-zeroes
Alyssa Rosenzweig [Thu, 24 Nov 2022 02:33:46 +0000 (21:33 -0500)]
agx: Make empty texture pack to all-zeroes

So we can do partial textures.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20013>

21 months agoradv: only install 00-radv-defaults.conf if xmlconfig is used
Samuel Pitoiset [Mon, 28 Nov 2022 07:44:00 +0000 (08:44 +0100)]
radv: only install 00-radv-defaults.conf if xmlconfig is used

RADV has its own drirc file. Make sure it also uses the xmlconfig
enable option.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20029>

21 months agoasahi: Fix remaining build issues on macOS
Asahi Lina [Mon, 28 Nov 2022 07:09:49 +0000 (16:09 +0900)]
asahi: Fix remaining build issues on macOS

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20030>

21 months agoasahi: add fallback for DRM_FORMAT_MOD_INVALID on macOS
Eric Engestrom [Sun, 20 Nov 2022 10:46:21 +0000 (10:46 +0000)]
asahi: add fallback for DRM_FORMAT_MOD_INVALID on macOS

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19879>

21 months agoradv: emit DB_RENDER_OVERRIDE2 as part of the framebuffer
Samuel Pitoiset [Mon, 21 Nov 2022 17:29:30 +0000 (18:29 +0100)]
radv: emit DB_RENDER_OVERRIDE2 as part of the framebuffer

The number of samples from the image has to match the number of samples
from the pipeline anyways.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19906>

21 months agofreedreno/decode: add missing dependency
Erik Faye-Lund [Fri, 25 Nov 2022 10:45:06 +0000 (11:45 +0100)]
freedreno/decode: add missing dependency

The source code for rddecompiler includes adreno_common.xml.h, which is
a generated header. In order to ensure that the header has been written
when compiling rddecompiler.c, we need a dependency here.

Fixes: 03d80e0a6d3 ("freedreno/decode: Add 'rddecompiler' tool")
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20003>

21 months agofreedreno/rddecompiler: Fix memory leak.
Vinson Lee [Mon, 28 Nov 2022 00:55:22 +0000 (16:55 -0800)]
freedreno/rddecompiler: Fix memory leak.

Fix defect reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable stream_data going out of scope leaks the storage it points to.

Fixes: a7773c3c4c7 ("freedreno/rddecompiler: Add shader disasm/asm support")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20028>

21 months agoclover: test for nir fp64 lowering options for cl_khr_fp64
Gert Wollny [Tue, 22 Nov 2022 08:20:59 +0000 (09:20 +0100)]
clover: test for nir fp64 lowering options for cl_khr_fp64

With NIR we have softfp64, but we don't really want this for CL,
so check whether fp64 is lowered to a software implementation.

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

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19919>

21 months agopvr: Setup tile buffers.
Karmjit Mahil [Thu, 17 Nov 2022 17:17:42 +0000 (17:17 +0000)]
pvr: Setup tile buffers.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20007>

21 months agopvr: Don't print out secondaries if they aren't used.
Karmjit Mahil [Thu, 10 Nov 2022 16:05:32 +0000 (16:05 +0000)]
pvr: Don't print out secondaries if they aren't used.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20008>

21 months agopvr: Add '+' before desc offsets in debug output.
Karmjit Mahil [Thu, 10 Nov 2022 15:51:48 +0000 (15:51 +0000)]
pvr: Add '+' before desc offsets in debug output.

Having the '+' makes it more obvious that it's the offset of the
primary/secondary.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20008>

21 months agopvr: Use glsl syntax to show set and binding number.
Karmjit Mahil [Thu, 10 Nov 2022 09:31:14 +0000 (09:31 +0000)]
pvr: Use glsl syntax to show set and binding number.

This makes the descriptor set debug output's descriptor set number
and binding number more obvious. The previous format wasn't as
obvious unless you knew how to read it.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20008>

21 months agopvr: Change how desc set debug output section dividers are printed.
Karmjit Mahil [Thu, 10 Nov 2022 15:05:31 +0000 (15:05 +0000)]
pvr: Change how desc set debug output section dividers are printed.

Instead of hard coding in the exact string to print out for the
divider, now we're printing the same char n times so we only need
to specify the character and how many times to retreat it.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20008>

21 months agopvr: Don't print inactive bindings.
Karmjit Mahil [Wed, 9 Nov 2022 17:15:40 +0000 (17:15 +0000)]
pvr: Don't print inactive bindings.

Previously all bindings were printed out and an "X" was used to
indicate if a binding was not active for a particular stage.
This commit just skips those bindings entirely reducing possible
confusion.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20008>

21 months agopvr: Print out empty row if dynamic primaries or secondaries are missing.
Karmjit Mahil [Wed, 9 Nov 2022 17:06:16 +0000 (17:06 +0000)]
pvr: Print out empty row if dynamic primaries or secondaries are missing.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20008>

21 months agopvr: Explain why dynamic descriptors are allocated separately.
Karmjit Mahil [Wed, 9 Nov 2022 17:02:19 +0000 (17:02 +0000)]
pvr: Explain why dynamic descriptors are allocated separately.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20008>

21 months agoradv/rt: Check space before emitting descriptors
Konstantin Seurer [Sat, 26 Nov 2022 15:09:49 +0000 (16:09 +0100)]
radv/rt: Check space before emitting descriptors

Found by inspection.

cc: mesa-stable

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

21 months agoradv/ray_queries: Fix AABB handling
Konstantin Seurer [Sat, 12 Nov 2022 15:06:26 +0000 (16:06 +0100)]
radv/ray_queries: Fix AABB handling

AABB intersections always have to be committed manually.
-> We don't have to copy opaque ones to closest.

It's also invalid to query t for candidate AABBs.

Totals from 7 (14.29% of 49) affected shaders:
CodeSize: 171008 -> 169672 (-0.78%)
Instrs: 32499 -> 32250 (-0.77%); split: -0.78%, +0.01%
Latency: 418859 -> 414759 (-0.98%); split: -0.98%, +0.00%
InvThroughput: 89182 -> 88251 (-1.04%); split: -1.05%, +0.00%
VClause: 602 -> 599 (-0.50%)
SClause: 837 -> 835 (-0.24%)
Copies: 4804 -> 4802 (-0.04%); split: -0.35%, +0.31%
Branches: 1593 -> 1585 (-0.50%)
PreSGPRs: 567 -> 566 (-0.18%)

Fixes: 3f72061 ("radv/rq: Use the common traversal helper")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19698>

21 months agoradv/ray_queries: Move some initialization outside a likely branch
Konstantin Seurer [Sat, 12 Nov 2022 14:13:05 +0000 (15:13 +0100)]
radv/ray_queries: Move some initialization outside a likely branch

Gets rid of some copies.

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

21 months agofrontend/dri: rewrite and comment dri_make_current to make it make sense
Marek Olšák [Tue, 15 Nov 2022 23:07:46 +0000 (18:07 -0500)]
frontend/dri: rewrite and comment dri_make_current to make it make sense

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: unduplicate flush_drawable callback
Marek Olšák [Tue, 15 Nov 2022 22:09:32 +0000 (17:09 -0500)]
frontend/dri: unduplicate flush_drawable callback

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: remove the drawable ctx hack, we should always use current context
Marek Olšák [Wed, 16 Nov 2022 00:51:07 +0000 (19:51 -0500)]
frontend/dri: remove the drawable ctx hack, we should always use current context

I've checked the loaders that this is what they expect.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: clean up updating dri_drawable::refcount
Marek Olšák [Tue, 15 Nov 2022 21:25:21 +0000 (16:25 -0500)]
frontend/dri: clean up updating dri_drawable::refcount

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: move callbacks from the VTable into dri_screen, dri_drawable
Marek Olšák [Tue, 15 Nov 2022 21:13:49 +0000 (16:13 -0500)]
frontend/dri: move callbacks from the VTable into dri_screen, dri_drawable

This just moves the callbacks and renames the functions.
Some functions had to be moved up because they are initialized there.
Remove some obsolete comments.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: clean up the hacky implementation of kopper_drawable
Marek Olšák [Tue, 15 Nov 2022 21:07:52 +0000 (16:07 -0500)]
frontend/dri: clean up the hacky implementation of kopper_drawable

Just put the kopper_drawable fields into dri_drawable and remove
kopper_drawable. The creation code is simplified.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: inline __DRIscreen in dri_screen, make __DRIscreen opaque
Marek Olšák [Tue, 15 Nov 2022 06:49:27 +0000 (01:49 -0500)]
frontend/dri: inline __DRIscreen in dri_screen, make __DRIscreen opaque

This cleanup removes the dri_util structure __DRIscreen(Rec) that is
difficult to follow, and switches all code to using dri_screen directly.

It also inlines kopper_screen in dri_screen because I don't see any
other way to do this cleanup.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: inline __DRIcontext in dri_context, make __DRIcontext opaque
Marek Olšák [Tue, 15 Nov 2022 06:49:27 +0000 (01:49 -0500)]
frontend/dri: inline __DRIcontext in dri_context, make __DRIcontext opaque

This cleanup removes the dri_util structure __DRIcontext(Rec) that is
difficult to follow, and switches all code to using dri_context directly.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: inline __DRIdrawable in dri_drawable, make __DRIdrawable opaque
Marek Olšák [Tue, 15 Nov 2022 06:49:27 +0000 (01:49 -0500)]
frontend/dri: inline __DRIdrawable in dri_drawable, make __DRIdrawable opaque

This cleanup removes the dri_util structure __DRIdrawable(Rec) that is
difficult to follow, and switches all code to using dri_drawable directly.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: replace the CopySubBuffer callback with a direct call
Marek Olšák [Tue, 15 Nov 2022 05:15:24 +0000 (00:15 -0500)]
frontend/dri: replace the CopySubBuffer callback with a direct call

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: replace the DestroyBuffer callback with a direct call
Marek Olšák [Tue, 15 Nov 2022 05:15:24 +0000 (00:15 -0500)]
frontend/dri: replace the DestroyBuffer callback with a direct call

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: replace the DestroyScreen callback with a direct call
Marek Olšák [Tue, 15 Nov 2022 05:15:24 +0000 (00:15 -0500)]
frontend/dri: replace the DestroyScreen callback with a direct call

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: inline __DriverAPIRec
Marek Olšák [Tue, 15 Nov 2022 05:12:24 +0000 (00:12 -0500)]
frontend/dri: inline __DriverAPIRec

the vtable indirection was unnecessary

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: remove __DRIdrawableRec::dri2::stamp
Marek Olšák [Tue, 15 Nov 2022 02:10:16 +0000 (21:10 -0500)]
frontend/dri: remove __DRIdrawableRec::dri2::stamp

It's practically unused. It was only off by one at initialization, but
that didn't have any effect.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agofrontend/dri: add comments describing drawable invalidation logic
Marek Olšák [Tue, 15 Nov 2022 01:18:34 +0000 (20:18 -0500)]
frontend/dri: add comments describing drawable invalidation logic

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agodri: move private __DRIDriverVtableExtension out of dri_interface.h
Marek Olšák [Tue, 15 Nov 2022 01:48:38 +0000 (20:48 -0500)]
dri: move private __DRIDriverVtableExtension out of dri_interface.h

It's only used internally.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agoglx,dri: simplify indirect function call syntax
Marek Olšák [Tue, 15 Nov 2022 22:53:39 +0000 (17:53 -0500)]
glx,dri: simplify indirect function call syntax

just remove () and * and the space

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>

21 months agoci/amd: add raven flakes which was previously failing
David Heidelberg [Sat, 26 Nov 2022 22:35:53 +0000 (23:35 +0100)]
ci/amd: add raven flakes which was previously failing

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20022>

21 months agoradv: reserve space for the scissor in vkCmdBeginRendering.
Bas Nieuwenhuizen [Fri, 25 Nov 2022 21:15:17 +0000 (22:15 +0100)]
radv: reserve space for the scissor in vkCmdBeginRendering.

Fixes: c7d0d328d56 ("radv: Set the window scissor to the render area, not framebuffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20014>

21 months agoradv: Enable rayTracingPipelineShaderGroupHandleCaptureReplay[Mixed].
Tatsuyuki Ishi [Wed, 23 Nov 2022 01:50:18 +0000 (10:50 +0900)]
radv: Enable rayTracingPipelineShaderGroupHandleCaptureReplay[Mixed].

Tested that a q2rtx gfxr capture replays correctly and without the
capture/replay feature warning.

I ran the CTS too, but it seems to be just giving out a pass without
testing the code path.

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

21 months agonir: fix a leak of ralloc ctx in nir_opt_ray_query_ranges
Tapani Pälli [Fri, 25 Nov 2022 08:31:36 +0000 (10:31 +0200)]
nir: fix a leak of ralloc ctx in nir_opt_ray_query_ranges

Fixes following leak:

  ==7520== 48 bytes in 1 blocks are definitely lost in loss record 1,597 of 2,016
  ==7520==    at 0x484486F: malloc (vg_replace_malloc.c:381)
  ==7520==    by 0x5314A4E: ralloc_size (ralloc.c:117)
  ==7520==    by 0x5314A1F: ralloc_context (ralloc.c:104)
  ==7520==    by 0x6A95D68: nir_opt_ray_query_ranges (nir_opt_ray_queries.c:235)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: f5b657658588 ("nir: Add a pass for combining ray queries")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20002>

21 months agoetnaviv: remove copy of resource level in etna_surface
Lucas Stach [Thu, 17 Nov 2022 15:07:06 +0000 (16:07 +0100)]
etnaviv: remove copy of resource level in etna_surface

Keeping a full copy of the resource level around in the surface is
confusing and this confusion has caused real bugs already. Get rid
of the copy by retrieving most of the information directly from the
etna_resource_level pointed at from the surface. Only the precomputed
offsets into the target and TS BOs need to be kept in the surface.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19814>

21 months agoetnaviv: fix wrong surface TS clear size
Lucas Stach [Thu, 17 Nov 2022 14:56:40 +0000 (15:56 +0100)]
etnaviv: fix wrong surface TS clear size

Clearing ts_size - ts_offset bytes in a level means we are clearing the
TS region of all layers in the level starting from the surface layer, so
clearing one surface might corrupt all other layers of a resource level.
Use the correct size to clear only the requested TS region.

Cc: mesa-stable
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19814>

21 months agoetnaviv: blt: use correct TS offset in clear operations
Lucas Stach [Thu, 17 Nov 2022 14:50:59 +0000 (15:50 +0100)]
etnaviv: blt: use correct TS offset in clear operations

Using the ts_offset from the level means we are always clearing the
TS region of layer 0 of the level. Use the correct offset which takes
into account the layer offset.

Cc: mesa-stable
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19814>

21 months agoetnaviv: fix ZS clear value computation
Lucas Stach [Wed, 23 Nov 2022 11:29:40 +0000 (12:29 +0100)]
etnaviv: fix ZS clear value computation

Instead of hand-rolling our own conversion and apparently getting the
rounding wrong, just use the common util function.

Fixes piglit test spec@!opengl 1.1@depthstencil-default_fb-clear

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19958>

21 months agoetnaviv: fix stencil operation without Z write
Lucas Stach [Wed, 23 Nov 2022 10:52:44 +0000 (11:52 +0100)]
etnaviv: fix stencil operation without Z write

If stencil operations are enabled, we either need the full early or
late ZS stage, even if Z writes are disabled. Empirically the early
stage properly supports stencil operations, just need to be careful to
not mix early tests with late writes when stencil operations modify
the depth buffer.

Fixes piglit tests:
spec@!opengl 1.1@depthstencil-default_fb-copypixels
spec@!opengl 1.1@depthstencil-default_fb-readpixels
spec@!opengl 1.1@depthstencil-default_fb-blit

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19958>

21 months agoRevert "glx/dri: Fix DRI drawable release at MakeCurrent time"
Martin Roukala (né Peres) [Thu, 24 Nov 2022 09:55:45 +0000 (11:55 +0200)]
Revert "glx/dri: Fix DRI drawable release at MakeCurrent time"

This reverts commit 31b04e420b0eb080084c6323066ea0b83929d59e which
is also breaking KDE in some ways.

Fixes: #7674
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19972>

21 months agoRevert "glx: Fix drawable refcounting for naked Windows"
Martin Roukala (né Peres) [Thu, 24 Nov 2022 06:38:17 +0000 (08:38 +0200)]
Revert "glx: Fix drawable refcounting for naked Windows"

This reverts commit 768238fdc06eed3dce36da3baf811cb70db42b5c which
is not only leading to memory leaks, but also reportedly breaks KDE
pretty badly.

Fixes: #7674, #7435
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19972>

21 months agoetnaviv: rs: fix blits with insufficient alignment for dual pipe operation
Lucas Stach [Thu, 24 Nov 2022 15:54:48 +0000 (16:54 +0100)]
etnaviv: rs: fix blits with insufficient alignment for dual pipe operation

Up-aligning the blit height does not always work, as some blit targets
have a smaller padded height. Fall back to single pipe operation if
increasing the height alignment fails. Still try to do it opportunistically
as it improves performance when resolving MSAA targets.

Fixes: 0ff96aaef3b1 ("etnaviv: rs: fix MSAA alignment adjustment")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19991>

21 months agoetnaviv: always use RS align when GPU has TEXTURE_HALIGN feature
Lucas Stach [Thu, 24 Nov 2022 15:39:35 +0000 (16:39 +0100)]
etnaviv: always use RS align when GPU has TEXTURE_HALIGN feature

Due to a logic bug we didn't always up-align the resource when the GPU
has the TEXTURE_HALIGN feature, which broke the RS blit when we need
to blit into a sampler shadow from a multi-tiled render target.

Fixes: 735718ed33b2 ("etnaviv: move etna_layout_multiple into etnaviv_resource.c")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19991>

21 months agoasahi: Add missing #include
Alyssa Rosenzweig [Fri, 25 Nov 2022 01:40:52 +0000 (20:40 -0500)]
asahi: Add missing #include

Noticed when shuffling headers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoasahi: Enable framebuffer compression
Alyssa Rosenzweig [Fri, 25 Nov 2022 02:30:33 +0000 (21:30 -0500)]
asahi: Enable framebuffer compression

At 4K, glmark2 -bdesktop from 60fps to 86fps.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoasahi: Fix incorrect debug string
Alyssa Rosenzweig [Thu, 24 Nov 2022 01:35:26 +0000 (20:35 -0500)]
asahi: Fix incorrect debug string

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoasahi: Print debug info about unsupported blits
Alyssa Rosenzweig [Thu, 24 Nov 2022 01:05:03 +0000 (20:05 -0500)]
asahi: Print debug info about unsupported blits

Black box for when we're going down.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoasahi: Don't hardcode is_dmabuf_modifier_supported
Alyssa Rosenzweig [Fri, 25 Nov 2022 16:54:50 +0000 (11:54 -0500)]
asahi: Don't hardcode is_dmabuf_modifier_supported

So we can add more modifiers more easily.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoasahi: Hook up compressed Z/S support on macOS
Asahi Lina [Fri, 25 Nov 2022 02:07:10 +0000 (21:07 -0500)]
asahi: Hook up compressed Z/S support on macOS

We still need to handle uncompressed depth on G13X, but that might never
actually happen in practice.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoasahi: Introduce compressed resource support
Asahi Lina [Wed, 23 Nov 2022 15:01:06 +0000 (00:01 +0900)]
asahi: Introduce compressed resource support

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoasahi: Identify compression-related XML
Asahi Lina [Wed, 23 Nov 2022 13:21:18 +0000 (22:21 +0900)]
asahi: Identify compression-related XML

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoail: Add unit tests for compression
Asahi Lina [Fri, 25 Nov 2022 02:16:44 +0000 (21:16 -0500)]
ail: Add unit tests for compression

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agoail: Introduce support for compression
Asahi Lina [Wed, 23 Nov 2022 11:38:23 +0000 (20:38 +0900)]
ail: Introduce support for compression

The main buffer is twiddled as before, but there's now also an auxiliary
compression buffer that we need to reserve space for.

With compression, the main buffer is aligned less. The macOS logic seems to be
to align to the page size only if the texture is both 3D and mipmapped, *and*
the layer stride is greater than the page size.

That's gated on compression being enabled. Page alignment seems to be needed for
uncompressed twiddled cube maps.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

21 months agodriconf/intel: Use fake vendor to WA bad detection in Source engine games
Sviatoslav Peleshko [Thu, 17 Nov 2022 20:59:20 +0000 (22:59 +0200)]
driconf/intel: Use fake vendor to WA bad detection in Source engine games

Source engine uses flawed device detection in Linux native OpenGL backend,
which causes it to use bad configurations for Intel devices and thus
not always render correctly. Workaround this by using vendor string that
does not include "Intel" in it.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7725
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19828>

21 months agoasahi: Fix undefined behaviour with samplers
Alyssa Rosenzweig [Thu, 24 Nov 2022 23:26:20 +0000 (18:26 -0500)]
asahi: Fix undefined behaviour with samplers

bind_sampler_states doesn't zero [nr_samplers, PIPE_MAX_SAMPLERS) so can get
non-null garbage samplers leading to a use-after-free (segfault derefencing
sampler) or a buffer overflow (writing samplers[] out).

Fixes crashes in Xonotic.

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

21 months agoasahi: Set GPR count accurately for background/EOT
Alyssa Rosenzweig [Thu, 24 Nov 2022 17:35:22 +0000 (12:35 -0500)]
asahi: Set GPR count accurately for background/EOT

Better occupancy, which is especially important when the background shader
does memory access (for reloads). On my 4K monitor, glmark2 -bdesktop fullscreen
from 95fps to 133fps.

At default settings, glmark2 -bterrain from 63fps to 71fps.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19997>

21 months agoasahi: Fix UB in union with logic ops
Alyssa Rosenzweig [Thu, 24 Nov 2022 15:55:20 +0000 (10:55 -0500)]
asahi: Fix UB in union with logic ops

Colour mask written.

Fixes: 9dddbfeaef2 ("asahi: Fix logic ops")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19998>

21 months agoradv/ci: Add coverage for ETC2 emulation.
Bas Nieuwenhuizen [Mon, 21 Nov 2022 23:16:05 +0000 (00:16 +0100)]
radv/ci: Add coverage for ETC2 emulation.

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

21 months agovulkan: Remove asserts that weren't valid for RADV ETC2 emulation.
Bas Nieuwenhuizen [Mon, 21 Nov 2022 23:07:43 +0000 (00:07 +0100)]
vulkan: Remove asserts that weren't valid for RADV ETC2 emulation.

Wasn't caught when radv was modified to use these helpers ...

Tried to move the aspects assert so it still checks application inputs.

Fixes: d9048e31a0d ("radv: Use vk_image_view as the base for radv_image_view")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19914>

21 months agoradv: Fix sampler types in ETC2 decode.
Bas Nieuwenhuizen [Mon, 21 Nov 2022 22:38:53 +0000 (23:38 +0100)]
radv: Fix sampler types in ETC2 decode.

Otherwise we'd have a type mismatch vs texture fetches, which
is asserted upon these days.

Fixes: 1153db23f58 ("radv: Add ETC2 decode shader.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19914>

21 months agoradv: Use correct init order for ETC2 image views
Bas Nieuwenhuizen [Mon, 21 Nov 2022 22:33:31 +0000 (23:33 +0100)]
radv: Use correct init order for ETC2 image views

Fixes: d9048e31a0d ("radv: Use vk_image_view as the base for radv_image_view")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19914>

21 months agoradeonsi: mark glx-multithread-texture as a flake
Erik Faye-Lund [Fri, 25 Nov 2022 10:54:47 +0000 (11:54 +0100)]
radeonsi: mark glx-multithread-texture as a flake

This has apparently been flaking for a while, so let's mark it as such.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7772
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20004>

21 months agopvr: debug: Add PPP sub-buffer support to CSB dumps.
Matt Coster [Tue, 16 Aug 2022 10:23:43 +0000 (11:23 +0100)]
pvr: debug: Add PPP sub-buffer support to CSB dumps.

This patch also includes the infrastructure for dumping sub-buffers in
print_sub_buffer() and new field types for floating and fixed point
decimals.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agopvr: csbgen: Remove TEXTURE_WRAP_VARYING-dependent fields
Matt Coster [Thu, 9 Jun 2022 12:51:51 +0000 (13:51 +0100)]
pvr: csbgen: Remove TEXTURE_WRAP_VARYING-dependent fields

This patch removes all fields dependent on the TEXTURE_WRAP_VARYING,
feature which is not currently supported.

It also removes STATE_PPP_CTRL.trp which is conditional on another
unused feature.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agopvr: debug: Add option to track pvr_bo allocations
Matt Coster [Mon, 6 Jun 2022 16:48:13 +0000 (17:48 +0100)]
pvr: debug: Add option to track pvr_bo allocations

This functionality should only need to be enabled when required by
other debug options.

While not used directly in this commit, it lays the groundwork for
dumping information from buffers referenced by other buffers.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agopvr: debug: Add "cs" debug option to dump control stream on job submit
Matt Coster [Wed, 29 Jun 2022 08:47:33 +0000 (09:47 +0100)]
pvr: debug: Add "cs" debug option to dump control stream on job submit

With PVR_DEBUG=cs, the control stream will be dumped to stderr
immediately prior to every render or compute job submission.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agopvr: debug: Add documentation for PVR_DEBUG environment variable
Matt Coster [Thu, 26 May 2022 08:45:28 +0000 (09:45 +0100)]
pvr: debug: Add documentation for PVR_DEBUG environment variable

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agopvr: Add pvr_bo_cpu_map_unchanged() helper to load saved vbits on map
Matt Coster [Tue, 16 Aug 2022 10:07:24 +0000 (11:07 +0100)]
pvr: Add pvr_bo_cpu_map_unchanged() helper to load saved vbits on map

When HAVE_VALGRIND is set, vbits of the CPU mapping are stored when
pvr_bo_cpu_unmap() is called. They can be reloaded by calling
pvr_bo_cpu_map_unchanged() instead of pvr_bo_cpu_map(). The vbits are
not loaded by default on every map, since they could easily have been
changed by the device between the unmap/map calls. Only use
pvr_bo_cpu_map_unchanged() when you can safely assume that nothing has
changed in the underlying memory.

When HAVE_VALGRIND is not set, pvr_bo_cpu_map_unchanged() just inlines
to pvr_bo_cpu_map().

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agopvr: csbgen: Generate enum-to-string functions for debugging
Matt Coster [Wed, 25 May 2022 12:30:55 +0000 (13:30 +0100)]
pvr: csbgen: Generate enum-to-string functions for debugging

All enums should be unambiguous, so an error is raised when multiple
enum variants with the same value are encountered. When no enum
variants match the provided value, NULL is returned. This allows the
to-string functions to double as validators.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agopvr: util: Add integer digit counting functions
Matt Coster [Mon, 6 Jun 2022 16:06:30 +0000 (17:06 +0100)]
pvr: util: Add integer digit counting functions

These are (reasonably) fast helpers for computing the number of binary,
decimal or hexadecimal digits required to represent a given non-negative
integer.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18948>

21 months agoradv: make sure to mark DCC as compressed on GFX11
Samuel Pitoiset [Fri, 25 Nov 2022 11:00:33 +0000 (12:00 +0100)]
radv: make sure to mark DCC as compressed on GFX11

The bit has moved to FDCC_ENABLE on GFX11.
Found by inspection.

Cc: 22.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20005>

21 months agoac/nir: combine shift translation
Rhys Perry [Wed, 23 Nov 2022 20:46:59 +0000 (20:46 +0000)]
ac/nir: combine shift translation

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19966>

21 months agoac/nir: mask shift operands
Rhys Perry [Wed, 23 Nov 2022 20:41:29 +0000 (20:41 +0000)]
ac/nir: mask shift operands

NIR shifts are defined to truncate the shift amount to the number of bits
needed to represent the bit-size of the value shifted. LLVM treats large
shifts as poison. This fix achieves NIR semantics for shifts.

As an example, a|(b << 32), where "a" is 32bits, should produce a|b
according to NIR (because 32&31 == 0).

This caused LLVM to incorrectly optimize "(a >> c) | (b << (32 - c))" to a
u2u32(pack_64_2x32(a, b) >> c) (v_alignbit_b32), when the original NIR
should have returned "a | b" if c==0.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19966>

21 months agovirgl: Fix injection of double from const mov instruction
Gert Wollny [Thu, 24 Nov 2022 09:14:25 +0000 (10:14 +0100)]
virgl: Fix injection of double from const mov instruction

We only copy two components, we have to use the complete original source,
and we should rewrite the new source from scratch to avoid incorrect
dimension and indirect handling.

Fixes: 036d7172c (virgl: Move double operands to a temp to avoid double-swizzling bugs)

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

21 months agoradv: remove useless parenthesis in radv_cmd_buffer_flush_dynamic_state()
Samuel Pitoiset [Fri, 18 Nov 2022 09:13:57 +0000 (10:13 +0100)]
radv: remove useless parenthesis in radv_cmd_buffer_flush_dynamic_state()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19843>

21 months agoradv: simplify handling logic op when it's not dynamic
Samuel Pitoiset [Fri, 18 Nov 2022 08:59:20 +0000 (09:59 +0100)]
radv: simplify handling logic op when it's not dynamic

The command buffer already emits ROP3_COPY if the logic op is disabled.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19843>

21 months agoradv: fix and rework DISABLE_DUAL_QUAD setting
Samuel Pitoiset [Fri, 18 Nov 2022 09:41:27 +0000 (10:41 +0100)]
radv: fix and rework DISABLE_DUAL_QUAD setting

This bit can be enabled with various combinations and it looks better
to only emit it from the cmdbuf.

Fixes: 17b9aa92b77 ("radv: add support for dynamic logic op enable")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19843>

21 months agoradv: re-emit dynamic provoking vertex mode if primitive topology changed
Samuel Pitoiset [Fri, 18 Nov 2022 09:10:24 +0000 (10:10 +0100)]
radv: re-emit dynamic provoking vertex mode if primitive topology changed

The vertex shader depends on the primitive topology.

Fixes: 2cce8500de0 ("radv: add support for dynamic provoking vertex mode with NGG")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19843>

21 months agoradv: re-emit dynamic depth clamp enable if depth clip enable changed
Samuel Pitoiset [Fri, 18 Nov 2022 08:50:40 +0000 (09:50 +0100)]
radv: re-emit dynamic depth clamp enable if depth clip enable changed

The depth clamp mode depends on depth clip enable/disable.

Fixes: e48c0fbd8f7 ("radv: add support for dynamic depth clamp enable")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19843>

21 months agoanv: use the anv_state_pool address helper more
Lionel Landwerlin [Wed, 23 Nov 2022 10:02:41 +0000 (12:02 +0200)]
anv: use the anv_state_pool address helper more

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19983>

21 months agov3dv: allocate copy query pipelines lazily
Iago Toral Quiroga [Thu, 24 Nov 2022 12:47:40 +0000 (13:47 +0100)]
v3dv: allocate copy query pipelines lazily

Instead of creating all 8 pipeline combinations when we initialize
the device we create the pipelines when we need to use them. This
is probably better because applications are likely to always use
the same flags for the copy command, which means that only one
pipeline may be required.

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

21 months agoradv: fix memleak with link time optimizations and GPL
Samuel Pitoiset [Thu, 24 Nov 2022 07:20:39 +0000 (08:20 +0100)]
radv: fix memleak with link time optimizations and GPL

Do not clone the NIR when the driver retains NIR shaders because it
exits early, otherwise stage->nir will never be freed.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7768
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19973>