Page 2 of 2
Re: Video problems on hw
Posted: Fri Dec 18, 2015 7:10 pm
by Stef
cero wrote:A couple posts above:
I understood the use_dma parameter as "do it faster if no other DMA is in progress". Am I wrong?
The DMA flag is just to use DMA or not for the fill operation, if a previous DMA was still occurring you will screw up VRAM if you try to write it (by DMA or not).
I tested your rom and i obtained a blank screen... look like you are using your own makefile and do not align rom size to 128 KB (which can be a problem for some flash cart). Still given your code you should not experience any troubles
cero wrote:Hm, would it be too much overhead to add VDP_waitDMACompletion() to the start of every VDP function, thereby making all functions safe to use, and also allowing user code to do non-VDP things when the DMA fill is going on?
If it was made an inline function, that'd be just one or two instructions.
Honestly i think it would be better to just allow 'wait for completion' on specific DMA VRAM fill and DMA VRAM copy operations as these are the only possible cases whee you can have troubles. And DMA VRAM fill as DMA VRAM copy are very rare operations.
Re: Video problems on hw
Posted: Sat Dec 19, 2015 9:54 am
by cero
Yes, but isn't a DMA fill 2x faster than cpu fill? So even when blocking, it's less time spent.
I'm using the default Makefile from gendev. I'll compare with what is in sgdk.
So to recap, the right fix is to wait for DMA completion right after VDP_clearPlan?
Re: Video problems on hw
Posted: Sat Dec 19, 2015 1:35 pm
by Stef
cero wrote:Yes, but isn't a DMA fill 2x faster than cpu fill? So even when blocking, it's less time spent.
Yeah still faster anyway (except during active period where software fill will be as fast then DMA fill) but sometime you really want to have DMA fill while you do others stuff with the CPU (just to optimize CPU free time) so it's just better to offer the choice
I'm using the default Makefile from gendev. I'll compare with what is in sgdk.
So to recap, the right fix is to wait for DMA completion right after VDP_clearPlan?
Yeah, just add that and it will fix the issue, next VDP_clearPlan(..) method will replace last parameter 'use_dma' by 'wait' so it will wait for DMA completion if wanted.
Re: Video problems on hw
Posted: Sat Dec 19, 2015 2:20 pm
by cero
Thanks, I updated the ROM. Can you do a quick test on hw?
https://github.com/clbr/gentest/blob/master/game.bin.xz
Re: Video problems on hw
Posted: Sun Dec 20, 2015 11:39 am
by Stef
I tested and it works perfectly on real hardware now, the sound is a bit distorted though.
Re: Video problems on hw
Posted: Sun Dec 20, 2015 8:12 pm
by cero
Thanks!