# HG changeset patch # User reimar # Date 1303455428 0 # Node ID 2f560e3611756ba8851bfd7d4dc3333fb3635fba # Parent 5d84566f91433a633f7fcacfa7c21ab36bcd01a9 Quick hack to fix compilation. Testing and improvements welcome. diff -r 5d84566f9143 -r 2f560e361175 libvo/vo_xvmc.c --- a/libvo/vo_xvmc.c Fri Apr 22 06:36:16 2011 +0000 +++ b/libvo/vo_xvmc.c Fri Apr 22 06:57:08 2011 +0000 @@ -95,6 +95,13 @@ #define MAX_SURFACES 8 static int number_of_surfaces=0; static XvMCSurface surface_array[MAX_SURFACES]; +static struct render_info { +#define STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */ +#define STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */ +#define STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */ + int state; + void *p_osd_target_surface_render; +} surface_render_info[MAX_SURFACES]; static struct xvmc_pix_fmt *surface_render; static struct xvmc_pix_fmt *p_render_surface_to_show = NULL; @@ -147,6 +154,16 @@ #endif XvImage * xvimage; +static struct render_info *get_render_info(struct xvmc_pix_fmt *cur_render) +{ + int idx; + if (!surface_render || !cur_render) + return NULL; + idx = cur_render - surface_render; + if (idx < 0 || idx >= MAX_SURFACES) + return NULL; + return surface_render_info + idx; +} static void allocate_xvimage(int xvimage_width,int xvimage_height,int xv_format) { @@ -364,7 +381,7 @@ assert( rndr->xvmc_id == AV_XVMC_ID ); mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: draw_image(show rndr=%p)\n",rndr); // the surface have passed vf system without been skiped, it will be displayed - rndr->state |= AV_XVMC_STATE_DISPLAY_PENDING; + get_render_info(rndr)->state |= STATE_DISPLAY_PENDING; p_render_surface_to_show = rndr; top_field_first = mpi->fields & MP_IMGFIELD_TOP_FIRST; return VO_TRUE; @@ -852,6 +869,7 @@ XvMCSyncSubpicture(mDisplay,&subpicture);//todo usleeep wait! if(subpicture_mode == BLEND_SUBPICTURE){ + struct render_info *info; osd_rndr = find_free_surface(); if(osd_rndr == NULL) return;// no free surface to draw OSD in @@ -872,12 +890,14 @@ osd_rndr->picture_structure = p_render_surface_to_show->picture_structure; //add more if needed osd_rndr-> = p_render_surface_to_show->; - p_render_surface_to_show->state &= ~AV_XVMC_STATE_DISPLAY_PENDING; - p_render_surface_to_show->state |= AV_XVMC_STATE_OSD_SOURCE; - p_render_surface_to_show->p_osd_target_surface_render = osd_rndr; + info = get_render_info(p_render_surface_to_show); + info->state &= ~STATE_DISPLAY_PENDING; + info->state |= STATE_OSD_SOURCE; + info->p_osd_target_surface_render = osd_rndr; p_render_surface_to_show = osd_rndr; - p_render_surface_to_show->state = AV_XVMC_STATE_DISPLAY_PENDING; + info = get_render_info(p_render_surface_to_show); + info->state = STATE_DISPLAY_PENDING; mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc:draw_osd: surface_to_show changed to %p\n",osd_rndr); }//endof if(BLEND) @@ -979,9 +999,9 @@ //the visible surface won't be displayed anymore, mark it as free if(p_render_surface_visible != NULL) - p_render_surface_visible->state &= ~AV_XVMC_STATE_DISPLAY_PENDING; + get_render_info(p_render_surface_visible)->state &= ~STATE_DISPLAY_PENDING; -//!!fixme assert(p_render_surface_to_show->state & AV_XVMC_STATE_DISPLAY_PENDING); +//!!fixme assert(p_render_surface_to_show->state & STATE_DISPLAY_PENDING); //show it, displaying is always vsynced, so skip it for benchmark put_xvmc_image(p_render_surface_to_show,first_frame); @@ -1027,10 +1047,10 @@ XvMCHideSurface(mDisplay,&surface_array[i]);//it doesn't hurt, I hope XvMCDestroySurface(mDisplay,&surface_array[i]); - if( (surface_render[i].state != 0) && + if( (surface_render_info[i].state != 0) && (p_render_surface_visible != &surface_render[i]) ) mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc::uninit surface_render[%d].status=%d\n",i, - surface_render[i].state); + surface_render_info[i].state); } memset(surface_render, 0, MAX_SURFACES * sizeof(struct xvmc_pix_fmt)); //for debugging @@ -1147,12 +1167,12 @@ int stat; //If this is source surface, check does the OSD rendering is compleate - if(src_rndr->state & AV_XVMC_STATE_OSD_SOURCE){ + if(get_render_info(src_rndr)->state & STATE_OSD_SOURCE){ mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: OSD surface=%p querying\n",src_rndr); - osd_rndr = src_rndr->p_osd_target_surface_render; + osd_rndr = get_render_info(src_rndr)->p_osd_target_surface_render; XvMCGetSurfaceStatus(mDisplay, osd_rndr->p_surface, &stat); if(!(stat & XVMC_RENDERING)) - src_rndr->state &= ~AV_XVMC_STATE_OSD_SOURCE; + get_render_info(src_rndr)->state &= ~STATE_OSD_SOURCE; } } static int count_free_surfaces(void) { @@ -1161,7 +1181,7 @@ num=0; for(i=0; ipicture_structure = 0; rndr->flags = 0; - rndr->state = 0; + get_render_info(rndr)->state = 0; rndr->start_mv_blocks_num = 0; rndr->filled_mv_blocks_num = 0; rndr->next_free_data_block_num = 0;