Open heitbaum opened 2 years ago
Maybe it's not waiting for vsync, you can try extending the sleep (make it 40) here: https://github.com/xbmc/xbmc/blob/master/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp#L148
Did you try perf top
? It should show which function spends most time executing. However, I'm not sure if this command requires debug symbols or not. I believe it would be easier to debug this issue with debug symbols enabled, regardless of method. Sadly, size of Kodi's debug symbols exploded in the past and it's not feasible to load them in debugger directly on target.
Maybe it's not waiting for vsync, you can try extending the sleep (make it 40) here: https://github.com/xbmc/xbmc/blob/master/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp#L148
@lrusak - looks like you found the line of code to manipulate it - first go. 👍
@lrusak where is syscall which waits on vsync located? I'll try to debug DRM driver to see what could be improved.
Did you try
perf top
? It should show which function spends most time executing. However, I'm not sure if this command requires debug symbols or not. I believe it would be easier to debug this issue with debug symbols enabled, regardless of method. Sadly, size of Kodi's debug symbols exploded in the past and it's not feasible to load them in debugger directly on target.
@jernejsk - I did now - as the below - it settled on this as the top:
@heitbaum Can you remove https://github.com/xbmc/xbmc/blob/master/xbmc/windowing/gbm/WinSystemGbm.cpp#L275-L278 and https://github.com/xbmc/xbmc/blob/master/xbmc/windowing/gbm/WinSystemGbm.h#L74 (with no other modification) and see if this changes something?
@heitbaum Can you remove https://github.com/xbmc/xbmc/blob/master/xbmc/windowing/gbm/WinSystemGbm.cpp#L275-L278 and https://github.com/xbmc/xbmc/blob/master/xbmc/windowing/gbm/WinSystemGbm.h#L74 (with no other modification) and see if this changes something?
Compiling up now 👍
As a FYI - I booted back into an arm32 userland image (from the 15th Jan) - pretty much the same - 5.16.1-rc1. This is without the https://github.com/xbmc/xbmc/blob/master/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp#L148 and CPU running @ 20%
Nothing changed much in kernel and Kodi (for rendering) for some time now. I guess this would be long time present bug, just nobody really dig into it.
Here is the output with your patch: CPU between 6.6-7.8%. Think you are right that it has been there for a while. I only noticed that it was on my desk for a few days and was looking into the temp/freq/governor and subsequently load issues.
--- a/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp 2022-01-23 05:52:41.460933783 +0000
+++ b/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp 2022-01-23 05:52:09.374274477 +0000
@@ -145,7 +145,7 @@
}
else
{
- KODI::TIME::Sleep(10);
+ KODI::TIME::Sleep(40);
}
}
--- a/xbmc/windowing/gbm/WinSystemGbm.cpp 2022-01-13 22:29:43.000000000 +0000
+++ b/xbmc/windowing/gbm/WinSystemGbm.cpp 2022-01-23 08:34:41.571847518 +0000
@@ -267,11 +267,6 @@
resource->OnLostDisplay();
}
-std::unique_ptr<CVideoSync> CWinSystemGbm::GetVideoSync(void* clock)
-{
- return std::make_unique<CVideoSyncGbm>(clock);
-}
-
std::vector<std::string> CWinSystemGbm::GetConnectedOutputs()
{
return m_DRM->GetConnectedConnectorNames();
--- a/xbmc/windowing/gbm/WinSystemGbm.h 2022-01-13 22:29:43.000000000 +0000
+++ b/xbmc/windowing/gbm/WinSystemGbm.h 2022-01-23 08:35:53.161579968 +0000
@@ -71,8 +71,6 @@
protected:
void OnLostDevice();
- std::unique_ptr<CVideoSync> GetVideoSync(void* clock) override;
-
std::shared_ptr<CDRMUtils> m_DRM;
std::unique_ptr<CGBMUtils> m_GBM;
std::shared_ptr<CVideoLayerBridge> m_videoLayerBridge;
As I said, you should not do any other change. KODI::TIME::Sleep(40);
defeats the purpose. I'm interesting if my change also lowers the load.
Hi @jernejsk - doesn’t seem to reduce without the kodi::TIME::Sleep(40);
what is CPU load? perf top shows only most called/time consuming functions, not actual load.
Sitting at 21-25% CPU
Thanks for testing! Hopefully @lrusak knows what to check/fix.
The atomic commit itself should be blocking as we don't use the asynchronous flag.
There is also some info in this old PR: https://github.com/xbmc/xbmc/pull/14266
Problem
# top -H
is showing that the Allwinner H6 chip in the Tanix TX6 is running high utilisation (even though there is no active processing.)doing an
strace -p
on the kodi.bin process shows the following.This processing should result in IDLE and a CPU of Zero.
Testing to date
I have tested the following:
None of these updates / changes has made any appreciable difference / fix,
Discovery
schedutil
is the governor in use.480Khz
because of the "idle CPU use".kodi.bin
process viasystemctl stop kodi
- theschedutil
governor does reduce the CPU to a frequency of 480Khz.1080Khz
and1320Khz
Frequency and a Temperature of 69°C.In gdb - thread 1 - is looping on the below (so assuming that this is the "CPU load we are seeing".
Reading