Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

移植AT32F435运行速度较低 #3

Closed
Mygit520 opened this issue Sep 14, 2024 · 9 comments
Closed

移植AT32F435运行速度较低 #3

Mygit520 opened this issue Sep 14, 2024 · 9 comments

Comments

@Mygit520
Copy link

#define NES_ENABLE_SOUND (0) /* enable sound /
#define NES_USE_SRAM (0) /
use SRAM */

#define NES_FRAME_SKIP (0) /* skip frames /
#define NES_COLOR_DEPTH (16) /
color depth /
#define NES_COLOR_SWAP (0) /
swap color channels /
#define NES_RAM_LACK (0) /
lack of RAM */

#define NES_USE_FS (0) /* use file system /
这是目前的配置。
int nes_draw(int x1, int y1, int x2, int y2, nes_color_t
color_data){
static unsigned int last_tick = 0;
LCD_Address_Set(50+0,50+0,306-1-0,290-1-0);
LCD_CS_Clr();
LCD_WR_Bus(0x32);
LCD_WR_Bus(0x00);
LCD_WR_Bus(0x3c);
LCD_WR_Bus(0x00);
for (int j = 0; j < 240; j++)
{
for (int i = 0; i < 256; i++)
{
Write_QSPI_Parameter(((((color_data[(j256+i)] << 1) & 0xffe0 )| (color_data[(j256+i)] & 0x001F))>>8)&0xFF);
Write_QSPI_Parameter((((color_data[(j256+i)] << 1) & 0xffe0 )| (color_data[(j256+i)] & 0x001F))&0xFF);
}
}
LCD_CS_Set();
FPS = 1000/(sys_tick-last_tick);
last_tick = sys_tick;
return 0;
}
这是LCD刷新函数和计算FPS函数,没有进行任何的nes_wait。运行后得到FPS只有9

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: The transplanted AT32F435 runs slower

@Dozingfiretruck
Copy link
Owner

你这是每个像素发?这效率很慢呀,你整屏buff发呢?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Are you posting every pixel? This efficiency is very slow. How do you apply the buff to the entire screen?

@Mygit520
Copy link
Author

你这是每个像素发?这效率很慢呀,你整屏buff发呢?

我现在是每个像素点都发,但是这样的话能够设定好LCD的范围之后,一直发就行了,LCD内部地址会自动递增,而且这样的帧率也是比较稳定的,所需时间和按点来发送的所需时间差距并不是很大。还是说我理解有误,请求大佬给我一点建议

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Are you sending every pixel? This efficiency is very slow. How do you apply the buff to the entire screen?

I am currently sending every pixel, but in this case, after setting the range of the LCD, I can just send it all the time. The internal address of the LCD will automatically increase, and the frame rate is relatively stable. The time required and the number of clicks are The difference in time required to send is not very big. Or maybe I misunderstood, please give me some advice.

@Dozingfiretruck
Copy link
Owner

你这是每个像素发?这效率很慢呀,你整屏buff发呢?

用以前的工程测试下来,AT32F435 288M主频 72Mspi+dma faster优化等级,240*240 整屏刷屏FPS为70+(普通spi驱动),
nes部分不做任何优化情况下,同时也不跳帧的情况下,帧率基本在40-50+,如果进行下优化或者直接跳1帧的话可以达到比较高的速率的

image

image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Are you sending every pixel? This efficiency is very slow. How do you apply the buff to the entire screen?

Tested using previous projects, AT32F435 288M main frequency 72Mspi+dma faster optimization level, 240*240 full screen refresh FPS is 70+ (normal spi driver),
Without any optimization in the nes part and without skipping frames, the frame rate is basically 40-50+. If optimization is performed or one frame is skipped directly, a relatively high rate can be achieved.

image

image

@Dozingfiretruck
Copy link
Owner

你这是每个像素发?这效率很慢呀,你整屏buff发呢?

我现在是每个像素点都发,但是这样的话能够设定好LCD的范围之后,一直发就行了,LCD内部地址会自动递增,而且这样的帧率也是比较稳定的,所需时间和按点来发送的所需时间差距并不是很大。还是说我理解有误,请求大佬给我一点建议

整块内存发送和你一个像素一个像素发完全不一样,和自增没关系,自增是lcd的驱动形式,按点发送时间相差极大,建议使用整屏+dma驱动

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Are you sending every pixel? This efficiency is very slow. How do you apply the buff to the entire screen?

I am currently sending every pixel, but in this case, after setting the range of the LCD, I can just send it all the time. The internal address of the LCD will automatically increase, and the frame rate is relatively stable. The required time and press The difference in time required to click to send is not very big. Or maybe I misunderstood, please give me some advice.

Sending the entire memory is completely different from sending it pixel by pixel. It has nothing to do with auto-increment. Auto-increment is the driving mode of LCD. The time of sending by point is very different. It is recommended to use the whole screen + dma driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants