Commit Graph

235 Commits

Author SHA1 Message Date
Rajnesh Kanwal d1eb75ecec pvr: Remove framebuffer NULL check from pvr_CmdBeginRenderPass2.
Framebuffer can not be NULL in pvr_CmdBeginRenderPass2.

Fixes: CID 1503259.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18866>
2022-09-30 10:52:51 +00:00
Rajnesh Kanwal 6cef99c536 pvr: Remove redundant assignment error.instruction.
Fixes: CID 1503256.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18866>
2022-09-30 10:52:51 +00:00
Rajnesh Kanwal 4f965ad8ee pvr: Remove redundant instruction buffer check.
Fixes: CID 1503273.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18866>
2022-09-30 10:52:51 +00:00
Rajnesh Kanwal 568b7b4635 pvr: Convert attachment indexes to unsigned.
This commit converts attachment indexes used in renderpass to unsigned
and uses VK_ATTACHMENT_UNUSED for unused attachments instead of -1.

Also fixes some signed to unsigned comparisons.

Fixed: CID 1515587, 1515590, 1515597, 1515604.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18866>
2022-09-30 10:52:51 +00:00
Rajnesh Kanwal 35c40c64c8 pvr: Handle indirect buffer address in pvr_setup_descriptor_mappings.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18872>
2022-09-30 10:55:27 +01:00
Rajnesh Kanwal faf1ac8307 pvr: implement vkcmddispatchindirect api.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18872>
2022-09-30 10:55:27 +01:00
Matt Coster b93b696356 pvr: Fix assignment to ISP back_a.sref
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <karmjit.mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18778>
2022-09-26 12:25:02 +00:00
Rajnesh Kanwal 672a1a9021 pvr: Implement vkCmdNextSubpass API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:54:18 +01:00
Rajnesh Kanwal 154ffdbd45 pvr: Pass load-op struct instead of idx to support subpass load-ops.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:54:15 +01:00
Rajnesh Kanwal f1d61d8161 pvr: Add support to create subpass load ops.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:54:10 +01:00
Rajnesh Kanwal 0756a28f2d pvr: Add attachment resolve support.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:54:07 +01:00
Rajnesh Kanwal ce5a34aadb pvr: Add const to structs that are not supposed to be modified.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:54:04 +01:00
Rajnesh Kanwal 2fc20cff4c pvr: Rename userpass_spawn to isp_userpass.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:54:01 +01:00
Rajnesh Kanwal f19697de5a pvr: Add missing output register write in pvr_CreateRenderPass2.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:53:58 +01:00
Rajnesh Kanwal 7eff950215 pvr: Use ~0 for masks instead of ~0U.
This makes code future proof in case someone changes the type
and also avoids half masks (0x00000000FFFFFFFF) in case of
64bit variables.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reported-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:53:54 +01:00
Rajnesh Kanwal 10b6a0d567 pvr: Add support for generating render pass hw setup data.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:53:52 +01:00
Rajnesh Kanwal b57cd62698 pvr: Replace pvr_renderpass_surface_initop with VkAttachmentLoadOp.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:53:48 +01:00
Rajnesh Kanwal 9f9a1ab118 pvr: General reformatting and renaming some fields.
Mainly renaming driver_id and similar fields to index to
better represent what they contain.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
2022-09-22 16:53:44 +01:00
Karmjit Mahil c4fa00f751 pvr: Add EMIT_MASK in pvr_emit_ppp_state().
This commit adds an extra check on the emitted ppp state by
adding an EMIT_MASK.
The mask is just a copy of the header at the beginning of the emit.
Each time a word is emitted the appropriate bit in the mask is
cleared and at the end we make sure that the mask is 0. If not,
we forgot the either clear a bit somewhere or emit some words.
This is intended to make it easier to find such errors.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18631>
2022-09-21 16:47:06 +00:00
Karmjit Mahil 1cfcf86da4 pvr: Add assert for texturestate being 0 in when emitting ppp state.
We assume that the texturestate size is 0 so we don't emit a state
update for pds_state_ptr2 since the hw wouldn't use it based on
the 0 size. This commit adds an assert to make sure of that.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18631>
2022-09-21 16:47:06 +00:00
Matt Coster 38a846ab5f pvr: Add pvr_csb_unpack().
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Co-Authored-By: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18631>
2022-09-21 16:47:06 +00:00
Karmjit Mahil a1c66ed5c1 pvr: Complete pvr_emit_ppp_state().
This commit appends dbsc commands to be executed in secondary
command buffers on vkCmdExecuteCommands().

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18631>
2022-09-21 16:47:06 +00:00
Karmjit Mahil ad4886cea9 pvr: Make control stream word writing stricter.
Use pvr_csb_write_value() and pvr_csb_write_struct() to have some
extra checks when writing pre-packed command/state words in
pvr_emit_ppp_state().

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18631>
2022-09-21 16:47:06 +00:00
Karmjit Mahil b5cbbdba29 pvr: Add csb helpers macros to write into raw buffer.
This commit adds two helper macros to write control stream words
into raw buffers with some extra checks.
The new macros are renamed versions of the previous CS_WRITE() and
CS_PACK_WRITE() macros.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18631>
2022-09-21 16:47:06 +00:00
Karmjit Mahil 091a117e38 pvr: Remove struct pvr_emit_state and emit header directly.
Previously `struct pvr_emit_state` was used to keep track of which
state update required emitting and the header was setup based on that.
This commit removes it so that we're instead setting up the header as
we go and we can emit it directly instead of decoding it based on the
emit_state (which is almost identical but with a few missing fields).

This commit also changes pvr_emit_ppp_state() so that each control
stream word is packed/emitted on its own instead of everything
being nested within the header pack. Making the code a bit easier
to follow.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18631>
2022-09-21 16:47:06 +00:00
Rajnesh Kanwal 75b57f44c1 pvr: Implement vkResetEvent API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18708>
2022-09-21 16:36:18 +00:00
Rajnesh Kanwal 96f5892f62 pvr: Implement vkSetEvent API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18708>
2022-09-21 16:36:18 +00:00
Rajnesh Kanwal 04dc963cd6 pvr: Implement vkCmdWaitEvents2 API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18612>
2022-09-16 13:02:30 +00:00
Rajnesh Kanwal 1c68620782 pvr: Implement vkCmdResetEvent2 API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18612>
2022-09-16 13:02:30 +00:00
Rajnesh Kanwal de1da8fa76 pvr: Implement vkCmdSetEvent2 API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18612>
2022-09-16 13:02:30 +00:00
Rajnesh Kanwal 1b94dfd4b2 pvr: Implement vkCreateEvent and vkDestroyEvent APIs.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18612>
2022-09-16 13:02:30 +00:00
Karmjit Mahil def3b88da5 pvr: Add basic skeleton for event sub cmd.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Sarah Walker <Sarah.Walker@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18612>
2022-09-16 13:02:30 +00:00
Rajnesh Kanwal 2e93833224 pvr: Fix multiple file descriptor leaks.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reported-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18594>
2022-09-14 13:08:29 +00:00
Frank Binns b97b15d762 pvr: add required pixel formats
As per section 33.3 ("Required Format Support") of the Vulkan 1.0 spec - see
tables 42 to 52.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18572>
2022-09-14 11:13:42 +00:00
Sarah Walker 4be56e5e3f pvr: Update FWIF 3d and compute register structures
This matches changes made in FW 1.17.OS@6285007.

Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18440>
2022-09-13 13:59:30 +00:00
Karmjit Mahil 24e24e9a28 pvr: Emit cs words for load op on vkCmdBeginRenderPass().
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18569>
2022-09-13 12:49:52 +00:00
Sarah Walker ad56b9644d pvr: Remove STRIP_RENDERING members from FWIF
This matches changes made in FW 1.17.OS@6256262.

Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18490>
2022-09-13 12:41:39 +00:00
Rajnesh Kanwal 222f3c8a6d pvr: Implement vkCmdDrawIndexedIndirect API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18486>
2022-09-13 12:33:13 +00:00
Rajnesh Kanwal cdf986a3e6 pvr: Implement vkCmdDrawIndirect API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18486>
2022-09-13 12:33:13 +00:00
Rajnesh Kanwal 0265a23172 pvr: Implement vkGetPhysicalDeviceImageFormatProperties2 API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18487>
2022-09-13 11:47:37 +00:00
Karmjit Mahil 460b19d393 pvr: Handle VK_CULL_MODE_FRONT_AND_BACK.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18550>
2022-09-13 09:00:17 +00:00
Karmjit Mahil 54876512a1 pvr: Add mid fragment pipeline barrier if needed.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18124>
2022-09-12 10:32:20 +01:00
Karmjit Mahil 4aedd2daa5 pvr: Implement clear ppp state emission from template.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18124>
2022-09-12 10:32:20 +01:00
Karmjit Mahil 7f39dbffd5 Revert "pvr: Make pvr_cmd_pack() macro clearly internal"
This reverts commit 27c57b8650.

The driver doesn't always pack or emit words directly. In some
cases it might be desirable to store the struct equivalent for the
control word and emit/pack at a later stage. Thus reverting to
expose pvr_cmd_pack().
One such use case is in the following commit.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18124>
2022-09-12 10:32:20 +01:00
Karmjit Mahil d8f41f8d55 pvr: Add graphics pipeline barrier handling.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18124>
2022-09-12 10:32:19 +01:00
Karmjit Mahil e91a823d15 pvr: Add static clear VDM state in pvr_device.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18124>
2022-09-12 10:32:19 +01:00
Karmjit Mahil bd02e21885 pvr: Add static clear control stream templates in pvr_device.
The templates will be used to flush fragment work at the
pipeline barrier. They will also be used in
vkCmdClearAttachments().

"pds_state" is a pointer to an array. This is done to prevent a
memcpy() patching the PDS state. Whenever the template requires
PDS state we will always be patching it so let's just pass a
pointer instead. Using a pointer here also allows to check (with a
NULL check) whether the pds state in the template was configured
prior to emitting.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18124>
2022-09-12 10:32:19 +01:00
Karmjit Mahil 4eb0991a6f pvr: Add clear program in pvr_device.
It gets used to flush fragment work for a graphics pipeline
barrier.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18124>
2022-09-12 10:32:19 +01:00
Karmjit Mahil c6a9897b76 pvr: Add depth_bias_array handling on dbenable.
On dbenable depth bias is enabled so we need to write the depth
bias data into the depth_bias_array (which gets uploaded to the
device) and also setup the depth bias index (used in the control
stream).

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18438>
2022-09-09 09:46:27 +00:00
Karmjit Mahil b36e9b6187 pvr: Remove unimplemented push descriptor code.
Push descriptors are part of VK_KHR_push_descriptor.
Not supporting it for now.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18430>
2022-09-08 11:56:43 +00:00
Frank Binns cbc477d057 pvr: finish render job sample count setup
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18437>
2022-09-08 11:25:02 +00:00
Karmjit Mahil 61d265cfce pvr: Finish setting up job resolve info.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18431>
2022-09-08 10:44:57 +00:00
Karmjit Mahil c6113def84 pvr: Set descriptor dirty flag based on other flags.
Set the flag if the descriptor set is updated.
Set the fragment descriptor dirty flag if blend consts are updated.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18429>
2022-09-08 10:36:27 +00:00
Frank Binns 80bd9ce7ee pvr: don't setup attachment tex state for images with input attachment bit unset
In this case the attachment tex state will be 0, which should make things easier
to debug.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18320>
2022-09-06 15:46:13 +01:00
Frank Binns fdf85f10a1 pvr: cube map tex state packing fixes
A VK_ERROR_FORMAT_NOT_SUPPORTED error was being returned when setting up the
image view tex state for images with the VK_IMAGE_USAGE_STORAGE_BIT and/or
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT bit(s) set due to missing handling in
pvr_pack_tex_state(). Resolve this by handling these cases, while taking the
opportunity to simplify how the tex type is determined when packing
TEXSTATE_IMAGE_WORD0.

It was also found that the depth field in TEXSTATE_IMAGE_WORD1 was being set up
incorrectly, as it was relying on the image depth being 0 for 1D and 2D images,
but the image depth will always be 1 in these cases.

Partial fix for dEQP-VK.image.qualifiers.volatile.cube.r32f. This now goes from
failing to seg faulting when VK_FORMAT_R32_SFLOAT is added to the format table,
as the test is now getting further.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18320>
2022-09-06 15:46:09 +01:00
Frank Binns 3436438dd0 pvr: set samplerAnisotropy to false
This now matches up with the value being returned for maxSamplerAnisotropy,
which is the unsupported limit of 1.

Fixes dEQP-VK.info.device_properties.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18320>
2022-09-06 15:46:05 +01:00
Rajnesh Kanwal 578361024c pvr: Fix clang-format issue.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18436>
2022-09-06 13:30:34 +00:00
Frank Binns 0013ef89bf pvr: remove image pointer from image view struct
A pointer is also stored in the base vk_image_view struct, so we can use this
one instead.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18373>
2022-09-02 09:21:54 +00:00
Jason Ekstrand 44ab076fea vulkan: Add a vk_command_buffer_ops struct
This is the standard pattern in the kernel for providing vfunc tables
for C objects.  We're using it in the pipeline cache code but we're
about to start adding more stuff and so it really helps if we have it
for command buffers as well.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Jason Ekstrand 5c143b132a vulkan: Re-order arguments to vk_command_buffer_init
Most other init functions follow the Vulkan API convention of putting
the parent object first.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18324>
2022-09-01 20:17:25 +00:00
Sarah Walker 48d07fb7d3 pvr: Update FWIF compute register structure
This matches changes made in FW 1.17.OS@6280047.

Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17680>
2022-09-01 10:01:28 +00:00
Frank Binns e5f0070b0c pvr: remove redundant TODO
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18336>
2022-09-01 09:33:29 +00:00
Jason Ekstrand 201e1ba9db pvr: Only destroy the physcial device if it exists
Without this, it segfaults on instance destruction which brings down the
Vulkan app if you have the driver installed on your system, even if you
have no PowerVR hardware.

Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18330>
2022-08-31 15:30:49 +00:00
Karmjit Mahil 6d34925967 pvr: Change indentation from tab to spaces for xml files.
This is done to match other drivers and to use spaces for
indentation throughout the whole of the powervr driver.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18319>
2022-08-31 08:26:17 +00:00
Frank Binns 7d614fa9b9 pvr: Implement vkResetCommandBuffer
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18317>
2022-08-31 08:13:05 +00:00
Frank Binns 88bed3babc pvr: reset all command buffer state in pvr_cmd_buffer_reset()
Command buffers were only being partially reset. Fix this by factoring out the
common parts of pvr_cmd_buffer_reset() and pvr_cmd_buffer_reset() into a common
function, so there's now only a single place to free command buffer state, and
zeroing out parts of the command buffer that were missed.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18317>
2022-08-31 08:13:04 +00:00
Rhys Perry aa2d6e020b Revert "nir: Drop the unused instr arg for src/dest copy functions."
This reverts commit c3a0184118.

Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>
2022-08-30 18:21:44 +00:00
Karmjit Mahil 1a250eeae3 pvr: Fix calculation in rogue_max_compute_shared_registers().
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18224>
2022-08-25 06:51:53 +00:00
Karmjit Mahil 241f42d443 pvr: Compete pvr_calc_fscommon_size_and_tiles_in_flight().
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18224>
2022-08-25 06:51:53 +00:00
Rajnesh Kanwal 74fc367127 pvr: Implement vkResetDescriptorPool API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18060>
2022-08-16 11:32:47 +00:00
Eric Engestrom fd28984f84 pvr: fix memleak in error paths
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18027>
2022-08-12 10:08:38 +00:00
Karmjit Mahil 04d192fccb pvr: Fix bo mapping on alloc with PVR_BO_ALLOC_FLAG_CPU_ACCESS.
If PVR_BO_ALLOC_FLAG_CPU_ACCESS was specified when calling
pvr_bo_alloc() the new bo was also being cpu mapped while this
was not the intention as the PVR_BO_ALLOC_FLAG_CPU_MAPPED is meant
to be used for that purpose. Fixed in this commit.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17984>
2022-08-11 09:59:05 +00:00
Frank Binns e3b7fad356 pvr: get free list min size from the runtime info
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17850>
2022-08-04 10:55:50 +00:00
Karmjit Mahil 661440717a pvr: Fix cdm shared reg usage reported to fw.
For context switching we need to keep track of the max shared regs
used and report that to the fw.

Reported-by: Rajnesh Kanwal rajnesh.kanwal@imgtec.com
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17683>
2022-07-29 11:37:06 +00:00
Karmjit Mahil e1a0432dd2 pvr: Add compute pipeline barrier handling.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17683>
2022-07-29 11:37:06 +00:00
Karmjit Mahil b92c40d40a pvr: Add IDF/WDF program for compute pipeline barrier.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17683>
2022-07-29 11:37:05 +00:00
Karmjit Mahil 6d672e0336 pvr: Add initial vkCmdPipelineBarrier skeleton.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17683>
2022-07-29 11:37:05 +00:00
Karmjit Mahil c70924b20e pvr: Add static consts to hard coding infra.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17681>
2022-07-29 11:21:08 +01:00
Karmjit Mahil a278f7d21e pvr: Add static consts support in descriptor pds program.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17681>
2022-07-29 11:21:04 +01:00
Karmjit Mahil a4830eec53 pvr: Rename uniform pds program to descriptor pds program.
The program will handle more than just DMAing uniforms so renaming
it. E.g. it will handle push constants and compile time static
constants.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17681>
2022-07-29 11:20:53 +01:00
Sarah Walker f286cab27b pvr: Move BRN 44079, 48492 and 66011 code into pvrsrvkm specific directory
The new kernel mode driver will provide the relevant information directly to
userspace, so this code is only required for pvrsrvkm.

Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17595>
2022-07-27 10:13:19 +00:00
Rajnesh Kanwal e13a450bf2 pvr: Add support for input attachment descriptor.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal b562d29196 pvr: Add support for storage and uniform texel descriptor.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal 08c867972f pvr: Add support for image descriptor.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal ecfea72c73 pvr: Add support for combined image and sampler descriptor.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal 290b9a953a pvr: Add support for sampler descriptor.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal 1bf883a8ae pvr: Move binding related checks in common code.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal f044676dbb pvr: Implement vkCreateBufferView and vkDestroyBufferView.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal 8ef42c25a6 pvr: Use common vk_buffer implementation.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Rajnesh Kanwal 405a407d42 pvr: Init and store default sampler in pvr_device.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
2022-07-25 11:57:48 +01:00
Konstantin Seurer 7c79399597 pvr: Remove format desc null check
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.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
Jason Ekstrand b510ee0d22 Use vk_foreach_struct_const where needed
We're about to make it so that the compiler warns/errors if you use the
wrong iterator macro.  Fix up a bunch of places where someone used the
wrong one before we break anything.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17630>
2022-07-19 19:55:17 +00:00
Konstantin Seurer fc26fbde3d vulkan: Common vk_format_get_component_bits
RADV and PowerVR use the same implementation.
Turnip does use a slightly modified version but the helper only has one
use -> just inline it and get rid of turnip's vk_format.h.

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17515>
2022-07-18 22:14:06 +00:00
Matt Coster 20350a73a7 pvr: Add helper macros for creating pvr_dev_addr_t instances
The two macros introduced here form a (hopefully) unobjectionable
subset of those added in !17203.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17488>
2022-07-15 10:39:21 +01:00
Matt Coster 282f0a9330 pvr: Split pvr_dev_addr_t into a separate header
This type is useful beyond the scope of winsys.

It can now be used without being lumbered with a dependency on
pvr_winsys.h. Since pvr_winsys.h is used by pvr_private.h, this can be
a common cause for circular dependencies during development.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17488>
2022-07-15 10:39:21 +01:00
Karmjit Mahil f2e2e66e42 pvr: Update pvrsrv build version for fixed size fw.
It's still 1.17 but the version is changed due to the fixed size
fw struct update.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17491>
2022-07-15 00:52:14 +00:00
Matt Coster 6165701b2e pvr: Implicitly assert that the correct sub-command type is present
Now that we have separate C types for the different sub-command types,
we can require a pointer to that type to be passed into functions
which expect the current sub-command to be of a specific type.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17458>
2022-07-13 12:30:10 +01:00
Matt Coster b9d6ed445d pvr: Split out unioned structs from struct pvr_sub_cmd
This is a simple optimization to make type-specific uses of struct
pvr_sub_cmd slightly less verbose.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17458>
2022-07-13 12:28:05 +01:00
Rajnesh Kanwal 1df16b5f22 pvr: Implement vkCmdDraw API.
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17487>
2022-07-13 10:35:10 +00:00
Eric Engestrom 9554462f4d pvr: use updated tokens from vk.xml
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342>
2022-07-12 15:53:11 +00:00