libraries/libvdpau: Revert a951d7375f

This is better not to be included, as nvidia people are
including thingies with the newer releases of their driver
that made this stuff not work anymore.

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
ponce 2012-08-21 17:52:14 +02:00 committed by Robby Workman
parent 8dc7eb1c91
commit 93f7e66986
3 changed files with 1 additions and 676 deletions

View File

@ -24,7 +24,7 @@
PRGNAM=libvdpau
VERSION=0.4.1
BUILD=${BUILD:-2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -65,10 +65,6 @@ cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# apply a patch from git and another for buggy flash
patch -p1 < $CWD/patches/vdpau_wrapper_c.patch
patch -p1 < $CWD/patches/0001-vdpau_trace-WAR-Flash-quirks.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \

View File

@ -1,492 +0,0 @@
From 079bd445d1fed5e12772a28142c916b1510fe848 Mon Sep 17 00:00:00 2001
From: Pierre-Loup A. Griffais <git@plagman.net>
Date: Tue, 10 Jan 2012 18:41:37 -0800
Subject: [PATCH] vdpau_trace: WAR Flash quirks
This stubs out all the tracing routines but two; one to ignore calls to
set_background_color to ignore Flash setting the colorkey to black. The other
wrapped function is put_bits_y_cb_cr, to swap the U and V planes as Flash sends
them to us in the wrong order.
---
trace/vdpau_trace.cpp | 411 +------------------------------------------------
1 files changed, 6 insertions(+), 405 deletions(-)
diff --git a/trace/vdpau_trace.cpp b/trace/vdpau_trace.cpp
index 821209a..3e74882 100644
--- a/trace/vdpau_trace.cpp
+++ b/trace/vdpau_trace.cpp
@@ -1822,60 +1822,19 @@ static VdpStatus _vdp_cap_video_surface_put_bits_y_cb_cr(
)
{
VdpStatus ret;
+ void* swapped_source_data[3];
- _VdpcapPlane planes[3];
- uint32_t plane_count = _VDP_TRACE_ARSIZE(planes);
- bool dump_data = _vdp_cap_init_planes(
- surface,
- source_data,
- source_pitches,
- 0,
- &plane_count,
- planes,
- _vdp_cap_init_planes_adapt_surface_video,
- _vdp_cap_init_planes_adapt_format_bits_ycbcr,
- source_ycbcr_format
- );
- if (!dump_data) {
- plane_count = 0;
- }
-
- fputs("vdp_video_surface_put_bits_y_cb_cr(", _vdp_cap_data.fp);
- if (_vdp_cap_data.level >= LEVEL_PARAMS) {
- fprintf(
- _vdp_cap_data.fp,
- "%u, %u, ",
- surface,
- source_ycbcr_format
- );
- _vdp_cap_dump_void_pointer_list(plane_count, source_data, true);
- fputs(", ", _vdp_cap_data.fp);
- _vdp_cap_dump_uint32_t_list(plane_count, source_pitches, true);
- fputs(", ", _vdp_cap_data.fp);
- }
- fputs(")\n", _vdp_cap_data.fp);
- if (_vdp_cap_data.level >= LEVEL_DATA) {
- fputs(" ... Data: ", _vdp_cap_data.fp);
- if (dump_data) {
- _vdp_cap_dump_plane_list(plane_count, planes);
- }
- else {
- fputs("???", _vdp_cap_data.fp);
- }
- fputs("\n", _vdp_cap_data.fp);
- }
+ swapped_source_data[0] = (void*)source_data[0];
+ swapped_source_data[1] = (void*)source_data[2];
+ swapped_source_data[2] = (void*)source_data[1];
ret = _vdp_cap_data.vdp_video_surface_put_bits_y_cb_cr(
surface,
source_ycbcr_format,
- source_data,
+ swapped_source_data,
source_pitches
);
- if (_vdp_cap_data.level >= LEVEL_PARAMS) {
- fprintf(_vdp_cap_data.fp, " -> %d\n", ret);
- }
-
return ret;
}
@@ -3863,29 +3822,7 @@ static VdpStatus _vdp_cap_presentation_queue_set_background_color(
VdpColor * const background_color
)
{
- VdpStatus ret;
-
- fputs("vdp_presentation_queue_set_background_color(", _vdp_cap_data.fp);
- if (_vdp_cap_data.level >= LEVEL_PARAMS) {
- fprintf(
- _vdp_cap_data.fp,
- "%u, ",
- presentation_queue
- );
- _vdp_cap_dump_color(background_color);
- }
- fputs(")\n", _vdp_cap_data.fp);
-
- ret = _vdp_cap_data.vdp_presentation_queue_set_background_color(
- presentation_queue,
- background_color
- );
-
- if (_vdp_cap_data.level >= LEVEL_PARAMS) {
- fprintf(_vdp_cap_data.fp, " -> %d\n", ret);
- }
-
- return ret;
+ return VDP_STATUS_OK;
}
static VdpStatus _vdp_cap_presentation_queue_get_background_color(
@@ -4139,18 +4076,6 @@ static VdpStatus _vdp_cap_presentation_queue_target_create_x11(
{
VdpStatus ret;
- fprintf(_vdp_cap_data.fp, "vdp_presentation_queue_target_create_x11(");
- if (_vdp_cap_data.level >= LEVEL_PARAMS) {
- fprintf(
- _vdp_cap_data.fp,
- "%u, %lu, %s",
- device,
- drawable,
- target ? "-" : "NULL"
- );
- }
- fputs(")\n", _vdp_cap_data.fp);
-
ret = _vdp_cap_data.vdp_presentation_queue_target_create_x11(
device,
drawable,
@@ -4182,18 +4107,6 @@ static VdpStatus _vdp_cap_get_proc_address(
{
VdpStatus ret;
- fputs("vdp_get_proc_address(", _vdp_cap_data.fp);
- if (_vdp_cap_data.level >= LEVEL_PARAMS) {
- fprintf(
- _vdp_cap_data.fp,
- "%u, %u, %s",
- device,
- function_id,
- function_pointer ? "-" : "NULL"
- );
- }
- fputs(")\n", _vdp_cap_data.fp);
-
if (device != _vdp_cap_data.vdp_device) {
_VDP_TRACE_ERROR_BREAKPOINT();
ret = VDP_STATUS_ERROR;
@@ -4207,317 +4120,17 @@ static VdpStatus _vdp_cap_get_proc_address(
*function_pointer = 0;
switch (function_id) {
- case VDP_FUNC_ID_GET_ERROR_STRING:
- if (_vdp_cap_data.vdp_get_error_string) {
- *function_pointer = (void *)&_vdp_cap_get_error_string;
- }
- break;
- case VDP_FUNC_ID_GET_PROC_ADDRESS:
- if (_vdp_cap_data.vdp_get_proc_address) {
- *function_pointer = (void *)&_vdp_cap_get_proc_address;
- }
- break;
- case VDP_FUNC_ID_GET_API_VERSION:
- if (_vdp_cap_data.vdp_get_api_version) {
- *function_pointer = (void *)&_vdp_cap_get_api_version;
- }
- break;
- case VDP_FUNC_ID_GET_INFORMATION_STRING:
- if (_vdp_cap_data.vdp_get_information_string) {
- *function_pointer = (void *)&_vdp_cap_get_information_string;
- }
- break;
- case VDP_FUNC_ID_DEVICE_DESTROY:
- if (_vdp_cap_data.vdp_device_destroy) {
- *function_pointer = (void *)&_vdp_cap_device_destroy;
- }
- break;
- case VDP_FUNC_ID_GENERATE_CSC_MATRIX:
- if (_vdp_cap_data.vdp_generate_csc_matrix) {
- *function_pointer = (void *)&_vdp_cap_generate_csc_matrix;
- }
- break;
- case VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES:
- if (_vdp_cap_data.vdp_video_surface_query_capabilities) {
- *function_pointer = (void *)&_vdp_cap_video_surface_query_capabilities;
- }
- break;
- case VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES:
- if (_vdp_cap_data.vdp_video_surface_query_get_put_bits_y_cb_cr_capabilities) {
- *function_pointer = (void *)&_vdp_cap_video_surface_query_get_put_bits_y_cb_cr_capabilities;
- }
- break;
- case VDP_FUNC_ID_VIDEO_SURFACE_CREATE:
- if (_vdp_cap_data.vdp_video_surface_create) {
- *function_pointer = (void *)&_vdp_cap_video_surface_create;
- }
- break;
- case VDP_FUNC_ID_VIDEO_SURFACE_DESTROY:
- if (_vdp_cap_data.vdp_video_surface_destroy) {
- *function_pointer = (void *)&_vdp_cap_video_surface_destroy;
- }
- break;
- case VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS:
- if (_vdp_cap_data.vdp_video_surface_get_parameters) {
- *function_pointer = (void *)&_vdp_cap_video_surface_get_parameters;
- }
- break;
- case VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR:
- if (_vdp_cap_data.vdp_video_surface_get_bits_y_cb_cr) {
- *function_pointer = (void *)&_vdp_cap_video_surface_get_bits_y_cb_cr;
- }
- break;
case VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR:
if (_vdp_cap_data.vdp_video_surface_put_bits_y_cb_cr) {
*function_pointer = (void *)&_vdp_cap_video_surface_put_bits_y_cb_cr;
}
break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES:
- if (_vdp_cap_data.vdp_output_surface_query_capabilities) {
- *function_pointer = (void *)&_vdp_cap_output_surface_query_capabilities;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES:
- if (_vdp_cap_data.vdp_output_surface_query_get_put_bits_native_capabilities) {
- *function_pointer = (void *)&_vdp_cap_output_surface_query_get_put_bits_native_capabilities;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES:
- if (_vdp_cap_data.vdp_output_surface_query_put_bits_indexed_capabilities) {
- *function_pointer = (void *)&_vdp_cap_output_surface_query_put_bits_indexed_capabilities;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES:
- if (_vdp_cap_data.vdp_output_surface_query_put_bits_y_cb_cr_capabilities) {
- *function_pointer = (void *)&_vdp_cap_output_surface_query_put_bits_y_cb_cr_capabilities;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_CREATE:
- if (_vdp_cap_data.vdp_output_surface_create) {
- *function_pointer = (void *)&_vdp_cap_output_surface_create;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY:
- if (_vdp_cap_data.vdp_output_surface_destroy) {
- *function_pointer = (void *)&_vdp_cap_output_surface_destroy;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS:
- if (_vdp_cap_data.vdp_output_surface_get_parameters) {
- *function_pointer = (void *)&_vdp_cap_output_surface_get_parameters;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE:
- if (_vdp_cap_data.vdp_output_surface_get_bits_native) {
- *function_pointer = (void *)&_vdp_cap_output_surface_get_bits_native;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE:
- if (_vdp_cap_data.vdp_output_surface_put_bits_native) {
- *function_pointer = (void *)&_vdp_cap_output_surface_put_bits_native;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED:
- if (_vdp_cap_data.vdp_output_surface_put_bits_indexed) {
- *function_pointer = (void *)&_vdp_cap_output_surface_put_bits_indexed;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR:
- if (_vdp_cap_data.vdp_output_surface_put_bits_y_cb_cr) {
- *function_pointer = (void *)&_vdp_cap_output_surface_put_bits_y_cb_cr;
- }
- break;
- case VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES:
- if (_vdp_cap_data.vdp_bitmap_surface_query_capabilities) {
- *function_pointer = (void *)&_vdp_cap_bitmap_surface_query_capabilities;
- }
- break;
- case VDP_FUNC_ID_BITMAP_SURFACE_CREATE:
- if (_vdp_cap_data.vdp_bitmap_surface_create) {
- *function_pointer = (void *)&_vdp_cap_bitmap_surface_create;
- }
- break;
- case VDP_FUNC_ID_BITMAP_SURFACE_DESTROY:
- if (_vdp_cap_data.vdp_bitmap_surface_destroy) {
- *function_pointer = (void *)&_vdp_cap_bitmap_surface_destroy;
- }
- break;
- case VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS:
- if (_vdp_cap_data.vdp_bitmap_surface_get_parameters) {
- *function_pointer = (void *)&_vdp_cap_bitmap_surface_get_parameters;
- }
- break;
- case VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE:
- if (_vdp_cap_data.vdp_bitmap_surface_put_bits_native) {
- *function_pointer = (void *)&_vdp_cap_bitmap_surface_put_bits_native;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE:
- if (_vdp_cap_data.vdp_output_surface_render_output_surface) {
- *function_pointer = (void *)&_vdp_cap_output_surface_render_output_surface;
- }
- break;
- case VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE:
- if (_vdp_cap_data.vdp_output_surface_render_bitmap_surface) {
- *function_pointer = (void *)&_vdp_cap_output_surface_render_bitmap_surface;
- }
- break;
- case VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES:
- if (_vdp_cap_data.vdp_decoder_query_capabilities) {
- *function_pointer = (void *)&_vdp_cap_decoder_query_capabilities;
- }
- break;
- case VDP_FUNC_ID_DECODER_CREATE:
- if (_vdp_cap_data.vdp_decoder_create) {
- *function_pointer = (void *)&_vdp_cap_decoder_create;
- }
- break;
- case VDP_FUNC_ID_DECODER_DESTROY:
- if (_vdp_cap_data.vdp_decoder_destroy) {
- *function_pointer = (void *)&_vdp_cap_decoder_destroy;
- }
- break;
- case VDP_FUNC_ID_DECODER_GET_PARAMETERS:
- if (_vdp_cap_data.vdp_decoder_get_parameters) {
- *function_pointer = (void *)&_vdp_cap_decoder_get_parameters;
- }
- break;
- case VDP_FUNC_ID_DECODER_RENDER:
- if (_vdp_cap_data.vdp_decoder_render) {
- *function_pointer = (void *)&_vdp_cap_decoder_render;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT:
- if (_vdp_cap_data.vdp_video_mixer_query_feature_support) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_query_feature_support;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT:
- if (_vdp_cap_data.vdp_video_mixer_query_parameter_support) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_query_parameter_support;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT:
- if (_vdp_cap_data.vdp_video_mixer_query_attribute_support) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_query_attribute_support;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE:
- if (_vdp_cap_data.vdp_video_mixer_query_parameter_value_range) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_query_parameter_value_range;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE:
- if (_vdp_cap_data.vdp_video_mixer_query_attribute_value_range) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_query_attribute_value_range;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_CREATE:
- if (_vdp_cap_data.vdp_video_mixer_create) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_create;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES:
- if (_vdp_cap_data.vdp_video_mixer_set_feature_enables) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_set_feature_enables;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES:
- if (_vdp_cap_data.vdp_video_mixer_set_attribute_values) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_set_attribute_values;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT:
- if (_vdp_cap_data.vdp_video_mixer_get_feature_support) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_get_feature_support;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES:
- if (_vdp_cap_data.vdp_video_mixer_get_feature_enables) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_get_feature_enables;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES:
- if (_vdp_cap_data.vdp_video_mixer_get_parameter_values) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_get_parameter_values;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES:
- if (_vdp_cap_data.vdp_video_mixer_get_attribute_values) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_get_attribute_values;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_DESTROY:
- if (_vdp_cap_data.vdp_video_mixer_destroy) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_destroy;
- }
- break;
- case VDP_FUNC_ID_VIDEO_MIXER_RENDER:
- if (_vdp_cap_data.vdp_video_mixer_render) {
- *function_pointer = (void *)&_vdp_cap_video_mixer_render;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY:
- if (_vdp_cap_data.vdp_presentation_queue_target_destroy) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_target_destroy;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE:
- if (_vdp_cap_data.vdp_presentation_queue_create) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_create;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY:
- if (_vdp_cap_data.vdp_presentation_queue_destroy) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_destroy;
- }
- break;
case VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR:
if (_vdp_cap_data.vdp_presentation_queue_set_background_color) {
*function_pointer = (void *)&_vdp_cap_presentation_queue_set_background_color;
}
break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR:
- if (_vdp_cap_data.vdp_presentation_queue_get_background_color) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_get_background_color;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME:
- if (_vdp_cap_data.vdp_presentation_queue_get_time) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_get_time;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY:
- if (_vdp_cap_data.vdp_presentation_queue_display) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_display;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE:
- if (_vdp_cap_data.vdp_presentation_queue_block_until_surface_idle) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_block_until_surface_idle;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS:
- if (_vdp_cap_data.vdp_presentation_queue_query_surface_status) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_query_surface_status;
- }
- break;
- case VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER:
- if (_vdp_cap_data.vdp_preemption_callback_register) {
- *function_pointer = (void *)&_vdp_cap_preemption_callback_register;
- }
- break;
- case VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11:
- if (_vdp_cap_data.vdp_presentation_queue_target_create_x11) {
- *function_pointer = (void *)&_vdp_cap_presentation_queue_target_create_x11;
- }
- break;
default:
- fprintf(
- _vdp_cap_data.fp,
- "VDPAU capture: Not able to proxy function %d",
- function_id
- );
ret = _vdp_cap_data.vdp_get_proc_address(device, function_id, function_pointer);
break;
}
@@ -4527,18 +4140,6 @@ static VdpStatus _vdp_cap_get_proc_address(
}
}
- if (_vdp_cap_data.level >= LEVEL_PARAMS) {
- fprintf(_vdp_cap_data.fp, " -> %d", ret);
- if (ret == VDP_STATUS_OK) {
- fprintf(
- _vdp_cap_data.fp,
- ", %p",
- *function_pointer
- );
- }
- fputs("\n", _vdp_cap_data.fp);
- }
-
return ret;
}
--
1.7.4.1

View File

@ -1,179 +0,0 @@
From 4262513e67c3572ed19bd796ec6180cdde7ccb7e Mon Sep 17 00:00:00 2001
From: Kiran Pawar <kpawar@nvidia.com>
Date: Fri, 05 Aug 2011 06:15:18 +0000
Subject: vdpau_wrapper.c: Track dynamic library handles and free them on exit using __attribute__((destructor))
Signed-off-by: Kiran Pawar <kpawar@nvidia.com>
Tested-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
---
diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c
index f504775..23de3d4 100644
--- a/src/vdpau_wrapper.c
+++ b/src/vdpau_wrapper.c
@@ -40,6 +40,17 @@ typedef void SetDllHandle(
void * driver_dll_handle
);
+static void * _vdp_backend_dll;
+static void * _vdp_trace_dll;
+static void * _vdp_driver_dll;
+static VdpDeviceCreateX11 * _vdp_imp_device_create_x11_proc;
+
+#if defined(__GNUC__)
+
+static void _vdp_close_driver(void) __attribute__((destructor));
+
+#endif
+
#if DEBUG
static void _vdp_wrapper_error_breakpoint(char const * file, int line, char const * function)
@@ -87,23 +98,16 @@ static char * _vdp_get_driver_name_from_dri2(
return driver_name;
}
-VdpStatus vdp_device_create_x11(
+static VdpStatus _vdp_open_driver(
Display * display,
- int screen,
- /* output parameters follow */
- VdpDevice * device,
- VdpGetProcAddress * * get_proc_address
-)
+ int screen)
{
char const * vdpau_driver;
char * vdpau_driver_dri2 = NULL;
char vdpau_driver_lib[PATH_MAX];
- void * backend_dll;
char const * vdpau_trace;
char const * func_name;
- VdpDeviceCreateX11 * vdp_imp_device_create_x11;
-
vdpau_driver = getenv("VDPAU_DRIVER");
if (!vdpau_driver) {
vdpau_driver = vdpau_driver_dri2 =
@@ -125,13 +129,13 @@ VdpStatus vdp_device_create_x11(
return VDP_STATUS_NO_IMPLEMENTATION;
}
- backend_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
- if (!backend_dll) {
+ _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
+ if (!_vdp_driver_dll) {
/* Try again using the old path, which is guaranteed to fit in PATH_MAX
* if the complete path fit above. */
snprintf(vdpau_driver_lib, sizeof(vdpau_driver_lib), DRIVER_LIB_FORMAT,
"", vdpau_driver, "");
- backend_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
+ _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
}
if (vdpau_driver_dri2) {
@@ -139,26 +143,28 @@ VdpStatus vdp_device_create_x11(
vdpau_driver_dri2 = NULL;
}
- if (!backend_dll) {
+ if (!_vdp_driver_dll) {
fprintf(stderr, "Failed to open VDPAU backend %s\n", dlerror());
_VDP_ERROR_BREAKPOINT();
return VDP_STATUS_NO_IMPLEMENTATION;
}
+ _vdp_backend_dll = _vdp_driver_dll;
+
vdpau_trace = getenv("VDPAU_TRACE");
if (vdpau_trace && atoi(vdpau_trace)) {
- void * trace_dll;
SetDllHandle * set_dll_handle;
- trace_dll = dlopen(VDPAU_MODULEDIR "/libvdpau_trace.so.1", RTLD_NOW | RTLD_GLOBAL);
- if (!trace_dll) {
+ _vdp_trace_dll = dlopen(VDPAU_MODULEDIR "/libvdpau_trace.so.1",
+ RTLD_NOW | RTLD_GLOBAL);
+ if (!_vdp_trace_dll) {
fprintf(stderr, "Failed to open VDPAU trace library %s\n", dlerror());
_VDP_ERROR_BREAKPOINT();
return VDP_STATUS_NO_IMPLEMENTATION;
}
set_dll_handle = (SetDllHandle*)dlsym(
- trace_dll,
+ _vdp_trace_dll,
"vdp_trace_set_backend_handle"
);
if (!set_dll_handle) {
@@ -167,9 +173,9 @@ VdpStatus vdp_device_create_x11(
return VDP_STATUS_NO_IMPLEMENTATION;
}
- set_dll_handle(backend_dll);
+ set_dll_handle(_vdp_backend_dll);
- backend_dll = trace_dll;
+ _vdp_backend_dll = _vdp_trace_dll;
func_name = "vdp_trace_device_create_x11";
}
@@ -177,17 +183,52 @@ VdpStatus vdp_device_create_x11(
func_name = "vdp_imp_device_create_x11";
}
- vdp_imp_device_create_x11 = (VdpDeviceCreateX11*)dlsym(
- backend_dll,
+ _vdp_imp_device_create_x11_proc = (VdpDeviceCreateX11*)dlsym(
+ _vdp_backend_dll,
func_name
);
- if (!vdp_imp_device_create_x11) {
+ if (!_vdp_imp_device_create_x11_proc) {
fprintf(stderr, "%s\n", dlerror());
_VDP_ERROR_BREAKPOINT();
return VDP_STATUS_NO_IMPLEMENTATION;
}
- return vdp_imp_device_create_x11(
+ return VDP_STATUS_OK;
+}
+
+static void _vdp_close_driver(void)
+{
+ if (_vdp_driver_dll) {
+ dlclose(_vdp_driver_dll);
+ _vdp_driver_dll = NULL;
+ }
+ if (_vdp_trace_dll) {
+ dlclose(_vdp_trace_dll);
+ _vdp_trace_dll = NULL;
+ }
+ _vdp_backend_dll = NULL;
+ _vdp_imp_device_create_x11_proc = NULL;
+}
+
+VdpStatus vdp_device_create_x11(
+ Display * display,
+ int screen,
+ /* output parameters follow */
+ VdpDevice * device,
+ VdpGetProcAddress * * get_proc_address
+)
+{
+ VdpStatus status;
+
+ if (!_vdp_imp_device_create_x11_proc) {
+ status = _vdp_open_driver(display, screen);
+ if (status != VDP_STATUS_OK) {
+ _vdp_close_driver();
+ return status;
+ }
+ }
+
+ return _vdp_imp_device_create_x11_proc(
display,
screen,
device,
--
cgit v0.9.0.2-2-gbebe