fastest method of drawing one pixel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-10 04:23 AM
Hello! I have a good 3d library https://github.com/FabioRM/dsp3D
The author of the library ran it on STM32F746 . The library has the function
void dsp3D_LL_drawPoint(uint32_t x, uint32_t y, color32_t color)
{
if(x < minX)
minX = x;
if(x > maxX)
maxX = x;
if(y < minY)
minY = y;
if(y > maxY)
maxY = y;
// YOUR IMPLEMENTATION
}
we need to substitute the code of the output pixel
I wrote to it my function TFT_FillRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t color)
oid TFT_FillRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t color)
{
#define swap(a,b) {int16_t t=a;a=b;b=t;}
if(x1>x2) swap(x1,x2);
if(y1>y2) swap(y1,y2);
uint32_t addr=0;
addr = hltdc.LayerCfg[0].FBStartAdress + 3*(y1*hltdc.LayerCfg[0].ImageWidth+x1);
hdma2d.Init.Mode = DMA2D_R2M;
hdma2d.Init.OutputOffset = hltdc.LayerCfg[0].ImageWidth - (x2-x1);
if(HAL_DMA2D_Init(&hdma2d) == HAL_OK)
{
if(HAL_DMA2D_Start(&hdma2d, color, addr, x2-x1, y2-y1) == HAL_OK)
{
HAL_DMA2D_PollForTransfer(&hdma2d, 10);
}
}
}
but drawing is very slowly
https://cloud.mail.ru/public/DGUX/TZoRw7stw
the author of the library does it faster
https://www.youtube.com/watch?v=HqQ-ebsyalM&feature=emb_logo
Please tell me, how can I draw one pixel faster?
- Labels:
-
STM32F7 Series
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-10 04:50 AM
*(addr) = color;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-10 05:07 AM
I wrote
void dsp3D_LL_drawPoint(uint32_t x, uint32_t y, color32_t color)
{
if(x < minX)
minX = x;
if(x > maxX)
maxX = x;
if(y < minY)
minY = y;
if(y > maxY)
maxY = y;
// YOUR IMPLEMENTATION
*(__IO uint32_t*)(0xD0000000 + 3*(y * SCREEN_WIDTH + x))=color;
}
Speed isn't increased...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-10 05:17 AM
If you want it to really go fast everything needs to be simplified and optimised - every function call adds overhead particularly at the pixel level.
Have a look at my example videos. This is all handcrafted code - no DMA, it is too slow
https://www.youtube.com/channel/UCK3btXJrZWnDVVTV7U-qzEw
These are running on an H743 at 800x600 resolution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-10 05:20 AM
Good!
Can you give me your library?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-01-10 06:03 AM
There is a link to the complete project code on this page. There is no library as such.
https://geoffg.net/maximite.html
One thing to note is that the video memory in internal RAM and then multiple framebuffers are kept in SDRAM. Although pixel level writing can be done to the video memory it is much better to write to a separate framebuffer in non-shared RAM and then bulk copy that to the video memory which is the only bit with shared access.