Commit Graph

17 Commits

Author SHA1 Message Date
Jeff Epler 20c9f25a65 rgbmatrix: Eliminate some duplicated height-calculating code
This was hard to write, so let's have it written in 2 places instead
of 4.
2021-01-26 14:35:26 -06:00
Jeff Epler 368977fb90 RGBMatrix: Additional tile tweaks
* Introduce explicit serpentine: bool argument instead of using negative
   numbers (thanks, ghost of @tannewt sitting on one shoulder)
 * Fix several calculations of height

Testing performed (matrixportal):
 * set up a serpentine 64x64 virtual display with 2 64x32 tiles
 * tried all 4 rotations
 * looked at output of REPL
2021-01-26 14:33:48 -06:00
Jeff Epler 51f0544405 protmatter: Update to version that supports tiling 2021-01-26 09:19:44 -06:00
Christian Walther a4b84cf0e1 Use movable allocation system for RGBMatrix allocations.
Hybrid allocation is now part of the infrastructure. Moving memory contents would not be necessary because displayio can recreate them, but does not hurt.
2020-11-28 17:54:34 +01:00
Christian Walther c7404a3ff8 Add movable allocation system.
This allows calls to `allocate_memory()` while the VM is running, it will then allocate from the GC heap (unless there is a suitable hole among the supervisor allocations), and when the VM exits and the GC heap is freed, the allocation will be moved to the bottom of the former GC heap and transformed into a proper supervisor allocation. Existing movable allocations will also be moved to defragment the supervisor heap and ensure that the next VM run gets as much memory as possible for the GC heap.

By itself this breaks terminalio because it violates the assumption that supervisor_display_move_memory() still has access to an undisturbed heap to copy the tilegrid from. It will work in many cases, but if you're unlucky you will get garbled terminal contents after exiting from the vm run that created the display. This will be fixed in the following commit, which is separate to simplify review.
2020-11-28 17:50:23 +01:00
Scott Shawcroft 1eb1434fc9
Merge pull request #3537 from jepler/update-protomatter-2
rgbmatrix: update protomatter to 1.0.5 tag
2020-10-12 15:45:51 -07:00
Jeff Epler 9696dbfd38 rgbmatrix: Don't crash when setting brightness=0
If the display is paused, `_PM_swapbuffer_maybe` will never return.
So, when brightness is 0, refresh does nothing.  This makes it necessary
to update the display when unpausing.

Closes: #3524
2020-10-12 13:28:20 -05:00
Jeff Epler 5e38bb98cb rgbmatrix: update protomatter to 1.0.5 tag
this is compile-tested on
 stm32f405 feather
 matrixportal
 nrf52840 feather

but not actually tested-tested.
2020-10-10 14:30:37 -05:00
Jeff Epler 17a5a85528 rgbmatrix: Move struct definition to shared-module, rename 'core' member 2020-09-02 13:34:16 -05:00
Jeff Epler 3c083330f8 RGBMatrix: Remove unused, dead allocation
@tannewt noticed this in a pull request review.  The allocated
memory was never used, but the GC would have collected it eventually.
2020-09-01 11:00:22 -05:00
Jeff Epler ce603dfebf rgbmatrix: Disable timer while reconstructing the display 2020-09-01 11:00:22 -05:00
Jeff Epler dfa90cc11d allocator.h: add a missing license notice 2020-09-01 11:00:19 -05:00
Jeff Epler e01ade3848 rgbmatrix: Don't inline the allocator functions 2020-09-01 11:00:07 -05:00
Jeff Epler 2f120c70ee rgbmatrix: recover gracefully from allocation errors
e.g., allocating a 192x32x6bpp matrix would be enough to trigger this
reliably on a Metro M4 Express using the "memory hogging" layout.
Allocating 64x32x6bpp could trigger it, but somewhat unreliably.

There are several things going on here:
 * we make the failing call with interrupts off
 * we were throwing an exception with interrupts off
 * protomatter failed badly in _PM_free when it was partially-initialized

Incorporate the fix from protomatter, switch to a non-throwing malloc
variant, and ensure that interrupts get turned back on.

This decreases the quality of the MemoryError (it cannot report the size
of the failed allocation) but allows CircuitPython to survive, rather
than faulting.
2020-09-01 10:55:45 -05:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Jeff Epler 5fcc6d6286 RGBMatrix: finish renaming from Protomatter
This gets all the purely internal references.  Some uses of
protomatter/Protomatter/PROTOMATTER remain, as they are references
to symbols in the Protomatter C library itself.
2020-04-17 18:44:07 -05:00
Jeff Epler 3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00