platform/upstream/mesa.git
2 years agoiris: don't create staging resources larger than half the aperture
Kenneth Graunke [Wed, 27 Apr 2022 08:15:00 +0000 (01:15 -0700)]
iris: don't create staging resources larger than half the aperture

This is a port of crocus's f1c1fcfd (crocus: don't create staging
resources > half aperture).

I chose to use the whole aperture here rather than 3/4 of it, mostly
to avoid adding another legacy field for aperture stuff.  It's close
enough to work.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2104
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

2 years agoiris: Fall back if iris_map_copy_region can't create a staging resource
Kenneth Graunke [Wed, 27 Apr 2022 08:30:18 +0000 (01:30 -0700)]
iris: Fall back if iris_map_copy_region can't create a staging resource

If we can't create a staging resource, then fall back to direct CPU
mapping (possibly with a stall).  This is a rare case, but it could
happen for very large staging buffers.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

2 years agoiris: Don't print out XXX messages if resource creation fails
Kenneth Graunke [Wed, 27 Apr 2022 08:32:47 +0000 (01:32 -0700)]
iris: Don't print out XXX messages if resource creation fails

Failing to create staging resources isn't necessarily a critical error,
and we probably don't want to be printing out XXX messages.  I mostly
had this here when bringing up the driver and resource creation was
failing because I'd done something wrong when writing the code.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

2 years agoiris: Delete unused iris_screen::aperture_bytes field
Kenneth Graunke [Wed, 27 Apr 2022 09:08:48 +0000 (02:08 -0700)]
iris: Delete unused iris_screen::aperture_bytes field

This was effectively removed in bb3545a6, but the field wasn't deleted,
leaving it there to troll people.  screen->aperture_bytes is 0?  What?

Fixes: bb3545a6ee4 ("intel: Store the aperture size in devinfo.")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

2 years agoradeonsi: use nir_opt_large_constants earlier
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 13:04:19 +0000 (15:04 +0200)]
radeonsi: use nir_opt_large_constants earlier

Calling it before nir_convert_to_lcssa helps in some cases,
because the NIR is simpler and nir_opt_large_constants can
detect that a variable is constant.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7059
CC: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>

2 years agoradv: deal with ac_nir_translate failures
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 13:02:29 +0000 (15:02 +0200)]
radv: deal with ac_nir_translate failures

Now that ac_nir_translate reports failures instead of aborting,
we need to deal with it in the driver.
For now, call abort to keep the existing behavior but this could
be improved.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>

2 years agoradeonsi: deal with ac_nir_translate failures
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 12:59:46 +0000 (14:59 +0200)]
radeonsi: deal with ac_nir_translate failures

ac_nir_translate can fail now so forward the translation result to
si_llvm_compile_shader. If it's a failure, it'll print something like:
  radeonsi: can't compile a main shader part
And the shader won't be used.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>

2 years agoac/llvm: add a return value to ac_nir_translate
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 12:58:17 +0000 (14:58 +0200)]
ac/llvm: add a return value to ac_nir_translate

Return a boolean instead of aborting when the NIR->LLVM translation fails.
This way, we can deal with the error at the calling site instead of crashing
the whole application.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>

2 years agonir: Print selection control for nir_if.
Georg Lehmann [Mon, 29 Aug 2022 15:18:56 +0000 (17:18 +0200)]
nir: Print selection control for nir_if.

It's useful to see this information now that aco is going to use it.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18297>

2 years agonv50: race free state tracking
Karol Herbst [Sun, 15 May 2022 17:20:40 +0000 (19:20 +0200)]
nv50: race free state tracking

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonvc0: make state handling race free
Karol Herbst [Thu, 17 Jun 2021 16:56:24 +0000 (18:56 +0200)]
nvc0: make state handling race free

I am not entirely convinced that contexts can't mess up the state of other
contexts, but with this we at least turn down the amount of races on the
CPU side.

If we hit bugs later we can always look into it then and figure out what
to fix how.

I think we might need a better solution for it in the future as state
tracking might need to become more involved, but for now this should be
good enough.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: make fencing race free
Karol Herbst [Wed, 30 Jun 2021 08:26:35 +0000 (10:26 +0200)]
nouveau: make fencing race free

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: per context client and pushbuf
Karol Herbst [Wed, 11 May 2022 00:32:52 +0000 (02:32 +0200)]
nouveau: per context client and pushbuf

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau/fence: per context fence
Karol Herbst [Wed, 9 Jun 2021 19:48:17 +0000 (21:48 +0200)]
nouveau/fence: per context fence

This doesn't add a fence list per pipe context, it simply makes us track
the current fence per context so we can safely modify the fence object
per thread.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonv50: remove nv50_bufctx_fence call in vbo_kick_notify
Karol Herbst [Sat, 3 Jul 2021 08:01:52 +0000 (10:01 +0200)]
nv50: remove nv50_bufctx_fence call in vbo_kick_notify

No idea why it is there. nvc0 doesn't do anything like it and it doesn't
regress any tests. Also removing is easier than handling the fence locking
inside the kick notify handler.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonv50: remove nouveau_fence_signalled prior nouveau_fence_wait
Karol Herbst [Fri, 7 May 2021 16:16:12 +0000 (18:16 +0200)]
nv50: remove nouveau_fence_signalled prior nouveau_fence_wait

nouveau_fence_wait handles signalled fences just as well.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau/fence: make the fence struct part of the fence API
Karol Herbst [Tue, 9 Feb 2021 19:32:15 +0000 (20:32 +0100)]
nouveau/fence: make the fence struct part of the fence API

This makes it easier to implement proper locking of the fence struct as we
can redesign some of the functions to take the list object instead of
fence objects.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: use PUSH_KICK instead of nouveau_pushbuf_kick
Karol Herbst [Wed, 30 Jun 2021 08:01:29 +0000 (10:01 +0200)]
nouveau: use PUSH_KICK instead of nouveau_pushbuf_kick

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: wrap nouveau_pushbuf_refn
Karol Herbst [Fri, 13 May 2022 15:36:14 +0000 (17:36 +0200)]
nouveau: wrap nouveau_pushbuf_refn

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: wrap nouveau_pushbuf_validate
Karol Herbst [Mon, 28 Jun 2021 22:37:39 +0000 (00:37 +0200)]
nouveau: wrap nouveau_pushbuf_validate

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: wrap all nouveau_pushbuf_space calls
Karol Herbst [Sat, 26 Jun 2021 08:24:45 +0000 (10:24 +0200)]
nouveau: wrap all nouveau_pushbuf_space calls

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: wrap nouveau_bo_wait
Karol Herbst [Fri, 25 Jun 2021 20:46:10 +0000 (22:46 +0200)]
nouveau: wrap nouveau_bo_wait

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: wrap nouveau_bo_map
Karol Herbst [Fri, 25 Jun 2021 20:44:26 +0000 (22:44 +0200)]
nouveau: wrap nouveau_bo_map

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: move nouveau_context initialization to common code
Karol Herbst [Thu, 10 Jun 2021 14:16:24 +0000 (16:16 +0200)]
nouveau: move nouveau_context initialization to common code

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau/fence: rework nouveau_fence_emit so we can call it on emitted fences
Karol Herbst [Fri, 7 May 2021 13:01:18 +0000 (15:01 +0200)]
nouveau/fence: rework nouveau_fence_emit so we can call it on emitted fences

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau/buffer: simplify uses of nouveau_fence_work
Karol Herbst [Fri, 7 May 2021 12:48:42 +0000 (14:48 +0200)]
nouveau/buffer: simplify uses of nouveau_fence_work

nouveau_fence_work already checks the state, so we can just call it
directly.

Strictly speaking, this isn't functional equivalent, but practically it
doesn't matter when we get the callback called.

Main reason for doing this is, that this makes locking way easier as we
can simply lock within nouveau_fence_* functions and callers don't have to
take locks themselves.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau/mm: make code thread safe
Karol Herbst [Wed, 27 Jan 2021 10:11:36 +0000 (11:11 +0100)]
nouveau/mm: make code thread safe

With this helgrind doesn't report any races in this code.

Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agonouveau: use the contexts pushbuf and client where possible
Karol Herbst [Wed, 16 Jun 2021 17:07:09 +0000 (19:07 +0200)]
nouveau: use the contexts pushbuf and client where possible

At the moment the context uses the screens object, but in order to fix
threading without having to lock too much we will have to allocate those
objects per context later.

Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

2 years agomesa/st: Drop st_texture_image_transfer::map
Nanley Chery [Mon, 22 Aug 2022 22:28:54 +0000 (15:28 -0700)]
mesa/st: Drop st_texture_image_transfer::map

It's only used in the scope of a single function, st_UnmapTextureImage. Use
a local variable instead.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

2 years agomesa/st: Fix indentation in st_MapTextureImage
Nanley Chery [Mon, 22 Aug 2022 21:36:38 +0000 (14:36 -0700)]
mesa/st: Fix indentation in st_MapTextureImage

Dedent an if-else block and setup the else braces according to the coding
style.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

2 years agomesa/st: Don't map compressed texture fallbacks for reads
Nanley Chery [Mon, 22 Aug 2022 18:56:43 +0000 (11:56 -0700)]
mesa/st: Don't map compressed texture fallbacks for reads

We don't need to map the compressed texture's fallback resource for operations
which will only read from the texture (e.g., glGetCompressedTexImage2D and
glCopyImageSubData).

For compressed textures using a fallback, delay the map until
st_UnmapTextureImage and only do the map if it's being written to.

To help identify what's being changed, the expected indentation changes are
split out into the next patch.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

2 years agomesa/st: Add and use st_texture_image_transfer::box
Nanley Chery [Mon, 22 Aug 2022 18:56:43 +0000 (11:56 -0700)]
mesa/st: Add and use st_texture_image_transfer::box

Use this field to determine which parts of the compressed texture fallback
resource needs updating. Drops a dependency on the
st_texture_image_transfer::transfer pointer.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

2 years agomesa/st: Add and use st_texture_image_insert_transfer
Nanley Chery [Mon, 22 Aug 2022 16:08:13 +0000 (09:08 -0700)]
mesa/st: Add and use st_texture_image_insert_transfer

Split out the transfer array reallocation and insertion functionality from
st_texture_image_map.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

2 years agomesa/st: Set PIPE_MAP_DISCARD_RANGE in fallback_copy_image
Nanley Chery [Wed, 24 Aug 2022 18:30:14 +0000 (11:30 -0700)]
mesa/st: Set PIPE_MAP_DISCARD_RANGE in fallback_copy_image

Enables some drivers to avoid reading from the destination when mapping it.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

2 years agov3dv: Use the common physical device enumeration
Konstantin Seurer [Sat, 20 Aug 2022 11:19:44 +0000 (13:19 +0200)]
v3dv: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

2 years agopanvk: Use the common physical device enumeration
Konstantin Seurer [Sat, 20 Aug 2022 10:59:37 +0000 (12:59 +0200)]
panvk: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

2 years agolvp: Use the common physical device enumeration
Konstantin Seurer [Wed, 17 Aug 2022 10:11:04 +0000 (12:11 +0200)]
lvp: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

2 years agoturnip: Use the common physical device enumeration
Konstantin Seurer [Wed, 17 Aug 2022 09:52:50 +0000 (11:52 +0200)]
turnip: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

2 years agoanv: Use the common physical device enumeration
Konstantin Seurer [Tue, 26 Jul 2022 09:40:03 +0000 (11:40 +0200)]
anv: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

2 years agoradv: Use the common physical device enumeration
Konstantin Seurer [Tue, 26 Jul 2022 09:16:05 +0000 (11:16 +0200)]
radv: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

2 years agovulkan: Add common physical device management
Konstantin Seurer [Tue, 26 Jul 2022 14:46:49 +0000 (16:46 +0200)]
vulkan: Add common physical device management

Add common entrypoints for enumerating physical devices, based on the RADV implementation.

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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

2 years agoradv: enable 64-bit vertex formats
Rhys Perry [Thu, 4 Aug 2022 17:08:38 +0000 (18:08 +0100)]
radv: enable 64-bit vertex formats

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6956
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoradv,aco: implement 64-bit vertex inputs
Rhys Perry [Tue, 2 Aug 2022 14:10:50 +0000 (15:10 +0100)]
radv,aco: implement 64-bit vertex inputs

Note that, from 22.4.1. Vertex Input Extraction of Vulkan spec:
The input variable in the shader must be declared as a 64-bit data type if
and only if format is a 64-bit data type.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoradv: enable R8G8B8, B8G8R8 and R16G16B16 vertex formats
Rhys Perry [Tue, 2 Aug 2022 13:40:46 +0000 (14:40 +0100)]
radv: enable R8G8B8, B8G8R8 and R16G16B16 vertex formats

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6956
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoradv: remove radv_translate_vertex_format
Rhys Perry [Wed, 3 Aug 2022 14:56:24 +0000 (15:56 +0100)]
radv: remove radv_translate_vertex_format

This is not used anymore.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoradv,aco: use pipe_format for dynamic vertex input state
Rhys Perry [Wed, 3 Aug 2022 13:38:16 +0000 (14:38 +0100)]
radv,aco: use pipe_format for dynamic vertex input state

Also prepare for 64-bit and R8G8B8/R16G16B16 with the addition of
radv_vs_input_state::nontrivial_formats.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5021
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoradv,aco: use pipe_format for static vertex input state
Rhys Perry [Fri, 29 Jul 2022 19:14:59 +0000 (20:14 +0100)]
radv,aco: use pipe_format for static vertex input state

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoradv: add radv_is_vertex_buffer_format_supported
Rhys Perry [Wed, 3 Aug 2022 17:03:28 +0000 (18:03 +0100)]
radv: add radv_is_vertex_buffer_format_supported

We will want to support formats which cannot used for texel buffers.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoac: add ac_vtx_format_info
Rhys Perry [Fri, 29 Jul 2022 18:34:47 +0000 (19:34 +0100)]
ac: add ac_vtx_format_info

This will be used by RADV and ACO.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agoutil/format,vulkan/format: update p_format for Vulkan vertex buffers
Rhys Perry [Thu, 4 Aug 2022 14:07:09 +0000 (15:07 +0100)]
util/format,vulkan/format: update p_format for Vulkan vertex buffers

We need to move some earlier (so they are <= 255 like the comment says)
and add a few 64-bit ones.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17894>

2 years agonir: use a GC context for instructions
Rhys Perry [Wed, 8 Sep 2021 14:24:10 +0000 (15:24 +0100)]
nir: use a GC context for instructions

Gives an roughly -15% change in compile-time for RADV/ACO.

Memory usage increase seems to be 5-6%.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5034
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

2 years agonir: adjust nir_src_copy signature to take a nir_instr *
Rhys Perry [Wed, 8 Sep 2021 15:41:00 +0000 (16:41 +0100)]
nir: adjust nir_src_copy signature to take a nir_instr *

This is almost always a nir_instr and updating the src of a nir_if will
have to work slightly differently in the future.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
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>

2 years agoRevert "nir: Drop the unused instr arg for src/dest copy functions."
Rhys Perry [Wed, 8 Sep 2021 10:37:07 +0000 (11:37 +0100)]
Revert "nir: Drop the unused instr arg for src/dest copy functions."

This reverts commit c3a01841184ee8303c0c5ebe58491301622c5ad6.

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>

2 years agonir/serialize: remove unused parameter from read_src()
Rhys Perry [Wed, 8 Sep 2021 14:28:53 +0000 (15:28 +0100)]
nir/serialize: remove unused parameter from read_src()

Signed-off-by: Rhys Perry <pendingchaos02@gmail.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>

2 years agoutil: add freelist allocator with mark/sweep
Rhys Perry [Wed, 8 Sep 2021 14:21:57 +0000 (15:21 +0100)]
util: add freelist allocator with mark/sweep

Based on the allocator https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/524,
but modified a bit (in particular, it's now separate from ralloc).

Signed-off-by: Rhys Perry <pendingchaos02@gmail.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>

2 years agoutil/ralloc: add HEADER_ALIGN macro
Rhys Perry [Wed, 8 Sep 2021 15:13:01 +0000 (16:13 +0100)]
util/ralloc: add HEADER_ALIGN macro

Signed-off-by: Rhys Perry <pendingchaos02@gmail.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>

2 years agonir: Free instructions more often
Connor Abbott [Tue, 19 Mar 2019 13:16:41 +0000 (14:16 +0100)]
nir: Free instructions more often

Soon we'll be allocating instructions out of a per-shader pool, which
means that if we don't free too many instructions during the main
optimization loop, the final nir_sweep() call will create holes which
can't be filled. By freeing instructions more aggressively, we can
allocate more instructions from the freelist which will reduce the final
memory usage.

Modified from Connor Abbott's original patch to rebase on top of
refactored DCE and so that the use-after-free in nir_algebraic_impl() is
fixed.

Co-authored-by: Rhys Perry <pendingchaos02@gmail.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>

2 years agogallium/u_threaded: buffer sharedness tracking
Jonathan [Wed, 13 Jul 2022 19:11:33 +0000 (21:11 +0200)]
gallium/u_threaded: buffer sharedness tracking

This fixes TC's buffer invalidation code for buffers that are shared
between contexts.

TC is unable to notify other TCs in case it replaces a shared buffer's
underlying storage when invalidating, causing those other TCs to use
wrong buffer IDs for busyness tracking, which leads to corruption due
to invalidation fast-paths being triggered when they shouldn't be.

This patch addresses this issue by tracking if a buffer is shared, and
if it is, disabling buffer storage replacement for the affected buffer.
This is achieved by tracking which TC instance first accessed a certain
buffer. If a second instance then accesses it as well, it will realize
that it isn't the only one working on the buffer and mark the buffer
accordingly.

If TC needs to invalidate a buffer for the correctness of an operation
at any point, it will fall back to doing the operation in a synchronous
fashion with this patch if the buffer is shared and currently busy.

It might be possible to later detect that a buffer has become un-shared;
however, this is outside of the scope of this bugfix patch.

v2: Do not disable buffer busyness tracking for shared buffers.

Fixes: e9c41b32 ("gallium/u_threaded: add buffer lists - tracking of buffers referenced by tc")

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17338>

2 years agogallium/u_threaded: Prepare for buffer sharedness tracking
Jonathan [Wed, 13 Jul 2022 19:00:28 +0000 (21:00 +0200)]
gallium/u_threaded: Prepare for buffer sharedness tracking

tc_add_to_buffer_list and tc_bind_buffer need the tc instance too.

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

2 years agou_atomic: Add a helper for pointer compare-exchange
Jesse Natalie [Tue, 30 Aug 2022 14:16:47 +0000 (07:16 -0700)]
u_atomic: Add a helper for pointer compare-exchange

Notably this helps with MSVC, which complains about compiling the not-taken
branches of the ternary when called with pointer args. Using a version that
doesn't have "runtime" sizeof checks eliminates the warnings.

Reviewed-by: Jonathan Strobl <jonathan.strobl@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17338>

2 years agoRevert "ci: disable the freedreno farm."
Rob Clark [Tue, 30 Aug 2022 14:59:34 +0000 (07:59 -0700)]
Revert "ci: disable the freedreno farm."

It is back again.  Hopefully it stays that way.

This reverts commit ab473a4f486146dcd474d81addc3bfcb136efd9f.

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

2 years agoaco/live_var_analysis: implement faster merging of live_out sets for some cases
Daniel Schürmann [Tue, 16 Aug 2022 22:23:36 +0000 (00:23 +0200)]
aco/live_var_analysis: implement faster merging of live_out sets for some cases

If we know that logical and linear predecessors are the same,
we don't need to check for the register type of each variable.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18105>

2 years agoaco: use std::vector::reserve() more often
Daniel Schürmann [Tue, 16 Aug 2022 22:18:54 +0000 (00:18 +0200)]
aco: use std::vector::reserve() more often

This removes the majority of vector re-allocations.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18105>

2 years agolima/ci: Make use of .lava-piglit
Christian Gmeiner [Mon, 29 Aug 2022 15:29:06 +0000 (17:29 +0200)]
lima/ci: Make use of .lava-piglit

This brings back the old CI behaviour.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18299>

2 years agogallium/u_transfer_helper: hide deinterleave helpers
Erik Faye-Lund [Tue, 9 Aug 2022 12:11:46 +0000 (14:11 +0200)]
gallium/u_transfer_helper: hide deinterleave helpers

There's no more callers of these, so let's make them an implementation
detail instead of public API.

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

2 years agozink: use full transfer-helper api
Erik Faye-Lund [Tue, 9 Aug 2022 12:11:22 +0000 (14:11 +0200)]
zink: use full transfer-helper api

This is going to make it easier to maintain u_transfer_helper in the
future.

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

2 years agogallium/u_transfer_helper: add in-place interleave flag
Erik Faye-Lund [Tue, 9 Aug 2022 12:07:03 +0000 (14:07 +0200)]
gallium/u_transfer_helper: add in-place interleave flag

This flag should allow Zink to stop using the interleave-specific API,
and instead just use the normal/full u_transfer_helper API, and start
using some more of these helpers.

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

2 years agogallium/u_transfer_helper: clean up boolean flags
Erik Faye-Lund [Tue, 9 Aug 2022 11:22:59 +0000 (13:22 +0200)]
gallium/u_transfer_helper: clean up boolean flags

Whenever we add or remove a flag here, we need to update a bunch of
drivers in a fragile way. Moving to flags here instead should make this
a bit easier to maintain in the future.

Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17959>

2 years agonir/opt_algebraic: a & ~a -> 0
Daniel Schürmann [Wed, 24 Aug 2022 16:42:09 +0000 (18:42 +0200)]
nir/opt_algebraic: a & ~a -> 0

Also re-ordered some optimizations for better readability.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18250>

2 years agoradv/ci: uprev boot2container
Martin Roukala (né Peres) [Fri, 26 Aug 2022 08:09:51 +0000 (11:09 +0300)]
radv/ci: uprev boot2container

This brings in massively-tidier logs.

Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18267>

2 years agov3dv: expose VK_KHR_maintenance4
Iago Toral Quiroga [Thu, 25 Aug 2022 07:58:00 +0000 (09:58 +0200)]
v3dv: expose VK_KHR_maintenance4

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: implement vkGetDeviceImageSparseMemoryRequirementsKHR
Iago Toral Quiroga [Thu, 25 Aug 2022 08:05:47 +0000 (10:05 +0200)]
v3dv: implement vkGetDeviceImageSparseMemoryRequirementsKHR

Added with KHR_maintenance4.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: implement vkGetDeviceBufferMemoryRequirementsKHR
Iago Toral Quiroga [Thu, 25 Aug 2022 07:56:53 +0000 (09:56 +0200)]
v3dv: implement vkGetDeviceBufferMemoryRequirementsKHR

Added with VK_KHR_maintenance4.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: add a buffer_init helper
Iago Toral Quiroga [Thu, 25 Aug 2022 07:41:06 +0000 (09:41 +0200)]
v3dv: add a buffer_init helper

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: add a get_buffer_memory_requirements helper
Iago Toral Quiroga [Thu, 25 Aug 2022 07:40:50 +0000 (09:40 +0200)]
v3dv: add a get_buffer_memory_requirements helper

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: implement vkGetDeviceImageMemoryRequirementsKHR
Iago Toral Quiroga [Thu, 25 Aug 2022 07:23:14 +0000 (09:23 +0200)]
v3dv: implement vkGetDeviceImageMemoryRequirementsKHR

Added with KHR_maintenance4.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: add a get_image_memory_requirements helper
Iago Toral Quiroga [Thu, 25 Aug 2022 07:22:46 +0000 (09:22 +0200)]
v3dv: add a get_image_memory_requirements helper

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: add a v3dv_image_init helper
Iago Toral Quiroga [Thu, 25 Aug 2022 07:01:10 +0000 (09:01 +0200)]
v3dv: add a v3dv_image_init helper

This is different from the internal create_image in that it doesn't
allocate memory for an image object, instead it expects the object
to be created and it initializes it from a VkImageCreateInfo struct.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: set maxBufferSize property
Iago Toral Quiroga [Thu, 25 Aug 2022 06:41:23 +0000 (08:41 +0200)]
v3dv: set maxBufferSize property

Included since KHR_maintenance4 and Vulkan 1.3.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: ref/unref pipeline layout objects
Iago Toral Quiroga [Thu, 25 Aug 2022 06:23:27 +0000 (08:23 +0200)]
v3dv: ref/unref pipeline layout objects

Since KHR_maintenance4 it is possible to destroy pipeline layouts
immediately after creating pipelines.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agov3dv: add a helper to destoy pipeline layouts
Iago Toral Quiroga [Thu, 25 Aug 2022 06:12:29 +0000 (08:12 +0200)]
v3dv: add a helper to destoy pipeline layouts

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

2 years agoradeonsi: use LOAD_CONTEXT_REG_INDEX for VGT_STRMOUT_DRAW_OPAQUE
Pierre-Eric Pelloux-Prayer [Thu, 18 Aug 2022 14:43:32 +0000 (16:43 +0200)]
radeonsi: use LOAD_CONTEXT_REG_INDEX for VGT_STRMOUT_DRAW_OPAQUE

Based on PAL's UniversalCmdBuffer::CmdDrawOpaque.

We don't need to use PFP_SYNC_ME because it's done in emit_cache_flush.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18129>

2 years agomesa: fall-back to fp16 for bptc-textures
Erik Faye-Lund [Wed, 24 Aug 2022 13:20:42 +0000 (15:20 +0200)]
mesa: fall-back to fp16 for bptc-textures

FP16 is way more commonly supported than FP32, and requires half the
memory bandwidth. Because the internal format of BPTC is really FP16,
let's fall back to that instead.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/main: add fp16-versions of bptc decompression functions
Erik Faye-Lund [Wed, 24 Aug 2022 13:16:37 +0000 (15:16 +0200)]
mesa/main: add fp16-versions of bptc decompression functions

These are essential copies of the float-versions, with minor
adjustments.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/main: remove always-true define
Erik Faye-Lund [Wed, 24 Aug 2022 12:41:47 +0000 (14:41 +0200)]
mesa/main: remove always-true define

We don't include this header anwhere where BPTC_BLOCK_DECODE isn't
already true, so let's remove it.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agozink: allow X32 -> A32
Erik Faye-Lund [Thu, 11 Aug 2022 10:32:16 +0000 (12:32 +0200)]
zink: allow X32 -> A32

The 32-bit per component pipe_formats are a bit different than the 8 and
16 bit formats, in that there's no UNORM or SNORM variants of them. So
let's just omit those variants.

While we're at it, update a comment that was already out-of-date anyway.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/st: enable bptc extension with fallback
Erik Faye-Lund [Wed, 10 Aug 2022 06:59:28 +0000 (08:59 +0200)]
mesa/st: enable bptc extension with fallback

This implements emulation of BPTC for all drivers that don't natively
support it in HW, similar to what we have for ETC and ASTC already. The
only significant difference is that we don't implement any transcoding
DRI-conf for it.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/st: implement fallback for bptc
Erik Faye-Lund [Wed, 10 Aug 2022 06:45:16 +0000 (08:45 +0200)]
mesa/st: implement fallback for bptc

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa: add _mesa_unpack_bptc-function
Erik Faye-Lund [Wed, 10 Aug 2022 09:16:28 +0000 (11:16 +0200)]
mesa: add _mesa_unpack_bptc-function

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa: add format-helper for bptc
Erik Faye-Lund [Wed, 10 Aug 2022 06:27:19 +0000 (08:27 +0200)]
mesa: add format-helper for bptc

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/st: add context-flag for bptc-support
Erik Faye-Lund [Wed, 10 Aug 2022 06:24:29 +0000 (08:24 +0200)]
mesa/st: add context-flag for bptc-support

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/st: do not use memcpy when using compressed fallback
Erik Faye-Lund [Thu, 11 Aug 2022 14:12:00 +0000 (16:12 +0200)]
mesa/st: do not use memcpy when using compressed fallback

If we're using the memcpy-path, we don't update the compressed image,
which will be needed if an application try to download the texture-image
again afterwards.

This isn't a problem yet, because none of the current compressed formats
with fallback are copyable as per the OpenGL 4.6 Core spec, table 8.14.
However, this is about to change, when we introduce fallback for BPTC
formats.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/st: avoid double-mapping if both images are the same
Erik Faye-Lund [Thu, 11 Aug 2022 09:07:52 +0000 (11:07 +0200)]
mesa/st: avoid double-mapping if both images are the same

If both src_image and dst_image are pointing to the same image, we'll
end up double mapping the image, which throws an assert in
st_texture_image_map.

So let's check if these images are the same, and avoid the extra mapping
in that case.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/st: simplify st_compressed_format_fallback
Erik Faye-Lund [Wed, 10 Aug 2022 11:06:57 +0000 (13:06 +0200)]
mesa/st: simplify st_compressed_format_fallback

By looking at the format-layout, we can do switch-cases here instead of
serial calls to _mesa_is_format_foo(). This isn't a huge deal yet, but
this function is going to learn about a lot more formats soon...

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/main: simplify implementation of _mesa_is_format_astc_2d
Erik Faye-Lund [Wed, 10 Aug 2022 10:29:07 +0000 (12:29 +0200)]
mesa/main: simplify implementation of _mesa_is_format_astc_2d

Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agomesa/main: simplify implmementation of _mesa_is_format_etc2
Erik Faye-Lund [Wed, 10 Aug 2022 10:26:49 +0000 (12:26 +0200)]
mesa/main: simplify implmementation of _mesa_is_format_etc2

Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

2 years agovenus: Document VK_EXT_texture_compression_astc_hdr support
Chad Versace [Wed, 24 Aug 2022 23:49:11 +0000 (16:49 -0700)]
venus: Document VK_EXT_texture_compression_astc_hdr support

Signed-off-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18000>

2 years agovenus: Enable VK_EXT_tooling_info
Chad Versace [Thu, 11 Aug 2022 00:49:46 +0000 (17:49 -0700)]
venus: Enable VK_EXT_tooling_info

Implement it locally with the common implementation.

Signed-off-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18000>

2 years agovenus: Enable VK_EXT_private_data
Chad Versace [Thu, 11 Aug 2022 00:03:07 +0000 (17:03 -0700)]
venus: Enable VK_EXT_private_data

Implement it as hybrid native/passthrough as a workaround until venus
learns how to deep surgery on pNext chains. Eventually, we want to
implement it purely natively. For details, see the big code comment.

See: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/908
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Signed-off-by: Chad Versace <chadversary@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18000>

2 years agovenus: Enable VK_KHR_format_feature_flags2
Chad Versace [Thu, 11 Aug 2022 01:43:02 +0000 (18:43 -0700)]
venus: Enable VK_KHR_format_feature_flags2

Signed-off-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18000>