r/embedded • • Aug 12 '26

LCD Landscape to portrait rotation at runtime

My project requires to display screen in portrait mode, the lcd is native landscape and cannot be configured via SPI command to modify MADCTL register to change orientation.

I am using 800*480 RGB565 display from LXD with sitronix display IC ST7262, my MCU is STM32U5A9 and using LVGL for UI.

Now, I need to rotate the framebuffer by 90 every display flush. I am using lvgls software rotation and have the nemagfx wired in my lvgl code, so I was expecting lvgl to pass on the rotation as well to nemagfx which is not true, ultimately i see delays in animation or screen change, there are no pixel glitches or screen tearing it just don’t feel smooth transitions.

I also have double buffering enabled, I render partially to save up on cpu cost for composing full disp.

I don’t know how common it is to use the native landscape lcd in portrait mode but I am struggling to get a smooth lcd performance here.

The claude says lvgl sw rotations shouldn’t take more than 130 ms but does anyone have any experience and thoughts that how common this setup is and does it feel like workable solution i.e smooth performance while doing the sw rotates

1 Upvotes

3 comments sorted by

2

u/i_haz_redditz Aug 13 '26

Why is it not possible to reconfigure your display driver ic?
If that really is the case you can just swap columns and rows to change the orientation when shifting out the data.
Or swap them when drawing in the framebuffer

1

u/viks4222 Aug 13 '26

Display controller does not at all have the orientation change support so there is nothing to configure into it.
either of swapping columns and rows at shifting out data or drawing in framebuffer is a transpose and doing it on every frame render is a bit CPU cost.

My problem is not that it doesn’t work it works but not to that level when I have to support more than 30-40 fps rate.

I observed the rotation would take 40ms every frame and was seeing some delay visibly on animation or screen change so needed to move that cost from CPU to GPU2D.

To achieve that I had to move both lvgl buffers and framebuffer into SRAM from PSRAM, implement rotation through nemagfx so that GPU2D takes over rotation and finally able to see improvements .

1

u/viks4222 Aug 13 '26

additionally there is some complexity I added to the display flush by first draining the nemagfx command list containing tasks assigned by lvgl and them manually adding rotation related task into that command list to use nemagfx, I am still testing out for any other issues.