# HG changeset patch # User iive # Date 1171885099 0 # Node ID f979aa12d8ccb5fc4dce52180311e7c60b5b6540 # Parent 3a30fc845a9ce90ae85e130939e893900aaabe42 Don't free and then allocate surfaces when config() is called again with same resolution and format. In this case properly clean surfaces from locking flags and empty the queue. diff -r 3a30fc845a9c -r f979aa12d8cc libvo/vo_xvmc.c --- a/libvo/vo_xvmc.c Mon Feb 19 10:48:50 2007 +0000 +++ b/libvo/vo_xvmc.c Mon Feb 19 11:38:19 2007 +0000 @@ -55,6 +55,7 @@ static int top_field_first; static int image_width,image_height; +static int image_format; static uint32_t drwX,drwY; #define NO_SUBPICTURE 0 @@ -108,6 +109,7 @@ }; static void xvmc_free(void); +static void xvmc_clean_surfaces(void); static int count_free_surfaces(); static xvmc_render_state_t * find_free_surface(); @@ -450,6 +452,10 @@ // Find free port that supports MC, by querying adaptors if( xv_port != 0 || number_of_surfaces != 0 ){ + if( height==image_height && width==image_width && image_format==format){ + xvmc_clean_surfaces(); + goto skip_surface_allocation; + } xvmc_free(); }; numblocks=((width+15)/16)*((height+15)/16); @@ -604,6 +610,8 @@ image_height = height; image_width = width; +skip_surface_allocation: + vo_mouse_autohide = 1; #ifdef HAVE_XF86VM @@ -752,6 +760,7 @@ first_frame = 1; vo_directrendering = 1;//ugly hack, coz xvmc works only with direct rendering + image_format=format; return 0; } @@ -1326,6 +1335,23 @@ return NULL; } +static void xvmc_clean_surfaces(void){ +int i; + + for(i=0; i