From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 105145] vaExportSurfaceHandle interaction with surface interlaced flag prevents switching on vaapi deinterlacing dynamically Date: Sat, 17 Feb 2018 12:47:13 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0724073124==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [IPv6:2610:10:20:722:a800:ff:fe98:4b55]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E047882B8 for ; Sat, 17 Feb 2018 12:47:13 +0000 (UTC) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0724073124== Content-Type: multipart/alternative; boundary="15188716330.6AD16c78.17415" Content-Transfer-Encoding: 7bit --15188716330.6AD16c78.17415 Date: Sat, 17 Feb 2018 12:47:13 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D105145 Bug ID: 105145 Summary: vaExportSurfaceHandle interaction with surface interlaced flag prevents switching on vaapi deinterlacing dynamically Product: Mesa Version: git Hardware: All OS: All Status: NEW Severity: major Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel@lists.freedesktop.org Reporter: k.philipp@gmail.com QA Contact: dri-devel@lists.freedesktop.org When decoding interlaced video with VAAPI and least when using the radeonsi driver, it is impossible to postproc-deinterlace a frame from a surface that was used with vaExportSurfaceHandle() before. This effectively means that it is impossible to dynamically switch on deinterlacing mid-stream, i.e. after an *interlaced* frame has been shown unprocessed with vaExportSurfaceHandle. Try for example with mpv from git: mpv -vo gpu --hwdec=3Dvaapi /path/to/interlaced/video.mkv (add --gpu-context=3Dwayland when running under Wayland, else vaapi will not work) give it a few seconds and then switch on deinterlacing with the 'd' key. You will see the error mesage "vaRenderPicture() failed (invalid VASurfaceI= D)" and not get any deinterlacing. Having deinterlacing enabled from the beginn= ing (e.g. with "--deinterlace=3Dyes") works, since no unprocesssed surface is exported then. The chain of events seems to be: - Create surfaces for decoding. They are marked interlaced by default on radeonsi. (see https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/radeonsi/si= _get.c?id=3D9d21dbeb88bc99ca0e153c11265e19536ad36b61#n655 - PREFERS_INTERLACED is always returned as true) - Export the decoded surfaces with vaExportSurfaceHandle() and present them= to the user. This has the side-effect of making the surfaces non-interlaced (s= ee https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/va/s= urface.c?id=3D9d21dbeb88bc99ca0e153c11265e19536ad36b61#n966) - Now we want to turn on postproc. - Create surfaces for postproc. They are, again, marked interlaced by defau= lt - Trying to deinterlace gives VA_STATUS_ERROR_INVALID_SURFACE_ID since it thinks that the source surface is not interlaced, and that the destination surface is - both of which is wrong (see https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/va/p= ostproc.c?id=3D9d21dbeb88bc99ca0e153c11265e19536ad36b61#n131) Reporting this against the radeonsi driver since I couldn't test with anyth= ing else, but the issue may really be in how vlVaExportSurfaceHandle works on a= ll drivers. On a related note, since the radeonsi driver by default generates interlaced surfaces when using vaCreateSurfaces, vlVaExportSurfaceHandle making them progressive seems to be the only reason it correctly bob-deinterlaces at the moment (MADI seems to be fine because it uses another code path). At least after all output surfaces have been exported once, before that it just blit= s. I also consider this a bug that could now be solved at the same time. If not,= I can open a new ticket for that. --=20 You are receiving this mail because: You are the assignee for the bug.= --15188716330.6AD16c78.17415 Date: Sat, 17 Feb 2018 12:47:13 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated
Bug ID 105145
Summary vaExportSurfaceHandle interaction with surface interlaced fla= g prevents switching on vaapi deinterlacing dynamically
Product Mesa
Version git
Hardware All
OS All
Status NEW
Severity major
Priority medium
Component Drivers/Gallium/radeonsi
Assignee dri-devel@lists.freedesktop.org
Reporter k.philipp@gmail.com
QA Contact dri-devel@lists.freedesktop.org

When decoding interlaced video with VAAPI and least when using=
 the radeonsi
driver, it is impossible to postproc-deinterlace a frame from a surface that
was used with vaExportSurfaceHandle() before.

This effectively means that it is impossible to dynamically switch on
deinterlacing mid-stream, i.e. after an *interlaced* frame has been shown
unprocessed with vaExportSurfaceHandle.

Try for example with mpv from git:
mpv -vo gpu --hwdec=3Dvaapi /path/to/interlaced/video.mkv
(add --gpu-context=3Dwayland when running under Wayland, else vaapi will not
work)
give it a few seconds and then switch on deinterlacing with the 'd' key.
You will see the error mesage "vaRenderPicture() failed (invalid VASur=
faceID)"
and not get any deinterlacing. Having deinterlacing enabled from the beginn=
ing
(e.g. with "--deinterlace=3Dyes") works, since no unprocesssed su=
rface is
exported then.

The chain of events seems to be:
- Create surfaces for decoding. They are marked interlaced by default on
radeonsi. (see
https=
://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/radeonsi/si_get.=
c?id=3D9d21dbeb88bc99ca0e153c11265e19536ad36b61#n655
- PREFERS_INTERLACED is always returned as true)
- Export the decoded surfaces with vaExportSurfaceHandle() and present them=
 to
the user. This has the side-effect of making the surfaces non-interlaced (s=
ee
htt=
ps://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/va/surf=
ace.c?id=3D9d21dbeb88bc99ca0e153c11265e19536ad36b61#n966)
- Now we want to turn on postproc.
- Create surfaces for postproc. They are, again, marked interlaced by defau=
lt
- Trying to deinterlace gives VA_STATUS_ERROR_INVALID_SURFACE_ID since it
thinks that the source surface is not interlaced, and that the destination
surface is - both of which is wrong (see
ht=
tps://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/va/pos=
tproc.c?id=3D9d21dbeb88bc99ca0e153c11265e19536ad36b61#n131)

Reporting this against the radeonsi driver since I couldn't test with anyth=
ing
else, but the issue may really be in how vlVaExportSurfaceHandle works on a=
ll
drivers.
On a related note, since the radeonsi driver by default generates interlaced
surfaces when using vaCreateSurfaces, vlVaExportSurfaceHandle making them
progressive seems to be the only reason it correctly bob-deinterlaces at the
moment (MADI seems to be fine because it uses another code path). At least
after all output surfaces have been exported once, before that it just blit=
s. I
also consider this a bug that could now be solved at the same time. If not,=
 I
can open a new ticket for that.


You are receiving this mail because:
  • You are the assignee for the bug.
= --15188716330.6AD16c78.17415-- --===============0724073124== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0724073124==--