Commit Graph

2409 Commits

Author SHA1 Message Date
Danylo Piliaiev a5b37c64d1 turnip: expose several already implemented extensions
They were promoted to Vulkan 1.1 and we already support them.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9757>
2021-03-22 18:20:57 +00:00
Connor Abbott d8a2abe348 freedreno/computerator: Add script for finding reg file size
This helps with finding the various parameters introduced in the last
commit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9498>
2021-03-22 18:03:16 +00:00
Connor Abbott d274649799 freedreno/computerator: Use threadsize calculated by ir3
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9498>
2021-03-22 18:03:16 +00:00
Connor Abbott 7ecc70b31c turnip: Use threadsize calculated by ir3
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9498>
2021-03-22 18:03:16 +00:00
Connor Abbott fd7960e191 ir3: Calcuate max_waves and threadsize
max_waves is just for shader-db stats for now, but threadsize will
replace the various mechanisms used to determine threadsize across the
different gen's. Calculating these correctly entails adding a bunch of
details about the sizes of various things to ir3. In the future we will
use the guts of the max_waves calculation to inform RA decisions as
well, which is why the max_waves calculation is broken up into register
dependent/independent pieces.

Something should be said about the units of reg_size_vec4. These units
were chosen for two reasons:

1. As said in the comment, it makes some calculations easier.
2. For a4xx/a5xx, where we don't know as much because we haven't done
   the same sorts of experiments to probe for the HW configuration, it
   corresponds more directly to things that are known. The existing code
   switches to the smaller threadsize when r24.x or higher is used,
   which translates directly to a reg_size_vec4 of 48. If we chose
   different units (e.g. multiplying by wave_granularity and/or
   threadsize_base), then to match the same behavior we'd have to set
   reg_size_vec4 based on some other parameters that aren't 100% known.
   If someone comes along and updates them, they might inadvertantly
   break it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9498>
2021-03-22 18:03:16 +00:00
Connor Abbott cbc68c79a5 freedreno: Add local_size to ir3_shader_variant
We want to use the local_size when available to calculate the threadsize
in ir3, and we need it to work with e.g. computerator where we don't
have a nir shader. Add a local_size field and use that in computerator
instead of of a separate structure that's inaccessable to core ir3.

Also set a dummy local_size in the tests to avoid a divide-by-zero.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9498>
2021-03-22 18:03:16 +00:00
Mike Blumenkrantz ad241b15a9 vk: consolidate dynamic descriptor binding sorting
this code was duplicated across several drivers

Reviewed-by: Adam Jackson <ajax@redhat.com>
turnip changes Reviewed-by: Hyunjun Ko <zzoon@igalia.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9480>
2021-03-22 16:51:55 +00:00
Danylo Piliaiev 208250b376 ir3: update info about applicability of saturation modifier
On a6xx saturation doesn't work on cat4 and on bary.f

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9751>
2021-03-22 15:02:14 +00:00
Rob Clark 9aef029635 freedreno/ir3: Precompute whether we need driver-params
To save a bit of extra math in the draw-path.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9581>
2021-03-20 12:13:09 -07:00
Rob Clark b5e1e99da1 freedreno/drm: Inline iova calculation
The shift/or are frequently zero, so this lets the compiler optimize out
some draw-overhead hotpath.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9581>
2021-03-20 12:13:09 -07:00
Rob Clark 93d5349fa5 freedreno/drm: Move emit_reloc_tail to head
Get this out of the way first to avoid some register push/pop.  Only
reloc->bo is needed after writing the address into cmdstream, so this
turns msm_submit_append_bo() into a tail call.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9581>
2021-03-20 12:13:09 -07:00
Rob Clark 684586b96e freedreno/drm: Split 64b vs 32b paths
No need to 'if (gpu_id >= 500)' on every reloc

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9581>
2021-03-20 12:13:09 -07:00
Rob Clark 9168d9cbfb freedreno/drm: Split softpin "reloc" functions
"OBJECT" rb's are long lived, and generating them is not a hotpath, but
relocs to "STREAMING" rb's are a hot path.  But we can decouple these.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9581>
2021-03-20 12:13:08 -07:00
Eric Anholt 4eb7c4d60c ci/freedreno: Mark all of dEQP TF as flaky.
I keep working on stabilizing it, but no luck yet.  Stop blocking CI on
our flakes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9715>
2021-03-19 22:07:57 +00:00
Danylo Piliaiev 9efec45b0c ir3: disallow .sat on SEL instructions
Saturation is unsupported on SEL instructions.

Fixes main menu rendering in Genshin Impact.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9666>
2021-03-19 17:09:07 +00:00
Eric Anholt 5da520cf3d freedreno/ir3: Demote centroid usage to pixel on non-msaa.
Like with the sample qualifier on all GPUs, use pixel on older HW when
MSAA rasterization is disabled to get reliable results.  Since I ran many
CI jobs on this, this updates the A530 TF flakes list, though I don't
think that this MR necessarily made it flakier (we were already struggling
on a5xx TF, which was what was motivating me to look at this!)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9641>
2021-03-18 10:46:09 -07:00
Danylo Piliaiev b804abd61d freedreno/isa: assert if field's range is out of bitset's range
Also, update outdated comment along the way.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9628>
2021-03-17 12:07:54 +00:00
Danylo Piliaiev 42c81e1901 ir3: match mova1 mnemonic when writing to A1
For MOV to A1 blob uses "mova1" mnemonic, which is mov.u16u16;
change s16 to u16 when creating MOV to A1 in order to match the blob.

Before, couldn't be parsed back:
 mov.s16s16 ha0.y, 0

After, could be parsed back and matches blob behaviour:
 mova1 a1.x, 0

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9628>
2021-03-17 12:07:54 +00:00
Danylo Piliaiev c0a62b203e ir3/isa,parser: fix encoding and parsing of bindless s2en SAM
Before, decoding showed that there is an error:
 sam.base0 (f32)(xyzw)r0.x, r0.z, a1.x   ; no field 'HAS_SAMP',
  WARNING: unexpected bits[0:7] in #cat5-samp-s2en-bindless-a1: 0x1 vs 0x0

After:
 sam.base0 (f32)(xyzw)r0.x, r0.z, s#1, a1.x

Fixes textures on the ground in TauCeti Vulkan Technology Benchmark

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9628>
2021-03-17 12:07:54 +00:00
Samuel Iglesias Gonsálvez 0acd7df67b turnip: set depth plane control zmode to A6XX_LATE_Z when sample mask is written
Otherwise, gl_SampleMask[] writes are ignored and the stencil test works like
if all samples were enabled.

Fixes: dEQP-VK.renderpass.suballocation.multisample.*s8*

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9478>
2021-03-17 09:05:33 +00:00
Iago Toral Quiroga 1e4abf1fe3 vulkan/util: call glsl_type_singleton_init_or_ref from vk_instance_init
v2: link libvulkan_util with libglsl so it can find the glsl singleton symbols.
v3: link with libcompiler instead of libglsl (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> for the v3dv bits.
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> for the turnip bits.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> for the radv bits.
Acked-by: Dave Airlie <airlied@redhat.com> for the lvp bits.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9457>
2021-03-17 08:15:36 +01:00
Hyunjun Ko d9fcf5de55 turnip: Enable nonuniform descriptor indexing
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9125>
2021-03-17 01:09:30 +00:00
Hyunjun Ko e9fd2a2a58 ir3: Add nonuniform encodings to ir3 encoder and parser
By keeping track of nonuniform access from nir and storing it to ir3.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9125>
2021-03-17 01:09:30 +00:00
Hyunjun Ko 433cdd1cff ir3: fix has_src() to return correctly in ir3_nir_lower_tex_prefetch
This seems to be originally introduced from 2a0d45ae6c, and 562aaea07c
misused the method.

Fixes: 2a0d45ae6c "freedreno/ir3: Add a NIR pass to select tex instructions eligible for pre-fetch"
Fixes: 562aaea07c "freedreno/ir3: respect tex prefetch limits"

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9125>
2021-03-17 01:09:30 +00:00
Hyunjun Ko e0e55b181f turnip: Return correct value of tu6_load_state_size
The state of active_desc_sets in pipeline should be set before
allocation of the pipeline so we get correct size of descriptor
sets and reserve enough space upfront.

Otherwise we might hit assert(pipeline->cs.bo_count == 1).

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9125>
2021-03-17 01:09:30 +00:00
Danylo Piliaiev e767208069 ir3: fix oob access to regs array for getbuf,getinfo,rgetinfo
Since they have zero source registers, src->regs[1] is out of bounds.
It probably wasn't able to cause any harm, but it's always better
be safe.

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

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9609>
2021-03-16 22:36:12 +00:00
Eric Anholt f3a7a8a4dc ci/freedreno: Switch the piglit testing to the new piglit runner.
Getting piglit to fit onto our test devices was proving difficult, and we
need the ability to handle flakes, so switch to the rust piglit runner
that @pepp wrote as part of the deqp-runner repo which gives us flake
detection, sharding across boards, fractional runs, and almost half the
runtime.

It doesn't handle piglit subtests yet, but if you can't run piglit's
python on your devices because it's too bloated and unstable, this is a
way forward.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9468>
2021-03-16 22:19:30 +00:00
Eric Anholt 739486de2f freedreno/a5xx: Fix the max texture buffer size.
The GLES minmax is 65536.  The blob vulkan exposes 65536 on both a5xx and
a6xx, but try just doing the same as we do for a6xx.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9617>
2021-03-16 16:15:48 +00:00
Eric Anholt b93d21810a freedreno/a5xx: Fix the texel buffer alignment requirement.
Info comes from the a540 vulkan blob driver minTexelBufferOffsetAlignment.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9617>
2021-03-16 16:15:48 +00:00
Danylo Piliaiev b8ca39a80d turnip: implement intrinsic_vulkan_resource_reindex
Descriptor arrays are continuous, so it's just an addition of offset.

Fixes test:
 dEQP-VK.spirv_assembly.instruction.compute.variable_pointers.dynamic_offset.select_descriptor_array

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9495>
2021-03-15 23:56:26 +00:00
Eric Anholt 3dc8102420 ci/freedreno: Add three more a5xx flakes from the last day.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9575>
2021-03-15 22:45:13 +00:00
Mike Blumenkrantz 71b17149e8 tu: use common interfaces for shader modules
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9508>
2021-03-15 21:47:44 +00:00
Danylo Piliaiev 914e7a7f73 turnip: set zmode to A6XX_EARLY_Z if FS forces early fragment test
Specifying "early_fragment_tests" in fragment shader takes precedence
over our internal conditions.

Fixes test:
 dEQP-VK.fragment_operations.early_fragment.early_fragment_tests_stencil

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9569>
2021-03-12 20:11:28 +00:00
Danylo Piliaiev 1a2f1e3f47 turnip: fill VkMemoryDedicatedRequirements
We support VK_KHR_dedicated_allocation so we must fill
VkMemoryDedicatedRequirements.

Vulkan spec states:

 "[...] requiresDedicatedAllocation may be VK_TRUE under one of the
 following conditions:

 The pNext chain of VkImageCreateInfo for the call to vkCreateImage used
 to create the image being queried included a VkExternalMemoryImageCreateInfo
 structure, and any of the handle types specified in
 VkExternalMemoryImageCreateInfo::handleTypes requires dedicated allocation,
 as reported by vkGetPhysicalDeviceImageFormatProperties2 in
 VkExternalImageFormatProperties::externalMemoryProperties.externalMemoryFeatures,
 the requiresDedicatedAllocation field will be set to VK_TRUE."

All handle types require dedicated allocation at the moment.

Fixes:
 dEQP-VK.api.external.memory.opaque_fd.dedicated.image.info
 dEQP-VK.memory.requirements.dedicated_allocation.buffer.regular
 dEQP-VK.memory.requirements.dedicated_allocation.image.transient_tiling_optimal

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9086>
2021-03-12 11:56:47 +02:00
Danylo Piliaiev ae3b95daa7 turnip: lower device index to zero
Vulkan 1.1 has VK_KHR_device_group and VK_KHR_device_group_creation
promoted to core, thus we should handle DeviceIndex built-in.

While we are here, also add these extensions to the extensions list,
even though they are not doing anything useful.

Fixes test:
 dEQP-VK.compute.device_group.device_index

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9516>
2021-03-11 21:12:52 +00:00
Connor Abbott ee1f140fd9 freedreno/a6xx: Cleanup SP_XS_CTRL_REG0 definitions
The registers were actually different per-stage even though we used the
same type, which resulted in a bunch of incorrectly programmed fields
and confusion. Move the stage-specific values to the registers
themselves, which makes things much less confusing and makes it possible
to set "mergedregs" correctly.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9493>
2021-03-11 20:58:39 +00:00
Connor Abbott 9a5596d679 freedreno/registers: Handle typed registers with fields
When a bitset is "inline" it should act as-if the its fields were
inserted into the register itself. However when initializing the
register's bitfield we weren't doing a deep copy of the inline bitfield,
so if the register defined additional fields then they would get added
to the original inline bitfield and any further registers with the same
type would get them. Fix this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9493>
2021-03-11 20:58:39 +00:00
Connor Abbott 1d8bf2d0bf freedreno/computerator: Fix thrsz type
And use it for the other thread size field, too

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9493>
2021-03-11 20:58:39 +00:00
Yannik Marek 369f9d225d turnip: fix alpha to coverage in no color and unused attachment cases
In cases where the alpha coverage is enabled but the color attachment is
either unused or absent there should be a dummy mrt to make the draw behave
correctly.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Yannik Marek <yannik@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8952>
2021-03-10 22:02:43 +00:00
Matt Turner 6ceb6b509e turnip: Remove unused TU_DEBUG_IR3 flag
Replaced by IR3_SHADER_DEBUG=disasm,{vs,...,cs} and unused since the
commit referenced below.

Fixes: 808992fc50 ("tu: Use the ir3 shader API")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8249>
2021-03-10 18:59:22 +00:00
Eric Anholt eba1b2a1ba ci/freedreno: Mark another a5xx TF flake.
Showed up with an iommu fault preceding it each time it failed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9488>
2021-03-10 18:44:16 +00:00
Jason Ekstrand 4fb6c051c9 anv: Move vk_format helpers to common code
The Android ones we put in anv_android.c.  Maybe one day we'll want a
vk_android.h to put some common Android stuff but, for now, let's keep
it contained to ANV's android code.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857>
2021-03-10 18:17:31 +00:00
Jason Ekstrand 2523c47720 turnip: Move the CreateRenderPass wrapper to common code
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857>
2021-03-10 18:17:31 +00:00
Danylo Piliaiev 2764cf8d32 ir3: use OPC_GETBUF to get size of sampler buffers
The maximum value which OPC_GETSIZE could return for one dimension
is 0x007ff0, however sampler buffer could be much bigger.
Blob uses OPC_GETBUF for them.

Fixes tests:
 dEQP-VK.memory.pipeline_barrier.transfer_dst_uniform_texel_buffer.1048576

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9391>
2021-03-10 17:10:45 +00:00
Danylo Piliaiev 8e6ed9948e freedreno/a5xx: port handling of PIPE_BUFFER textures from a6xx
Otherwise, we won't be able to use OPC_GETBUF to get their size.

After this change we also could get rid of the hack for OPC_GETSIZE
which scaled the size for texture buffers.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9391>
2021-03-10 17:10:44 +00:00
Danylo Piliaiev d968995c67 turnip: fix SP_HS_WAVE_INPUT_SIZE value
It appears that storage for varyings in a wave has an upper
limit of wavesize * max_a831 where max_a831 is 64.
Exceeding the limit seam to force gpu to reduce primitives
processed per wave, at least calculations make sense with
such interpretation.

With blob SP_HS_WAVE_INPUT_SIZE never exceeds 64 and setting
it to 65 in freedreno leads to a hang.

Copied from the commit to freedreno e5499ca2

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8187>
2021-03-10 16:50:11 +00:00
Connor Abbott 7b7532b806 freedreno/computerator: Add branching example
Mainly to be able to test label resolution without having to replace a
shader.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9463>
2021-03-10 16:23:04 +00:00
Connor Abbott 19c7b6f9d6 ir3/parser: Add ability to specify branchstack
This lets you test branching with computerator.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9463>
2021-03-10 16:23:04 +00:00
Connor Abbott a820eb537c ir3/parser: Support labels
This fixes the assembly for many scenarios where you want to use shader
replacement.

Note: unfortunately this leaks the identifier string created while
lexing, but I couldn't find a way to avoid leaking it except for
bringing in ralloc or something (which would be way more complicated).
The only other place doing something similar in mesa is the glsl parser,
which is using ralloc (actually a linear context).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9463>
2021-03-10 16:23:04 +00:00
Connor Abbott 534658f79b freedreno/computerator: Fix example assembly
Use the new bindless cat6 syntax for a6xx.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9463>
2021-03-10 16:23:04 +00:00
Connor Abbott cd772d5687 ir3/parser: Fix parsing of "0.0" in @const line
Trying to specify a floating-point value in a @const line would result
in it getting interpreted as a FLUT value and failing parsing. Fix this
by making the various FLUT tokens include the surrounding parentheses.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9463>
2021-03-10 16:23:04 +00:00
Dave Airlie 8027a7ba8a shader_info: convert textures_used to a bitset.
For now keep it a bitset of 1 32-bit dword.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9456>
2021-03-10 06:16:09 +10:00
Danylo Piliaiev 1d70863c12 freedreno/hw: fix populating branch targets in isa_decode pre-pass
pre-pass ran with branch_labels being false which made it no-op.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9476>
2021-03-09 18:17:48 +00:00
Jason Ekstrand e20e85f01e nir: Make nir_ssa_def_rewrite_uses_after take an SSA value
This replaces the new_src parameter of nir_ssa_def_rewrite_uses_after()
with an SSA def, and rewrites all the users as needed.

Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9383>
2021-03-08 16:59:55 +00:00
Jason Ekstrand 117668b811 nir: Make nir_ssa_def_rewrite_uses take an SSA value
This commit replaces the new_src parameter of nir_ssa_def_rewrite_uses()
with an SSA def, removes nir_ssa_def_rewrite_uses_ssa(), and rewrites
all the users as needed.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9383>
2021-03-08 16:59:55 +00:00
Jason Ekstrand 13a0ee8a51 nir: Add and use a new nir_ssa_def_rewrite_uses_src helper
This is currently an alias for nir_ssa_def_rewrite_uses but we move all
the instances which used it to write a non-SSA source to the newly named
helper.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9383>
2021-03-08 16:59:55 +00:00
Connor Abbott ccd7986f59 freedreno/cffdec: Use rb trees for tracking buffers
Gets rid of the arbitrary size limitation, and should make decoding
faster with many buffers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8838>
2021-03-08 15:18:47 +00:00
Danylo Piliaiev 7e25e5b56f ir3: disallow moving memory writes over discard
Writes to global memory should not be moved over discard,
otherwise we could have unintended side-effects or lack of
side-effects where they should be observed.

Fixes tests:
 dEQP-VK.rasterization.frag_side_effects.color_at_beginning.kill
 dEQP-VK.rasterization.frag_side_effects.color_at_end.kill

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9365>
2021-03-04 11:40:58 +00:00
Juan A. Suarez Romero 7b3b8524ef ci: Bump deqp to vk-gl-cts 1.2.5.2
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9369>
2021-03-04 11:09:35 +00:00
Danylo Piliaiev 72a9f315db ir3: make mark_kill_path exit early if instr is already seen
Would bring down its complexity in pathological cases.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9386>
2021-03-04 10:52:06 +00:00
Danylo Piliaiev 9dbb678f5a ir3: prevent duplication of instruction's dependencies
Otherwise mark_kill_path() is happy to take exponential time to finish.

It was possible to have such chains:
  ...
 stib.base0 imm[0.000000,0,0x0], ssa_233, ssa_234, false-deps:ssa_231, ssa_231
 stib.base0 imm[0.000000,0,0x0], ssa_237, ssa_238, false-deps:ssa_235, ssa_235
 stib.base0 imm[0.000000,0,0x0], ssa_241, ssa_242, false-deps:ssa_239, ssa_239
 stib.base0 imm[0.000000,0,0x0], ssa_245, ssa_246, false-deps:ssa_243, ssa_243
 stib.base0 imm[0.000000,0,0x0], ssa_249, ssa_250, false-deps:ssa_247, ssa_247
 stib.base0 imm[0.000000,0,0x0], ssa_105, ssa_253, false-deps:ssa_251, ssa_251
 stib.base0 imm[0.000000,0,0x0], ssa_109, ssa_256, false-deps:ssa_254, ssa_254
 stib.base0 imm[0.000000,0,0x0], ssa_113, ssa_259, false-deps:ssa_257, ssa_257
 stib.base0 imm[0.000000,0,0x0], ssa_117, ssa_262, false-deps:ssa_260, ssa_260
 stib.base0 imm[0.000000,0,0x0], ssa_265, ssa_266, false-deps:ssa_263, ssa_263
 stib.base0 imm[0.000000,0,0x0], ssa_269, ssa_270, false-deps:ssa_267, ssa_267
 stib.base0 imm[0.000000,0,0x0], ssa_273, ssa_274, false-deps:ssa_271, ssa_271
  ...

Fixes tests:
 dEQP-VK.geometry.layered.cube_array.36_36_12.secondary_cmd_buffer_inherit_framebuffer
 dEQP-VK.geometry.layered.3d.64_64_8.secondary_cmd_buffer_inherit_framebuffer
 dEQP-VK.geometry.layered.cube_array.64_64_12.secondary_cmd_buffer_inherit_framebuffer

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9386>
2021-03-04 10:52:06 +00:00
Eric Anholt a8423eb732 ci/turnip: Mark a flaky WSI test.
This one has flaked many times at this point, and I've even seen it flake
locally.  No luck debugging it yet.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9397>
2021-03-03 23:03:48 +00:00
Rob Clark 1611693977 freedreno/ir3: Add comments about shader key/gen
I had forgotton on which gens these where used on (which is important if
you need to know which shader stages use these).. expand the comments a
bit.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9394>
2021-03-03 22:09:22 +00:00
Eric Anholt 957132294f ci/a5xx: Increase the gles3/31 coverage.
Now that there's more time available in our budget per board, we can run
all of gles31, and half of gles3, instead of 10%.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9314>
2021-03-03 21:05:39 +00:00
Eric Anholt 1087bf16af ci/a3xx: Run all of GLES3 dEQP.
We're not spending half our time booting any more, so run the other half.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9314>
2021-03-03 21:05:39 +00:00
Eric Anholt bb82efa792 ci/a5xx: Run all of gles2 in one job.
Now that we're not spending so much time on boot overhead, no need to
parallelize.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9314>
2021-03-03 21:05:39 +00:00
Eric Anholt bcdfee3bcd ci/freedreno: Switch the fastboot boards to using nfsroot.
This saves time in packing the rootfs, allows for larger rootfses, and
avoids the need for webdav.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9314>
2021-03-03 21:05:39 +00:00
Danylo Piliaiev 4600dbc6cc turnip: fix leak of tu_shader object during compute pipeline creation
tu_shader should be freed after pipeline is successfully created.

Fixes tests:
 dEQP-VK.api.object_management.alloc_callback_fail.compute_pipeline
 dEQP-VK.api.object_management.alloc_callback_fail_multiple.compute_pipeline

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9364>
2021-03-03 10:41:29 +00:00
Danylo Piliaiev d06c1e4554 turnip/ir3: check for bindless IBOs in atomic dests fixup
Otherwise destinations may remain unfixed because ir3_shader_nibo
doesn't count bindless IBOs.

Fixes tests:
 dEQP-VK.image.atomic_operations.*intermediate_values

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9309>
2021-02-26 21:13:04 +00:00
Rob Clark a9618e7c42 util: Add accessor for util_cpu_caps
In release builds, there should be no change, but in debug builds the
assert will help us catch undefined behavior resulting from using
util_cpu_caps before it is initialized.

With fix for u_half_test for MSVC from Jesse Natalie squashed in.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9266>
2021-02-26 18:31:19 +00:00
Eric Anholt f65a7a8aa3 freedreno/a5xx: Fix cube image load/stores.
This is the same thing we do on a6xx for cubes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9270>
2021-02-25 19:11:19 +00:00
Eric Anholt c93fd1046a freedreno: Use the mesa/st frontend lowering of GL_CLAMP.
350 lines of code for this stupid feature, and we weren't even doing it
right for CS/GS/tess.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9267>
2021-02-25 00:38:11 +00:00
Eric Anholt 5fa27e6670 freedreno: Drop custom driver lowering of GL's color clamping.
The mesa/st frontend can do it for us now that we don't need to worry
about breaking precompiles.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>
2021-02-24 21:48:54 +00:00
Eric Anholt 3b9f6af1a9 freedreno: Drop custom driver lowering of two-sided color.
The GL frontend can do it for us now, so just use their code instead of
our own shader variants.  In the past we had to do hide the GL shader
variants in the driver to get precompiles from st, but no longer as of
!8601.

I tested with drawoverhead -test 6 (shader program change, n=30) and -test
1 (no statechanges, n=43) and saw no change in driver overhead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>
2021-02-24 21:48:54 +00:00
Eric Anholt de17b4aab5 freedreno: Remove uniform variables after finalizing NIR.
mesa/st optimizes the uniform storage if you have the finalize hook in
place, causing the uniforms declared to potentially not have storage in
the ParameterValues list any more.  If you leave your uniforms around in
the NIR, then a later finalization after variant creation will re-add the
uniforms to parameters, defeating the optimization and likely reallocating
the uniform storage (causing use-after-free).  So, we have to do this
before we can start using variants in mesa/st.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>
2021-02-24 21:48:54 +00:00
Rob Clark e5a64e34d8 freedreno/ir3: Drop foreach_bit() macro
Now that there is a global one in util/bitscan.h

Note this version had an extra assert which is not really suitable to a
generic foreach_bit().. just move the assert to the two usages of the
iterator macro.

Signed-off-by: Rob Clark <robdclark@chromium.org>

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9191>
2021-02-24 17:11:44 +00:00
Mike Blumenkrantz 77cba4b9f2 freedreno/vulkan: for_each_bit -> foreach_bit
Reviewed-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9191>
2021-02-24 17:11:44 +00:00
Juan A. Suarez Romero e814e23f59 ci/piglit: allow parallel piglit jobs
This allows to split a piglit job in several parallel jobs, to speed up
the execution.

Due piglit restrictions, this only works for single profiles. Otherwise
an error will be shown in the runner.

Also, a new gitlab job variable `PIGLIT_TESTS` is introduced that
contains the excluded/included tests with `-x` or `-n`. The rest of the
piglit options go to `PIGLIT_OPTIONS` (like `--timeout n`).

v2 (Andres):
 - Replay profile is supported in parallel jobs.
 - Bail out inmediately if parallel jobs is tried with multiple
profiles.
 - Use testlist only when doing parallel jobs.
 - Do not drop pass tests when filtering executed tests.
 - Get rid of PIGLIT_FRACTION.

v4:
 - uncommit unrelated change (Andres).

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9022>
2021-02-24 09:41:33 +01:00
Eric Anholt ad77170b85 ci: Move the dEQP and traces expectations to the per-driver CI dirs.
This means less custom test-source-dep stuff for these drivers, though it
means that touching the CI expects files will cause a bit more retesting:

- broadcom drivers retest as a group (but Igalia requested that
  organization of CI files)
- radv+radeonsi retest as a group
- lvp+llvmpipe retest as a group

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9161>
2021-02-22 23:02:42 +00:00
Eric Anholt 419758abc8 ci/a5xx: Increase our dEQP GLES3 fraction by 4x.
Now that we've got SMP, we can get a lot more of this test suite covered
in our 10-minute job window.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9144>
2021-02-22 19:31:46 +00:00
Eric Anholt fcc2ed6299 ci/bare-metal: Use an upstream kernel for db820c.
On top of the last kernel tree I added a couple of DT changes for db820c
from the qcom landing tree necessary for bringing up the GPU, and a fix to
my OOB cleanups fro cheza.  I also enabled the CPU clock driver for db820c
so we can turn on SMP and not leave jobs stranded on a 19Mhz CPU or whatever.

This causes us to need a bit of updating of our TF expectations since the
order of jobs changes a bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9144>
2021-02-22 19:31:46 +00:00
Eric Anholt 8c539275d9 ci/freedreno: Remove stray BM_DTB definition.
It's unused -- cheza uses an image with kernel+dtb glued together, and
this var does nothing (which is good, given that it was pointing to
db820c.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9144>
2021-02-22 19:31:46 +00:00
Dave Airlie 7b1568b7a3 tu: reset object base on recycled command buffers
The loader_set_dispatch overwrites the magic with the dispatch
pointer, however when cmd buffers get recycled, and the loader
is in debug mode, it asserts that the magic isn't set anymore.

When recycling command buffers, reset the object base.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9145>
2021-02-22 09:32:49 +10:00
Rob Clark a983a87a5f freedreno/ir3/print: Improve branch printing
Handle the instruction suffix better, and don't try to print src regs in
a generic way, since that doesn't really work out.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9142>
2021-02-19 22:56:56 +00:00
Rob Clark 03762a956e freedreno/ir3/print: More sane ssa src/dst display
Give src/dst a "ssa_%u" name generated from the instruction's unique
serialno.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9142>
2021-02-19 22:56:56 +00:00
Danylo Piliaiev 0fa7ec1473 turnip,freedreno/a6xx: tell hw the size of shared mem used by CS
Before, we only used 2k of shared memory.

It was found that 5 lower bits of SP_CS_UNKNOWN_A9B1 do control
the available size of shared memory for compute shaders, with
AVAILABLE_SIZE = (SP_CS_UNKNOWN_A9B1_SHARED_SIZE + 1) * 1k
up to 32k. And SP_CS_UNKNOWN_A9B1_SHARED_SIZE being zero enables
all 32k of shared memory.

Fixes tests:
 dEQP-VK.rasterization.line_continuity.line-strip
 dEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.workgroup.payload_local.buffer.guard_nonlocal.workgroup.comp
 dEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.workgroup.payload_nonlocal.workgroup.guard_local.buffer.comp
 dEQP-VK.memory_model.write_after_read.core11.u32.coherent.fence_fence.atomicwrite.workgroup.payload_local.image.guard_nonlocal.workgroup.comp

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9157>
2021-02-19 20:28:44 +02:00
Eric Anholt dab845d457 ci: Move specific driver testing to separate files in separate dirs.
The top-level gitlab-ci.yml is big and unwieldy when one wants to work on
CI for a single driver.  Move the drivers to separate include files for
ease of finding all your driver's tests, and also to pave the way for work
on a single driver's CI to not retest all other drivers.

Reviewed-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9139>
2021-02-19 17:30:36 +00:00
Danylo Piliaiev 14a0004232 turnip: consider tile_max_h when calculating tiling config
Otherwise we may get a tile height exceeding the maximum.

Fixes tests:
 dEQP-VK.pipeline.render_to_image.core.2d.huge.height.r8g8b8a8_unorm
 dEQP-VK.pipeline.render_to_image.core.2d.huge.height.r8g8b8a8_unorm_d16_unorm
 dEQP-VK.pipeline.render_to_image.core.2d.huge.height.r8g8b8a8_unorm_s8_uint

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9159>
2021-02-19 15:24:30 +00:00
Danylo Piliaiev b6b3b38434 turnip: consider HW limit on number of views when apply multipos opt
Blob doesn't apply multipos optimization starting from 11 views
even on a650, however in practice, with the limit of 16 views,
tests pass on a640/a650 and fail on a630.

Fixes tests:
 dEQP-VK.multiview.draw_indexed.max_multi_view_view_count
 dEQP-VK.multiview.input_attachments.max_multi_view_view_count
 dEQP-VK.multiview.masks.max_multi_view_view_count
 dEQP-VK.multiview.multisample.max_multi_view_view_count
 dEQP-VK.multiview.queries.max_multi_view_view_count
 dEQP-VK.multiview.renderpass2.index.fragment_shader.max_multi_view_view_count
 dEQP-VK.multiview.secondary_cmd_buffer.max_multi_view_view_count

Fixes: 8d275778 ("tu: Enable multi-position output")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9135>
2021-02-19 09:16:00 +00:00
Jonathan Marek ec54166a2b freedreno/a6xx: set SP_PERFCTR_ENABLE in computerator
Set this register to have properly working SP perfcntrs in computerator.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8423>
2021-02-19 04:04:03 +00:00
Jonathan Marek 46f64aa3be freedreno/a6xx: update some registers
Some sorting, adding unknown fields, documenting some fields, etc.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8423>
2021-02-19 04:04:03 +00:00
Jonathan Marek b94c652afe freedreno/a6xx: always use reg64 for address registers (no LO/HI)
Reduce noise in a6xx.xml by removing LO/HI versions of address registers.

Also fix type="address" registers in register packing (use bit size instead
of checking for "waddress" to use qword)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8423>
2021-02-19 04:04:02 +00:00
Jonathan Marek b15d4484f8 freedreno/a6xx: update perfcntr registers (declare as arrays)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8423>
2021-02-19 04:04:02 +00:00
Jonathan Marek 72f00fe72e freedreno/registers: use macro instead of inline function for array regs
This is to allow use in places where an inline function isn't allowed,
such as a static initializer.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8423>
2021-02-19 04:04:02 +00:00
Connor Abbott 79921b81bc freedreno/a6xx: Document threadsize-related fields
We'll need to use if we want to start playing around with thread sizes.
At least now we know what the actual threadsize is.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8423>
2021-02-19 04:04:02 +00:00
Samuel Iglesias Gonsálvez 8dd54778fa turnip: VK_EXT_memory_budget implementation
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8524>
2021-02-17 08:07:33 +01:00
Samuel Iglesias Gonsálvez 4342dec09a turnip: keep track of memory heap usage, size and flags
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8524>
2021-02-17 08:07:19 +01:00
Caio Marcelo de Oliveira Filho e4e962cbe0 freedreno/ir3: Use gl_varying_slot_name_for_stage()
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8998>
2021-02-13 00:44:53 +00:00
Danylo Piliaiev f0a76b2067 turnip: enable inheritedQueries
Passes relevant CTS tests.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8824>
2021-02-10 12:38:44 +00:00
Jason Ekstrand 0260b4a7e7 vulkan: Add a common helper for enumerating instance extension properties
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8792>
2021-02-04 20:02:12 +00:00
Rob Clark ff61e9b54d freedreno/decode: Fix overflow
CP_SET_DRAW_STATE state-groups count as a 4th level of IB.  Fixes a
crash seen on 32b/arm builds of crashdec.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8842>
2021-02-03 18:35:38 +00:00
Samuel Iglesias Gonsálvez 5723887676 turnip: fix resolve MSAA D32_SFLOAT_S8_UINT image to S8_UINT
According to VK_KHR_depth_stencil_resolve spec (see
VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03182):

"If the VkFormat of pDepthStencilResolveAttachment has a stencil
component, then the VkFormat of pDepthStencilAttachment must have a
stencil component with the same number of bits and numerical
type"

The issue with D32_SFLOAT_S8_UINT format is that it is implemented as
two planes, so we need to execute the separate_stencil path in
tu_emit_blit() to resolve its stencil component into S8_UINT image.

Fixes the following tests:

dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint.compatibility_depth_zero_stencil_zero_testing_stencil
dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_stencil

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8527>
2021-02-03 16:51:02 +00:00
Samuel Iglesias Gonsálvez 09e9be3d8f turnip: fix resolve MSAA D24_UNORM_S8_UINT image to S8_UINT
According to VK_KHR_depth_stencil_resolve spec (see
VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03182)

"If the VkFormat of pDepthStencilResolveAttachment has a stencil
component, then the VkFormat of pDepthStencilAttachment must have a
stencil component with the same number of bits and numerical type"

That means that we can resolve MSAA depth/stencil to a stencil only
image only if the stencil component matches with same number of bits
and type.

Although the driver only supports VK_RESOLVE_MODE_SAMPLE_ZERO_BIT
resolve mode, it was doing a sample average when resolving a MSAA
D24_UNORM_S8_UINT image to S8_UINT.

Fixes the following tests:

dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d24_unorm_s8_uint.compatibility_depth_zero_stencil_zero_testing_s
tencil
dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d24_unorm_s8_uint_separate_layouts.compatibility_depth_zero_stenc
il_zero_testing_stencil

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8527>
2021-02-03 16:51:02 +00:00
Samuel Iglesias Gonsálvez 5fc5d18aac turnip: fix UINT64_MAX size wrapping in tu_GetBufferMemoryRequirements()
tu_GetBufferMemoryRequirements() ends up wrapping the UINT64_MAX size
to 0 when aligning.

Fixes:

   dEQP-VK.api.buffer.basic.size_max_uint64

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4493>
2021-02-03 16:01:41 +01:00
Samuel Iglesias Gonsálvez ea42632ba7 turnip: set sparseAddressSpaceSize to zero
According to Vulkan spec, "Table 46. Required Limits", as sparse
binding is unsupported, we need to return unsupported limit for
sparseAddressSpaceSize, which is zero.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4493>
2021-02-03 16:01:21 +01:00
Jonathan Marek dd388b14c8 turnip: add missing register write to disable dithering
This was causing rendering issues with low precision formats because GL
driver can enable it.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8707>
2021-02-03 13:45:19 +00:00
Jonathan Marek bdaa4d1ee0 turnip: don't always use 3d ops for blit_image
Revert this accidentally committed testing change.

Fixes: 872c4bcd27 ("turnip: implement z-scaling and z-mirroring BlitImage")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8707>
2021-02-03 13:45:19 +00:00
Jonathan Marek b37bd5f89b turnip: IMAGE_FILTER_{LINEAR,CUBIC}_BIT only for non-integer formats
Avoid CTS trying to use linear filtering for integer formats.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8707>
2021-02-03 13:45:19 +00:00
Jonathan Marek b4653c1033 turnip: use vk_format_is_int to disable COLOR_ATTACHMENT_BLEND_BIT
This is simpler and easier to understand.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8707>
2021-02-03 13:45:19 +00:00
Jonathan Marek de44e700b1 turnip: delete unused vk_format_parse.py file
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8707>
2021-02-03 13:45:19 +00:00
Jonathan Marek 596e82510d turnip: fix logicOp
Don't ignore logic op for integer formats.

Blend also doesn't need this path, because it isn't valid for blendEnable
to be true for integer formats.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8707>
2021-02-03 13:45:19 +00:00
Jason Ekstrand f2545f22f4 vulkan: Drop the type_prefix parameter from gen_extensions
Now that all the drivers are converted, it's set to 'vk' by everyone so
there's no point in having the parameter.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:25 +00:00
Jason Ekstrand bafd0c680d vulkan: Rework vk_device_init and friends
Now that all drivers are converted over, we can make a few changes.
First off, vk_device_init no longer takes two separate allocators
because we can assume that the parent instance is non-null and it can
pull the instance allocator from that.  Second, dispatch tables and the
instance extension table are no longer optional.  We leave the device
extension table optional for now because we don't do any verification at
vk_init_physical_device time and some drivers find it more convenient to
set the extensions later in their own physical_device_init for various
reasons.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:25 +00:00
Jason Ekstrand 394708b3cb turnip: Switch to the common VK_EXT_debug_report
Acked-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand 3a8060271c turnip: Drop some legacy wrappers in favor of common code
Acked-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand 0870cf4c06 turnip: Use common entrypoints for VK_EXT_private_data
Acked-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand 59d70c47c7 turnip: Use the common dispatch framework
Acked-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand d360a996f9 vulkan: Add common instance and physical device structs
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand 5d6ac87d61 vulkan: Add a return code to vk_device_init
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand 8ee88948e3 vulkan: Move vk_device to its own file
Things are going to start getting more complicated so let's avoid the
single mega-file approach.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand ce0e5cd35b turnip: Properly clean up vk_device
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:24 +00:00
Jason Ekstrand 8d6cf9e1c2 vulkan/meson: Add missing dependencise on vk_extensions_gen.py
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
2021-02-01 18:54:23 +00:00
Connor Abbott ae7a9d0585 ir3: Assume that nir_tex_instr::dest_type is sized
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989>
2021-01-25 11:22:07 +01:00
Connor Abbott 23beffadea freedreno/ir3: Handle sized tex destination types
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989>
2021-01-25 11:21:42 +01:00
Danylo Piliaiev fa74389485 turnip: don't emit tess consts if they are not used
If tess consts aren't used they don't get included in constlen,
and we risk overrunning consts of the next stage.

Fixes:
 dEQP-VK.tessellation.invariance.outer_edge_index_independence.quads_fractional_even_spacing_ccw
 dEQP-VK.tessellation.invariance.outer_triangle_set.quads_fractional_odd_spacing
 dEQP-VK.tessellation.invariance.primitive_set.isolines_fractional_odd_spacing_ccw
 dEQP-VK.tessellation.invariance.primitive_set.quads_fractional_odd_spacing_cw

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

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8578>
2021-01-20 13:10:10 +00:00
Samuel Iglesias Gonsálvez b50b28cd33 turnip: disable UBWC on Z24_S8 MSAA images on A630
Fixes GPU hangs in dEQP-VK.renderpass2.depth_stencil_resolve.* tests
on A630.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8381>
2021-01-18 17:32:21 +01:00
Mauro Rossi b53d404aa7 android: freedreno/ir3: Switch over to new encoder/decoder
Fixes the following building error:

FAILED: out/target/product/x86_64/obj/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so
...
ld.lld: error: undefined symbol: isa_assemble
>>> referenced by ir3_shader.c:151 (external/mesa/src/freedreno/ir3/ir3_shader.c:151)
...
ld.lld: error: undefined symbol: isa_decode
>>> referenced by ir3_shader.c:668 (external/mesa/src/freedreno/ir3/ir3_shader.c:668)

Fixes: 5cae4779c ("freedreno/ir3: Switch over to new encoder/decoder")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8538>
2021-01-17 21:57:05 +01:00
Mauro Rossi 7c0298e2fe android: freedreno/hw/isa: Add description of ir3 ISA
Necessary to build libir3decode and libir3encode for Android

Fixes: 6d94f575d ("freedreno/hw/isa: Add description of ir3 ISA")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8538>
2021-01-17 21:57:05 +01:00
Joel Linn 5939a64b15 freedreno/a2xx: add RB perfcounter 1-3
Xenos driver reads four perf counters in total.

v2: fix register names

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7666>
2021-01-16 19:10:22 +00:00
Joel Linn 040ffee71f freedreno/a2xx: fix/add RBBM perfcounter
Xenos driver read two perf counters and their order is also different.

v2: fix typo in register address

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7666>
2021-01-16 19:10:22 +00:00
Rob Clark bfe5ac89b2 freedreno/isa: Fix branch/jump offset encoding
When cross compiling with clang, `1ul` would end up 32b instead of 64b,
resulting in 32b fields (like branch/jump offsets) being encoded as
zero.  Which results in infinite loops.

Fixes: e7630ec278 ("freedreno/hw: Add isaspec mechanism for documenting/defining an ISA")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8528>
2021-01-15 17:36:30 +00:00
Danylo Piliaiev 5e2cee57c5 freedreno/ir3/parser: add cat7 support
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8420>
2021-01-15 10:08:38 +00:00
Danylo Piliaiev 39a2da738d ir3: add debug option to override shader assembly
IR3_SHADER_DEBUG=vs,tcs,tes... now also prints shader's sha1.

When there is a file named %sha1%.asm in IR3_SHADER_OVERRIDE_PATH
directory - ir3 assembly from file would be parsed, assembled, and
will override the shader with corresponding sha1 hash.

Parsing failure is considered unrecoverable error.
Upon successful override shader's assembly is printed with:
 "Native code (overridden) for unnamed ..."

This debug option allows easier testing of small changes in
assembly without modifying the compiler or using computerator.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8388>
2021-01-14 21:51:16 +00:00
Danylo Piliaiev cea4d85093 turnip: make GS use correct varyings size from previous stage
Fixes:
 dEQP-VK.tessellation.invariance.primitive_set.triangles_fractional_even_spacing_ccw
 dEQP-VK.tessellation.invariance.outer_edge_division.triangles_fractional_even_spacing
 dEQP-VK.tessellation.invariance.outer_edge_symmetry.triangles_fractional_odd_spacing_cw
 dEQP-VK.tessellation.invariance.outer_edge_symmetry.quads_fractional_odd_spacing_ccw
 dEQP-VK.tessellation.invariance.outer_edge_symmetry.isolines_equal_spacing_cw
 dEQP-VK.tessellation.invariance.outer_edge_index_independence.triangles_equal_spacing_ccw
 dEQP-VK.tessellation.invariance.outer_edge_index_independence.triangles_fractional_even_spacing_cw
 dEQP-VK.tessellation.invariance.inner_triangle_set.triangles_equal_spacing

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8497>
2021-01-14 19:06:07 +00:00
Danylo Piliaiev ad098553ee turnip/ir3: handle image load/stores produced by AtomicLoad/Store
SpvOpAtomicLoad and SpvOpAtomicStore are translated into
nir_intrinsic_image_deref_store/load instead of some separate
atomic intrinsics, however they don't have src or dest type
specified. Turnip doesn't support shaderImageFloat32Atomics
so type is just integer.

Fixes:
dEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.device.payload_local.image.guard_local.image.frag
dEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.workgroup.payload_local.buffer.guard_local.image.comp
dEQP-VK.memory_model.write_after_read.core11.u32.coherent.fence_fence.atomicwrite.device.payload_local.buffer.guard_local.image.comp
dEQP-VK.memory_model.write_after_read.core11.u32.coherent.fence_fence.atomicwrite.workgroup.payload_local.image.guard_local.image.comp
dEQP-VK.memory_model.write_after_read.core11.u32.coherent.fence_fence.atomicwrite.workgroup.payload_nonlocal.workgroup.guard_local.image.comp

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8476>
2021-01-14 05:43:56 +00:00
Rob Clark 74748f16c9 freedreno/ir3: Remove legacy packed-struct encoding
Note that we can't actually remove the packed structs themselves yet,
because tu still uses them in some hand-coded blit shaders.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:48 +00:00
Rob Clark 1a8113fdee freedreno/ir3/decode: Switch over to new disasm
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:48 +00:00
Rob Clark 668943e9f7 freedreno/ir3: Realign disasm shader stats
To better match up with what mesa shader-db stats look like, for easier
comparision.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark 3e15ba5ccc freedreno/ir3: Better sstall estimation
1) Take into account repeat/nop cycles
2) Clear sfu_delay after an (ss) sync

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark 11cba228fd freedreno/ir3: Small resinfo disasm tweak
Add the 'type' field.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark 5cae4779c2 freedreno/ir3: Switch over to new encoder/decoder
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark 01e8bd55de freedreno/ir3/tests: Switch disasm test over to new decoder
Also, uncomment the `stc` test vectors (since the new decoder decodes
these properly) and comment out an instruction which looks suspiciously
like -6.0 in hex.

This also switches the parser back to `atomic.b.op` from `atomic.op.b`
which was a short-term workaround to make it easier for the legacy
disassembler.

Also switch the binary encoding for ldib to clear b0, because the new
disassembler warns about unexpected dontcare bits (which cases the
disasm to not match).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark 704e49bae0 freedreno/hw/isa: Add expression caching
Drops decoding an ~850KB collection of instructions from ~4min to ~1sec.

Granted for normal sized shaders, this probably doesn't matter.. but it
at reduces my cycle time for fixing things to match existing disasm
syntax using this massive collection of unique instructions.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark 6d94f575d2 freedreno/hw/isa: Add description of ir3 ISA
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark e7630ec278 freedreno/hw: Add isaspec mechanism for documenting/defining an ISA
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark 6309c9313b freedreno/ir3: Add some new "logical" opcodes
Once we switch over to the xml based ir3 ISA definition, the opcodes
will be decoupled from instruction encoding.  Which will let us better
handle cases where a single "opcode" (from instruction encoding stand-
point) means different things on different generations.  And also cases
like the different variations of `b`ranch instructions, which share a
single hw "opcode" plus a separate "brtype" field.  When we start using
these in ir3, we'd like to treat them as separate instructions and not
have to care about the details of how they are encoded.

For now, these are only used internally within the new xml generated
instruction encoding, but once the existing "packed struct" encoding/
decoding is replace, we'll update ir3 to start using the new opcode
enums directly (except for the `mov` variants).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark cd31bface8 freedreno/ir3: Decouple ir3_info collection from assembler
We'll want to re-use this when cutting over to the new XML based
instruction encoding.  So untangle it from instruction packing.

Also, move handling of the appended constant data out of the
assembler, since this isn't much related to instruction encoding.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Rob Clark e1f8aaf9d2 freedreno/ir3: Fix ldg decoding/parsing
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7997>
2021-01-13 18:32:47 +00:00
Danylo Piliaiev 5331b1d945 turnip: implement indirect dispatch
Vulkan guarantees only 4 byte alignment of offset for vkCmdDrawIndirect,
while CP_LOAD_STATE.EXT_SRC_ADDR requires 16 byte alignment which
makes us copy indirect parameters to a correctly aligned buffer.

Blob does essentially the same but emits indirect CP_LOAD_STATE
with src = SS6_UBO and EXT_SRC_ADDR = 0xe0000, and only for a
first dispatch.

Fixes:
dEQP-VK.compute.indirect_dispatch.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8444>
2021-01-13 09:55:47 +00:00
Danylo Piliaiev a6ae7b2421 turnip: remove unused IR3_DP_LOCAL_GROUP_SIZE_* from cs params
In Turnip local group size is lowered in NIR via
nir_lower_compute_system_values.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8444>
2021-01-13 09:55:47 +00:00
Daniel Schürmann bd8e84eb8d nir: replace .lower_sub with .has_fsub and .has_isub
This allows a more fine-grained control about whether
a backend supports one of these instructions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597>
2021-01-11 19:13:51 +00:00
Rhys Perry f199b7188b nir/load_store_vectorize: add data as callback args
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/4202>
2021-01-07 16:34:53 +00:00
Rhys Perry 00c8bec47b nir: add nir_load_store_vectorize_options
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/4202>
2021-01-07 16:34:53 +00:00
Michel Dänzer 1de2fd0cf2 wsi/x11: Always link against xcb-xrandr
The next commit will make use of it even without
VK_USE_PLATFORM_XLIB_XRANDR_EXT.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8197>
2021-01-07 14:57:45 +01:00
Eric Anholt 3efbc47c83 freedreno: Mark a615/a618 as also lacking Z24_UINT_S8_UINT support.
Rob says it's also the case on 618, and presumably 615 as well then, so
make it take the same path as a630.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8319>
2021-01-06 22:54:14 +00:00
Eric Anholt 1c4613f5d4 turnip: Move the limited_z24s8 flag to the shared device info.
I want to do the same logic in freedreno, so use the same flag.  On
suggestion by robclark, rename it to what it specifically means.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8319>
2021-01-06 22:54:14 +00:00
Vinson Lee 03999595e7 freedreno/afuc: Replace readfile with os_read_file.
Tested afuc-disasm produced same output.

$ ./builddir/src/freedreno/afuc/afuc-disasm -g 6 src/freedreno/.gitlab-ci/reference/afuc_test.fw > /tmp/afuc_test.asm
$ diff ./src/freedreno/.gitlab-ci/reference/afuc_test.asm /tmp/afuc_test.asm
$ echo $?
0

Suggested-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8290>
2021-01-06 18:12:34 +00:00
Rob Clark 32a6a13052 freedreno/ir3/parser: Fix pre-a6xx stib parsing
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:53 +00:00
Rob Clark 859c92d7ee freedreno/ir3/parser: a6xx ldib/stib parsing
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:53 +00:00
Rob Clark b7ea6ec178 freedreno/ir3: Fix pre-a6xx ldgb/stib parsing
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:53 +00:00
Rob Clark 050a449dbb freedreno/ir3: Explicitly flag disasm test vectors that don't parse
Mark the test cases which aren't supported by ir3_parser.y explicitly,
so we notice future regressions.  And likewise, fail when we see an
unexpected pass, so we don't forget to update the test vectors in the
future as ir3_parser improves.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:53 +00:00
Rob Clark b073dae5f0 freedreno/ir3: Fix ldg decoding/parsing
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:53 +00:00
Rob Clark a7e88787f6 freedreno/ir3/parser: Fixup stg parsing and add more tests
The offset can also be a register, in which case we need to shuffle
around the src order.  Add a few more test vectors to cover each
permutation (no offset, immed offset, gpr offset).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark d6fa130dda freedreno/ir3/parser: Add stgb support
Note that this conflicts with `stc` on a6xx+, so a good test that the
(new) disasm can handle both cases properly.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark eddfafae6a freedreno/ir3/parser: Add ldgb support
Gives us at least better coverage of pre-a6xx-bindless-ibo instructions.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 1746c4d211 freedreno/ir3/parser: Fix pre-a6xx resinfo
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 32539c1afc freedreno/ir3/parser: Fix atomic support
1) Handle a6xx bindless form
2) Fix shared vs global encoding

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark c5479d1d8d freedreno/ir3/parser: Add ldc support
Note that this shows up a slight encoding difference compared to test
vector extracted from blob deqp runs.  We think these should be dontcare
bits.  For now, add a note and replace the encoded value in the disasm
test.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark d7f141bb35 freedreno/ir3: Add cat5/cat6 nonuniform flag
Not yet used by the compiler, but needed so we don't loose information
between ir3 parser and instruction encoding.

Currently ignored for cat5, because the uniform vs non-uniform default
is swapped there.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 101bf686ee freedreno/ir3: Disambiguate a6xx+ "bindless" instructions
Add a `.b`.. for the atomic instructions it should be `atomic.b.op` but
for now put the `.b` at the end to simplify life for the existing disasm

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark c55737902c freedreno/ir3: Don't leak disk_cache
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 71f902bab9 freedreno/ir3: Add parsing and assembler testing
In theory we should be able to round-trip from disasm->asm and get a
bitwise match.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark b91319d952 freedreno/ir3: Tweak ldib/resinfo encoding
The blob is using '0' for the low bit in these (except for ldib where it
seems to randomly use either '0' or '1').  The upcoming xml based ISA
spec maps this bit to 'dontcare' in the ldib case.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 99908c8d6d freedreno/ir3/parser: Add initial cat6 IBO instructions
Well, really just resinfo.. dealing with the different ldib/stib syntax
for a6xx+ vs earlier seems a bit too painful to deal with.  But resinfo
at least gives us some encoding test coverage of this group of instrs.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark f9c76fba9d freedreno/ir3/parser: Relative gpr/const can have modifiers too
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 594b004e00 freedreno/ir3/parser: Add missing (sat) modifier
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 77552cbdda freedreno/ir3: Don't set bit for dest conversion for p0.c
This appears to be ignored when writing to predicate registers (which I
guess makes sense, since they are boolean).  So no real harm in setting
it, other than it makes some of the ir3_parser test vectors not match
the expected result for encoding.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 1cdff35361 freedreno/ir3/parser: Fixup cat5 s2en instructions
Currently ir3 (incl emit_cat5()) expects the samp/tex src register to be
first.. which requires some fixup for the parser to match.

TODO we might want to revisit the src reg order when adding new instr
packing/encoding.  For now, lets just make the parser match the rest of
ir3.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark d35c79614e freedreno/ir3/parser: Fix dsxpp/dsypp encoding
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark e9b3234915 freedreno/ir3/parser: Fix cat6 store encoding
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark b90a1cf747 freedreno/ir3: Cleanup cat6 load instructions
There was some src2 vs src3 confusion, but since the syntax is like:

   ldl.f32 rDst, l[rBase+off], ncomp

it makes more sense to call the offset src2 and ncomp src3, than the
way we had it.  This is also easier to deal with for the ir3 assembly
parser.

Also, src_offset was only ever used by the assembly parser, and was
handled incorrectly in emit_cat6(), resulting that cat6 load instrs
would not work properly in (for ex) computerator.  Since we are
cleaning things up, drop src_offset and make the asm parser work in
the same way as the nir->ir3 frontend.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 4e272003b1 freedreno/ir3: Clean up instruction creation
Convert everything remaining over to the version which takes # of
register (src + dst) and drop the ir3_instr_create2() version.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark d968f46997 freedreno/ir3/parser: Handle half-immed
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 68be24dd6c freedreno/ir3/parser: cat1 updates (mova1, movmsk)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 647d7fc36d freedreno/ir3/parser: cat1 instructions can write relative GPR
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 0b36044d4f freedreno/ir3/parser: Add new cat0 instructions
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 2dc6458563 freedreno/ir3: Various cat0 updates
Update the IR and packer to handle the additional cat0 fields, in
prep for adding support in the assembler (in prep for adding round
trip parsing/packing test coverage).

We don't actually use these yet from the ir3 compiler, but at least
this is one less thing to worry about when we start trying to use
them.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark eec183c159 freedreno/ir3/parser: Reset lexer when input changes
Otherwise, in case of parse errors, the lexer state can still contain
buffered input from the previous parse.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 7b2d2bafe4 freedreno/ir3: Move assembler error handling
Move out of ir3_parse_asm() so we can re-use it in disasm test for
round-tripping asm/disasm.  We don't want failures to be fatal (yet)
as there are still some things missing from the assembler.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark a928d0ab46 freedreno/ir3: Add some more disasm test vectors
Various things that I noticed which were initially wrong with the xml
based disasm.

These were extracted from a collection of unique instructions extracted
from deqp traces, which unfortunately looses the link back to the
original test case.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark 2933d54992 freedreno/ir3: Fix mova1 disasm
Yet another mnemonic for mov

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Rob Clark e3bd9aaf6b freedreno/ir3: Fix half-immed decoding issues
For mov, half-float immeds are packed in 16b.  In other cases, the
syntax for a half-immed is a bit different (ie. `h(1)`)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Connor Abbott 6f35ebd8a5 ir3: Support MOVMSK
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Connor Abbott 5d36f36454 ir3: Better rules for shared src copy propagation
It turns out that the actual rule for when a source/dest can be shared
is that it has to be cat1, cat2, or cat3. Allow this and silence
warnings.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Connor Abbott f9804673fb ir3: Rename high registers to shared registers
This more accurately reflects what they are.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8175>
2021-01-06 16:46:52 +00:00
Christian Gmeiner 32bd47f6fa tu: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Christian Gmeiner d46a761e9e ir3: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Eric Anholt 7e1e227694 freedreno/ir3: Deduplicate link_stream_out.
All 3 copies were the same other than style tweaks.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8336>
2021-01-05 18:23:37 +00:00
Danylo Piliaiev 122da9bd2d freedreno/ir3: remap FRAG_RESULT_COLOR to _DATA* for dual-src blending
gl_SecondaryFragColorEXT is mapped to FRAG_RESULT_COLOR and just
have a different io.dual_source_blend_index. We don't need to replicate
the color to other render targets in case of dual source blending, so
we could just remap it to FRAG_RESULT_DATA0 + index.

Fixes piglit test:
 arb_blend_func_extended-fbo-extended-blend-pattern_gles2

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8245>
2020-12-28 17:33:17 +00:00
Vinson Lee 7d8d99ea12 turnip: Remove unsigned nonnegative check.
index is of type uint32_t.

Fix defect reported by Coverity Scan.

Macro compares unsigned to 0 (NO_EFFECT)
unsigned_compare: This greater-than-or-equal-to-zero comparison of
an unsigned value is always true. index >= 0U.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8231>
2020-12-24 23:08:56 +00:00
Hyunjun Ko ec1464077b turnip: use ir3_compiler_destroy instead of ralloc_free
Fixes: c0f22c3d94 "freedreno/ir3: add ir3_compiler_destroy()"

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Hyunjun Ko 19a7a915ca turnip/kgsl: support VK_KHR_performance_query
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Hyunjun Ko 3d90909837 turnip: enable VK_KHR_performance_query with new debug flag
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Hyunjun Ko c921a6e98d turnip: support multipass for performance query.
To support multipass, querying perf counters happens in several steps
below.

0) There's a scratch reg to set pass indices for perf counters query.
   Prepare cmd streams to set each pass index to the reg at device
   creation time. See tu_CreateDevice in tu_device.c
1) Emit command streams to read all requested perf counters at all
   passes in begin/end query with CP_REG_TEST/CP_COND_REG_EXEC, which
   reads the scratch reg where pass index is set.
2) Pick the right cs setting proper pass index to the reg and prepend it
   to the command buffer at each submit time.
3) If the pass index in the reg is true, then executes the command
   stream below CP_COND_REG_EXEC.

Would need to implement for kgsl in the future.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Hyunjun Ko 937dd76426 turnip: Implement VK_KHR_performance_query
There are still some commands unimplemented yet.

- vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR:
  The following patch supports this.

- vkAcquireProfilingLockKHR / vkReleaseProfilingLock
  This patch supports only monitoring perf counters for each submit.
  To reserve/configure counters across submits we would need a kernel
  interface to be able to do that.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6808>
2020-12-22 04:57:22 +00:00
Danylo Piliaiev e5499ca2bf freedreno/a6xx: Fix SP_HS_UNKNOWN_A831 value and document it
It appears that storage for varyings in a wave has an upper
limit of wavesize * max_a831 where max_a831 is 64.
Exceeding the limit seam to force gpu to reduce primitives
processed per wave, at least calculations make sense with
such interpretation.

With blob SP_HS_UNKNOWN_A831 never exceeds 64 and setting
it to 65 in freedreno leads to a hang.

On A630 tests (patch_size=3 + gl_Position + array of vec4)
have shown such relation:

| Num of vec4 | A831 | PC_HS_INPUT_SIZE |
|-------------|------|------------------|
| 1           | 0x10 | 0xc              |
| 2           | 0x14 | 0xf              |
| 3           | 0x18 | 0x12             |
| 4           | 0x1c | 0x15             |
| 5           | 0x20 | 0x18             |
| 6           | 0x24 | 0x1b             |
| 7           | 0x28 | 0x1e             |
| 8           | 0x2c | 0x21             |
| 9           | 0x30 | 0x24             |
| 10          | 0x34 | 0x27             |
| 11          | 0x38 | 0x2a             |
| 12          | 0x3c | 0x2d             |
| 13          | 0x3f | 0x30             |
| 14          | 0x40 | 0x33             |
| 15          | 0x3d | 0x36             |
| 16          | 0x3d | 0x39             |
| 17          | 0x40 | 0x3c             |
| 18          | 0x3f | 0x3f             |
| 19          | 0x3e | 0x42             |
| 20          | 0x3d | 0x45             |
| 21          | 0x3f | 0x48             |
| 22          | 0x3d | 0x4b             |
| 23          | 0x40 | 0x4e             |
| 24          | 0x3d | 0x51             |
| 25          | 0x3f | 0x54             |
| 26          | 0x3c | 0x57             |
| 27          | 0x3e | 0x5a             |
| 28          | 0x40 | 0x5d             |
| 29          | 0x3c | 0x60             |
| 30          | 0x3e | 0x63             |
| 31          | 0x40 | 0x66             |
|-------------|------|------------------|

Brief tests with high patch sizes also confirm that formula
matches blob behaviour.

A831 is not a limit for storage available for one thread, so
naming it as SP_HS_WAVE_INPUT_SIZE would make more sense.

Fixes: 47e2c195 "freedreno/a6xx: Program state for tessellation stages"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7917>
2020-12-21 16:25:34 +02:00
Danylo Piliaiev 22180137e9 ir3: Allow tesselation to use all 32 varying slots
POS, PSIZE, CLIP_DIST0, and CLIP_DIST1 have their own predefined
indices, map's size should take this into account.

Fixes: 9e063b01 "ir3: Switch tess lowering to use location"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7917>
2020-12-21 16:06:20 +02:00
Samuel Iglesias Gonsálvez 84136d78e6 turnip: fix cube map array image size calculation
imageSize() expects the last component of the return value to be the
number of layers in the texture array. In the case of cube map array,
it will return a ivec3, with the third component being the number of
layer-faces.

Fixes: dEQP-VK.image.image_size.cube_array.*

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8087>
2020-12-18 06:43:07 +01:00
Danylo Piliaiev b34bc3db67 tu: pCounterBuffers can be NULL in vkCmd*TransformFeedbackEXT()
According to the spec:

"pCounterBuffers is an optional array of buffer handles [...]
 If pCounterBuffers is NULL, then transform feedback will start
 capturing vertex data to byte offset zero in all bound transform
 feedback buffers."

"If counterBufferCount is not 0, and pCounterBuffers is not NULL,
 pCounterBuffers must be a valid pointer to an array [...]"

So counterBufferCount could be non-zero with pCounterBuffers
being NULL.

Fixes crash in RenderDoc when inspecting draw call with tesselation
or geometry shader present.

Fixes: 98b0d900 "turnip: rework streamout state and add missing counter buffer read/writes"
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8140>
2020-12-17 16:33:33 +00:00
Danylo Piliaiev 6aec3c9a23 tu: Ignore pTessellationState if there is no tesselation shaders
According to the spec:

"pTessellationState [...] is ignored if the pipeline does not
 include a tessellation control shader stage and tessellation
 evaluation shader stage."

Fixes crash in RenderDoc when inspecting draw call with
geometry shader but without tesselation shaders.

Fixes: eefdca2e "turnip: Parse tess state and support PATCH primtype"
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8140>
2020-12-17 16:33:33 +00:00
Michael Forney 434da21a7c meson: add missing dependency on generated git_sha1.h
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8121>
2020-12-17 00:03:22 +00:00
Eric Anholt f6665eb053 freedreno/ir3: Free the compiler at the end of the unit tests.
Needed for meson test with asan enabled.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7936>
2020-12-15 19:39:29 +00:00
Samuel Iglesias Gonsálvez e8bf15d107 turnip: pCounterBufferOffsets can be NULL on vkCmd*TransformFeedbackEXT()
According to the spec for both vkCmd{Begin,End}TransformFeedbackEXT(),
if pCounterBufferOffsets is NULL, then it is assumed the offsets are
zero.

Fixes crash on dEQP-VK.transform_feedback.simple.backward_dependency_no_offset_array

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8057>
2020-12-11 16:30:51 +00:00
Jonathan Marek fa16e66a3f turnip: always set LRZ registers to zero for 3d clear/blit
Apparently LRZ will be read/written regardless of depth being enabled or
not, so we have to make sure these registers are zero.

Fixes: 1d83f5ae84 ("turnip: disable LRZ on vkCmdClearattachments() 3D fallback path")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
2020-12-08 13:26:16 -05:00
Jonathan Marek f24358e002 turnip: move up LRZ invalidate in CmdClearAttachments
There is an early return if cmd->state.predication_active is true, so do
the LRZ invalidate before that.

Fixes: 2f79e00664 ("turnip: disable LRZ on vkCmdClearAttachments()")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
2020-12-08 13:26:16 -05:00
Jonathan Marek aed7c5aa31 turnip: do not emit draw states in draw_cs outside of renderpass
This avoids a possible issue with MSAA sysmem clears, which use a 3D clear
path which assumes draw states are disabled, and are emitted in draw_cs in
BeginRenderPass.

(checking for TU_CMD_DIRTY_DRAW_STATE also allows not emitting the draw
states if they will be re-emitted on the next draw anyway. the previous
patch makes it so TU_CMD_DIRTY_DRAW_STATE is always set outside of
renderpasses)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
2020-12-08 13:26:11 -05:00
Jonathan Marek 3f58d80823 turnip: correctly disable draw states outside of renderpasses
* do the disable in EndRenderPass2 to fix the missing disable for sysmem
* we don't need a disable at the end of every tile, or between binning pass
  and gmem pass (the first draw in draw_cs emits all the draw states)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
2020-12-08 13:16:11 -05:00
Jonathan Marek af6e74bca8 turnip: always emit LRZ draw state in DIRTY_DRAW_STATE path
The packet size is constant and assumes all states, except for the 2 input
attachment states. (this means we get an invalid packet if DIRTY_LRZ isn't
set when DIRTY_DRAW_STATE is set).

Fixes: 3c07a14998 ("turnip: enable LRZ")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
2020-12-08 13:16:11 -05:00
Jonathan Marek 2d886fb436 turnip: do not include compute stage in pipeline_builder
This avoids emitting compute-related state in the graphics pipeline
(tu6_emit_xs_config was being called for compute stage).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
2020-12-08 13:16:11 -05:00
Jonathan Marek d7ea266e6f turnip: no linear_to_srgb for alpha channel for gmem clear value packing
Alpha channel is always linear (oops).

Fixes: ddac5933f8 ("turnip: call packing functions directly for pack_gmem_clear_value")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
2020-12-08 13:16:09 -05:00
Mauro Rossi 2c16c209b5 android: freedreno/ir3: use python3 in gen rules
Completes freedreno gen rules migration to python3 as per meson.build
With this change all freedreno gen rules use $(MESA_PYTHON3)

Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7942>
2020-12-07 13:10:32 +00:00
Jonathan Marek 872c4bcd27 turnip: implement z-scaling and z-mirroring BlitImage
Z scaling case without nearest filter needs a 3D texture, so add a 3D
texture path and use it to cover all scaling/mirroring cases.

The "rotation" argument for the clear/blit "setup" function is replaced
with a more generic "blit_param", which has a different meaning for the
3D blit path. (to avoid having too many arguments)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7781>
2020-12-03 15:30:06 +00:00
Eric Anholt 06f2516696 freedreno/afuc: Fix up some sprintf format security warnings.
Showed up when I tried enabling asan.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7695>
2020-12-02 20:43:33 +00:00
Daniel Stone 9eee405484 freedreno: Add missing dependency to build
computerator depends on ir3_parser.h, which is a generated file, but
this dependency is not expressed in the build.

Fixes: 1e8808a4a0 ("freedreno/ir3: refactor out helper to compile shader from asm")
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7870>
2020-12-02 16:26:29 +00:00
Danylo Piliaiev a569ffeb83 freedreno/a6xx: Fix typo in height alignment calculation in a6xx layout
Fixes KHR-GL31.texture_size_promotion.functional

Fixes: e49748521e
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7792>
2020-11-26 17:37:37 +00:00
Erik Faye-Lund 5461e21245 Revert "freedreno/ir3: Use get_once() for one-time init"
This reverts commit b4ad27a986.

Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7760>
2020-11-25 09:44:11 +00:00
Rob Clark b4ad27a986 freedreno/ir3: Use get_once() for one-time init
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>
2020-11-24 21:03:34 +00:00
Rob Clark 53f7d539cd util: Add helgrind support for simple_mtx
Annoyingly mtypes.h pulls in simple_mtx, which means we end up needing
to sprinkle a lot of idep_mesautil around.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3773
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>
2020-11-24 21:03:34 +00:00
Rob Clark 9de6a601ce freedreno/drm: Quiet timedout error msg
This isn't terribly interesting, but got more chatty when we converted
to mesa_loge() vs debug_printf()

Fixes: 156d7e45f7 ("freedreno: Convert to mesa_log*()")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7717>
2020-11-23 16:04:52 +00:00
Connor Abbott 76ade57fa6 ir3/ra: Fix array reg liveness in scalar pass
Assigning an array reg removes IR3_REG_ARRAY, which means that
definitions and uses can't be tracked back to the array register's name
and liveness for the components of the array aren't correctly
calculated. To fix this we delay assigning array registers until the
scalar pass.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7711>
2020-11-23 11:33:13 +00:00
Connor Abbott bac6cc586f ir3: Enable nir_lower_vars_to_scratch on a6xx
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:58 +01:00
Connor Abbott 4d44461dd5 tu: Support private memory
Allocate enough space and then program the registers correctly. We
currently allocate scratch memory as part of the pipeline, because the
alternative of trying to share it across pipelines is a bit trickier due
to the need for the configs to exactly match whenever we reuse the same
buffer for different shaders.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott b525934f26 freedreno: Add per-device parameters for private memory
We have to allocate backing storage big enough to hold all the private
memory for all threads that can possibly be in flight, which means that
we have to start filling in some more model-specific information as the
sizes will be different for models with different core counts/ALU
counts.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott ae109ca83c ir3: Properly validate cat6 half-ness
Apparently this is all that's required to get loads & stores to work
with half registers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott 4970aa5577 ir3: Initial support for private memory
Add information that the driver will need to setup registers, and
implement support for load_scratch/store_scratch using private memory.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott 32cb01a418 ir3/parser: Fix st{l,lw,g,p} and ld{l,lw,g,p} assembly
It seems the src_offset and dst_offset are unused for these, and the
offset is expected to be an immediate register. Also we forgot to add a
dummy dst for the store instructions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott 504142ff75 ir3: Fix STP/LDP assembly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott e7471ce776 ir3: Support assembling & disassembling getspid/getwid
These aren't useful yet in the driver, but were useful for
reverse-engineering how private memory works.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott 2cee8642ca ir3: Add more a6xx-specific cat6 opcodes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott c82d7be193 ir3: Expand cat6 a6xx opcode field
Turns out the low bit of pad3 is actually the high bit of the opcode.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott 92fe6fa0cc freedreno/a6xx: Document private memory registers
They seem to be broadly similar to the a3xx ones, albeit with some
things shuffled around and with different units, and the extra layout
mode bits.

We also document the FIRST_EXEC_OFFSET registers, so that we can start
properly setting them all to 0 in freedreno and turnip in later commits.
I discovered the compute one when playing with function support in the
blob CL driver, and added the other registers via analogy (the blob
Vulkan driver sets FIRST_EXEC_OFFSET and the shader VA together in one
packet for all stages, so it seems to really be in the same place for
all stages).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott 3d5bed03e1 freedreno/ci: Strip location from asserts
Let's not force everyone touching ir3.h to make random changes to the
reference output.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Samuel Iglesias Gonsálvez 1200f6da0b turnip: implement VK_KHR_depth_stencil_resolve support
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6884>
2020-11-19 09:43:11 +00:00
Eric Anholt 8ae38885d6 freedreno: Fix uninitialized var warning in afuc using unreachable().
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7664>
2020-11-18 18:15:02 +00:00
Alejandro Piñeiro c77409a87e turnip: minor tu_queue fixes related to vk_base_object
Include:
   * Missing call to tu_queue_finish
   * Use the proper free method for device->queues

Fixes 5d3fdbc52b

Tested-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7663>
2020-11-18 00:58:29 +00:00
Eric Anholt 008872aa30 turnip: Assert about the storage buffer offset alignment.
Giving us an unaligned pointer is invalid, and this helps switch a CTS bug
from being a flake to a consistent crash.

https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/2661

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7662>
2020-11-18 00:38:02 +00:00
Vinson Lee 69cad1f96e turnip: Close sync_fd only if it is a valid file descriptor.
Fix defects reported by Coverity Scan.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: sync_fd is passed to a parameter that cannot be negative.

Fixes: cec0bc73e5 ("turnip: rework fences to use syncobjs")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7647>
2020-11-17 01:05:44 +00:00
Eric Anholt 1f44053301 freedreno+turnip: Upload large shader constants as a UBO.
Right now if the shader indirects on some large constant array, we see NIR
load_consts (usually from the const file) of its contents into general
registers, then indirection on the GPRs.  This often results in register
allocation failures, as it's easy to go beyond the ~256 dwords of
registers per invocation.

By moving the large constants to a UBO, we can load an arbitrary number of
them.  They also can be theoretically moved to the constant reg file (~2k
dwords), though you're unlikely to hit this path without an indirect load
on your large constant, and we don't yet let UBO indirect loads get moved
to constant regs.

This possibly won't work out right if we have 16-bit load_constants, but
without other MRs in flight we won't see 16-bit temps to be lowered to
this.

This allows 2 kerbal-space-program shaders to compile that previously
would fail, and fixes the new dEQP-VK and -GLES2 tests I wrote that
dynamically index a 40-element temporary array of float/vec2/vec3/vec4
with constant element initializers.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2789
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5810>
2020-11-16 13:55:41 -08:00
Eric Anholt 17db969f7a freedreno/ir3: Fix incorrect optimization of usage of 16-bit constbuf vals.
If you're loading a 32b word from the const file and doing a cov.u32u16
split to two 16bit values, we can't turn that into a reference of a 16-bit
float value directly from the constbuf, because the
CONSTANT_DEMOTION_ENABLE results in a f2f16 operation on the 32-bit value
that we didn't want.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5810>
2020-11-16 13:54:22 -08:00
Eric Anholt a9b37e5dad freedreno/ir3: Include at least 4 NOPs so that cffdump doesn't disasm junk.
cffdump looks at the following 4 instructions to decide if the shader has
*really* ended, so if we pack data after that (such as turnip's next
stage's shader), it might decode instructions that aren't really part of
the shader.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5810>
2020-11-16 13:54:22 -08:00
Eric Anholt 433841d9eb freedreno: Fix leak of shader binary on disk cache hits.
It's supposed to be ralloced -- there's not even a shader variant destroy
function for freeing, just ralloc_free() on the ir3_shader_variant or the
parent ir3_shader when you're done!

Fixes: f97acb4bb4 ("freedreno/ir3: disk-cache support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5810>
2020-11-16 13:54:22 -08:00
Rob Clark 4b65c09d86 freedreno/ir3: Fix crash in shader compile fail path
Fixes: 74140c2e85 ("freedreno/ir3: convert over to ralloc")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7612>
2020-11-13 22:44:04 +00:00
Rob Clark cf9ef90066 freedreno/ir3: Add pass to deal with load_uniform base offsets
With indirect load_uniform, we can only encode 10b of constant base
offset.  This pass detects problematic cases and peels out the high
bits of the base offset.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7612>
2020-11-13 22:44:04 +00:00
Vinson Lee dad6b62576 turnip: Fix file descriptor return.
Fix defect reported by Coverity Scan.

Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach the expression -1 inside this statement: return ret ? -1 : handle.fd;

Fixes: cec0bc73e5 ("turnip: rework fences to use syncobjs")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7498>
2020-11-12 22:32:23 +00:00
Marek Olšák baa5807e36 nir: rename needs_helper_invocations to needs_quad_helper_invocations
This indicates that only quad operations use helper invocations.
Also handle quad_swizzle_amd.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7586>
2020-11-12 21:02:05 +00:00
Rob Clark 8de279f8db freedreno/drm: Add some locking asserts
Also fix evil-twin table_lock which they turned up.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7580>
2020-11-12 18:14:56 +00:00
Eric Anholt eda3e4e055 nir/builder: Add a name format arg to nir_builder_init_simple_shader().
This cleans up a bunch of gross sprintfs and keeps the caller from needing
to remember to ralloc_strdup.  I added a couple of '"%s", name ? name :
""' to radv where I didn't fully trace through whether a non-null name was
being passed in.

I also took the liberty of adding a basic name to a few shaders (pan_blit,
unit tests)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7323>
2020-11-11 08:50:29 -08:00
Eric Anholt 5f992802f5 nir/builder: Drop the mem_ctx arg from nir_builder_init_simple_shader().
This looks a lot more simple now!

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7323>
2020-11-11 08:50:29 -08:00
Eric Anholt 4e9328e3b6 nir_builder: Return a new builder from nir_builder_init_simple_shader().
It's a little inline function, so we can just RAII it for better
ergonomics.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7323>
2020-11-11 08:49:49 -08:00
Rob Clark 13d509c7e6 freedreno/drm: Rework APPEND() macro
In particular I wanted the nr_foo increment to be after assignment..
mostly just to track down a potential race.  (This wasn't it, but I
like this color for the bikeshed better.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
2020-11-10 17:58:44 +00:00
Rob Clark 06b918153d freedreno/drm: Drop growable submit_bos table
Since we are not tracking reloc flags per submit, we can just construct
this table at flush time, rather than using a second growable table that
is in sync with msm_submit->bos.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
2020-11-10 17:58:44 +00:00
Rob Clark b2f4bf0105 freedreno/drm: Make ring refcnt atomic again
In general, rings are not shared across contexts/threads.  But this
can happen with texture stateobjs, which can be invalidated by other
contexts.

And while we're here, lets convert the rest of freedreno/drm to
u_atomic

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
2020-11-10 17:58:44 +00:00
Rob Clark 156d7e45f7 freedreno: Convert to mesa_log*()
debug_printf() isn't terribly great in multi-threaded situations.. but
since we now have a simple util/log.h, which even plays nicely with
logcat on android, lets use that instead.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
2020-11-10 17:58:44 +00:00
Rob Clark 78b3f58c99 freedreno/drm: Convert to simple_mtx
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
2020-11-10 17:58:44 +00:00
Vinson Lee 7004548bdf turnip: Remove pipeline NULL check.
pipeline cannot be NULL since pipeline->layout->num_sets was just
checked.

Fix defect reported by Coverity Scan.

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking pipeline 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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7521>
2020-11-09 18:02:21 -08:00
Eric Anholt 9f1cd99ba1 turnip: Fix image size for 3D vkGetImageSubresourceLayout.
Fixes most subcases of dEQP-VK.image.subresource_layout.3d.* The remaining
failures appear to be in snorm, which 2D also fails on (and the blob
reports as not supported for this test).

We don't currently have these tests in CI, but they'll appear with
1.2.4.0.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7467>
2020-11-06 10:04:43 -08:00
Eric Anholt 1882a02d83 tu: Make sure spirv_to_nir knows we support imageStorageWithoutFormat.
You have to set these flags along with the extension, or you get a bunch
of warnings from spirv-to-nir.

Fixes: e781cc7025 ("tu: Expose shaderStorageImage*WithoutFormat")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7465>
2020-11-05 22:34:32 +00:00
Jonathan Marek b2c719308c turnip: enable VK_EXT_image_drm_format_modifier
Add missing GetPhysicalDeviceImageFormatProperties2 logic for the extension
and enable it.

Also stop exposing optimal tiling for formats which are linear only, to
simplify dealing with those.

Passes dEQP-VK.drm_format_modifiers.*

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6940>
2020-11-05 18:06:15 +00:00
Jonathan Marek f624692a57 turnip: don't always fallback to linear for mutable formats
Use VkImageFormatListCreateInfo, and enable VK_KHR_image_format_list to
expose it. (and reorganize linear fallback code a bit)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6940>
2020-11-05 18:06:15 +00:00
Jonathan Marek 8c4426f519 turnip: remove unnecessary/redundant tu_image fields
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6940>
2020-11-05 18:06:15 +00:00
Jonathan Marek c64cd6988f turnip: remove useless tu_image asserts
Validation layer already catches these errors, so don't bother.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6940>
2020-11-05 18:06:15 +00:00
Jonathan Marek dfaa8b9ae7 turnip: LAYOUT_PREINITIALIZED is not different for optimal tiling
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6940>
2020-11-05 18:06:14 +00:00
Jonathan Marek 43c16483e0 turnip: don't implement CreateImage as two separate functions
Inline tu_image_create into tu_CreateImage.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6940>
2020-11-05 18:06:14 +00:00
Jason Ekstrand 3cc58e6470 nir: Add and use some deref mode helpers
NIR derefs currently have exactly one variable mode.  This is about to
change so we can handle OpenCL generic pointers.  In order to transition
safely, we need to audit every deref->mode check.  This commit adds a
set of helpers that provide more nuanced mode checks and converts most
of NIR to use them.

For simple cases, we add nir_deref_mode_is and nir_deref_mode_is_one_of
helpers.  These can be used in passes which don't have to bother with
generic pointers and just want to know what mode a thing is.  If the
pass ever encounters generic pointers in a way that this check would be
unsafe, it will assert-fail to alert developers that they need to think
harder about things and fix the pass.

For more complex passes which require a more nuanced understanding of
modes, we add nir_deref_mode_may_be and nir_deref_mode_must_be helpers
which accurately describe the compiler's best knowledge about the given
deref.  Unfortunately, we may not be able to exactly identify the mode
in a generic pointers scenario so we have to be very careful when we use
these.  Conversion of these passes is left to later commits.

For the case of mass lowering of a particular mode (nir_lower_explicit_io
is one good example), we add nir_deref_mode_is_in_set.  This is also
pretty assert-happy like nir_deref_mode_is but is for a set containment
comparison on deref modes where you expect the deref to either be all-in
or all-out.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>
2020-11-03 22:18:28 +00:00
Jason Ekstrand 3f0a29fffb nir/builder: Add a nir_ieq_imm helper
This shows up surprisingly often.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>
2020-11-03 22:18:28 +00:00
Marijn Suijten 200bcd7a44 android: freedreno: Add freedreno_dev_info.[ch] to Makefile.sources
Addresses the following linker error when building for Android:

    ld.lld: error: undefined symbol: freedreno_dev_info_init
    >>> referenced by freedreno_screen.c:1001 (external/mesa3d/src/gallium/drivers/freedreno/freedreno_screen.c:1001)
    >>>               freedreno_screen.o:(fd_screen_create) in archive [..]/libmesa_pipe_freedreno_intermediates/libmesa_pipe_freedreno.a

These functions were introduced in a file that was not included in the
Android build yet.  Also sort the list of files alphabetically as
requested in an earlier MR.

Fixes: 4a0bdf47e4 ("freedreno: Introduce common device info struct")
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7411>
2020-11-03 11:02:54 +00:00
Connor Abbott fe3e571870 tu: Support rasterizerDiscardEnable and RasterizationStreamSelect
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>
2020-11-03 10:14:45 +00:00
Connor Abbott 841f736824 tu: Support geometryStreams
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>
2020-11-03 10:14:45 +00:00
Connor Abbott 563789ce37 ir3: Support geometry streams
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>
2020-11-03 10:14:45 +00:00
Connor Abbott 48cfaecd4f freedreno/a6xx: Update SO registers for streams
These seem to be unchanged from a5xx, so a5xx could probably be updated
too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>
2020-11-03 10:14:45 +00:00
Jonathan Marek 990343b70d turnip: rework android gralloc path so it doesn't call tu_image_create
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7406>
2020-11-02 19:30:48 +00:00
Connor Abbott a1d2b215f1 tu: Use freedreno_dev_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7385>
2020-11-02 18:07:05 +00:00
Connor Abbott 4a0bdf47e4 freedreno: Introduce common device info struct
This will collect all the various alignments, sizes, and magic values
and set them appropriately, replacing the various pieces scattered
throughout the drivers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7385>
2020-11-02 18:07:05 +00:00
Vinson Lee fdb1997ab5 Fix VMware capitalization.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7260>
2020-10-27 15:33:40 -07:00
Connor Abbott f2ae8d116a freedreno/a6xx: Implement user clip/cull distances
Also, plumb things through ir3 so that we don't lower clip planes to
discard anymore.

This seems to fix some artifacts in the neverball trace.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6959>
2020-10-23 11:09:18 +00:00
Connor Abbott b4224c39e1 tu: Implement clip/cull distances
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6959>
2020-10-23 11:09:18 +00:00
Connor Abbott 47f825ac63 ir3: Handle clip+cull distances
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6959>
2020-10-23 11:09:18 +00:00
Connor Abbott 9e063b01b7 ir3: Switch tess lowering to use location
Clip & cull distances, which are compact arrays, exposed a lot of holes
because they can take up multiple slots and partially overlap.

I wanted to eliminate our dependence on knowing the layout of the
variables, as this can get complicated with things like partially
overlapping arrays, which can happen with ARB_enhanced_layouts or with
clip/cull distance arrays. This means no longer changing the layout
based on whether the i/o is part of an array or not, and no longer
matching producer <-> consumer based on the variables. At the end of the
day we have to match things based on the user-specified location, so for
simplicity this switches the entire i/o handling to be based off the
user location rather than the driver location. This means that the
primitive map may be a little bigger, but it reduces the complexity
because we never have to build a table mapping user location to driver
location, and it reduces the amount of work done at link time in the SSO
case. It also brings us closer to what the other drivers do.

While here, I also fixed the handling of component qualifiers, which was
another thing broken with clip/cull distances.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6959>
2020-10-23 11:09:18 +00:00
Eric Anholt b03fdca2e0 turnip: Add error path handling for descriptor pool init.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
2020-10-20 22:16:59 +00:00
Eric Anholt d384f3be4c turnip: Handle the error path for tu/drm's vkResetFences().
OUT_OF_MEMORY is the only valid error code from this function, but this
error is more of a "things went horribly wrong, you can't talk to the GPU"
case.  Set the device to be in error.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
2020-10-20 22:16:59 +00:00
Eric Anholt 296468ef1a turnip: Handle some error paths in allocating CS space from a command buffer.
Fixes some release-build warnings.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
2020-10-20 22:16:59 +00:00
Eric Anholt 9b156ef57b freedreno/fdperf: Silence a compiler warning about current counter.
It seems like selecting the first here is a fine choice if we can't
find the counter.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
2020-10-20 22:16:59 +00:00
Eric Anholt a512e9eecd freedreno/tools: Fix compiler warnings about using sz in the error paths.
If we don't check for a NULL str, then sz might be undefined (as was
happening in the match_compatible path, and returning 0 makes us not match
as we should).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
2020-10-20 22:16:59 +00:00
Eric Anholt 91c5bbc128 freedreno/cffdec: Fix format overflow warning.
../src/freedreno/decode/cffdec.c: In function ‘reg_disasm_gpuaddr’:
../src/freedreno/decode/cffdec.c:404:29: error: ‘sprintf’ writing a
terminating nul past the end of the destination [-Werror=format-overflow=]
  404 |   sprintf(filename, "%04d.%s", n++, ext);
../src/freedreno/decode/cffdec.c:404:3: note: ‘sprintf’ output between
9 and 16 bytes into a destination of size 8
  404 |   sprintf(filename, "%04d.%s", n++, ext);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
2020-10-20 22:16:59 +00:00
Eric Anholt 4df98c3c0c turnip: Only link libdrm in the DRM case, not KGSL.
libvulkan's not a fan of opening my libdrm.so.2 from /vendor/lib64 or
/vendor/lib64/hw, but then we shouldn't need it, anyway.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>
2020-10-19 18:41:50 +00:00
Eric Anholt f63ce9bbe0 turnip: Don't link the WSI code if we don't have a WSI extension.
I don't like the TU_HAS_SURFACE duplication, but this is a step to having
a non-libdrm-dependent turnip on Android with KGSL (which doesn't have
drm for rendering).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>
2020-10-19 18:41:50 +00:00
Eric Anholt 8f3313fb47 turnip: Use Mesa's libsync.h instead of libdrm's libsync.h.
Given that we already link to Android's libsync, use it instead of using a
build-time dependency on libdrm for the KGSL path.  This also would help
for older kernel compat with KGSL.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>
2020-10-19 18:41:50 +00:00
Eric Anholt 8a72666e91 turnip: Drop a dead error checking path in device init.
The only result != SUCCESS setters above all jump across to the fail
label.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>
2020-10-19 18:41:50 +00:00
Eric Anholt 3a1f22c38b turnip: Add support for GetSwapchainGrallocUsage2ANDROID().
This is lifted straight from anv, which seems like a reasonable way to go.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7015>
2020-10-08 21:04:01 +00:00
Eric Anholt 5a595cd3af turnip: Detect Qualcomm gralloc and its UBWC flag on gralloc surfaces.
And document where to find information on qcom gralloc's private handle
layout.  I chose not to #include the gralloc_priv because it seems that
there's not much we need yet, and I'm hoping we can avoid the build-time
dependency on the specific platform.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7015>
2020-10-08 21:04:01 +00:00
Eric Anholt 9a14e74752 turnip/kgsl: Add support for importing dma-bufs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7015>
2020-10-08 21:04:01 +00:00
Eric Anholt b732e4f274 turnip/kgsl: Fix last minute breakage of the build.
Need to land KGSL in CI!

Fixes: 8163c818e3 ("turnip: implement timestamp fences/semaphores for kgsl backend")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7015>
2020-10-08 21:04:01 +00:00
Eric Anholt 624a2aad66 freedreno/ir3: Don't leave holes the UBO upload plan.
Shaders may not use a particular region of a UBO in a given shader (think
UBOs shared between stages, or between shaders), and by just always
extending the existing range for a given UBO, we'd waste bandwidth
uploading it, and also waste our precious const space in storing the
unused data.

Instead, only upload exactly the ranges we can use, and merge ranges when
they're neighbors.  We may end up with more upload packets, but the
bandwidth savings is surely going to be worth it (and if find we want a
distance threshold for merging with nearby uploads, that would be easy to
add).

total instructions in shared programs: 9266114 -> 9255092 (-0.12%)
total full in shared programs: 343162 -> 341709 (-0.42%)
total constlen in shared programs: 1454368 -> 1275236 (-12.32%)
total cat6 in shared programs: 93073 -> 82589 (-11.26%)
total (ss) in shared programs: 212402 -> 206404 (-2.82%)
total (sy) in shared programs: 122905 -> 114007 (-7.24%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7036>
2020-10-08 20:29:02 +00:00
Eric Anholt ddf468f96f freedreno/ir3: Clean up the UBO upload plan setup.
No more start > end for signaling that the slot isn't used, no more funny
setup of num_enabled.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7036>
2020-10-08 20:29:02 +00:00
Eduardo Lima Mitev 713386af20 turnip: Enable support for KHR_incremental_present
All bits should already be provided by wsi/common.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6704>
2020-10-07 07:13:41 +00:00
Marek Olšák f5f0c012ad gallium/util: remove empty file u_half.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6987>
2020-10-06 21:07:11 -04:00
Marek Olšák b42c6ff6f6 util: remove util_float_to_half and util_half_to_float wrappers
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6987>
2020-10-06 21:07:07 -04:00
Eric Anholt e33f9dbc1a turnip/kgsl: Add strerror decode in BO init failure.
Just covering more of the error paths.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7014>
2020-10-05 22:42:14 +00:00
Eric Anholt 5d3aeafa77 turnip: Report device loss through _mesa_loge() instead of fprintf.
We drop the file/line, but there are only a couple of places calling this
and they have unique strings anyway.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7014>
2020-10-05 22:42:14 +00:00
Eric Anholt 50f25da2b5 turnip: Always enable TU_DEBUG=startup on debug drivers.
For Android, it's hard to inject environment variables for testing, and I
figure if you've got a debug driver then you'd love to see about driver
init failures anyway.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7014>
2020-10-05 22:42:14 +00:00
Eric Anholt a4d9a9d11c turnip: Extend the coverage of TU_DEBUG=startup.
I found while debugging KGSL that we were missing failure output for a
bunch of the error paths.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7014>
2020-10-05 22:42:14 +00:00
Eric Anholt 80869f0bc3 turnip: Mark the vk_errorf helper as bring printflike.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7014>
2020-10-05 22:42:13 +00:00
Eric Anholt 01de452b5d turnip: Use mesa's normal PRINTFLIKE macro instead of our own.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7014>
2020-10-05 22:42:13 +00:00
Eric Anholt a7bc2f8d1b turnip: Don't expose VK_ANDROID_native_buffer on non-Android.
The code is only there when compiling that platform.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7014>
2020-10-05 22:42:13 +00:00
Jonathan Marek 8163c818e3 turnip: implement timestamp fences/semaphores for kgsl backend
This gets fences and semaphores working for kgsl (minus import/export).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7000>
2020-10-05 21:07:01 +00:00
Jonathan Marek ef918f0e33 turnip: remove pre-emption marker
turnip doesn't implement pre-emption, this hasn't been a problem with drm
backend since the kernel driver doesn't implement it either, however this
causes issues with kgsl backend.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6994>
2020-10-04 03:30:48 +00:00
Samuel Iglesias Gonsálvez 57b4f60add turnip: don't initialize GRAS_LRZ_CNTL/RB_LRZ_CNTL tu6_init_hw()
They will be initialized when emitting the draw state.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez 3c07a14998 turnip: enable LRZ
v2:

* Use sub_cs when creating the IB in tu6_build_lrz(). (Jonathan Marek)
* Emit tu6_build_lrz() only when pipeline state changes or there is a
clear. (Jonathan Marek)

v3:

* Don't modify tu_pipeline object, track the changes in command buffer
state.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez 1d83f5ae84 turnip: disable LRZ on vkCmdClearattachments() 3D fallback path
Partial clears are not supported and we may end up having LRZ enabled
from past commands.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez 2f79e00664 turnip: disable LRZ on vkCmdClearAttachments()
We don't support partial clears on LRZ. Blob disables them too.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez 27743b029d turnip: emit correct LRZ fast clear setup
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez 0ca87ed506 turnip: add support to clear LRZ
v2:

* Don't emit tu6_clear_lrz() using a IB but in the command stream
provided. (Jonathan Marek)
* Valid_clear_ib is always false if TU_DEBUG_NOLRZ is set. Remove the
useless condition. (Jonathan Marek)
* Added more comments.
* Use r2d function for blitting LRZ. (Jonathan Marek)

v3:
* Do LRZ tracking in the command buffer state (Connor).

v4:

* Simplify the emission of source setup (Jonathan Marek)

v5:

* Separate LRZ setup in a different function.
* Not hide LRZ setup inside GMEM path (Jonathan Marek)
* Fix iova address emission in tu6_clear_lrz() (Jonathan Marek)
* Add CCU sysmem flushes (Jonathan Marek)

v6:

* Fixed bug related to storing a VkClearValue pointer that could be
  out-of-scope when we access to it for emitting LRZ clear.

v7:

* Merge tu6_clear_lrz() and tu6_clear_lrz_setup() into the same
function and emit LRZ clear at the beginning of the renderpass.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez 0b2cfd0668 turnip: add LRZ valid tracking for secondary command buffers
After a secondary command buffer is executed, LRZ is not valid
until it is cleared again.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez 517b26bdd1 turnip: add LRZ tracking to command buffer state
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:47 +00:00
Samuel Iglesias Gonsálvez fdad1ca256 turnip: disable LRZ depending on fragment changes
Disable LRZ write if the fragment shader discard the fragments, modify
its position or if early-Z is disabled.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:46 +00:00
Samuel Iglesias Gonsálvez d1fa40bdcf turnip: disable LRZ writes when blend is enabled
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:46 +00:00
Samuel Iglesias Gonsálvez 38f008e07b turnip: disable LRZ on specific cases
There are depth compare op modes that are not supported by LRZ in the
HW. Also, it is not supported when blend or stencil are enabled.

v2:

* Set pipeline->lrz.write to the same value than depthWriteEnable.
* Improve comment on disabling LRZ write on blend.
* Remove pipeline's lrz invalidation when there is no clear mask in
render pass. It is confusing. (Jonathan Marek)
* Mark the pipeline state as changed.
* Add comment on not using GREATER flag.

v3:

* Replace {rb,gras}_lrz_cntl by flags in struct tu_pipeline.
* Added z_test_enable flag.

v4:

* Created struct tu_lrz_pipeline to avoid modifying immutable objects.

v5:

* Fixed crashes when pDepthStencilState pointer is NULL.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:46 +00:00
Samuel Iglesias Gonsálvez 6089b00e89 turnip: create LRZ buffer
v2:
- Add missing vulkan subpass support. (Jonathan Marek)
- When creating the BO, mark it as not valid until it is cleared.
- Move LRZ struct to tu_image. (Jonathan Marek)
- Destroy BO when we destroy the image. (Jonathan Marek)

v3:
- Allocate the buffer as part of the image's BO (Connor)
- Moved image's LRZ values to its layout.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:46 +00:00
Samuel Iglesias Gonsálvez 138d2928cd turnip: add environment variable to disable LRZ
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
2020-10-02 03:46:46 +00:00
Jonathan Marek 535fd6d45e freedreno/cffdec: fix decoding of bindless descriptors
Add ADDR suffix so that regbase() doesn't fail and return 0.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6968>
2020-10-02 00:48:59 +00:00
Matt Turner 1aac47db69 Revert F16C series (MR 6774)
This reverts commit 4fb2eddfdf.
This reverts commit 7a1deb16f8.
This reverts commit 2b6a172343.
This reverts commit 5af81393e4.
This reverts commit 87900afe5b.

A couple of problems were discovered after this series was merged that
cause breakage in different configurations:

   (1) It seems that using -mf16c also enables AVX, leading to SIGILL on
   platforms that do not support AVX.
   (2) Since clang only warns about unknown flags, and as I understand
   it Meson's handling in cc.has_argument() is broken, the F16C code is
   wrongly enabled when clang is used, even for example on ARM, leading
   to a compilation error.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3583
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6969>
2020-10-01 21:08:12 +00:00
Jason Ekstrand 0aa08ae2f6 nir: Split NIR_INTRINSIC_TYPE into separate src/dest indices
We're about to introduce conversion ops which are going to want two
different types.  We may as well just split the one we have rather than
end up with three.  There are a couple places where this is mildly
inconvenient but most of the time I find it to actually be nicer.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6945>
2020-10-01 18:36:53 +00:00
Eric Anholt 49ec863e83 freedreno/ir3: Enable the i/o vectorizer on UBOs.
This will merge loads of UBO components together into vec4 loads.  At the
same time, it improves the alignment information on our loads, fixing the
regression from the vec3 loads fix.

shader-db results:
total instructions in shared programs: 12829370 -> 8755851 (-31.75%)
total cat6 in shared programs: 145840 -> 97027 (-33.47%)

Overall results from before the vec3 fix:
total instructions in shared programs: 8019997 -> 8755851 (9.18%)
total cat6 in shared programs: 87683 -> 97027 (10.66%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6612>
2020-09-30 19:53:43 +00:00
Eric Anholt bd60e31c83 freedreno/ir3: Make sure we run the opt loop after lowering UBOs to vec4.
The lowering pass may introduce vector bcsels that we need to scalarize
back out.  It's unusual to have UBOs and not get any lowered to push
constants, so the flag was usually set anyway.

Fixes: 2b25240993 ("freedreno/ir3: Replace our custom vec4 UBO intrinsic
with the shared lowering.")

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6612>
2020-09-30 19:53:43 +00:00
Jonathan Marek 8dc8922af2 turnip: implement legacy API functions separately
Move legacy API functions to a separate file, and implement them by calling
the new API functions, like tu_CreateRenderPass was already doing.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6920>
2020-09-30 17:02:55 +00:00
Marek Olšák 4fb2eddfdf gallium/util: remove empty file u_half.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6774>
2020-09-30 16:28:24 +00:00
Marek Olšák 2b6a172343 util: remove util_float_to_half and util_half_to_float wrappers
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6774>
2020-09-30 16:28:24 +00:00
Jason Ekstrand 92a594b154 spirv: Delete the legacy offset/index UBO/SSBO lowering
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5275>
2020-09-30 07:20:39 +00:00
Jason Ekstrand d3fa7451a6 anv,radv,tu,val: Call nir_lower_io for push constants
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5275>
2020-09-30 07:20:39 +00:00
Jonathan Marek 728061b968 turnip: signal fence and semaphore in AcquireNextImage2KHR
As a result of doing semaphores correctly, this is needed for things to
work correctly.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek e192f8f30a turnip: share code between semaphores/fences + fence import/export
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek 0497c9cb6c turnip: remove remaining uses of drmSyncobj helpers
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek c4d5010c54 turnip: rework ImportSemaphoreFdKHR
The behavior of OPAQUE_FD should be unchanged.

SYNC_FD case is reworked to be more like what anv does: a new temporary
syncobj is always created, with the CREATE_SIGNALED flag if necessary.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek 8343c32f5a turnip: rework GetSemaphoreFdKHR
Fixes:
- permanent payload not being restored for the OPAQUE_FD case
- incorrectly resetting the permanent payload in SYNC_FD case

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek fb76af24a2 turnip: semaphores simplification (only syncobj semaphores supported)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek 1dfb5a93d2 turnip: set MSM_SUBMIT_SYNCOBJ_RESET for submit pWaitSemaphores
From VK spec:

"the act of waiting for a binary semaphore also unsignals that semaphore"

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek 2a3f6e0267 turnip: always create permanent syncobj for semaphore
This allows non-exported semaphores to behave correctly instead of being
ignored in QueueSubmit().

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
2020-09-30 00:32:40 +00:00
Jonathan Marek dcc278c722 turnip: clean up tu_device_memory
Delete unused code.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6913>
2020-09-29 23:24:32 +00:00
Rob Clark 7454ae4ea6 freedreno/registers: Add a couple things used on kernel side
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6900>
2020-09-29 20:56:54 +00:00
Rob Clark 27c8d97657 freedreno/drm: Also clean ring_cache
We also need to release all the entries from the ring_cache when tearing
down the dev.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6900>
2020-09-29 20:56:54 +00:00
Rob Clark 69a3ef6511 freedreno/drm: drop bo's dev reference
This is a bit over-paranoid, and can cause drm device fd leaks if there
is a bo leak somewhere.  Which is kind of a worse outcome.

This "fixes" a fd leak seen in:

dEQP-EGL.functional.query_context.get_current_display.*
dEQP-EGL.functional.query_context.get_current_context.*
dEQP-EGL.functional.query_context.get_current_display.*

(Still tracking down the root leak)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6900>
2020-09-29 20:56:54 +00:00
Connor Abbott 8d2757789a tu: Enable multi-position output
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6515>
2020-09-29 16:16:05 +00:00
Connor Abbott 64ad5a1f7b ir3, tu: Link per-view position correctly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6515>
2020-09-29 16:16:05 +00:00
Connor Abbott 6982e8510b ir3, tu: Run optimization loop twice
This call to ir3_optimize_nir() mirrors what st/mesa does for us in
Gallium, and will be necessary for cross-stage linking and the multiview
lowering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6515>
2020-09-29 16:16:05 +00:00
Connor Abbott 41a5a21858 tu: Refactor shader compilation flow
In order to do cross-stage linking, we'll need to split out SPIR-V->NIR
and NIR finalization, so that we can do a round of linking in between.
The multiview lowering pass also assumes that it sits between two
optimization loops, which in anv are the pre-linking optimizations and
post-linking finalization.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6515>
2020-09-29 16:16:05 +00:00
Connor Abbott 67ac16611b tu: Write multiview control registers in binning pass
Multiview is never used with binning, but we still need to make sure to
disable it in the binning pass.

Fixes: c0c7dbd ("tu: Implement multiview pipeline state")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6515>
2020-09-29 16:16:05 +00:00
Jonathan Marek 6d4f33e469 turnip: initial implementation of VK_KHR_push_descriptor
Add missing descriptor sets code for push descriptors, and a simple initial
implementation to enable the extension and pass dEQP tests.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6755>
2020-09-29 12:58:34 +00:00
Jonathan Marek 992d24794d turnip: delete unused/broken pipeline layout hashing code
Note: immutable samplers hash was wrong since we have an array of
tu_sampler and not 4 dwords like radv.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6755>
2020-09-29 12:58:34 +00:00
Jonathan Marek 560cff81f5 turnip: remove unused cmd_buffer/device arguments in descriptor sets
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6755>
2020-09-29 12:58:34 +00:00
Eric Anholt a55dc276a3 turnip: Replace tu_log*() with mesa_log*()
This gets us logging on Android.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6806>
2020-09-28 09:14:44 -07:00
Samuel Iglesias Gonsálvez b54a0bb528 freedreno/layout: add tile_all flag to the layout
Added a new tile_all flag which is used to set the TILE_ALL flag of
the texture. Enabled tile_all to depth/stencil images are they are
non-linear.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6848>
2020-09-25 15:38:47 +00:00
Jonathan Marek dcba32bac0 turnip: implement VK_EXT_extended_dynamic_state
Passes dEQP-VK.pipeline.extended_dynamic_state.*

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5641>
2020-09-25 12:59:02 +00:00
Jonathan Marek b2fa2d99ae turnip: move A6XX_RB_ALPHA_CONTROL write to init_hw
Its always 0.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5641>
2020-09-25 12:59:02 +00:00
Jonathan Marek d1588c78ab turnip: fix wrong indentation in tu6_draw_common
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5641>
2020-09-25 12:59:02 +00:00
Kenneth Graunke 140f53e646 Revert "nir: replace lower_ffma and fuse_ffma with has_ffma"
This reverts commit 939ddf3f67.

Intel has a separate pass for fusing FFMAs selectively.  We split
these flags in commit 1b72c31e1f and
the reasoning still stands.  The patch being reverted was just a
cleanup, so there should be no issue with reverting it.

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6849>
2020-09-24 13:11:50 -07:00
Jonathan Marek cec0bc73e5 turnip: rework fences to use syncobjs
Fences are now just a syncobj, which makes our life easier.

The next step will be to fill out ImportFenceFdKHR()/GetFenceFdKHR().

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6683>
2020-09-24 14:37:13 +00:00
Jonathan Marek c23206757a turnip: require syncobj support
Note: this means turnip requires kernel 5.8 (or older with syncobj patch).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6683>
2020-09-24 14:37:13 +00:00
Jonathan Marek 89ffe859a8 turnip: add a fd field to tu_device
Avoid the extra indirect for this commonly used field.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6683>
2020-09-24 14:37:13 +00:00
Jonathan Marek ec4fe92c83 turnip: delete unused tu_fence_signal function
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6683>
2020-09-24 14:37:13 +00:00
Jonathan Marek 4c71cda9ab vulkan/wsi/display: add option for display fence to signal syncobj
To avoid having a separate "wsi_fence" path in the driver, make it so wsi
fences can signal a syncobj.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6707>
2020-09-24 13:20:00 +00:00
Marek Olšák 939ddf3f67 nir: replace lower_ffma and fuse_ffma with has_ffma
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6756>
2020-09-24 12:29:11 +00:00
Marek Olšák 21174dedec nir: split fuse_ffma into fuse_ffma16/32/64
AMD wants different behavior for each bit size

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6756>
2020-09-24 12:29:11 +00:00
Connor Abbott e781cc7025 tu: Expose shaderStorageImage*WithoutFormat
We don't use the format anymore in the backend, except determining the
number of components, and we fallback to 4 there if it's not specified.
So we should be safe to enable this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6800>
2020-09-22 14:54:40 +00:00
Connor Abbott 37054a3ef5 ir3: Don't use the format to get the image type
Use the sampler type instead, which was recently plumbed through core
NIR, for load/store and the right type for atomics. This removes the
last hard dependency on the image format.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6800>
2020-09-22 14:54:40 +00:00
Connor Abbott 6ebc20fd88 tu: Expose shaderImageGatherExtended
This just allows textureGather() to have offsets, which we already
supported in ir3.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6800>
2020-09-22 14:54:40 +00:00
Connor Abbott 205f4e9a57 tu: Expose shaderStorageImageExtendedFormats
We already supported all the formats on the list, so it's trivial to
enable.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6800>
2020-09-22 14:54:40 +00:00
Jason Ekstrand 9750164c09 nir: Rename get_buffer_size to get_ssbo_size
This makes it explicit that this intrinsic is only for SSBOs.  For the
v3dv driver, we'll be adding a get_ubo_size intrinsic and we want to be
able to distinguish between the two.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6812>
2020-09-22 13:34:12 +00:00
Eric Anholt 08add9f61c turnip/kgsl: Associate fences with submits.
This fixes all the I was seeing in the multiview tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4479>
2020-09-21 22:51:05 +00:00
Kristian H. Kristensen e80758405c turnip: Add kgsl backend
Lacking a bit around fences and wsi integration, but there's enough
here to actually drive the GPU.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4479>
2020-09-21 22:51:05 +00:00
Vinson Lee cde5b86a88 turnip: Release bo_mutex lock before potential error path.
Fix defect reported by Coverity Scan.

Missing unlock (LOCK)
missing_unlock: Returning without unlocking queue->device->bo_mutex.

Suggested-by: Jonathan Marek <jonathan@marek.ca>
Fixes: bea6290ca0 ("turnip: device global bo list")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6768>
2020-09-17 23:27:40 +00:00
Eric Anholt 207219d435 turnip: Add support for a615.
Verified RB_CCU_CNTL, 9805, and A0F8 values from blob traces.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6741>
2020-09-16 23:53:00 +00:00
Gert Wollny 7ab804dbb4 freedreno/ir3: set lower_uniforms_to_ubo compiler flag
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6316>
2020-09-16 10:07:42 +00:00
Jonathan Marek efff734220 turnip: multiViewport and VK_EXT_shader_viewport_index_layer
Passes at least:
dEQP-VK.dynamic_state.vp_state.viewport_array
dEQP-VK.draw.shader_viewport_index.*
dEQP-VK.draw.shader_layer.*

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5832>
2020-09-15 16:18:45 +00:00
Jonathan Marek 52534c3a86 freedreno/ir3: add view_zero to shader key
Does the same thing as layer_zero, but for VARYING_SLOT_VIEWPORT.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5832>
2020-09-15 16:18:45 +00:00
Jonathan Marek e732750b16 freedreno/ir3: allow layer/viewport output for VS/GS/DS
With VK_EXT_shader_viewport_index_layer, these stages can all output the
viewport or layer id, and not just GS anymore.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5832>
2020-09-15 16:18:45 +00:00
Vinson Lee e607477d7c freedreno: Check file descriptor before write.
Fix defect reported by Coverity Scan.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be
negative.

Fixes: 1ea4ef0d3b ("freedreno: slurp in decode tools")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6696>
2020-09-14 22:38:47 +00:00
Jonathan Marek f3109c4579 turnip: avoid heap allocations in QueueSubmit when semaphores are used
Use the stack. (note: we already do for drm_msm_gem_submit_cmd array, and
using calloc() for heap allocations in a VK driver is wrong

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6687>
2020-09-14 18:11:59 +00:00
Jonathan Marek bea6290ca0 turnip: device global bo list
Avoid having to deal with BO tracking. However, the kernel still requires a
bo list, so keep a global one which can be re-used for every submit.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6686>
2020-09-13 04:04:58 +00:00
Jonathan Marek 52becd39a5 turnip: rework vertex buffers draw state handling
This exploits a HW optimization for when only the size of a draw state is
changed, to make things simpler and more optimal (assuming a well behaved
user which doesn't unecessarily call CmdBindVertexBuffers many times)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6665>
2020-09-10 13:14:05 +00:00
Eric Anholt cd4fb5a434 freedreno/fdl: Add layout test for the Android CTS's MSAA mustpass surface.
Rob had a question of if we were laying things out the same as the blob.
This doesn't detect any difference in our layout, though.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6589>
2020-09-10 00:11:46 +00:00
Eric Anholt 14131ed308 freedreno/cffdec: Add support for texturator's 2DMS layout setup.
We can't initialize our MSAA texture with glTexImage2D(), so we have to do
a draw to get its slice's layout into the cmdstream.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6589>
2020-09-10 00:11:46 +00:00
Eric Anholt 2f39727cc6 freedreno/cffdec: Fix up texturator parsing scripts for XML changes.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6589>
2020-09-10 00:11:46 +00:00
Vinson Lee 587969154f freedreno: Fix file descriptor leak.
Fix defects reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_handle: Handle variable fd going out of scope leaks the handle.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be negative.

Fixes: 1ea4ef0d3b ("freedreno: slurp in decode tools")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6642>
2020-09-09 21:56:04 +00:00
Eric Anholt 802d3611dc turnip: Fix truncation of iovas to 32 bits in queries.
Fixes regression when switching to msm-next-pgtables.

Fixes: e34b0d65f9 ("turnip: Implement and enable VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>
2020-09-09 17:25:38 +00:00
Eric Anholt 329c317287 turnip: Fix truncation of CS shader iovas to 32 bits.
This was invalid, and makes VK break consistently with the
msm-next-pgtbables branch.

Fixes: 13525a9c70 ("turnip: pipeline program state refactor")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>
2020-09-09 17:25:38 +00:00
Eric Anholt 3b3772d6e6 freedreno: Make the pack struct have a .qword for wide addresses.
Storing a precomputed iova in reg packing wasn't possible because you'd
truncate to 32 bits.  Making it be .qword makes it possible.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>
2020-09-09 17:25:38 +00:00
Eric Anholt 021523d4ae turnip: Fix a compiler warning in release builds of the query code.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6592>
2020-09-09 17:25:38 +00:00
Jonathan Marek 5a95cc04de turnip: remove some unnecessary regs init
The removed registers are all set elsewhere when they are relevant, so
there is no need to initialize them in init_hw().

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>
2020-09-09 17:01:51 +00:00
Jonathan Marek 3d0ab65b48 turnip: delete unused "tu_cmd_buffer_upload"
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>
2020-09-09 17:01:51 +00:00
Jonathan Marek 3b144d5fb8 turnip: fix the type of tu_shader_module code field, delete unused sha1
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>
2020-09-09 17:01:51 +00:00
Jonathan Marek 6f51192169 turnip: delete unused tu_image fields
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>
2020-09-09 17:01:51 +00:00
Jonathan Marek bd53a25592 turnip: delete tu_physical_device path field
Resolves a "strncpy specified bound 20 equals destination size" warning.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6664>
2020-09-09 17:01:51 +00:00
Eric Anholt 41b5aafef3 freedreno/ir3: Apply the max upload limit to initial range setup
There's no sense in planning out an upload that we won't be able to
actually upload due to the limit.  This means that we can keep making
other loads pushable, even after we find one that wouldn't be, and we
don't fill the const file with UBO data for a load we couldn't promote.

total instructions in shared programs: 8096655 -> 8044344 (-0.65%)
total constlen in shared programs: 1447824 -> 1411384 (-2.52%)
total cat6 in shared programs: 97824 -> 89983 (-8.02%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>
2020-09-08 18:20:51 +00:00
Eric Anholt f74c3b0404 freedreno/ir3: Use the new NIR UBO ranges in UBO analysis.
Now that NIR doesn't lose the original base/range on the
nir_lower_uniforms_to_ubo() path, we get a lot more indirect arrays
uploaded in shader-db.

total instructions in shared programs: 8125988 -> 8103788 (-0.27%)
total constlen in shared programs: 1313096 -> 1448864 (10.34%)
total cat6 in shared programs: 104089 -> 97824 (-6.02%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>
2020-09-08 18:20:51 +00:00
Mauro Rossi 9d02d65f46 android: freedreno/common: add libmesa_git_sha1 static dependency
Fixes the following building error:

external/mesa/src/freedreno/common/freedreno_uuid.c:30:10: fatal error: 'git_sha1.h' file not found
         ^~~~~~~~~~~~
1 error generated.

Fixes: e7458f19e ("freedreno/uuid: Generate meaningful device and driver UUID")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6625>
2020-09-07 20:02:45 +00:00
Jonathan Marek 50ff8a772a freedreno/regs: add 7nm DSI PHY/PLL regs
This is for the kernel driver.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6603>
2020-09-04 19:15:32 +00:00
Marek Olšák ac55b1a9a6 nir: get ffma support from NIR options for nir_lower_flrp
This also fixes the inverted last parameter of nir_lower_flrp in most drivers.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6599>
2020-09-04 17:06:22 +00:00
Jason Ekstrand 38a83a3048 nir/lower_indirect_derefs: Add a threshold
Instead of always lowering everything, we add a threshold such that if
the total indirected array size (AoA size) is above that threshold, it
won't lower.  It's assumed that the driver will sort things out somehow
by, for instance, lowering to scratch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5909>
2020-09-03 14:26:49 +00:00
Connor Abbott 612ef74190 freedreno/computerator: Use a render node
Fixes headless systems.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6562>
2020-09-02 14:53:44 +00:00
Hyunjun Ko 075e40ea98 turnip: Implement VK_EXT_host_query_reset
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6299>
2020-09-02 10:49:03 +00:00
Hyunjun Ko b92be738d5 turnip: Support pipeline statistics query
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6299>
2020-09-02 10:49:03 +00:00
Hyunjun Ko 170da456ef turnip: Refactor structs of tu_query
Since there are different number of results depending on query types,
this patch removes the result field out of the common struct and defines
query-specific results in each type of query struct.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6299>
2020-09-02 10:49:03 +00:00
Jonathan Marek a6291b1b11 freedreno/ir3: rework setup_{input,output} to make struct varyings work
Rework setup_{input,output} to be called during emit_intrinsic, in a way
which allows struct/array/matrix type varyings to work.

This allows turnip to pass dEQP-VK.glsl.linkage.varying.struct.*

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6181>
2020-09-01 15:10:47 +00:00
Jonathan Marek c694af40bf freedreno/ir3: improve handling of aliased inputs
This allows overlapping inputs, which is required for the next patch which
makes it so setup_input may be called multiple times for each input.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6181>
2020-09-01 15:10:47 +00:00
Jonathan Marek acb6163d5e freedreno/ir3: remove indirect input load
nir_intrinsic_load_input should only be used with VS and FS, indirect input
shouldn't be possible for those.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6181>
2020-09-01 15:10:47 +00:00
Eric Anholt 221aa00eeb turnip: Make sure we include the build id.
The ir3 disk cache is initialized when we use the ir3 compiler, even if we
don't use it ourselves, and it requires a build id.  With lld, it seems we
don't end up getting one included by default.

Fixes: f97acb4bb4 ("freedreno/ir3: disk-cache support")
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6324>
2020-08-31 17:50:30 +00:00
Eric Anholt 2b25240993 freedreno/ir3: Replace our custom vec4 UBO intrinsic with the shared lowering.
This gets us fewer comparisons in the shaders that we need to optimize
back out, and reduces backend code.

total instructions in shared programs: 11547270 -> 7219930 (-37.48%)
total full in shared programs: 334268 -> 319602 (-4.39%)

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6378>
2020-08-24 09:53:36 -07:00
Jesse Natalie d3faac7a15 nir: Add options to nir_lower_compute_system_values to control compute ID base lowering
If no options are provided, existing intrinsics are used.
If the lowering pass indicates there should be offsets used for global
invocation ID or work group ID, then those instructions are lowered to
include the offset.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>
2020-08-21 22:07:05 +00:00
Jesse Natalie 2e1df6a17f nir: Move compute system value lowering to a separate pass
The actual variable -> intrinsic lowering stays where it is, but
ops which convert one intrinsic to be implemented in terms of
another have moved.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>
2020-08-21 22:07:05 +00:00
Karol Herbst e5899c1e88 nir: rename nir_op_fne to nir_op_fneu
It was always fneu but naming it fne causes confusion from time to time. So
lets rename it. Later we also want to add other unordered and fne, this is
a smaller preparation for that.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6377>
2020-08-21 17:26:21 +00:00
Jason Ekstrand 1ccd681109 nir: Add an LOD parameter to image_*_size
The OpenCL image_width/height/depth functions have variants which can
take an LOD parameter.  More importantly, LLVM-SPIRV-Translator always
generates OpImageQuerySizeLod even if the LOD is guaranteed to be zero.
Given that over half the hardware out there has an LOD field for image
size queries (based on a rudimentary scan through their NIR -> whatever
code), we may as well just add the source to the NIR intrinsic.  If this
is ever a problem for anyone, the lowering is pretty trivial.

I've also added asserts to everyone's drivers that should alert them if
they ever see an LOD other than zero.  This will never happen with GL or
Vulkan so there's no need for panic.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6396>
2020-08-20 20:48:10 +00:00
Connor Abbott b708a1acb8 tu: Enable VK_KHR_multiview
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:18 +00:00
Connor Abbott c0c7dbd103 tu: Implement multiview pipeline state
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:18 +00:00
Connor Abbott c884afc6f7 tu: Add multiview lowering pass
For now this only handles an a630 quirk where PC_MULTIVIEW_MASK doesn't
exist. However in the future it will also handle multi-position output.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:18 +00:00
Connor Abbott 7b53ac1c1f tu: Implement multiview query interactions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:18 +00:00
Connor Abbott ff5f460980 tu: Improve timestamp queries
As the original comment says, we can't really give the user what they
want if there's a timestamp inside a GMEM renderpass, but we can give
them a better approximation of it. At least sysmem renderpasses will now
have an accurate timestamp.

Also, don't emit the WFI if it's not necessary, based on the stage
flags.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:18 +00:00
Connor Abbott 6c446fe650 tu: Implement multiview clear/resolve interactions
Loads, stores, clears, and resolves now happen per-view. Since we only
support multiview with sysmem rendering, we only implement this for
sysmem clears and resolves.

There aren't any tests that mix multiview and MSAA, so no coverage of
the resolve path.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:17 +00:00
Connor Abbott 99a87e5e0e tu: Parse multiview render pass info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:17 +00:00
Connor Abbott f01a0dc27a tu: Translate VkRenderPassMultiviewCreateInfo to VkRenderPassCreateInfo2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:17 +00:00
Connor Abbott 5ef960e93c ir3: Add support for gl_ViewIndex in VS & FS
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:17 +00:00
Connor Abbott 4b163ff1eb freedreno/a6xx: Add multiview registers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>
2020-08-20 19:21:17 +00:00
Rob Clark 4de027d6bf freedreno/cffdump: add arg to filter by process name
Usueful when you have a cmdstream trace which consists of multiple
different processes.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6409>
2020-08-20 19:01:52 +00:00
Eric Anholt a27823ef2c freedreno/ir3: Fix assertion failures dumping CS high full regs.
The *2 here would bump into the *2 in regset, causing assertion failures
dumping CS programs.  Just set the mergedregs flag on a6xx, and don't
duplicate the mergedregs logic.  If you're dealing with new HW where we
don't know if mergedregs is set, you may need to tweak the flag during
disasm setup for the stats to make sense.

Fixes: f7bd3456d7 ("freedreno: deduplicate a3xx+ disasm")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6323>
2020-08-19 16:56:14 +00:00
Eric Anholt ce335dcb19 freedreno/cffdec: When .mergedregs is set, don't count half regs.
This matches what ir3.c does in the mergedregs case: just count max full
reg used.  This flag is unset so far, but will be soon and keeps our
output comparable between blob and freedreno.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6323>
2020-08-19 16:56:13 +00:00
Eric Anholt 803ec06b1b freedreno/ir3: Fix compiler warning from the setjmp fails path.
The TRY() macro doesn't call the contents if we fail to set up
setjmp/longjmp.

Fixes: 3d6e4a201a ("freedreno/decode: try harder to not crash in disasm")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6323>
2020-08-19 16:56:13 +00:00
Connor Abbott 76f711d09d tu: Use an input for the layer when lowering input attachments
Also remove a hack that's no longer needed. This should fix input
attachments with layered rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5719>
2020-08-19 16:36:43 +00:00
Connor Abbott d243bf1032 nir/lower_input_attachments: Support loading layer id as an input
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5719>
2020-08-19 16:36:43 +00:00
Connor Abbott e72895767b nir/lower_input_attachments: Refactor to use an options struct
While we're at it, fold the details of how to load the fragcoord into
load_fragcoord().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5719>
2020-08-19 16:36:43 +00:00
Rob Clark ee7949b064 freedreno/registers: SC_WAIT_WC is not a6xx
I think this is probably only a2xx, but it was masking
WRITE_PRIMITIVE_COUNTS on a6xx.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6376>
2020-08-19 14:03:42 +00:00
Roman Stratiienko 8626d4cbef android: freedreno: Another build fix
During build on Android 10, build error occurred:

'''
[ 26% 456/1718] Gen Header: libfreedreno_registers_32 <= a3xx.xml.h
FAILED: out/target/product/pinephone/gen/STATIC_LIBRARIES/libfreedreno_registers_intermediates/registers/adreno/a3xx.xml.h
/bin/bash -c "PATH=/usr/bin:\$PATH python3 external/mesa3d/src/freedreno/registers/gen_header.py external/mesa3d/src/freedreno/registers/adreno/a3xx.xml > out/target/product/pinephone/gen/STATIC_LIBRARIES/libfreedreno_registers_intermediates/registers/adreno/a3xx.xml.h"
Traceback (most recent call last):
  File "external/mesa3d/src/freedreno/registers/gen_header.py", line 470, in <module>
    main()
  File "external/mesa3d/src/freedreno/registers/gen_header.py", line 446, in main
    xml_file = sys.argv[2]
IndexError: list index out of range
'''

Align build rules with meson fixes it.

Fixes: 62ebd342 ("freedreno/registers: split header build into subdirs")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6170>
2020-08-19 11:57:17 +00:00
Hyunjun Ko e0e9712a4d freedreno: support GL_EXT_semaphore
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4565>
2020-08-18 20:40:40 +00:00
Eduardo Lima Mitev f6187aa1c3 freedreno: Enable GL_EXT_memory_object and GL_EXT_memory_object_fd
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4565>
2020-08-18 20:40:40 +00:00
Eduardo Lima Mitev 03fdf418a5 freedreno/layout: Move hard-coded minimum width for UBWC to a macro
This will also allow reuse of the value later in this series.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4565>
2020-08-18 20:40:40 +00:00
Connor Abbott 7c98066e80 freedreno: Add afuc regression test
a5xx is still TODO, but at least this is a start.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott d145fcc1c1 freedreno/afuc: Install asm/disasm
Make the name a bit longer, since when installed it's not tucked away
under afuc/ anymore.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott f0b87186df freedreno/afuc: Make 0 a valid number
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott 66dd248593 freedreno/afuc: Handle xmov modifiers
Although it's kind-of similar to "(rptN)" in the shader ISA, I called it
"xmov" to make it clear that it's completely orthogonal to "(rep)",
although you certainly can use both modifiers on the same instruction.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott b2b19234d8 freedreno/afuc: Add iret
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott a2c14ac070 freedreno/afuc: Handle setsecure opcode
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott 0acc394486 freedreno/afuc: Fix printing preemptleave on a5xx
This opcode is actually used on a5xx, but I'm not sure what it's for.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00