Skip to content

Commit f097811

Browse files
evelikovXinfengZhang
authored andcommitted
drm: remove no longer used helpers
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
1 parent fda9052 commit f097811

File tree

2 files changed

+0
-129
lines changed

2 files changed

+0
-129
lines changed

va/drm/va_drm_utils.c

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,6 @@
3434

3535
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
3636

37-
struct driver_name_map {
38-
const char *key;
39-
const char *name;
40-
};
41-
42-
static const struct driver_name_map g_driver_name_map[] = {
43-
{ "i915", "iHD" }, // Intel Media driver
44-
{ "i915", "i965" }, // Intel OTC GenX driver
45-
{ "pvrsrvkm", "pvr" }, // Intel UMG PVR driver
46-
{ "radeon", "r600" }, // Mesa Gallium driver
47-
{ "radeon", "radeonsi" }, // Mesa Gallium driver
48-
{ "amdgpu", "radeonsi" }, // Mesa Gallium driver
49-
{ "WSL", "d3d12" }, // Mesa Gallium driver
50-
{ "nvidia-drm", "nvidia" }, // NVIDIA driver
51-
{ NULL, NULL }
52-
};
53-
5437
static char *
5538
va_DRM_GetDrmDriverName(int fd)
5639
{
@@ -66,92 +49,6 @@ va_DRM_GetDrmDriverName(int fd)
6649
return driver_name;
6750
}
6851

69-
/* Returns the VA driver candidate num for the active display*/
70-
VAStatus
71-
VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates)
72-
{
73-
struct drm_state * const drm_state = ctx->drm_state;
74-
int count = 0;
75-
const struct driver_name_map *m = NULL;
76-
char *driver_name;
77-
78-
if (!drm_state || drm_state->fd < 0)
79-
return VA_STATUS_ERROR_INVALID_DISPLAY;
80-
81-
driver_name = va_DRM_GetDrmDriverName(drm_state->fd);
82-
if (!driver_name)
83-
return VA_STATUS_ERROR_UNKNOWN;
84-
85-
for (m = g_driver_name_map; m->key != NULL; m++) {
86-
if (strcmp(m->key, driver_name) == 0) {
87-
count ++;
88-
}
89-
}
90-
91-
free(driver_name);
92-
93-
/*
94-
* If the drm driver name does not have a mapped vaapi driver name, then
95-
* assume they have the same name.
96-
*/
97-
if (count == 0)
98-
count = 1;
99-
100-
*num_candidates = count;
101-
return VA_STATUS_SUCCESS;
102-
}
103-
104-
/* Returns the VA driver name for the active display */
105-
VAStatus
106-
VA_DRM_GetDriverName(VADriverContextP ctx, char **driver_name_ptr, int candidate_index)
107-
{
108-
struct drm_state * const drm_state = ctx->drm_state;
109-
const struct driver_name_map *m;
110-
int current_index = 0;
111-
112-
*driver_name_ptr = NULL;
113-
114-
if (!drm_state || drm_state->fd < 0)
115-
return VA_STATUS_ERROR_INVALID_DISPLAY;
116-
117-
*driver_name_ptr = va_DRM_GetDrmDriverName(drm_state->fd);
118-
119-
if (!*driver_name_ptr)
120-
return VA_STATUS_ERROR_UNKNOWN;
121-
122-
/* Map vgem to WSL2 for Windows subsystem for linux */
123-
struct utsname sysinfo = {};
124-
if (!strncmp(*driver_name_ptr, "vgem", 4) && uname(&sysinfo) >= 0 &&
125-
strstr(sysinfo.release, "WSL")) {
126-
free(*driver_name_ptr);
127-
*driver_name_ptr = strdup("WSL");
128-
}
129-
130-
for (m = g_driver_name_map; m->key != NULL; m++) {
131-
if (strcmp(m->key, *driver_name_ptr) == 0) {
132-
if (current_index == candidate_index) {
133-
break;
134-
}
135-
current_index ++;
136-
}
137-
}
138-
139-
/*
140-
* If the drm driver name does not have a mapped vaapi driver name, then
141-
* assume they have the same name.
142-
*/
143-
if (!m->name)
144-
return VA_STATUS_SUCCESS;
145-
146-
/* Use the mapped vaapi driver name */
147-
free(*driver_name_ptr);
148-
*driver_name_ptr = strdup(m->name);
149-
if (!*driver_name_ptr)
150-
return VA_STATUS_ERROR_ALLOCATION_FAILED;
151-
152-
return VA_STATUS_SUCCESS;
153-
}
154-
15552
/* Returns the VA driver names and how many they are, for the active display */
15653
VAStatus
15754
VA_DRM_GetDriverNames(VADriverContextP ctx, char **drivers, unsigned *num_drivers)

va/drm/va_drm_utils.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,6 @@
4242
extern "C" {
4343
#endif
4444

45-
DLL_HIDDEN
46-
VAStatus
47-
VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates);
48-
49-
/**
50-
* \brief Returns the VA driver name for the active display.
51-
*
52-
* This functions returns a newly allocated buffer in @driver_name_ptr that
53-
* contains the VA driver name for the active display. Active display means
54-
* the display obtained with any of the vaGetDisplay*() functions.
55-
*
56-
* The VADriverContext.drm_state structure must be valid, i.e. allocated
57-
* and containing an open DRM connection descriptor. The DRM connection
58-
* does *not* need to be authenticated as it only performs a call to
59-
* drmGetVersion().
60-
*
61-
* @param[in] ctx the pointer to a VADriverContext
62-
* @param[out] driver_name_ptr the newly allocated buffer containing
63-
* the VA driver name
64-
* @return VA_STATUS_SUCCESS if operation is successful, or another
65-
* #VAStatus value otherwise.
66-
*/
67-
DLL_HIDDEN
68-
VAStatus
69-
VA_DRM_GetDriverName(VADriverContextP ctx, char **driver_name_ptr, int candidate_index);
70-
7145
DLL_HIDDEN
7246
VAStatus
7347
VA_DRM_GetDriverNames(VADriverContextP ctx, char **drivers, unsigned *num_drivers);

0 commit comments

Comments
 (0)