Commit Graph

2106 Commits

Author SHA1 Message Date
Alejandro Piñeiro 106b33405e vc4/v3d: stop adding NORAST when SHADERDB debug option is used
Right now if we use the option SHADERDB, NORAST is added
automatically. There's no comment justifying it, neither a lot of info
on the commits that added that. But I guess that the purpose is that
SHADERDB option is assumed to be used only to gather shader-db stats,
so setting setting NORAST would allow to get those dumps faster.

But adding debug options automatically can be confusing, as we could
get a behaviour that we were not expecting. At least I needed to check
why using SHADERDB was getting a black screen. And if we want to get
this behaviour, we can easily add manually the NORAST.

Finally, v3dv doesn't support NORAST right now (and we don't have
immediate plans to implement it), so it is somewhat inconsistent to
get different behaviour from the same debug option from the two
drivers.

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17788>
2022-07-29 18:29:34 +00:00
Iago Toral Quiroga 97708505d7 v3dv: expose Vulkan 1.2
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17786>
2022-07-28 11:18:57 +00:00
Iago Toral Quiroga 46d43b1ca1 broadcom/ci: update list of slow tests
These showed up in some runs for me.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17786>
2022-07-28 11:18:57 +00:00
Iago Toral Quiroga 15bf6d08c5 v3dv: enable missing mandatory Vulkan 1.2 features
For some reason the Vulkan spec required that these features must be
supported even though they only affect features that are optional
in Vulkan 1.2 and that we don't support, so enabling them doesn't
have any practical implications for us.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17786>
2022-07-28 11:18:57 +00:00
Iago Toral Quiroga 6a48d38196 v3dv: enable missing Vulkan 1.2 features for supported extensions
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17786>
2022-07-28 11:18:57 +00:00
Iago Toral Quiroga 366534768a v3dv: fill in Vulkan 1.2 missing device properties
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17786>
2022-07-28 11:18:57 +00:00
Iago Toral Quiroga efb17fc4f1 v3dv: explicitly set sampler min/max filter properties to false
Our hardware doesn't support min/max filtering.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17786>
2022-07-28 11:18:57 +00:00
Iago Toral Quiroga 903a75245b v3dv: only check binning sync for semaphores for the first CL job
Semaphore waits in a command buffer only affect the first jobs we execute
in each hardware queue since jobs in the same queue are serialized against
each other. Binning syncs in particular, only affect CL jobs.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17594>
2022-07-27 00:00:54 +00:00
Iago Toral Quiroga 2ca4a51679 v3d,v3dv: add a common v3d_hw_prim_type helper
We had this replicated in both drivers.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17594>
2022-07-27 00:00:54 +00:00
Iago Toral Quiroga e812cbe847 v3dv: remove unnecesary FIXME comment
We only want to cleant BCL barrier flags if we consume a BCL barrier.
For example, if the client records a barrier for an index buffer
it should apply to the next draw call that uses an index buffer
which may not be the current draw call but one coming after it.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17594>
2022-07-27 00:00:54 +00:00
Emma Anholt f6c5b1d6c6 nir: Split usub_sat lowering flag from uadd_sat.
Intel vec4 would like to do uadd_sat, but use lowering for usub_sat.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17637>
2022-07-22 17:54:28 +00:00
Jason Ekstrand 87ab287436 vulkan: Call lower_clip_cull_distance_arrays in vk_spirv_to_nir
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17644>
2022-07-21 21:18:48 +00:00
Konstantin Seurer 61dfccae79 v3dv: Remove format desc null asserts
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17490>
2022-07-21 12:48:01 +00:00
Juan A. Suarez Romero 7131a05f92 v3d/ci: update expected list
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17660>
2022-07-20 18:37:26 +00:00
Alejandro Piñeiro efc827ceea v3d/v3dv: use NIR_PASS(_
Instead of NIR_PASS_V, when possible.

This was done recently on anv (see commit ce60195ec and MR#17014)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:25 +00:00
Alejandro Piñeiro 0a50330c3d broadcom/compiler: make several passes to return a progress
Two advantages:
   * When using NIR_DEBUG=nir_print_xx, will print outcome only if
     there is a change
   * We can use NIR_PASS(_, ...) instead of NIR_PASS_V, that has
     slightly more validation checks.

This includes:
  * v3d_nir_lower_image_load_store
  * v3d_nir_lower_io
  * v3d_nir_lower_line_smooth
  * v3d_nir_lower_load_store_bitsize
  * v3d_nir_lower_robust_buffer_access
  * v3d_nir_lower_scratch
  * v3d_nir_lower_txf_ms

As we are here we also simplify some of them by using the
nir_shader_instructions_pass helper.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:25 +00:00
Alejandro Piñeiro 81ca0b4191 broadcom/compiler: removed unused function
It is not even implemented.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:25 +00:00
Alejandro Piñeiro 22022dfa04 v3dv/pipeline: use nir_shader_instructions_pass when lowering layout
The trigger for this commit was when we found that we were not calling
nir_metadata_preserve when lowering the layout code. But then I found
that it would be better to just update the code to use
nir_shader_instructions_pass, so we can avoid to manually:
   * Initialize the nir_builder
   * Call nir_foreach functions (we pass the callback)
   * Call nir_metadata_preserve functions (that as mentioned we were not calling)

We also get a nice cleanup of several functions by reducing the number
of parameters (we pass a state struct).

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:24 +00:00
Alejandro Piñeiro d8fee4cdaa broadcom/compiler: use NIR_PASS for nir_lower_vars_to_ssa at v3d_optimize_nir
There's no reason to not take into account progress at that point.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:24 +00:00
Alejandro Piñeiro dea0fe8a06 broadcom/compiler: wrap nir_convert_to_lcssa with NIR_PASS_V
So we get it included with the NIR_DEBUG=print_xx debug options.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:24 +00:00
Alejandro Piñeiro 72cc268858 broadcom: document which debug options are specific for a given driver
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:24 +00:00
Alejandro Piñeiro e4d7c3b179 broadcom: add no_merge_jobs debug option
To avoid having a custom getenv on v3dv.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:24 +00:00
Alejandro Piñeiro bdf23805ab v3dv/device: add comment on depthClamp feature
As we can't support it, and I need to recheck now and then when I read
that code.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>
2022-07-20 11:35:24 +00:00
Iago Toral Quiroga b54544852c v3dv: fix offset reported by vkGetImageSubresourceLayout
This represents an offset from the actual start of the image data,
not from the start of the memory allocation bound to the image.

Fixes:
dEQP-VK.image.subresource_layout.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17648>
2022-07-20 10:33:57 +00:00
Iago Toral Quiroga d2d2fdf934 v3dv: remove assert that poolSizeCount must be larger than 0
From the Vulkan spec:

   "If poolSizeCount is not 0, pPoolSizes must be a valid pointer to an
    array of poolSizeCount valid VkDescriptorPoolSize structures"

So 0 is actually allowed and there is a CTS to check it is handled gracefully.

Fixes:
dEQP-VK.api.descriptor_pool.zero_pool_size_count

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17648>
2022-07-20 10:33:57 +00:00
Iago Toral Quiroga 19ef41b181 v3dv: handle VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17616>
2022-07-20 10:05:59 +00:00
Juan A. Suarez Romero 95fe540139 v3d/ci: (partially) revert expected list
This reverts the traces expected list changed in f3579a62e9
("v3d/v3dv/ci: update expected results").

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17647>
2022-07-20 09:37:43 +02:00
Juan A. Suarez Romero f3579a62e9 v3d/v3dv/ci: update expected results
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17632>
2022-07-19 17:26:52 +00:00
Konstantin Seurer d316d24d74 v3dv: Use nir_gen_rect_vertices
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17535>
2022-07-19 12:47:31 +00:00
Iago Toral Quiroga bec3c83e19 v3dv: implement VK_KHR_buffer_device_address
This feature allows shaders to use pointers to buffers which may
not be bound via descriptor sets. Access to these buffers is done
via global intrinsics.

Because the buffers are not accessed through descriptor sets, any
live buffer flagged with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR
can be accessed by any shader using global intrinsics, so the driver
needs to make sure all these buffers are mapped by the kernel when
it submits the job for execution.

We handle this by tracking if any draw call or compute dispatch in
a job uses a pipeline that has any such shaders. If so, the job is
flagged as using buffer device address and the kernel submission
for that job will add all live BOs bound to buffers flagged with the
buffer device address usage flag.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17275>
2022-07-19 09:47:34 +02:00
Iago Toral Quiroga 90054e9c5d broadcom/compiler: track if a shader uses global intrinsics
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17275>
2022-07-19 09:47:34 +02:00
Iago Toral Quiroga fa03d9c8be broadcom/compiler: implement 2x32 global intrinsics
Notice we ignore the high 32-bit component of the address because
we know it must be 0.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17275>
2022-07-19 09:47:34 +02:00
Iago Toral Quiroga ea3acbef8d v3dv: remove duplicate condition
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga 706f1252ba v3dv: explain why we clear certain state after a draw call
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga 702b685b07 v3dv: add a dirty state for pending push constants UBO updates
If we have 2 pipelines that consume the same push constant data
but where one of them only uses direct access and the other has
indirect access, a draw with the first pipeline would clear the
dirty flag without updating the UBO and by the time we bind and
draw with the second pipeline we won't upload the constants either
because the first draw cleared the dirty flag.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga 3898bf6971 v3dv: allocate more push constant buffers if needed
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga e451c612df v3dv: stop tracking push constant buffer references
Since we allocate this ourselves we can immediately add it to the
job at the time we allocate it.

This also fixes a bug we introduced when we implemented inline
uniforms because since that commit, if we had an inline uniform
buffer at index 1 which happend to have indirect access we would
track it in slot 0 instead of slot 1, potentially overwriting
the push constant buffer reference.

Fixes: ea3223e7a4 ('v3dv: implement VK_EXT_inline_uniform_block')
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga 45b8dc667a v3dv: don't allocate MAX_PUSH_CONSTANTS_SIZE bytes for the push constants UBO
We have code in there to allocate various segments of MAX_PUSH_CONSTANTS_SIZE
to handle the case of various draw calls in the same command buffer requiring
different push constants, so we are implicitly expecting it to be larger than
this. In fact, this only works now because when we allocate a BO we are always
at least allocating a full page, so the least we ever allocate is 4096 bytes,
so be explicit about it to avoid confusion.

Also, since we were always mapping MAX_PUSH_CONSTANTS_SIZE and the mapping
always starts at the beginning of the BO, it looks like after the first copy
when the resource offset is not zero, we would be writing outside the mapped
range. Always map the full size of the BO instead to ensure this doesn't
happen.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga 51a45f9315 v3dv: limit upload of indirect push constant data
We have been always uploading MAX_PUSH_CONSTANTS_SIZE but now that
we track the actual size of the push constant buffer we can use
this instead.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga 005542f0e3 v3dv: move push constant data to the command buffer state
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Iago Toral Quiroga 41a0c89d9f v3dv: only save/restore push constant data for meta operations if needed
If the command buffer didn't have any push constants or the meta
operation didn't write any new constants we don't need to restore
the state.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
2022-07-19 05:46:04 +00:00
Adam Jackson 768238fdc0 glx: Fix drawable refcounting for naked Windows
driFetchDrawable is only ever called from the MakeCurrent path, which
means it has to handle the case of pre-GLX-1.3 Windows being named as
the drawable. When it finds the drawable in the hash, it increments its
refcount before returning it, so for a GLXWindow it would be 2 on first
return, one from glXCreateWindow and one from glXMakeCurrent. But when
it does not find the drawable and creates one for the naked Window, the
reference count on first return would only be 1. As a result, if this
context was then ever bound to a different drawable, the old Window's
DRI drawable state (like the back buffer) would be destroyed.

Fixes piglit's glx-multi-window-single-context and glx-make-current for
a variety of drivers.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6713
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17479>
2022-07-13 12:25:30 -04:00
Iago Toral Quiroga 40976356f2 v3d,v3dv: stop copying and pasting the translate_swizzle helper
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17509>
2022-07-13 10:09:34 +00:00
Iago Toral Quiroga 8d8491df5e v3d: stop using a smaller texture limit in OpenGL
The compiler has improved significantly since we found this issue
and this is no longer required.

Notice that because we are increasing the number of samplers
supported beyond what we can loop unroll (currently capped at 16),
some piglit tests that test the maximum number of samplers supported
start to fail because they use indirect indexing on a sampler array
and we don't support that (previously the indirect indexing was
removed by loop unrolling). This is a bug in tests which the
GLSL linker detects, failing to compile the shaders.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17509>
2022-07-13 10:09:34 +00:00
Iago Toral Quiroga 9b74f4218f v3d,v3dv: stop hardcoding various image limits
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17509>
2022-07-13 10:09:34 +00:00
Iago Toral Quiroga 25fc388d7e v3dv: clean up get_internal_type_bpp_for_image_aspects
Also, remove the FIXME to pre-compute this in images. We only use
this helper from copy/clear operations where we may be working
with a compatible framebuffer format instead of the original image.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17509>
2022-07-13 10:09:34 +00:00
Iago Toral Quiroga 1442861141 v3dv: fix comment for point_sprite_mask filed in shader key
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17486>
2022-07-13 05:20:31 +00:00
Emma Anholt 7976d558d5 vc4: Add links to test bug reports.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17449>
2022-07-12 17:15:43 +00:00
Emma Anholt 2f851f0479 vc4: Work around a HW bug with 2-vert line loops.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17449>
2022-07-12 17:15:43 +00:00
Emma Anholt 0f37e3c339 mesa: Fix the error check for VertexAttrib*.
It was checking "mesa's theoretical max attributes" rather than "the
driver's max attributes."

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17449>
2022-07-12 17:15:43 +00:00