Video problems on hw

SGDK only sub forum

Moderator: Stef

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Video problems on hw

Post 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.
cero
Very interested
Posts: 340
Joined: Mon Nov 30, 2015 1:55 pm

Re: Video problems on hw

Post 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?
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Video problems on hw

Post 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.
cero
Very interested
Posts: 340
Joined: Mon Nov 30, 2015 1:55 pm

Re: Video problems on hw

Post 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
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Video problems on hw

Post by Stef »

I tested and it works perfectly on real hardware now, the sound is a bit distorted though.
cero
Very interested
Posts: 340
Joined: Mon Nov 30, 2015 1:55 pm

Re: Video problems on hw

Post by cero »

Thanks!
Post Reply