bitslip6 / rpi-gpu-hub75-matrix

Control Hub75 panels using GPIO on Raspberry Pi 5 @9600Hz. OpenGL ES 3.1 fragment shaders. 3 parallel panels, chain up to 8 panels on each port. Gamma and Tone Mapping, 64 bit BCM. ShaderToy support.
14 stars 2 forks source link

Implement --led-rgb-sequence option #8

Closed mrechte closed 1 week ago

mrechte commented 1 week ago

To change the panel pixel order. Could you, please, point-out where and how to change the output pixel order. I assume it is in render_forever function, tweaking the bcm_signal[offset] value ?

bitslip6 commented 1 week ago

There is currently no option for this. however, if you take a look at src/pixles.c: update_bcm_signal_32, update_bcm_signal_64 you will see that bits are ordered RGB. You can re-order these here for any order you like for your installation.

I'll have to think about adding support for other pixel-ordering since this is the hottest loop in the update thread and runs bit_depth iterations per pixel per frame. It is only 2 lines of code but has bit masks for 18 GPIO lines.

So for a 192x192 pixel scene running at 64bit BCM depth at 60FPS, that is 141,557,760 loop iterations per second.

Currently, this is also 2,211,840 conditional ifs to see if we need to calculate the pixel offsets every time upate_bcm_signal_x() is called. If these offsets are added to the scene_info struct then we can calculate them 1x and remove the only if() in those functions.

we will need to make separate functions for each pixel order and then select the correct function map_byte_image_to_bcm()

If you feel confident to make this change:

add new uint8_t pixel_order to include/rpihub75.h scene_info struct. add new option in util.c default_scene function to set the pixel_order edit src/pixels.c map_byte_image_to_bcm and select the correct function for the update_bcm_signal function pointer then send a pull request.

If not I can probably get to this change this weekend.

Side note: anti-aliased TTF fonts coming this month.

mrechte commented 1 week ago

https://github.com/bitslip6/rpi-gpu-hub75-matrix/pull/9

mrechte commented 1 week ago

Thanks for accepting my PR