Hi guys,
I am designing a really simple GPU and Bresenham line algorithm will be supported. Implementing
the algorithm in VHDL is no problem for me, my problems are on how to use the framebuffer.
My board (de2-115) has a SDRAM with 128MB that I really want to use it as framebuffer so I can save
block ram to other things like caches, buffers, etc.
As many of you may know, SDRAM achieves its best performance when we use bursts to read/write it
and to use this feature, we need consecutive addresses at each burst. The problem is that bresenham may
not generate pixels at consecutive positions.
How could I solve this issue? What I need is an efficient way of moving the generated pixels to the SDRAM.
I've thought on working with tiles:
- generate the first pixel and then determine on which tile we are. Set the appropriated registers
- draw the part of line that is contained in the tile
- stop the bresenham algorithm and transfer the tile to the framebuffer
- repeat the process until all the line has been drawed
The problem with this approach is that I waste more time transferring non-generated pixels than generated pixels.