[MPlayer-dev-eng] Better double frame rate output and framedrop
Vicente Sendra
visenri at yahoo.es
Mon Oct 29 23:31:14 CET 2012
> > One of my laptops (core2 duo) play it flawlessly with
> :
> > -cache 2000 -vo gl -framedrop -lavdopts threads=2
> judder.m2ts
> > or
> > -cache 2000 -vo directx -framedrop -lavdopts
> threads=2 judder.m2ts
>
> I only see this with -vo gl and vblank_mode=2, xv and vdpau
> are
> unaffected as is gl without vblank_mode=2 with or without
> swap buffers
> wait enabled. On R600 all three working cases do vsync in a
> different
> way to the failing case.
> VO: [gl] 1920x1080 => 1920x1080 Planar YV12 [fs]
> DROPPED NEW FRAME by SYNC
> A: 11.8 V: 11.9 A-V: -0.127 ct: 0.000 8/ 8 ??% ??% ??,?% 1 0
> DROPPED NEW FRAME by SYNC
> Dropping frame with size not matching configured size
> A: 11.8 V: 12.1 A-V: -0.219 ct: -0.013 11/ 11 ??% ??% ??,?% 2 0
> DROPPED NEW FRAME by VOUT
> A: 12.0 V: 12.4 A-V: -0.377 ct: -0.025 15/ 15 ??% ??% ??,?% 3 0
> DROPPED NEW FRAME by VOUT
> A: 12.0 V: 12.3 A-V: -0.267 ct: -0.029 16/ 16 ??% ??% ??,?% 4 0
> DROPPED NEW FRAME by VOUT
> A: 12.2 V: 12.4 A-V: -0.236 ct: -0.042 19/ 19 ??% ??% ??,?% 5 0
> DROPPED NEW FRAME by VOUT
> A: 12.2 V: 12.4 A-V: -0.250 ct: -0.046 20/ 20 0 0 0 6 0
> DROPPED NEW FRAME by VOUT
> A: 12.3 V: 12.6 A-V: -0.219 ct: -0.058 23/ 23 1 18 50 7 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 12.4 V: 12.7 A-V: -0.261 ct: -0.067 26/ 26 2 10 83 9 0
> DROPPED NEW FRAME by VOUT
> A: 12.6 V: 13.0 A-V: -0.420 ct: -0.079 30/ 30 0 6 33 10 0
> DROPPED NEW FRAME by VOUT
> A: 12.6 V: 12.9 A-V: -0.296 ct: -0.083 31/ 31 0 0 0 11 0
> DROPPED NEW FRAME by VOUT
> A: 12.7 V: 13.0 A-V: -0.278 ct: -0.096 34/ 34 0 6 33 12 0
> DROPPED NEW FRAME by VOUT
> A: 12.8 V: 13.1 A-V: -0.279 ct: -0.100 35/ 35 0 0 0 13 0
> DROPPED NEW FRAME by VOUT
> A: 12.9 V: 13.2 A-V: -0.261 ct: -0.113 38/ 38 0 6 33 14 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 13.0 V: 13.3 A-V: -0.286 ct: -0.121 41/ 41 1 14 100 16 0
> DROPPED NEW FRAME by VOUT
> A: 13.2 V: 13.6 A-V: -0.445 ct: -0.133 45/ 45 0 10 50 17 0
> DROPPED NEW FRAME by VOUT
> A: 13.2 V: 13.5 A-V: -0.325 ct: -0.138 46/ 46 0 0 0 18 0
> DROPPED NEW FRAME by VOUT
> A: 13.3 V: 13.7 A-V: -0.303 ct: -0.150 49/ 49 1 10 50 19 0
> DROPPED NEW FRAME by VOUT
> A: 13.4 V: 13.7 A-V: -0.308 ct: -0.154 50/ 50 0 0 0 20 0
> DROPPED NEW FRAME by VOUT
> A: 13.5 V: 13.8 A-V: -0.287 ct: -0.167 53/ 53 0 9 50 21 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 13.6 V: 14.1 A-V: -0.437 ct: -0.175 56/ 56 1 18 100 23 0
> DROPPED NEW FRAME by VOUT
> A: 13.8 V: 14.1 A-V: -0.345 ct: -0.188 60/ 60 0 13 50 24 0
> DROPPED NEW FRAME by VOUT
> A: 13.8 V: 14.2 A-V: -0.354 ct: -0.192 61/ 61 0 0 0 25 0
> DROPPED NEW FRAME by VOUT
> A: 13.9 V: 14.3 A-V: -0.328 ct: -0.204 64/ 64 0 13 50 26 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 14.0 V: 14.5 A-V: -0.495 ct: -0.213 67/ 67 1 5 83 28 0
> DROPPED NEW FRAME by VOUT
> A: 14.2 V: 14.6 A-V: -0.387 ct: -0.225 71/ 71 0 17 50 29 0
> DROPPED NEW FRAME by VOUT
> A: 14.2 V: 14.7 A-V: -0.484 ct: -0.229 72/ 72 0 0 0 30 0
> DROPPED NEW FRAME by VOUT
> A: 14.3 V: 14.8 A-V: -0.462 ct: -0.238 74/ 74 1 13 133 31 0
> DROPPED NEW FRAME by VOUT
> A: 14.5 V: 14.9 A-V: -0.496 ct: -0.250 78/ 78 0 9 50 32 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 14.6 V: 15.1 A-V: -0.529 ct: -0.263 82/ 82 0 5 33 34 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 14.7 V: 15.2 A-V: -0.462 ct: -0.275 86/ 86 0 17 50 36 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 14.8 V: 15.3 A-V: -0.504 ct: -0.284 89/ 89 2 9 83 38 0
> DROPPED NEW FRAME by VOUT
> A: 15.0 V: 15.6 A-V: -0.646 ct: -0.296 93/ 93 0 21 50 39 0
> DROPPED NEW FRAME by VOUT
> A: 15.0 V: 15.5 A-V: -0.538 ct: -0.300 94/ 94 0 0 0 40 0
> DROPPED NEW FRAME by VOUT
> A: 15.2 V: 15.7 A-V: -0.504 ct: -0.313 97/ 97 1 21 50 41 0
> DROPPED NEW FRAME by VOUT
> A: 15.2 V: 15.7 A-V: -0.521 ct: -0.317 98/ 98 0 0 0 42 0
> DROPPED NEW FRAME by VOUT
> A: 15.3 V: 15.8 A-V: -0.488 ct: -0.329 101/101 0 21 50 43 0
> DROPPED NEW FRAME by VOUT
> DROPPED NEW FRAME by VOUT
> A: 15.4 V: 15.9 A-V: -0.530 ct: -0.338 104/104 1 13 83 45 0
As i thought, the problem is the time it takes to do the page flip.
It seems that vblank_mode=2 disables buffering in the graphics card and every time a new frame is flipped, flip function returns only when new vertical sync has been done.
This explains the fact that "vflip_frame_time_usage" peaks at around vertical sync period, 16.6ms at 60hz, 17-21ms (some peaks bigger than 17ms are normal because of multitasking).
The problem is this scenario is similar to have a vertical refresh rate of 24Hz as some screens allow, so, the algorithm needs more information to do the right thing, it needs to know the video card refresh rate.
Knowing that it can do:
-If frame rate is lower for sure than refresh rate (1-2Hz should be enough for this): disable drop by VOUT.
But even knowing video card refresh rate, we can have a problem in this case when screen refresh rate is similar or lower to frame rate, because large delays (in video flip) are going to happen all the time, and we don't know if delays are because of too much frames buffered or because we have frame buffering disabled (as it is with vblank_mode=2).
So, we need even more information:
-Video card refresh rate.
-Video output buffering.
I think video output buffering may be hard to get (or incorrect) depending on video cards/video drivers/OS used.
Maybe the safest solution is to add a command line option to adjust new frame drop behavior, i think good options could be:
Max frame rate output:
-Set to value > 0
Drop frames when frame rate is higher than this frame rate (use this to calculate minimum period and use this to calculate frame delay relative to actual frame rate, and when delay > 1/2 minimum period drop a frame).
-Set to value < 0
Disable frame rate drop by vout.
-Set to value = 0
Enable frame rate drop by vout with max frame rate autodetection (actual code)
In some cases setting it to disabled or value = vrefresh may result almost the same behavior, as your case, because if you disable new frame drop system, when A-V delay reaches 0.1sec, it will start dropping frames as needed, but cpu use can change a lot, because many drivers just loop in the blocking call to flip waiting for vsync.
Avoid burned cpu time was the main goal of this patch.
Any more ideas or suggestions are welcome.
More information about the MPlayer-dev-eng
mailing list