[lkml]   [2018]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: framebuffer corruption due to overlapping stp instructions on arm64
<div><div dir="auto">The easiest explanation for this would be that the memory isn’t mapped correctly. You can’t use PCIe memory spaces with anything other than Device-nGnRE or stricter mappings. That’s just differences between the AMBA and PCIe (posted/unposted) memory models.</div></div><div dir="auto"><br></div><div dir="auto">Normal memory (cacheable or uncacheable, which Linux tends to call “memory” and “writecombine” respectively) is not a good idea.</div><div dir="auto"><br></div><div dir="auto">There are two options; make sure Links maps it’s framebuffer as Device memory, or the driver, or both - and make sure that only aligned accesses happen (otherwise you’ll just get a synchronous exception) and there isn’t a Normal memory alias.</div><div dir="auto"><br></div><div dir="auto">Alternatively, tell the PCIe driver that the framebuffer is in system memory - you can map it however you like but there’ll be a performance hit if you start to use GPU acceleration, but a significant performance boost from the PoV of the CPU. Only memory accessed from the PCIe master interface (i.e. reads and writes generated by the card itself - telling the GPU to pull from system memory or other DMA) can be in Normal memory and this allows PCIe to be cache coherent with the right interconnect. The slave port on a PCIe root complex (i.e. CPU writes) can’t be used with Normal, or reorderable, and therefore your 2GB of graphics memory is going to be slow from the point of view of the CPU.</div><div dir="auto"><br></div><div dir="auto">To find the correct mapping you’ll need to know just how cache coherent the PCIe RC is...</div><div dir="auto"><br></div><div dir="auto">Ta,</div><div dir="auto">Matt</div><div dir="auto"><br></div><div><div class="gmail_quote"><div dir="ltr">On Thu, Aug 2, 2018 at 14:31 Mikulas Patocka &lt;<a href=""></a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a <br>
strange problem.<br>
When I use the links browser in graphics mode on the framebuffer, I get <br>
occasional pixel corruption. Links does memcpy, memset and 4-byte writes <br>
on the framebuffer - nothing else.<br>
I found out that the pixel corruption is caused by overlapping unaligned <br>
stp instructions inside memcpy. In order to avoid branching, the arm64 <br>
memcpy implementation may write the same destination twice with different <br>
alignment. If I put &quot;dmb sy&quot; between the overlapping stp instructions, the <br>
pixel corruption goes away.<br>
This seems like a hardware bug. Is it a known errata? Do you have any <br>
workarounds for it?<br>
I tried AMD card (HD 6350) and NVidia (NVS 285) and both exhibit the same <br>
corruption. OpenGL doesn&#39;t work (it results in artifacts on the AMD card <br>
and lock-up on the NVidia card), but it&#39;s quite expected if even simple <br>
writing to the framebuffer doesn&#39;t work.<br>
 \ /
  Last update: 2018-08-02 22:50    [W:0.165 / U:9.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site