Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Placement of displayio elements for efficient updates?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Placement of displayio elements for efficient updates?

by kevinjwalters on Wed Apr 29, 2020 10:07 am

Can the geographical placement of objects on the screen using displayio library affect performance for applications which want to update the screen frequently? E.g. for data updating at 10-100Hz is there a difference between:

Code: Select all | TOGGLE FULL SIZE
BIG TEXT SHOWING DYNAMIC DATA
GRAPH SHOWING SAME DATA
STATIC TEXT


and the re-ordered

Code: Select all | TOGGLE FULL SIZE
BIG TEXT SHOWING DYNAMIC DATA
STATIC TEXT
GRAPH SHOWING SAME DATA


I'm wondering if the second option causes larger area writes to the screen from possible coalescing of the areas updated? Also, is it important to avoid even 1 pixel overlaps between static and dynamic objects for similar reasons?

kevinjwalters
 
Posts: 665
Joined: Sun Oct 01, 2017 3:15 pm

Re: Placement of displayio elements for efficient updates?

by tannewt on Wed Apr 29, 2020 11:36 am

It depends on how your text is implemented. Are you using one TileGrid for everything or a Label which uses a TileGrid per character?

Note that the display is limited to 60Hz updates by default. You can change this rate by switching to manual refresh and providing a target frames per second to refresh.

tannewt
 
Posts: 1716
Joined: Thu Oct 06, 2016 8:48 pm

Re: Placement of displayio elements for efficient updates?

by kevinjwalters on Sat Jul 18, 2020 12:17 pm

For text I used Label objects. I split them into dynamic fields and static text. I've just annotated a photograph of a CLUE with two rectangles to show this, see below.

clue-displayio-label-overlap-discussion-example1.png
CLUE running metal detector software from Adafruit Guide with purple and orange box annotations
clue-displayio-label-overlap-discussion-example1.png (500.06 KiB) Viewed 6 times


The 0.7 outlined in purple is one Label where I change the text value and the other orange one is a Label which is created once and then never changed. My assumption was that this would be more efficient performance-wise for data updates. I was curious if I accidentally overlap those two Labels if displayio then ends up sending both to the screen when 0.7 changes as if they were one object? I.e. does one have to be careful on positioning of static displayio objects wrt dynmaic ones?

kevinjwalters
 
Posts: 665
Joined: Sun Oct 01, 2017 3:15 pm

Re: Placement of displayio elements for efficient updates?

by tannewt on Mon Jul 20, 2020 6:38 pm

Overlapping static with dynamic shouldn't change performance. Overlapping dynamic with dynamic will be the same as if they weren't but cause pixels to refresh twice. We only optimize within a tilegrid's boundaries. For example, if a tilegrid moves a little bit, it'll only update the bounds of the move and not double refresh the overlap.

tannewt
 
Posts: 1716
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.