iris: Avoid abort() if kernel can't allocate memory

When the system doesn't have enough memory, GNOME Shell may be crashed
by iris:
gnome-shell[1161]: iris: Failed to submit batchbuffer: Cannot allocate memory
gnome-shell[1161]: GNOME Shell crashed with signal 6

So don't abort() when kernel can't allocate memory to avoid crashing the
entire desktop.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11178>
This commit is contained in:
Kai-Heng Feng 2021-06-04 12:13:04 +08:00 committed by Marge Bot
parent d873e30d3b
commit f9d8d9acbb
1 changed files with 2 additions and 1 deletions

View File

@ -756,8 +756,9 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line)
* with a new logical context, and inform iris_context that all state
* has been lost and needs to be re-initialized. If this succeeds,
* dubiously claim success...
* Also handle ENOMEM here.
*/
if (ret == -EIO && replace_hw_ctx(batch)) {
if ((ret == -EIO || ret == -ENOMEM) && replace_hw_ctx(batch)) {
if (batch->reset->reset) {
/* Tell gallium frontends the device is lost and it was our fault. */
batch->reset->reset(batch->reset->data, PIPE_GUILTY_CONTEXT_RESET);