FCP and FP GPU-swap timestamps can differ when they are the same paint. |
|||||||||
Issue descriptionIdeally, if FCP and FP are set a result of the same Paint(), they should have the same timestamp. From a web developer perspective, checking firstPaint == firstContentfulPaint would be nice, as opposed to maybe |firstContentfulPaint - firstPaint| < epsilon. For testing the new GPU swap timestamps, this gives us a nice guarantee we can use for layout tests. The timestamp for the swap versions of these metrics is set in SwapPromise::DidSwap(), but will be slightly different for each swap promise (for the same Paint()). During testing we found that ~65% of the time the timestamps for swap promises queued for the same Paint() were the same (within 1us). However, since each swap promise computes its own timestamp, they are not identical and can cause FP and FCP to differ in the performance API. A prototype CL that addresses this by modifying the SwapPromise API can be found here: https://chromium-review.googlesource.com/c/570886/
,
Jul 17 2017
,
Jul 17 2017
Scott said he has another prototype that limits changes to PaintTiming. I'd love to see that (although this is not high priority)
,
Jul 18 2017
Here's the other prototype that takes a different approach: https://chromium-review.googlesource.com/c/576352/.
,
Aug 22 2017
It is essential that single frame has single timestamp and the latter approach does introduce a potential race. Capturing timestamp per frame in compositor does not seem like a big overhead, so we could unconditionally capture it. Let me see if we have an existing timestamp laying around we could reuse.
,
Aug 23 2017
IIRC +brianderson was opposed to always generating a new timestamp per frame in compositor
,
Aug 28 2017
The performance overhead of generating a new timestamp per frame shouldn't be too big - Brian, is the performance overhead your concern?
,
Aug 28 2017
Scott, can you comment on what exactly the proposal is here that has overhead issues? IIUC this is not just overhead of a single timestamp but the cost of always queueing a swap promise (regardless of whether it is needed) and consequent IPCs (hard to say without knowing the proposal)
,
Aug 28 2017
Sure, IIRC the only concern about the overhead is related to computing the timestamp once per frame, as it can be slow on some platforms. And, since we aren't queuing a swap promise for each frame (for purposes of FP/FCP/etc.), this adds unneeded overhead. I'm not aware of overhead concerns for queuing unnecessary swap promises. In the initial prototype/proposal, I added methods to the SwapPromise interface to minimize overhead but provide a consistent timestamp, i.e. we added a NeedsTimstamp() method so it is only computed if needed, and the same timestamp is passed to all SwapPromises through DidSwap(). This is kind of gross, so I think it's being proposed just to always compute and pass the timestamp to DidSwap(), so it's cleaner (we would also need the timestamp in DidNotSwap() to be consistent, since we are now computing a timestamp there as well). So, TL;DR, we want one timestamp per frame, but we only queue swap promises for some frames. So, is it too much overhead to compute it in ALL cases, even if it isn't needed?
,
Aug 28 2017
The overhead may be acceptable. (In the worst case it's on the order of ~10us [Android] every ~16ms?) Sunny, Brian - any thoughts?
,
Aug 31 2017
Brian and I chatted this morning about this, and he's thinking there might be a timestamp that can be plumbed through to the SwapPromise machinery. The current thought is to try to reuse an existing timestamp, and modify the SwapPromise interface adding a timestamp parameter to both DidSwap() and DidNotSwap().
,
Jan 4 2018
Brianderson: Ping!
,
Apr 23 2018
Is there any update for this bug?
,
Aug 2
Ping. And one option to fix the bug would be only queueing a swap promise if none is queued in PaintTiming (and processing all available paints within the single promise). I did something like this for EventTiming.
,
Aug 2
Brian is off Chrome now. Marking untriaged.
,
Aug 10
,
Nov 26
This bug is stale. Plan is to move to presentation timestamp at some point. +sadrul because I don't know if those have the same problem as swap timestamps.
,
Nov 26
Presentation-timestamps will not have this issue. |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by sheriffbot@chromium.org
, Jul 14 2017