SDL Textures Without Hardware Acceleration



I recently made a custom but straightforward GUI application using SDL and C++. It doesn’t have a lot of moving parts, just a few number changes on button press so I expected it to be quite fast. On my old lintel i3 Ubuntu laptop it is, but on the Linux based micro controller I developed it for not so much. I tried it on two different controller boards, the ever classic Raspberry Pi 3B+ and a HummingBoard Edge which sports an iMX.6 dual core processor. On the raspberry pi, running my application would max out all 4 cores and overheat it in a matter of minutes. The HummingBoard fared a little bit better, the heat sink kept it from overheating but both of it’s cores were maxed. In both cases the program ran extremely slow, getting a single new frame every 2-3 seconds.

Now my initial reaction was that somethings wrong with my code so i went back and ran one of Lazy Foo’s tutorials on the Pi ( A simple frame counter maxed out 2 of the Pi’s 4 cores and hit a max frame rate of about 40.

Later I found out that there is an option on the new Pi to enable hardware graphics acceleration and sure enough it ran my GUI program at 60fps using a fraction of a single core. Now of course that will speed it up but should it really be that drastic? This got me thinking about back when I was reading up on SDL Textures and how they are stored in VRAM and interact directly with the graphics processor. What exactly happens with Textures when you have no hardware graphics acceleration? The HummingBoard and first test with the Pi had no graphics hardware, is this why my performance seems so ridiculously bad? If that is the case is there any fix for this besides rewriting my whole program using surfaces?



Not enough information about bottlenecks in code. What type of rendering(hardware/software). If you use software try to use my patch
but anyway, any working on performance need to operate with some results - before and after. You can try to use some performance profiler like AMD codeanalyst or internal msvc profiler dependent of ide what you use.


Ooops, ya I forgot to add in that I’m using SDL_Texture for all of my rendering which if I’m understanding correctly means I’m using all hardware rendering. That’s partly where my question is coming from, what does SDL do when running SDL_Texture on a machine with no graphics hardware?

I didn’t put a whole lot about the code itself because I’m trying to figure out if there could be external factors slowing it down. Optimizing my code is certainly a step I could take but it runs so incredibly poorly on some hardware and then totally fine on other relatively comparable hardware. Plus even running simple tutorial code also had the same terrible performance on certain hardware. The fact that a simple frame counter written as part of the Lazy Foo tutorials (code linked in original post) is maxing out two 1.3GHz ARM Cortex-A53 cores on a Pi makes me think that there’s a larger problem than just optimization.