-
Notifications
You must be signed in to change notification settings - Fork 1
/
0019-gbm-don-t-assert-if-DRI-context-creation-fails.patch
42 lines (37 loc) · 1.54 KB
/
0019-gbm-don-t-assert-if-DRI-context-creation-fails.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From f14bd69871df7e99b1c3eae546a17199bbc31b83 Mon Sep 17 00:00:00 2001
From: Brendan King <[email protected]>
Date: Fri, 1 Dec 2017 08:31:15 +0000
Subject: [PATCH] gbm: don't assert if DRI context creation fails
If the DRI backend fails to create a DRI context, return an error,
rather than asserting.
---
src/gbm/backends/dri/gbm_dri.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 00fcc57..fc0bbf5 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -1290,8 +1290,11 @@ gbm_dri_bo_map(struct gbm_bo *_bo,
if (!dri->context)
dri->context = dri->dri2->createNewContext(dri->screen, NULL,
NULL, NULL);
- assert(dri->context);
mtx_unlock(&dri->mutex);
+ if (!dri->context) {
+ errno = ENOSYS;
+ return NULL;
+ }
/* GBM flags and DRI flags are the same, so just pass them on */
return dri->image->mapImage(dri->context, bo->image, x, y,
@@ -1419,8 +1422,11 @@ gbm_dri_bo_blit(struct gbm_bo *_dst_bo, struct gbm_bo *_src_bo,
if (!dri->context)
dri->context = dri->dri2->createNewContext(dri->screen, NULL,
NULL, NULL);
- assert(dri->context);
mtx_unlock(&dri->mutex);
+ if (!dri->context) {
+ errno = ENOSYS;
+ return 0;
+ }
/* GBM flags and DRI flags are the same, so just pass them on */
dri->image->blitImage(dri->context, dst_bo->image, src_bo->image,