question about what thread calls OnPaint

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.

question about what thread calls OnPaint

Postby sepehrl » Sun Oct 04, 2015 4:39 pm

Hello, I have a little confusion about where exactly OnPaint is being called. In versions prior to 2494 (current dev branch), I used to have a mutex in my CEF renderer class and copy the buffer out of it for my UI thread but after I upgraded to 2494 I noticed OnPaint is always being called on my UI thread and once my UI update() loop tries to pull the copied buffer, it raises an exception because the mutex is already locked by the same thread.

So bottom line, my question is who calls the OnPaint and where? docs says after I call Invalidate(), OnPaint is supposed to be called asynchronously but that is not happening in my case.

I am not actually complaining, the performance is fantastic with 2494, I no longer need to double-copy the browser buffer, I am just curious if something has changed in the architecture that I am not aware of. Thanks in advance!

I am using: CEF3 - 2494 on Windows 10
sepehrl
Newbie
 
Posts: 5
Joined: Sun Oct 04, 2015 4:30 pm

Re: question about what thread calls OnPaint

Postby magreenblatt » Sun Oct 04, 2015 5:59 pm

What CEF version were you using previously? Are you using software or GPU rendering?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: question about what thread calls OnPaint

Postby sepehrl » Sun Oct 04, 2015 6:47 pm

magreenblatt wrote:What CEF version were you using previously? Are you using software or GPU rendering?

2454 was the version before it (the one that calls OnPaint in a seperste thread). I am assuming by software rendering you mean launching CEF by --disable-gpu and --disable-gpu-compositing; in that case I use the software renderer.
I have not changed the passed command lines since I upgraded. I pass the above two commands and the OSR framerste switch only.
sepehrl
Newbie
 
Posts: 5
Joined: Sun Oct 04, 2015 4:30 pm

Re: question about what thread calls OnPaint

Postby magreenblatt » Sun Oct 04, 2015 8:12 pm

All CEF versions should call OnPaint on the browser process UI thread. It's possible that the asynchronous nature of Invalidate has changed, though.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: question about what thread calls OnPaint

Postby sepehrl » Tue Oct 06, 2015 12:00 pm

Thanks so much for clarification. Is there a way to reliably check for the behavior of Invalidate() during runtime beside CEF version checking and conditional compilation?
sepehrl
Newbie
 
Posts: 5
Joined: Sun Oct 04, 2015 4:30 pm

Re: question about what thread calls OnPaint

Postby magreenblatt » Tue Oct 06, 2015 12:11 pm

sepehrl wrote:Thanks so much for clarification. Is there a way to reliably check for the behavior of Invalidate() during runtime beside CEF version checking and conditional compilation?

If it's not asynchronous then I would consider that a bug. Feel free to add an issue for it.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: question about what thread calls OnPaint

Postby sepehrl » Tue Oct 06, 2015 12:19 pm

It has actually a better performance in my point of view. Having a mutex and double-copying the browser buffer is now gone. I propose CEF keeps it that way! :)
Before this, I could not go beyond 1920x1080 and now, because double buffering is gone I can resize my browser up to 4k resolutions and still running at 60fps.
I am now able to directly feed the OnPaint buffer into an OpenGL texture without copying it which is much faster.
sepehrl
Newbie
 
Posts: 5
Joined: Sun Oct 04, 2015 4:30 pm

Re: question about what thread calls OnPaint

Postby magreenblatt » Tue Oct 06, 2015 12:48 pm

sepehrl wrote:It has actually a better performance in my point of view. Having a mutex and double-copying the browser buffer is now gone. I propose CEF keeps it that way! :)
Before this, I could not go beyond 1920x1080 and now, because double buffering is gone I can resize my browser up to 4k resolutions and still running at 60fps.
I am now able to directly feed the OnPaint buffer into an OpenGL texture without copying it which is much faster.

Please still add the bug. At a minimum the documentation needs to be fixed and a unit test added to make sure the behavior doesn't regress (assuming the behavior can be guaranteed).
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: question about what thread calls OnPaint

Postby sepehrl » Tue Oct 06, 2015 1:06 pm

sepehrl
Newbie
 
Posts: 5
Joined: Sun Oct 04, 2015 4:30 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 111 guests