<?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>i.MX Processors中的主题 Re: glTexDirectVIV Pointer Becomes Invalid</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/glTexDirectVIV-Pointer-Becomes-Invalid/m-p/787939#M122067</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which GPU version are you using? which BSP? you are not using X11, then I suppose you are using 4.9.88 version, where supposedly fixed all &lt;SPAN&gt;glTexDirectVIV issues.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Nov 2018 15:20:08 GMT</pubDate>
    <dc:creator>Bio_TICFSL</dc:creator>
    <dc:date>2018-11-08T15:20:08Z</dc:date>
    <item>
      <title>glTexDirectVIV Pointer Becomes Invalid</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/glTexDirectVIV-Pointer-Becomes-Invalid/m-p/787938#M122066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've written&amp;nbsp;the software for a digital signage product that we're developing which uses the iMX6. The screen content is configurable, and is rendered using OpenGL ES (to an SDL generated window - not using X11). It's possible to set up the screen layout such that is has&amp;nbsp;video&amp;nbsp;on a part of the screen, and I'm&amp;nbsp;handling the video using a combination of ffmpeg's libav and a custom decoder that&amp;nbsp;utilises the iMX6 VPU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To render the video to the OpenGL ES scene, I initially create a ring buffer of 3 textures and then call&amp;nbsp;glTexDirectVIV for each texture and store the pointer that's&amp;nbsp;returned. Then as the video plays, I have a thread that copies the decoded video frames to the textures using the pointers that I initially received via&amp;nbsp;&lt;SPAN&gt;glTexDirectVIV (I'm using NEON instructions to copy the frames as quickly as possible).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The result is quite impressive, given that it's not a zero copy solution. I'm getting about 60 fps for fairly complex OpenGL ES scenes with a video playing in the middle of it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm experiencing a problem though, where after a period of time (seems fairly random -&amp;nbsp;anywhere from a few seconds to a few hours) the video starts to flicker with black frames. It initially looks like every third frame is black, and then after a while every 2 out of 3 frames, and then it turns completely&amp;nbsp;black - so I'm immediately thinking it's a problem with my ring buffer of 3 textures. I've been through the code trying to diagnose the issue, and the problem doesn't occur if I don't use&amp;nbsp;&lt;SPAN&gt;glTexDirectVIV and just&amp;nbsp;copy the frames using&amp;nbsp;glTexSubImage2D, but that causes the frame rate to drop.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I now have it where I can connect a USB keyboard to the device, and when I hit a certain key it re-calls&amp;nbsp;&lt;SPAN&gt;glTexDirectVIV&amp;nbsp;to refresh the pointers that I have stored for the 3 textures. That's all that happens when I hit the keyboard key. Now when the video starts to flicker, when I hit this key then the flickering immediately stops.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;So I've concluded that the GPU must be moving the textures in the GPU memory, thus invalidating the pointers that I have stored by my initial&amp;nbsp;&lt;SPAN&gt;glTexDirectVIV call.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;I originally referred to this when I wrote my code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;A class="link-titled" href="http://imxcv.blogspot.com/2012/10/video-to-texture-streaming-part-3-imx6.html" title="http://imxcv.blogspot.com/2012/10/video-to-texture-streaming-part-3-imx6.html"&gt;Computer Vision on i.MX Processors: Video to Texture Streaming (Part 3) - i.MX6 processor&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;and with regard to glTexDirectVIV, it states "&lt;EM&gt;This function should be called just once in your code! (this was my mistake for a long time.....)&lt;/EM&gt;".&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;My question is - should I in fact be calling&amp;nbsp;&lt;SPAN&gt;glTexDirectVIV on every video frame before I copy the data, rather than assume the pointers will stay valid? That's what I'm starting to consider, but I'm a little concerned that it might&amp;nbsp;cause a different problem that I'm not aware of, given the statement on that blogspot page.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;If I am supposed to only call&amp;nbsp;&lt;SPAN&gt;glTexDirectVIV once initially, how can I get around this problem that I'm seeing where the GPU seems to move the textures and therefore invalidates my stored pointers? Is there a way I can detect that this has happened, or prevent it happening in the first place?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 11:50:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/glTexDirectVIV-Pointer-Becomes-Invalid/m-p/787938#M122066</guid>
      <dc:creator>rikfelton</dc:creator>
      <dc:date>2018-10-31T11:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: glTexDirectVIV Pointer Becomes Invalid</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/glTexDirectVIV-Pointer-Becomes-Invalid/m-p/787939#M122067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which GPU version are you using? which BSP? you are not using X11, then I suppose you are using 4.9.88 version, where supposedly fixed all &lt;SPAN&gt;glTexDirectVIV issues.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2018 15:20:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/glTexDirectVIV-Pointer-Becomes-Invalid/m-p/787939#M122067</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2018-11-08T15:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: glTexDirectVIV Pointer Becomes Invalid</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/glTexDirectVIV-Pointer-Becomes-Invalid/m-p/787940#M122068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a SOM from one of our suppliers (the RM3 from Blue Chip Technology, &lt;A class="link-titled" href="https://www.bluechiptechnology.com/products/rm3/" title="https://www.bluechiptechnology.com/products/rm3/"&gt;RM3 ARM Dual/Quad-Core Cortex A9 Module | Blue Chip Technology&lt;/A&gt;). It has the i.MX6 Quad, which I believe has the&amp;nbsp;Vivante GC2000 GPU?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using buildroot to create the system, and the kernel is 4.1.15&amp;nbsp;which&amp;nbsp;comes from&amp;nbsp;&lt;A class="link-titled" href="https://github.com/bluechiptechnology/linux-4.1.15-bctre3.git" title="https://github.com/bluechiptechnology/linux-4.1.15-bctre3.git"&gt;GitHub - bluechiptechnology/linux-4.1.15-bctre3: kernel for RE3 boards based on Freescale Linux 4.1.15&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you suggesting that if&amp;nbsp;I contact Blue Chip and we use kernel version 4.9.88 or later, then that would solve my problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Rik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2018 15:34:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/glTexDirectVIV-Pointer-Becomes-Invalid/m-p/787940#M122068</guid>
      <dc:creator>rikfelton</dc:creator>
      <dc:date>2018-11-08T15:34:14Z</dc:date>
    </item>
  </channel>
</rss>

