0001-src-egl_gbm_render_surface-properly-fallback-to-surf.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 856f9849763535d62ed01b538ba23905875c93f4 Mon Sep 17 00:00:00 2001
  2. From: "Yann E. MORIN" <yann.morin.1998@free.fr>
  3. Date: Tue, 26 Sep 2023 20:31:17 +0200
  4. Subject: [PATCH] src/egl_gbm_render_surface: properly fallback to surface with
  5. no modifier
  6. In 869fa7fcfbeb, we added a fallback to be able to create an EGL sruface
  7. when the driver do not support modifiers, like the llvmpipe software
  8. renderer (or like some proprietary drivers, like the MALI ones), as
  9. reported in #269 [0].
  10. However, in c6537673c9b6, there was a big overhaul of renderer
  11. infrastructure. That commit lost the with-modifiers code path and only
  12. kept the without-modifiers fallback one (i.e. it only kept the call to
  13. gbm_surface_create(), not to gbm_surface_create_with_modifiers()).
  14. Then in b0d09f5032a4, the with-modifier code path was re-instated, but
  15. in a way that made it exclusive with the without-modifiers one. That is,
  16. the without-modifiers code path was not a fallback to when the other
  17. failed.
  18. Re-instate the fallback mechanism as intiially implemented.
  19. [0] https://github.com/ardera/flutter-pi/issues/269
  20. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
  21. Upstream: https://github.com/ardera/flutter-pi/pull/367
  22. ---
  23. src/egl_gbm_render_surface.c | 6 ++++--
  24. 1 file changed, 4 insertions(+), 2 deletions(-)
  25. diff --git a/src/egl_gbm_render_surface.c b/src/egl_gbm_render_surface.c
  26. index ce9e5e7..8a58667 100644
  27. --- a/src/egl_gbm_render_surface.c
  28. +++ b/src/egl_gbm_render_surface.c
  29. @@ -146,6 +146,7 @@ static int egl_gbm_render_surface_init(
  30. }
  31. #endif
  32. + gbm_surface = NULL;
  33. if (allowed_modifiers != NULL) {
  34. gbm_surface = gbm_surface_create_with_modifiers(
  35. gbm_device,
  36. @@ -158,9 +159,10 @@ static int egl_gbm_render_surface_init(
  37. if (gbm_surface == NULL) {
  38. ok = errno;
  39. LOG_ERROR("Couldn't create GBM surface for rendering. gbm_surface_create_with_modifiers: %s\n", strerror(ok));
  40. - return ok;
  41. + LOG_ERROR("Will retry without modifiers\n");
  42. }
  43. - } else {
  44. + }
  45. + if (gbm_surface == NULL) {
  46. gbm_surface = gbm_surface_create(
  47. gbm_device,
  48. size.x,
  49. --
  50. 2.25.1