Framebuffer driver screen rotation

Description

Framebuffer driver screen rotation

What MCU/Processor/Board and compiler are you using?

Linux FB

What do you want to achieve?

Rotate 480x800 16 bit screen counter-clockwise 90 degrees. It’s currently displayed fine in portrait format.

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Have you considered rotating the Linux driver instead? I suggest doing this as it will make outputting data to the display less complicated. Additionally, this would allow you to use some sort of splash screen while the kernel is loading if that is of interest.

Which driver are you using? Many/Most of them have a rotate parameter you can pass in via the device tree file. This is an example from one I used in a previous project:

    dt024ctft@0,0 {
        compatible = "ilitek,ili9341";
        reg = <0>;
        status = "okay";

        spi-max-frequency = <24000000>;
        width = <240>;
        height = <320>;
        regwidth = <8>;
        buswidth = <9>;
        bpp = <16>;
        debug = <0>;
        rotate = <90>;
        bgr;
        fps = <30>;
        txbuflen = <32768>;
        reset-gpios = <&gpio2 13 0>;    /* Reset pin */
    };

Were I you I’d investigate this as it will impact anything you output to the screen, not only what has come from this application.

Is this possible for the Linux framebuffer?

It’s something you specify to the driver via your device tree file. See my example above.

Which display are you using, and what is your output method (HDMI, LVDS, RGB, etc.)?

The STM32MP157C-DK2 has a FRD397B2509V2 TFT MIPI DSI LCD module with an OTM8009A LCD driver. The driver doesn’t support rotation. Is there another way in the LittlevGL framebuffer driver?

The only setting of which I’m aware is the rotate_d which you can configure inside your lv_disp_drv_t object.

Note that even after changing that setting your driver still needs to handle drawing the buffer to the appropriate location on the screen (LittlevGL does not just hand you a landscape buffer with everything drawn in portrait).