[FFmpeg-devel] [PATCH 2/2] dxva2_h264: add a workaround for old intel GPUs

Anton Fedchin anightik at gmail.com
Wed Mar 5 07:40:38 CET 2014


> On Tue, Mar 04, 2014 at 08:28:39AM +0100, Rainer Hochecker wrote:
> > +    else if (ctx->workaround & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO)
> > +        pp->Reserved16Bits            = 0x34c;
>
> How is that related?
>
> > @@ -238,7 +240,11 @@ static void fill_slice_long(AVCodecContext *avctx,
DXVA_Slice_H264_Long *slice,
> >              if (list < h->list_count && i < h->ref_count[list]) {
> >                  const Picture *r = &h->ref_list[list][i];
> >                  unsigned plane;
> > -                unsigned index = get_refpic_index(pp,
ff_dxva2_get_surface_index(ctx, r));
> > +                unsigned index;
> > +                if (ctx->workaround &
FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO)
> > +                    index = ff_dxva2_get_surface_index(ctx, r);
> > +                else
> > +                    index = get_refpic_index(pp,
ff_dxva2_get_surface_index(ctx, r));
>
>
> I'd say this looks nicer as
> unsigned index = ff_dxva2_get_surface_index(ctx, r);
> if (!(ctx->workaround & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO)
>     index = get_refpic_index(pp, index);
>
> I also wonder if it wouldn't make more sense to merge into the previous
> patch (though that also depends on the answer to my question about the
> first part).
> Also, would it be possible to auto-detect whether this should be used or
> not?
> Lastly, which devices does this fix? Is everything but the "ClearVideo"
> ones broken currently, or is it only some special devices that even
> care about this?

The latest drivers on SandyBridge and older Intel GPU's has two H.264
decoders: DXVADDI_Intel_ModeH264_E with GUID
{604F8E68-4951-4C54-88FE-ABD25C15B3D6} (Intel spesific
H264_VLD_NoFGT_ClearVideo decoder) and standard Microsoft DXVA2_ModeH264_E
decoder with GUID {1B81BE68-A0C7-11D3-B984-00C04F2E73C5}. IvyBridge and
newer has only last one.

Intel ClearVideo decoder has issues with decoding with refs >= 11. To avoid
issues we should use standard Microsoft H.264 decoder (DXVA2_ModeH264_E)
which has not issues, but in the current master there is no possibility to
use the standard decoder on SNB and older without first path.

The first patch fixes using the standart Microsoft H.264 decoder on Intel
SandyBridge and older GPU's, but it breaks the Intel ClearVideo decoder.
The second path add workaround for the Intel ClearVideo decoder. The
application should set the workaround flag if it use Intel ClearVideo
device.

As for auto detect original autor of patches says:
> I looked into that just now, and it would be possible, however this
probing would need to happen on every call to the slice filling function,
> because there currently is no good way to store that information, and
also no guarantee that the user code cannot swap out the decoder
> object mid-playback (ie. when the player is moved to another screen on
another GPU this can happen)


More information about the ffmpeg-devel mailing list