gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

Errors on Rock64

Open boblun opened this issue 7 years ago • 10 comments

So far so good but certain things fail

With LIBGL_FB=0 ffplay works in window but not in fullscreen (Block in topleft - surface seems to be there because cant access desktop) LIBGL_FB=3 works both Windowed and Fullscreen

Running mythtv get LIBGL: FPE Vertex shader compile failed: $&�� LIBGL: FPE Fragment shader compile failed: $&�� LIBGL: FPE Program link failed: $&��

boblun avatar Sep 25 '18 06:09 boblun

I haven't tried mythtv yet, but I guess the shader it created are not convered properly... Can you run it with LIBGL_LOGSHADERERROR=1 LIBGL_COMMENTS=1 to have more detail about the shaders that don't compile (also, strange that the error message is just garbage).

For the fullscreen issue with LIBGL_FB=0, there is not much I can do, I guess the issue is in the egl driver and it's interaction with X11. Hopefully LIBGL_FB=3 doesn't introduce too much slow down (or no slowdown at all compared to LIBGL_FB=0).

ptitSeb avatar Sep 25 '18 06:09 ptitSeb

MythTV does seem to have its own problems - at least the current git version. When I select GLES1.5 it gets further but fails with

2018-09-25 22:40:03.424096 I Trying the OpenGL 1.2 render 2018-09-25 22:40:03.432266 I OpenGL painter using existing OpenGL context. QEGLPlatformContext: Failed to create context: 3009 2018-09-25 22:40:03.562902 E OpenGL: Init an invalid context. Missing call to setWidget or create?

I suspect MythTv is using GL VIa QT and the QT Lib is possibly not honouring LD_LIBRARY_PATH, (Hardwired to a particular GL Lib) which either isn't there or is not working. Interestingly it calls QT EGL which perhaps opens the door to using EGL rather than GL4ES. This is backed up by the fact that making GL4ES libGL unavailable results in exactly the same behaviour. I think this might be a QT issue. I am continuing to look into it.

(I Havent got GL4ES libGL enabled in the system directories for safety reasons)

On the Fullscreen issue, I don't think this is likely to be the problem, other EGL only apps work fine in fullscreen, What is the difference between FB=0 and 3?

boblun avatar Sep 25 '18 12:09 boblun

For Qt, it is possible your QtOpenGL is compiled for GLES2. You probably need to build it for Desktop OpenGL for this to work (it's always build for GLES2 on ARM platforms). Also, it probably try to open libGLESv2.so, and that will somehow conflict with libGL.so because most functions name are common.

On the Fullscreen issue, with LIBGL_FB=0, the egl context is created in a regular way, using current eglDisplay and with the X11 Window gave in parameter in the glX functions. With LIBGL_FB=3, the egl context created is a XPixMap (if available) or PBuffer (as a fallback). Then, at the swapbuffer, a simple eglSwapbuffers(...) is called for LIBGL_FB=0 where it will be a full blit with LIBGL_FB=3.

ptitSeb avatar Sep 25 '18 13:09 ptitSeb

Here is the error log for the V2 Shader error IBGL: Error while compiling shader 6. Original source is: #version 110 #extension GL_ARB_texture_rectangle : enable uniform sampler2DRect s_texture0; varying vec4 v_color; varying vec2 v_texcoord0; void main(void) { gl_FragColor = texture2DRect(s_texture0, v_texcoord0) * v_color; }

======= ShaderConv Source is: #version 100 precision mediump float; precision mediump int;

#extension GL_ARB_texture_rectangle : enable uniform sampler2DRect s_texture0; varying vec4 v_color; varying vec2 v_texcoord0; void main(void) { gl_FragColor = texture2DRect(s_texture0, v_texcoord0) * v_color; }

======= Compiler message is 0:5: P0007: Extension directive must occur before any non-preprocessor tokens 0:6: L0001: Typename expected, found 'sampler2DRect'

LIBGL: End of Error log

boblun avatar Oct 04 '18 03:10 boblun

If I Set GL version 1.5 I get a similar but different failure

LIBGL: FPE Vertex shader compile failed: source is // FPE_Shader generated // ** Vertex Shader ** // ligthting=0 (twosided=0, separate=0, color_material=0) // secondary=0, planes=000000 // texture=00000001, point=0 varying vec4 Color; varying vec2 _gl4es_TexCoord_0;

void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; Color = gl_Color; // texturing // texture 0 active: 1
_gl4es_TexCoord_0 = gl_MultiTexCoord0.xy / gl_MultiTexCoord0.q; }

Error is: ��� LIBGL: FPE Fragment shader compile failed: source is // FPE_Shader generated // ** Fragment Shader ** // lighting=0, alpha=0, secondary=0, planes=000000, textype=00000001, texformat=00000000 point=0 varying vec4 Color; varying vec2 _gl4es_TexCoord_0; uniform sampler2D _gl4es_TexSampler_0; void main() { vec4 fColor = Color; vec4 texColor0 = texture2D(_gl4es_TexSampler_0, _gl4es_TexCoord_0); // Texture 0 active: 1, texenv=0, format=0 fColor *= texColor0; gl_FragColor = fColor; }

Error is: ��� LIBGL: FPE Program link failed: source of vertex shader is // FPE_Shader generated // ** Vertex Shader ** // ligthting=0 (twosided=0, separate=0, color_material=0) // secondary=0, planes=000000 // texture=00000001, point=0 varying vec4 Color; varying vec2 _gl4es_TexCoord_0;

void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; Color = gl_Color; // texturing // texture 0 active: 1
_gl4es_TexCoord_0 = gl_MultiTexCoord0.xy / gl_MultiTexCoord0.q; }

source of fragment shader is // FPE_Shader generated // ** Fragment Shader ** // lighting=0, alpha=0, secondary=0, planes=000000, textype=00000001, texformat=00000000 point=0 varying vec4 Color; varying vec2 _gl4es_TexCoord_0; uniform sampler2D _gl4es_TexSampler_0; void main() { vec4 fColor = Color; vec4 texColor0 = texture2D(_gl4es_TexSampler_0, _gl4es_TexCoord_0); // Texture 0 active: 1, texenv=0, format=0 fColor *= texColor0; gl_FragColor = fColor; }

Error is: ���

Thread 1 "mythfrontend" received signal SIGSEGV, Segmentation fault. realize_glenv (ispoint=, ispoint@entry=0) at /home/rock64/src/gl4es/src/gl/fpe.c:686 686 if(glprogram->has_builtin_attrib) (gdb) bt #0 0x0000007fb30ceae0 in realize_glenv (ispoint=, ispoint@entry=0) at /home/rock64/src/gl4es/src/gl/fpe.c:686 #1 0x0000007fb30d107c in realize_glenv (ispoint=0) at /home/rock64/src/gl4es/src/gl/fpe.c:521 #2 0x0000007fb30d107c in fpe_glDrawArrays (mode=5, first=0, count=4) at /home/rock64/src/gl4es/src/gl/fpe.c:521 #3 0x0000007fb30be7b0 in glDrawElementsCommon (mode=, first=85, count=4, len=85, sindices=, iindices=0x7fb6f55fc0 <MythUIImage::DrawSelf(MythPainter*, int, int, int, QRect)+1216>, instancecount=1440573064) at /home/rock64/src/gl4es/src/gl/drawing.c:346 #4 0x0000007fb704de10 in MythRenderOpenGL1::DrawBitmapPriv(unsigned int, QRect const*, QRect const*, unsigned int, int, int, int, int) (this=0x5555b302f0, tex=720, src=0x7fffffdd40, dst=0x7fffffdd10, prog=0, alpha=255, red=255, green=255, blue=255) at mythrender_opengl1.cpp:346 #5 0x0000007fb7037668 in MythRenderOpenGL::DrawBitmap(unsigned int, unsigned int, QRect const*, QRect const*, unsigned int, int, int, int, int) (this=0x5555b302f0, tex=720, target=0, src=0x7fffffdd40, dst=0x7fffffdd10, prog=0, alpha=255, red=255, green=255, blue=255) at mythrender_opengl.cpp:893 #6 0x0000007fb702ed74 in MythOpenGLPainter::DrawImage(QRect const&, MythImage*, QRect const&, int) (this=0x5555a5fb70, r=..., im= 0x7f6c0112a0, src=..., alpha=255) at mythpainter_ogl.cpp:212 #7 0x0000007fb6f55fc0 in MythUIImage::DrawSelf(MythPainter*, int, int, int, QRect) (this=0x5555dd64a0, p=0x5555a5fb70, xoffset=0, yoffset=0, alphaMod=255, clip---Type to continue, or q to quit--- Rect=...) at mythuiimage.cpp:1335 #8 0x0000007fb6f46c40 in MythUIType::Draw(MythPainter*, int, int, int, QRect) (this=0x5555dd64a0, p=0x5555a5fb70, xoffset=0, yoffset=0, alphaMod=255, clipRect=...) at mythuitype.cpp:511 #9 0x0000007fb6f46cf4 in MythUIType::Draw(MythPainter*, int, int, int, QRect) (this=0x5555de08f0, p=0x5555a5fb70, xoffset=0, yoffset=0, alphaMod=255, clipRect=...) at mythuitype.cpp:517 #10 0x0000007fb6ef0b74 in MythMainWindow::draw(MythPainter*) (this=0x5555a5dd40, painter=0x5555a5fb70) at mythmainwindow.cpp:886 #11 0x0000007fb6ef0820 in MythMainWindow::drawScreen() (this=0x5555a5dd40) at mythmainwindow.cpp:848 #12 0x0000007fb6eeee98 in MythPainterWindowGL::paintEvent(QPaintEvent*) (this=0x5555a2e3b0, pe=0x7fffffe3d0) at mythmainwindow.cpp:439 #13 0x0000007fb65b4844 in QWidget::event(QEvent*) () at /usr/lib/aarch64-linux-gnu/libQt5Widgets.so.5 #14 0x0000007fb6574f90 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/aarch64-linux-gnu/libQt5Widgets.so.5 #15 0x0000007fb657cce8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/aarch64-linux-gnu/libQt5Widgets.so.5 #16 0x0000007fb5830438 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/aarch64-linux-gnu/libQt5Core.so.5 #17 0x0000007fb65add18 in QWidgetPrivate::sendPaintEvent(QRegion const&) () at /usr/lib/aarch64-linux-gnu/libQt5Widgets.so.5 ---Type to continue, or q to quit--- #18 0x0000007fb65ae10c in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () at /usr/lib/aarch64-linux-gnu/libQt5Widgets.so.5 #19 0x0000007fb6582a00 in QWidgetPrivate::repaint_sys(QRegion const&) () at /usr/lib/aarch64-linux-gnu/libQt5Widgets.so.5 #20 0x0000007fb65d1d48 in () at /usr/lib/aarch64-linux-gnu/libQt5Widgets.so.5 #21 0x0000005555a68da0 in () (gdb)

boblun avatar Oct 04 '18 03:10 boblun

Also glDeleteQueriesARB is undefined?

boblun avatar Oct 04 '18 04:10 boblun

Hmm I notice there are no ARB Wrappers in queries.c

boblun avatar Oct 04 '18 04:10 boblun

So. For the "v2" shader, it use textureRectangle stuff, that's not supported yet, so the faillure is normal. Support for those is on my todo...

The faillure on the v1.5 is not normal. It seems no shader actually compile, like if the context is not set properly. Is there some errors, in the beggigning on the app, stating that EGL has found any config or something like that?

The ARB wrapper to queries, yes, I can add that. But remember these function are dummies and have 0 bits of precisions. What app needs that?

ptitSeb avatar Oct 04 '18 05:10 ptitSeb

OK,

I Added the ARB queries myself to get past the link error, that went OK. Clear this up for me, doesn't the wrapper pass through the arguments to GLES equivalent function unaltered. Why then are they useless?


The Converted Shaders have

#version 100 precision mediump float; precision mediump int;

#extension GL_ARB_texture_rectangle : enable

These error out saying that the directives should precede the code IE Compiler message is 0:5: P0007: Extension directive must occur before any non-preprocessor tokens 0:6: L0001: Typename expected, found 'sampler2DRect'

So the two precision lines need to come after #extensions, even though some things aren't implemented this might need to be fixed. Maybe its that way for another reason? I don't understand the code yet. *The GLES Shader spec does suggest directives come before code.


I think the failure on the 1.5 shaders in mythtv is from a misset LIBGL_GL value. I fixed it and no more segfault - But the windows that gets rendered is Empty.

In the History I get 018-10-04 17:33:17.988641 I Trying the OpenGL 1.2 render 2018-10-04 17:33:17.988999 I OpenGL painter using existing OpenGL context. QEGLPlatformContext: Failed to create context: 3009 2018-10-04 17:33:18.128028 E OpenGL: Init an invalid context. Missing call to setWidget or create?

And I think this is the cause of the hollow window - Myth TV Passes a bad EGL Context to ES4GL, I need to debug that problem first I think

kodi just generates a Black fullscreen window so at least it goes a little way, but it would be nice if it emitted some diagnostics ...

boblun avatar Oct 04 '18 07:10 boblun

For the QueriesARB: these functions just don't exist in GLES, so there is nothing to wrap (also, gl4es is now more then a simple wrapper, there are a lot of stuff happening behind the scene). I'll add the ARB functions, if you had a link error, then it's clearly needed (or youc an do a PR if you want).

For the shader, yes, the #extension should be before the other stuff, and this is not handled correctly yet. I'll try to add something to handle that in the code. But that will not fix the issue because texture2DRect and sampler2DRect are not supported in shaders for now (that will require some work, and I'll probably work on that with version 1.1.1).

For the 1.x version, yeah, the EGL stuff seems to conflict somehow. Not sure how, because the EGL context should be an ES2 context that Qt shoul dbe able to use (using LIBGL_GL=15 LIBGL_ES=2 exports)

ptitSeb avatar Oct 04 '18 08:10 ptitSeb