windowless frame rate never exceeds 30

311 views
Skip to first unread message

fabia...@web.de

unread,
Oct 10, 2017, 6:59:54 PM10/10/17
to CEF Python
So, I'm having the issue that my 60 fps application only gets 30 cef OnPaint updates per second. I'm fully aware of the "windowless_frame_rate" : 60 option. I know that it works, because setting it to 1 really does give me 1 update a second. I also know that I can get 60 fps and that there are 60 fps because using the devconsole I can profile the browser while it is running and it is doing 16 ms / 60 fps internally. However, that is not how often the OnPaint gets called.

If I print the frames that happen and the times a frame got "painted" (OnPaint) I get this log :

[...]
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
INFO:STDOUT:Frame happened
INFO:STDOUT:Frame happened
INFO:STDOUT:Painting a frame
[...]

I've completely emptied the OnPaint except for a print to make sure it completes in time, but same deal.

So, half the frames get rendered offscreen but never get sent to OnPaint. This creates a noticable delay in the application. Especially since due to engine infrastructure, it is already one main frame behind, so cef is then up to 4 frames (64milliseconds!) behind input.

fabia...@web.de

unread,
Oct 10, 2017, 7:16:39 PM10/10/17
to CEF Python
here's the internal 60fps:
https://i.imgur.com/NKOQ7Ie.png
Which I'd like to get from it.
Also, why is 60 the limit? My main application does adaptive v-sync, I'd like to be able to set cef to that. But that could for example be 144hz. Why is it capped at 60? (or 30, actually)

Czarek Tomczak

unread,
Oct 11, 2017, 12:08:25 AM10/11/17
to CEF Python
OnPaint will get called only when something changes on a web page.

You didn't provide basic information. What OS and cefpython version? What example are you running, what framework?

Czarek Tomczak

unread,
Oct 11, 2017, 12:09:29 AM10/11/17
to CEF Python
Run with --debug flag and attach debug.log file.

Czarek Tomczak

unread,
Oct 11, 2017, 12:11:35 AM10/11/17
to CEF Python
See also what flags to set for best performance: https://github.com/cztomczak/cefpython/issues/240

fabia...@web.de

unread,
Oct 11, 2017, 7:24:03 AM10/11/17
to CEF Python
So, this problem was first discovered by trying to drag a jquery ui dialog box and it lagging far behind.

Here's the debug log: https://pastebin.com/eTCchkXW

It isn't one of the examples or established frameworks, as I'm writing a vulkan game engine and I hope to use cef for the UI. It is still loosely based on one of the examples, I forgot which by now.

There is always something to update, as for the sake of testing this bug I created a permament css animation.

Should it help, here's the python module handling it:
https://pastebin.com/3zwQa8Ez
and here's the main html:
https://pastebin.com/27GSEfZY
I won't run without the rest of the engine, but maybe it helps.

Looking at the run flags, it looks like the important ones should be already automatically set as I tell it to offscreen render.

fabia...@web.de

unread,
Oct 11, 2017, 7:24:46 AM10/11/17
to CEF Python
Oh yeah, Python 3.6.3 64 bit, latest modules of everything according to pypi and windows 7 and 10 64 bit.

Czarek Tomczak

unread,
Oct 11, 2017, 7:37:11 AM10/11/17
to CEF Python
The debug.log you provided doesn't contain any logs, only some errors (false-positive).

You are not setting any of the important offscreen flags for best performance, thus the slow frame rate you get is expected.

fabia...@web.de

unread,
Oct 11, 2017, 7:40:36 AM10/11/17
to CEF Python
In the image you can see that the framework is internally rendering at 60 fps. With 16 ms between frames. You can also see that a frame is rendered in about 1/10th of the time (about 2 ms) So in theory it could render at 500 fps with these settings. This is admittedly on a beast machine, but the point stands, there are 60 fps, half of which do not get an OnPaint.
Reply all
Reply to author
Forward
0 new messages