hardware/intel/libva
Revision | 3741b212147709a6127266de69a8b73dc1fd3409 (tree) |
---|---|
Zeit | 2013-06-19 15:34:12 |
Autor | Fei Jiang <fei.jiang@inte...> |
Commiter | Xiang, Haihao |
LIBVA_DRIVER_NAME still needs va_getDriverName to open DRM device
va_getDriverName is bypassed when LIBVA_DRIVER_NAME is set, but driver
needs DRM device fd which is only opened in va_getDriverName
Change-Id: I4fe11edf9d8c328806255d4c93313cf99655a91d
Signed-off-by: Fei Jiang <fei.jiang@intel.com>
(cherry picked from commit 04706eb13ae410b53b6b38150413d544b7fdb524)
@@ -449,24 +449,30 @@ VAStatus vaInitialize ( | ||
449 | 449 | |
450 | 450 | va_infoMessage("VA-API version %s\n", VA_VERSION_S); |
451 | 451 | |
452 | + vaStatus = va_getDriverName(dpy, &driver_name); | |
453 | + va_infoMessage("va_getDriverName() returns %d\n", vaStatus); | |
454 | + | |
452 | 455 | driver_name_env = getenv("LIBVA_DRIVER_NAME"); |
453 | - if (driver_name_env && geteuid() == getuid()) { | |
456 | + if ((VA_STATUS_SUCCESS == vaStatus) && | |
457 | + driver_name_env && (geteuid() == getuid())) { | |
454 | 458 | /* Don't allow setuid apps to use LIBVA_DRIVER_NAME */ |
459 | + if (driver_name) /* memory is allocated in va_getDriverName */ | |
460 | + free(driver_name); | |
461 | + | |
455 | 462 | driver_name = strdup(driver_name_env); |
456 | 463 | vaStatus = VA_STATUS_SUCCESS; |
457 | 464 | va_infoMessage("User requested driver '%s'\n", driver_name); |
458 | - } else { | |
459 | - vaStatus = va_getDriverName(dpy, &driver_name); | |
460 | - va_infoMessage("va_getDriverName() returns %d\n", vaStatus); | |
461 | 465 | } |
462 | 466 | |
463 | - if (VA_STATUS_SUCCESS == vaStatus) { | |
467 | + if ((VA_STATUS_SUCCESS == vaStatus) && (driver_name != NULL)) { | |
464 | 468 | vaStatus = va_openDriver(dpy, driver_name); |
465 | 469 | va_infoMessage("va_openDriver() returns %d\n", vaStatus); |
466 | 470 | |
467 | 471 | *major_version = VA_MAJOR_VERSION; |
468 | 472 | *minor_version = VA_MINOR_VERSION; |
469 | - } | |
473 | + } else | |
474 | + va_errorMessage("va_getDriverName() failed with %s,driver_name=%s\n", | |
475 | + vaErrorStr(vaStatus), driver_name); | |
470 | 476 | |
471 | 477 | if (driver_name) |
472 | 478 | free(driver_name); |