Wayland: fixed build of Wayland Renderers caused by Health Monitoring API change
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Wed, 3 Jul 2013 10:24:36 +0000 (12:24 +0200)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Fri, 5 Jul 2013 10:56:48 +0000 (12:56 +0200)
Health monitoring is updated to detect thread dead-lock by incrementing
thread internal counters. The health monitoring API of Plugins was modified
to request the internal iteration counter value.

This allows the health monitor to check, if the plugin is still working.

This patch enables the build, but does not implement iteration counter
handling in Wayland-based Renderers.

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandBaseWindowSystem.h
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp
LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/include/WaylandGLESRenderer.h
LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/src/WaylandGLESRenderer.cpp
RELEASE_NOTES.txt

index 8616d05..f7542a4 100644 (file)
@@ -76,7 +76,7 @@ public:
     WaylandBaseWindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager);
     virtual ~WaylandBaseWindowSystem();
     bool init(BaseGraphicSystem<void*, void*>* sys);
-    bool start();
+    bool start(int maxIterationDurationInMS);
     void stop();
     void signalRedrawEvent();
     void wakeUpRendererThread();
@@ -133,6 +133,8 @@ protected:
     struct wl_list m_listFrameCallback;
     struct wl_list m_nativeSurfaceList;
 
+    int m_maxIterationDurationInMS;
+
     void createServerinfo(WaylandBaseWindowSystem* windowSystem);
     struct native_surface* createNativeSurface();
     void postReleaseBuffer(struct wl_buffer *buffer);
index b9df97f..8bfc306 100644 (file)
@@ -1183,7 +1183,6 @@ bool WaylandBaseWindowSystem::init(BaseGraphicSystem<void*, void*>* base)
         return false;
     }
 
-    mThreadId = renderThread;
     while (false == m_initialized)
     {
         usleep(10000); // TODO
@@ -1193,8 +1192,9 @@ bool WaylandBaseWindowSystem::init(BaseGraphicSystem<void*, void*>* base)
     return m_success;
 }
 
-bool WaylandBaseWindowSystem::start()
+bool WaylandBaseWindowSystem::start(int maxIterationDurationInMS)
 {
+    m_maxIterationDurationInMS = maxIterationDurationInMS;
     bool result = true;
     LOG_DEBUG("WaylandBaseWindowSystem", "Starting / Creating thread");
     // let thread actually run
index a516212..36ef53a 100644 (file)
@@ -33,7 +33,7 @@ class WaylandGLESRenderer : public BaseRenderer
 {
 public:
     WaylandGLESRenderer(ICommandExecutor& executor, Configuration& config);
-    bool start(int, int, const char*);
+    bool start(int, int, const char*, int);
     void stop();
     void doScreenShot(std::string fileToSave);
     void doScreenShotOfLayer(std::string fileToSave, uint id);
@@ -48,7 +48,7 @@ public:
     virtual bool getOptimizationMode(OptimizationType id, OptimizationModeType *mode);
 
     // from PluginBase
-    virtual HealthCondition pluginGetHealth();
+    virtual int getIterationCounter();
 
     // implement in inheriting classes
     virtual WaylandBaseWindowSystem* getWindowSystem(const char* displayname) = 0;
index add9ce9..eed050c 100644 (file)
@@ -35,7 +35,7 @@ WaylandGLESRenderer::WaylandGLESRenderer(ICommandExecutor& executor, Configurati
     LOG_DEBUG("WaylandGLESRenderer", "Creating Renderer");
 }
 
-bool WaylandGLESRenderer::start(int width, int height, const char* displayname)
+bool WaylandGLESRenderer::start(int width, int height, const char* displayname, int maxIterationDurationInMS)
 {
     struct wl_display* nativeDisplayHandle = NULL;
     EGLDisplay eglDisplayhandle = NULL;
@@ -77,7 +77,7 @@ bool WaylandGLESRenderer::start(int width, int height, const char* displayname)
     {
         m_pGraphicSystem->setTextureBinder(m_binder);
 
-        if (!m_pWindowSystem->start())
+        if (!m_pWindowSystem->start(maxIterationDurationInMS))
         {
             goto fail; // TODO bad style
         }
@@ -164,11 +164,6 @@ bool WaylandGLESRenderer::getOptimizationMode(OptimizationType id, OptimizationM
     return m_pGraphicSystem->getOptimizationMode(id, mode);
 }
 
-HealthCondition WaylandGLESRenderer::pluginGetHealth()
-{
-    return BaseRenderer::pluginGetHealth();
-}
-
 Shader* WaylandGLESRenderer::createShader(const string* vertexName, const string* fragmentName)
 {
     Shader *result = NULL;
@@ -180,3 +175,20 @@ Shader* WaylandGLESRenderer::createShader(const string* vertexName, const string
     m_pWindowSystem->setSystemState(IDLE_STATE);
     return result;
 }
+
+int WaylandGLESRenderer::getIterationCounter()
+{
+    // TODO: add real thread iteration counter here
+    // The renderer plugin thread must wake up at least once in
+    // each health monitoring interval. This interval is passed
+    // to the plugin as argument in its start() method.
+    // Each time the plugin thread gets active, it must
+    // increment the internal iteration counter.
+    // This way the health monitor can detect, if the plugin
+    // thread is running, dead or blocked.
+
+    // TODO: remove this placeholder, which just returns an
+    // incremented interation counter to make health monitoring happy.
+    static int iteration = 0;
+    return ++iteration;
+}
index a8ae369..4a0228c 100644 (file)
@@ -1,4 +1,4 @@
-next version
+Version 1.1
 ----------------------
 This version includes the following enhancements.