<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: i.MX6: async behavior of glTexDirectVIVMap in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277678#M31340</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clay!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've checked your blog but I haven't been able to find some information about this topic. Is it any working code available?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Oct 2015 13:08:56 GMT</pubDate>
    <dc:creator>_andev_</dc:creator>
    <dc:date>2015-10-06T13:08:56Z</dc:date>
    <item>
      <title>i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277655#M31317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm currently trying to implement a QtQuick2.0 Video-Backend to use glTexDirectVIVMap, so that we can get to &amp;lt;10% (maybe &amp;lt;5%) for 1080p video playback.&lt;/P&gt;&lt;P&gt;I'm already rather far and it does look promising!&lt;/P&gt;&lt;P&gt;Here is the interesting part of the code:&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small unlinked"&gt;http://pastebin.com/rPjUrb2N&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm just pasting part of the code for simplicity reasons.&lt;/P&gt;&lt;P&gt;'bind()' is the function which is called with a active glContext and should result in a glBindTexture call.&lt;/P&gt;&lt;P&gt;All the other code is glue-code and not important for this question.&lt;/P&gt;&lt;P&gt;(If someone want the code never the less, just ask me. It will eventually be open sourced anyway so no problem in sharing the unfinished version)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still have two mayor problems.&lt;/P&gt;&lt;P&gt;This question is about my struggle with glTexDirectVIVMap:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seams that glTexDirectVIVMap is mapping the memory in the background...?&lt;/P&gt;&lt;P&gt;What I meaning is that it's completely async ... I think.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I seems that the time it requires to do the map is heavily depending on the chip (GC800 or GC2000, imx6solo vs. quad) and also(!) very much depending on what else is going on on the GPU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can very&lt;/P&gt;&lt;P&gt;&amp;nbsp; from &amp;lt; 1/24 seconds (==smooth playback)&lt;/P&gt;&lt;P&gt;&amp;nbsp; to ~ 1/4 seconds (the only way to get non-stuttering playback to reduce to playback speed to ~1/6)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a huge problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*edit - missed to describe to problem*&lt;/P&gt;&lt;P&gt;The problem is that the frame start to 'stutter' as soon as the delay is to high.&lt;/P&gt;&lt;P&gt;On the solo it's stuttering all the time.&lt;/P&gt;&lt;P&gt;On the quad it's only stuttering if one renders something else in the background (which results in 60fps instead of 24fps opengl-rendering)&lt;/P&gt;&lt;P&gt;*edit - end*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a couple of possible solutions in mind ... but either I don't have enough knowledge for it or it has massive drawbacks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possible solutions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I'm doing something wrong with glTexDirectVIVMap or glTexDirectInvalidateVIV&lt;/P&gt;&lt;P&gt;... if someone spots an error, let me know.&lt;/P&gt;&lt;P&gt;... I've tried to use glTexDirectVIV as well without success, I think it's not meant for this use-case (==where memory allocation happens somewhere else)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. queue with a specific value.&lt;/P&gt;&lt;P&gt;I could do a N-buffering approach&lt;/P&gt;&lt;P&gt;So this would mean one would:&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1. take a new frame&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2. map it to texture&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3. push texture on a stack/FIFO&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4. pop oldest texture from stack (and free memory)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During all this time the 'oldest texture' is used for rendering.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could be configurable but at the end of the day one would need to find a reasonable value for N.&lt;/P&gt;&lt;P&gt;It looks like that the max. value for N could be ~6.&lt;/P&gt;&lt;P&gt;... this is just a guess!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If frames come along and the stack is full, one would drop them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6 frames are 0.25 seconds (24fps/6frame).&lt;/P&gt;&lt;P&gt;Meaning one would need to buffer 0.25 seconds audio as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. queue until map is done.&lt;/P&gt;&lt;P&gt;Same thing as '2.' but rather then guessing 'N', one could use (if existing) some API to get the state of the memory mapping?&lt;/P&gt;&lt;P&gt;GL_MAPPING_DONE flag or something like that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then one would pop the oldest texture as soon as the second-oldest texture is ready.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jul 2013 12:42:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277655#M31317</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-17T12:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277656#M31318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the N-buffering .. didn't help at all (even with 12 buffers) :smileyhappy:&lt;/P&gt;&lt;P&gt;I got no clue what's going on here&lt;/P&gt;&lt;P&gt;... I've checked the data-buffers, there creation and deletion ... the GstBuffers and everything.Everything comes in in order, gets passed on in order and gets deleted in order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I replace the glTexDirectVIVMap with &lt;/P&gt;&lt;P&gt;glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, vF.width(), vF.height(), 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, constBits);&lt;/P&gt;&lt;P&gt; it runs flawlessly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm out of ideas ...&lt;/P&gt;&lt;P&gt;Anyone an idea what I could try, test, change or look at?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 13:40:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277656#M31318</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-18T13:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277657#M31319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the complete code.&lt;/P&gt;&lt;P&gt;It should apply to qtmultimedia dev (also stable I guess)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also added the qml file I'm using to test right now.&lt;/P&gt;&lt;P&gt;Reducing the playspeed (line #36) and/or disabling the animationblue rectangle (line #62) reduces/removes the stuttering.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still believe that there is something funny going on with glTexDirectVIVMap (the same code works wonderful with glTexImage2d) ... I got no clue what! :smileyhappy:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 10:33:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277657#M31319</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-19T10:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277658#M31320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I couldn't download the attached zip packages, but what I guess from your pastebin code, is that you recall glTexDirectVIVMap everytime you call bind. As I understood it from reading &lt;A href="http://www.imxcv.blogspot.de/" title="http://www.imxcv.blogspot.de/"&gt;Computer Vision on i.MX Processors&lt;/A&gt; it is only necessary to call it once and later call glTexDirectInvalidateVIV only. Maybe I overlooked something in the pastebin code, but the static initialized variable seems to be used only for binding the API functions and not the creation of the GPU buffer mapping. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 15:26:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277658#M31320</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-07-22T15:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277659#M31321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there anything one can do wrong @ uploading file?&lt;/P&gt;&lt;P&gt;I've just tested and I can download them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway:&lt;/P&gt;&lt;P&gt;Calling glTexDirectVIVMap only once is only applicable when one used the same memory over and over again .. isn't it?&lt;/P&gt;&lt;P&gt;With gstreamer one gets new buffers continuously ... right? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not ... &lt;/P&gt;&lt;P&gt;I could try to remember 'all' buffers including their textures.&lt;/P&gt;&lt;P&gt; When a new one comes -&amp;gt; new texture -&amp;gt; glTexDirectVIVMap +&amp;nbsp; glTexDirectInvalidateVIV&amp;nbsp; -&amp;gt; active texture for SG rendering&lt;/P&gt;&lt;P&gt; When one comes, one already knows -&amp;gt;&amp;nbsp; take existing texture -&amp;gt;&amp;nbsp; glTexDirectInvalidateVIV&amp;nbsp; -&amp;gt; active texture for SG rendering&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... after writing those line, this does sound logical :smileyhappy:&lt;/P&gt;&lt;P&gt;I'll give it a try and let you know!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jul 2013 08:39:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277659#M31321</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-23T08:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277660#M31322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just tried. Same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works surprisingly well.&lt;/P&gt;&lt;P&gt;It's about ~13 different memory locations per video playback.&lt;/P&gt;&lt;P&gt;As the format and size and everything stays the same within one video playback it's actually working very well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This means:&lt;/P&gt;&lt;P&gt; - I call glTexDirectVIVMap 13 times, for the "first" 13 frames, for 13 different textureIDs.&lt;/P&gt;&lt;P&gt; - After that I only call: &lt;/P&gt;&lt;P&gt; glBindTexture(GL_TEXTURE_2D, bitsToTextureMap.value(vF.bits()));&lt;/P&gt;&lt;P&gt; glTexDirectInvalidateVIV_LOCALE(GL_TEXTURE_2D);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it has the same stuttering problem.&lt;/P&gt;&lt;P&gt;As soon as something else happens on the GPU (e.g. a simple animation), the playback starts to go forth and back rapidly (/stutter).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greets&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jul 2013 09:32:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277660#M31322</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-23T09:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277661#M31323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found it!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;export FB_MULTI_BUFFER=2&lt;/P&gt;&lt;P&gt;solved the stuttering on nitrogen as well as on wandsolo!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it might be a vsync vs. memory sync problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jul 2013 11:13:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277661#M31323</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-23T11:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277662#M31324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on something very similar, although it is not tight to Qt. I'm using gstreamer and copy the data with memmove in the handoff callback of a fakesink. Because the callback is in a different thread, I post a message about the frame change to my message loop and call glBindTexture and &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectInvalidateVIV&lt;/SPAN&gt; in the main thread afterwards. I have two textures created with &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectVIVMap&lt;/SPAN&gt; that I use as flip buffer for the thread. So it's ensured, that during rendering only the texture is used where the callback thread does currently NOT write into. &lt;/P&gt;&lt;P&gt;I exported FB_MULTI_BUFFER=2 that solved tearing problems with normal OpenGL rendering (so I guess it works as expected), but regarding the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectInvalidateVIV&lt;/SPAN&gt; thing for the gstreamer data, I currently have exactly the same effect of stuttering video playback when something else is done on the GPU. If I only render after the video data has changed it works flawlessly, but if I render again before a new image from gstreamer becomes available, it seems like the video texture is flipped to the last one, although I made sure it is the same as before.&lt;/P&gt;&lt;P&gt;I thought it might be a problem within my code, but after printing out every flip, copy, update and rendering of the textures it might be something else, because everything prints out in the expected order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 08:30:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277662#M31324</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-07-31T08:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277663#M31325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made the same observations.&lt;/P&gt;&lt;P&gt;.. and apparently FB_MULTI_BUFFER=2 only shallows the problem .. the back-forth-stuttering still happens on the i.MX6s .. and I suspect on the 'big' ones also when doing more complex painting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got another implementation .. which is a bit dumb/wrong to some degree .. it doesn't 'cleanup' the textures, I just remembers the textures for each pointer value it gets.&lt;/P&gt;&lt;P&gt;... for a simple gstreamer setup this is working flawlessly as there is only around ~15 different memory positions (/pointer values) coming out of gstreamer.&lt;/P&gt;&lt;P&gt;The important difference is that I only call glTexDirectVIVMap on new data positions with new(!) textures... and for the "old" data positions I just call glTexDirectInvalidateVIV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The funny thing is &lt;SPAN&gt;I always use the most recent texture .. so no double-buffering or anything like that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;There is a lot of 'buffering' as I don't clean up ... but from a data point of view, always the latest data from gstreamer, and therefor also the latest texture &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectInvalidateVIV was called on is used&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;... but this is hardly the final solution! :smileyhappy:.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;lt;edit&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I should have mentioned that the new implementation doesn't have any stuttering at all &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;...it just has minor 'glitches' once in a while (3/minute)...I suspect and additional double buffering (which is easy to do as we already have quite some buffers) would solve that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;lt;/edit&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greets&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 09:27:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277663#M31325</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-31T09:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277664#M31326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just realized now, that you are using directly the GStreamer buffers using the MAP method. It seems to be obvious to avoid copying data, as I did it until now. I thought about changing it to your direct buffer solution, but apart from the problems you mentioned above, it's also not clear to me, how you synchronize the gl calls with GStreamer?&lt;/P&gt;&lt;P&gt;I'm currently using the fakesink handoff signal, but the callback is being called from a GStreamer thread. So all I could do is posting a message to my main thread with the buffer passed to the callback. But because of the async behaviour of my posted event, the buffer might already be reused by GStreamer when I want to use it within OpenGL (is it even guaranteed, that the buffer stays valid after leaving the handoff callback?). I would expect that you might have similar problems, if you don't have any other synchronization method, do you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW. I have a i.MX6Q so yes, the behaviour is the same as on the i.MX6s&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 10:45:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277664#M31326</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-07-31T10:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277665#M31327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Qt implements it a bit different .. rather then using fakesink, Qt implements the final sink and takes the buffers directly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .. rather then using fakesink as a buffer-container (that what you're doing right?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, after one is 'done' with the buffer one needs to de-ref it to free it&amp;nbsp; .. I'm not entirely sure if this prevents gstreamer from reusing the buffers to early...&lt;/P&gt;&lt;P&gt;This is happening in the unmap() function of QVideoFrame ... in another implementations (with n-buffering) I always 'unmap'ed as late as possible (the moment before it needed to be replaced) .... this never worked nicely (even with 12-buffering).&lt;/P&gt;&lt;P&gt;Reusing the same texture and data-area and just invalidated the data-content seems to work significantly better altough I unmap right after glTexDirectVIVMap/glTexDirectInvalidateVIV (which is possibly the worst thing one can do).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ... this could also be a source for the 3/minute-flickering (gstreamer reusing the buffer to fast)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 11:10:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277665#M31327</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-31T11:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277666#M31328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So do you copy the GStreamer data passed to Qt's final sink? If not (directly using the GStreamer buffer data), I doubt that the pointers are ensured to stay valid. I just did a quick look at the fakesink source code and it does not provide any information if GStreamer cares about the ref count of the buffers being passed to it's render method. There's a property num-buffers in the fakesink but I couldn't find out if it has any relationship to the number of different data buffers within GStreamer's pipeline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your proposed solution with unmaping right after glTexDirectInvalidateVIV seems to be the only proper solution to me. Why do you think that's the worst thing one can do?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's assume the buffer won't be reused by GStreamer until it's dereferenced, I would assume that the final solution might be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Create GStreamer Pipeline with either Qt's final sink or GStreamer's fake-sink&lt;/P&gt;&lt;P&gt;- add ref to the buffer passed to the render method of Qt's final sink or the handoff callback of fake-sink&lt;/P&gt;&lt;P&gt;- notify main thread about new frame being available (I guess that's necessary in Qt too, as GStreamer is multithreaded and the rendering is done in another thread, isn't it?)&lt;/P&gt;&lt;P&gt;- render main application using glTexDirectVIVMap for non existing texture addresses following a glTexDirectInvalidateVIV call.&lt;/P&gt;&lt;P&gt;- deref the buffer to allow GStreamer to reuse it for decoding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The main problem I see here, is that depending on the performance of the main application thread vs. the decoding thread, GStreamer might have to allocate more and more buffers, because the main application might not render the referenced buffers fast enough.&lt;/P&gt;&lt;P&gt;The other problem might be that GStreamer does not care about the reference count of the buffers passed to the sink at all and reuses them even if they might currently used by the rendering thread which may have strange side effects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did I miss anything?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My first implementation was basically as described above, but with copying the data in a flip-buffer texture&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Create GStreamer Pipeline with GStreamer's fake-sink&lt;/P&gt;&lt;P&gt;- copy buffer passed to the handoff callback of fake-sink into a texture address retrieved by glTexDirectVIV before&lt;/P&gt;&lt;P&gt;- notify main thread about new frame being available and swap texture to the "backbuffer", allowing the decode thread to update the texture currently not used for rendering&lt;/P&gt;&lt;P&gt;- call glTexDirectInvalidateVIV after binding the updated texture&lt;/P&gt;&lt;P&gt;- render main application &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although I can't find any logical problem in my first implementation it suffers from the stuttering if anything else is rendered. If only newly decoded frames are used as rendering trigger it's rendering absolutly fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 11:45:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277666#M31328</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-07-31T11:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277667#M31329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I finally did another test, by keeping the pipeline from my first implementation, but replaced glTexDirectVIV with glTexDirectVIVMap and my own buffers. But if I did not overlooked some other mistakes, it makes the things even worse. Basically the stuttering is exactly the same but additionally I got some update artifacts which look like a conflicting read/write operation on the same memory region.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 12:33:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277667#M31329</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-07-31T12:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277668#M31330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe it's a problem that I update the texture memory from within the GStreamer thread (although I don't use the texture in the current rendering path) and during the eglSwapBuffer call the current "backbuffer" texture is some kind of invalidated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess if that's the case, only an expert from vivante or fresscale can confirm that. I will try to add another buffer only managed by the cpu to verify that the stuttering does not happen when the texture is not updated in a background thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 13:04:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277668#M31330</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-07-31T13:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277669#M31331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did create a CPU managed buffer with the size of the texture memory and copied the GStreamer buffer data passed to the fakesink callback into it. I then notify the main thread about the new frame being available and copy the content of that CPU managed buffer to the pointer I got from glTexDirectVIV from within the main (OpenGL) thread. With that solution I got a lot of copies which makes the use of glTexDirectVIV not really better than just using glTexSubImage (although I guess glTexImage2D does not support the NV12 format, does it?) but at least no stuttering and performance for a 1080p@24fps seems to be ok (around 15ms for only uploading and rendering the video).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So maybe the documentation of glTexDirectVIV and &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectInvalidateVIV&lt;/SPAN&gt; regarding threading can be a bit more detailed in future versions. Currently my impression is that updating a memory area from another thread than the OpenGL thread, even if the texture behind it is currently not used by the rendering is not allowed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 14:11:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277669#M31331</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-07-31T14:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277670#M31332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The 'final solution' you described above is exactly what I'm doing (I've only implemented the last two steps, the rest is already in place within QtMultimedia)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason I said unmapping (/def_ref) right away is possibly the worst thing to do is the reason that I still believe (or better hope) that gstreamer doesn't blindly reuse the buffers how ever he likes ... this would mean that one should unmap after(!) the texture -which uses this data- isn't visible anymore (because a new one is available) .... unmapping (/def_ref) right away says: "hey gstreamer, I don't need this data anymore, do with it what you want", but just just started(!) to display this data&lt;/P&gt;&lt;P&gt;&amp;nbsp; .. this can be fixed easily&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree @ the documentation isn't really complete in regards to multi-threading :smileyhappy: ... I hope someone from freescale will quote on this thread eventually :smileyhappy:&lt;/P&gt;&lt;P&gt;&amp;nbsp; ... I got some contact I reached out to .. if they tell me anything I past in it in this thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't want to copy the buffer at all... this is not efficient.. and avoidable!... otherwise it's (as you said) just a slightly optimized version of glTexSubImage !&lt;/P&gt;&lt;P&gt;15ms .. that's very close to 16.666 which is the complete frame for 60fps :smileyhappy: ... I assume you're using a dual or quad? .. 15ms is not what you'll get on a wandboard solo (which is what I'm after in the end)&lt;/P&gt;&lt;P&gt;... so (unless I've overlook anything) glTexDirectVIV is not an option for me (as it will always requires a cpu bases memory operation, doesn't it?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 14:32:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277670#M31332</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-07-31T14:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277671#M31333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;were you able to finish your application ? is your problem solved ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Andre&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 16:24:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277671#M31333</guid>
      <dc:creator>andre_silva</dc:creator>
      <dc:date>2013-08-05T16:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277672#M31334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not Thomas, but for me it's not solved, as the performance is not optimal when we're not able to directly use the memory pointer of &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectVIV in a background thread. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;The solution by using &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectVIV&lt;/SPAN&gt;Map would be even better. It would be nice if there is an example that shows usage of gstreamer decoding with &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;glTexDirectVIV&lt;/SPAN&gt;Map that checks for thread safeness and should allow zero copy rendering as an OpenGL texture.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Using gstreamer's gl plugins would be probably not&amp;nbsp; a good solution as sharing textures with gstreamer is not very convenient to implement in custom applications.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 16:34:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277672#M31334</guid>
      <dc:creator>volki</dc:creator>
      <dc:date>2013-08-05T16:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277673#M31335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can only agree with all of Volkers statements :smileyhappy:&lt;/P&gt;&lt;P&gt;It's not solved for me either ... I've something running, but it's not ideal and it's certainly not a solution for the wandsolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 16:39:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277673#M31335</guid>
      <dc:creator>senykthomas</dc:creator>
      <dc:date>2013-08-05T16:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6: async behavior of glTexDirectVIVMap</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277674#M31336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H6 style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;A _jive_internal="true" class="font-color-meta-light" href="https://community.nxp.com/message/346765#346765" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #a9a9a9;"&gt;Re: i.MX6: async behavior of glTexDirectVIVMap&lt;/A&gt;&lt;/STRONG&gt;&lt;/H6&gt;&lt;P class="j-post-avatar" style="font-style: inherit; font-family: inherit;"&gt;&lt;A _jive_internal="true" class="j-avatar jiveTT-hover-user" data-avatarid="26840" data-externalid="" data-presence="null" data-userid="203879" data-username="PrabhuSundararaj" href="https://community.nxp.com/people/PrabhuSundararaj" style="font-style: inherit; font-family: inherit; color: #6a737b;"&gt;&lt;IMG alt="Prabhu Sundararaj" border="0" class="jiveImage jive-avatar" data-avatarid="26840" data-height="46" data-username="PrabhuSundararaj" height="46" src="https://community.nxp.com/people/PrabhuSundararaj/avatar/46.png?a=26840" style="border: 0px; font-style: inherit; font-family: inherit;" width="46" /&gt;&lt;/A&gt;&lt;SPAN class="j-status-levels" style="font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="Employee" class="jiveImage" src="https://community.nxp.com/6.0.2.0/resources/images/status/FS_EMP_40x18.png" style="font-style: inherit; font-family: inherit;" title="Employee" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author" style="font-style: inherit; font-size: 0.9em; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;A href="https://community.nxp.com/people/PrabhuSundararaj"&gt;PrabhuSundararaj&lt;/A&gt; &lt;/STRONG&gt;Aug 26, 2013 10:14 AM &lt;SPAN class="font-color-meta-light j-thread-replyto" style="padding: 0 0 0 3px; font-style: inherit; font-family: inherit; color: #a9a9a9;"&gt;(&lt;A _jive_internal="true" class="font-color-meta-light localScroll" href="https://community.nxp.com/message/346765?et=watches.email.thread#343104" style="font-style: inherit; font-family: inherit; color: #a9a9a9;" title="Go to message"&gt;in response to Carlos Roberto De Aguinaga Ramirez&lt;/A&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="j-ui-elem j-dotted-star" style="font-style: inherit; font-family: inherit; background-position: no-repeat no-repeat;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; VPU is expected to create 7 buffers for 1080p video. But&lt;BR /&gt;we see 13 textures are created. So the current way of mapping is correct. No&lt;BR /&gt;harm in it.&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;When you run the sintel_trailer-1080p.mp4, the frame&lt;BR /&gt;address incoming is not in round robin fashion, since this video is high&lt;BR /&gt;profile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;VPU will take the available free buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;In this case I can see the same address is being repeated&lt;BR /&gt;for 3 consecutive frames. That means, the both GPU and VPU accessing the&lt;BR /&gt;buffer, causing this distortion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;For this case I added a check if the same address is&lt;BR /&gt;repeating immediately for the next frame do a glFinish before&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp; glBindTexture(GL_TEXTURE_2D,&lt;BR /&gt;bitsToTextureMap.value(vF.bits()));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;glTexDirectInvalidateVIV(GL_TEXTURE_2D);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;Fixed the problem to some extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp; Also I tried the base line profile video, where the&lt;BR /&gt;address were not repeated, it worked in round robin fashion. But I can see the&lt;BR /&gt;distortion when I add parallel GLES drawings.&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;Here are my findings&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -eglSwapBuffer&lt;BR /&gt;does not wait for the frame to complete. It flushes the command buffer and&lt;BR /&gt;gives back control for the application for the next frame. So the command&lt;BR /&gt;buffers which including the texture to be rendered is in GPU queue, not&lt;BR /&gt;rendered by the GPU. In the meanwhile VPU also can take the buffer control and&lt;BR /&gt;can decode on it. Hence this asynchronous behavior causing this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - One solution&lt;BR /&gt;is to make sure the frame is completely processed by GPU and give back control&lt;BR /&gt;to VPU to process the next frame. As like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glFinish();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glBindTexture(GL_TEXTURE_2D,&lt;BR /&gt;bitsToTextureMap.value(vF.bits()));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; glTexDirectInvalidateVIV(GL_TEXTURE_2D);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return bitsToTextureMap.value(vF.bits());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - glTexImage2D&lt;BR /&gt;will work good in this case, because the texture will be copied to GPU memory.&lt;BR /&gt;No race conditions.&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Please let me know whether the glFinish is solving the problem on wandsolo, also would&lt;BR /&gt;like to know the performance impact.&lt;/P&gt;&lt;P class="jive-thread-reply-btn" style="margin: 26px 0 -10px; font-size: 0.9em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;DIV class="jive-thread-reply-btn-correct" style="font-style: inherit; font-family: inherit;"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/message/346765?et=watches.email.thread" style="margin: 0 20px 0 0; padding: 2px 14px 4px 28px; font-weight: bold; font-style: inherit; font-family: inherit; color: #6a737b; background-color: #f3f3f3;"&gt;/message/346765?et=watches.email.thread&lt;/A&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Aug 2013 17:38:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-async-behavior-of-glTexDirectVIVMap/m-p/277674#M31336</guid>
      <dc:creator>karina_valencia</dc:creator>
      <dc:date>2013-08-26T17:38:23Z</dc:date>
    </item>
  </channel>
</rss>

