]> git.vomp.tv Git - vompclient.git/commitdiff
Revert ref-count-negative commit
authorChris Tallon <chris@vomp.tv>
Fri, 3 Dec 2021 20:57:04 +0000 (20:57 +0000)
committerChris Tallon <chris@vomp.tv>
Fri, 3 Dec 2021 20:57:04 +0000 (20:57 +0000)
Import comments and dumpImages from 0-6-dev-imagerefs

osdopenvg.cc
osdvector.cc
osdvector.h
surfacevector.cc

index 6c8ddd9ec2d6f14d68c80bc432c66a7b3e2b84b9..7b6b9806aa7a4ad7578be878f893ea51fbcf3e02 100644 (file)
@@ -512,6 +512,8 @@ void OsdOpenVG::renderLoop()
     if (ts != 0)
     {
       // OSDOVG-ROD-EXPERIMENT
+      //dumpImages();
+
       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; });
 
index e7311ed82b9bfa10fd737122a94b4a0fd496cdd7..990072c20f5e05fe701188953427475700fcc2ab 100644 (file)
@@ -17,6 +17,8 @@
     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
+// FIXME It doesn't seem like the LoadingIndex entries in loadindex_ref ever get deleted
+
 #include "log.h"
 #include "surfacevector.h"
 #include "vdr.h"
@@ -456,7 +458,10 @@ void OsdVector::removeLoadingIndexRef(const LoadingIndex ref)
 
     if ( itty != tvmedias_loaded.end())
     {
-      // removeImageRef((*itty).second); // remove lock
+      removeImageRef((*itty).second); // remove lock
+
+      /* Update - not this? Re-enabled. */
+
       /*
        * I'm not sure exactly how all this works but removing this line of code prevents
        * reference counts in vhi_refcounts from going negative. Therefore I suspect the above
@@ -473,6 +478,31 @@ void OsdVector::removeLoadingIndexRef(const LoadingIndex ref)
   }
 }
 
+void OsdVector::dumpImages()
+{
+   // surfaces_mutex.lock();
+
+  printf("tvmedias.size = %i\n", tvmedias.size());
+
+  printf("vhi_refcounts\n");
+  // std::map<ImageIndex, int> vhi_refcounts;
+  // ImageIndex is a VectorHandle. VectorHandle is an unsigned int
+  for(auto& a : vhi_refcounts)
+  {
+    printf("ImageIndex: %u int: %i\n", a.first, a.second);
+  }
+
+  printf("loadingindex_ref\n");
+  // std::map<LoadingIndex, int> loadindex_ref;
+  // LoadingIndex is a unsigned long long
+  for(auto& a : loadindex_ref)
+  {
+    printf("LoadingIndex: %llu (%llu) int: %i\n", a.first, a.first >> 32, a.second);
+  }
+
+  // surfaces_mutex.unlock();
+}
+
 void OsdVector::cleanupOrphanedRefs()
 {
   // Do some garbage collection
@@ -986,7 +1016,7 @@ void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder)
     itty++;
   }
 
-  LogNT::getInstance()->debug(TAG, "removeDecoder");
+  LogNT::getInstance()->debug("PictureReader", "removeDecoder");
   decoder->shutdown();
   delete decoder;
   decoders_lock.unlock();
@@ -1117,7 +1147,7 @@ bool OsdVector::PictureReader::processReceivedPictures()
       return true;
     }
 
-    // LogNT::getInstance()->debug(TAG, "TVMedia Pictures arrived VDR {:#x} {} {}",
+    // LogNT::getInstance()->debug("PictureReader", "TVMedia Pictures arrived VDR {:#x} {} {}",
     // vresp->getStreamID(),vresp->getUserDataLength(),vresp->getFlag());
     bool decode = false;
     bool freed = false;
index b3b20cc77b7f4f0ed4c5e90197ae277807ae0053..8bf73986bd3e4492d9ef0034c76659c9f84d379f 100644 (file)
@@ -214,6 +214,8 @@ struct SurfaceInfo
 class OsdVector : public Osd, public MessageReceiver
 {
   public:
+    void dumpImages();
+
     OsdVector();
     virtual ~OsdVector();
 
index ca1c6bad1e52276c7104052ff9de36e6b02825be..a01bbad004ac9b2f2305f2a57e032989cf5d1261 100644 (file)
@@ -262,7 +262,8 @@ void SurfaceVector::drawTVMedia(TVMediaInfo& tvmedia, float x, float y, float  w
 {
   command_mutex.lock();
   VectorHandleImage handle = 0;
-  LoadingIndex load_index = osd->getTVMediaRef(tvmedia, handle);
+  LoadingIndex load_index = osd->getTVMediaRef(tvmedia, handle); // This is where you can get a cache hit
+
 
   if (width != 0 && height != 0)
   {