31
31
#include "va_drm_utils.h"
32
32
#include "va_drmcommon.h"
33
33
34
- struct driver_name_map {
35
- const char * key ;
36
- const char * name ;
37
- };
38
-
39
- static const struct driver_name_map g_driver_name_map [] = {
40
- { "i915" , "iHD" }, // Intel Media driver
41
- { "i915" , "i965" }, // Intel OTC GenX driver
42
- { "pvrsrvkm" , "pvr" }, // Intel UMG PVR driver
43
- { "radeon" , "r600" }, // Mesa Gallium driver
44
- { "radeon" , "radeonsi" }, // Mesa Gallium driver
45
- { "amdgpu" , "radeonsi" }, // Mesa Gallium driver
46
- { "nvidia-drm" , "nvidia" }, // NVIDIA driver
47
- { NULL , NULL }
48
- };
49
-
50
34
static char *
51
35
va_DRM_GetDrmDriverName (int fd )
52
36
{
@@ -62,82 +46,6 @@ va_DRM_GetDrmDriverName(int fd)
62
46
return driver_name ;
63
47
}
64
48
65
- /* Returns the VA driver candidate num for the active display*/
66
- VAStatus
67
- VA_DRM_GetNumCandidates (VADriverContextP ctx , int * num_candidates )
68
- {
69
- struct drm_state * const drm_state = ctx -> drm_state ;
70
- int count = 0 ;
71
- const struct driver_name_map * m = NULL ;
72
- char * driver_name ;
73
-
74
- if (!drm_state || drm_state -> fd < 0 )
75
- return VA_STATUS_ERROR_INVALID_DISPLAY ;
76
-
77
- driver_name = va_DRM_GetDrmDriverName (drm_state -> fd );
78
- if (!driver_name )
79
- return VA_STATUS_ERROR_UNKNOWN ;
80
-
81
- for (m = g_driver_name_map ; m -> key != NULL ; m ++ ) {
82
- if (strcmp (m -> key , driver_name ) == 0 ) {
83
- count ++ ;
84
- }
85
- }
86
-
87
- free (driver_name );
88
-
89
- /*
90
- * If the drm driver name does not have a mapped vaapi driver name, then
91
- * assume they have the same name.
92
- */
93
- if (count == 0 )
94
- count = 1 ;
95
-
96
- * num_candidates = count ;
97
- return VA_STATUS_SUCCESS ;
98
- }
99
-
100
- /* Returns the VA driver name for the active display */
101
- VAStatus
102
- VA_DRM_GetDriverName (VADriverContextP ctx , char * * driver_name_ptr , int candidate_index )
103
- {
104
- struct drm_state * const drm_state = ctx -> drm_state ;
105
- const struct driver_name_map * m ;
106
- int current_index = 0 ;
107
-
108
- * driver_name_ptr = NULL ;
109
-
110
- if (!drm_state || drm_state -> fd < 0 )
111
- return VA_STATUS_ERROR_INVALID_DISPLAY ;
112
-
113
- * driver_name_ptr = va_DRM_GetDrmDriverName (drm_state -> fd );
114
- if (!* driver_name_ptr )
115
- return VA_STATUS_ERROR_UNKNOWN ;
116
-
117
- for (m = g_driver_name_map ; m -> key != NULL ; m ++ ) {
118
- if (strcmp (m -> key , * driver_name_ptr ) == 0 ) {
119
- if (current_index == candidate_index ) {
120
- break ;
121
- }
122
- current_index ++ ;
123
- }
124
- }
125
-
126
- /*
127
- * If the drm driver name does not have a mapped vaapi driver name, then
128
- * assume they have the same name.
129
- */
130
- if (!m -> name )
131
- return VA_STATUS_SUCCESS ;
132
-
133
- /* Use the mapped vaapi driver name */
134
- free (* driver_name_ptr );
135
- * driver_name_ptr = strdup (m -> name );
136
- if (!* driver_name_ptr )
137
- return VA_STATUS_ERROR_ALLOCATION_FAILED ;
138
-
139
- return VA_STATUS_SUCCESS ;
140
- }
141
49
142
50
/* Returns the VA driver names and how many they are, for the active display */
143
51
VAStatus
0 commit comments