aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDanylo Piliaiev <[email protected]>2020-04-28 14:51:26 +0300
committerMarge Bot <[email protected]>2020-04-29 08:51:33 +0000
commit8f0d3874411ec3c0dcb1171cad5930db70fb48b4 (patch)
tree581d14af1d494a463aa018684780c8c11932cec8 /src/gallium
parent1a33358b274631e0b8b493b0d885091d839f9d13 (diff)
iris/bufmgr: Check if iris_bo_gem_mmap failed
After refactoring of iris_bo_map_cpu and iris_bo_map_wc - immediate return of NULL on failure to mmap a buffer was lost. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2855 Fixes: 5bc3f52dd8c2b5acaae959ccae2e1fb7c769bb22 Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4786>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/iris/iris_bufmgr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index 5bf52b32eeb..c8e6d0c654b 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -980,6 +980,10 @@ iris_bo_map_cpu(struct pipe_debug_callback *dbg,
if (!bo->map_cpu) {
DBG("iris_bo_map_cpu: %d (%s)\n", bo->gem_handle, bo->name);
void *map = iris_bo_gem_mmap(dbg, bo, false);
+ if (!map) {
+ return NULL;
+ }
+
VG_DEFINED(map, bo->size);
if (p_atomic_cmpxchg(&bo->map_cpu, NULL, map)) {
@@ -1027,6 +1031,10 @@ iris_bo_map_wc(struct pipe_debug_callback *dbg,
if (!bo->map_wc) {
DBG("iris_bo_map_wc: %d (%s)\n", bo->gem_handle, bo->name);
void *map = iris_bo_gem_mmap(dbg, bo, true);
+ if (!map) {
+ return NULL;
+ }
+
VG_DEFINED(map, bo->size);
if (p_atomic_cmpxchg(&bo->map_wc, NULL, map)) {