VIDEO - Experimental VGA patch (vgaonly commited)

Here you can discuss the development of patches.

Re: Experimental VGA patch

Postby Qbix » 2007-6-26 @ 15:36

*moved*
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10556
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: Experimental VGA patch

Postby augnober » 2007-7-02 @ 14:18

h-a-l-9000:
I like this patch a lot. I've been trying it on some demos, and some of my own apps.. and also integrated it with the vsync patch I was working on. Here's a small bug report.

Update: I think it's not a real bug afterall. In fact, I think your patch fixed dosbox to work more like real hardware. After looking through the write_p3c0() code in vga_attr.cpp, I noticed that my code probably should be outputting 0x33 to 0x3c0 instead of 0x13. After making that change, my apps work fine under your patch. I'd still be curious to see what happens on real hardware though to be sure. The rest below was written before this update.

I noticed that it breaks the rendering of my vsync test apps. I already had them attached on the forums at the following location, as a part of the vsync patch diff (source for vsync.com is distributed too.. and forever.com is 45 bytes and hence readable/debuggable):
download link-
http://www.vogons.org/download.php?id=2439
thread link (first page, second post from bottom)-
http://www.vogons.org/viewtopic.php?t=10752&highlight=vsync

It's because when I just modify the horizontal pel scrolling register and wait for retrace, VGA_DrawSingleLine() draws black rows instead of the row contents. I noticed this comment - "TODO else draw overscan color line black line should be good enough for now (DoWhackaDo)". If I remove the DoWhackaDo case from the code (and instead always use the 'vga.attr.enabled' case), then the apps work perfectly.

It would be best to test the apps on a real system too of course. I've only ever run them in Dosbox. So until it is tried on a real machine, I have to accept the possibility that your changes may have actually caused it to work correctly for the first time ;)
augnober
Member
 
Posts: 115
Joined: 2004-10-03 @ 02:23

Re: Experimental VGA patch

Postby h-a-l-9000 » 2007-7-02 @ 15:07

I just tested it in real hardware before reading your update - vsync.com doesn't work there.
My suggested fix is to write 0x20 to 3c0 after you are done updating the PEL. Writing 0x33 is illegal I think.
1+1=10
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Experimental VGA patch

Postby `Moe` » 2007-8-29 @ 01:00

The patch doesn't work well anymore. With latest CVS, I get random crashes (weird ones, looking like buffer overflows) or misbehaviour (patch simply stopping to work). Has something important changed?

Since the crashes are not happening at the place they are caused, I had no luck tracking them down with gdb.
User avatar
`Moe`
Oldbie
 
Posts: 1169
Joined: 2004-4-29 @ 01:06
Location: Oldenburg, Germany

Re: Experimental VGA patch

Postby wd » 2007-8-29 @ 09:34

Writing 0x33 is illegal I think.

I've seen this done in some ega bios though, not sure what it's
supposed to do but it looks like the value should be changed
accordingly and the protection set after that (like 0x20 does).
Doesn't make too much sense to me though.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Experimental VGA patch

Postby h-a-l-9000 » 2007-8-29 @ 14:47

Illegal might have been the wrong word - just having the 0x20 bit set disables screen output. So if we want to see something we should always clear it after writing the other registers. The DoWhackaDo demo uses it to hide a part of the screen that would otherwise look corrupted.

I'm attaching the re-merged patch which works for me. Might be some patching problem?
You do not have the required permissions to view the files attached to this post.
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Experimental VGA patch

Postby `Moe` » 2007-8-29 @ 18:58

Tried it, behaves a bit better, but still not good enough:

Tried latest CVS, core normal or dynamic, cycles max or 2000, X-Mas Lemmings. Mission briefing shows up correct (top half: winter palette, bottom half: brownish one), but it still reliably crashes at some mode switch. No crash with the same executable and machine=vga.

Note that this is a 64-bit build on a high-end dual core machine.
User avatar
`Moe`
Oldbie
 
Posts: 1169
Joined: 2004-4-29 @ 01:06
Location: Oldenburg, Germany

Re: Experimental VGA patch

Postby h-a-l-9000 » 2007-8-30 @ 06:44

crashes at some mode switch.


Good hint - maybe adding PIC_RemoveEvents(VGA_DrawSingleLine); in vga_draw.cpp line 1119 helps?

Code: Select all
if (( width != vga.draw.width) || (height != vga.draw.height) ||
      (aspect_ratio != vga.draw.aspect_ratio) ||
      (vga.mode != vga.lastmode)) {
      vga.lastmode = vga.mode;
      PIC_RemoveEvents(VGA_VerticalTimer);
      PIC_RemoveEvents(VGA_VerticalDisplayEnd);
      PIC_RemoveEvents(VGA_DrawPart);
      PIC_RemoveEvents(VGA_DrawSingleLine);
      vga.draw.width = width;
      vga.draw.height = height;
      vga.draw.doublewidth = doublewidth;
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Experimental VGA patch

Postby `Moe` » 2007-8-31 @ 07:28

Already tried that (there and at a few other locations), didn't help.
User avatar
`Moe`
Oldbie
 
Posts: 1169
Joined: 2004-4-29 @ 01:06
Location: Oldenburg, Germany

Re: Experimental VGA patch

Postby h-a-l-9000 » 2007-8-31 @ 17:42

In VGA_KillDrawing too?

If you really like that patch maybe try to comment out the "if(!vga.demomode) {" in render.cpp. It will break the output but maybe it doesn't crash anymore. I didn't really know what I did there ;)

Or change the
Code: Select all
typedef struct {
   struct {
      Bit8u red;
      Bit8u green;
      Bit8u blue;
      Bit8u unused;
   } rgb[256];
   union {
      Bit16u b16[256];
      Bit32u b32[256];
   } lut;
   bool changed;
   Bit8u modified[256];
   Bitu first;
   Bitu last;
} RenderPal_t;

the 256 to higher values.
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Experimental VGA patch

Postby `Moe` » 2007-9-03 @ 21:05

Got it!

In vga_draw.c, at the end of VGA_DrawSingleLine, I added a check for vga.draw.resizing, and while it is not a proper fix, it demonstrates the problem:

Code: Select all
    if (!vga.draw.resizing && vga.draw.lines_done < vga.draw.lines_total) {
        if(readd) PIC_AddEvent(VGA_DrawSingleLine,vga.draw.delay.virtline);

    } else {
        RENDER_EndUpdate();
    }


I don't have a complete overview of the vga hardware emulation, but it seems to be a race condition. Dual-core is the key: SDL event handlers run in a different thread on Linux (I checked that with gdb), so a race condition with the main emulation loop is possible, and dual-cores exhibit those more readily.

The reason why this isn't enough is that at certain cycles values, it still crashes, at other values there is heavy flickering in lemmings, where there is a palette change mid-screen, and sometimes that palette switch gets "stuck", i.e., doesn't happen anymore. Quite typical for a race condition, although I don't understand the code well enough yet.
User avatar
`Moe`
Oldbie
 
Posts: 1169
Joined: 2004-4-29 @ 01:06
Location: Oldenburg, Germany

Re: Experimental VGA patch

Postby Miki Maus » 2007-9-10 @ 23:31

Just a note.
With latest DOSBox 0.72 CVS build from ykhwong and machine set to demovga, Pinball Fantasies show correct colors in table select menus. :cool:
User avatar
Miki Maus
Member
 
Posts: 197
Joined: 2004-10-18 @ 22:19
Location: Cave

Re: Experimental VGA patch

Postby Great Hierophant » 2007-10-03 @ 00:29

Miki Maus wrote:Just a note.
With latest DOSBox 0.72 CVS build from ykhwong and machine set to demovga, Pinball Fantasies show correct colors in table select menus. :cool:


The demovga option does not seem to want to work in fullscreen with direct3d. It would be perfect if these two options could be made compatible.
User avatar
Great Hierophant
l33t
 
Posts: 2363
Joined: 2003-4-27 @ 08:20

Re: Experimental VGA patch

Postby h-a-l-9000 » 2007-11-28 @ 18:23

Update:

- new approach that should have less issues
(translate to 16bpp instead of changing the renderer palette)
- updated to apply to CVS

To activate:
machine=vgaonly

ibmtiming is replaced by:

[cpu]
screenflip=value

(useful values are 0-1500 or thereabouts, 0 is default, it's the microseconds delay of latching the new screen address, change it if you have a game with flicker issues).
You do not have the required permissions to view the files attached to this post.
Last edited by h-a-l-9000 on 2007-12-22 @ 14:41, edited 1 time in total.
1+1=10
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Experimental VGA patch

Postby wd » 2007-11-28 @ 23:12

Nice, thanks!
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Experimental VGA patch

Postby h-a-l-9000 » 2007-12-11 @ 16:21

Little hack for DoWhackaDo in scanline emulation mode.
You do not have the required permissions to view the files attached to this post.
1+1=10
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Experimental VGA patch

Postby h-a-l-9000 » 2007-12-12 @ 16:37

Fix for the Wish demo (they use both A0000 and B0000 for video memory access)
You do not have the required permissions to view the files attached to this post.
Last edited by h-a-l-9000 on 2008-2-03 @ 19:26, edited 1 time in total.
1+1=10
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: Experimental VGA patch

Postby zaphod77 » 2007-12-19 @ 16:19

MasterBlazer (ballblazer for PCs) does multiple palette shifts during gameplay. it's a good test case.
zaphod77
Newbie
 
Posts: 12
Joined: 2006-5-30 @ 07:01

Re: Experimental VGA patch

Postby jal » 2007-12-21 @ 11:03

zaphod77 wrote:MasterBlazer (ballblazer for PCs) does multiple palette shifts during gameplay. it's a good test case.


So did you test it? Or just recommend someone else does?


JAL
User avatar
jal
Member
 
Posts: 495
Joined: 2004-1-02 @ 15:30
Location: Amersfoort, Netherlands

Re: Experimental VGA patch

Postby Srecko » 2007-12-22 @ 02:46

"Copper" relies on a fancy dac or crtc programming, some effects don't work with vgaonly (after copper bars, there should be stretching of a helicopter screen but it remains static, also "zooming" effect is problematic)
http://www.pouet.net/prod.php?which=2048

Also I couldn't get proper colors in Pinball fantasies yet (I tested using only latest version) :(

Great patch btw.

edit: The "Plasma" intro
(ftp://ftp.scene.org/mirrors/hornet/demo ... plasma.zip)
draws only one line if machine is set to "vgaonly". Draws full screen with "vga". although with graphical issues.
Last edited by Srecko on 2007-12-22 @ 15:36, edited 1 time in total.
Srecko
Member
 
Posts: 466
Joined: 2003-9-08 @ 15:03

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 1 guest