Display Rotation in direct mode thanks to mirror feature of LCD controler

LVGL allows us to rotate the display to switch between portrait and landscape modes but not in direct mode.

Some controllers like the ST7701 offer a mirror function.

Tell me if I’m wrong:

  • Pre-condition: The ST7701 controller drives a screen in portrait mode and that LVGL is configured in landscape mode and direct mode.
  • If LVGL could swap x y when writing to the drawing buffer, the image will be correctly displayed by the controller but as seen in a mirror; so by activating the mirror function of the ST7701, this will finalize a 90° rotation without additional CPU consumption.

if your controller support rotating the image all you need to do is configuring the controller as you need, and use the final resolution for the LVGL display.

Of course, but ST7701 does not support rotation it only supports mirror feature.

Ah, I see.

The problem is that rotation in direct mode is not possible. Imagine that a 10x50 rectangle is rendered in the middle of the screen. As it’s direct mode, it’s written into the frame buffer. So if you rotate the rectangle to get an 50x10 one and blend it, you will have both the 10x50 and the 50x10 on the screen.

Yes, I understand, that’s why I suggest dividing portrait/landscape rotation into two stages:

  • LVGL swap x y when writing in the drawing buffer.
  • Controller mirrors the image received from LVGL.
1 Like

It would be a really large scale change and it’s not on the roadmap now. :frowning:

Does this impact more than files under /draw/src/ directory?

Maybe only lv_draw_sw_blend.c.