freedreno/drm: don't crash for unsupported devices

For unsupported devices fd_pipe_new() will return NULL, causing a crash
when fd_device_new() tries to check device generation.

Handle fd_pipe_new() returning NULL by destroying device and returning
NULL.

Fixes: 4861067689 ("freedreno/drm: Add sub-allocator")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26961>
(cherry picked from commit 7a81855a67)
This commit is contained in:
Dmitry Baryshkov
2024-01-09 23:50:00 +02:00
committed by Eric Engestrom
parent 25aa495324
commit ceb2551194
2 changed files with 8 additions and 1 deletions

View File

@@ -104,6 +104,9 @@ out:
if (!use_heap) {
struct fd_pipe *pipe = fd_pipe_new(dev, FD_PIPE_3D);
if (!pipe)
goto fail;
/* Userspace fences don't appear to be reliable enough (missing some
* cache flushes?) on older gens, so limit sub-alloc heaps to a6xx+
* for now:
@@ -119,6 +122,10 @@ out:
}
return dev;
fail:
fd_device_del(dev);
return NULL;
}
/* like fd_device_new() but creates it's own private dup() of the fd