mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 14:50:11 +01:00
read-only mirror of https://gitlab.freedesktop.org/mesa/mesa
There is a small gap of time where the currently bound uncompiled shaders, and compiled shader variant, are out of sync. Specifically, between pipe->bind_*_state() and the next draw. Currently, shaders variants live entirely within a single context, and when deleting an iris_uncompiled_shader, we check if any of its variants are currently bound, and defer deleting those until the next iris_update_compiled_shaders() hook runs and binds new shaders to replace them. (This is due to the time gap between binding new uncompiled shaders, and updating variants at draw time when we have the required NOS in place.) This works pretty well in a single context world. But as we move to share compiled shader variants across multiple contexts, it breaks down. When deleting a shader, we can't look at all contexts to see if its variants are bound anywhere. We can't even quantify whether those contexts will run a future draw any time soon, to update and unbind. One fairly crazy solution would be to delete the variants anyway, and leave the stale pointers to dead variants in place. This requires removing any code that compares old and new variants. Today, we do that sometimes for seeing if the old/new shaders toggled some feature. Worse than that, though, we don't just have to avoid dereferences, we'd have to avoid pointer comparisons. If we free a variant, and quickly allocate a new variant, malloc may return the same pointer. If it's for the same shader stage, we may get a new different program that has the same pointer as a previously bound stale one, causing us to think nothing had changed when we really needed to do updates. Again, this is doable, but leaves the code fragile - we'd have to guard against future patches adding such checks back in. So, don't do that. Instead, do basic reference counting. When a variant is bound in a context, up the reference. When it's unbound, decrement it. When it hits zero, we know it's not bound anywhere and is safe to delete, with no stale references. This ends up being reasonably cheap anyway, since the atomic is usually uncontested. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7668> |
||
|---|---|---|
| .appveyor | ||
| .gitlab/issue_templates | ||
| .gitlab-ci | ||
| bin | ||
| build-support | ||
| docs | ||
| doxygen | ||
| include | ||
| scons | ||
| src | ||
| subprojects | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .mailmap | ||
| .travis.yml | ||
| Android.common.mk | ||
| Android.mk | ||
| appveyor.yml | ||
| CleanSpec.mk | ||
| common.py | ||
| meson.build | ||
| meson_options.txt | ||
| README.rst | ||
| REVIEWERS | ||
| SConstruct | ||
| VERSION | ||
`Mesa <https://mesa3d.org>`_ - The 3D Graphics Library ====================================================== Source ------ This repository lives at https://gitlab.freedesktop.org/mesa/mesa. Other repositories are likely forks, and code found there is not supported. Build & install --------------- You can find more information in our documentation (`docs/install.rst <https://mesa3d.org/install.html>`_), but the recommended way is to use Meson (`docs/meson.rst <https://mesa3d.org/meson.html>`_): .. code-block:: sh $ mkdir build $ cd build $ meson .. $ sudo ninja install Support ------- Many Mesa devs hang on IRC; if you're not sure which channel is appropriate, you should ask your question on `Freenode's #dri-devel <irc://chat.freenode.net#dri-devel>`_, someone will redirect you if necessary. Remember that not everyone is in the same timezone as you, so it might take a while before someone qualified sees your question. To figure out who you're talking to, or which nick to ping for your question, check out `Who's Who on IRC <https://dri.freedesktop.org/wiki/WhosWho/>`_. The next best option is to ask your question in an email to the mailing lists: `mesa-dev\@lists.freedesktop.org <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>`_ Bug reports ----------- If you think something isn't working properly, please file a bug report (`docs/bugs.rst <https://mesa3d.org/bugs.html>`_). Contributing ------------ Contributions are welcome, and step-by-step instructions can be found in our documentation (`docs/submittingpatches.rst <https://mesa3d.org/submittingpatches.html>`_). Note that Mesa uses gitlab for patches submission, review and discussions.