iris: Patch constant data pointers into shaders Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6244>
iris: Use gen_disassemble This one doesn't require the program size and so it won't mess up if we have a bunch of constant data at the end. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6244>
intel/disasm: Label support in shader disassembly for UIP/JIP Shader instructions which use UIP/JIP now get formatted with a label in addition with immediate value, labels have "LABEL%d" format. v2: - Consider brw_jump_scale when calculating label's offset From: "Lonnberg, Toni" <toni.lonnberg@intel.com> Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com> Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4245>
iris: Add a kernel_input_size field for compiled shaders Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6280>
iris: Delete shader variants when deleting the API-facing shader We were space-leaking iris_compiled_shader objects, leaving them around basically forever - long after the associated iris_uncompiled_shader was deleted. Perhaps even more importantly, this left the BO containing the assembly referenced, meaning those were never reclaimed either. For long running applications, this can leak quite a bit of memory. Now, when freeing iris_uncompiled_shader, we hunt down any associated iris_compiled_shader objects and pitch those (and their BO) as well. One issue is that the shader variants can still be bound, because we haven't done a draw that updates the compiled shaders yet. This can cause issues because state changes want to look at the old program to know what to flag dirty. It's a bit tricky to get right, so instead we defer variant deletion until the shaders are properly unbound, by stashing them on a "dead" list and tidying that each time we try and delete some shader variants. This ensures long running programs delete their shaders eventually. Fixes: ed4ffb97158 ("iris: rework program cache interface") Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6075>
iris: Annotate all BO uses with domain and sequence number information. Probably the most annoying patch to review from the whole series -- Mark every buffer object use as accessed through some caching domain with the sequence number of the current synchronization section of the batch. The additional argument of iris_use_pinned_bo() makes sure I'd have gotten a compile error if I had missed any buffer added to the batch validation list. There are only a few exceptions where a buffer is left untracked while adding it to the validation list, justified below: - Batch buffers: These are strictly read-only for the moment. - BLORP buffer objects: Their seqnos are bumped manually at the end of iris_blorp_exec() instead, in order to avoid plumbing domain information through BLORP address combining. - Scratch buffers: The contents of these are strictly thread-local. - Shader images and SSBOs: Accesses of these buffers are explicitly synchronized at the API level. v2: Opt out of tracking more aggressively (Ken): In addition to the above, surface states, binding tables, instructions and most dynamic states are now left untracked, which means a *lot* more BO uses marked IRIS_DOMAIN_NONE which need to be reviewed extremely carefully, since the cache tracker won't be able to provide any coherency guarantees for them. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>
iris: move iris_vtable to iris_screen instead of inlining this into every context, now a struct is used in the screen struct to reduce memory usage and simplify a couple of the methods Closes: https://gitlab.freedesktop.org/kwg/mesa/-/issues/6 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4376>
intel/blorp: Plumb the stage through blorp upload_shader Vulkan uses that for its own upload function -- even though for BLORP it doesn't really currently care. Neither Iris and i965 makes use of it at the moment. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4170> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4170>
iris: Change keybox parenting For temporary lookups, just allocate out of the NULL ralloc context, so we don't have to edit the linked list of ralloc children to add it and then immediately remove it again. When uploading a new shader, allocate the keybox off the shader, so if we delete the shader the keybox also goes away. Less manual cleanup.
intel/compiler: Add a "base class" for program keys Right now, all keys have two things in common: a program string ID and a sampler_prog_key_data. I'd like to add another thing or two and need a place to put it. This commit adds a new brw_base_prog_key struct which contains those two common bits. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
iris: Use a uint16_t for key sizes sizeof(struct brw_vs_prog_key) == 324. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
iris: Handle binding table in the driver Stop using brw_compiler to lower the final binding table indices for surface access. This is done by simply not setting the 'prog_data->binding_table.*_start' fields. Then make the driver perform this lowering. This is a better place to perfom the binding table assignments, since the driver has more information and will also later consume those assignments to upload resources. This also prepares us for two changes: use ibc without having to implement binding table logic there; and remove unused entries from the binding table. Since the `block` field in brw_ubo_range now refers to the final binding table index, we need to adjust it before using to index shs->constbuf. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
iris: always include an extra constbuf0 if using UBOs In st_nir_lower_uniforms_to_ubo() all UBO access in the shader have its index incremented to open room for uniforms in constbuf0. So if we use UBOs, we always need to include the extra binding entry in the table. To avoid doing this checks both when compiling the shader and when assigning binding tables, store the num_cbufs in iris_compiled_shader. Fixes a bunch of tests from Piglit and CTS that use UBOs but don't use uniforms or system values. Note that some tests fitting this criteria were passing because the UBOs were moved to be push constants (avoiding the problem). Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
iris: drop key_size_for_cache dead since my program cache API rework. we could still use it for one function, but it's so trivial to pass the size, that it's probably not worth the extra code
iris: rework program cache interface This exposes iris_upload_shader() without having to bind it, which will be useful for precompiles. It also lets us examine the old programs and flag dirty bits at a higher level, rather than cramming all that knowledge into the cache layer.
iris: export iris_upload_shader
iris: bypass params and do it ourselves the backend keeps dead code eliminating them all, so we can't do that, plus we don't want to because params[] is lame
iris: implement scratch space! we borrow the approach from anv rather than i965, as it works better with pre-baked state that needs to contain scratch BO addresses fixes a bunch of varying packing tests
iris: Flag constants dirty on program changes 3DSTATE_CONSTANT_* looks at prog_data->ubo_ranges. We were getting saved by iris_set_constant_buffers() usually happening when changing programs (as they usually change uniforms too), but with the clear shader that doesn't use uniforms, we weren't getting one and were leaving push constants enabled, screwing things up. Also clean up a bit of a mess left by the hacks - we were missing bindings in the VS/FS/CS case, among other issues...
iris: better dirty checking