Skip to content

Commit

Permalink
drm: remove no longer used helpers
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 b652415 commit 00a2cb1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 118 deletions.
92 changes: 0 additions & 92 deletions va/drm/va_drm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,6 @@
#include "va_drm_utils.h"
#include "va_drmcommon.h"

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

static const struct driver_name_map g_driver_name_map[] = {
{ "i915", "iHD" }, // Intel Media driver
{ "i915", "i965" }, // Intel OTC GenX driver
{ "pvrsrvkm", "pvr" }, // Intel UMG PVR driver
{ "radeon", "r600" }, // Mesa Gallium driver
{ "radeon", "radeonsi" }, // Mesa Gallium driver
{ "amdgpu", "radeonsi" }, // Mesa Gallium driver
{ "nvidia-drm", "nvidia" }, // NVIDIA driver
{ NULL, NULL }
};

static char *
va_DRM_GetDrmDriverName(int fd)
{
Expand All @@ -62,82 +46,6 @@ va_DRM_GetDrmDriverName(int fd)
return driver_name;
}

/* Returns the VA driver candidate num for the active display*/
VAStatus
VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates)
{
struct drm_state * const drm_state = ctx->drm_state;
int count = 0;
const struct driver_name_map *m = NULL;
char *driver_name;

if (!drm_state || drm_state->fd < 0)
return VA_STATUS_ERROR_INVALID_DISPLAY;

driver_name = va_DRM_GetDrmDriverName(drm_state->fd);
if (!driver_name)
return VA_STATUS_ERROR_UNKNOWN;

for (m = g_driver_name_map; m->key != NULL; m++) {
if (strcmp(m->key, driver_name) == 0) {
count ++;
}
}

free(driver_name);

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

*num_candidates = count;
return VA_STATUS_SUCCESS;
}

/* Returns the VA driver name for the active display */
VAStatus
VA_DRM_GetDriverName(VADriverContextP ctx, char **driver_name_ptr, int candidate_index)
{
struct drm_state * const drm_state = ctx->drm_state;
const struct driver_name_map *m;
int current_index = 0;

*driver_name_ptr = NULL;

if (!drm_state || drm_state->fd < 0)
return VA_STATUS_ERROR_INVALID_DISPLAY;

*driver_name_ptr = va_DRM_GetDrmDriverName(drm_state->fd);
if (!*driver_name_ptr)
return VA_STATUS_ERROR_UNKNOWN;

for (m = g_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 drm 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;
}

/* Returns the VA driver names and how many they are, for the active display */
VAStatus
Expand Down
26 changes: 0 additions & 26 deletions va/drm/va_drm_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,6 @@
extern "C" {
#endif

DLL_HIDDEN
VAStatus
VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates);

/**
* \brief Returns the VA driver name for the active display.
*
* This functions returns a newly allocated buffer in @driver_name_ptr that
* contains the VA driver name for the active display. Active display means
* the display obtained with any of the vaGetDisplay*() functions.
*
* The VADriverContext.drm_state structure must be valid, i.e. allocated
* and containing an open DRM connection descriptor. The DRM connection
* does *not* need to be authenticated as it only performs a call to
* drmGetVersion().
*
* @param[in] ctx the pointer to a VADriverContext
* @param[out] driver_name_ptr the newly allocated buffer containing
* the VA driver name
* @return VA_STATUS_SUCCESS if operation is successful, or another
* #VAStatus value otherwise.
*/
DLL_HIDDEN
VAStatus
VA_DRM_GetDriverName(VADriverContextP ctx, char **driver_name_ptr, int candidate_index);

DLL_HIDDEN
VAStatus
VA_DRM_GetDriverNames(VADriverContextP ctx, char **drivers, unsigned *num_drivers);
Expand Down

0 comments on commit 00a2cb1

Please sign in to comment.