[SoftHdDevice] va-api VAAPI / VPP support for SoftHdDevice

  • English please!


    I try to debug the problems with va-api.


    Code
    1. vdr[12071]: video: 2:17:36.801 +18 364 0/\ms 66+1 v-buf


    One problem is that the decoder buffers never more than 1 decoded frame, the above "+1".


    I added the vdpau improvements to va-api.


    Code
    1. fprintf(stderr,"error not reached\n");


    This code is never reached.


    Johns


    Edit: old patch removed.

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

    The post was edited 1 time, last by johns ().

  • My logs show this kind of behaviour (pesintta's vpp_support + your patch):


    How can I help you?

  • You get a perfect (not perfect too, see edit:) log.


    I get


    Now i get some reached, but the log should look like yours :/.


    Now i get a bad log:

    Code
    1. - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D - D


    Do you have a bigger number before "v-buf"? (in syslog every 5min).


    I try to find the bugs and i have too less decoded frames buffered, the missing frames can be my errors.


    I have no difference here between vpp branch and my branch and glx and !glx.


    It should be -D not reached -D not reached .... .
    It should decode 1 frame and display 1 frame, but he seems to reach the sync display not often.


    And it should be "+3 v-buf or "+4 v-buf" for HDTV.


    Edit:
    I see your log contains -P, these are too wrong. -P is nothing todo. It can -D -P or -D -P -P.
    It should always be 1x -D each line. 1 decode each line.


    Johns


    P.S.: above tests with 720p Das Erste HD + ZDF HD.

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

  • johns vai-api from sep 30 + patch on braswell


    on ZDF HD I get only lines as follows :


    13 upto 26 -D's per line ending with "error not reached"


    vbuf is staying at (very low about 0-3) +1 v-buf


    Greetings Rene

  • See:
    http://projects.vdr-developer.…86175ad85ea04ccab227b8051


    I removed this old cruft from vdpau now. This is also included in the va-api part with a little difference.
    I will test this later with va-api.


    Edit: I made a new patch, should work with both SoftHdDevice versions.


    Code
    1. -3 +S
    2. -3 +S
    3. -3 +-3 +S
    4. -P S
    5. -3 +-3 +-P S
    6. -P S
    7. -3 +-3 +-P S
    8. -P S
    9. -3 +S
    10. ....


    Numbers are the used buffers, P is pause, S is sync+display.


    Now my softhddevice works fine with skylake and "va-api" and "va-api-glx". No drops, no dups, audio+video in sync.


    Johns

    Files

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

    The post was edited 2 times, last by johns ().

  • ffmpeg 2.8 is working with my version, sometimes i get only black picture.
    with vpp-version i get always back picture.


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

  • Just tried the v2 patch with vpp_support code and the video is jerky and pretty much unwatchable:

    Code
    1. -3 +S
    2. -P S
    3. ...


    The vbuf varies from 7 to 22, but usually stays around 18:

    Code
    1. video: 25:51:25.189 +16 328 0/\ms 8+7 v-buf
    2. video: 25:51:55.189 +16 328 0/\ms 22+7 v-buf


    Reverting the VaapiSyncRenderFrame change fixes the issue and the output looks like:

    Code
    1. -3 +S
    2. -3 +S
    3. ...


    ffmpeg 2.8 is working with my version, sometimes i get only black picture.


    This sounds exactly the same as I had with ffmpeg-2.7 until I enabled USE_MPEG_COMPLETE/H264_EOS_TRICKSPEED defines.

  • Just tried the v2 patch with vpp_support code and the video is jerky and pretty much unwatchable:

    Code
    1. -3 +S
    2. -P S
    3. ...


    I can't say that i get a good picture with vpp-branch. There are still bad frames in the queue.
    I see no difference between patch and without patch.


    Quote

    The vbuf varies from 7 to 22, but usually stays around 18:

    Code
    1. video: 25:51:25.189 +16 328 0/\ms 8+7 v-buf
    2. video: 25:51:55.189 +16 328 0/\ms 22+7 v-buf


    The number before the "+" are the undecoded frames, should not become 0, than
    the decoder has nothing todo. Important are the +7 which says 7 frames (interlaced 1/2 frames) are prepared.


    Quote


    Reverting the VaapiSyncRenderFrame change fixes the issue and the output looks like:

    Code
    1. -3 +S
    2. -3 +S
    3. ...


    I think you must enable USE_PIP, without USE_PIP the new mpeg parser is not enabled.

    Quote


    This sounds exactly the same as I had with ffmpeg-2.7 until I enabled USE_MPEG_COMPLETE/H264_EOS_TRICKSPEED defines.


    I thought the same, but -DUSE_MPEG_COMPLETE and -DH264_EOS_TRICKSPEED are enabled.


    With -DDEBUG ffmpeg says something about can't initialize hardware decoder.
    I still need to check where the difference between my and the vpp branch is.


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

    The post was edited 1 time, last by johns ().

  • Edit: i corrected my spelling error PIC -> PIP. USE_PIP should it be.


    I get the video packet from VDR, how the TV stations transmit them.


    Normaly 1 packet contains only 1 video frame. But some TV stations sends packets which contains multiple frames.
    In the old version I just waited for a free slot in the video frame buffer, but this didn't work, if you want to decode multiple streams.
    Multiple streams are needed to support PIP.


    Before i send the video packets to the decoder, I parse them and make sure that they contain only 1 frame.


    .RenderFrame => VdpauSyncRenderFrame, VaapiSyncRenderFrame should now get only 1 frame and there is 1 free frame in the decoded video ring buffer.


    .DisplayHandlerThread = VdpauDisplayHandlerThread, VaapiDisplayHandlerThread is now the only position where waiting and sync happens.


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch


  • The ffmpeg compatibility might due the change of including avctx->hwaccl_context as a private data now:
    http://fossies.org/diffs/ffmpeg/2.7.2_vs_2.8/


    There must be some difference between my branch and the vpp branch.


    My version is working with 2.8 with the patch. Sometimes i get a black picture after channel switch, can be a 2.8 bug or a general bug.
    I must do more tests.


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

  • In the vpp branch could something be wrong with the ringbuffer.


    There is a difference between the main loop code and the code VaapiSyncRenderFrame:
    The main loop fills the ring buffer until #VIDEO_SURFACES_MAX are decoded.
    VaapiSyncRenderFrame uses VIDEO_SURFACES_MAX - 1.


    I'm still searching and try to understand where VideoFirstField abd VideoSecondField are used and why.


    Edit: I see a problem, vpp branch adds two surfaces to the ringbuffer.


    Than it should look like this:

    Code
    1. @@ -5079,7 +5079,7 @@ static void VaapiQueueSurface(VaapiDecoder * decoder, VASurfaceID surface,
    2. ++decoder->FrameCounter;
    3. if (1) { // can't wait for output queue empty
    4. - if (atomic_read(&decoder->SurfacesFilled) >= VIDEO_SURFACES_MAX) {
    5. + if (atomic_read(&decoder->SurfacesFilled) >= VIDEO_SURFACES_MAX - 1) {
    6. ++decoder->FramesDropped;
    7. Warning(_("video: output buffer full, dropping frame (%d/%d)\n"),
    8. decoder->FramesDropped, decoder->FrameCounter);


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

    The post was edited 1 time, last by johns ().

  • Got ffmpeg-2.8 and your patch working with help of pesintta. Checkout the latest vpp_support changes from github and then apply this over your patch:

    Code
    1. - if (filled < VIDEO_SURFACES_MAX) {
    2. + if (filled < VIDEO_SURFACES_MAX - 1) {


    ...and the results:

    Code
    1. -P S
    2. -2 +-P S
    3. -P S
    4. -2 +-P S
    5. ...


    ffmpeg-2.8 requires this one:


    What comes to the FirstField and SecondField: for my knowledge there're just crude hacks to make Intel driver to output fields in a correct order. Otherwise, some hardware / driver versions messed up the deinterlace. In utopia, you don't need those or their values are [0,0] as in my Haswell setup.

  • Nice. I was until "FFMPEG_BUG1_WORKAROUND" and that my new Vaapi_get_format or VaapiGetSurface are a little different.


    FFmpeg 2.8 is working now.


    But I have still the bad frames. which appears every random seconds. Which are green or red or blue horizontal bars.
    When I comment out the vpp queue, it is fine.


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

  • I added the patch (without the debug) to my GIT.


    I added the check to enforce USE_PIP:

    Code
    1. #ifndef USE_PIP
    2. #error "-DUSE_PIP or #define USE_PIP is needed,"
    3. #endif


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

  • I have installed SoftHdDevice on my new laptop with a Pentium N3700 processor. It works, but after a few seconds and sometimes directly after switching channels I see flickering horizontal lines (see this screen recording).


    But I have still the bad frames. which appears every random seconds. Which are green or red or blue horizontal bars.

    Sounds like you have the same problem or is yours different?


    When I comment out the vpp queue, it is fine.

    Could you please explain how to do this and which effects it has?


    My second problem is that the OSD is corrupted. My laptop screen has a resolution of 1366x768. If I connect my FullHD TV via HDMI the OSD looks good. I have the same problem with my Haswell based VDR if I start the plugin in window mode and scale it down. Any ideas how to fix this?


    PS: I am using
    x11-libs/libva-9999
    x11-libs/libva-intel-driver-9999
    x11-drivers/xf86-video-intel-2.99.917
    media-video/ffmpeg-2.6.3
    Kernel 4.3.0-rc6+ (drm-intel-nightly)

  • This is exact the failure i'm seeing too.


    IIRC I disabled denose, shapren, ... filters. I have currently no patch.


    Johns

    Sag mir, wo die Developer sind. Wo sind sie geblieben? . . . . . . . . . . . . . . . . . . . . SoftHdDevice - A software and GPU emulated HD output device plugin.
    Sag mir, wo die Developer sind. Was ist geschehn?


    Client0: Crown CW02 MSI_C847MS-E33 Zotac_GT640_passiv Cine-S2 iMon-MCE / streamdev softhddevice
    Client1: Lian_Li_PC-Q09FB ASRock_H67M-ITX/HT I3-2100 ASUS_ENGT520_passiv / streamdev softhddevice
    Test: Lian_Li_PC-Q09R Asus C60M1-I / streamdev
    Server0: Dockstar TT-S2-3600-USB / streamdev
    Server2: Lian_Li_PC-Q07R Intel_DH61DL G620 WD20EARX 90W PicoPSU Cine-S2+DuoFlex-S2+DuoFlex-CT / streamdev / 22 Watt Verbrauch

  • My second problem is that the OSD is corrupted. My laptop screen has a resolution of 1366x768. If I connect my FullHD TV via HDMI the OSD looks good. I have the same problem with my Haswell based VDR if I start the plugin in window mode and scale it down. Any ideas how to fix this?


    Go to the Softhddevice-Plugin-Setup:
    Video - OSD Size - NOT auto, choose another resolution and now the OSD in window mode should be ok. That was you're problem?


    With my Haswell it's nearly perfect now with softhhdevice from johns or from pesintta. It's only not ok on my Desktop with 60 Hz. The mode isn't integrated, isnt' it?


    Stefan