LVGL guider RT1060 Rotation porting CPU Rotate and PXP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LVGL guider RT1060 Rotation porting CPU Rotate and PXP

Jump to solution
959 Views
kwf
Contributor III

Hi Commnuity,

 I need help with a GUI design issue I'm facing on the RT1060 EVK platform. I'm using LVGL to design the GUI, but here's the catch: the RT1060 EVK is designed in landscape mode, while I actually need it to be in portrait mode. So, what I did was create a new project in GUI guide 1.5.1 and selected a custom resolution of 272*480 (since text and other elements can't be rotated).

The GUI guide project show as below.

kwf_3-1684143231603.png

This configuration displays the GUI in the upper half of the screen, and I can scroll down to access the lower half where all the components work fine.

Now, here's where things get tricky. I did some research on the forum  (I.MX 1060 SDK lvgl guider - rotation display ), and there was a discussion about this topic, but unfortunately, no clear conclusion was reached.

I came across the SDK PXP Rotate, and I tried to integrate it into my GUI Guide project. I called the PXP initialization function in lvgl_support.c show as below.

 

static void APP_InitPxp(void)
{
    PXP_Init(APP_PXP);

    /* PS configure. */
    const pxp_ps_buffer_config_t psBufferConfig = {
        .pixelFormat = APP_PXP_PS_FORMAT,
        .swapByte    = false,
        .bufferAddr  = (uint32_t)s_frameBuffer,
        .bufferAddrU = 0U,
        .bufferAddrV = 0U,
        .pitchBytes  = APP_PS_WIDTH * APP_BPP,
    };

#if defined(FSL_FEATURE_PXP_V3) && FSL_FEATURE_PXP_V3
    PXP_SetProcessSurfaceBackGroundColor(APP_PXP, 0U, 0U);
#else
    PXP_SetProcessSurfaceBackGroundColor(APP_PXP, 0U);
#endif

    PXP_SetProcessSurfaceBufferConfig(APP_PXP, &psBufferConfig);

    PXP_SetProcessSurfacePosition(APP_PXP, 0, 0, APP_IMG_WIDTH, APP_IMG_HEIGHT);

    /* Disable AS. */
    PXP_SetAlphaSurfacePosition(APP_PXP, 0xFFFFU, 0xFFFFU, 0U, 0U);

    outputBufferConfig.pixelFormat    = APP_PXP_OUT_FORMAT;
    outputBufferConfig.interlacedMode = kPXP_OutputProgressive;
    outputBufferConfig.buffer0Addr    = (uint32_t)s_frameBuffer[1];
    outputBufferConfig.buffer1Addr    = 0;
    outputBufferConfig.pitchBytes     = LCD_WIDTH * APP_BPP;
    outputBufferConfig.width          = LCD_WIDTH;
    outputBufferConfig.height         = LCD_HEIGHT;

    PXP_SetOutputBufferConfig(APP_PXP, &outputBufferConfig);

    /* Disable CSC1, it is enabled by default. */
    PXP_EnableCsc1(APP_PXP, false);

}

 

Used the PXP_SetRotateConfig function to rotate the display by 90 degrees within the Demo_FlushDisplay function.

 

static void DEMO_FlushDisplay(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
{
//	irq = DisableGlobalIRQ();
    DCACHE_CleanInvalidateByRange((uint32_t)color_p, DEMO_FB_SIZE);
    /*------------------------modify by AF---------------------------*/

	/* Prepare next buffer for LCD. */
	PXP_SetRotateConfig(APP_PXP, kPXP_RotateProcessSurface, kPXP_Rotate90, kPXP_FlipDisable);

	outputBufferConfig.buffer0Addr = (uint32_t)color_p;
	PXP_SetOutputBufferConfig(APP_PXP, &outputBufferConfig);

	PXP_Start(APP_PXP);

	/* Wait for process complete. */
	while (!(kPXP_CompleteFlag & PXP_GetStatusFlags(APP_PXP)))
	{
	}

	PXP_ClearStatusFlags(APP_PXP, kPXP_CompleteFlag);

	APP_FillFrameBuffer((void*)color_p);

    ELCDIF_SetNextBufferAddr(LCDIF, (uint32_t)color_p);

    s_framePending = true;

 

 But guess what? It didn't work. It seems that rotating the PXP on the RT1060 isn't as simple as I thought.

 

Later, I stumbled upon an example on the RT1170 that used CPU rotation. Intrigued, I attempted to port this method to the RT1060. Interestingly, when I displayed the buffer s_frameBuffer[0], only half of the screen was visible. However, when I displayed s_frameBuffer[1], it showed a successful rotation. I'm wondering if LVGL has some underlying mechanism that causes this behavior.

 

kwf_0-1684143200328.png

kwf_1-1684143210222.png

kwf_2-1684143219795.png

To sum it up, I have a few questions and observations:

  1. Can PXP Rotate function used in an LVGL project?
  2. It seems that when the configured panel size differs from the actual panel size, LVGL stores the excess portion somewhere and enables scrolling to display it, which leads to abnormal behavior during customer configuration.
  3. The CPU-based rotation seems to involve some calculations in LVGL that produce the observed outcome. How to fix it?

 

I would greatly appreciate your input and guidance on these matters. If you need any additional information or code snippets, please let me know.

 

Thanks a lot for your help!

Labels (1)
Tags (2)
0 Kudos
1 Solution
935 Views
Ramon_Vega
NXP TechSupport
NXP TechSupport

dear @kwf 

Unfortunately for this case, it is not possible to develop this project with the RT1060-EVK and RK043FN02H-CT panel, because this panel does not support LVGL display rotation. That is the reason why GUI-guider does not have this feature available.
As advice, you may consider choosing the RT1170-EVK with panel. This one is suitable for your project.

MIMXRT1170-EVK | NXP Semiconductors

5.5" LCD Panel | NXP Semiconductors

I hope this information help you!.

Kind Regards.

-Ramon.

View solution in original post

0 Kudos
2 Replies
678 Views
sidharth-458
Contributor I

you might try using the function lv_gpu_pxp_blit in flushcb, you need 1 input buffer and 1 output/stationary buffer. In lv_disp_draw_buf_init put framebuf 1 and null, disp_drv should not be using software rotate; should use full refresh. 

0 Kudos
936 Views
Ramon_Vega
NXP TechSupport
NXP TechSupport

dear @kwf 

Unfortunately for this case, it is not possible to develop this project with the RT1060-EVK and RK043FN02H-CT panel, because this panel does not support LVGL display rotation. That is the reason why GUI-guider does not have this feature available.
As advice, you may consider choosing the RT1170-EVK with panel. This one is suitable for your project.

MIMXRT1170-EVK | NXP Semiconductors

5.5" LCD Panel | NXP Semiconductors

I hope this information help you!.

Kind Regards.

-Ramon.

0 Kudos