nvc0: return NULL instead of asserting in nvc0_resource_from_user_memory

Fixes: 212f1ab40e ("nvc0: support PIPE_CAP_RESOURCE_FROM_USER_MEMORY_COMPUTE_ONLY")
Acked-by: David Heidelberg <david@ixit.cz>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
(cherry picked from commit 277925471e)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32119>
This commit is contained in:
Karol Herbst
2024-02-26 15:51:46 +01:00
committed by Dylan Baker
parent b856d0d3cc
commit 7cef55b993
2 changed files with 4 additions and 6 deletions

View File

@@ -244,7 +244,7 @@
"description": "nvc0: return NULL instead of asserting in nvc0_resource_from_user_memory",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "212f1ab40ea5945919a92926fd9b2aa085fed661",
"notes": null

View File

@@ -141,11 +141,9 @@ nvc0_resource_from_user_memory(struct pipe_screen *pipe,
const struct pipe_resource *templ,
void *user_memory)
{
ASSERTED struct nouveau_screen *screen = nouveau_screen(pipe);
assert(screen->has_svm);
assert(templ->target == PIPE_BUFFER);
struct nouveau_screen *screen = nouveau_screen(pipe);
if (!screen->has_svm || templ->target != PIPE_BUFFER)
return NULL;
return nouveau_buffer_create_from_user(pipe, templ, user_memory);
}