REPOST: Change LCD orientation in 180 degree
QUESTION - TouchGFX Community repost - Eyal goltzman - July 2016
Hello,
Following Yossi question from today and Martin reference to Soren answer in https://touchgfx.zendesk.com/hc/en-us/community/posts/206708899--orientation-180-degree
We are using LCD without SPI interface, only parallel RGB interface through the LCD-TFT Controller peripheral, so controlling the LCD as describe in your answer to the above link is not an option.
Since our customers have a mechanical issue with the display orientation (the flat cable position) we are trying to address it with SW solution.
As I see it, there is an option to rotate the frame buffer just before calling swapFrameBuffers, what do you think? It could be done? performance issues? Can we do it ourselves? How?
Thanks,
Eyal
ANSWER - TouchGFX Community repost - Soren Pingel Dalsgaard - July 2016
Hi Eyal,
How unfortunate! You could do the rotation manually, but the performance penalty will be very significant, to the extent that only very simple UIs can be realized.
This is due to two things:
- If anything changes on screen then you must invalidate() the entire screen. Otherwise it will not have properly "undone" the rotation from last time, causing the widgets to appear in both normal and rotated positions.
- The rotation algorithm must invert both X and Y axis. This means that you must either read or write each and every pixel of the screen non-sequentially to SDRAM, which is very expensive.
I think the right place to do such a rotation would be by overriding HAL::endFrame. Something like this:
void MyHAL::endFrame()
{
dma.flush(); //wait for all dma operations to have completed
rotateFb(getClientFrameBuffer()); //apply rotation on the fb
HAL::endFrame(); //call base impl when rotation is done.}Apart from this you would need also to invert the coordinates in your touch controller driver.
You can give it a shot, but I am not too optimistic to be honest. Hopefully you could convince your customer to switch to another display that can either be mounted normally or supports scan direction swap.
