您尚未登录。

#1 全志 SOC » F1C100S DMA » 2024-05-13 17:32:00

runner111
回复: 3

我现在使用LVGL,想把disp_flush效率提升。于是就使用了DMA,将color_p的数据搬运到LCD的buffer中,但是每次只能搬运几个字节。感觉像是cache同步问题,对cache进行了强制更新,也没用。请问有什么好办法?
DMA设置:
DMA_Init();
g_dma.Type = NDMA;//类型
g_dma.Ch = 0;//通道
g_dma.Continuous_Mode_Enable = 0;//连续模式
g_dma.Read_Byte_Counter_Enable = 0;//读计数值使能
//---------
g_dma.Source_Address_Type = DMA_ADDRESS_TYEP_LINEER;//源地址类型
g_dma.Source_DRQ_Type = NDMAS_DRQ_Type_SDRAM_Memory;//源类型
g_dma.Source_Data_Width = DMA_DATA_WIDTH_32;//源数据宽度
g_dma.Source_Burst_Length = DMA_BURST_LENGTH_4;//BURST
//-----------
g_dma.Destination_Address_Type = DMA_ADDRESS_TYEP_LINEER;//目标地址类型
g_dma.Destination_DRQ_Type = NDMAD_DRQ_Type_SDRAM_Memory;//目标类型
g_dma.Destination_Data_Width = DMA_DATA_WIDTH_32;//目标数据宽度
g_dma.Destination_Burst_Length = DMA_BURST_LENGTH_4;//BURST

更改后的disp_flush函数
static void disp_flush(lv_disp_drv_t disp_drv, const lv_area_t area, lv_color_t * color_p)
{
/The most simple case (but also the slowest) to put all pixels to the screen one-by-one/

int32_t x;
int32_t y;

g_dma.Source_Address = (unsigned int)color_p;

g_dma.Byte_Counter = (area->x2 + 1 - area->x1) * 2;//Byte计数
for(y = area->y1; y <= area->y2; y++) {
MMU_CleanDCacheArray(g_dma.Source_Address, g_dma.Byte_Counter);
g_dma.Destination_Address = (unsigned int)BT + y LV_HOR_RES_MAX 2 + area->x1 * 2;
DMA_Config(&g_dma);
DMA_Enable(&g_dma);
while (DMA_Get_Full_TIP(&g_dma));
DMA_Disable(&g_dma);
MMU_InvalidateDCacheArray(g_dma.Destination_Address, g_dma.Byte_Counter);
g_dma.Source_Address += (area->x2 + 1 - area->x1) * 2;
}

/* IMPORTANT!!!

  • Inform the graphics library that you are ready with the flushing*/
    lv_disp_flush_ready(disp_drv);
    }

#2 Re: 计算机图形/GUI/RTOS/FileSystem/OpenGL/DirectX/SDL2 » Freetype 内存回收 » 2019-10-05 09:29:41

int ftfont_rander(unsigned long u32c, FontCharRec *fcr){
struct FTContext *ctx = &g_ftctx;
FT_UInt glyph_index;
FTC_SBitRec *ftsbrec;

if(ctx->ftmgr == NULL){
return 1;
}
/* Request face object from cache
if (FTC_Manager_LookupFace(ctx->ftmgr, ctx, &ctx->ftface)) {
return 2;
}*/

// Request size object from cache
if (FTC_Manager_LookupSize(ctx->ftmgr, &ctx->ftscaler, &ctx->ftsize)) {
return 3;
}

// Request glyph index from cache
glyph_index = FTC_CMapCache_Lookup(ctx->ftcache, ctx, 0, u32c);

// Request bitmap from cache
if (FTC_SBitCache_Lookup(ctx->ftsbcache, &ctx->ftitype, glyph_index, &ftsbrec, NULL)) {
return 4;
}

fcr->w = ftsbrec->width;
fcr->h = ftsbrec->height;
fcr->left = ftsbrec->left;
fcr->top = ftsbrec->top;
fcr->pitch = ftsbrec->pitch;
fcr->w_adv = ftsbrec->xadvance;
fcr->h_adv = ftsbrec->yadvance;
fcr->buffer = ftsbrec->buffer;
return 0;
}

#3 Re: 计算机图形/GUI/RTOS/FileSystem/OpenGL/DirectX/SDL2 » Freetype 内存回收 » 2019-10-05 09:11:39

没有GUI是我自己写的,所以我不知道Freetype能不能管理内存,实际上我每次取出ftsbrec之后,就会把内容复制,这个buffer实际上就没用了。
但是没看到哪里会清理缓存,我缓存倒是开了1M。
FTC_Manager_New(ctx->ftlib, 0, 0, 1000000,
(FTC_Face_Requester)_ftfont_cbFaceRequester,
NULL, &ctx->ftmgr)

#4 计算机图形/GUI/RTOS/FileSystem/OpenGL/DirectX/SDL2 » Freetype 内存回收 » 2019-10-04 21:46:43

runner111
回复: 6

我用Freetype 在嵌入式上打印汉字,逻辑是Freetype得到汉字的8位灰度图后,我用这个灰度图建立一个ARGB8888的汉字图像。
我的问题是,如何把freetype的汉字buffer清掉?是必须调FTC_Manager_Done和FT_Done_FreeType吗?这样每写一个汉字
都需要重新初始化,感觉效率太低了。有什么好方法?谢谢

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn


东莞哇酷科技有限公司开发