Fun with performance

Fun with performance

QtEmbedded has a class called QDirectPainter. This class allows to directly manipulate the mmaped screen. E.g. this can be used to memcpy images to the framebuffer like it is done in QImage, QPixmap, bitBlt. It can also be used by MediaPlayer like OpiePlayer2 to memcpy the videoplayer widget into the screen.
Having nice kernel drivers that support layers one can run the GUI on top of the video and one can control the visibility and opacity by controlling the ‘a’ of the RGBA. This can be done nicely using QDirectPainter. Just mark the relevant pixels with their alpha values and be done. The most obvious piece of code would use |= to OR the alpha value to the current pixel.

There is only bad thing with this approach. This code will do a load and store on the same pixel. As my failure showed this is not done within one or two cycles but requires more time. Now imagine you do this on a complete 640×480 display. Right you can not make the complete display transparent within one time slice but suffer context switches. The lesson learned is simply assign a value do not try to OR it

Comments are closed.