juj / fbcp-ili9341

A blazing fast display driver for SPI-based LCD displays for Raspberry Pi A, B, 2, 3, 4 and Zero
MIT License
1.58k stars 265 forks source link

Issues after commenting out `#define DISPLAY_OUTPUT_LANDSCAPE` #272

Open jam-eth opened 2 years ago

jam-eth commented 2 years ago

Hello everyone.

I'm working through a project with a display mounted in portrait, and I have hit a wall. the issues begin the moment i comment out #define DISPLAY_OUTPUT_LANDSCAPE

So here's what I do before uncommenting that line, hopefully, if someone is able to play along, the issue should be simple to replicate:

I'm running the latest version of Raspberry Pi OS from their new flashing tool. Debian Bullseye 32-bit, on a Raspberry Pi 3B I'm trying to get a "square-ish" display in the center of a portrait orientated 2.8" SPI display like this I don't do much in config.txt I set a top and bottom overscan, set hdmi_force_hotplug=1 and comment out #dtoverlay=vc4-kms-v3d

my CMake config looks like this: (I was getting DMA conflicts if i don't specify the DMA channels) cmake -DILI9341=ON -DGPIO_TFT_DATA_CONTROL=24 -DGPIO_TFT_RESET_PIN=25 -DSPI_BUS_CLOCK_DIVISOR=6 -DDMA_TX_CHANNEL=0 -DDMA_RX_CHANNEL=5 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DSTATISTICS=0 ..

this works fine. I get a very narrow (because of the overscan) desktop in lansdsacpe on my display, I can leave it for hours and come back to it, jog the mouse and the cursor moves immediately.

So the next step is to get it in portrait, and this is where several issues are introduced.

I comment out #define DISPLAY_OUTPUT_LANDSCAPE in config.h

The first issue is that the display is now in the correct orientation on the display, but it is mirrored, this can and has been resolved by adding the line madctl ^= MADCTL_COLUMN_ADDRESS_ORDER_SWAP; in ili9341.cpp as per https://github.com/juj/fbcp-ili9341/issues/85 I have found that this last step, although working in un-mirroring the LCD, is not responsible for the issues. going through the installation step-by-step, my issues are present as soon as #define DISPLAY_OUTPUT_LANDSCAPE is commented out.

the second and biggest issue at this point is that after about 7 seconds of inactivity the display freezes (keep the display updating ie. jiggling the mouse cursor, and the display does not lock up) in order to get the display working again I need to unplug it, re-connect, and run ./fbcp again to get the display working until there is no activity for 7 seconds again.

Thirdly once the display has locked up. trying to Ctrl-C to close the driver doesn't work, I need to force quit fbcp by Ctrl-C-ing 5 times. the display continues to display a frozen image after fbcp has been forced to quit. so the frozen display is at this point, affecting the operation of the Pi.

I've spent all day trying with -DUSE_DMA_TRANSFERS=OFF and all manner of clock divisors from 6 to 40. and the issue behavior remains constant, id go as far as to say in my setup commenting out #define DISPLAY_OUTPUT_LANDSCAPE breaks the driver.

Is anoyone around to help troubleshoot? im at a loss :p

jam-eth commented 2 years ago

Update:

This issue is introduced in the latest version of Raspberry Pi OS.

I can comment out #define DISPLAY_OUTPUT_LANDSCAPE in the "legacy" version of Raspberry Pi OS through the Raspberry Pi SD card flasher, and in the RetroPi image, again tested by flashing the image from the Raspberry PI SD card flasher utility.

So it's not disastrous, but something has been introduced in the latest version of Raspberry Pi OS that breaks fbcp-ili9341 when using non-standard display orientation configs.

Happy to test, less good at Linux :p