platform/upstream/mesa.git
2 years agozink: break out of zs mixed layout update loop when work is done
Mike Blumenkrantz [Tue, 7 Jun 2022 00:54:25 +0000 (20:54 -0400)]
zink: break out of zs mixed layout update loop when work is done

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16900>

2 years agointel: Build mi_builder_test whenever build-tests is set
Jordan Justen [Tue, 7 Jun 2022 06:15:27 +0000 (23:15 -0700)]
intel: Build mi_builder_test whenever build-tests is set

Previously `install-intel-gpu-tests` controlled this, but now
`install-intel-gpu-tests` will only be used to decide if it should be
installed.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16902>

2 years agolavapipe: Use vk_image_buffer_copy_layout
Jason Ekstrand [Mon, 6 Jun 2022 13:52:24 +0000 (08:52 -0500)]
lavapipe: Use vk_image_buffer_copy_layout

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agopanvk: Use vk_image_buffer_copy_layout
Jason Ekstrand [Mon, 6 Jun 2022 13:27:41 +0000 (08:27 -0500)]
panvk: Use vk_image_buffer_copy_layout

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agoradv: Use vk_image_buffer_copy_layout
Jason Ekstrand [Mon, 6 Jun 2022 13:22:12 +0000 (08:22 -0500)]
radv: Use vk_image_buffer_copy_layout

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agovulkan,radv: Steal some image offset/extent helpers from radv
Jason Ekstrand [Sun, 5 Jun 2022 04:30:21 +0000 (23:30 -0500)]
vulkan,radv: Steal some image offset/extent helpers from radv

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agoanv: Use the common image<->buffer copy helper
Jason Ekstrand [Sun, 5 Jun 2022 04:07:51 +0000 (23:07 -0500)]
anv: Use the common image<->buffer copy helper

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agovulkan: Add a helper for image<->buffer copies
Jason Ekstrand [Sun, 5 Jun 2022 04:00:51 +0000 (23:00 -0500)]
vulkan: Add a helper for image<->buffer copies

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agovulkan/format: Add a vk_format_get_aspect_format helper
Jason Ekstrand [Mon, 6 Jun 2022 16:32:43 +0000 (11:32 -0500)]
vulkan/format: Add a vk_format_get_aspect_format helper

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agovulkan,radv: Move vk_format_get_plane_format to common code
Jason Ekstrand [Mon, 6 Jun 2022 16:25:45 +0000 (11:25 -0500)]
vulkan,radv: Move vk_format_get_plane_format to common code

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agoradv: Use the common image offset/extent sanitize helpers
Jason Ekstrand [Sun, 5 Jun 2022 03:33:37 +0000 (22:33 -0500)]
radv: Use the common image offset/extent sanitize helpers

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/16873>

2 years agovulkan,anv: Move the image offset/extent sanitize helpers to common code
Jason Ekstrand [Sun, 5 Jun 2022 03:22:15 +0000 (22:22 -0500)]
vulkan,anv: Move the image offset/extent sanitize helpers to common code

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16873>

2 years agottn: Populate the images/textures/samplers_used fields in shader_info
Jason Ekstrand [Tue, 7 Jun 2022 15:59:23 +0000 (10:59 -0500)]
ttn: Populate the images/textures/samplers_used fields in shader_info

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6630
Fixes: 625b352f14b7 ("nir: Set image_buffers and msaa_images in lower_samplers_as_deref")
Tested-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16910>

2 years agod3d12: Report PIPE_CAP_ACCELERATED as 0 on WARP
Jesse Natalie [Mon, 6 Jun 2022 16:30:59 +0000 (09:30 -0700)]
d3d12: Report PIPE_CAP_ACCELERATED as 0 on WARP

Acked-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16892>

2 years agodocs: Fixes dispatch.rst with __THREAD_INITIAL_EXEC
Yonggang Luo [Sat, 9 Apr 2022 14:50:04 +0000 (22:50 +0800)]
docs: Fixes dispatch.rst with __THREAD_INITIAL_EXEC

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16858>

2 years agopvr: Remove clang-format off comment from vk_format.h
Rajnesh Kanwal [Tue, 24 May 2022 13:17:09 +0000 (14:17 +0100)]
pvr: Remove clang-format off comment from vk_format.h

This enables clang formatting for vk_format.h. This was disabled
as we were using tabs for indentation and vk_format.h uses three
spaces for indentation.

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/16897>

2 years agopvr: Move transfer logic to pvr_job_transfer.[ch]
Rajnesh Kanwal [Tue, 19 Apr 2022 16:21:16 +0000 (17:21 +0100)]
pvr: Move transfer logic to pvr_job_transfer.[ch]

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/16897>

2 years agopvr: Add services winsys transfer cmd submit interface.
Rajnesh Kanwal [Tue, 19 Apr 2022 15:36:43 +0000 (16:36 +0100)]
pvr: Add services winsys transfer cmd submit interface.

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/16897>

2 years agopvr: Change ALIGN macro to ALIGN_ATTR.
Rajnesh Kanwal [Mon, 30 May 2022 15:57:55 +0000 (16:57 +0100)]
pvr: Change ALIGN macro to ALIGN_ATTR.

ALIGN is defined as a function in u_math.h and same name is
used to define a macro in pvr_rogue_fwif_shared.h. This commit
resolves this conflict.

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/16897>

2 years agopvr: Fix UTIL_ARCH_BIG_ENDIAN check in vk_format.h.
Rajnesh Kanwal [Mon, 16 May 2022 15:53:18 +0000 (16:53 +0100)]
pvr: Fix UTIL_ARCH_BIG_ENDIAN check in vk_format.h.

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/16897>

2 years agopvr: Restrict argument to dev_info where possible.
Rajnesh Kanwal [Mon, 16 May 2022 15:37:32 +0000 (16:37 +0100)]
pvr: Restrict argument to dev_info where possible.

Avoid passing whole device structure. In most of the cases
we only need dev_info from device pointer to check for
features and ERNs.
This commits simply avoids the need to carry device pointer
where ever we go.

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/16897>

2 years agopvr: Fix ISP_RENDER_MODE_TYPE enum in rogue_cr.xml
Rajnesh Kanwal [Mon, 16 May 2022 15:29:31 +0000 (16:29 +0100)]
pvr: Fix ISP_RENDER_MODE_TYPE enum in rogue_cr.xml

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/16897>

2 years agopvr: Add transfer 3d parameter heap support.
Rajnesh Kanwal [Mon, 16 May 2022 13:52:13 +0000 (14:52 +0100)]
pvr: Add transfer 3d parameter heap support.

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/16897>

2 years agopvr: Remove vk_format_is_pure_integer and use common helper.
Rajnesh Kanwal [Mon, 16 May 2022 13:45:31 +0000 (14:45 +0100)]
pvr: Remove vk_format_is_pure_integer and use common helper.

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/16897>

2 years agopvr: Allow signal_sync pointer to be NULL in job submission.
Rajnesh Kanwal [Mon, 16 May 2022 13:28:43 +0000 (14:28 +0100)]
pvr: Allow signal_sync pointer to be NULL in job submission.

This allows the common driver to pass NULL signal_sync for cases
where there are multiple jobs (of the same type) to be processed.
In that case, it's useless to maintain the signal_syncs other than
the one returned by the last submission.

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/16897>

2 years agopvr: Add support for R32G32B32A32_UINT, R32_UINT and R8_UINT formats.
Rajnesh Kanwal [Mon, 16 May 2022 13:27:40 +0000 (14:27 +0100)]
pvr: Add support for R32G32B32A32_UINT, R32_UINT and R8_UINT formats.

These formats are required by vkCmdCopyBuffer implementation. The
formats in pvr_format_table are exposed to applications as well.
Given these formats are supported for rendering and sampling, there
shouldn't be a problem exposing these to applications.

Co-authored-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@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/16897>

2 years agopvr: Pass device info struct in pds generator.
Rajnesh Kanwal [Mon, 16 May 2022 13:26:43 +0000 (14:26 +0100)]
pvr: Pass device info struct in pds generator.

Fixes a potential NULL pointer dereference.

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/16897>

2 years agoradv: Fix the accel struct size calculation
Konstantin Seurer [Sun, 5 Jun 2022 09:12:10 +0000 (11:12 +0200)]
radv: Fix the accel struct size calculation

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16874>

2 years agoac: use ResetAllOptionOccurrences instead of ResetCommandLineParser
Rhys Perry [Fri, 3 Jun 2022 11:15:56 +0000 (12:15 +0100)]
ac: use ResetAllOptionOccurrences instead of ResetCommandLineParser

Fixes -amdgpu-atomic-optimizations=true option.

From CommandLine.h:
/// Reset all command line options to a state that looks as if they have
/// never appeared on the command line.  This is useful for being able to parse
/// a command line multiple times (especially useful for writing tests).
void ResetAllOptionOccurrences();

/// Reset the command line parser back to its initial state.  This
/// removes
/// all options, categories, and subcommands and returns the parser to a state
/// where no options are supported.
void ResetCommandLineParser();

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fixes: 7e2874dc93a ("ac: reset LLVM command line parser")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16850>

2 years agov3d: release all color buffers on context destroy
Juan A. Suarez Romero [Tue, 7 Jun 2022 06:54:34 +0000 (08:54 +0200)]
v3d: release all color buffers on context destroy

All of them must be released on context destroy, and not only the first
one.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16903>

2 years agointel: Fix build of mi_builder_tests by including c99_compat.h
Jordan Justen [Mon, 6 Jun 2022 23:14:32 +0000 (16:14 -0700)]
intel: Fix build of mi_builder_tests by including c99_compat.h

We need this so C++ will understand "restrict" which is used in the
genxml output.

Fixes: 9f717b5f23c ("util: remove needless c99_compat.h includes")
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16899>

2 years agodzn: Emit missing transition barriers for rendering attachments
Boris Brezillon [Mon, 30 May 2022 10:00:43 +0000 (03:00 -0700)]
dzn: Emit missing transition barriers for rendering attachments

VkRenderingAttachmentInitialLayoutInfoMESA provides information about
the initialLayout -> currentLayout that's expected when we begin a
render pass. Let's take it into account.

Fixes: 2d0798440b4 ("dzn: Add support for dynamic rendering")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16792>

2 years agoradv: report the marketing name as part of the device name
Samuel Pitoiset [Thu, 27 May 2021 07:03:24 +0000 (09:03 +0200)]
radv: report the marketing name as part of the device name

This now reports something like "AMD Radeon RX 5700 XT (RADV NAVI10)".

This introduces a new variable for storing the marketing name because
the existing device name is used by the shaders cache and must remain
the same to avoid any issues with precompilation.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4802
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11027>

2 years agoradv/winsys: add get_chip_name() to the null winsys
Samuel Pitoiset [Thu, 27 May 2021 09:51:25 +0000 (11:51 +0200)]
radv/winsys: add get_chip_name() to the null winsys

Make it return "Null hardware", this is just for RADV_FORCE_FAMILY.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11027>

2 years agogallium: rename PIPE_CAP_MAX_SHADER_BUFFER_SIZE -> *_UINT
Marek Olšák [Mon, 6 Jun 2022 00:55:50 +0000 (20:55 -0400)]
gallium: rename PIPE_CAP_MAX_SHADER_BUFFER_SIZE -> *_UINT

to imply the maximum of 4GB - 1.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agogallium: rename PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE->MAX_TEXEL_BUFFER_ELEMENTS_UINT
Marek Olšák [Mon, 6 Jun 2022 00:15:44 +0000 (20:15 -0400)]
gallium: rename PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE->MAX_TEXEL_BUFFER_ELEMENTS_UINT

to allow exposing 4G - 1. The "SIZE" was also a misnomer because it meant
elements. This no longer clamps the size to INT_MAX in st/mesa.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agogallium: add PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT for UBOs
Marek Olšák [Sun, 5 Jun 2022 22:56:07 +0000 (18:56 -0400)]
gallium: add PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT for UBOs

We plan to report UINT32_MAX for UBOs.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agogallium: rename PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE to *_BUFFER0_*
Marek Olšák [Sun, 5 Jun 2022 22:47:09 +0000 (18:47 -0400)]
gallium: rename PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE to *_BUFFER0_*

UBOs will use a larger limit.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agost/mesa: round down MaxUniformBlockSize to a multiple of 4 for piglit
Marek Olšák [Mon, 6 Jun 2022 04:26:35 +0000 (00:26 -0400)]
st/mesa: round down MaxUniformBlockSize to a multiple of 4 for piglit

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agost/mesa: limit MaxComputeWorkGroupCount to INT_MAX - 1 due to failing tests
Marek Olšák [Mon, 6 Jun 2022 03:16:29 +0000 (23:16 -0400)]
st/mesa: limit MaxComputeWorkGroupCount to INT_MAX - 1 due to failing tests

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agomesa: change GL_MAX_SHADER_STORAGE_BLOCK_SIZE to UINT
Marek Olšák [Sun, 5 Jun 2022 23:54:02 +0000 (19:54 -0400)]
mesa: change GL_MAX_SHADER_STORAGE_BLOCK_SIZE to UINT

so that we can report 4G - 1.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agomesa: change GL_MAX_TEXTURE_BUFFER_SIZE to UINT
Marek Olšák [Sun, 5 Jun 2022 23:54:02 +0000 (19:54 -0400)]
mesa: change GL_MAX_TEXTURE_BUFFER_SIZE to UINT

so that we can report 4G - 1.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agomesa: change GL_MAX_UNIFORM_BLOCK_SIZE to UINT
Marek Olšák [Mon, 6 Jun 2022 00:05:15 +0000 (20:05 -0400)]
mesa: change GL_MAX_UNIFORM_BLOCK_SIZE to UINT

to allow 4GB - 1.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agomesa: change GL_MAX_COMPUTE_WORK_GROUP_COUNT to UINT
Marek Olšák [Sun, 5 Jun 2022 22:34:03 +0000 (18:34 -0400)]
mesa: change GL_MAX_COMPUTE_WORK_GROUP_COUNT to UINT

AMD wants to report UINT32_MAX here.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agomesa: clamp UINT values greater than INT_MAX for glGetInteger
Marek Olšák [Sun, 5 Jun 2022 22:30:13 +0000 (18:30 -0400)]
mesa: clamp UINT values greater than INT_MAX for glGetInteger

so that values greater than INT_MAX report INT_MAX with glGetInteger and
the full value with glGetInteger64. This allows exposing compute grid sizes
and max buffer sizes greater than INT_MAX.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>

2 years agomesa/st: use util_streaming_load_memcpy for compute pbo copying
Mike Blumenkrantz [Tue, 17 May 2022 18:57:49 +0000 (14:57 -0400)]
mesa/st: use util_streaming_load_memcpy for compute pbo copying

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16732>

2 years agostreaming-memcpy: move to src/util/ and compile unconditionally
Mike Blumenkrantz [Thu, 2 Jun 2022 14:02:57 +0000 (10:02 -0400)]
streaming-memcpy: move to src/util/ and compile unconditionally

this is useful, so make it available for general use

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16732>

2 years agomesa/streaming-memcpy: add memcpy fallback
Mike Blumenkrantz [Thu, 2 Jun 2022 13:56:11 +0000 (09:56 -0400)]
mesa/streaming-memcpy: add memcpy fallback

this makes it more compatible and able to be used from the caller without ifdefs

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16732>

2 years agoci/crocus: Drop g41's xfail for rgba_half_float_oes.
Emma Anholt [Mon, 6 Jun 2022 21:49:06 +0000 (14:49 -0700)]
ci/crocus: Drop g41's xfail for rgba_half_float_oes.

Something fixed it recently, noticed when I was testing this MR and ran
manual jobs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agoglsl: Drop INT_DIV_TO_MUL_RCP lowering.
Emma Anholt [Tue, 31 May 2022 20:52:57 +0000 (13:52 -0700)]
glsl: Drop INT_DIV_TO_MUL_RCP lowering.

nir_lower_int_to_float() does this at the end of compilation, no need to
do it up front.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agolima: Lower nir_op_idiv with other scalar math operations.
Vasily Khoruzhick [Mon, 6 Jun 2022 21:43:43 +0000 (14:43 -0700)]
lima: Lower nir_op_idiv with other scalar math operations.

This will end up appearing in the backend once we move GLSL's
idiv->fmul+frcp lowering to NIR.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agonir: Fix idiv lowering on !NativeIntegers when lower_fdiv is also set.
Emma Anholt [Mon, 6 Jun 2022 18:30:51 +0000 (11:30 -0700)]
nir: Fix idiv lowering on !NativeIntegers when lower_fdiv is also set.

Avoids a regression when turning off GLSL's int div lowering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agoglsl: Drop the div-to-mul-rcp lowering for floats.
Emma Anholt [Tue, 31 May 2022 20:48:17 +0000 (13:48 -0700)]
glsl: Drop the div-to-mul-rcp lowering for floats.

NIR has fdiv, and all the NIR backends have to have lower_fdiv set
appropriately already since various passes (format conversions,
tgsi_to_nir, nir_fast_normalize(), etc.) might generate one.

This causes softpipe and llvmpipe to now do actual divides, since
lower_fdiv is not set there.  Note that llvmpipe's rcp implementation is a
divide of 1.0 by x, so now we're going to be just doing div(x, y) instead
of mul(x, div(1.0, y)).

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agotgsi_exec: Fix inf/nan handling for divide by zero.
Emma Anholt [Wed, 1 Jun 2022 19:49:59 +0000 (12:49 -0700)]
tgsi_exec: Fix inf/nan handling for divide by zero.

For RCP and for DDIV, we do division without any src1 != 0 checks, and we
should do the same here so that we get infs or nans as appropriate instead
of undefined.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agoglsl: Move exp/log-to-exp2/log2 lowering to glsl-to-NIR.
Emma Anholt [Tue, 31 May 2022 20:36:15 +0000 (13:36 -0700)]
glsl: Move exp/log-to-exp2/log2 lowering to glsl-to-NIR.

It's way more concise to write as nir_builder calls.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agoglsl: Remove stale lower_instructions comments.
Emma Anholt [Tue, 31 May 2022 20:33:14 +0000 (13:33 -0700)]
glsl: Remove stale lower_instructions comments.

Should have been in 3a42e92a4f2f ("glsl: Drop the dead MOD_TO_FLOOR path.")

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agogallium+glsl: Remove EmitNoSat/PIPE_CAP_VERTEX_SHADER_SATURATE
Emma Anholt [Tue, 31 May 2022 20:21:44 +0000 (13:21 -0700)]
gallium+glsl: Remove EmitNoSat/PIPE_CAP_VERTEX_SHADER_SATURATE

The drivers not setting it were:

- nv30, which gets lowering using NIR's lower_fsat flag.
- r300, which gets lowering using NIR's lower_fsat flag.
- a2xx, which has was getting it optimized back to fsat anyway.

This drops the check for the cap from gallium nine.  While nine does have
a non-nir path, I think it's safe to assume that if you have SM3
texturing, you can do fsat.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agonouveau/nv30: Make sure fsat is lowered in the VS.
Emma Anholt [Tue, 31 May 2022 20:18:09 +0000 (13:18 -0700)]
nouveau/nv30: Make sure fsat is lowered in the VS.

GLSL lowers fsat to clamps based on PIPE_CAP_VERTEX_SHADER_SATURATE
(EmitNoSat), but nir is happy to optimize that back to fsat unless you
tell it not to.

Noticed by inspection while looking at deleting EmitNoSat.

Fixes: ca1ec7272685 ("nv30/40: Switch to using NIR-to-TGSI by default.")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>

2 years agoradeonsi: replace llvm ls/hs interface lds ops with nir lowered ones
Qiang Yu [Mon, 9 May 2022 13:28:26 +0000 (21:28 +0800)]
radeonsi: replace llvm ls/hs interface lds ops with nir lowered ones

Use ac nir lower pass to generate these lds load/store ops explicitly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agoac/nir: Add remappability to tess and ESGS I/O lowering passes.
Timur Kristóf [Thu, 12 May 2022 13:48:24 +0000 (15:48 +0200)]
ac/nir: Add remappability to tess and ESGS I/O lowering passes.

This will be used for radeonsi to map common I/O location to fixed
slots agreed by different shader stages.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agoac/nir: skip gl_Layer/gl_ViewportIndex write for LS
Qiang Yu [Mon, 9 May 2022 13:42:47 +0000 (21:42 +0800)]
ac/nir: skip gl_Layer/gl_ViewportIndex write for LS

This is from radeonsi.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agoradeonsi: add tcs_vgpr_only_inputs parameter to si_get_nir_shader
Qiang Yu [Sun, 8 May 2022 14:10:58 +0000 (22:10 +0800)]
radeonsi: add tcs_vgpr_only_inputs parameter to si_get_nir_shader

Will be used later.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agoradeonsi: implement load_lshs_vertex_stride abi
Qiang Yu [Sat, 7 May 2022 09:54:02 +0000 (17:54 +0800)]
radeonsi: implement load_lshs_vertex_stride abi

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agoac/nir: use nir_intrinsic_load_lshs_vertex_stride_amd
Qiang Yu [Sat, 7 May 2022 09:38:04 +0000 (17:38 +0800)]
ac/nir: use nir_intrinsic_load_lshs_vertex_stride_amd

For radeonsi which pass this value by argument.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agonir: add nir_intrinsic_load_lshs_vertex_stride_amd
Qiang Yu [Sat, 7 May 2022 09:34:54 +0000 (17:34 +0800)]
nir: add nir_intrinsic_load_lshs_vertex_stride_amd

For loading LS-HS vertex stride by shader argument in radeonsi.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agoac/llvm: get back nir_intrinsic_load_tess_rel_patch_id_amd
Qiang Yu [Wed, 11 May 2022 07:11:27 +0000 (15:11 +0800)]
ac/llvm: get back nir_intrinsic_load_tess_rel_patch_id_amd

radeonsi will use it. This can be removed again after radeonsi support
radv_nir_lower_abi like lower pass.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418>

2 years agoglsl: tidy up link_varyings_and_uniforms()
Timothy Arceri [Mon, 6 Jun 2022 03:00:35 +0000 (13:00 +1000)]
glsl: tidy up link_varyings_and_uniforms()

All uniform linking is now done via nir based linker not via this
code so we drop that from its name. We also drop a bunch of unused
parameters.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16880>

2 years agoglsl: drop extra optimise swizzles call
Timothy Arceri [Mon, 6 Jun 2022 02:57:08 +0000 (12:57 +1000)]
glsl: drop extra optimise swizzles call

As per the comment this was meant to tidy things up after varying
linking but varying linking has been moved into a nir based linker
so this extra call is no longer needed.

This optimisation pass is still called in the regular glsl ir
optimisation loop.

No shader-db change on Iris (BDW).

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16880>

2 years agoturnip: Move tile loads back into the draw CS.
Emma Anholt [Tue, 17 May 2022 19:07:06 +0000 (12:07 -0700)]
turnip: Move tile loads back into the draw CS.

Now that we don't need to know if HW binning actually will get used or
not, we can just emit the tile loads into the start of the draw CS.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Allow nested CP_COND_REG_EXEC
Danylo Piliaiev [Wed, 13 Apr 2022 17:37:38 +0000 (20:37 +0300)]
turnip: Allow nested CP_COND_REG_EXEC

This ends up being needed for moving tile loads into the draw cs.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Allow load/store skipping in vkCmdClearAttachments().
Emma Anholt [Wed, 1 Jun 2022 22:01:44 +0000 (15:01 -0700)]
turnip: Allow load/store skipping in vkCmdClearAttachments().

We have to use a 3D draw to make it possible (so it goes through the
binner's visibility calcs), but hopefully the increased overhead for apps
with non-skippable rendering balances against skipping in others.

The real motivation is to get draw-time state out of tile load setup.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Refactor a bit of subpass attachment processing.
Emma Anholt [Fri, 20 May 2022 04:23:29 +0000 (21:23 -0700)]
turnip: Refactor a bit of subpass attachment processing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Include 3d-based CmdClearAttachments() in binning visibility.
Emma Anholt [Wed, 1 Jun 2022 21:11:47 +0000 (14:11 -0700)]
turnip: Include 3d-based CmdClearAttachments() in binning visibility.

It means the clear's draw can get skipped when it doesn't intersect with
the tile.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Refactor a bit of repeated code for subpass setup.
Emma Anholt [Thu, 19 May 2022 23:40:14 +0000 (16:40 -0700)]
turnip: Refactor a bit of repeated code for subpass setup.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoci/turnip: Add a little forced touch-testing of XFB with no binning requested.
Emma Anholt [Tue, 17 May 2022 17:51:19 +0000 (10:51 -0700)]
ci/turnip: Add a little forced touch-testing of XFB with no binning requested.

This is just a couple of seconds of runtime.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Use fb->binning_possible to decide on conditional tile load/stores.
Emma Anholt [Mon, 16 May 2022 20:39:04 +0000 (13:39 -0700)]
turnip: Use fb->binning_possible to decide on conditional tile load/stores.

When !fb->binning but fb->binning_possible, we can just set the VSC
per-tile visibility reg to all visible in the "whoops, we'd rather not bin
but we had to anyway for XFB" case.  This gets that EndRenderPass state out
of tile_load_cs/store_cs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Move binning decisions from FB usage time to FB creation time.
Emma Anholt [Mon, 16 May 2022 20:18:06 +0000 (13:18 -0700)]
turnip: Move binning decisions from FB usage time to FB creation time.

This is mostly about helping me understand which choices are constant for the object as opposed to runtime decisions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Refactor a bit of tu6_emit_tile_select().
Emma Anholt [Tue, 17 May 2022 21:28:47 +0000 (14:28 -0700)]
turnip: Refactor a bit of tu6_emit_tile_select().

Reduce redundant code, make the used SET_VISIBILITY_OVERRIDE value clearer.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoturnip: Don't bother creating tile_load/store_cs for sysmem rendering.
Emma Anholt [Tue, 17 May 2022 21:19:50 +0000 (14:19 -0700)]
turnip: Don't bother creating tile_load/store_cs for sysmem rendering.

They won't get called, so don't bother.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16826>

2 years agoci/i915: Update manual piglit job expectations.
Emma Anholt [Mon, 6 Jun 2022 21:46:56 +0000 (14:46 -0700)]
ci/i915: Update manual piglit job expectations.

These shaders are near the instruction count limit, and something changed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16896>

2 years agoci/i915: Merge the piglit and deqp runs.
Emma Anholt [Mon, 6 Jun 2022 19:51:14 +0000 (12:51 -0700)]
ci/i915: Merge the piglit and deqp runs.

One less button to click.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16896>

2 years agoiris:Duplicate DRM fd internally instead of reuse.
Nagappa Koppad, Basanagouda [Mon, 6 Jun 2022 09:10:06 +0000 (14:40 +0530)]
iris:Duplicate DRM fd internally instead of reuse.

Scenario we want to avoid is double close of DRM fd in iris driver.

Signed-off-by: Nagappa Koppad, Basanagouda <basanagouda.nagappa.koppad@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6620
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16886>

2 years agodocs: Document Mali-G57 conformance
Alyssa Rosenzweig [Sat, 4 Jun 2022 12:52:24 +0000 (08:52 -0400)]
docs: Document Mali-G57 conformance

Update the Panfrost driver documentation and the Mesa 22.2 release notes to
advertise the new Valhall support.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16890>

2 years agopanfrost: Enable Mali-G57
Alyssa Rosenzweig [Fri, 28 Jan 2022 17:00:37 +0000 (12:00 -0500)]
panfrost: Enable Mali-G57

Everything required for conformant OpenGL ES 3.1 support on Valhall (v9) is now
upstream -- all that's left is to enable implementations! Add the GPU ID for the
Mali-G57 implemented in the MediaTek MT8192 system-on-chip.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16890>

2 years agoaco: consider fma with multiplication by power-of-two unfused
Rhys Perry [Mon, 11 Apr 2022 16:51:42 +0000 (17:51 +0100)]
aco: consider fma with multiplication by power-of-two unfused

fossil-db (Sienna Cichlid):
Totals from 700 (0.43% of 162353) affected shaders:
MaxWaves: 18986 -> 18990 (+0.02%)
Instrs: 546475 -> 539729 (-1.23%); split: -1.24%, +0.00%
CodeSize: 2823716 -> 2808504 (-0.54%); split: -0.55%, +0.01%
VGPRs: 25304 -> 25288 (-0.06%)
Latency: 2180102 -> 2168187 (-0.55%); split: -0.55%, +0.01%
InvThroughput: 466223 -> 457326 (-1.91%)
VClause: 6768 -> 6797 (+0.43%); split: -0.01%, +0.44%
SClause: 12235 -> 12237 (+0.02%); split: -0.22%, +0.24%
Copies: 34498 -> 34479 (-0.06%); split: -0.21%, +0.15%
PreVGPRs: 20968 -> 20958 (-0.05%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15862>

2 years agomesa: enable HardwareAcceleratedSelect
Qiang Yu [Thu, 28 Apr 2022 02:26:13 +0000 (10:26 +0800)]
mesa: enable HardwareAcceleratedSelect

Could be enabled/disabled by MESA_HW_ACCEL_SELECT.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agovirgl: return -1 for PIPE_CAP_ACCELERATED
Qiang Yu [Sat, 21 May 2022 12:55:00 +0000 (20:55 +0800)]
virgl: return -1 for PIPE_CAP_ACCELERATED

There's no way currently in virgl to determine whether it's running
above CPU or GPU. This info will be used to disable HW SELECT.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agozink: reset PIPE_CAP_ACCELERATED when cpu soft rendering
Qiang Yu [Sat, 21 May 2022 07:35:39 +0000 (15:35 +0800)]
zink: reset PIPE_CAP_ACCELERATED when cpu soft rendering

This field can be used to disable some unsupport/unproper hardware
acceleration. Reset it when zink is runing on cpu rendering.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa/st: implement hardware accelerated GL_SELECT
Qiang Yu [Sat, 2 Apr 2022 09:12:20 +0000 (17:12 +0800)]
mesa/st: implement hardware accelerated GL_SELECT

Use an internal geometry shader to handle input primitives. Do full
accurate culling and clipping in the shader and output hit result and
min/max depth to a SSBO for final being written to select buffer.

With multiple result slots in SSBO we can left multiple draws on the
fly and wait them done when buffer is full or exit GL_SELECT mode.

This provides quicker selection response compared to software based
solution. Tested on Discovery Studio 2020: some complex model needs
1~2s selection response time originally, now it's almost selected
immidiately.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa: pass select result buffer offset as attribute/varying
Qiang Yu [Thu, 17 Mar 2022 03:23:22 +0000 (11:23 +0800)]
mesa: pass select result buffer offset as attribute/varying

Will be used by geometry shader to store hit result.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa: add HWSelectModeBeginEnd dispatch table
Qiang Yu [Fri, 13 May 2022 09:34:14 +0000 (17:34 +0800)]
mesa: add HWSelectModeBeginEnd dispatch table

Used when in glBegin/End section and HW GL_RENDER mode.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa: set CurrentServerDispatch too when glBegin/End
Qiang Yu [Sat, 14 May 2022 03:34:41 +0000 (11:34 +0800)]
mesa: set CurrentServerDispatch too when glBegin/End

When glthread not enabled, CurrentClientDispatch and CurrentServerDispatch
should be same. This does not cause problems before because OutsideBeginEnd
and BeginEnd have same BeginEnd entries, so when
CurrentServerDispatch==OutsideBeginEnd
CurrentClientDispatch==BeginEnd
will call into same BeginEnd _mesa_* functions.

But we'll add another dispatch table to replace BeginEnd when HW GL_SELECT
mode, so this needs to be fixed. Otherwise some function like _mesa_Rectf
which always call with CurrentServerDispatch will go into wrong entries.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomapi: add api setup header for hw select mode
Qiang Yu [Fri, 13 May 2022 13:11:47 +0000 (21:11 +0800)]
mapi: add api setup header for hw select mode

Used by GL_SELECT mode dispatch table setup.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa/vbo: enclose none-vertex functions with HW_SELECT_MODE
Qiang Yu [Fri, 13 May 2022 11:50:04 +0000 (19:50 +0800)]
mesa/vbo: enclose none-vertex functions with HW_SELECT_MODE

For constructing dispatch table used in GL_SELECT mode. Every vertex
inserted need to also insert a name stack offset attribute.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa: add hw select name stack code path
Qiang Yu [Wed, 9 Mar 2022 07:03:01 +0000 (15:03 +0800)]
mesa: add hw select name stack code path

HW code path will not flush vertex whenever name stack change.
It will save the current name stack and write to select buffer
only when no space left or exit select mode.

This let us submit multi draws from different name stack at
once instead of submit draws for a single name stack then
wait it finish before submit next one.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa: refine name stack code to prepare for hw select
Qiang Yu [Wed, 9 Mar 2022 06:33:22 +0000 (14:33 +0800)]
mesa: refine name stack code to prepare for hw select

No functional change, just pack existing software based implementation into
the HardwareAcceleratedSelect switch, will add hardware implementation in
next commit.

ctx->Select.NameStackDepth is sure to be <=MAX_NAME_STACK_DEPTH, so removed
the overflow check in _mesa_LoadName.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Sgined-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa: add _mesa_bufferobj_get_subdata
Qiang Yu [Wed, 9 Mar 2022 03:34:57 +0000 (11:34 +0800)]
mesa: add _mesa_bufferobj_get_subdata

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa: add hardware accelerated select constant
Qiang Yu [Mon, 7 Mar 2022 07:37:03 +0000 (15:37 +0800)]
mesa: add hardware accelerated select constant

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agonir/builder: add load/store array variable helper functions
Qiang Yu [Sat, 19 Mar 2022 13:05:33 +0000 (21:05 +0800)]
nir/builder: add load/store array variable helper functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>

2 years agomesa/vbo: remove unused vbo_context->binding
Qiang Yu [Mon, 14 Mar 2022 07:11:34 +0000 (15:11 +0800)]
mesa/vbo: remove unused vbo_context->binding

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>