Author Topic: MacVICE  (Read 100832 times)

Offline GANDALf

  • A600
  • *
  • Posts: 13
  • Karma: 0
Re: MacVICE
« Reply #120 on: October 08, 2009, 04:43:26 AM »
Just compiled SVN21577 and can confirm that it works OK. Thanks.

Offline GANDALf

  • A600
  • *
  • Posts: 13
  • Karma: 0
Re: MacVICE
« Reply #121 on: October 16, 2009, 07:08:58 PM »
Trouble again with SVN21599 . Console and control window appears but not the main window (although it's visible in dock icon  ??? ) and immediate spinning wheel... PPC/Cocoa.

Offline lallafa

  • A600
  • *
  • Posts: 83
  • Karma: 1
  • MacVICE & DI64 Dev
    • lallafa's Blog
Re: MacVICE
« Reply #122 on: October 16, 2009, 11:02:10 PM »
You are right... I just tested on my old PB G4 and it shows the same lock up...
I'll have a look at it.

BTW... does the new -syncdraw work for you?
This new drawing mode is somewhat experimental and tries to improve the emulator output if the screen refresh rate does not match the emulation video refresh rate. E.g. on a PAL C64 screens are generated with up to 50 Hz while my LCD shows 60 Hz.

With multi buffers the emulator draws the screens into a set of buffers with 50 Hz and the display fetches them with 60 Hz synced with the VBL of the display... The buffers are time stamped and if the display fetch does not find a frame with exact time match then it interpolated (i.e. blends) the two surrounding emulator frames with weights depending on the time distance to the frames...

Syncing display time and emulator draw time is the trick here... and I did some first tests with it (see check in), but they definitely need improvement...

I think thats a rather cool way to cope with emulation rate != display refresh rate temporal aliasing and does not force me to look out for a 50 Hz native display ;)

Offline lallafa

  • A600
  • *
  • Posts: 83
  • Karma: 1
  • MacVICE & DI64 Dev
    • lallafa's Blog
Re: MacVICE
« Reply #123 on: October 16, 2009, 11:45:26 PM »
@GANDALf: I just checked in [21603]... this should fix the ppc problem.

Offline GANDALf

  • A600
  • *
  • Posts: 13
  • Karma: 0
Re: MacVICE
« Reply #124 on: October 17, 2009, 06:35:19 AM »
Just checking out new version and will report.

is -syncdraw compile or run option? I had hard time to discover all build-vice-dist.sh options and their order (noob ::) )
found it in inspector. It works very well! No overhead and no stray redraw lines. Doesn't help 'lace flicker tho.
« Last Edit: October 17, 2009, 10:40:24 AM by GANDALf »

Offline MagerValp

  • A600
  • *
  • Posts: 85
  • Karma: 0
Re: MacVICE
« Reply #125 on: October 18, 2009, 01:28:50 AM »
This sounds really interesting, so I compiled a new build (with clang, yay :). Lace flicker is still there, as Gandalf points out. I was curious about the buffer setting, so I cranked it up to 50, which gave me this:

Code: [Select]
Process:         x64 [31144]
Path:            /Users/pelle/src/vice/build/cocoa-10.6-clang/x86_64/vice-macosx-cocoa-x86_64-10.6-clang-2.1.17/x64.app/Contents/MacOS/x64
Identifier:      org.viceteam.x64
Version:         ??? (2.1.17)
Code Type:       X86-64 (Native)
Parent Process:  launchd [155]

Date/Time:       2009-10-18 17:58:28.336 +0200
OS Version:      Mac OS X 10.6.1 (10B504)
Report Version:  6

Interval Since Last Report:          17926 sec
Crashes Since Last Report:           1
Per-App Interval Since Last Report:  98 sec
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      5610CC0F-0D30-4256-9E8A-20B877605F9A

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
*** error for object 0x4088000000000000: pointer being reallocated was not allocated


Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib              0x00007fff86ba1ff6 __kill + 10
1   libSystem.B.dylib              0x00007fff86c43072 abort + 83
2   libSystem.B.dylib              0x00007fff86c31d25 szone_error + 519
3   libSystem.B.dylib              0x00007fff86b5bb1e szone_realloc + 102
4   libSystem.B.dylib              0x00007fff86b5ba7b malloc_zone_realloc + 92
5   libSystem.B.dylib              0x00007fff86b67b13 realloc + 169
6   org.viceteam.x64              0x000000010000f7c9 0x100000000 + 63433
7   org.viceteam.x64              0x00000001000ec9b5 0x100000000 + 969141
8   org.viceteam.x64              0x00000001000ea991 0x100000000 + 960913
9   org.viceteam.x64              0x00000001000d7b71 0x100000000 + 883569
10  com.apple.CoreFoundation      0x00007fff8166d35c __invoking___ + 140
11  com.apple.CoreFoundation      0x00007fff8166d22d -[NSInvocation invoke] + 141
12  com.apple.CoreFoundation      0x00007fff81688f21 -[NSInvocation invokeWithTarget:] + 49
13  com.apple.CoreFoundation      0x00007fff8166a37c ___forwarding___ + 860
14  com.apple.CoreFoundation      0x00007fff81666458 _CF_forwarding_prep_0 + 232
15  com.apple.CoreFoundation      0x00007fff8166d35c __invoking___ + 140
16  com.apple.CoreFoundation      0x00007fff8166d22d -[NSInvocation invoke] + 141
17  com.apple.Foundation          0x00007fff82d70498 -[NSConnection dispatchInvocation:] + 181
18  com.apple.Foundation          0x00007fff82d6e725 -[NSConnection handleRequest:sequence:] + 1138
19  com.apple.Foundation          0x00007fff82d6e020 -[NSConnection handlePortCoder:] + 765
20  com.apple.Foundation          0x00007fff82d6dcdb -[NSConcretePortCoder dispatch] + 49
21  com.apple.Foundation          0x00007fff82d371a2 __NSFireMachPort + 270
22  com.apple.CoreFoundation      0x00007fff8165c1fe __CFMachPortPerform + 366
23  com.apple.CoreFoundation      0x00007fff8165bf84 __CFRunLoopDoSource1 + 356
24  com.apple.CoreFoundation      0x00007fff8163464d __CFRunLoopRun + 4413
25  com.apple.CoreFoundation      0x00007fff8163303f CFRunLoopRunSpecific + 575
26  com.apple.Foundation          0x00007fff82d53958 -[NSConnection sendInvocation:internal:] + 1969
27  com.apple.CoreFoundation      0x00007fff8166a37c ___forwarding___ + 860
28  com.apple.CoreFoundation      0x00007fff81666458 _CF_forwarding_prep_0 + 232
29  org.viceteam.x64              0x00000001000c96d4 0x100000000 + 825044
30  org.viceteam.x64              0x00000001000cbf9c 0x100000000 + 835484
31  org.viceteam.x64              0x00000001000cc702 0x100000000 + 837378
32  org.viceteam.x64              0x00000001000ca882 0x100000000 + 829570
33  com.apple.AppKit              0x00007fff84c98c31 -[NSOutlineView _dataSourceSetValue:forColumn:row:] + 97
34  com.apple.AppKit              0x00007fff84d55bb2 -[NSTableView textDidEndEditing:] + 541
35  com.apple.Foundation          0x00007fff82cf9926 _nsnote_callback + 167
36  com.apple.CoreFoundation      0x00007fff8163fe4a __CFXNotificationPost + 954
37  com.apple.CoreFoundation      0x00007fff8162c7f8 _CFXNotificationPostNotification + 200
38  com.apple.Foundation          0x00007fff82cf0890 -[NSNotificationCenter postNotificationName:object:userInfo:] + 101
39  com.apple.AppKit              0x00007fff849e6541 -[NSTextView(NSPrivate) _giveUpFirstResponder:] + 571
40  com.apple.AppKit              0x00007fff84a2b9a8 -[NSTextView(NSKeyBindingCommands) insertNewline:] + 485
41  com.apple.AppKit              0x00007fff849e5e09 -[NSTextView doCommandBySelector:] + 293
42  com.apple.AppKit              0x00007fff849da78b -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] + 1966
43  com.apple.AppKit              0x00007fff849d9c9c -[NSTextInputContext handleEvent:] + 737
44  com.apple.AppKit              0x00007fff849d994e -[NSView interpretKeyEvents:] + 186
45  com.apple.AppKit              0x00007fff849d9727 -[NSTextView keyDown:] + 819
46  com.apple.AppKit              0x00007fff8494b6a9 -[NSWindow sendEvent:] + 8803
47  com.apple.AppKit              0x00007fff84880122 -[NSApplication sendEvent:] + 4717
48  com.apple.AppKit              0x00007fff84816acc -[NSApplication run] + 474
49  org.viceteam.x64              0x00000001000d54a1 0x100000000 + 873633
50  org.viceteam.x64              0x00000001000d368e 0x100000000 + 865934
51  org.viceteam.x64              0x00000001000016d4 0x100000000 + 5844

Scrollers appear more stable though, really nice!

Offline lallafa

  • A600
  • *
  • Posts: 83
  • Karma: 1
  • MacVICE & DI64 Dev
    • lallafa's Blog
Re: MacVICE
« Reply #126 on: October 18, 2009, 03:18:09 AM »
It looks like you are running out of memory with 50 buffers + 50 textures (each the size of a canvas) :)

Sensible values are 3-5 (and 1 as it disables mulit buffering but keeps syncdraw).
Usually you need at max 2 frames to interpolate between, and one or more frames that get drawn by the emulator.

Yes, the approach does not flicker fix a interlaced image.
Currently, I resample only the 50 Hz machine frame rate with my 60 Hz display rate.

But this approach is extensible: by adding a time window I can blend together all frames that fit in this window... if the window is 2 machine frames then it will blend together interlaced (half-)pictures... something to study for the next weekend ;)


Offline GANDALf

  • A600
  • *
  • Posts: 13
  • Karma: 0
Re: MacVICE
« Reply #127 on: October 18, 2009, 07:44:55 AM »
Great stuff. Hope to see more results after the weekend. :)

Offline MagerValp

  • A600
  • *
  • Posts: 85
  • Karma: 0
Re: MacVICE
« Reply #128 on: October 19, 2009, 12:23:30 AM »
Would it be possible to make the number of interpolation buffers match the sound buffer, to sync up audio and video?

Offline lallafa

  • A600
  • *
  • Posts: 83
  • Karma: 1
  • MacVICE & DI64 Dev
    • lallafa's Blog
Re: MacVICE
« Reply #129 on: October 25, 2009, 01:27:55 AM »
@MagerValp: sound and video buffers are currently unrelated. The sync loop in the emulator is driven and controlled by the sound sync. The video "sync" is only done in the rendering thread. There timestamped frames arrive from the emulator core and are blended accordingly for the current display frame.

[21641] adds a flicker fixer to the blend mode and cleans up parameters.
The number of buffers is now chosen automatically (0=auto).
Sync mode can now be toggled between: off, nearest and blend.
Nearest picks the nearest machine frame for display and does no blending.
Blend does blend two nearby machine frames for the display.
If flicker fix is enabled then up to four frames are blended together:
2 half frames each to get a full frame and two full frames to get the temporal inbetween for display....


Offline MagerValp

  • A600
  • *
  • Posts: 85
  • Karma: 0
Re: MacVICE
« Reply #130 on: October 25, 2009, 05:16:00 AM »
@MagerValp: sound and video buffers are currently unrelated. The sync loop in the emulator is driven and controlled by the sound sync. The video "sync" is only done in the rendering thread. There timestamped frames arrive from the emulator core and are blended accordingly for the current display frame.

Yes, that is precisely why it'd be a major feature if they were to become related :) On WinVICE with default settings audio is delayed by 300 ms thanks to the sound buffer, which really hurts some demos. It's much better on MacVICE, but it'd be nice if audio and video delay was identical. Or are you saying that thanks to the time stamped frames audio and video is now synced?

Quote
[21641] adds a flicker fixer to the blend mode and cleans up parameters.

Very interesting. Flicker is completely eliminated, rock solid image. I like having blending on, but flicker fixing off though, so you can at least see a hint of interlace flicker.

Is there any chance that the blended image could stay when pausing? That would make it easier to take blended screenshots.

Offline MagerValp

  • A600
  • *
  • Posts: 85
  • Karma: 0
Re: MacVICE
« Reply #131 on: October 25, 2009, 05:40:11 AM »
Hmm, with svn 21642 I've had two random crashes. No error dialog, window just closes, and console says:

Code: [Select]
2009-10-25 22.17.02 [0x0-0x2ca2ca].org.viceteam.x64[64651] Reading configuration file `/Users/pelle/Library/Preferences/org.viceteam.x64/vicerc'.
2009-10-25 22.17.02 com.apple.launchd.peruser.501[155] ([0x0-0x2ca2ca].org.viceteam.x64[64651]) Exited with exit code: 255
2009-10-25 22.17.02 kernel The graphics driver has detected a corruption in its command stream.

Offline GANDALf

  • A600
  • *
  • Posts: 13
  • Karma: 0
Re: MacVICE
« Reply #132 on: October 26, 2009, 01:32:24 AM »
After opening Inspector, Open, attach... commands no longer work. Sometimes they work until closing Log window... something strange happening there.

Toggling  FlickerFixer does nothing, pictures flicker as ussual.

Offline lallafa

  • A600
  • *
  • Posts: 83
  • Karma: 1
  • MacVICE & DI64 Dev
    • lallafa's Blog
Re: MacVICE
« Reply #133 on: October 26, 2009, 03:43:02 AM »
@MagerValp: does [21645] fix your random crashes... I improved the locking of the GL contexts.

Showing a full frame in Pause mode should be possible. I'll test it next weekend.

@GANDALf: sounds really strange... Do you have the supplied CBM font installed for new disk image preview?

What is shown in the log for "MacVideo"? Does the Pixel Buffer creation work or fail?
If it fails then no Flicker Fixer will work on your graphics HW....

Offline lallafa

  • A600
  • *
  • Posts: 83
  • Karma: 1
  • MacVICE & DI64 Dev
    • lallafa's Blog
Re: MacVICE
« Reply #134 on: October 26, 2009, 04:50:56 AM »
@GANDALf: [21647] should fix your problem...

BTW: make sure to enable "Blend" sync draw mode before enabling flicker fixer.