Commit Graph

540 Commits

Author SHA1 Message Date
Frank Binns 9b7faa7d96 pvr: fix invalid read reported by valgrind
pvr_gpu_upload() can't be used in the case of pvr_gpu_upload_usc() as it expects
the source and destination buffers to be the same size. This isn't the case
because pvr_gpu_upload_usc() adds some padding bytes to the size passed in by
the caller.

Fixes: 547a10f870 ("pvr: switch pvr_cmd_buffer_alloc_mem to use pvr_bo_suballoc")
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/23185>
2023-05-25 01:51:36 +00:00
Frank Binns 886ad3b4ec pvr: fix array overflow in pvr_device_tile_buffer_ensure_cap()
The function didn't properly handle the case where the requested capacity was
less than the existing capacity. This led to the loop limit being some huge
number and it writing past the end of the 'buffers' array.

Partially fixes:
  dEQP-VK.renderpass.suballocation.multisample_resolve.r16g16b16a16_unorm
    .max_attachments_8_samples_2

The test no longer hangs, but segfaults 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/23104>
2023-05-19 10:44:27 +00:00
Matt Coster c05dd04898 pvr: Return VkResult from winsys buffer_map operation
This allows VK_ERROR_MEMORY_MAP_FAILED to propagate correctly.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster a986aea7f7 pvr: Assorted cleanup
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster 4643319f43 pvr: Use common physical device enumeration
The PowerVR IP does not contain display hardware - this means it is
always necessary to open two separate devices for render and display.
The try_create_for_drm callback is not suitable for this configuration,
so we use the enumerate callback instead.

The previous implementation did not check that the discovered display
device was compatible with the render device - this is corrected by
unifying the compatibility lists into pvr_drm_configs.

The pvr driver is not currently supported on systems which contain
multiple compatible render or display devices, so the enumerate callback
implementation returns the first discovered render device and its
compatible display device.

This change also removes the workaround for drmGetDevices2() required
after libdrm commit 8cb12a2528. The
upstream fix has been in releases of libdrm for over a year now, and
mesa requires reasonably a recent version which is new enough to
contain it.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster 31e98d3783 pvr: Rename primary_{device,fd,path} to display_*
This makes it explicit that primary_fd is NOT just a handle to the
primary node on render_fd - rather it's a handle to the primary node
on a separate display device.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster 157499bd05 pvr: Drop pdevice from pvr_physical_device_get_supported_extensions()
This parameter doesn't make a lot of sense - it's currently unused, but
it can never be valid anyway since the return of this function is used
in the early initialization of pvr_physical_device.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster 9edac86572 pvr: Squeeze fd handling into winsys layer
This sets us up to make use of the common physical device initialization
code.

As well as lifting the fd handles out of the implementations, this
pushes creation and destruction of the fds into the winsys layer. In
order for this to make sense, the winsys object is now created *before*
each pvr_device or pvr_physical_device. If there's an error setting up
the winsys instance, there's no point in continuing to create either
one.

Also lifts alloc to the winsys layer since there's nothing special about
it in either implementation.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster 7cb945b777 pvr: Fix incorrect error handling in pvr_render_ctx_switch_init()
Partially fixes: dEQP-VK.api.device_init
  .create_instance_device_intentional_alloc_fail.basic

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster 0ae96a95ff pvr: Fix incorrect error return in pvr_ctx_sr_programs_setup()
Partially fixes: dEQP-VK.api.device_init
  .create_instance_device_intentional_alloc_fail.basic

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster c0b4359113 pvr: Propagate errors as VkResults from ioctls through winsys
Partially fixes: dEQP-VK.api.device_init
  .create_instance_device_intentional_alloc_fail.basic

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Matt Coster 438433e131 pvr: Return VkResult from pvr_winsys_create()
Previously this function simply returned NULL on any error, which
caused OOM errors to be suppressed as initialization failures.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23023>
2023-05-18 15:56:59 +00:00
Oskar Rundgren b214cf11b9 pvr: Fix transfer image clearing PBE packmodes
The PBE input format must match format in clear color registers.
Fixes image clearing for following formats:
  - B4G4R4A4_UNORM_PACK16
  - A8B8G8R8_UNORM_PACK32
  - R5G6B5_UNORM_PACK16
  - A1R5G5B5_UNORM_PACK16
  - R8G8B8A8_SNORM
  - R8G8_UNORM
  - R8G8_SNORM
  - R8_UNORM
  - R8_SNORM
  - A2B10G10R10_UINT_PACK32 - only packmode U32 supported

For some of the norm formats the clear color register format was
changed from integer (pvr_float_to_sfixed) to float (pvr_float_to_f16).
This change was done to match the default PBE emit Norm settings.
An alternative way to fix this would have been to change the PBE
Norm setting.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23082>
2023-05-18 12:25:07 +00:00
Karmjit Mahil c0d6ce4a4b pvr: Use idalloc as the allocator for sync prims
Previously we allocated the sync prim at the end of the block and
also freed from the end. This is problematic if things are freed
out of order and some new ones allocated within the frees.

This commits uses the idalloc to keep track of the sync prim block
allocations.

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/23076>
2023-05-18 12:07:22 +00:00
Karmjit Mahil fb85417433 pvr: Move pvrsrv sync prim code into new pvr_srv_sync_prim.{c,h}
Some setup for later on when we'll start keeping track of sync
prim allocation with a proper allocator.

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/23076>
2023-05-18 12:07:22 +00:00
Karmjit Mahil d1e61d563d pvr: Add pvrsrvkm sync prim set bridge call
To reuse a sync prim we'll need to set it to 0 so adding the
bridge call for 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/23076>
2023-05-18 12:07:22 +00:00
Matt Coster 9938865705 pvr: Simplify descriptor set layout dump separators
There's no need for macros here, and they make clang-format unhappy.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23028>
2023-05-18 11:49:58 +00:00
Matt Coster b793afc0ce pvr: Add PVR_DEBUG=vk_desc option to dump descriptor set layouts
Prints on every call to vkCreate{DescriptorSet,Pipeline}Layout().

Previously, this could not be turned on or off at runtime, and was
dependent on DEBUG.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23028>
2023-05-18 11:49:58 +00:00
Matt Coster c5195a67b8 pvr: Remove bad assert in pvr_clear_attachments()
Fixes: dEQP-VK.renderpass.suballocation.formats.d16_unorm.input
  .dont_care.dont_care.clear
Fixes: dEQP-VK.renderpass.suballocation.formats.d32_sfloat.input
  .dont_care.dont_care.clear

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reported-by: James Glanville <james.glanville@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23024>
2023-05-18 11:31:40 +00:00
Matt Coster ae64b47113 pvr: Return correct pbe_accum_format size for A2B10G10R10_UINT_PACK32
Fixes: dEQP-VK.renderpass.suballocation.formats.a2b10g10r10_uint_pack32
  .input.dont_care.dont_care.clear

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reported-by: James Glanville <james.glanville@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23024>
2023-05-18 11:31:40 +00:00
Matt Coster 741f51552f pvr: Set output_offset correctly in pvr_clear_color_attachment_static()
Fixes: dEQP-VK.renderpass.suballocation.formats.r16g16_sint.input
  .dont_care.dont_care.clear

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reported-by: James Glanville <james.glanville@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23024>
2023-05-18 11:31:39 +00:00
Karmjit Mahil 0960ac2a24 pvr: Use the suballocator for queries
Fixes:
  dEQP-VK.api.object_management.max_concurrent.query_pool

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23071>
2023-05-18 10:26:14 +00:00
Karmjit Mahil 2dcbeb234e pvr: Fix vk_free() in vkCreateRenderPass2() error path
There was a missing vk_free() and one at the wrong place.

Fixes:
  dEQP-VK.api.object_management.alloc_callback_fail.render_pass

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/23070>
2023-05-18 10:05:26 +00:00
Karmjit Mahil 792cf1caff pvr: Fix possible allocation of 0 size
Some tests had `input_count == 0` so the driver would attempt to
`vk_alloc()` a size of zero and error out. Add some checks to
prevent 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/23070>
2023-05-18 10:05:26 +00:00
Karmjit Mahil 5f60444b13 pvr: Fix missing invalidation of the command buffer
If the command buffer already had an error while recording, on
vkEndCommandBuffer() the command buffer wasn't being transitioned
to the invalid 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/23069>
2023-05-18 09:41:58 +00:00
Karmjit Mahil 7c382f4f6f pvr: Remove custom status in command buffer
Some code still used our custom `status` field within the command
buffer. This could lead to unreliable error handling since we're
using the common vk_command_buffer handling.

This commit removes the field and changes the error paths to use
the common code instead.

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/23069>
2023-05-18 09:41:58 +00:00
Alyssa Rosenzweig 01e9ee79f7 nir: Drop unused name from nir_ssa_dest_init
Since 624e799cc3 ("nir: Drop nir_ssa_def::name and nir_register::name"), SSA
defs don't have names, making the name argument unused. Drop it from the
signature and fix the call sites. This was done with the help of the following
Coccinelle semantic patch:

    @@
    expression A, B, C, D, E;
    @@

    -nir_ssa_dest_init(A, B, C, D, E);
    +nir_ssa_dest_init(A, B, C, D);

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23078>
2023-05-17 23:46:16 +00:00
James Glanville 4d188e005b pvr: Fix deferred_control_stream_flags
Signed-off-by: James Glanville <james.glanville@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
James Glanville fbe975e738 pvr: Fix seg fault on unused ds attachment
Fixes:
  dEQP-VK.renderpass.suballocation.formats.r16g16_sint.input
    .dont_care.dont_care.self_dep_clear

Signed-off-by: James Glanville <james.glanville@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren 2e5fb91090 pvr: Transfer image to buffer dest rect
In copy to buffer region, set dest rect to region size.
The rectangle must be block size adjusted in case of block compressed
format.

Fix test: dEQP-VK.api.copy_and_blit.core.image_to_buffer.regions

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren 9e91e06d45 pvr: Transfer optimisation remove unused features from API
The transfer command "struct pvr_transfer_cmd" has support for
features not used by Vulkan: colour key, pattern, rop blit and
alpha blending

The whole "struct pvr_transfer_blit" can be removed. Also all code
related to transfer alpha blending can be removed.

This is an optimisation and doesn't fix any dEQP tests.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren f142eae05f pvr: Transfer check valid source address mask
The mask should be inverted.

Fixes tests in dEQP-VK.api.copy_and_blit.* using the texel unwind workaround.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren 1f36901ad9 pvr: fix texel unwind workaround mappings
Fix the rectangle mappings used with texel unwind workaround (unaligned address).

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren 9d7b35bf8e pvr: Transfer remove byte unwind workaround
The byte unwind workaround can be used when source texture virtual
address doesn't meet HW requirements (is unaligned) and the pixel
format can't be changed i.e. destination is compressed. If
destination texture is not compressed the simpler texel extend
workaround can be used.

Currently byte unwind workaround has bugs so removing the
workaround fixes tests in
dEQP-VK.api.copy_and_blit.core.blit_image.simple_tests.* when they
instead use texel extend workaround.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren 7f5920ba98 pvr: Transfer support flipped rectangle mapping
The rectangles in "struct pvr_rect_mapping" are unsigned so a
flipped rectangle mapping isn't possible. Add new struct members
flip_x and flip_y to specify flipped mapping.

Add support for flipped rectangles in transfer copy blit path.
Support for flipped rectangles in the clip blit path is not done
in this change.

The new booleans are false by default because transfer command
"struct pvr_transfer_cmd" is zeroed on allocation in
pvr_transfer_cmd_alloc (pvr_blit.c).

Fixes:
  dEQP test case: dEQP-VK.api.copy_and_blit.core.blit_image.simple_tests
    .mirror_xy.nearest

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren 41fbe9fe8e pvr: Transfer block compressed with 3d twiddled layout
Block compressed formats with 3d twiddled memory layout not supported.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:26 +00:00
Oskar Rundgren 59ba5cc2d1 pvr: Transfer ignore non zero stride for twiddled surface
Twiddled surfaces don't use stride but printing info about ignored
stride is not useful on debug driver.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:25 +00:00
Oskar Rundgren 0e3c828fc4 pvr: PBE fix mesa pipe swizzle conversion
The swizzle of pipe formats is described in
"struct util_format_description". The struct has array
"unsigned char swizzle[4];". The index of the array is the colour
channel  (in the order R, G, B and A). The value is what position
the colour channel is sourced from.

In PBE register settings (REG_SWIZ_CHAN[0-3]) the register index is
output channel position (and not colour). The colours are in the PBE
source channels - SWIZ_SOURCE_CHAN0 typically red.

The function pvr_get_pbe_hw_swizzle doesn't translate the swizzle
correctly. Remove function and replace with switch for each colour.
This could be done in a for loop, but there is just as much code
in the loop, it involves pointers and it's less readable for humans.
That's why I opted for this implementation.

Fixed test:
  dEQP-VK.api.copy_and_blit.core.image_to_image
    .all_formats.color.2d.r4g4b4a4_unorm_pack16.b4g4r4a4_unorm_pack16
and other with this pixel format.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
2023-05-17 08:18:25 +00:00
Oskar Rundgren c0a3954538 pvr: Transfer add s8_uint support
Replacing pvr_get_transfer_pbe_packmode with pvr_get_pbe_packmode
fixes many depth stencil deqp tests.

Replacing assert "Handle depth stencil format swizzle." with an
actual swizzle fixes tests using S8_UINT.

The swizzle for VK_FORMAT_S8_UINT returned from
pvr_get_format_swizzle (in pvr_image_state_set_codegen_defaults)
isn't correct. Modify the swizzle for format VK_FORMAT_S8_UINT.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren b5aff65560 pvr: Transfer add depth merge support for X8_D24
Add depth merge support for VK_FORMAT_X8_D24_UNORM_PACK32 as source.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren 71ca441229 pvr: Add PBE packmode for depth stencil formats
Add PBE packmode for depth stencil formats

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren b106752782 pvr: Add back S8_UINT support
Revert "pvr: Don't advertise S8_UINT support"

Adding back support for S8_UINT format. It's used in many deqp tests.
Example:
  dEQP-VK.api.copy_and_blit.core.image_to_image.all_formats
    .depth_stencil.2d.d24_unorm_s8_uint_d24_unorm_s8_uint.optimal_optimal

This reverts commit ff07610462d5100a1ade101c1960beb4a454e7ce.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren d8bd30d9b2 pvr: Transfer multiple emits clip rectangle
Adjust PBE clip rectangle for second emit.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren 9bce479efc pvr: Transfer fix blit with multiple emits
The PBE state words for second emit are at wrong offset. Add new
define ROGUE_NUM_PBESTATE_REG_WORDS_FOR_TRANSFER to fix the offset.
The last word is always 0.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Karmjit Mahil 48bf9c736f pvr: Use original binding numbers instead of reassigning
Previously, in the descriptor set layout, if there were gaps
within the binding numbers, the code would remove the gap and
assign a sequential binding number to each.

This is causes problems when looking up the binding on a
vkUpdateDescriptorSets() as the user would still be providing the
original binding numbers. If gaps were removed and binding
number re-assigned, the binding could either not be found, or a
different binding was found instead of the desired one.

Let's not re-assign binding numbers and just use the original
ones.

This fixes the following assert being hit:
  `pvr_descriptor_set.c:1890: pvr_write_descriptor_set:
   Assertion `binding' failed.`
on dEQP tests such as:
  dEQP-VK.glsl.opaque_type_indexing.ubo.uniform_vertex
  dEQP-VK.glsl.opaque_type_indexing.ubo.uniform_fragment
  ...

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/22918>
2023-05-16 18:09:03 +00:00
Karmjit Mahil bac048e1df pvr: Add missing NULL checks in some vkDestroy...() functions
Seems like `dEQP-VK.api.null_handle.destroy_device` was already
passing but let's add the null check in case of future changes
which might not accept NULL.

Fixes:
  dEQP-VK.api.null_handle.destroy_descriptor_set_layout
  dEQP-VK.api.null_handle.destroy_pipeline_layout
  dEQP-VK.api.null_handle.destroy_query_pool

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/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren 7cb77cb089 pvr: Transfer PBE gamma is unset
PBE gamma is set in pvr_pbe_get_src_format_and_gamma but later
always set to NONE. Should be enabled for SRGB formats.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren 9fccc25bdf pvr: Transfer PBE source snorm format should be signed
Wrong shader was picked because snorm formats were treated as unsigned.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Oskar Rundgren a495cdb09e pvr: Allow block compressed source blit
Allow blit from block compressed formats to unorm and float formats.

Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22918>
2023-05-16 18:09:03 +00:00
Karmjit Mahil b59eb30e88 pvr: Fix cs corruption in pvr_pack_clear_vdm_state()
VDMCTRL_INDEX_LIST3 is packed conditionally which can cause the
generation of a corrupted control stream as the function mandated
the provided buffer to be of a fixed size always including the
possibly unpacked word. This would leave a gap in the control
stream when the caller ends up copying the buffer into the control
stream.

Reported-by: James Glanville <james.glanville@imgtec.com>
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/22918>
2023-05-16 18:09:03 +00:00