Mesa (main): intel: protect against empty invalidate ranges

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 13 02:06:32 UTC 2022


Module: Mesa
Branch: main
Commit: 1aeb11cde1bc610cb23343ab507b1bf3b197b1b4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1aeb11cde1bc610cb23343ab507b1bf3b197b1b4

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Jul 12 11:20:10 2022 +0300

intel: protect against empty invalidate ranges

It's legal for an application to call vkInvalidateMappedMemoryRanges()
/ vkFlushMappedMemoryRanges() with zero sized ranges.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: b91971c240d3 ("anv: use the right helper to invalidate memory")
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6852
Reviewed-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17481>

---

 src/intel/common/intel_clflush.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/intel/common/intel_clflush.h b/src/intel/common/intel_clflush.h
index 7c6aaf8f2df..e1c3728015f 100644
--- a/src/intel/common/intel_clflush.h
+++ b/src/intel/common/intel_clflush.h
@@ -49,6 +49,9 @@ intel_flush_range(void *start, size_t size)
 static inline void
 intel_invalidate_range(void *start, size_t size)
 {
+   if (size == 0)
+      return;
+
    intel_clflush_range(start, size);
 
    /* Modern Atom CPUs (Baytrail+) have issues with clflush serialization,



More information about the mesa-commit mailing list