0025-gbm-don-t-assert-if-DRI-context-creation-fails.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 799e67eeeb7d6984df65fa17ce9374416de5f61c Mon Sep 17 00:00:00 2001
  2. From: Brendan King <Brendan.King@imgtec.com>
  3. Date: Fri, 1 Dec 2017 08:31:15 +0000
  4. Subject: [PATCH] gbm: don't assert if DRI context creation fails
  5. If the DRI backend fails to create a DRI context, return an error,
  6. rather than asserting.
  7. ---
  8. src/gbm/backends/dri/gbm_dri.c | 10 ++++++++--
  9. 1 file changed, 8 insertions(+), 2 deletions(-)
  10. diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
  11. index bd8a80c..2aa9c7c 100644
  12. --- a/src/gbm/backends/dri/gbm_dri.c
  13. +++ b/src/gbm/backends/dri/gbm_dri.c
  14. @@ -1245,8 +1245,11 @@ gbm_dri_bo_map(struct gbm_bo *_bo,
  15. if (!dri->context)
  16. dri->context = dri->dri2->createNewContext(dri->screen, NULL,
  17. NULL, NULL);
  18. - assert(dri->context);
  19. mtx_unlock(&dri->mutex);
  20. + if (!dri->context) {
  21. + errno = ENOSYS;
  22. + return NULL;
  23. + }
  24. /* GBM flags and DRI flags are the same, so just pass them on */
  25. return dri->image->mapImage(dri->context, bo->image, x, y,
  26. @@ -1374,8 +1377,11 @@ gbm_dri_bo_blit(struct gbm_bo *_dst_bo, struct gbm_bo *_src_bo,
  27. if (!dri->context)
  28. dri->context = dri->dri2->createNewContext(dri->screen, NULL,
  29. NULL, NULL);
  30. - assert(dri->context);
  31. mtx_unlock(&dri->mutex);
  32. + if (!dri->context) {
  33. + errno = ENOSYS;
  34. + return 0;
  35. + }
  36. /* GBM flags and DRI flags are the same, so just pass them on */
  37. dri->image->blitImage(dri->context, dst_bo->image, src_bo->image,