Screen rotation in Azure GUIX

Serhii Cherkasov 81 Reputation points
2022-07-27T07:31:01.567+00:00

Hello, I am working with NXP MIMXRT1170-EVK evaluation board and portrait-oriented display. There is an example in MCUXpresso SDK which worked perfectly from the box, without exceptions. But I need to make a screen rotation to make it landscape-oriented.
I found two ways to make that, but I don't like both.

  1. I made changes in GUIX Studio project. Changed 1280x720 resolution to 720x1280 and enabled CCW rotation.
  2. Changed _gx_display_driver_565rgb_setup to _gx_display_driver_565rgb_rotated_setup.
  3. Changed strideBytes from 720x2 to 1280x2
  4. Added _gx_canvas_offset_set(canvas, 0, (1280-720)) in toggle function before display->gx_display_driver_canvas_copy(canvas, &canvas_frame)

Its don't work by 100% because my text is disappearing when I'm interacting with widgets.
225182-image.png

The other way it included changes in GUIX Studio: I'm making 1280x1280 screen and moving my window in bottom part of the screen. But without offset.

Both worked because I think rotated_canvas_copy copied canvas from my window to out-of-bounds. So it will need additional moves to make it right place, like offset.

225191-ccw-rotation.gif

NXP Community Forum in this thread, I write more detailed step-by-step moves while discovering things.
So my question is what did I miss?

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
331 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Ken Maxwell 706 Reputation points Microsoft Employee
    2022-08-01T22:59:16.73+00:00

    It's unclear to me if this issue is related to screen rotation. Does the text that is not showing up ever show up? Can you tell me a little bit more about how this text is updated? What type of widget is this, how to you build the string (maybe show me the code) and what are the styles/properties of the widget that should be drawing the text. It is also not clear why you needed to specify this canvas offset. All that you should need to do is turn on the CW or CCW rotation setting. Leave the x-resolution and y-resolution settings as they were. For example, just for testing, I configured a 640x240 project, with rotation, and it looks like this:

    226840-image.png

    The x and y axis should be swapped by GUIX Studio. Please follow up on the questions above and we can get this resolved.

    1 person found this answer helpful.
    0 comments No comments

  2. Serhii Cherkasov 81 Reputation points
    2022-08-02T14:58:22.873+00:00

    I have removed my changes and am following what you say.

    All that you should need to do is turn on the CW or CCW rotation setting. Leave the x-resolution and y-resolution settings as they were.

    So I leave 1280x720 resolution and selected CW-rotation.

    Display options:
    227276-image.png
    My project window:
    227249-image.png

    But I changed _gx_display_driver_565rgb_setup to _gx_display_driver_565rgb_rotated_setup.
    Because the program ends in UsageFault_Handler() if it was not rotated
    227250-image.png

    EDIT: Its the CCW rotation
    227284-image.png

    0 comments No comments

  3. Ken Maxwell 706 Reputation points Microsoft Employee
    2022-08-03T17:17:16.587+00:00

    OK there are a couple of other details I need to understand. You mentioned you are calling _gx_display_driver_565rgb_rotated_setup, which of course is what you need to do if your display is mounted in non-native orientation. But I am not clear on your display driver. Are you using a custom display driver? Normally your custom display driver calls the _gx_display_driver_565rgb_rotated_setup function, along with implementing the hardware setup and buffer-toggle functions. We have template drivers that provide an outline of what you need to do to implement a basic display driver, and I have attached the version for 565_rgb operation. I also noticed that you have the "Allocate Canvas Memory" checkbox checked. That's fine I guess, but people normally only use this when running on Windows or Linux. When running on the real hardware, people normally turn this off, because the display driver allocates the canvas memory (because there are very often specific requirements as far as where this memory is located, alignment, etc...) 227777-gx-display-driver-565rgb-template.txt

    Rename the file to .c, and use this as the basis for your display driver. You should be able to configure the buffer toggle function such that is copies the modified portion of the canvas memory to the visible frame buffer as needed, without adding any canvas offsets or things of that nature.


  4. Serhii Cherkasov 81 Reputation points
    2023-02-27T12:56:48.66+00:00

    My teammate bypassed this problem.

    Basically, he returned the GUIX project (in Studio) to the default state, with 1280 width and 720 height without rotation.

    I have used offset after rotation, to move down my window. But our board has PXP module, so a better solution is to reset the display resolution to default without rotation, but for rotation use PXP module.

    This is not the exact solution that I have asked for here, but it helps in our case and we stopped working on it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.