Skip to content

Commit

Permalink
x11: remove legacy code paths
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Velikov <[email protected]>
  • Loading branch information
evelikov committed Feb 6, 2023
1 parent c620701 commit b652415
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 237 deletions.
28 changes: 0 additions & 28 deletions va/x11/va_dri3.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,34 +128,6 @@ va_isDRI3Connected(VADriverContextP ctx, int *outfd)
return 0;
}

VAStatus va_DRI3_GetNumCandidates(
VADisplayContextP pDisplayContext,
int *num_candidates
)
{
VADriverContextP const ctx = pDisplayContext->pDriverContext;
struct drm_state * drm_state = (struct drm_state *)ctx->drm_state;
int fd = -1;

if (va_isDRI3Connected(ctx, &fd) && fd != -1)
return VA_STATUS_ERROR_UNKNOWN;

drm_state->fd = fd;
drm_state->auth_type = VA_DRM_AUTH_CUSTOM;
return VA_DRM_GetNumCandidates(ctx, num_candidates);
}

VAStatus va_DRI3_GetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name,
int candidate_index
)
{
VADriverContextP const ctx = pDisplayContext->pDriverContext;

return VA_DRM_GetDriverName(ctx, driver_name, candidate_index);
}

VAStatus va_DRI3_GetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers,
Expand Down
13 changes: 0 additions & 13 deletions va/x11/va_dri3.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@
#include "sysdeps.h"
#include "va_backend.h"

DLL_HIDDEN
VAStatus va_DRI3_GetNumCandidates(
VADisplayContextP pDisplayContext,
int *num_candidates
);

DLL_HIDDEN
VAStatus va_DRI3_GetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name_ptr,
int candidate_index
);

DLL_HIDDEN
VAStatus va_DRI3_GetDriverNames(
VADisplayContextP pDisplayContext,
Expand Down
20 changes: 0 additions & 20 deletions va/x11/va_fglrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,26 +238,6 @@ static Bool VA_FGLRXGetClientDriverName(Display *dpy, int screen, char **clientD
return success;
}

VAStatus va_FGLRX_GetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name,
int candidate_index
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
Bool result;

if (candidate_index != 0)
return VA_STATUS_ERROR_INVALID_PARAMETER;

result = VA_FGLRXGetClientDriverName(ctx->native_dpy, ctx->x11_screen,
driver_name);
if (!result)
return VA_STATUS_ERROR_UNKNOWN;

return VA_STATUS_SUCCESS;
}

VAStatus va_FGLRX_GetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers,
Expand Down
7 changes: 0 additions & 7 deletions va/x11/va_fglrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
#include <X11/Xlib.h>
#include "va_backend.h"

DLL_HIDDEN
VAStatus va_FGLRX_GetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name,
int candidate_index
);

DLL_HIDDEN
VAStatus va_FGLRX_GetDriverNames(
VADisplayContextP pDisplayContext,
Expand Down
26 changes: 0 additions & 26 deletions va/x11/va_nvctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,32 +397,6 @@ static Bool VA_NVCTRLGetClientDriverName(Display *dpy, int screen,
return True;
}

VAStatus va_NVCTRL_GetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name,
int candidate_index
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
int direct_capable;
Bool result;

if (candidate_index != 0)
return VA_STATUS_ERROR_INVALID_PARAMETER;

result = VA_NVCTRLQueryDirectRenderingCapable(ctx->native_dpy, ctx->x11_screen,
&direct_capable);
if (!result || !direct_capable)
return VA_STATUS_ERROR_UNKNOWN;

result = VA_NVCTRLGetClientDriverName(ctx->native_dpy, ctx->x11_screen,
driver_name);
if (!result)
return VA_STATUS_ERROR_UNKNOWN;

return VA_STATUS_SUCCESS;
}

VAStatus va_NVCTRL_GetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers,
Expand Down
7 changes: 0 additions & 7 deletions va/x11/va_nvctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
#include <X11/Xlib.h>
#include "va_backend.h"

DLL_HIDDEN
VAStatus va_NVCTRL_GetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name,
int candidate_index
);

DLL_HIDDEN
VAStatus va_NVCTRL_GetDriverNames(
VADisplayContextP pDisplayContext,
Expand Down
136 changes: 0 additions & 136 deletions va/x11/va_x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@
#include <fcntl.h>
#include <errno.h>

struct driver_name_map {
const char *key;
const char *name;
};

static const struct driver_name_map g_dri2_driver_name_map[] = {
{ "i965", "iHD" }, // Intel iHD VAAPI driver with i965 DRI driver
{ "i965", "i965" }, // Intel i965 VAAPI driver with i965 DRI driver
{ "iris", "iHD" }, // Intel iHD VAAPI driver with iris DRI driver
{ "iris", "i965" }, // Intel i965 VAAPI driver with iris DRI driver
{ "crocus", "i965" }, // Intel i965 VAAPI driver with crocus DRI driver
{ NULL, NULL }
};

static int va_DisplayContextIsValid(
VADisplayContextP pDisplayContext
)
Expand Down Expand Up @@ -91,126 +77,6 @@ static void va_DisplayContextDestroy(
free(pDisplayContext);
}

static VAStatus va_DRI2_GetNumCandidates(
VADisplayContextP pDisplayContext,
int *num_candidates
)
{
char *driver_name = NULL;
const struct driver_name_map *m = NULL;
VADriverContextP ctx = pDisplayContext->pDriverContext;

*num_candidates = 0;

if (!(va_isDRI2Connected(ctx, &driver_name) && driver_name))
return VA_STATUS_ERROR_UNKNOWN;

for (m = g_dri2_driver_name_map; m->key != NULL; m++) {
if (strcmp(m->key, driver_name) == 0) {
(*num_candidates)++;
}
}

free(driver_name);

/*
* If the dri2 driver name does not have a mapped vaapi driver name, then
* assume they have the same name.
*/
if (*num_candidates == 0)
*num_candidates = 1;

return VA_STATUS_SUCCESS;
}

static VAStatus va_DRI2_GetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name_ptr,
int candidate_index
)
{
const struct driver_name_map *m = NULL;
int current_index = 0;
VADriverContextP ctx = pDisplayContext->pDriverContext;

*driver_name_ptr = NULL;

if (!(va_isDRI2Connected(ctx, driver_name_ptr) && *driver_name_ptr))
return VA_STATUS_ERROR_UNKNOWN;

for (m = g_dri2_driver_name_map; m->key != NULL; m++) {
if (strcmp(m->key, *driver_name_ptr) == 0) {
if (current_index == candidate_index) {
break;
}
current_index++;
}
}

/*
* If the dri2 driver name does not have a mapped vaapi driver name, then
* assume they have the same name.
*/
if (!m->name)
return VA_STATUS_SUCCESS;

/* Use the mapped vaapi driver name */
free(*driver_name_ptr);
*driver_name_ptr = strdup(m->name);
if (!*driver_name_ptr)
return VA_STATUS_ERROR_ALLOCATION_FAILED;

return VA_STATUS_SUCCESS;
}

static VAStatus va_DisplayContextGetDriverName(
VADisplayContextP pDisplayContext,
char **driver_name, int candidate_index
)
{
VAStatus vaStatus;

if (driver_name)
*driver_name = NULL;
else
return VA_STATUS_ERROR_UNKNOWN;

vaStatus = va_DRI3_GetDriverName(pDisplayContext, driver_name, candidate_index);
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_DRI2_GetDriverName(pDisplayContext, driver_name, candidate_index);
#ifdef HAVE_NVCTRL
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name, candidate_index);
#endif
#ifdef HAVE_FGLRX
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_FGLRX_GetDriverName(pDisplayContext, driver_name, candidate_index);
#endif

return vaStatus;
}

static VAStatus va_DisplayContextGetNumCandidates(
VADisplayContextP pDisplayContext,
int *num_candidates
)
{
VAStatus vaStatus;

vaStatus = va_DRI3_GetNumCandidates(pDisplayContext, num_candidates);
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_DRI2_GetNumCandidates(pDisplayContext, num_candidates);

/* A call to va_DisplayContextGetDriverName will fallback to other
* methods (i.e. NVCTRL, FGLRX) when DRI2 is unsuccessful. All of those
* fallbacks only have 1 candidate driver.
*/
if (vaStatus != VA_STATUS_SUCCESS)
*num_candidates = 1;

return VA_STATUS_SUCCESS;
}

static VAStatus va_DisplayContextGetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers, unsigned *num_drivers
Expand Down Expand Up @@ -268,8 +134,6 @@ VADisplay vaGetDisplay(

pDisplayContext->vaIsValid = va_DisplayContextIsValid;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetNumCandidates = va_DisplayContextGetNumCandidates;
pDisplayContext->vaGetDriverNameByIndex = va_DisplayContextGetDriverName;
pDisplayContext->vaGetDriverNames = va_DisplayContextGetDriverNames;

pDriverContext = va_newDriverContext(pDisplayContext);
Expand Down

0 comments on commit b652415

Please sign in to comment.