0001-adjust-call-sequence-to-ensure-authenticate.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From a80d2fe3bcc2c14c6e1434615d1be38924b668ea Mon Sep 17 00:00:00 2001
  2. From: Carl Zhang <carl.zhang@intel.com>
  3. Date: Mon, 30 Dec 2019 04:38:43 -0500
  4. Subject: [PATCH] adjust call sequence to ensure authenticate operation is
  5. executed
  6. fixes #355
  7. Downloaded from upstream PR: https://github.com/intel/libva/pull/356
  8. Signed-off-by: Carl Zhang <carl.zhang@intel.com>
  9. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  10. ---
  11. va/va.c | 25 ++++++++++++++++---------
  12. 1 file changed, 16 insertions(+), 9 deletions(-)
  13. diff --git a/va/va.c b/va/va.c
  14. index cfcabff..7f014a1 100644
  15. --- a/va/va.c
  16. +++ b/va/va.c
  17. @@ -367,11 +367,23 @@ static VAStatus va_getDriverNameByIndex(VADisplay dpy, char **driver_name, int c
  18. VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
  19. const char *driver_name_env = NULL;
  20. VADriverContextP ctx;
  21. + VAStatus status = VA_STATUS_SUCCESS;
  22. ctx = CTX(dpy);
  23. + if (pDisplayContext->vaGetDriverNameByIndex) {
  24. + /*if vaGetDriverNameByIndex is implemented*/
  25. + status = pDisplayContext->vaGetDriverNameByIndex(pDisplayContext, driver_name, candidate_index);
  26. + } else {
  27. + if (candidate_index == 0)
  28. + status = pDisplayContext->vaGetDriverName(pDisplayContext, driver_name);
  29. + else
  30. + status = VA_STATUS_ERROR_INVALID_PARAMETER;
  31. + }
  32. driver_name_env = getenv("LIBVA_DRIVER_NAME");
  33. /*if user set driver name by vaSetDriverName */
  34. if (ctx->override_driver_name){
  35. + if(*driver_name)
  36. + free(*driver_name);
  37. *driver_name = strdup(ctx->override_driver_name);
  38. if (!(*driver_name)) {
  39. va_errorMessage(dpy, "va_getDriverNameByIndex failed with %s, out of memory\n",vaErrorStr(VA_STATUS_ERROR_ALLOCATION_FAILED));
  40. @@ -380,19 +392,14 @@ static VAStatus va_getDriverNameByIndex(VADisplay dpy, char **driver_name, int c
  41. va_infoMessage(dpy, "User requested driver '%s'\n", *driver_name);
  42. return VA_STATUS_SUCCESS;
  43. } else if (driver_name_env && (geteuid() == getuid())) {
  44. + if(*driver_name)
  45. + free(*driver_name);
  46. /*if user set driver name by environment variable*/
  47. *driver_name = strdup(driver_name_env);
  48. va_infoMessage(dpy, "User environment variable requested driver '%s'\n", *driver_name);
  49. return VA_STATUS_SUCCESS;
  50. - } else if (pDisplayContext->vaGetDriverNameByIndex) {
  51. - /*if vaGetDriverNameByIndex is implemented*/
  52. - return pDisplayContext->vaGetDriverNameByIndex(pDisplayContext, driver_name, candidate_index);
  53. - } else {
  54. - if (candidate_index == 0)
  55. - return pDisplayContext->vaGetDriverName(pDisplayContext, driver_name);
  56. - else
  57. - return VA_STATUS_ERROR_INVALID_PARAMETER;
  58. - }
  59. + }
  60. + return status;
  61. }
  62. static char *va_getDriverPath(const char *driver_dir, const char *driver_name)