Commit Graph

46002 Commits

Author SHA1 Message Date
Marek Olšák 1a2dde8f86 radeonsi: add internal blitter_running flag
to skip the indirection in si_decompress_textures

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>
2021-01-22 16:45:30 +00:00
Marek Olšák 5fabeb49d8 radeonsi: don't use rasterizer_discard to validate draws, only check ps_shader
Let's just say that PS can never be NULL here.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>
2021-01-22 16:45:30 +00:00
Marek Olšák cd42ed34b0 radeonsi: optimize translating index_size to index_type
gcc generated a lookup table for the switch. This replaces it with
arithmetics.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>
2021-01-22 16:45:30 +00:00
Marek Olšák 28e419f001 radeonsi: don't mark NULL states as dirty in si_pm4_reset_emitted
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>
2021-01-22 16:45:30 +00:00
Marek Olšák 488cd3b93f radeonsi: clear dirty_states if si_pm4_bind_state is unbinding or no-op
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>
2021-01-22 16:45:30 +00:00
Marek Olšák a0978fffb8 radeonsi: add new possibly faster command submission helpers
This decreases the release libgallium_dri.so size without debug symbols
by 16384 bytes. The CPU time spent in si_emit_draw_packets decreased
from 4.5% to 4.1% in viewperf13/catia/plane01.

The previous code did:
    cs->current.buf[cs->current.cdw++] = ...;
    cs->current.buf[cs->current.cdw++] = ...;
    cs->current.buf[cs->current.cdw++] = ...;
    cs->current.buf[cs->current.cdw++] = ...;

The new code does:
    unsigned num = cs->current.cdw;
    uint32_t *buf = cs->current.buf;
    buf[num++] = ...;
    buf[num++] = ...;
    buf[num++] = ...;
    buf[num++] = ...;
    cs->current.cdw = num;

The code is the same (radeon_emit is redefined as a macro) except that
all set and emit functions must be surrounded by radeon_begin(cs) and
radeon_end().

radeon_packets_added() returns whether there has been any new packets added
since radeon_begin.

radeon_end_update_context_roll(sctx) sets sctx->context_roll = true
if there has been any new packets added since radeon_begin.

For now, the "cs" parameter is intentionally unused in radeon_emit and
radeon_emit_array.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>
2021-01-22 16:45:29 +00:00
Erik Faye-Lund 45bebc7a9c zink: respect fragment-shader depth-layout
This is required by GLSL 1.30 and later, so we should also respect the
setting.

Fixes: 6785d8c460 ("zink: expose GLSL 1.30")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8644>
2021-01-22 15:46:49 +00:00
Erik Faye-Lund 855370bb62 zink: make all xfb caps depend on extension
Without this, we'll expose GL_ARB_transform_feedback2 and
GL_ARB_transform_feedback3 even without VK_EXT_transform_feedback,
because these caps are directly wired up without checking the pervious
extensions.

Fixes: e8ad52f7b0 ("zink: enable xfb extension in screen creation")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 8c7d971666 zink: require vulkan memory model for tesselation
We enable the KHR_vulkan_memory_model extension whenever we use
tesselation, so right now this is a defacto requirement. So let's make
this requirement explicit.

Fixes: f815b87e18 ("zink: export tess shader pipe caps")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund f95c174927 zink: check for extension instead of function
This shouldn't change any behavior, it just seems a bit more to the
point to check for the extension that decides if these are NULL or not
than to check both of them.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund c9340744a3 zink: respect feature-cap for multi-draw indirect
Even in the presence of VK_KHR_draw_indirect_count, we still technically
need to respect the feature-cap when using a Vk 1.0 core-function.

Fixes: cef876910a ("zink: enable PIPE_CAP_MULTI_DRAW_INDIRECT(_PARAMS) caps")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 6f6941e2dd zink: respect feature-cap for sample-shading
Vulkan has a cap to enable this, we should check that one rather than
always claiming support.

Fixes: 0c70268ff7 ("zink: mark ARB_sample_shading as supported")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 612169859a zink: respect feature-cap for independent blending
Vulkan has a cap to enable this, we should check that one rather than
always claiming support.

Fixes: 8d46e35d16 ("zink: introduce opengl over vulkan")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 831d205513 zink: respect feature-cap for robust buffer access
Vulkan has a cap to enable this, we should check that one rather than
always claiming support.

Fixes: 61720098fa ("zink: set PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund b35e11ef95 zink: always expose linear float textures
This is not an optional feature in Vulkan, so we can rely on this being
supported. This has the nice benefit of enabling OpenGL ES 3.0 support
on ANV.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Boyuan Zhang 27209e63ea frontend/va/image: add pipe flush for vlVaPutImage
To fix synchronization issue between multimedia queue and gfx queue.
Adding flush call will let multimedia queue to wait for the content of gfx
command buffer to be executed, for the case where there is dependency
between these two queues.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8567>
2021-01-22 15:03:38 +00:00
Víctor Manuel Jáquez Leal 925d701014 frontends/va/context: don't set max_references with num_render_targets
For HEVC and VP9 template's max_references are tied to the number of
surfaces associated with context. Later, the decoder is created if
max_references is different to zero.

But vaCreateContext() doesn't really need an array of VASurfaceIDs (see
https://lists.01.org/pipermail/intel-vaapi-media/2017-July/000052.html and
https://github.com/intel/libva/issues/251).

This patch removes the validation of the max_references at decoder
creation and also remove the assignation of num_render_targets to
max_references.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7949>
2021-01-22 14:59:53 +01:00
Icecream95 f55649d20b panfrost: Add support for INTEL_blackhole_render
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8607>
2021-01-22 06:31:02 +00:00
Mike Blumenkrantz 96d7555770 zink: support PIPE_FORMAT_X24S8_UINT
enables ARB_texture_view

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8630>
2021-01-21 22:03:49 -05:00
Mike Blumenkrantz 264a5b1d15 zink: add layout member to barrier setup in draw
this lets us track different layouts

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8630>
2021-01-21 21:40:41 -05:00
Mike Blumenkrantz 09182d9ae8 zink: support VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL usage
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8630>
2021-01-21 21:40:41 -05:00
Hoe Hao Cheng fa86272547 zink: expose PIPE_CAP_ANISOTROPIC_FILTER
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Tested-by: Fabio Pedretti <fabio.ped@libero.it>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8617>
2021-01-22 01:30:50 +00:00
Kenneth Graunke 0f9f625089 iris: Refactor iris_debug_recompile interface to take a shader.
This simplifies each call site slightly and will save some interface
churn in the next rework.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8634>
2021-01-22 00:20:27 +00:00
Kenneth Graunke 4423903089 iris: Drop iris_print_program_cache().
I have never used this to debug anything in iris, and it's been years
since I even thought about using i965's similar functionality.  I'm
planning to move a bunch of shaders out of the global hash table, at
which point it'll be much less useful.  So, just drop it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8634>
2021-01-22 00:20:27 +00:00
Kenneth Graunke 5e2c799d0e iris: Drop find_existing_assembly optimization from program cache
This tried to de-duplicate identical copies of the same shader
assembly, but in the least efficient way possible: it did a linear
walk through every shader in the entire context memcmp'ing the
final assembly (after going through the effort to compile it).
In the end, all it saved was space and number of BOs, not even
state changes.

This optimization has been mostly replaced by st/mesa's cache
mechanism, which looks for multiple shaders that compile to the
same NIR and go further than this did, and actually reuse the
same pipe shader state.  That's even more efficient than this.

This seems to still trigger some times, because the NIR that
st/mesa hashes hasn't quite been finalized and stripped.  But
it would be better to improve that, not this.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8634>
2021-01-22 00:20:27 +00:00
Mike Blumenkrantz 61720098fa zink: set PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8631>
2021-01-21 23:14:31 +00:00
Mike Blumenkrantz bcc8222277 zink: set PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8631>
2021-01-21 23:14:31 +00:00
Mike Blumenkrantz 0ab9114abd zink: force per-sample interpolation
this gives us new rasterizer states when multisample stuff changes instead
of new fs states, which is what we want since these correlate to pipeline
flags, not shader-specific things

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8631>
2021-01-21 23:14:31 +00:00
Kenneth Graunke e2500c02cc iris: Consider resolves after changing a resource's aux state
The intention of IRIS_DIRTY_{RENDER,COMPUTE}_RESOLVES_AND_FLUSHES
is to avoid considering resolves/flushes on back to back draw calls
where nothing of significance has changed with the resources.  When
anything changes that could require a resolve, we must flag those.

Those situations are:
1. Texture/image/framebuffer bindings change
   (as the set of images we need to look at is now different)
2. Depth writes are enabled/disabled (the resolve code uses this)
3. The aux state for a currently bound resource changes.

We were missing this last case.  In particular, one example where
we missed this was:

1. Bind a texture.
2. Clear that texture (likely blits/copies/teximage would work too)
3. Draw and sample from that texture

Clear-then-Bind would work, as binding would flag resolves as dirty.
But Bind-then-Clear doesn't work, as clear can change the aux state
of the bound texture, but wasn't flagging that anything had changed.

Technically, we could consider whether the resource whose aux state
is changing is bound for compute (and only flag COMPUTE_RESOLVES),
or bound for a 3D stage (and only flag RENDER_RESOLVES), and flag
nothing at all if it isn't bound.  But we don't track that well,
and it probably isn't worth bothering.  So, flag unconditionally
for now.

This does not appear to impact Piglit's drawoverhead scores.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3994
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4019
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8603>
2021-01-21 22:58:08 +00:00
Mike Blumenkrantz 64f55b82c7 zink: set PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS
ARB_copy_image is already supported

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8625>
2021-01-21 22:29:54 +00:00
Marek Olšák b4f3497786 mesa: remove STATE_INTERNAL
Let's flatten the tokens to generate optimal code for fetch_state.

There was only one name conflict: STATE_NORMAL_SCALE was used both as
internal and non-internal.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183>
2021-01-21 21:59:29 +00:00
Mike Blumenkrantz 099ce1aacc zink: GLSL 420
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8620>
2021-01-21 21:19:12 +00:00
Vinson Lee f14836574a nv50/ir: Initialize CodeEmitter members in constructor.
Fix defects reported by Coverity Scan.

uninit_member: Non-static class member code is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member codeSize is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member codeSizeLimit is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member relocInfo is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8569>
2021-01-21 13:09:22 -08:00
Ilia Mirkin 245a696741 nvc0/ir: add fixup to deal with interpolateAtSample with non-MSAA
The spec calls to always use sample 0 in this case, whereas we can do
undefined things for invalid sample id's in the MSAA case.

Fixes
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.non_multisample_buffer.sample_n_*

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8574>
2021-01-21 15:55:34 -05:00
Mike Blumenkrantz 3f9a6d333b zink: export shader image caps using features
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 0daa61553d zink: check if multisample support exists for shader image formats
avoid issues later by checking this now while we're here

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz b9b812edb8 zink: handle shader image descriptor updates during draw
this is ugly and will be cleaned up later, but the idea is to have identical
handling between samplers and images such that for each type, an array of resources
is processed and it's just setting up variables which fall through to the actual
descriptor struct processing

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 9ba38ab6fa zink: add a pipe_context::set_shader_images hook
this is sort of a weird mechanism since shader images have no allocated
struct and just hang out on the context

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz e1f798ca50 zink: break out bufferview creation into separate function
we'll reuse this for shader images

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz c4d00b9ca4 zink: handle image descriptors during zink_shader creation
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 10fb7a8c0f zink: enable image caps in ntv when a shader has images
since we don't have the device info we have to emit some caps on the
fly here

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 245d9fa21b zink: enable early frag test execution in ntv when necessary
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 9cd2aff1a3 zink: add handling for all basic image ops in ntv
now that atomic handling is standardized, there's only a few actual ops left
to have proper image support

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz a4f06b3528 zink: expand ntv array derefs to track image derefs
this is sort of what we should be moving towards for io as well at some point,
the gist of the change here being that when images are deref'd, we need
to be able to do a lookup on the deref store later on in order to get the
image back

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 77b6b3eb0b zink: add nir_var_uniform case to get_storage_class()
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 2ade1f3a6e zink: handle nir_intrinsic_memory_barrier in ntv
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 768c9fa5c2 zink: handle more atomic ops in ntv
this standardizes and simplifies atomic op dispatch since none of them have
any special handling

it also removes unnecessary (but harmless) memory semantics from a previous commit

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz a2855e2180 zink: handle image variable types in ntv
this just does spirv variable setup

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz fce791722b zink: add new 'sampler_types' variable to ntv_context struct
image_types will be used for images in the next commit

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz a9f2637267 zink: add shader image support to zink_binding()
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 934625d53d zink: add a pipe_context::memory_barrier hook
I'm not claiming this is 100% correct, but it works

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 06273abd20 zink: add 'has_draw' flag to batch struct
this tells us if a batch has a draw command pending

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 05629bb470 zink: verify format caps and add storage image usage when possible in creation
this is a huge perf hog that will be improved on later, but it's necessary for now
in order to correctly determine whether we can use resources as shader images
since gallium gives us no info about usage

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 493fae5016 zink: add ntv function for emitting variable access decorations
these are used for images

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 882ab6afb7 zink: add spirv builder functions for image ops
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 3d2ffb394a zink: add spirv_builder function for hexops
these are functions with 6 operands

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 139ae442c6 zink: rewrite image/sampler glsl -> vk type functions for robustness
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 177a42333f zink: add ntv util function for getting image type
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Mike Blumenkrantz 263d3ae188 zink: rename zink_context::*image_views -> sampler_views
this is wrongly named and conflicts with things that are actually
image_views (assuming we're using gallium terminology in order to match
the rest of the ecosystem)

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:44 +00:00
Erik Faye-Lund d74b012260 zink: fix vertex-stride wrangling
Because Gallium and Vulkan disagree on what kind of state strides is, we
need to wrangle this state a bit, and up until now, we've been simply
fixing this up while binding the vertex-buffers.

But this isn't robust, because the vertex element state might be bound
after the vertex-buffer state was bound. We also need to take
binding-map into account, which we're currently missing as well.

Instead, w need to deal with this at a place where we know what's being
used for both of these. So let's do this during draw instead.

Ideally, we'd also do some dirty-tracking to know if this is needed or
not, but I believe Mike has some patches in this areas lined up, so it
might be easier to wait for those.

Fixes: 8d46e35d16 ("zink: introduce opengl over vulkan")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3661
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4125
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8588>
2021-01-21 11:14:25 +00:00
Vinson Lee 0da527028b nv50/ir: Add InsertConstraintsPass constructor.
Fix defect reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
member_not_init_in_gen_ctor: The compiler-generated constructor for this
class does not initialize targ.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8541>
2021-01-21 00:50:59 +00:00
Icecream95 a4e8ad9b27 panfrost: Fix the tile size assertion
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7086>
2021-01-20 23:43:39 +00:00
Icecream95 2e97d7c835 panfrost: Transaction elimination support
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7086>
2021-01-20 23:43:39 +00:00
Icecream95 7707ccf286 panfrost: Add a debug flag to disable checksumming
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7086>
2021-01-20 23:43:39 +00:00
Icecream95 fc69c423fd panfrost: Only checksum resources when it makes sense to
To simplify tracking the checksum validity, only checksum 2D
resources.

The GPU cannot do checksumming when there is too much data to be
written out, so limit the number of bytes per pixel to an architecture
specific value.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7086>
2021-01-20 23:43:39 +00:00
Icecream95 a1bf4be844 panfrost: Add a function to determine if a resource is 2D
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7086>
2021-01-20 23:43:39 +00:00
Rob Clark 77398a9e41 radeonsi: Use util_writes_stencil() helper
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8598>
2021-01-20 23:15:47 +00:00
Rob Clark 04f8aa7c1e r300: Use util_writes_depth_stencil() helper
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8598>
2021-01-20 23:15:47 +00:00
Rob Clark c01aac141a freedreno/a6xx: Don't early-z if there are stencil writes
Fixes a similar stencil related misrendering in a couple "RV AppStudios"
titles.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8598>
2021-01-20 23:15:47 +00:00
Rob Clark 7277342b5e gallium/util: Add helpers to determine if z/s is written
For drivers that must control various 'early-z'-like state, it is easy
enough to get this wrong.  So add helpers so we don't have to duplicate
the logic in each driver.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8598>
2021-01-20 23:15:47 +00:00
Marek Olšák bc0508ad38 radeonsi: allow instance_count == 0 on chips that handle it correctly
Let's remove this overhead.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák 76d6351dab radeonsi: don't validate inlinable uniforms at draw time
Let's trust the state tracker that it sets inlinable uniforms only
when shaders can use them.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák 185a2472a4 radeonsi: move variables closer to their use in most draw state functions
for lower register pressure, though I haven't measured this.

si_draw_vbo will be handled in a future commit.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák ae5df516f1 radeonsi: clear dirty_atoms and dirty_states only if we entered the emit loop
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák 2206840f6c radeonsi: enable the GS tri strip adj workaround with primitive_restart
If a primitive restart index occurs after an even number of triangles,
the workaround works.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák 888a45a362 radeonsi: evaluate si_get_vs in si_draw_vbo at compile time
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák c5d3341b6e radeonsi: inline the last use of si_get_vs_state
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák 5f7715083b radeonsi: evaluate sh_base in si_emit_vs_state at compile time
This computes the value at compile time because si_get_user_data_base is
always inlined.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák e8ccb6f0f3 radeonsi: add si_get_user_data_base selecting user data registers
This will be used in templated si_draw_vbo in place of sh_base.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák 88a02d80de radeonsi: don't set context_roll for non-gfx9 in templated functions
It's not needed by other chips.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák 581a96bc44 radeonsi: don't pass pipe_draw_info into si_emit_draw_registers
Only two fields are used. It's probably better this way.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Marek Olšák ac2b4aa08f radeonsi: unify uploaders on APUs too
const_uploader and stream_uploader point to the same uploader.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
2021-01-20 21:53:13 +00:00
Eric Anholt f79f382c81 nir_to_tgsi: Store directly to TGSI outputs when possible.
Saves emitting a MOV at the end of the program to store the output.

softpipe glmark2 -b buffer +9.73451% +/- 3.17924% (n=6)
softpipe glmark2 -b build +5.57621% +/- 1.35074% (n=9)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8023>
2021-01-20 19:48:59 +00:00
Rohan Garg d245d7b6b8 virgl: Cache depth and stencil buffers
Expand the list of bind flags to cache depth and stencil
buffers.

Extensive testing shows the following performance improvements:

Game           |    % difference in FPS
Plague Inc     |             7
Portal 2       |             21
Overcooked 2   |             1.2
Hollow Knight  |            -1.1
Civilization V |             3.8

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8560>
2021-01-20 17:09:25 +00:00
Mike Blumenkrantz 924d1ba9eb zink: enable WSI-faking for RADV too
temporary until we get real WSI support

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8284>
2021-01-20 16:31:47 +00:00
Mike Blumenkrantz 356a381600 zink: add VK_KHR_driver_properties
yet another extension that breaks naming conventions for structs/enums,
even if it does so in a very sensible way

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8284>
2021-01-20 16:31:47 +00:00
Gert Wollny 3b27243b01 r600: Enable sb also for NIR
Currently, r600/nir doens't have a proper scheduler or optimizer backend,
to be able to make use of this code path without performance regressions,
we enable the sb optimizer also for NIR.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny e20a83eb86 r600/sb: fall back to un-optimized byte code when ra_init fails
Some emulated fp64 piglit create code that seems to make the register
allocation with sb worse than the original shader created from NIR, so
fall back to using the un-optimized shader.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny c1785c55f7 r600/sb: fix boundary assert for mem-instruction decoding
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny 14fe19e797 r600/sfn: Keep array registers alive for the whole shader
This is needed when using sb as a post-optimizer.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny 9fa48c0207 r600/sfn: update shader array info
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny 7717c1090a r600/nir: pass array info to r600_shader for sb
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny ff382c6634 r600/sb: Add support for INTERP_X and INTERP_Z ops
v2: Fix parsing the 2-slot instructions

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny f57ae1e69c r600: Add flags to INTERP_X and INTERP_Z two-slot ops
v2: use the gap in the enum bit field to add the 2-slot bit

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny 198c3acacf r600/sfn: fix use of b32all/and
Fixes: f79b7fcf7c
       r600/sfn: use 32 bit bools

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Gert Wollny 4f88668f4a r600/nir: clone shader before first query to shader key
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563>
2021-01-20 12:12:07 +00:00
Juan A. Suarez Romero 6d587f754c v3d: use a compatible supported format for TFU-based blit
When trying to blit using the TFU, as we are doing an exact copy with no
conversions, we can choose a supported format that is compatible with the
underlying format's texel size.

This allows to use the TFU to blit formats that are not supported, like
r8ui or r16ui.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8495>
2021-01-20 08:58:55 +00:00
Vinson Lee dd72019d03 r600/sfn: Remove StoreMerger unused member b.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8540>
2021-01-19 15:06:25 -08:00
cheyang 3e13c1f8df frontend/dri: fix doesn't support RGBA ordering still expose RGBA in config
Signed-off-by: cheyang <cheyang@bytedance.com>
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8553>
2021-01-19 17:10:47 +00:00
Mike Blumenkrantz 5ebfb9cd60 zink: process ubos with location values set as long as they're actually ubos
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8514>
2021-01-19 14:14:59 +00:00