Here’s a quick walkthrough for anyone wanting to do more etnaviv (very welcome!) reverse engineering. ![]() In the end, I was able to find the GPU bits that need to be toggled to disable Early-Z rejection and fix all KiCAD rendering problems. Christian Gmeiner and Marek Vasut, both etnaviv contributors, helped me - each providing puzzle pieces of the toolset required for reverse engineering the GPU. ![]() This affected the rendering of KiCAD’s traces, text and zones, which is best explained with a picture:Īfter much frustration, I decided to dig into Mesa’s etnaviv driver source code to see if I could figure out how to disable Early-Z rejection in GC7000L myself. In the case of etnaviv driving the GC7000L, this did not work. The GPU drivers have to detect that "discard" is being used and disable the Early-Z optimization for the scene. But this can only work if objects behind the current object have been painted, or something wrong will show up instead. The discard (sometimes called TEXKILL) instruction can be used to poke transparent holes into the currently drawn texture/triangle, so that the background would shine through instead. Triangles that are determined to be fully obscured can be skipped altogether, saving rendering time.Ī problem with this approach appears when using a shader function called "discard". There is an optimization in modern GPUs called "Early-Z Reject" that sorts out the Depth Buffer before running all the expensive shaders that determine the actual texture and color of the pixels. The Depth Buffer will make sure that pixels closer to the camera obscure pixels that are further away. This way, it doesn’t matter in which order the objects (triangles) are painted. If there is already something that is logically in front of what we want to paint, we don’t paint over it. When another pixel is scheduled to be painted on top, its Z position is first compared to what value is already in the Depth Buffer at that X/Y coordinate. To figure out the correct 3D order of the pixels the GPU has to paint every frame, it uses a so-called Depth Buffer to record the Z (depth) position in 3D space of every pixel it has rendered so far. One such feature is disabling "Early-Z Reject". GC7000L has a new architecture internally called "HALTI 5" which introduced some differences to older generations supported by the etnaviv drivers, so some GPU features behave differently than expected or are activated by unknown registers or bit positions that have to be reverse engineered-again. This cleared the way to being able to turn Accelerated Graphics mode on. The etnaviv open source driver for GC7000L doesn’t support this feature, so I came up with a workaround patch for KiCAD that doesn’t use an overlay but renders to the foreground framebuffer instead. KiCAD implements an "overlay", which is a third OpenGL framebuffer (in addition to background and foreground graphics) for interactive operations like drawing new traces or artwork on top of existing, cached graphics. There were three roadblocks in the way to running KiCAD on Reform, two of which affected some other applications/games as well: 1. With software-based rendering, KiCAD performs very slowly on Reform/ARM64 systems, especially for complex boards, so that wasn’t an option for me. While KiCAD compiles and runs on Reform, it wasn’t possible to enable the "Accelerated Graphics" mode that leverages the GPU for schematics and PCB rendering. How to Fix Show-Stopper Graphics Bugs on Reformįor at least the last half year I’ve been unhappy about not being able to use KiCAD on Reform, the free and open source electronics design program that I used to create the circuit boards that make up Reform. ![]() While the built-in GC7000L GPU has significantly more work to do to render to 4K compared to 1080p, it is possible to clock it up to 1 GHz to squeeze out some more performance. The Hantro H.264 hardware decoder (now supported by the Linux kernel) can decode 4K video in realtime, but we still have to validate this. Needless to say, this resolution is great for working with lots of text or terminals on a big screen. We’ll obtain a display that can accept 4K 60 Hz over HDMI and report back.
0 Comments
Leave a Reply. |