Commit Graph

147652 Commits

Author SHA1 Message Date
Rhys Perry 6afba80534 aco: don't create DPP instructions with SGPR operands
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 2e6834d4f6 ("aco: combine DPP into VALU before RA")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13976>
2021-11-30 20:11:48 +00:00
Alyssa Rosenzweig 8d2be391e3 panfrost: Add empty tile flags to GenXML
These flags control special CRC handling for empty tiles using the CRC
clear colour field added on Bifrost. Their use depends on CRC being
used. We missed these flags earlier; let's add them since they are used
by the Valhall DDK but are not new to Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13982>
2021-11-30 15:43:59 +00:00
Samuel Pitoiset 8f00f19da5 radv: fix resetting the entire vertex input dynamic state
If there is holes, eg. the application firsts set vertex attributes
0 and 1, then vertex attributes 0 and 7, the format of vertex attribute
1 is still the previous one, while it should be FORMAT_INVALID to avoid
a GPU hang.

This fixes a GPU hang with Yuzu.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5627
Cc: 21.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13856>
2021-11-30 15:10:39 +00:00
Nanley Chery 18cd0a5409 anv: Drop code from get_blorp_surf_for_anv_buffer
The code to handle ASTC surfaces hasn't been needed since commit
dd92179a72 ("anv: Canonicalize buffer formats for image/buffer copies").

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>
2021-11-30 13:36:35 +00:00
Nanley Chery 355f318843 anv: Allow transfer-only linear ASTC images
Some apps depend on this to run.

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

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>
2021-11-30 13:36:35 +00:00
Nanley Chery bdf8b36c4c anv: Require transfer features for transfer usages
In order for an image to support the transfer usage, require that its
format can be used for blits or copies.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>
2021-11-30 13:36:35 +00:00
Nanley Chery 8171535c45 iris: Allow GPU-based uploads of ASTC textures
ISL recently started allowing linear ASTC surfaces to be created. With
that in place, iris can perform GPU-based uploads to ASTC textures in
the same way it does so with other compressed surfaces.

We're not aware of any reason to continue special-casing ASTC texture
uploads, so we get rid of the code which does so.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>
2021-11-30 13:36:35 +00:00
Nanley Chery caa998ca8f intel/isl: Allow creating non-Y-tiled ASTC surfaces
The sampler can only decode ASTC surfaces that are Y-tiled. ISL has
been asserting this restriction at surface creation time.

However, some drivers want to create a surface that is only used for
copying compressed data. And during the copy, the surface won't have a
compressed format.

To enable this behavior, we choose to move the tiling assertion to the
moment a surface state is created for the sampler.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>
2021-11-30 13:36:35 +00:00
Kenneth Graunke 574c5d1540 blorp: Disallow multisampling for BLORP compute blits and copies.
We don't support typed image writes for multisampling, so we can't
handle multisampled destinations.  We also usually handle MSAA by
running the fragment shader per-sample, which we aren't accounting
for in our compute shaders, so we can't handle MSAA sources either.

We could do both of these things if we really wanted to, but we don't.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13524>
2021-11-30 12:30:50 +00:00
Kenneth Graunke f0744ebef2 blorp: Assert that BLORP_BATCH_PREDICATE_ENABLE isn't set for compute
We don't support this, so make sure it isn't happening.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13524>
2021-11-30 12:30:50 +00:00
Kenneth Graunke 5dc36e5e93 blorp: Don't try to use the 3D stencil write hardware for compute
When we're doing a stencil blit via a fragment shader, we can avoid
W-tiling shenanigans by using the stencil write hardware on Skylake
and later.

Of course, the compute engine doesn't have stencil fragment writes,
so it can't do that.  Just fall back to the detiling shenanigans.

Caught by Piglit's arb_copy_image-formats when forcing iris to use
BLOCS for resource_copy_region on Icelake.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13524>
2021-11-30 12:30:50 +00:00
Kenneth Graunke d832209a78 blorp: Fix compute-blits for rectangles not aligned to the workgroup
When dispatching compute shaders to do a blit, our destination rectangle
may not line up perfectly with the workgroup size.  For example, we may
round the left x0 coordinate down to a multiple of the workgroup width,
and the right x1 coordinate up to the next multiple of the workgroup
width.  Similarly for y0/y1 and workgroup height.  This means that we
may dispatch additional invocations which should not actually do any
blitting.  We need to set key->uses_kill to bounds check and drop those.

Caught by Piglit's arb_copy_image-simple when forcing iris to perform
resource_copy_region via BLOCS and running with INTEL_DEBUG=norbc on
Icelake.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13524>
2021-11-30 12:30:50 +00:00
Filip Gawin 80c2b27438 iris: fix mapping compressed textures
This code was originally made for crocus by Dave Airlie.
Iris is also affected, so this commit ports the fix.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12993>
2021-11-30 10:07:35 +00:00
Qiang Yu fcc062235c ci: remove egl-copy-buffers from fail list
egl-copy-buffers test has been fixed for dri3. So remove
it from broadcom and freedreno ci fail list to prevent the
gitlab ci test fail:

  spec@egl 1.4@egl-copy-buffers,UnexpectedPass

Also remove it from radeonsi ci fail list since I verified
on radeonsi.

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13868>
2021-11-30 01:58:42 +00:00
Qiang Yu 24aa03e9e8 loader/dri3: fix piglit egl-copy-buffer test
In the test no front buffer has been allocated on the client
side, so we get a segfault when access it directly.

eglCopyBuffers() just need to do server side copy, so we don't
really need to create a client side front buffer to perform
the copy.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13868>
2021-11-30 01:58:42 +00:00
Mykhailo Skorokhodov 391569e911 nir: Fix read depth for predecessors
In some non-trivial cases (the amber script file in the merge
request description) phi instruction has more than 32 elements
in predecessors tree and that isn't recursion, just large tree.
In that case, phis not fully converted into a register or mov,
but successfully removed.

The fix removes the counter and adds container of visited blocks.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3690
Cc: mesa-stable
Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13710>
2021-11-30 00:12:48 +00:00
Ilia Mirkin e31d08d307 ci: move windowoverlap exclusion to all-skips
The test is just plain not built by our containers. Skip it everywhere.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13919>
2021-11-29 18:08:49 -05:00
Rhys Perry 32a8b391e3 nir/tests: add DCE test for loops following a jump
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>
2021-11-29 22:22:24 +00:00
Rhys Perry cc5dd15417 nir/cf: fix insertion of loops/ifs after jumps
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>
2021-11-29 22:22:24 +00:00
Rhys Perry 2fe13aa2ad nir/dce: fix DCE of loops with a halt or return instruction in the pre-header
If there is a halt or return instruction right before a loop with a single
continue, we would have taken the fast path intended for loops without
continues.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 71a985d80b ("nir/dce: perform DCE for unlooped instructions in a single pass")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>
2021-11-29 22:22:24 +00:00
Vasily Khoruzhick 34a75ce15c lima: fix blending with min/max ops
It turns out that BLEND_MIN and BLEND_MAX in Utgard take blend factors
into account. My guess is that actual equation looks like:

OP(As * S + Ad * D, Ad) for alpha, and
OP(Cs * S + Cd * D, Cd) for color.

So we have to set S factor to 1 and D factor to 0 to be compliant with
GL spec.

Fixes following piglit tests:
spec@!opengl 1.4@blendminmax
spec@arb_blend_func_extended@arb_blend_func_extended-fbo-extended-blend
(with patch my for ES2_compatibility and EXT_blend_func_extended)

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13873>
2021-11-29 19:31:59 +00:00
Vasily Khoruzhick 5f9434b611 lima: use 1 as blend factor for dst_alpha for SRC_ALPHA_SATURATE
As per [1] alpha blend factors for Sa and Da should be 1 for
SRC_ALPHA_SATURATE

[1] https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_blend_func_extended.txt

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13873>
2021-11-29 19:31:59 +00:00
Vasily Khoruzhick d1d3ebb48c lima: implement dual source blend
It was a bit trickier to RE, since blob doesn't expose this
functionality at all, however we had a clue from the very beginning:
lima_blend_factor is 3 bits, i.e. 8 values, but only 5 of them were
used, it just waited till someone tried what 3 unused values do.

Interestingly enough, it turns out "5" works just as "0" (which is
PIPE_BLENDFACTOR_*SRC_*), but only if output register for gl_FragColor
is $0, So it looks suspiciously similar with PIPE_BLENDFACTOR_*SRC1_*
behavior, and looks like secondary output is taken from $0.

Since output regs for all other outputs are configured via RSW, there
must be a field in RSW for output register for secondary color, it's
likely 4 bits and it's currently set to 0 for reg $0.

Then it was just a matter of brute-forcing various consecutive 4 bits
in RSW - and indeed, setting top 4 bits of rsw->aux0 to the index of
gl_FragColor output register fixes blending tests when we use "5"
blend factor instead of "0".

So it must be a register number for gl_SecondaryFragColor. Unlike
gl_FragColor, the field is only repeated once in RSW.

Wire it up in compiler, and piglit arb_blend_func_extended now passes.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13873>
2021-11-29 19:31:59 +00:00
Rhys Perry 65a78b2252 aco: properly update use counts if a extract is still used
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13909>
2021-11-29 18:52:12 +00:00
Vasily Khoruzhick b8f4d36ee4 lima: disasm: call util_cpu_detect() to init CPU caps
It's needed by _mesa_half_to_float(), without this change it hits
assertion failure in util_get_cpu_caps().

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13968>
2021-11-29 18:34:58 +00:00
Vasily Khoruzhick 711a4ccddb lima: disasm: use last argument as a filename
Otherwise it fails to open a file.

Fixes: 9660427ab7 ("lima: Print usage if --help is any of the arguments.")
Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13968>
2021-11-29 18:34:58 +00:00
Vasily Khoruzhick 437b97de1c lima: fix crash with sparse samplers
Fixes following piglit tests:
spec@arb_fragment_program@fp-fragment-position
spec@arb_fragment_program@sparse-samplers

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13939>
2021-11-29 18:19:19 +00:00
Marek Olšák e48f676835 glthread: don't sync for more glGetIntegerv enums for glretrace
This makes glretrace faster with glthread.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13970>
2021-11-29 14:28:12 +00:00
Iago Toral Quiroga 996f147fef broadcom/compiler: relax restriction on VPM inst in last thread end slot
According to the documentation, only vpmwt is disallowed in the last delay
slot of the thread end.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13975>
2021-11-29 14:06:43 +00:00
Filip Gawin 57969c6dad radv: dont call calloc when BVH is empty
Usage of pointer returned by calloc(0) is UB.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13503>
2021-11-29 13:38:37 +00:00
Samuel Pitoiset 8eae431720 radv/llvm: constify radv_shader_info
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/13542>
2021-11-29 10:10:07 +00:00
Samuel Pitoiset 6c1cd2fd3a radv/llvm: stop trying to eliminate VS outputs
This has no effects, except for XFB but that shouldn't really matter.

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/13542>
2021-11-29 10:10:06 +00:00
Samuel Pitoiset 5a94271069 radv: constify radv_shader_info in radv_declare_shader_args()
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/13542>
2021-11-29 10:10:06 +00:00
Samuel Pitoiset 096c02bcf5 radv: copy the user SGPRs locations outside of radv_declare_shader_args()
The shader locations are now directly stored in radv_shader_args which
makes sense because they are tied to the arguments. The locations are
then copied to radv_shader_info but they will be moved into a new
radv_shader_binary_info with upcoming changes.

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/13542>
2021-11-29 10:10:06 +00:00
Samuel Pitoiset 3bbc226d7a radv: configure the number of SGPRs/VGPRs directly from the arguments
Instead of copying the values to radv_shader_info.

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/13542>
2021-11-29 10:10:06 +00:00
Samuel Pitoiset 990a8ee5eb radv: add a workaround to fix a segfault with Metro Exodus (Linux native)
The game calls vkGetSemaphoreCounterValue() with an invalid semaphore
handle and it crashes. This is an invalid Vulkan usage and it should
be fixed in the game. I reported the issue to the developers.

Workaround this temporarily (hopefully) by ignoring
vkGetSemaphoreCounterValue() if the semaphore is NULL from an internal
RADV layer.

Cc: 21.3 mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5119
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/13956>
2021-11-29 09:01:30 +00:00
Samuel Pitoiset a58f68fc68 radv: fix accessing NULL pointers when destroy the VRS image
Detected by UBSAN.

../src/amd/vulkan/radv_private.h:2939:1: runtime error: member access
within null pointer of type 'struct radv_device_memory'

../src/amd/vulkan/radv_private.h:2926:1: runtime error: member access
within null pointer of type 'struct radv_buffer'

../src/amd/vulkan/radv_private.h:2945:1: runtime error: member access
within null pointer of type 'struct radv_image'

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/13965>
2021-11-29 08:55:02 +01:00
Iago Toral Quiroga 6923dd687c broadcom/compiler: allow color TLB writes in last instruction
Only Z writes are disallowed.

total instructions in shared programs: 11578449 -> 11577369 (<.01%)
instructions in affected programs: 38132 -> 37052 (-2.83%)
helped: 1080
HURT: 0
Instructions are helped.

total max-temps in shared programs: 2334416 -> 2334395 (<.01%)
max-temps in affected programs: 218 -> 197 (-9.63%)
helped: 21
HURT: 0
Max-temps are helped.

total inst-and-stalls in shared programs: 11607890 -> 11606810 (<.01%)
inst-and-stalls in affected programs: 38265 -> 37185 (-2.82%)
helped: 1080
HURT: 0
Inst-and-stalls are helped.

total nops in shared programs: 338316 -> 337236 (-0.32%)
nops in affected programs: 2625 -> 1545 (-41.14%)
helped: 1080
HURT: 0
Nops are helped.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13964>
2021-11-29 06:44:07 +00:00
Ilia Mirkin f533d7a446 freedreno/ir3: get the post-lowering clip/cull mask
The variant may include a lowered gl_Clip/CullDistance array. So we have
to use the variant's info (which is not available). However we save off
the clip/cull masks already, so just reuse those.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13891>
2021-11-28 02:55:58 -05:00
Ilia Mirkin 13fb587b8a freedreno/ir3: indicate that clipdist arrays are in use
We expose the compact array cap, which means that we get compact
clipdist arrays. Indicate this to the lowering pass so that it works for
gl_ClipDistance from fs, among others.

Fixes, among others, on a420,

tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-interpolated.shader_test

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13891>
2021-11-28 02:55:58 -05:00
Ilia Mirkin b7f423006a nir/lower_clip: support clipdist array + no vars
This runs after the "to io" lowering on freedreno. Support this case.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>
2021-11-28 04:44:56 +00:00
Ilia Mirkin 7efb1c4b29 nir/lower_clip: increment num_inputs/outputs by appropriate amount
The inputs/outputs are meant to be in vec4 units.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>
2021-11-28 04:44:56 +00:00
Ilia Mirkin 3bf47700e2 nir/lower_clip: location offset goes into offset, not base
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>
2021-11-28 04:44:56 +00:00
Ilia Mirkin a8930e6302 nir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL
gl_ClipDistance most definitely can be read in fragment shaders since
GLSL 1.30. This is also accessible in ES with EXT_clip_cull_distance.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>
2021-11-28 04:44:56 +00:00
Leandro Ribeiro b5848b2dac egl/wayland: use surface dma-buf feedback to allocate surface buffers
As explained in "egl/wayland: add initial dma-buf feedback support", we
still don't use the per-surface dma-buf feedback. In this patch we start
to use it.

If per-surface dma-buf feedback is advertised, use it to allocate
surface buffers. Also, the dma-buf protocol states that the feedback is
resent only when the client is using a suboptimal format/modifier pair.
So listen for new per-surface feedback events and reallocate the surface
buffers based on them. We can't change the format of a buffer, but we
can pick a new modifier.

This patch is based on previous work of Scott Anderson (@ascent).

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>
2021-11-26 16:06:09 +00:00
Leandro Ribeiro 5b56fc748a egl/wayland: move loader_dri_create_image() calls to separate functions
In get_back_bo() we have two calls to loader_dri_create_image() and some
overhead. As in the next commit we add another call to this same
function and more overhead to get_back_bo(), it starts to lose
legibility.

So move loader_dri_create_image() calls to separate functions, allowing
us to have an easier to read get_back_bo(). It also adds some minor
style changes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>
2021-11-26 16:06:09 +00:00
Leandro Ribeiro 83916ae0b9 egl/wayland: add initial dma-buf feedback support
This bumps the supported dma-buf version up to 4 and adds the initial
dma-buf feedback implementation. It follows the changes in the dma-buf
protocol extension [1] to include the dma-buf feedback interface, which
should be incorporated by most Wayland compositors in the future.

From version 4 onwards, the dma-buf modifier events are not sent by the
compositor anymore, so we use the default feedback to pick the set of
formats/modifiers supported by the compositor. Also, we try to avoid the
wl_drm device event and instead use the dma-buf feedback main device. We
only fallback to wl_drm when the compositor advertises a device that
does not have a render node associated.

In this initial dma-buf feedback implementation we still don't do
anything with the per-surface dma-buf feedback, but in the next commits
we add proper support.

It's important to mention that this also bumps the minimal supported
version of wayland-protocols to 1.24, in order to include [1].

[1] https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/8

This patch is based on previous work of Scott Anderson (@ascent).

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>
2021-11-26 16:06:09 +00:00
Leandro Ribeiro a25d4dd276 loader: add function to get render node from dev_t
Add function loader_get_render_node() to help us to get a render node
from dev_t. If the device does not expose a render node, this new
function returns NULL.

As this function uses drmGetDeviceFromDevId(), we bump libdrm minimal
version to 2.4.109.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>
2021-11-26 16:06:09 +00:00
Leandro Ribeiro cd39180cfa egl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>
2021-11-26 16:06:09 +00:00
Leandro Ribeiro aa6c900625 egl/wayland: move formats and modifiers to a separate struct
This will allow us to remove EGL_DRI2_NUM_FORMATS (as explained in
"egl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS") and it will
also help to add the dma-buf feedback support. Both changes happen in
the next commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>
2021-11-26 16:06:09 +00:00