logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0003-video-out-gpu-Prevent-empty-array-when-no-compilers-.patch (2820B)


  1. From 13ced625d99b119bde0bb207a6b2ace7098f3880 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Wed, 3 Jul 2019 02:21:16 -0700
  4. Subject: [PATCH] video/out/gpu: Prevent empty array when no compilers or
  5. contexts are enabled
  6. ---
  7. video/out/gpu/context.c | 11 ++++++-----
  8. 1 file changed, 6 insertions(+), 5 deletions(-)
  9. diff --git a/video/out/gpu/context.c b/video/out/gpu/context.c
  10. index 88d4f4232d..5630c81f88 100644
  11. --- a/video/out/gpu/context.c
  12. +++ b/video/out/gpu/context.c
  13. @@ -115,6 +115,7 @@ static const struct ra_ctx_fns *contexts[] = {
  14. #if HAVE_DMABUF_WAYLAND
  15. &ra_ctx_wldmabuf,
  16. #endif
  17. + NULL
  18. };
  19. static int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt,
  20. @@ -122,7 +123,7 @@ static int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt,
  21. {
  22. mp_info(log, "GPU APIs (contexts):\n");
  23. mp_info(log, " auto (autodetect)\n");
  24. - for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++) {
  25. + for (int n = 0; n < MP_ARRAY_SIZE(contexts) - 1; n++) {
  26. if (!contexts[n]->hidden)
  27. mp_info(log, " %s (%s)\n", contexts[n]->type, contexts[n]->name);
  28. }
  29. @@ -134,7 +135,7 @@ static inline OPT_STRING_VALIDATE_FUNC(ra_ctx_validate_api)
  30. struct bstr param = bstr0(*value);
  31. if (bstr_equals0(param, "auto"))
  32. return 1;
  33. - for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) {
  34. + for (int i = 0; i < MP_ARRAY_SIZE(contexts) - 1; i++) {
  35. if (bstr_equals0(param, contexts[i]->type) && !contexts[i]->hidden)
  36. return 1;
  37. }
  38. @@ -146,7 +147,7 @@ static int ra_ctx_context_help(struct mp_log *log, const struct m_option *opt,
  39. {
  40. mp_info(log, "GPU contexts (APIs):\n");
  41. mp_info(log, " auto (autodetect)\n");
  42. - for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++) {
  43. + for (int n = 0; n < MP_ARRAY_SIZE(contexts) - 1; n++) {
  44. if (!contexts[n]->hidden)
  45. mp_info(log, " %s (%s)\n", contexts[n]->name, contexts[n]->type);
  46. }
  47. @@ -158,7 +159,7 @@ static inline OPT_STRING_VALIDATE_FUNC(ra_ctx_validate_context)
  48. struct bstr param = bstr0(*value);
  49. if (bstr_equals0(param, "auto"))
  50. return 1;
  51. - for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) {
  52. + for (int i = 0; i < MP_ARRAY_SIZE(contexts) - 1; i++) {
  53. if (bstr_equals0(param, contexts[i]->name) && !contexts[i]->hidden)
  54. return 1;
  55. }
  56. @@ -182,7 +183,7 @@ struct ra_ctx *ra_ctx_create(struct vo *vo, struct ra_ctx_opts opts)
  57. bool old_probing = vo->probing;
  58. vo->probing = opts.probing;
  59. - for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) {
  60. + for (int i = 0; i < MP_ARRAY_SIZE(contexts) - 1; i++) {
  61. if (contexts[i]->hidden)
  62. continue;
  63. if (!opts.probing && strcmp(contexts[i]->name, opts.context_name) != 0)
  64. --
  65. 2.44.0