2014-08-25, 01:45
Since a few months ago, XBMC is able to run on Linux systems using the Android GPU drivers for EGL support via libhybris, using a (unsupported in the main xbmc repo) EGLNativeTypeHybris plugin: https://www.youtube.com/watch?v=MUorE09cC-4
More recently, we have also successfully tried XBMC running on wayland (no additions to the main repo), where wayland is running thanks to libhybris: https://www.youtube.com/watch?v=KYymcNoGmqQ and https://www.youtube.com/watch?v=DRBzOpxEaiU This is more desirable since everything is in the main repo already
There is one issue when using libhybris (either wayland or the EGLNativeTypeHybris plugin): there is a tearing appearing *sometimes - quite often - maybe depending of how much actions is in the scene* in the top right corner - always the same place, always the same size - it's a square almost 1/4 of the screen.
You can see it around minute 1:30 in the first wayland video - there is a trembling in that quarter of the screen. This issue is present both in EGLNativeTypeHybris and wayland - so the culprit is probably somewhere between libhybris egl and xbmc video renderer - maybe not getting the right refresh rate from libhybris, maybe doing it too often and overwriting some buffers - in the video above with wayland you can see xbmc reporting 600Hz refresh rate - or maybe hybris tries that with the movie too - no idea.
One of the contributors had a workaround for that issue in the EGLNativeTypeHybris plugin - see https://github.com/mihailescu2m/xbmc/blo...is.cpp#L92
I can't say I have a good idea what exactly is happening, but I would say he's made a thread (though using hybris does not require you to use a separate thread) where he is calling a paintEvent.set() in addition to the normal hybris display code (no idea how these events work in XBMC )
Unfortunately... newer versions of libhybris changed the API for how buffers are handling - and instead of having to call lockFrontBuffer -> prepare and set buffers -> unlockFrontBuffer like in the code above (ahead of the paintEvent) - now there is a callback that is executed by libhybris. We have already adapted EGLNativeTypeHybris to that - this is the commit for the new libhybris API:
https://github.com/Owersun/xbmc/commit/2...a5f06b96b9
In there you basically see that there is no more thread doing the painting, but it's subclassing HWComposerNativeWindow and moving the - prepare and set buffers - code in libhybris HWComposerNativeWindow::present virtual function.
You see that now there is no more thread calling the paintEvent like in the previous hack, and the tearing is back ... (both in wayland and EGLNativeTypeHybris using the new hybris API).
Now, here's a fun thing - if you press TAB when playing and get the menu overlay on top of the movie - the tearing is gone (see again the video at the end where there is the menu on top ... it's really smooth then!). This leads me to believe that indeed in full-screen video mode the renderer has the wrong refresh rate - while in full-screen egl application mode the refresh is OK... see also second wayland video... i was not able the see tearing, albeit the window is small...
Maybe someone here with a better understanding of the video renderer and the egl windows can understand what's going on and offer some help...
Is there a way to cap the refresh rate of the video renderer? (either up or down?)
Why is this happening only on full screen video mode, and when the menu is shown then it's not tearing anymore? Is the EGL window that shows the menu somehow fiddling with the refresh rate?
Is there a different "mode" flag being passed around for full-screen and windowed? How could I try the "windowed" mode - but a window as big as the screen... Is there a way to call that paint event from another part of the code?
How could I try a hack to simulate an invisible menu-like overlay?
For completeness... the tearing is gone only when the menu was shown, when having the overlay with the movie info at the bottom like at 1:26 there as still tearing - any idea why that would be (probably the video is still in FULL-SCREEN mode)?
Thanks!
More recently, we have also successfully tried XBMC running on wayland (no additions to the main repo), where wayland is running thanks to libhybris: https://www.youtube.com/watch?v=KYymcNoGmqQ and https://www.youtube.com/watch?v=DRBzOpxEaiU This is more desirable since everything is in the main repo already
There is one issue when using libhybris (either wayland or the EGLNativeTypeHybris plugin): there is a tearing appearing *sometimes - quite often - maybe depending of how much actions is in the scene* in the top right corner - always the same place, always the same size - it's a square almost 1/4 of the screen.
You can see it around minute 1:30 in the first wayland video - there is a trembling in that quarter of the screen. This issue is present both in EGLNativeTypeHybris and wayland - so the culprit is probably somewhere between libhybris egl and xbmc video renderer - maybe not getting the right refresh rate from libhybris, maybe doing it too often and overwriting some buffers - in the video above with wayland you can see xbmc reporting 600Hz refresh rate - or maybe hybris tries that with the movie too - no idea.
One of the contributors had a workaround for that issue in the EGLNativeTypeHybris plugin - see https://github.com/mihailescu2m/xbmc/blo...is.cpp#L92
I can't say I have a good idea what exactly is happening, but I would say he's made a thread (though using hybris does not require you to use a separate thread) where he is calling a paintEvent.set() in addition to the normal hybris display code (no idea how these events work in XBMC )
Unfortunately... newer versions of libhybris changed the API for how buffers are handling - and instead of having to call lockFrontBuffer -> prepare and set buffers -> unlockFrontBuffer like in the code above (ahead of the paintEvent) - now there is a callback that is executed by libhybris. We have already adapted EGLNativeTypeHybris to that - this is the commit for the new libhybris API:
https://github.com/Owersun/xbmc/commit/2...a5f06b96b9
In there you basically see that there is no more thread doing the painting, but it's subclassing HWComposerNativeWindow and moving the - prepare and set buffers - code in libhybris HWComposerNativeWindow::present virtual function.
You see that now there is no more thread calling the paintEvent like in the previous hack, and the tearing is back ... (both in wayland and EGLNativeTypeHybris using the new hybris API).
Now, here's a fun thing - if you press TAB when playing and get the menu overlay on top of the movie - the tearing is gone (see again the video at the end where there is the menu on top ... it's really smooth then!). This leads me to believe that indeed in full-screen video mode the renderer has the wrong refresh rate - while in full-screen egl application mode the refresh is OK... see also second wayland video... i was not able the see tearing, albeit the window is small...
Maybe someone here with a better understanding of the video renderer and the egl windows can understand what's going on and offer some help...
Is there a way to cap the refresh rate of the video renderer? (either up or down?)
Why is this happening only on full screen video mode, and when the menu is shown then it's not tearing anymore? Is the EGL window that shows the menu somehow fiddling with the refresh rate?
Is there a different "mode" flag being passed around for full-screen and windowed? How could I try the "windowed" mode - but a window as big as the screen... Is there a way to call that paint event from another part of the code?
How could I try a hack to simulate an invisible menu-like overlay?
For completeness... the tearing is gone only when the menu was shown, when having the overlay with the movie info at the bottom like at 1:26 there as still tearing - any idea why that would be (probably the video is still in FULL-SCREEN mode)?
Thanks!