summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2009-07-08 07:50:40 +0000
committerAustin Yuan <shengquan.yuan@intel.com>2009-07-08 17:42:05 +0800
commitc00a20b3c19b90f7f9fbd4007e02ba4ce20e975b (patch)
tree18844a6d49f397303d5fa92877ef21b6d085d0b6 /src
parent3cc18d820a60748c1c19fa5f4a388d9c05013392 (diff)
downloadlibva-c00a20b3c19b90f7f9fbd4007e02ba4ce20e975b.tar.gz
Fix va_DisplayContextGetDriverName() to check for LIBVA_DRIVER_NAME first.
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/x11/va_x11.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c
index 1e53401..cfb88be 100644
--- a/src/x11/va_x11.c
+++ b/src/x11/va_x11.c
@@ -206,30 +206,23 @@ static VAStatus va_DisplayContextGetDriverName (
int driver_minor;
int driver_patch;
Bool result = True;
- char *x_driver_name = NULL;
+ char *driver_name_env;
if (driver_name)
*driver_name = NULL;
-
- vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name);
- if (vaStatus != VA_STATUS_SUCCESS)
- vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name);
- if ((vaStatus == VA_STATUS_SUCCESS)
+ if ((driver_name_env = getenv("LIBVA_DRIVER_NAME")) != NULL
&& geteuid() == getuid())
{
/* don't allow setuid apps to use LIBVA_DRIVER_NAME */
- if (getenv("LIBVA_DRIVER_NAME"))
- {
- /* For easier debugging */
- if (*driver_name)
- XFree(*driver_name);
-
- *driver_name = strdup(getenv("LIBVA_DRIVER_NAME"));
- return VA_STATUS_SUCCESS;
- }
+ *driver_name = strdup(driver_name_env);
+ return VA_STATUS_SUCCESS;
}
-
+
+ vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name);
+ if (vaStatus != VA_STATUS_SUCCESS)
+ vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name);
+
return vaStatus;
}