return 1;
}
+// OSDOVG-ROD-EXPERIMENT - temp hack to allow OsdVector to signal the thread in OsdOpenVG
+void OsdOpenVG::nudgeRenderThread()
+{
+ Log::getInstance()->log("OSD", Log::DEBUG, "Nudge render thread");
+
+ // signal renderLoop to go-around (from putOpenVGCommand)
+ renderThreadMutex.lock();
+ if (renderThreadReq == 0) renderThreadReq = 1;
+ renderThreadCond.notify_one();
+ renderThreadMutex.unlock();
+}
+
+/*
+ * OSDOVG-ROD-EXPERIMENT
+ *
+ * To switch OsdOpenVG to render-on-demand instead of rendering in a loop
+ *
+ * Pros:
+ * More responsive OSD
+ * Cuts 5% constant CPU usage
+ * Seems to have tickled the GFX corruption bug, might make it easier to find that
+ *
+ * Cons:
+ * There's a comment about video tearing if render is called too often.
+ * Will tearing show up in on-demand mode?
+ * Moves away from conventional FPS type render loop. VOMP doesn't use 3D GFX / animations
+ * currently, so this doesn't matter at the moment?
+ * Code needs updating to call nudgeRenderThread,
+ * e.g. FIXME backing out of the options screen doesn't redraw VWelcome
+ *
+ * Maybe have a hybrid system. One that normally works on-demand but can
+ * also switch to looping on the fly if necessary.
+ */
+
+
void OsdOpenVG::renderLoop()
{
// We have to claim the egl context for this thread
long long time1 = getTimeMS();
- if ((time1 - lastrendertime) > 200) //5 fps for OSD updates are enough, avoids tearing
+ // OSDOVG-ROD-EXPERIMENT - always render, but only when signalled to
+ if (1) // ((time1 - lastrendertime) > 200) //5 fps for OSD updates are enough, avoids tearing
{
#if DEV
dumpStyles();
if (ts != 0)
{
+ // OSDOVG-ROD-EXPERIMENT
+ // renderThreadCond.wait(ul, [this]{ return renderThreadReq != 0; }); // experiment! always wait, no time limit
renderThreadCond.wait_for(ul, std::chrono::milliseconds(ts), [this]{ return renderThreadReq != 0; });
if (renderThreadReq == 2)
return;
}
+ if (renderThreadReq == 0) abort(); // OSDOVG-ROD-EXPERIMENT - check this never happens
+
// Either timeout or renderThreadReq == 1 - go around
renderThreadReq = 0;