totalcross icon indicating copy to clipboard operation
totalcross copied to clipboard

Optimize TotalCrossVM for IMX6ULL

Open Farshid-Monhaseri opened this issue 4 years ago • 10 comments

Issue Title

Optimize graphics drawing on IMX6ULL (no GPU)

Describe the requirement

For running TotalCross apps on IMX6ULL some optimization should be done in TotalCrossVM, because the device has no GPU and OpenGL implementation won't work with this device, in the other hand the device has low CPU resources too and software rendering result will be poor, thus some optimization patches should be applied in TotalCrossVM to make TotalCross apps be capable of fluent execution on the device.

Additional context

The only graphical acceleration unit on IMX6ULL is the PXP(Pixel Pipeline) unit which is capable of basic color space conversion, blitting, scaling and blending.

Farshid-Monhaseri avatar Nov 25 '20 00:11 Farshid-Monhaseri

My parenting about PXP, why not invest in something like a "native" implementation of skia on top of X11? I'm talking about removing the SDL from the stack

acmlira avatar Nov 25 '20 10:11 acmlira

X11 is a dead-end for embedded; we ought to focus on Wayland and direct framebuffer rendering.

otavio avatar Nov 25 '20 11:11 otavio

Since X11 is client-server based, it introduces a huge overhead to the drawing routines. Maybe stick to SDL on embedded for this reason.

teras avatar Nov 25 '20 14:11 teras

Yes it seems that X11 is not a good idea at all.

acmlira avatar Nov 25 '20 14:11 acmlira

We use SDL as a cross platform window management library to abstract from window manegment backends. Generally removing SDL and implementing native window manegmanet codes for every platform will help TotalCrossVM binary size and maybe a bit on performance but on IMX6ULL won't help. If we want to step on removing SDL on implement some native codes to deals with window manager in different platfroms, x11 is not the only target, we should implement Android, Window, macOS, IOS, and also Wayland on Linux too. It is true x11 windows can work with most of Wayland servers but It is optional and on most embedded Linux devices usually developers disable it(as @otavio mention that). So we should implement some common Wayland protocols too such as XDG, IVI and so on. For IMX6ULL rendering acceleration, PXP implementation is the only real. practical and efficient option as It is done in imx GStreamer plugins too.

Farshid-Monhaseri avatar Nov 25 '20 14:11 Farshid-Monhaseri

Before thinking about implementing it using pxp I'd verify if we don't have room for optimization as pxp is i.MX specific and we won't be capable to support rendering specific for every platform.

We need to check if we are using SDL on the most optimal way as it is usually pretty fast and maybe we are paying with performance for some misuse or wrong strategy.

otavio avatar Nov 26 '20 01:11 otavio

Agreed, @otavio!!

I was discussing with @teras @Farshid-Monhaseri @flsobral and @acmlira if there is any way to make a profile of every step in the execution stack, to know better WHERE we need to optimize, instead of wasting time with pxp in the first place (as we don't know where the performance is struggling)

Any suggestions for that? =)

brunoamuniz avatar Nov 26 '20 10:11 brunoamuniz

I'd probably discuss this with SDL community; they very likely have ideas or some tooling for this.

otavio avatar Nov 26 '20 11:11 otavio

We use SDL just for window management not for drawing graphics or texts ... the only optimization for SDL would be choosing right 'Window renderer' for Linux arm devices. I think SDL index x11 window renders with lower index so TotalCrossVM will choose the first compatible window renderer. We can make TotalCrossVM to choose Wayland on Linux ARM devices if it is available ... We draw text & graphics with Skia and even if we want to accelerate graphics & text drawing operations we may have to patch Skia for our self for I.MX devices or upstream the patches .

Farshid-Monhaseri avatar Nov 26 '20 15:11 Farshid-Monhaseri

Before we spend time on this, we ought to build a highly optimized image with the Yocto Project and see what performance we can get. It will also allow finding the transitions/primitives which are lagging and possibly look for optimization opportunities.

otavio avatar Nov 26 '20 17:11 otavio