MPU默认配置导致LCD接口刷屏速度变慢

cancel
Showing results for 
Search instead for 
Did you mean: 

MPU默认配置导致LCD接口刷屏速度变慢

624 Views
sunhonglisun
Contributor I

使用LCD+PXP一直刷屏,同时保持SDK中的BOARD_ConfigMPU函数开启后导致刷屏帧率变慢了约20%,请问有可能是什么原因导致的?

Labels (1)
0 Kudos
3 Replies

502 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi ,

非常感谢使用NXP产品,很高兴为你提供技术支持!
大致猜测可能与LCD和PXP处理的图像帧存储的空间的属性有关,我建议你详细的介绍一下你的测试流程和代码结构,因为上述描述可得有效信息太少了。

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

502 Views
sunhonglisun
Contributor I

您好:

首先非常感谢您的回复;

具体的情况是这样的;

1. MPU函数中关于SDRAM的配置如下(其他配置保持默认不变):

/* Region 1 setting: Memory with Device type, not shareable, non-cacheable. */
MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);

/* Region 7 setting: Memory with Normal type, not shareable, outer/inner write back */
MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 1, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);

/* Region 8 setting, set last 2MB of SDRAM can't be accessed by cache, glocal variables which are not expected to be
* accessed by cache can be put here */
/* Memory with Normal type, not shareable, non-cacheable */
MPU->RBAR = ARM_MPU_RBAR(8, 0x81E00000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_2MB);

2. 使用了LCD和PXP外设,且定义了两个单buffer用于数据填充定义如下:

__align(8) uint16_t elcdif_lcd_framebuf[480][800] __attribute__((at(0x801000000))); 

__align(8) uint16_t elcdif_pxp_framebuf[480][800] __attribute__((at(0x802000000)));

数据从先从elcdif_pxp_framebuf经过pxp处理后传到elcdif_lcd_framebuf通过LCD接口传出来。

3. pxp部分初始化函数(只使用的PS):

PXP_Init(APP_PXP);

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

PXP_SetProcessSurfaceBackGroundColor(APP_PXP, 0U);

PXP_SetProcessSurfaceBufferConfig(APP_PXP, &psBufferConfig);
PXP_SetProcessSurfacePosition(APP_PXP, 0, 0, 800, 480);
/* Disable AS. */
PXP_SetAlphaSurfacePosition(APP_PXP, 0xFFFFU, 0xFFFFU, 0U, 0U);

/* Output config. */
outputBufferConfig.pixelFormat = kPXP_OutputPixelFormatRGB565;//kPXP_OutputPixelFormatRGB888;
outputBufferConfig.interlacedMode = kPXP_OutputProgressive;
outputBufferConfig.buffer0Addr = (uint32_t)elcdif_lcd_framebuf;
outputBufferConfig.buffer1Addr = 0U;
outputBufferConfig.pitchBytes = APP_IMG_WIDTH * APP_BPP;
outputBufferConfig.width = APP_IMG_WIDTH;
outputBufferConfig.height = APP_IMG_HEIGHT;

PXP_SetOutputBufferConfig(APP_PXP, &outputBufferConfig);

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

4. 测试部分代码:

test_my++;
sprintf(str,"%03d",test_my);

TEXT_SetText(WM_GetDialogItem(main_hWin2, ID_TEXT_0),str);

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

上述简单的计数程序一直累加,然后显示,您会发现:开启MPU函数中SDRAM部分配置后,计数并显示的速度明显比关闭SDRAM部分配置的速度要慢20%左右。

使用如下SDRAM配置后速度会有提升(其他部分保持不变):

/* Region 7 setting: Memory with Normal type, not shareable, outer/inner write back */
MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);

请帮忙分析原因,谢谢。

0 Kudos

502 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi ,

感谢回复。

对于可共享存储区域,存储系统在具有多个总线主控的系统(例如,具有DMA控制器的处理器)中的总线主控之间提供数据同步。 对于i.MXRT,默认情况下可共享即表示不可缓存(Cache)。

应该这就是你所发现的现象的原因。

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos