Commit a2523fec authored by Gwenole Beauchesne's avatar Gwenole Beauchesne Committed by Austin Yuan

Fix NVIDIA driver detection.

Signed-off-by: default avatarAustin Yuan <shengquan.yuan@intel.com>
parent 3e118290
......@@ -25,6 +25,6 @@ noinst_LTLIBRARIES = libva_x11.la
libva_x11includedir = ${includedir}/va
libva_x11include_HEADERS = va_x11.h va_dri.h va_dri2.h va_dricommon.h
libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c
libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c
EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h
EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h
This diff is collapsed.
/*
* Copyright (c) 2008 NVIDIA, Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef VA_NVCTRLLIB_H
#define VA_NVCTRLLIB_H
#include <X11/Xlib.h>
Bool VA_NVCTRLQueryDirectRenderingCapable( Display *dpy, int screen,
Bool *isCapable );
Bool VA_NVCTRLGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName );
#endif /* VA_NVCTRLLIB_H */
......@@ -30,6 +30,7 @@
#include "va_dri.h"
#include "va_dri2.h"
#include "va_dricommon.h"
#include "va_nvctrl.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
......@@ -125,6 +126,57 @@ static VAStatus va_DRIGetDriverName (
return VA_STATUS_SUCCESS;
}
static VAStatus va_NVCTRL_GetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
int direct_capable;
int driver_major;
int driver_minor;
int driver_patch;
Bool result = True;
char *nvidia_driver_name = NULL;
if (result)
{
result = VA_NVCTRLQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen, &direct_capable);
if (!result)
{
va_errorMessage("VA_NVCTRLQueryDirectRenderingCapable failed\n");
}
}
if (result)
{
result = direct_capable;
if (!result)
{
va_errorMessage("VA_NVCTRLQueryDirectRenderingCapable returned false\n");
}
}
if (result)
{
result = VA_NVCTRLGetClientDriverName(ctx->x11_dpy, ctx->x11_screen, &driver_major, &driver_minor,
&driver_patch, &nvidia_driver_name);
if (!result)
{
va_errorMessage("VA_NVCTRLGetClientDriverName returned false\n");
}
}
if (result)
{
vaStatus = VA_STATUS_SUCCESS;
va_infoMessage("va_NVCTRL_GetDriverName: %d.%d.%d %s (screen %d)\n",
driver_major, driver_minor, driver_patch,
nvidia_driver_name, ctx->x11_screen);
if (driver_name)
*driver_name = nvidia_driver_name;
}
return vaStatus;
}
static VAStatus va_DisplayContextGetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
......@@ -147,6 +199,8 @@ static VAStatus va_DisplayContextGetDriverName (
vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name);
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name);
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name);
return vaStatus;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment