Bug 79377

Summary: MADI on at least IVB and SNB assumes that reference surface is NV12, even when it's not (e.g. when feeding YUY2 surfaces from software to VPP)
Product: libva Reporter: Simon Farnsworth <simon>
Component: intelAssignee: PengChen <peng.c.chen>
Status: NEEDINFO --- QA Contact: Sean V Kelley <seanvk>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Hacky patch that fixes the deinterlacing bug
Patch against staging to reject non-NV12 surfaces

Description Simon Farnsworth 2014-05-28 16:43:30 UTC
With VA-API intel-driver 1.3.1 on IVB, or on SNB with the SNB MADI backport applied, I see issues when I upload YUY2 surfaces from a V4L2 capture card to VA-API for deinterlacing using gstreamer-vaapi version 0.5.8 with the patch from https://bugzilla.gnome.org/show_bug.cgi?id=726361 applied to enable me to force deinterlacing.

My pipeline looks like:

gst-launch-1.0 v4l2src ! vaapipostproc deinterlace-mode=interlaced deinterlace-method=motion-adaptive ! vaapisink

The problem is that the reference frame passed to hardware is still in YUY2 format, whereas the hardware is expecting NV12 format. I've come up with a very hacky patch which "fixes" the problem, which I'll attach to this bug.
Comment 1 Simon Farnsworth 2014-05-28 16:48:23 UTC
Created attachment 100041 [details] [review]
Hacky patch that fixes the deinterlacing bug

This patch isn't suitable for applying to the source tree as-is. It puts in a special case for MADI, where the colour space conversion is applied to the reference frame, too.

Applying this "fixes" my issue with deinterlacing YUY2 surfaces, implying that it's about colour space of the reference frame.
Comment 2 haihao 2014-05-29 06:40:00 UTC
It would be better to fix this issue in gstreamer-vaapi, could you file a bug in gsteamer bugzilla to track the issue ?
Comment 3 Simon Farnsworth 2014-05-29 09:09:45 UTC
(In reply to comment #2)
> It would be better to fix this issue in gstreamer-vaapi, could you file a
> bug in gsteamer bugzilla to track the issue ?

I'll file a bug there, too.

At a minimum, though, intel-driver needs to reject the reference surface if it's in the wrong format, just as it refuses to work without a reference surface. I'll cook up a quick patch to show what I mean.
Comment 4 Simon Farnsworth 2014-05-29 09:29:27 UTC
Created attachment 100098 [details] [review]
Patch against staging to reject non-NV12 surfaces

This patch (against the staging branch) simply has intel-driver reject non-NV12 references on SNB and IVB, returning the same error code (different warning message) as it would if you asked for MADI without providing a reference surface.

I haven't gone deep enough into MCDI and MADI on HSW/BDW to work out whether they need a similar patch.
Comment 5 Simon Farnsworth 2014-05-29 09:37:04 UTC
https://bugzilla.gnome.org/show_bug.cgi?id=730925 filed for gstreamer-vaapi.
Comment 6 Pengfei 2014-08-19 05:53:21 UTC
the patch Patch against staging to reject non-NV12 surfaces has been sent to Libva <libva-bounces@lists.freedesktop.org>. and assign to you.
Comment 7 Pengfei 2014-08-19 05:57:21 UTC
the patch Patch against staging to reject non-NV12 surfaces has been sent to Libva <libva-bounces@lists.freedesktop.org>. and assign to you.
Comment 8 Simon Farnsworth 2014-09-12 11:22:41 UTC
I can't find the patch in my archive of the list. Could someone give me a pointer to it?
Comment 9 haihao 2015-11-23 16:27:46 UTC
Sorry for slow response. do you still experience this issue?
Comment 10 Simon Farnsworth 2016-01-12 02:54:01 UTC
(In reply to haihao from comment #9)
> Sorry for slow response. do you still experience this issue?

I've left ONELAN, and no longer have access to this hardware. You should be able to reproduce with the details in comment #0 if it's still an issue on IVB or SNB.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.