After enable egl in Cobalt, it can display the Youtube page, but the UI display in Blue color, could any one help to point out which caused it?
Asked
Active
Viewed 193 times
0
-
Hi! Just to eliminate the possibility, since the "No Signal!" is white and everything else is faded blue, is it possible that the TV's "No Signal!" overlay is also putting up a faint blue layer in front of the application? – Andrew Top Mar 02 '17 at 17:55
-
@Andrew, the 'No Signal' does not matter, when I disabled the 'No Signal' layer, the problem still exist. – bitchainer Mar 03 '17 at 00:21
-
Hmm, okay then. So it looks like not a single pixel on the screen is pure white (even the white selector, which is rendered as a white rectangle, not a texture), they are all tinted blue, so it looks like it's not a texture color format problem. We don't have any kind of overlay surface that we draw on top of everything, so I don't think it's that. Do you see any red at all? Could it be just missing red? So it could be a render target setting? – Andrew Top Mar 04 '17 at 23:32
-
You can try playing with render target configuration options in cobalt/renderer/backend/egl/graphics_system.cc:65 and see if that has an effect. You can also try adjusting the setting for SB_PREFERRED_RGBA_BYTE_ORDER in your platform's configuration_public.h to see if it has an effect. It should be SB_PREFERRED_RGBA_BYTE_ORDER_RGBA for EGL/GLES2 platforms, but you can also try SB_PREFERRED_RGBA_BYTE_ORDER_BGRA and SB_PREFERRED_RGBA_BYTE_ORDER_ARGB. – Andrew Top Mar 04 '17 at 23:49
-
@Andrew, after changing the SB_PREFERRED_RGBA_BYTE_ORDER to SB_PREFERRED_RGBA_BYTE_ORDER_BGRA or SB_PREFERRED_RGBA_BYTE_ORDER_ARGB, it does not have any changes, and it seemed SB_PREFERRED_RGBA_BYTE_ORDER only support BGRA or RGBA from the code where it used in https://cobalt.googlesource.com/cobalt/+/9fd106630afcfc799d1f7d301e19935ee431681e/src/cobalt/renderer/rasterizer/skia/skia/config/SkUserConfig.h. And I also add the startup logo when load Cobalt, and it showed it does support red color, but the color is not pure red(255,0,0). – bitchainer Mar 06 '17 at 02:13
-
@Andrew, from the display side of the platform(use EGL/GLES2), it needed ARGB color format, but from the setting in https://cobalt.googlesource.com/cobalt/+/9fd106630afcfc799d1f7d301e19935ee431681e/src/cobalt/renderer/backend/egl/graphics_system.cc, it used EGL_BIND_TO_TEXTURE_RGBA, maybe it's not incompatible, but when I changed the config in graphics_system.cc:65 or configuration_public.h, nothing can work, so is there a way to make it compatible to have a try? – bitchainer Mar 06 '17 at 02:23
-
@Andrew, from the source code in https://cobalt.googlesource.com/cobalt/+/9fd106630afcfc799d1f7d301e19935ee431681e/src/third_party/skia/include/core/SkImageInfo.h, you also find that SK_*32_SHFIT values must correspond to BGRA or RGBA byte order, it does not support ARGB byte order. – bitchainer Mar 06 '17 at 02:42
-
hmmm, okay I see. Would you be able to tell me what happens when, in cobalt/renderer/rasterizer/skia/hardware_rasterizer.cc, you add the lines: GL_CALL(glClearColor(1, 1, 1, 1)); GL_CALL(glClear(GL_COLOR_BUFFER_BIT)); GL_CALL(glFlush()); graphics_context_->SwapBuffers(render_target_egl); return; To HardwareRasterizer::Impl::Submit(), right near the beginning, after the line "backend::GraphicsContextEGL::ScopedMakeCurrent(graphics_context_, render_target_egl);"? That should result in pure white output, but I'm guessing it will be tinted blue. – Andrew Top Mar 07 '17 at 04:25
-
Is it possible that in your platform's comparable version of starboard/shared/x11/application_x11.cc, there is some debug code that sets up an extra layer in front of the application's UI layer? Is your video player working right now? Does the problem persist when you play a video? Could it be that glColorMask() was previously set to a funny value? What if you call it somewhere each frame in HardwareRasterizer::Impl::Submit() with parameters glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)? – Andrew Top Mar 07 '17 at 04:31
-
And concerning EGL_BIND_TO_TEXTURE_RGBA, that is only actually needed for tests, so for Cobalt itself, you can try simply removing that from the attribute list and see if it makes a difference. – Andrew Top Mar 07 '17 at 04:33
-
@Andrew, after adding the lines: GL_CALL(glClearColor(1, 1, 1, 1)); GL_CALL(glClear(GL_COLOR_BUFFER_BIT)); GL_CALL(glFlush()); graphics_context_->SwapBuffers(render_target_egl); return; To HardwareRasterizer::Impl::Submit(), it display blue as you said, see the 3rd picture above. And I have try to remove the EGL_BIND_TO_TEXTURE_RGBA setting, but the problem still exist, no change at all. – bitchainer Mar 07 '17 at 05:53
-
@Andrew, I also call glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) at the beginning or eng in HardwareRasterizer::Impl::Submit(), there is no change. PS. The video can not be played yet, so can not see the difference. – bitchainer Mar 07 '17 at 06:26
-
Hmm, this is a bit strange. To narrow down where this blue is coming from, maybe you can try building the small GL example program included with starboard. All it does is use EGL to create a GLES2 context within which it uses glScissor() and glClear() to render a moving rectangle on the screen. It is in starboard/examples/glclear. You can build it by typing "ninja glclear -C out/my-platform_debug". If it is easy to run executables other than cobalt on your platform, please let me know if the blue appears. It might be helpful to adjust the glClearColor() parameters to be white only. – Andrew Top Mar 07 '17 at 06:39
-
If it is difficult to build targets other than Cobalt on your platform (like the glclear example), you could try adding some test code to GraphicsSystemEGL::GraphicsSystemEGL(). This function will get called to initialize the EGL Display within Cobalt. Can you try adding to the end of that function a loop that clears the screen to white and then swaps the buffer? I'd like to know if this is caused by Cobalt, the EGL attributes passed in to glChooseConfig(), or from code outside of Cobalt (e.g. Starboard platform code that is configuring Cobalt's UI layer to render with blue). – Andrew Top Mar 07 '17 at 06:49
-
If you'd like, e-mail me at aabtop@google.com and we can continue the conversation there, where it will be easier to share code. – Andrew Top Mar 07 '17 at 06:50
-
@Andrew, I can build and run glclear example, the small square will keep moving and changing different color. But I don't know whether it displayed right or not. – bitchainer Mar 07 '17 at 07:24
-
@Andrew, it seemed the glclear sample also has the same problem, the background color is blue, as you can see the picture above. – bitchainer Mar 07 '17 at 07:55
-
@Andrew, after some tests, I have found that cobalt or glclear sample will be influenced by the default background color(pure blue) of the tv system, if I changed the tv system background color to black, then cobalt will not display in blue, but the Brightness is low. – bitchainer Mar 07 '17 at 08:31
-
@Andrew, I attached UI above, you can see the color is much dark, it's not bright. – bitchainer Mar 07 '17 at 08:39
-
@Andrew, I have found the root cause, the egl window alpa value is not right, thank you so much for your kind help! – bitchainer Mar 07 '17 at 09:41
1 Answers
0
Set the alpha value of the egl window(EGLNativeWindowType) to 0xff when it's created.

bitchainer
- 535
- 2
- 19
-
Ahhh excellent, happy to hear it's figured out! It sounds like the solution involved a change to the Starboard implementation (e.g. SbWindowGetPlatformHandle() I think?), but if you had to change any of the common Cobalt code, I'd like to know so that we can improve things in general. – Andrew Top Mar 07 '17 at 22:04
-
@Andrew, yes, I added a member for SbWindowPrivate, created the fdev_window type egl window with memory allocated, set its width/height and alpa value in the construct function, and freed the egl window in the descontruct function, in window_internal.cc, then used it in SbWindowGetPlatformHandle. This egl related code is in controled with egl macro defintion as it's just for egl not for directfb. The egl macro defination I set is in cobalt/build/config/base.gypi. – bitchainer Mar 08 '17 at 02:53