[mythtv] [PATCH] XvMC - the segv in videoout_xvmc

Craig Rindy developstuff at qwest.net
Wed Nov 26 02:25:43 EST 2003


This fixes the nVidia/XvMC problem (from the "XvMC crashing - gdb backtrace" thread) for me on the GeForce4 MX440.  Thank you very much; I bought that card specifically for an old system that probably couldn't decode high-quality MPEG-2 by itself.

I quit using the nVidia proprietary drivers with the FX5200Ultra due to an annoying, recurring CPU leak which locked up the X interface, so no more XvMC for that one, but I feel much better running all free software on it (it's my main recorder and viewer -- I can't sit on my ass and wait for some company to decide when a bug should get fixed).

Donkey Kong is my friend.

Steve Brown wrote:
> A few things didn't get deallocated and got the nvidia library confused.
> 
> Not sure I understand the XvMC api yet, but the changes seem to help.
> 
> Steve
> 
> 
> ------------------------------------------------------------------------
> 
> diff -u -r1.16 videoout_xvmc.cpp
> --- libs/libmythtv/videoout_xvmc.cpp	16 Nov 2003 19:08:33 -0000	1.16
> +++ libs/libmythtv/videoout_xvmc.cpp	25 Nov 2003 22:54:00 -0000
> @@ -308,6 +308,8 @@
>  
>      data->XJ_gc = XCreateGC(data->XJ_disp, data->XJ_win, 0, 0);
>      XJ_depth = DefaultDepthOfScreen(data->XJ_screen);
> +    XFlush(data->XJ_disp);
> +    XSync(data->XJ_disp, false);
>  
>      XvImageFormatValues *xvfmv;
>      int num_subpic;
> @@ -412,7 +414,17 @@
>  
>      if (ret != Success)
>      {
> -        cerr << "Unable to create XvMC Context\n";
> +        cerr << "Unable to create XvMC Context return status:" << ret ;
> +        switch (ret)
> +        {
> +            case XvBadPort: cerr << " XvBadPort"; break;
> +            case BadValue:  cerr << " BadValue" ; break;
> +            case BadMatch:  cerr << " BadMatch" ; break;
> +            case BadAlloc:  cerr << " BadAlloc" ; break;
> +            default:        cerr << " unrecognized return value"; break;
> +        }
> +        cerr << endl;
> +
>          return false;
>      }
>  
> @@ -436,7 +448,9 @@
>          if (ret != Success)
>          {
>              cerr << "Unable to create XvMC Macro Blocks\n";
> +            XvMCDestroyBlocks(data->XJ_disp,&(data->data_blocks[i]));
>              XvMCDestroyContext(data->XJ_disp, &data->ctx);
> +            return false;
>          }
>      }
>  
> @@ -486,6 +500,7 @@
>  
>      if (rez == Success)
>      {
> +        data->subpicture_alloc = true;
>          XvMCClearSubpicture(data->XJ_disp, &data->subpicture, 0, 0, XJ_width,
>                              XJ_height, data->subpicture_clear_color);
>  
> @@ -500,10 +515,10 @@
>  
>          data->xvimage->data = data->shminfo.shmaddr;
>  
> -        shmctl(data->shminfo.shmid, IPC_RMID, 0);
> -
>          XShmAttach(data->XJ_disp, &data->shminfo);
>  
> +        shmctl(data->shminfo.shmid, IPC_RMID, 0);
> +
>          if (data->subpicture.num_palette_entries > 0)
>          {
>              int snum = data->subpicture.num_palette_entries;
> @@ -532,8 +547,11 @@
>                                       data->palette);
>          }
>      }
> -    else
> +    else 
> +    {
>          data->subpicture_mode = NO_SUBPICTURE;
> +        data->subpicture_alloc = false;
> +    }
>  
>      XSync(data->XJ_disp, 0);
>  
> @@ -558,7 +576,7 @@
>  
>  void VideoOutputXvMC::DeleteXvMCBuffers()
>  {
> -    for (int i = 0; i < numbuffers; i++)
> +    for (int i = 0; i < 8; i++)
>      {
>          XvMCDestroyMacroBlocks(data->XJ_disp, &data->mv_blocks[i]);
>          XvMCDestroyBlocks(data->XJ_disp, &data->data_blocks[i]);
> @@ -588,6 +606,8 @@
>  
>          data->subpicture_alloc = false;
>          XFree(data->xvimage);
> +        XFlush(data->XJ_disp);
> +        XSync(data->XJ_disp, false);
>  
>          if (data->palette)
>              delete [] data->palette;
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev



More information about the mythtv-dev mailing list