Skip to content

Commit fda9052

Browse files
evelikovXinfengZhang
authored andcommitted
x11: remove legacy code paths
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
1 parent 3ac96ad commit fda9052

File tree

7 files changed

+0
-239
lines changed

7 files changed

+0
-239
lines changed

va/x11/va_dri3.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -128,34 +128,6 @@ va_isDRI3Connected(VADriverContextP ctx, int *outfd)
128128
return 0;
129129
}
130130

131-
VAStatus va_DRI3_GetNumCandidates(
132-
VADisplayContextP pDisplayContext,
133-
int *num_candidates
134-
)
135-
{
136-
VADriverContextP const ctx = pDisplayContext->pDriverContext;
137-
struct drm_state * drm_state = (struct drm_state *)ctx->drm_state;
138-
int fd = -1;
139-
140-
if (va_isDRI3Connected(ctx, &fd) && fd != -1)
141-
return VA_STATUS_ERROR_UNKNOWN;
142-
143-
drm_state->fd = fd;
144-
drm_state->auth_type = VA_DRM_AUTH_CUSTOM;
145-
return VA_DRM_GetNumCandidates(ctx, num_candidates);
146-
}
147-
148-
VAStatus va_DRI3_GetDriverName(
149-
VADisplayContextP pDisplayContext,
150-
char **driver_name,
151-
int candidate_index
152-
)
153-
{
154-
VADriverContextP const ctx = pDisplayContext->pDriverContext;
155-
156-
return VA_DRM_GetDriverName(ctx, driver_name, candidate_index);
157-
}
158-
159131
VAStatus va_DRI3_GetDriverNames(
160132
VADisplayContextP pDisplayContext,
161133
char **drivers,

va/x11/va_dri3.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,6 @@
3636
#include "sysdeps.h"
3737
#include "va_backend.h"
3838

39-
DLL_HIDDEN
40-
VAStatus va_DRI3_GetNumCandidates(
41-
VADisplayContextP pDisplayContext,
42-
int *num_candidates
43-
);
44-
45-
DLL_HIDDEN
46-
VAStatus va_DRI3_GetDriverName(
47-
VADisplayContextP pDisplayContext,
48-
char **driver_name_ptr,
49-
int candidate_index
50-
);
51-
5239
DLL_HIDDEN
5340
VAStatus va_DRI3_GetDriverNames(
5441
VADisplayContextP pDisplayContext,

va/x11/va_fglrx.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -238,26 +238,6 @@ static Bool VA_FGLRXGetClientDriverName(Display *dpy, int screen, char **clientD
238238
return success;
239239
}
240240

241-
VAStatus va_FGLRX_GetDriverName(
242-
VADisplayContextP pDisplayContext,
243-
char **driver_name,
244-
int candidate_index
245-
)
246-
{
247-
VADriverContextP ctx = pDisplayContext->pDriverContext;
248-
Bool result;
249-
250-
if (candidate_index != 0)
251-
return VA_STATUS_ERROR_INVALID_PARAMETER;
252-
253-
result = VA_FGLRXGetClientDriverName(ctx->native_dpy, ctx->x11_screen,
254-
driver_name);
255-
if (!result)
256-
return VA_STATUS_ERROR_UNKNOWN;
257-
258-
return VA_STATUS_SUCCESS;
259-
}
260-
261241
VAStatus va_FGLRX_GetDriverNames(
262242
VADisplayContextP pDisplayContext,
263243
char **drivers,

va/x11/va_fglrx.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@
3030
#include <X11/Xlib.h>
3131
#include "va_backend.h"
3232

33-
DLL_HIDDEN
34-
VAStatus va_FGLRX_GetDriverName(
35-
VADisplayContextP pDisplayContext,
36-
char **driver_name,
37-
int candidate_index
38-
);
39-
4033
DLL_HIDDEN
4134
VAStatus va_FGLRX_GetDriverNames(
4235
VADisplayContextP pDisplayContext,

va/x11/va_nvctrl.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -397,32 +397,6 @@ static Bool VA_NVCTRLGetClientDriverName(Display *dpy, int screen,
397397
return True;
398398
}
399399

400-
VAStatus va_NVCTRL_GetDriverName(
401-
VADisplayContextP pDisplayContext,
402-
char **driver_name,
403-
int candidate_index
404-
)
405-
{
406-
VADriverContextP ctx = pDisplayContext->pDriverContext;
407-
int direct_capable;
408-
Bool result;
409-
410-
if (candidate_index != 0)
411-
return VA_STATUS_ERROR_INVALID_PARAMETER;
412-
413-
result = VA_NVCTRLQueryDirectRenderingCapable(ctx->native_dpy, ctx->x11_screen,
414-
&direct_capable);
415-
if (!result || !direct_capable)
416-
return VA_STATUS_ERROR_UNKNOWN;
417-
418-
result = VA_NVCTRLGetClientDriverName(ctx->native_dpy, ctx->x11_screen,
419-
driver_name);
420-
if (!result)
421-
return VA_STATUS_ERROR_UNKNOWN;
422-
423-
return VA_STATUS_SUCCESS;
424-
}
425-
426400
VAStatus va_NVCTRL_GetDriverNames(
427401
VADisplayContextP pDisplayContext,
428402
char **drivers,

va/x11/va_nvctrl.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@
2929
#include <X11/Xlib.h>
3030
#include "va_backend.h"
3131

32-
DLL_HIDDEN
33-
VAStatus va_NVCTRL_GetDriverName(
34-
VADisplayContextP pDisplayContext,
35-
char **driver_name,
36-
int candidate_index
37-
);
38-
3932
DLL_HIDDEN
4033
VAStatus va_NVCTRL_GetDriverNames(
4134
VADisplayContextP pDisplayContext,

va/x11/va_x11.c

Lines changed: 0 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,6 @@
4646
#include <fcntl.h>
4747
#include <errno.h>
4848

49-
struct driver_name_map {
50-
const char *key;
51-
const char *name;
52-
};
53-
54-
static const struct driver_name_map g_dri2_driver_name_map[] = {
55-
{ "i965", "iHD" }, // Intel iHD VAAPI driver with i965 DRI driver
56-
{ "i965", "i965" }, // Intel i965 VAAPI driver with i965 DRI driver
57-
{ "iris", "iHD" }, // Intel iHD VAAPI driver with iris DRI driver
58-
{ "iris", "i965" }, // Intel i965 VAAPI driver with iris DRI driver
59-
{ "crocus", "i965" }, // Intel i965 VAAPI driver with crocus DRI driver
60-
{ NULL, NULL }
61-
};
62-
6349
static void va_DisplayContextDestroy(
6450
VADisplayContextP pDisplayContext
6551
)
@@ -84,128 +70,6 @@ static void va_DisplayContextDestroy(
8470
free(pDisplayContext);
8571
}
8672

87-
static VAStatus va_DRI2_GetNumCandidates(
88-
VADisplayContextP pDisplayContext,
89-
int *num_candidates
90-
)
91-
{
92-
char *driver_name = NULL;
93-
const struct driver_name_map *m = NULL;
94-
VADriverContextP ctx = pDisplayContext->pDriverContext;
95-
96-
*num_candidates = 0;
97-
98-
if (!(va_isDRI2Connected(ctx, &driver_name) && driver_name))
99-
return VA_STATUS_ERROR_UNKNOWN;
100-
101-
for (m = g_dri2_driver_name_map; m->key != NULL; m++) {
102-
if (strcmp(m->key, driver_name) == 0) {
103-
(*num_candidates)++;
104-
}
105-
}
106-
107-
free(driver_name);
108-
109-
/*
110-
* If the dri2 driver name does not have a mapped vaapi driver name, then
111-
* assume they have the same name.
112-
*/
113-
if (*num_candidates == 0)
114-
*num_candidates = 1;
115-
116-
return VA_STATUS_SUCCESS;
117-
}
118-
119-
static VAStatus va_DRI2_GetDriverName(
120-
VADisplayContextP pDisplayContext,
121-
char **driver_name_ptr,
122-
int candidate_index
123-
)
124-
{
125-
const struct driver_name_map *m = NULL;
126-
int current_index = 0;
127-
VADriverContextP ctx = pDisplayContext->pDriverContext;
128-
129-
*driver_name_ptr = NULL;
130-
131-
if (!(va_isDRI2Connected(ctx, driver_name_ptr) && *driver_name_ptr))
132-
return VA_STATUS_ERROR_UNKNOWN;
133-
134-
for (m = g_dri2_driver_name_map; m->key != NULL; m++) {
135-
if (strcmp(m->key, *driver_name_ptr) == 0) {
136-
if (current_index == candidate_index) {
137-
break;
138-
}
139-
current_index++;
140-
}
141-
}
142-
143-
/*
144-
* If the dri2 driver name does not have a mapped vaapi driver name, then
145-
* assume they have the same name.
146-
*/
147-
if (!m->name)
148-
return VA_STATUS_SUCCESS;
149-
150-
/* Use the mapped vaapi driver name */
151-
free(*driver_name_ptr);
152-
*driver_name_ptr = strdup(m->name);
153-
if (!*driver_name_ptr)
154-
return VA_STATUS_ERROR_ALLOCATION_FAILED;
155-
156-
return VA_STATUS_SUCCESS;
157-
}
158-
159-
static VAStatus va_DisplayContextGetDriverName(
160-
VADisplayContextP pDisplayContext,
161-
char **driver_name, int candidate_index
162-
)
163-
{
164-
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
165-
166-
if (driver_name)
167-
*driver_name = NULL;
168-
else
169-
return VA_STATUS_ERROR_UNKNOWN;
170-
171-
if (!getenv("LIBVA_DRI3_DISABLE"))
172-
vaStatus = va_DRI3_GetDriverName(pDisplayContext, driver_name, candidate_index);
173-
if (vaStatus != VA_STATUS_SUCCESS)
174-
vaStatus = va_DRI2_GetDriverName(pDisplayContext, driver_name, candidate_index);
175-
#ifdef HAVE_NVCTRL
176-
if (vaStatus != VA_STATUS_SUCCESS)
177-
vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name, candidate_index);
178-
#endif
179-
#ifdef HAVE_FGLRX
180-
if (vaStatus != VA_STATUS_SUCCESS)
181-
vaStatus = va_FGLRX_GetDriverName(pDisplayContext, driver_name, candidate_index);
182-
#endif
183-
184-
return vaStatus;
185-
}
186-
187-
static VAStatus va_DisplayContextGetNumCandidates(
188-
VADisplayContextP pDisplayContext,
189-
int *num_candidates
190-
)
191-
{
192-
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
193-
194-
if (!getenv("LIBVA_DRI3_DISABLE"))
195-
vaStatus = va_DRI3_GetNumCandidates(pDisplayContext, num_candidates);
196-
if (vaStatus != VA_STATUS_SUCCESS)
197-
vaStatus = va_DRI2_GetNumCandidates(pDisplayContext, num_candidates);
198-
199-
/* A call to va_DisplayContextGetDriverName will fallback to other
200-
* methods (i.e. NVCTRL, FGLRX) when DRI2 is unsuccessful. All of those
201-
* fallbacks only have 1 candidate driver.
202-
*/
203-
if (vaStatus != VA_STATUS_SUCCESS)
204-
*num_candidates = 1;
205-
206-
return VA_STATUS_SUCCESS;
207-
}
208-
20973
static VAStatus va_DisplayContextGetDriverNames(
21074
VADisplayContextP pDisplayContext,
21175
char **drivers, unsigned *num_drivers
@@ -245,8 +109,6 @@ VADisplay vaGetDisplay(
245109
return NULL;
246110

247111
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
248-
pDisplayContext->vaGetNumCandidates = va_DisplayContextGetNumCandidates;
249-
pDisplayContext->vaGetDriverNameByIndex = va_DisplayContextGetDriverName;
250112
pDisplayContext->vaGetDriverNames = va_DisplayContextGetDriverNames;
251113

252114
pDriverContext = va_newDriverContext(pDisplayContext);

0 commit comments

Comments
 (0)