Rendering glass jaw on C1+

Moderators: odroid, mdrjr

Rendering glass jaw on C1+

Unread postby dqbydt » Thu Mar 09, 2017 7:46 am

I am evaluating the C1+ for use in an embedded application, and have run into a crippling rendering performance glass jaw. Curiously, it affects only the C1+; I have not noticed it on virtually any other Android platform I have tried it on - including SOMs like this one http://www.technexion.com/products/legacy/soms/detail/TDM-3730, with comparatively puny processors (800 MHz DM3730 with 512 MB DDR1). The XU4 doesn't show this problem either.

I have been able to distill the problem down to the following: if you try to draw on a Canvas with a transparent color, the floor drops out from under the framerate. The minimal code to reproduce is the following implementation of the run() method of SurfaceView:

Code: Select all
    @Override
    public void run() {

        while (running) {

            if (!mHolder.getSurface().isValid())
                continue;

            Canvas canvas = mHolder.lockCanvas();

            // This call is essential for background transparency on SurfaceView!
            canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);

            canvas.drawColor(0xa0030b0d);  // <--- Changing this to solid (e.g. 0x030b0d) dramatically improves framerate

            mHolder.unlockCanvasAndPost(canvas);
        }
    }


See attached screenshots (both from a VU7+). Performance with transparency drops to less than 50% of that without.

In case anybody is interested in reproducing, test app here:
https://github.com/dqbydt/DrawBitmapTest

According to this http://stackoverflow.com/q/9588776 SO post, hardware acceleration is not enabled on SurfaceViews. So I'm not sure whether the GPU is used in rendering this or not. However it may be rendered, why would it perform so poorly on the C1+ compared to the XU4 (or almost 10 other Android phones/tablets)? It would be great if somebody could shed some light on this.
Attachments
odroidx.png
Framerate when painting with transparent color
odroidx.png (13.75 KiB) Viewed 184 times
odroids.png
Framerate when painting with solid color
odroids.png (13.93 KiB) Viewed 184 times
dqbydt
 
Posts: 12
Joined: Wed Mar 01, 2017 7:52 am
languages_spoken: English
ODROIDs: C1+ XU4

Re: Rendering glass jaw on C1+

Unread postby rooted » Thu Mar 09, 2017 8:43 am

Without looking at the code are you sure it's not a bpp issue?

Try enabling/disabling these two in developer options, I'm mobile and don't want to type it [emoji14]

Image

Try 1 at a time of course.

Does it behave this way on a normal display? Not the VU7.
User avatar
rooted
 
Posts: 3282
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)

Re: Rendering glass jaw on C1+

Unread postby dqbydt » Thu Mar 09, 2017 3:07 pm

1. bpp: Well I'm running the same apk on the same display (VU7+) on two platforms (C1+ and XU4). So it ought not to be a bpp issue (unless something in the C1+ kernel has been misconfigured).

2. I tried all 4 combinations of both of those options, to no avail. No effect on the low framerate.

3. On a normal DVI monitor (running at 1024x768x60Hz) the framerate drops further, from ~24 fps to ~19 fps. I further noticed that if I move the mouse rapidly and continuously, the framerate drops yet more, to ~15 fps. Both of these (reduced framerate due to additional pixels and due to increased CPU interrupt rate) seem to suggest that the rendering is indeed being done on the CPU. Even that would be fine, were it not for the fact that CPU usage (as seen in the Android Monitor) is always around 25%, which means that the other three cores are sitting idle.
dqbydt
 
Posts: 12
Joined: Wed Mar 01, 2017 7:52 am
languages_spoken: English
ODROIDs: C1+ XU4

Re: Rendering glass jaw on C1+

Unread postby rooted » Thu Mar 09, 2017 3:43 pm

I have an app I wrote that had a similar issue when using canvas, it seems like it was PorterDuff related.

I would try without AA the text.

Try different optimization and you may be able to pinpoint the issue so it can be fixed in the OS.
User avatar
rooted
 
Posts: 3282
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)

Re: Rendering glass jaw on C1+

Unread postby odroid » Thu Mar 09, 2017 5:36 pm

Do you use Android 4.4 on C1+? or 5.1?
User avatar
odroid
Site Admin
 
Posts: 21780
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Rendering glass jaw on C1+

Unread postby dqbydt » Fri Mar 10, 2017 4:10 pm

I tried 4.4.4 v3.4 and 5.1.1 v1.4.
They both show the perf problem.
dqbydt
 
Posts: 12
Joined: Wed Mar 01, 2017 7:52 am
languages_spoken: English
ODROIDs: C1+ XU4

Re: Rendering glass jaw on C1+

Unread postby odroid » Tue Mar 21, 2017 3:32 am

We also met the same issue only on C1+ while C2 & XU4 have no issue.
But it is very hard to know what causes the slowness issue.
User avatar
odroid
Site Admin
 
Posts: 21780
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Rendering glass jaw on C1+

Unread postby rooted » Tue Mar 21, 2017 4:52 am

I can't find the source to the application I wrote.

I do remember when displaying an image on canvas a certain way caused dragging the zoomed image to be extremely laggy on all devices I own except the Galaxy S5. When displaying it a different way it's smooth on all devices.

What I'm saying is a workaround may be possible in your code that allows for proper performance.

*edit*
I found the code, in my case it was one of these that was the root cause:

Code: Select all
PorterDuff.Mode.OVERLAY

Or
Code: Select all
PorterDuff.Mode.MULTIPLY


Being you need transparency I don't know of a quick workaround. I think using something other than PorterDuff may be possible.

Both of the modes above use transparency, perhaps try overlay with no color.

Something like (I can't test and it's from memory so likely wrong):

Code: Select all
someDrawable.setColorFilter(Color.rgb(0, 0, 0), PorterDuff.Mode.OVERLAY);
User avatar
rooted
 
Posts: 3282
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1
C1+
C2
XU3 Lite
XU4
VU7+
HiFi Shield 2
Smart Power (original)


Return to Android

Who is online

Users browsing this forum: No registered users and 5 guests