libdrm/lima: propagate allocation failure

Failed allocations were still denoted with a successful return value
to the caller. This situation was triggered by artificial testing and
has not been observed yet in practice. In case the 'LIMA_GEM_CREATE'
I/O control fails Mesa will dereference invalid pointers anyway.

Issue genodelabs/genode-allwinner#27.
This commit is contained in:
Josef Söntgen 2023-12-19 16:31:56 +01:00 committed by Christian Helmuth
parent 602f9b5670
commit d9e4d32374

View File

@ -765,6 +765,7 @@ class Lima::Call
_main_ctx->gpu().upgrade_ram(donate);
});
} catch (Gpu::Vram::Allocation_failed) {
_va_alloc.free(va);
return;
}
@ -776,14 +777,12 @@ class Lima::Call
{
::uint64_t const size = arg.size;
try {
_alloc_buffer(size, [&](Vram const &b) {
arg.handle = b.id().value;
});
return 0;
} catch (...) {
return -1;
}
bool result = false;
_alloc_buffer(size, [&](Vram const &b) {
arg.handle = b.id().value;
result = true;
});
return result ? 0 : -1;
}
int _drm_lima_gem_submit(drm_lima_gem_submit &arg)