30 fps cap

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

30 fps cap

Postby sunflare » Mon Aug 11, 2014 3:49 pm

hi

i'm using windowless rendering from the new 2062 branch (rev 1804) and can't seem to get past 30 fps. CefBrowserSettings.windowless_frame_rate doesn't seem to do anything above 30, if i set it lower than 30, the setting works. According to the comment in the header file, this should go up to 60.

i'm pretty sure that this is not a performance problem, because i get almost exactly 30 fps, even if i resize the browser window to 100x100 pixels.
It shouldn't be a message loop problem either, I call CefDoMessageLoopWork() after every frame of my graphics engine, which runs uncapped at about 3000fps at the moment.

while we're at it: why is there a cap on CefBrowserSettings.windowless_frame_rate at all? Why shouldn't I be able to render the cef frame at 120 fps if it makes sense for my application?

thanks in advance
sunflare
Techie
 
Posts: 22
Joined: Sat Apr 26, 2014 2:42 pm

Re: 30 fps cap

Postby nvine » Mon Aug 11, 2014 11:18 pm

I think the problem is that you are not calling CefDoMessageLoopWork() very often. Decrease the resolution of the timer used to call CefDoMessageLoopWork(), say to 1000/60 milliseconds.
nvine
Mentor
 
Posts: 56
Joined: Tue Feb 21, 2012 11:13 pm

Re: 30 fps cap

Postby sunflare » Tue Aug 12, 2014 4:22 am

nvine wrote:I think the problem is that you are not calling CefDoMessageLoopWork() very often. Decrease the resolution of the timer used to call CefDoMessageLoopWork(), say to 1000/60 milliseconds.

as stated in the previous post, CefDoMessageLoopWork() is called about 3000 times a second.
sunflare
Techie
 
Posts: 22
Joined: Sat Apr 26, 2014 2:42 pm

Re: 30 fps cap

Postby magreenblatt » Tue Aug 12, 2014 5:58 am

sunflare wrote:while we're at it: why is there a cap on CefBrowserSettings.windowless_frame_rate at all?

Because there is a trade-off between fps and resource usage.

sunflare wrote:Why shouldn't I be able to render the cef frame at 120 fps if it makes sense for my application?

New frames are generated at the vsync rate, which is generally 60fps.

See https://code.google.com/p/chromiumembed ... il?id=1257 for details.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: 30 fps cap

Postby sunflare » Tue Aug 12, 2014 6:20 am

magreenblatt wrote:New frames are generated at the vsync rate, which is generally 60fps.

generally yes, but not always
there are more and more 120/144hz displays coming out.

but thats just an aside, i can live with 60 fps. the real problem is that it caps at 30
sunflare
Techie
 
Posts: 22
Joined: Sat Apr 26, 2014 2:42 pm

Re: 30 fps cap

Postby magreenblatt » Tue Aug 12, 2014 6:46 am

What frame rate do you get in cefclient when running with the `--off-screen-rendering-enabled` command-line flag? Last I checked https://webglsamples.googlecode.com/hg/field/field.html was reporting around 45fps on Windows and 60fps on Linux and OS X. Unfortunately that URL is currently down so you'll have to find something else to test with.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: 30 fps cap

Postby sunflare » Tue Aug 12, 2014 7:21 am

the benchmark (the URL works for me btw.) reports 60 fps but it doesn't seem to actually display 60 fps, it looks like 30
when i open the same thing in chrome or in cefclient without --off-screen-rendering-enabled it looks a lot smoother, even though it reports the same fps
Last edited by sunflare on Tue Aug 12, 2014 7:39 am, edited 2 times in total.
sunflare
Techie
 
Posts: 22
Joined: Sat Apr 26, 2014 2:42 pm

Re: 30 fps cap

Postby magreenblatt » Tue Aug 12, 2014 7:37 am

Ok, so that's likely the behavior with the default framerate (30fps). Now try adding `--off-screen-frame-rate=60` and see if that makes a difference.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: 30 fps cap

Postby sunflare » Tue Aug 12, 2014 7:40 am

yeah, with --off-screen-frame-rate=60 it works in cefclient
sunflare
Techie
 
Posts: 22
Joined: Sat Apr 26, 2014 2:42 pm

Re: 30 fps cap

Postby sunflare » Tue Aug 12, 2014 10:18 am

ok, i'm not so sure anymore

i've written a little patch that measures the onPaint() calls that happen each second in cefclient

according to this, cefclient can't get above 30 fps either with '--off-screen-rendering-enabled --off-screen-frame-rate=60' o.O

here is the patch:
Code: Select all
--- osrenderer.cpp   2014-08-12 17:11:46.708042600 +0200
+++ /home/sunflare/osrenderer.cpp   2014-08-12 17:09:05.000000000 +0200
@@ -4,6 +4,9 @@
 
 #include "cefclient/osrenderer.h"
 
+#include <iostream>
+#include <ctime>
+
 #if defined(OS_WIN)
 #include <gl/gl.h>
 #include <gl/glu.h>
@@ -264,6 +267,18 @@
     // Disable alpha blending.
     glDisable(GL_BLEND);
   }
+
+  if (type == PET_VIEW) {
+    static unsigned framesSinceTime = 0;
+    static unsigned lastTime = time(0);
+    unsigned currentTime = time(0);
+    ++framesSinceTime;
+    if ((currentTime - lastTime) > 0) {
+      std::cout << "fps: " << framesSinceTime << "\n";
+      framesSinceTime = 0;
+      lastTime = currentTime;
+    }
+  }
 }
 
 void ClientOSRenderer::SetSpin(float spinX, float spinY) {
sunflare
Techie
 
Posts: 22
Joined: Sat Apr 26, 2014 2:42 pm

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 48 guests