New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X11: fix usage of required configuration values #15148
Conversation
@AlwinEsch Can you make the changes? IMO this should go into v18 (@MartijnKaijser) so we have working viz and screen savers on X11. |
Is updated. Sit still to change the addons, unbelievably complex to convert these to the shader type :-| . |
@FernetMenta Can you comment on why there is this custom visual selection code in |
@pkerling when selecting a config for rendering to the main window GetEGLConfig returns a config that matches the native visual. Such a config has all the attributes required by Kodi core. |
I believe you that it does (after all it is working fine so far), but that does not really answer my question :-) Which is why |
8540151
to
44f42e3
Compare
I had to add a second commit. When switching I noticed another error. Some addons need the stuff described above, but they have always been removed by Kodi with glClear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minors then I think we are good to go
} | ||
|
||
bool CGLContextEGL::SuitableCheck(EGLDisplay& eglDisplay, EGLConfig& config) | ||
{ | ||
if (config == EGL_NO_CONFIG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this block to IsSuitableVisual
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your mean to let the
if (config == EGL_NO_CONFIG)
{
CLog::Log(LOGERROR, "Failed to determine egl config for visual info");
return false;
}
away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And:
bool CGLContextEGL::IsSuitableVisual(XVisualInfo *vInfo)
{
EGLConfig config = GetEGLConfig(m_eglDisplay, vInfo);
if (config == EGL_NO_CONFIG)
{
CLog::Log(LOGERROR, "Failed to determine egl config for visual info");
return false;
}
return true;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If yes makes not direct sense, before was it only to report a failed GetEGLConfig and to prevent the further check. But now becomes everything done inside the GetEGLConfig and can report EGL_NO_CONFIG frequently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should GetEGLConfig
frequently report EGL_NO_CONFIG
? In that case we will not get any display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the IsSuitableVisual call complete, where this becomes called is the GetEGLConfig called directly after.
Now think that it is a remnant of the conversion of the old CGLContextGLX where this call was necessary.
The CLog::Log(LOGERROR, "Failed to determine egl config for visual info");
should never come, only for the worst case where a "eglGetConfigs" call returns true with a empty entry in list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Point still stands: This function is never called with EGL_NO_CONFIG
, so having the log message makes no sense
b70439b
to
f982588
Compare
jenkins build this please |
How is the state to bring in? The most OpenGL related addons need this. |
if (m_renderClearCnt == 0) | ||
return; | ||
|
||
/* make five render calls with clear to prevent mix with cached display data */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's really crazy, but without that, when you start some visualizations (which used previous screen data and no "glClear") it flickers to the wild (for example, some modes in Screensaver Solar Winds)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hack should under no circumstances go in.
I just noticed another thing: The screensavers render directly to display, right? If so, not calling glClear will not solve the problem for example on Wayland. We call eglSwapBuffers
to display the content, but this is not a simple "front-back-buffer-switch" which it might have been in former times. Modern graphics drivers have multiple buffers ready and cycle through them as they see fit. Spec says: "The contents of ancillary buffers are always undefined after calling eglSwapBuffers. The contents of the color buffer are undefined if the value of the EGL_SWAP_BEHAVIOR attribute of surface is not EGL_BUFFER_PRESERVED." So the color buffer content is undefined when not calling glClear
and the screensaver cannot rely on any specific content still being there.
xbmc/windowing/X11/GLContextEGL.cpp
Outdated
m_eglConfig = GetEGLConfig(m_eglDisplay, vInfo); | ||
XFree(vInfo); | ||
|
||
if (m_eglConfig == EGL_NO_CONFIG) | ||
{ | ||
CLog::Log(LOGERROR, "failed to get eglconfig for visual id"); | ||
CLog::Log(LOGWARNING, "failed to get matching eglconfig for visual 0x%x of the window and is not suitable", visualid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLog::Log(LOGWARNING, "failed to get matching eglconfig for visual 0x%x of the window and is not suitable", visualid); | |
CLog::Log(LOGERROR, "failed to get suitable eglconfig for visual 0x%x", visualid); |
Leave as error
511c6fd
to
e8aef1b
Compare
@@ -68,6 +68,9 @@ bool CGUIWindowScreensaver::OnMessage(CGUIMessage& message) | |||
|
|||
case GUI_MSG_WINDOW_INIT: | |||
{ | |||
// override the clear colour - we must never clear fullscreen | |||
m_clearBackground = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found another way, the way before with count was really not nice.
There are also a few other places in Kodi that go that way. Also, 3D video rendering must avoid a glClear is called (over other way).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #15148 (comment) - not calling glClear
does not mean that the buffer contents are preserved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it then also needed on other fullscreen places in Kodi? In a visualization I can maybe understand, this are combinated with other parts on screen and could get mixed up.
There must be somewhere and somehow a way possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it then also needed on other fullscreen places in Kodi?
How do you know it is needed? It might just be a performance optimization (no use clearing the buffer if we draw over everything anyway) - do you have a specific place where you know that it is really necessary?
Does the complete screen content have to be copied with every render call to have it back at the next frame?
Yes and no. There are extensions that can be used instead of the often unsupported EGL_BUFFER_PRESERVED
. But they will not give you the last frame, but instead an arbitrary previous frame and tell you how old it is (EGL_EXT_buffer_age
) - this also works with Wayland. But it will not help with the solarwinds screensaver because I guess that it is implemented in a way that it needs the exact previous frame. Then yes, you need to copy when swapping buffers. This is also what the driver would usually do for you anyway when setting EGL_BUFFER_PRESERVED
. See also e.g. https://community.arm.com/graphics/b/blog/posts/mali-performance-3-is-egl_5f00_buffer_5f00_preserved-a-good-thing
Other option is to modify solarwinds screensaver to always draw everything.
Have now also tested with wayland over xbmc/screensavers.rsxs#20 and runs without problems |
7d97867
to
40c111e
Compare
Have removed the last commit. Must be for Leia now a separate request created? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be OK now
Afaik we have not branched yet, so no backport needed |
Before has Kodi checked only the EGL_NATIVE_VISUAL_ID and ignored others. With this was e.g. on a some addons the needed EGL_DEPTH_SIZE not available. This separates a part of IsSuitableVisual (...) into a separate function (SuitableCheck (...)) which is checked by GetEGLConfig and takes the necessary configuration from the list.
This calls GetEGLConfig which becomes also called direct after the place where IsSuitableVisual is called.
@AlwinEsch thanks for your persistence! happy to see the screensavers and visualizations get some love :) |
Description
Before has Kodi checked only the EGL_NATIVE_VISUAL_ID and ignored
others. With this was e.g. on some addons the needed EGL_DEPTH_SIZE
not available.
This separates a part of
IsSuitableVisual(...)
into a separate function(
SuitableCheck(...)
) which is checked byGetEGLConfig(...)
and takes thenecessary configuration from the list.
Motivation and Context
Sit for a while because the addons which use GL to switch to the 4.0 version so that they work again and was almost senseless.
Thought all the time to have done something wrong in the rework and now found that the error lies in Kodi.
In addition, I found in the end that it was with the override
KODI_GL_INTERFACE=GLX ./Kodi-x11
went and finally found that the error lies in Kodi itself.How Has This Been Tested?
Screenshots (if appropriate):
Types of change
Checklist: