mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 02:40:11 +01:00
read-only mirror of https://gitlab.freedesktop.org/mesa/mesa
When performing transfer maps on images that require staging buffers (say, for presenting a linear view of tiled memory), we were reading the existing contents of the buffer into the staging resource on map unless PIPE_MAP_DISCARD_RANGE was set. The thinking was to support partial writes. If you map a subrectangle of an image, but then only write selective pixels - should it preserve the existing contents of the mapped region? I believed that it should, unless you pass PIPE_MAP_DISCARD_RANGE to explicitly say that that it's okay to invalidate the destination region. However, that does not appear to be the interpretation favored by other Mesa developers (in particular Michel Dänzer and Marek Olšák). The radeonsi driver does not do this readback from the destination region to the staging buffer unless you pass PIPE_MAP_READ. If you want to do a partial write and preserve contents, you need to pass both flags: (PIPE_MAP_READ | PIPE_MAP_WRITE). Passing READ is expected to come with an associated cost. OpenGL defines GL_MAP_INVALIDATE_RANGE_BIT for mapping buffer objects, which is translated to PIPE_MAP_DISCARD_RANGE. However, unextended OpenGL doesn't define mapping textures. There are two main sources of image maps: our internal MapTextureImage() hook, and gbm_bo_map(). I've audited our internal MapTextureImage() calls, and while some do pass PIPE_MAP_DISCARD_RANGE, almost all of them wholly overwrite the mapped region, and those that care about combining with existing image contents all pass PIPE_MAP_READ. So this should work there. GBM defines three flags: GBM_BO_TRANSFER_READ, WRITE, and READ_WRITE. There is no defined "invalidate range" bit. In issue #6020, Matthias Treydte notes that this extra readback can cause performance problems, and with iris's current interpretation, there's no way to avoid it. During that discussion, Michel and Matthias both argued that GBM_BO_TRANSFER_WRITE should invalidate the destination contents and avoid the readback, while GBM_BO_TRANSFER_READ_WRITE would preserve it. This patch makes iris follow that model for image mappings, removing readback on staging maps for both detiling and stall avoidance, unless PIPE_MAP_READ is passed. I believe we can change this with impunity. For buffer objects, Ian Romanick and I both agree that partial writes should be supported, and GL_MAP_INVALIDATE_RANGE_BIT exists precisely to indicate that you should spend effort preserving existing contents. So we continue doing readback for buffers unless PIPE_MAP_DISCARD_RANGE is flagged, for now. While I think this is work, it also seems to be undertested in the CTS and Piglit. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6020 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19209> |
||
|---|---|---|
| .github/workflows | ||
| .gitlab/issue_templates | ||
| .gitlab-ci | ||
| android | ||
| bin | ||
| build-support | ||
| docs | ||
| include | ||
| src | ||
| subprojects | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .graphqlrc.yml | ||
| .mailmap | ||
| CODEOWNERS | ||
| meson.build | ||
| meson_options.txt | ||
| README.rst | ||
| 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 `OFTC's #dri-devel <irc://irc.oftc.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.