14 September 2019, 00:10 | #1 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,170
|
flickering when writing to video memory during VBL
Hi,
For my Oric remakes project (C + assembly, and NO SDL DAMNIT!), I'm using VBL interrupt to refresh my screen. It's working properly, fast and all (thanks to an optimized asm routine) but there's some flickering. I'm directly poking into screen rastport planes. How can I fix it ? is double buffering the only way? |
14 September 2019, 07:59 | #2 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
Or, do all the updates early enough that they don’t interfere with the display. |
|
14 September 2019, 09:30 | #3 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
There are three ways to do that :
1. Frame flipping (aka double buffer). 2. Using a back-buffer (blit somewhere in fastmem, then copy back very fast). 3. Be fast enough so the beam doesn't catch up with your update. |
14 September 2019, 12:10 | #4 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,170
|
thanks for this information. Frame flipping looks cool. I'm using an intuition screen so I guess that I'll have to forget it...
I'm not targetting stock A500 or A1200 ATM. With a fast enough CPU the flickering isn't visible, yes. But it's WinUAE. With "A500/A1200 speed", the screen flashes like crazy (but at least refresh is fast enough) My screen refresh first clears the screen, then performs "OR" with pre-computed patterns to fill it up (Oric display has 6 bits per pixel so I need to use OR). If I don't clear the screen, I have to AND with pre-computed tables too. Well, maybe 1 read to register + 1 OR and 1 AND is better than clearing first then just using OR. |
14 September 2019, 12:53 | #5 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Quote:
The best solution would be to completely rewrite the graphic routines so that original screen format is no longer used. Alternatively, you may want to prepare 48 pixels in registers, then write them at once to avoid reading chipmem. But it may need just too much space. However as you don't target vanilla machines, i guess there is some fastmem available ? If so, you may end up faster by preparing the screen in fastmem, then copying it to chip. |
||
14 September 2019, 16:05 | #6 |
Registered User
Join Date: Sep 2017
Location: Kansas, USA
Posts: 324
|
Doesn't seem so bad: http://amigadev.elowar.com/read/ADCD.../node0346.html
|
15 September 2019, 09:13 | #7 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Apparently the current method is to clear the whole screen, then render it, right ?
Another idea could be to clear one line, then do it, clear next line, do it, etc. If the overall process is faster than the beam, there would be no glitches anymore. Else, glitches should still be a lot smaller than whole screen flickering. |
27 September 2019, 12:58 | #8 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
If there's a way to set the top line of display higher than 0 using the OS, then you could double-buffer by creating a bitmap twice as high as the screen, and toggle "startY" between 0 and 256, drawing into the high part while showing the low.
Note that if rendering a frame can take more than 1 vblank, you should render outside the vblank and increase some frame counter, and in the vblank only swap if the counter has increased. Interrupts should in general just interrupt the OS briefly, not run mainline code. Interrupting for too long (let's say for more than 5ms or 25%, which is a lot) may prevent necessary tasks from running, which sort of ruins the idea of multitasking. Last edited by Photon; 30 September 2019 at 13:44. |
27 September 2019, 18:34 | #9 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
Unless i mis-interpreted this. |
|
27 September 2019, 20:17 | #10 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
27 September 2019, 21:17 | #11 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,170
|
Meynaf I know you know the Oric. I'm using pre-computed shifted tables already. At least it avoids shifting, but there are still 3 planes to alter.
I'm doing some ORing so if I do that in fastmem, it will be faster/as fast to perform the ORs there, then in the end copy the data to chipmem Instead of clearing a whole line, I'm writing a LONG instead of a WORD, with LSW set to 0. So one write to set data and clear the next cells, ready for more ORing. I'm trying to implement a "draw only changes" option currently. I'm targetting 68020 with fastmem. Ideally I'd like that to run on A1200/020 nofast, maybe it'll work with "draw only changes". And will also depend on the game. |
27 September 2019, 22:40 | #12 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
|
|
28 September 2019, 09:28 | #13 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
28 September 2019, 09:49 | #14 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
But we are splitting hairs here and its fine, you just meant copy the data. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Memory watch point on blitter writing to memory? | mcgeezer | support.WinUAE | 12 | 26 June 2019 22:12 |
$120+S&H for video toaster, time-base-corrector TBC, memory and modem | OceanPark2 | MarketPlace | 0 | 12 July 2007 21:36 |
A4000 memory and video output | polbit | support.Hardware | 11 | 19 February 2007 15:00 |
Chip memory, VGA output, IPF writing | Hideki | support.Hardware | 10 | 09 January 2007 15:18 |
Linking VBL interrups under the system | Photon | Coders. General | 1 | 09 March 2006 16:51 |
|
|