summaryrefslogtreecommitdiff
path: root/va
diff options
context:
space:
mode:
authorFei Jiang <fei.jiang@intel.com>2013-03-28 04:29:36 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-06-19 14:34:12 +0800
commit3741b212147709a6127266de69a8b73dc1fd3409 (patch)
treee8f5cfdfbbf00f6dc1a457f1fbb6fad84111d9ad /va
parent9171d06d687b1074433650ea137819bbdfd20118 (diff)
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)
Diffstat (limited to 'va')
-rw-r--r--va/va.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/va/va.c b/va/va.c
index 400273e..3358119 100644
--- a/va/va.c
+++ b/va/va.c
@@ -449,24 +449,30 @@ VAStatus vaInitialize (
va_infoMessage("VA-API version %s\n", VA_VERSION_S);
+ vaStatus = va_getDriverName(dpy, &driver_name);
+ va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
+
driver_name_env = getenv("LIBVA_DRIVER_NAME");
- if (driver_name_env && geteuid() == getuid()) {
+ if ((VA_STATUS_SUCCESS == vaStatus) &&
+ driver_name_env && (geteuid() == getuid())) {
/* Don't allow setuid apps to use LIBVA_DRIVER_NAME */
+ if (driver_name) /* memory is allocated in va_getDriverName */
+ free(driver_name);
+
driver_name = strdup(driver_name_env);
vaStatus = VA_STATUS_SUCCESS;
va_infoMessage("User requested driver '%s'\n", driver_name);
- } else {
- vaStatus = va_getDriverName(dpy, &driver_name);
- va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
}
- if (VA_STATUS_SUCCESS == vaStatus) {
+ if ((VA_STATUS_SUCCESS == vaStatus) && (driver_name != NULL)) {
vaStatus = va_openDriver(dpy, driver_name);
va_infoMessage("va_openDriver() returns %d\n", vaStatus);
*major_version = VA_MAJOR_VERSION;
*minor_version = VA_MINOR_VERSION;
- }
+ } else
+ va_errorMessage("va_getDriverName() failed with %s,driver_name=%s\n",
+ vaErrorStr(vaStatus), driver_name);
if (driver_name)
free(driver_name);