cef-mixer icon indicating copy to clipboard operation
cef-mixer copied to clipboard

Background not rendering, Blue Background instead

Open ghost opened this issue 6 years ago • 32 comments

Happens on some system, the system where the picture was taken has an AMD Radeon HD7600M & Intel® HD Graphics 4000.

Some other Graphics Units with the same problem: Nvidia Geforce 9500 GT, Driver version 342.01 Nvidia Geforce 9800 GT, Driver version Unknown Nvidia Geforce 545 GT, Driver version: 267.95 Nvidia Quadro FX 3800, Driver version: 342.00 AMD Radeon R9 M200X, second GPU: Intel® HD Graphics 4600 ATI Radeon HD 4650, Driver version: Unknown

190db9fe4f8084d388b2d32d31a6b11c61fd847d

ghost avatar Apr 14 '18 19:04 ghost

Are you using the sample distribution of CEF this sample provides or did you build your own? I was wondering if you are able to run the DEBUG version of this app. The D3D11 device is setup with the D3D11_CREATE_DEVICE_DEBUG when running in Debug mode and it should trace out any D3D errors. I can only assume Chromium is unable to create the shared texture on the hardware sets you have listed.

I would also be curious what information is listed in Chrome on any of those machines if you navigate to chrome://gpu in the browser.

wesselsga avatar Apr 14 '18 21:04 wesselsga

I am using the sample distribution of CEF linked in this repo.

How would I go about running the DEBUG version?

ghost avatar Apr 14 '18 21:04 ghost

You would have to build CEF with the pull request which takes quite a bit of time. With D3D11_CREATE_DEVICE_DEBUG the error messages just goto the output of OutputDebugString so you could in theory just comment out the #ifdef on line 765 in d3d11.cpp in this app and simply run the Release build. If you dont have Visual Studio on one of those test machines you can use DebugView to see the trace messages. I'm pretty sure you need the Win10 SDK installed however at a minimum to be able to create a D3D11 device with D3D11_CREATE_DEVICE_DEBUG flag. So it could be a pain if you don't already have VS installed.

I'm trying to dig up an old machine here to see if I can get something reproducible.

wesselsga avatar Apr 14 '18 21:04 wesselsga

I am currently building cef, after I am done and tested again I will get back at you...

Here is the chrome://gpu output btw:

https://pastebin.com/qLhWG8ZM

ghost avatar Apr 14 '18 22:04 ghost

if there is anything i can do to help let me know, i also have been having this issue since the 15th march update ot the CEF

winxuser avatar Apr 15 '18 03:04 winxuser

I reproduced this issue on NVidia GeForce 8400 GS (driver version 342.01). Looks like the code that was added to Chromium setting up the FBO on the D3D11 texture is likely failing. These are the error messages I'm seeing here:

[0414/215616.497:ERROR:gles2_cmd_decoder.cc(4671)] [.DisplayCompositor-0000000009E2EB90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glClear: framebuffer incomplete
[0414/215616.498:ERROR:gles2_cmd_decoder.cc(4671)] [.DisplayCompositor-0000000009E2EB90]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete

I will have to do some more digging to see if this can be resolved.

wesselsga avatar Apr 15 '18 04:04 wesselsga

that would be great. need anything let me know, ill test new and wonderful things on my old gpu hahah

winxuser avatar Apr 15 '18 04:04 winxuser

Ok, looks like the issue is setting up the gl pbuffer with the D3D11 texture. The code was using the following for the config attributes on the pbuffer:

EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT

On older hardware, ES3 isn't available via ANGLE so the call to eglCreatePbufferFromClientBuffer is failing. I updated the sample distribution linked from this project to simply use the EGL_OPENGL_ES2_BIT which hopefully should work. If we can verify this works for your hardware setups listed above - I will integrate this fix into the actual PR for CEF (probably with a fallback mechanism that attempts ES3 first and uses ES2 if that fails)

If you need to build CEF yourself (and don't want to wait for me to update the PR) ... you can make the change in gpu\command_buffer\service\external_texture_manager.cc at line 188.

Thanks!

wesselsga avatar Apr 15 '18 07:04 wesselsga

In @Flatracer's chrome://gpu output, I spotted these workarounds existing:

Disable Direct3D11 on systems with AMD switchable graphics: 451420, 755722
Applied Workarounds: disable_d3d11

This might be problematic if Chrome itself wouldn't work without these workarounds at all either - it's likely for the issue with old (feature level 10) GPUs to be distinct from this issue with Intel/AMD or AMD/AMD switchable graphics.

The bugs referred to, for reference, are #451420 and apparently #755722 which shows that Chrome is only meant to apply these workarounds on older drivers.

Driver vendor   Advanced Micro Devices, Inc.
Driver version  15.200.1062.1004
Driver date 8-3-2015

Might it be needed to disable the GPU workaround blacklist using a flag to get this to work on this kind of hardware, and should doing this not be affecting the scenario at all (e.g. if both the mixer as well as Chrome are forced to run on the AMD GPU)?

blattersturm avatar Apr 15 '18 07:04 blattersturm

@wesselsga Could you send me the new build? I just have my laptop with me and it would take ages to build it myself.

ghost avatar Apr 15 '18 10:04 ghost

@Flatracer, it seems to be the case the link in the project README to the binary distribution was updated, so only cef-mixer itself would need to be built.

However, if only the above change was made, just dropping in the new Release/ DLLs might work as well.

blattersturm avatar Apr 15 '18 10:04 blattersturm

What about nvidia gpu's @blattersturm they would give out a different log?

winxuser avatar Apr 15 '18 10:04 winxuser

@blattersturm I don't think he updated the repo with the new file, thats the same file I downloaded earlier do build the demo. 🤔

When it is the updated file, it doesn't work, still the same problem.

ghost avatar Apr 15 '18 11:04 ghost

@blattersturm is correct - if disable_d3d11 is being applied by chromium then this definitely will not work. @Flatracer - the binary distribution was the only thing updated and you should be able to just unzip and drop the new libcef.dll in your bin/ directory.

You could try updating the html_layer.cpp source file in cefmixer and add the --ignore-gpu-blacklist command-line flag in the method OnBeforeCommandLineProcessing.

I'm surprised this wouldn't work on the Nvidia systems you listed? If the last modified date of the libcef.dll is 4/15/2018 6:53 UTC time - you should have the correct latest version.

wesselsga avatar Apr 15 '18 14:04 wesselsga

I am trying this on the AMD/Intel system I mentioned very first. The Nvidia systems are from other ppl.

So, I did what you said (copied the libcef.dll over)... Still, no Background and a new error (only once though).

Here is the debug log, with a bunch of errors: debug.log

2018-04-15 17_15_23

ghost avatar Apr 15 '18 15:04 ghost

On that same machine - is disable_d311 listed in chrome://gpu?

wesselsga avatar Apr 15 '18 15:04 wesselsga

I think you mean disable_d3d11 instead of disable_d311, so yes, it is listed.

ghost avatar Apr 15 '18 15:04 ghost

Adding ignore-gpu-blacklist didn't work either.

ghost avatar Apr 15 '18 16:04 ghost

Yeah, sorry - I meant disable_d3d11. Alright, so we need to find the combination of command-line switches to force D3D11 on - even just using Chrome.

wesselsga avatar Apr 15 '18 16:04 wesselsga

I added command_line->AppendSwitchWithValue("use-angle", "d3d11"); in the method OnBeforeCommandLineProcessing in html_layer.cpp and it is working 😀

ghost avatar Apr 15 '18 17:04 ghost

Excellent, thanks for the update. I'll just add that flag to the cefmixer sample application with some code comments in case others also run into this issue.

wesselsga avatar Apr 15 '18 18:04 wesselsga

Fixed with the latest commit!

ghost avatar Apr 15 '18 19:04 ghost

Still not fixed for me, what can i do to help?

AMD 8850M + Intel Graphics 4000

ThiagoLAMF avatar Apr 21 '18 18:04 ThiagoLAMF

Which driver version of AMD are you using?

Can you run chrome://gpu in Chrome on that hardware and share the results?

My guess is we're still running into the issue @blattersturm referred to above where Chromium is falling back to D3D9 for AMD switchable graphics.

In windows Task Manager, there is an option to view the command line args for a process. When running cefmixer - can you check for any of the cefmixer process instances having the command line arg --disable_d3d11? If so, you could try adding --ignore-gpu-blacklist to the flags passed to Chromium specified in cefmixer in html_layer.cpp.

If you have Visual Studio on that machine - you can run cefmixer in VS and look for any error logs in the Output window. I'm pretty sure there will be errors about .. framebuffer incomplete since its likely Chromium isn't using D3D11.

wesselsga avatar Apr 22 '18 03:04 wesselsga

Which driver version of AMD are you using?

18.2 (latest one i think)

Can you run chrome://gpu in Chrome on that hardware and share the results?

https://pastebin.com/MVGWSsdh

In windows Task Manager, there is an option to view the command line args for a process. When running cefmixer - can you check for any of the cefmixer process instances having the command line arg --disable_d3d11?

None of the processes were running with this arg.

you could try adding --ignore-gpu-blacklist to the flags passed to Chromium specified in cefmixer in html_layer.cpp.

I tried doing that anyway, but it didn't work.

If you have Visual Studio on that machine - you can run cefmixer in VS and look for any error logs in the Output window. I'm pretty sure there will be errors about .. framebuffer incomplete since its likely Chromium isn't using D3D11.

Output seems normal i think, but im getting some dll errors though, here: https://pastebin.com/2qvW9cxJ

Maybe im doing something wrong idk. Just to clarify, im using the sample distribution for CEF.

ThiagoLAMF avatar Apr 23 '18 01:04 ThiagoLAMF

Thanks for the info. Looking at the log from the program it really should be working, that is you are getting the calls to OnAcceleratedPaint as I would expect so Chromium should have its FBO setup correctly.

In main.cpp in cefmixer there is a extern declare for AmdPowerXpressRequestHighPerformance - can you try commenting that out and re-running cefmixer? Your dump from chrome://gpu shows that Chrome has selected the Intel Graphics gpu which is normal unless you override it with a Profile setting. I'm curious if it works using the same gpu that Chrome is using. The AmdPowerXpressRequestHighPerformance should force cefmixer to select the AMD gpu - which is normally what we want.

Also you could try setting up a profile in AMD settings so that Chrome runs on the AMD gpu. (just to see if that works). Currently the string in chrome://gpu reports:

GL_RENDERER ANGLE (Intel(R) HD Graphics Family Direct3D11 vs_5_0 ps_5_0)

If you have it setup on the AMD gpu - the value for GL_RENDERER ANGLE will show 'AMD' something or other

wesselsga avatar Apr 24 '18 07:04 wesselsga

Okay, sorry that i took a long time to respond...

So commenting out the declare for AmdPowerXpressRequestHighPerformance didn't change anything. Then i created a new profile in AMD settings for cef-mixer, for running in power saver mode, and it worked! That means that it worked w/ the intel integrated gpu.

I tried to create a profile for chrome as well, to run in high performace, but no matter what, always runs on intel graphics.

Anyway, i'm thinking about building CEF and debug cef-mixer comparing both profiles. Do you think i could identify the problem this way?

ThiagoLAMF avatar Apr 28 '18 18:04 ThiagoLAMF

You can certainly try debugging cef-mixer to see if you notice anything. Another thing you could try is to disable the integrated graphics in your BIOS. Many hybrid systems have this option in the BIOS - Chromium should then be forced to use AMD. For sanity, I guess I would want to see Chromium work with the AMD graphics first.

Something sort of off-topic - I'm surprised commenting out AmdPowerXpressRequestHighPerformance didn't force the use of Intel graphics. I wonder if AMD is also handling the NvOptimus extern declare.

wesselsga avatar Apr 30 '18 14:04 wesselsga

I would be curious if you were able to run cef-mixer in DEBUG - there could potentially be some D3D11 warnings traced - I'm guessing that it might be failing to open or use the shared texture in cef-mixer.

My suspicion is that the cef-mixer application and Chromium are actually using 2 different gpus - in which case the sharing wouldn't work. And cef-mixer basically will not render anything if it fails to open the shared texture.

If you do get a DEBUG build running - maybe step through the open_shared_texture call to see if it is successfully opening the texture object.

To easily run cef-mixer DEBUG, just copy the Release folder from the sample distribution and rename it to Debug. Then you can switch Visual Studio to DEBUG for the cef-mixer project.

I have updated the cef-mixer app to display the name of the GPU adapter it is using in the Window title bar. You can also dump the source of the HTML views by using a new flag on the command line:

cefmixer.exe chrome://gpu --view-source

With the --view-source command-line flag, cef-mixer will dump the HTML source to temporary files in the folder C:\users\[your-user]\AppData\Local\cefmixer . This way, even when the app is unable to render the page - we can snoop the chrome://gpu page and see what Chromium is using for its gpu when running with cef-mixer.

wesselsga avatar May 02 '18 12:05 wesselsga

My suspicion is that the cef-mixer application and Chromium are actually using 2 different gpus - in which case the sharing wouldn't work. And cef-mixer basically will not render anything if it fails to open the shared texture.

I think you might be right, that explains why it works when cef-mixer is in power saving mode. I ran the cef-mixer in debug mode but i didn't find any obvious errors or anything in the call for open_shared_texture.

For sanity, I guess I would want to see Chromium work with the AMD graphics first.

Chrome just won't run w/ the AMD card, and honestly i have no idea what to do. :( I can't trust the AMD settings, it won't let me run chrome in high performance. I tried a workaround by renaming the chrome.exe to chrome_test.exe and i successfully changed the settings to high performance, however chrome://gpu still shows the intel card.

I also tried to disable the intel graphics in the BIOS, but there's no option, apparently you can't use only the AMD card in most machines with switchable graphics.

Here's the output for chrome://gpu with the flag you added: https://pastebin.com/VcLB7VPS

Also a screenshot that shows the application running and the current settings in amd ui:

cef

ThiagoLAMF avatar May 13 '18 00:05 ThiagoLAMF