Commit Graph

135743 Commits

Author SHA1 Message Date
Mike Blumenkrantz
c7da40b2eb zink: increment batch->descs_used during update_descriptors flushing
ensure that this actually flushes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9273>
2021-02-25 04:52:42 +00:00
Mike Blumenkrantz
4412d2b69d zink: properly size descriptorset layout binding stack array
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9273>
2021-02-25 04:52:42 +00:00
Mike Blumenkrantz
f840057700 zink: unref programs last in batch reset
we're going to want to make sure all other resources have been handled
at this point so that we can make some better decisions in this block
based on descriptor usage

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9273>
2021-02-25 04:52:42 +00:00
Mike Blumenkrantz
992ddf7e4b zink: ralloc zink program structs
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9273>
2021-02-25 04:52:42 +00:00
Mike Blumenkrantz
747caaa83d zink: use zink_program in zink_batch_reference_program()
this is a little nicer

no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9273>
2021-02-25 04:52:42 +00:00
Mike Blumenkrantz
5503ffecfb zink: add zink_program struct as a base class for compute/gfx structs
this is going to be useful for managing descriptors

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9273>
2021-02-25 04:52:42 +00:00
Vinson Lee
50ca42dc43 zink: Remove leftover dead code.
Fix defect reported by Coverity Scan.

Structurally dead code (UNREACHABLE)
unreachable: This code cannot be reached: return progress;

Fixes: d550c5780f ("zink: use nir_shader_instructions_pass for draw params pass")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9182>
2021-02-25 04:41:53 +00:00
Vinson Lee
9b54272425 gv100/ir: Initialize CodeEmitterGV100 members in constructor.
Fix defects reported by Coverity Scan.

uninit_member: Non-static class member prog is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member insn 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/9183>
2021-02-25 04:36:52 +00:00
Vinson Lee
7b934d1ecd nir/lower_tex: Change coord type to int.
nir_tex_instr_src_index returns an int.

Fix defect reported by Coverity Scan.

Macro compares unsigned to 0 (NO_EFFECT)
unsigned_compare: This greater-than-or-equal-to-zero comparison of an unsigned value is always true. coord >= 0U.

Fixes: b154a4154b ("nir/lower_tex: rewrite tex/txb -> txd/txl before saturating srcs")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9181>
2021-02-25 04:15:07 +00:00
Vinson Lee
816d28f4a1 llvmpipe: Fix typos.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8542>
2021-02-25 04:04:28 +00:00
Vinson Lee
6fc3363368 r600: Fix typos.
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/8293>
2021-02-25 03:55:43 +00:00
Michel Zou
2944b4b6b4 gallium: remove DROP_PIPE_LOADER_MISC
not needed since these code paths are always enabled

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7208>
2021-02-25 03:41:36 +00:00
Michel Zou
951f328723 lavapipe: set empty dll prefix
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7208>
2021-02-25 03:41:36 +00:00
Michel Zou
e8d63375d2 lavapipe: add mingw32 def file
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7208>
2021-02-25 03:41:36 +00:00
Michel Zou
8af568e4ae vulkan: implement wsi_win32 backend
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7208>
2021-02-25 03:41:36 +00:00
Dave Airlie
6c0546f466 lavapipe: use null probe path on win32
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7208>
2021-02-25 03:41:36 +00:00
Timothy Arceri
fbabd2163d util/disk_cache: fix crash in fossilize_db
We don't need to close the file here check_files_opened_successfully()
already does that for us if needed.

This fixes a crash when invalid filename/paths are provided to the
MESA_DISK_CACHE_READ_ONLY_FOZ_DBS environment variable.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9251>
2021-02-25 03:27:14 +00:00
Mike Blumenkrantz
ba4bc54dea zink: rename zink_context::buffers -> vertex_buffers (and usage mask)
this is more descriptive

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9272>
2021-02-24 21:41:05 -05:00
Mike Blumenkrantz
cfc669585b zink: use dynamic vertex buffer strides
this removes another case of needing to rehash/create a new pipeline

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9272>
2021-02-24 21:41:05 -05:00
Mike Blumenkrantz
9d0434bf64 zink: make dynamic state usage in pipeline creation more explicit/flexible
we'll be expanding this, so we want to have it very easy to update and read

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9272>
2021-02-24 21:41:05 -05:00
Mike Blumenkrantz
51e527a9ba zink: setup CmdBindVertexBuffers2EXT member in screen for dynamic state
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9272>
2021-02-24 21:41:05 -05:00
Marek Olšák
f827b29234 nouveau_vieux: use align_calloc for the context to fix m32 crashes
Fixes: 3175b63a0d "mesa: don't allocate matrices with malloc"

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9220>
2021-02-25 02:33:12 +00:00
Marek Olšák
81cf4bef7e radeon,r200: use align_calloc for the context to fix m32 crashes
Fixes: 3175b63a0d "mesa: don't allocate matrices with malloc"

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9220>
2021-02-25 02:33:12 +00:00
Marek Olšák
75d5c1229e i915: use align_calloc for the context to fix m32 crashes
Fixes: 3175b63a0d "mesa: don't allocate matrices with malloc"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4295

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9220>
2021-02-25 02:33:12 +00:00
Mike Blumenkrantz
22fc869187 zink: set VK_IMAGE_LAYOUT_PRESENT_SRC_KHR on fb resources at eof flush
this should maybe fix garbled images on amd?

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Mike Blumenkrantz
55f05638f5 zink: handle VK_IMAGE_LAYOUT_PRESENT_SRC_KHR barriers
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Mike Blumenkrantz
c5292710c4 zink: handle PIPE_FLUSH_DEFERRED
these flushes queue the fence to be submitted on the next finish call, so
we have to store the context to the fence to be able to handle threaded calls

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Mike Blumenkrantz
c271ac0066 zink: add util function for returning previous batch
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Mike Blumenkrantz
24b237d3d4 zink: add a define for compute batch count
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Mike Blumenkrantz
ef3dc995a9 zink: only flush batches in pipe_context::flush if they actually have work
no need to submit command buffers to the queue which have no commands, so we
can just proceed to give back an inactive fence object that always returns success

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Antonio Caggiano
9dac191f6e zink: fix destroy batch
Extract batch destruction in its own function, then make sure to
release objects.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Mike Blumenkrantz
da2d8f1078 zink: create a single fence per batch on startup and then reuse
previously we would be creating a new fence per batch for every submit,
but we can just reset and reuse them if we're careful with it

based on original patch by Antonio Caggiano

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
2021-02-24 21:09:52 -05:00
Mike Blumenkrantz
a27570326f zink: reorder zink_bind_vertex_buffers()
we should be making this a no-op if we have no bindings (somehow)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9241>
2021-02-24 20:47:51 -05:00
Mike Blumenkrantz
381e92e811 zink: move samplerview referencing around in update_descriptors()
no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9241>
2021-02-24 20:47:51 -05:00
Mike Blumenkrantz
679dd69741 zink: avoid memset during update_descriptors() for resources refs
we can simplify this a bit to further reduce cpu usage here

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9241>
2021-02-24 20:47:51 -05:00
Dave Airlie
7826648e14 lavapipe: fix depth texturing swizzle
This is pretty much derived from what works and passes
both GL via zink and VK-GL-CTS test suites.

The zink multisample regressions tests rendered black, so
"passed" before, now they render more junk.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9260>
2021-02-25 01:32:33 +00:00
Eric Anholt
6d2b2515c4 freedreno/a5xx+: Drop the unused no_decode_srgb flag.
This was a flag used for a4xx GMEM draws.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9267>
2021-02-25 00:38:11 +00:00
Eric Anholt
9522087b75 freedreno/a5xx+: Stop recompiling on texture samples changes.
The shader only looks at this bit of the key on a3xx, and a4xx already
didn't set it.  This will help give us precompile hits for MSAA texture
sampling.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9267>
2021-02-25 00:38:11 +00:00
Eric Anholt
c93fd1046a freedreno: Use the mesa/st frontend lowering of GL_CLAMP.
350 lines of code for this stupid feature, and we weren't even doing it
right for CS/GS/tess.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9267>
2021-02-25 00:38:11 +00:00
Mike Blumenkrantz
05d0514a8f zink: ci updates
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9115>
2021-02-24 23:25:01 +00:00
Mike Blumenkrantz
cf8ca77be1 zink: handle point sprite
this needs custom yinvert handling and also prim mode detection, which
gallium can't do on its own

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9115>
2021-02-24 23:25:01 +00:00
Mike Blumenkrantz
b9676976d0 zink: store prim mode to context during draw
we need to be able to access this for shader rewrites

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9115>
2021-02-24 23:25:01 +00:00
Mike Blumenkrantz
2e60929b47 nir/texcoord_replace: add a yinvert param
vulkan needs to invert the y coord in order to handle PIPE_SPRITE_COORD_LOWER_LEFT

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9115>
2021-02-24 23:25:01 +00:00
Mike Blumenkrantz
707dc04b78 zink: no-op descriptor updating for draws without descriptors
this is a valid case that we can trivially shortcut to cut down on calls

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9155>
2021-02-24 22:44:50 +00:00
Eric Anholt
5fa27e6670 freedreno: Drop custom driver lowering of GL's color clamping.
The mesa/st frontend can do it for us now that we don't need to worry
about breaking precompiles.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>
2021-02-24 21:48:54 +00:00
Eric Anholt
3b9f6af1a9 freedreno: Drop custom driver lowering of two-sided color.
The GL frontend can do it for us now, so just use their code instead of
our own shader variants.  In the past we had to do hide the GL shader
variants in the driver to get precompiles from st, but no longer as of
!8601.

I tested with drawoverhead -test 6 (shader program change, n=30) and -test
1 (no statechanges, n=43) and saw no change in driver overhead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>
2021-02-24 21:48:54 +00:00
Eric Anholt
de17b4aab5 freedreno: Remove uniform variables after finalizing NIR.
mesa/st optimizes the uniform storage if you have the finalize hook in
place, causing the uniforms declared to potentially not have storage in
the ParameterValues list any more.  If you leave your uniforms around in
the NIR, then a later finalization after variant creation will re-add the
uniforms to parameters, defeating the optimization and likely reallocating
the uniform storage (causing use-after-free).  So, we have to do this
before we can start using variants in mesa/st.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>
2021-02-24 21:48:54 +00:00
Eric Anholt
9fcc369770 mesa: Always make sure uniform storage doesn't get reallocated.
Every caller of associate_uniform_storage was doing this to safety-check
that the uniform storage didn't get reallocated, except for
st_deserialise_ir_program().  This ended up leaving an opening for
use-after-free without hitting the assert in the hot-cache case (and I
found it on freedreno).  Having added it, it also reveals use-after-frees
in the drawpixels shader variant cases on llvmpipe and zink.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>
2021-02-24 21:48:54 +00:00
Mauro Rossi
3468c0dd4d android: mesa: Move the FXT1 compressor/decompressor to util/
After commit a46b73e in order to build mesa for Android
we need to generate $(intermediates)/util/format/u_format_pack.h
instead of $(intermediates)/format/u_format_pack.h

Fixes the following building error in Android build:

external/mesa/src/util/format/u_format_fxt1.c:28:10: fatal error: 'util/format/u_format_pack.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Fixes: a46b73e ("mesa: Move the FXT1 compressor/decompressor to util/")
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9240>
2021-02-24 21:29:14 +00:00
Jose Fonseca
a4ffa25ee8 scons: Add u_format_pack.h include path.
Fixes MSVC SCons build.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9263>
2021-02-24 20:48:47 +00:00