Ticket #1842: cn400-mythtv-vid.patch

File cn400-mythtv-vid.patch, 4.2 KB (added by teague@…, 13 years ago)

Patch against mythtv-vid to get it working on the CN400 chipset.

  • libs/libmythtv/util-opengl.cpp

     
    6767{
    6868    int ret, errbase, eventbase, gl_major, gl_minor;
    6969
     70    // this crashes my Unichrome-based system if it is run more than once.
     71    static bool has_run = false;
     72    static int static_major = 0;
     73    static int static_minor = 0;
     74    static int static_ret = false;
     75
     76    if( has_run )
     77    {
     78        major = static_major;
     79        minor = static_minor;
     80        return static_ret;
     81    }
     82
    7083    major = minor = 0;
     84    has_run = true;
    7185
    7286    X11S(ret = glXQueryExtension(XJ_disp, &errbase, &eventbase));
    7387    if (!ret)
     
    86100    if (!ret)
    87101        return false;
    88102
    89     major = gl_major;
    90     minor = gl_minor;
     103    static_major = major = gl_major;
     104    static_minor = minor = gl_minor;
     105    static_ret = true;
    91106
    92107    return true;
    93108}
  • libs/libmythtv/videoout_xv.cpp

     
    17561756    if (!xvmc_ctx)
    17571757        return false;
    17581758
    1759     bool createBlocks = !(XVMC_VLD == (xvmc_surf_info.mc_type & XVMC_VLD));
    1760     xvmc_surfs = CreateXvMCSurfaces(xvmc_buf_attr->GetMaxSurf(), createBlocks);
     1759    bool surface_has_vld = (XVMC_VLD == (xvmc_surf_info.mc_type & XVMC_VLD));
     1760    xvmc_surfs = CreateXvMCSurfaces(xvmc_buf_attr->GetMaxSurf(),
     1761                                    surface_has_vld);
    17611762    if (xvmc_surfs.size() < xvmc_buf_attr->GetMinSurf())
    17621763    {
    17631764        VERBOSE(VB_IMPORTANT, LOC_ERR + "Unable to create XvMC Surfaces");
     
    17871788    }
    17881789    xvmc_osd_lock.unlock();
    17891790
    1790 
    17911791    X11S(XSync(XJ_disp, False));
    17921792
    17931793    return true;
     
    17961796#endif // USING_XVMC
    17971797}
    17981798
    1799 vector<void*> VideoOutputXv::CreateXvMCSurfaces(uint num, bool create_xvmc_blocks)
     1799vector<void*> VideoOutputXv::CreateXvMCSurfaces(uint num, bool surface_has_vld)
    18001800{
    18011801    (void)num;
    1802     (void)create_xvmc_blocks;
     1802    (void)surface_has_vld;
    18031803
    18041804    vector<void*> surfaces;
    18051805#ifdef USING_XVMC
     
    18081808                            ((video_dim.height() + 15) / 16));
    18091809    uint num_data_blocks = num_mv_blocks * blocks_per_macroblock;
    18101810
     1811    // need the equivalent of 5 extra surfaces for VLD decoding
     1812    if( surface_has_vld )
     1813        num += 5;
     1814
    18111815    // create needed XvMC stuff
    18121816    bool ok = true;
    18131817    for (uint i = 0; i < num; i++)
     
    18201824        int ret = XvMCCreateSurface(XJ_disp, xvmc_ctx, &(surf->surface));
    18211825        ok &= (Success == ret);
    18221826
    1823         if (create_xvmc_blocks && ok)
     1827        if (ok && !surface_has_vld)
    18241828        {
    18251829            ret = XvMCCreateBlocks(XJ_disp, xvmc_ctx, num_data_blocks,
    18261830                                   &(surf->blocks));
     
    18311835            }
    18321836        }
    18331837
    1834         if (create_xvmc_blocks && ok)
     1838        if (ok && !surface_has_vld)
    18351839        {
    18361840            ret = XvMCCreateMacroBlocks(XJ_disp, xvmc_ctx, num_mv_blocks,
    18371841                                        &(surf->macro_blocks));
     
    18521856        }
    18531857        surfaces.push_back(surf);
    18541858    }
     1859
     1860    // for VLD decoding: the last 5 surfaces were allocated just to make
     1861    // sure we had enough space.  now, deallocate/destroy them.
     1862
     1863    if( surface_has_vld )
     1864    {
     1865        VERBOSE(VB_PLAYBACK,
     1866                LOC + QString("VLD - Allocated %1 surfaces, now destroying 5 of them.").arg(surfaces.size()));
     1867
     1868        for( uint i = 0; i < 5; i++ )
     1869        {
     1870            xvmc_vo_surf_t *surf = (xvmc_vo_surf_t*)surfaces.back();
     1871            surfaces.pop_back();
     1872            XvMCDestroySurface(XJ_disp, &(surf->surface));
     1873            delete surf;
     1874        }
     1875    }
     1876
    18551877#endif // USING_XVMC
    18561878    return surfaces;
    18571879}
     
    41924214            break;
    41934215
    41944216        case kCodec_MPEG1_VLD:
    4195             vld = true;
     4217            mc = vld = true;
    41964218            ret = CODEC_ID_MPEG2VIDEO_XVMC_VLD;
    41974219            break;
    41984220        case kCodec_MPEG2_VLD:
    4199             vld = true;
     4221            mc = vld = true;
    42004222            ret = CODEC_ID_MPEG2VIDEO_XVMC_VLD;
    42014223            break;
    42024224        case kCodec_H263_VLD: