This cleans up a bunch of gross sprintfs and keeps the caller from needing
to remember to ralloc_strdup. I added a couple of '"%s", name ? name :
""' to radv where I didn't fully trace through whether a non-null name was
being passed in.
I also took the liberty of adding a basic name to a few shaders (pan_blit,
unit tests)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7323>
These two consumers were the only ones out of the ~65 calls to
init_simple_shader, so there's a pretty clear consensus on how to allocate
simple shaders. I suspect that actually these would be just fine with
b.shader being the mem_ctx, but that would take a bit more rework.
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7323>
Rather than hard-code a list of all the format
modifiers supported by any gallium driver and the
number of aux planes they require in the dri state
tracker, add a screen proc that queries the number
of planes required for a given modifier+format
pair.
Since the only format modifiers that require
auxiliary planes currently are the iris driver's
I915_FORMAT_MOD_Y_TILED_CCS,
I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS, and
I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS, the absence
of the screen proc implies zero aux planes for all
of the screen's supported modifiers. Hence, when
a driver does not expose the proc, derive the
number of planes directly from the format.
Signed-off-by: James Jones <jajones@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3723>
Add a "do you support this modifier?" query to all
drivers which support format modifiers. This will
be used in a subsequent change to fully
encapsulate modifier validation and auxiliary plane
count calculation logic behind the driver
abstraction, which will in turn simplify the
addition of device-class-specific format modifiers
in the nouveau driver.
Signed-off-by: James Jones <jajones@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3723>
dEQP-VK.pipeline.blend.dual_source.format.r16g16b16a16_snorm.states.color_1msc_1ms1a_add_alpha_1mdc_1msa_sub-color_dc_1ms1c_rsub_alpha_z_1mdc_sub-color_ca_1ms1c_min_alpha_sas_ca_rsub-color_1ms1c_s1c_add_alpha_z_1mda_add,Fail
dEQP-VK.pipeline.blend.dual_source.format.r8g8_snorm.states.color_z_sc_add_alpha_1ms1c_sa_min-color_dc_1mca_add_alpha_z_1mca_max-color_1ms1c_sa_max_alpha_1mcc_sc_sub-color_s1c_1mda_add_alpha_s1c_1mda_add,Fail
dEQP-VK.pipeline.blend.dual_source.format.r8g8b8a8_snorm.states.color_1msc_1ms1a_add_alpha_1mdc_1msa_sub-color_dc_1ms1c_rsub_alpha_z_1mdc_sub-color_ca_1ms1c_min_alpha_sas_ca_rsub-color_1ms1c_s1c_add_alpha_z_1mda_add,Fail
dEQP-VK.pipeline.blend.dual_source.format.r8g8b8a8_snorm.states.color_z_sc_add_alpha_1ms1c_sa_min-color_dc_1mca_add_alpha_z_1mca_max-color_1ms1c_sa_max_alpha_1mcc_sc_sub-color_s1c_1mda_add_alpha_s1c_1mda_add,Fail
dEQP-VK.pipeline.blend.format.r16g16b16a16_snorm.states.color_ca_1mca_rsub_alpha_1mda_z_sub-color_sc_sc_add_alpha_1mca_sa_max-color_sa_1msa_min_alpha_1msc_sa_sub-color_dc_sc_add_alpha_1mdc_1mca_add,Fail
dEQP-VK.pipeline.blend.format.r8g8b8a8_snorm.states.color_ca_1mca_rsub_alpha_1mda_z_sub-color_sc_sc_add_alpha_1mca_sa_max-color_sa_1msa_min_alpha_1msc_sa_sub-color_dc_sc_add_alpha_1mdc_1mca_add,Fail
All fail due to the 1 - mdc or 1 - mca alpha channel in the last quadrant.
Cc: 20.3 <mesa-stable>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7499>
If we have cbufs but they are all empty, default
to returning the fb->samples.
Fixes:
dEQP-VK.pipeline.multisample.mixed_count.1_4_unused
on lavapipe
v2:
drop unneeded chunk (Roland)
Cc: 20.3 <mesa-stable>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7499>
Some drivers will drop warnings about seeing these structs in the
pNext chain and not handling them. This change makes it so we
only include the structs with Vulkan drivers that are known to
require them for proper behavior (v3dv only for now) to avoid the
warnings.
It should be noted that here we are only supressing the messages
from Zink. Since the Mesa Vulkan WSI code will include these structs,
when native Vulkan Mesa drivers are used without Zink they might
still dump these messages.
Requested by Mike Blumenkrantz.
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7523>
We can use num_blocks (if it's been initialized by some pass indexing
blocks) to pre-size our table, which helps on validating shaders with many
blocks which would otherwise reallocate the set several times.
No statistically significant performance difference on softpipe
KHR-GL33.texture_swizzle.functional runtime (n=15). A previous, similar
variant of this patch cut .3% of instructions in softpipe shader-db ./run
shaders/closed/steam/borderlands-2/35* (an arbitrary set of shaders that
completed in reasonable amount of time) according to callgrind.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7244>
This implementation was broken and should have just been the same as the
hash_table_clear() one, which I copied over here. It was setting all
formerly-present entries to deleted, yet also setting deleted_entries to
0. This meant that all new searches or additions after clearing would
have to reprobe the whole table until a rehash happened, and that rehash
would be delayed because we violated the deleted_entries invariant.
No statistically significant performance difference on softpipe
KHR-GL33.texture_swizzle.functional runtime (n=18)
Fixes: 5c075b0855 ("util/set: add a set_clear function")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7244>
Use the entry_is_present() helper to clarify what's going on with
deletion, and then we can remove the special continue for NULL since we're
just writing NULL anyway (which the CPU cache will elide for us).
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7244>
Just add as_string to these to faciliate the non-string ones.
(extracted by airlied from pmoreau patch).
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7520>
With the image_read_write OpenCL CTS we can get a stack overflow handling
all the events as the application itself never flushes.
We need to address this in two ways:
1. flush the queue once an abritary amoung of events piled up.
2. Drop event deps once they get a fence assigned.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7460>
Just statically initialize the dummy/incomplete framebuffer/renderbuffer
to avoid re-intializing their mutex.
==328537== Mutex reinitialization: mutex 0x1281bd28, recursion count 0, owner 0.
==328537== at 0x486FD34: pthread_mutex_init_intercept (drd_pthread_intercepts.c:826)
==328537== by 0x486FD34: pthread_mutex_init (drd_pthread_intercepts.c:835)
==328537== by 0x118F9727: mtx_init (threads_posix.h:207)
==328537== by 0x118F983B: simple_mtx_init (simple_mtx.h:132)
==328537== by 0x118FA087: _mesa_init_fbobjects (fbobject.c:93)
==328537== by 0x117E8CB7: init_attrib_groups (context.c:849)
==328537== by 0x117E942F: _mesa_initialize_context (context.c:1225)
==328537== by 0x1173C323: st_create_context (st_context.c:1019)
==328537== by 0x11720A9F: st_api_create_context (st_manager.c:930)
==328537== by 0x1170E2CF: dri_create_context (dri_context.c:163)
==328537== by 0x11FB9DC3: driCreateContextAttribs (dri_util.c:480)
==328537== by 0x8E9D3DF: dri3_create_context_attribs (dri3_glx.c:316)
==328537== by 0x8E9D49B: dri3_create_context (dri3_glx.c:347)
==328537== mutex 0x1281bd28 was first observed at:
==328537== at 0x486FD34: pthread_mutex_init_intercept (drd_pthread_intercepts.c:826)
==328537== by 0x486FD34: pthread_mutex_init (drd_pthread_intercepts.c:835)
==328537== by 0x118F9727: mtx_init (threads_posix.h:207)
==328537== by 0x118F983B: simple_mtx_init (simple_mtx.h:132)
==328537== by 0x118FA087: _mesa_init_fbobjects (fbobject.c:93)
==328537== by 0x117E8CB7: init_attrib_groups (context.c:849)
==328537== by 0x117E942F: _mesa_initialize_context (context.c:1225)
==328537== by 0x1173C323: st_create_context (st_context.c:1019)
==328537== by 0x11720A9F: st_api_create_context (st_manager.c:930)
==328537== by 0x1170E2CF: dri_create_context (dri_context.c:163)
==328537== by 0x11FB9DC3: driCreateContextAttribs (dri_util.c:480)
==328537== by 0x8E9D3DF: dri3_create_context_attribs (dri3_glx.c:316)
==328537== by 0x8E9D49B: dri3_create_context (dri3_glx.c:347)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7517>
Since the ralloc context for cache_key allocation is shared between all
the contexts hanging off a screen, we need to allocate the key under the
screen->lock.
Fixes: 91f9bb99c5 ("freedreno: add gmem state cache")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
In particular I wanted the nr_foo increment to be after assignment..
mostly just to track down a potential race. (This wasn't it, but I
like this color for the bikeshed better.)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
Since we are not tracking reloc flags per submit, we can just construct
this table at flush time, rather than using a second growable table that
is in sync with msm_submit->bos.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
This protects better against another context triggering a batch flush
and unref while the first context is doing resource tracking.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
In general, rings are not shared across contexts/threads. But this
can happen with texture stateobjs, which can be invalidated by other
contexts.
And while we're here, lets convert the rest of freedreno/drm to
u_atomic
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
It is smaller than a pointer, and doesn't run into problems of context
destroy/create cycle ending up with the same address.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
Originally the tex cache was never touched from other contexts, but
rebind_resource() changed that. Add some locking to protect tex cache
against multi-threaded access.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>