summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/vdpau/ftab.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/vdpau/ftab.c')
-rw-r--r--src/gallium/state_trackers/vdpau/ftab.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/vdpau/ftab.c b/src/gallium/state_trackers/vdpau/ftab.c
index 81d16ec306a..2c84554cf83 100644
--- a/src/gallium/state_trackers/vdpau/ftab.c
+++ b/src/gallium/state_trackers/vdpau/ftab.c
@@ -26,6 +26,9 @@
**************************************************************************/
#include <assert.h>
+
+#include "util/u_memory.h"
+
#include "vdpau_private.h"
static void* ftab[67] =
@@ -104,19 +107,31 @@ static void* ftab_winsys[1] =
&vlVdpPresentationQueueTargetCreateX11 /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 */
};
+static void* ftab_driver[2] =
+{
+ &vlVdpVideoSurfaceGallium, /* VDP_FUNC_ID_SURFACE_GALLIUM */
+ &vlVdpOutputSurfaceGallium /* VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM */
+};
+
boolean vlGetFuncFTAB(VdpFuncId function_id, void **func)
{
assert(func);
+ *func = NULL;
+
if (function_id < VDP_FUNC_ID_BASE_WINSYS) {
- if (function_id > 66)
- return FALSE;
- *func = ftab[function_id];
- }
- else {
+ if (function_id < Elements(ftab))
+ *func = ftab[function_id];
+
+ } else if (function_id < VDP_FUNC_ID_BASE_DRIVER) {
function_id -= VDP_FUNC_ID_BASE_WINSYS;
- if (function_id > 0)
- return FALSE;
- *func = ftab_winsys[function_id];
+ if (function_id < Elements(ftab_winsys))
+ *func = ftab_winsys[function_id];
+
+ } else {
+ function_id -= VDP_FUNC_ID_BASE_DRIVER;
+ if (function_id < Elements(ftab_driver))
+ *func = ftab_driver[function_id];
}
+
return *func != NULL;
}