From dc44507f2ad9d6301557d32d41a87cee6e6ae934 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 6 May 2009 00:17:21 +0300 Subject: vo_vdpau: Add template file for VDPAU functions Add a template file that contains a single listing of various information needed about the VDPAU interface functions, and is then included multiple times to create required declarations and tables. Previously some of the information needed to be duplicated for each of those uses. --- TOOLS/vdpau_functions.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 TOOLS/vdpau_functions.py (limited to 'TOOLS') diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py new file mode 100644 index 0000000000..386d70ab33 --- /dev/null +++ b/TOOLS/vdpau_functions.py @@ -0,0 +1,56 @@ +# Generate vdpau_template.c + +functions = """ +# get_error_string should be first, because the function lookup loop should +# have it available to print errors for other functions +get_error_string + +bitmap_surface_create +bitmap_surface_destroy +bitmap_surface_put_bits_native +decoder_create +decoder_destroy +decoder_render +device_destroy +generate_csc_matrix GenerateCSCMatrix # CSC completely capitalized +output_surface_create +output_surface_destroy +output_surface_put_bits_indexed +output_surface_put_bits_native +output_surface_render_bitmap_surface +output_surface_render_output_surface +presentation_queue_block_until_surface_idle +presentation_queue_create +presentation_queue_destroy +presentation_queue_display +presentation_queue_target_create_x11 +presentation_queue_target_destroy +video_mixer_create +video_mixer_destroy +video_mixer_render +video_mixer_set_attribute_values +video_mixer_set_feature_enables +video_surface_create +video_surface_destroy +video_surface_put_bits_y_cb_cr +""" + +print(""" +/* List the VDPAU functions used by MPlayer. + * Generated by vdpau_functions.py. + * First argument on each line is the VDPAU function type name, + * second macro name needed to get function address, + * third name MPlayer uses for the function. + */ +""") +for line in functions.splitlines(): + parts = line.split('#')[0].strip().split() + if not parts: + continue # empty/comment line + if len(parts) > 1: + mp_name, vdpau_name = parts + else: + mp_name = parts[0] + vdpau_name = ''.join(part.capitalize() for part in mp_name.split('_')) + macro_name = mp_name.upper() + print('VDP_FUNCTION(Vdp%s, VDP_FUNC_ID_%s, %s)' % (vdpau_name, macro_name, mp_name)) -- cgit v1.2.3 From d9cea6a98b1f0879c163e198061f1380c5ee8432 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 2 Sep 2009 20:21:24 +0300 Subject: vo_vdpau: Allocate one large surface for EOSD content Create a single large bitmap surface for EOSD objects and pack all the bitmap rectangles inside that. The old code created a separate bitmap surface for every bitmap and then resized the cached surfaces when drawing later frames. The number of surfaces could be large (at least about 2000 for one sample subtitle script) so this was very inefficient. The old code also used a very simple strategy for pairing existing surfaces to new bitmaps; it could resize tiny surfaces to hold large glyphs while using existing large surfaces to hold tiny glyphs and as a result allocate arbitrarily much more total surface area than was necessary. The new code only supports using a single surface, freeing it and allocating a larger one if necessary. It would be possible to support multiple surfaces in case of hitting the maximum bitmap surface size, but I'll wait to see if that is actually needed before implementing it. NVIDIA seems to support bitmap surface sizes up to 8192x8192, so it would take either a really pathological subtitle script rendered at a high resolution or an implementation with lower limits before multiple surfaces would be necessary. The packing algorithm should successfully pack the bitmaps into a surface of size w*h as long as the total area of the bitmaps does not exceed 16/17 (w-max_bitmap_width)*(h-max_bitmap_height), so there should be no totally catastrophic failure cases. The 16/17 factor comes from approximate sorting used in the algorithm. On average performance should be better than this minimum guaranteed level. --- TOOLS/vdpau_functions.py | 1 + 1 file changed, 1 insertion(+) (limited to 'TOOLS') diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py index 386d70ab33..84e79d647b 100644 --- a/TOOLS/vdpau_functions.py +++ b/TOOLS/vdpau_functions.py @@ -8,6 +8,7 @@ get_error_string bitmap_surface_create bitmap_surface_destroy bitmap_surface_put_bits_native +bitmap_surface_query_capabilities decoder_create decoder_destroy decoder_render -- cgit v1.2.3 From 3b3dfc02ac28283345ec90ade8e0e6e64b672147 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 7 Sep 2009 02:02:24 +0300 Subject: vo_vdpau: Support recovering from VDPAU display preemption Add code to reinitialize all VDPAU objects if a display preemption condition occurs. Reinitializing them in the middle of playback will cause video corruption at least until the next keyframe when using hardware decoding, but decoding does seem to recover after a keyframe. --- TOOLS/vdpau_functions.py | 1 + 1 file changed, 1 insertion(+) (limited to 'TOOLS') diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py index 84e79d647b..e628cb00c3 100644 --- a/TOOLS/vdpau_functions.py +++ b/TOOLS/vdpau_functions.py @@ -20,6 +20,7 @@ output_surface_put_bits_indexed output_surface_put_bits_native output_surface_render_bitmap_surface output_surface_render_output_surface +preemption_callback_register presentation_queue_block_until_surface_idle presentation_queue_create presentation_queue_destroy -- cgit v1.2.3