[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [399] trunk/fuse
Brought to you by:
fredm
|
From: <fr...@us...> - 2007-06-24 21:52:30
|
Revision: 399
http://svn.sourceforge.net/fuse-for-macosx/?rev=399&view=rev
Author: fredm
Date: 2007-06-24 14:52:32 -0700 (Sun, 24 Jun 2007)
Log Message:
-----------
Use a CoreVideo display link rather than setting needs display from the
emulator thread.
Modified Paths:
--------------
trunk/fuse/TODO
trunk/fuse/fusepb/Fuse.xcodeproj/project.pbxproj
trunk/fuse/fusepb/views/DisplayOpenGLView.h
trunk/fuse/fusepb/views/DisplayOpenGLView.m
trunk/fuse/ui/cocoa/cocoadisplay.m
Modified: trunk/fuse/TODO
===================================================================
--- trunk/fuse/TODO 2007-06-24 01:06:12 UTC (rev 398)
+++ trunk/fuse/TODO 2007-06-24 21:52:32 UTC (rev 399)
@@ -30,12 +30,12 @@
DisplayOpenGLView and flip between them on frame end), should also have a
mutex taken while DisplayOpenGLView changes and cocoadisplay flips to
prevent thread sync problems
-* Add .WAV loader using audiofile
+X Add .WAV loader using audiofile
+X Figure out why minimise icon image is partially blanked when minimise starts
* Quit keyhandling when command key is pressed
* Use sheets rather than modal dialogs (for Save As)
* Put in latest hq[23]x filters (HQ2x_555 from ScummVM should do the trick)
* Make border display optional
-* Figure out why minimise icon image is partially blanked when minimise starts
* Allow Cmd-w to close as many windows as possible
* Make activity icons transparent
* Seperate out sound buffer interleaving code to allow for the use of hardware etc.
Modified: trunk/fuse/fusepb/Fuse.xcodeproj/project.pbxproj
===================================================================
--- trunk/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2007-06-24 01:06:12 UTC (rev 398)
+++ trunk/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2007-06-24 21:52:32 UTC (rev 399)
@@ -241,6 +241,7 @@
B61F46A109121DF100C8096C /* gcrypt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6BA1A8B04E4F3290017354F /* gcrypt.framework */; };
B61F46A209121DF100C8096C /* libbz2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6202BD105BD43D800A1EA8F /* libbz2.framework */; };
B61F46A409121DF100C8096C /* FuseImporter.mdimporter in CopyFiles */ = {isa = PBXBuildFile; fileRef = B64FEA96084F8EC300879389 /* FuseImporter.mdimporter */; };
+ B6251C3E0C2EB24500BD5543 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6251C3D0C2EB24500BD5543 /* QuartzCore.framework */; };
B639B7680A6BAFCF00927E24 /* csw.icns in Resources */ = {isa = PBXBuildFile; fileRef = B639B7670A6BAFCF00927E24 /* csw.icns */; };
B639B7D10A6BB45600927E24 /* raw.icns in Resources */ = {isa = PBXBuildFile; fileRef = B639B7D00A6BB45600927E24 /* raw.icns */; };
B6403FD80A7E4B1A00E00B11 /* loader.c in Sources */ = {isa = PBXBuildFile; fileRef = B6403FD60A7E4B1A00E00B11 /* loader.c */; };
@@ -378,6 +379,7 @@
B6202BD105BD43D800A1EA8F /* libbz2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libbz2.framework; path = ../../bzip2/build/Deployment/libbz2.framework; sourceTree = SOURCE_ROOT; };
B621A11E062E92FB00F63DBC /* if2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = if2.c; path = ../if2.c; sourceTree = SOURCE_ROOT; };
B621A11F062E92FB00F63DBC /* if2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = if2.h; path = ../if2.h; sourceTree = SOURCE_ROOT; };
+ B6251C3D0C2EB24500BD5543 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
B62E1BC303E298B200A80002 /* Debugger.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Debugger.nib; path = nibs/Debugger.nib; sourceTree = SOURCE_ROOT; };
B62F3BB4059F5B5900A7009A /* PokeFinder.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = PokeFinder.nib; path = nibs/PokeFinder.nib; sourceTree = "<group>"; };
B62F3BCE059F5BF300A7009A /* PokeFinderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PokeFinderController.h; path = controllers/PokeFinderController.h; sourceTree = "<group>"; };
@@ -666,6 +668,7 @@
B6A6F0F30B3D602F000B88E9 /* AudioUnit.framework in Frameworks */,
B6A6F1060B3D60D0000B88E9 /* OpenGL.framework in Frameworks */,
B653532B0B902CB20083F942 /* IOKit.framework in Frameworks */,
+ B6251C3E0C2EB24500BD5543 /* QuartzCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -693,17 +696,18 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
+ F541C0750396490901C2A5B9 /* 765.framework */,
B6FA759C0C1D7507007F5A10 /* audiofile.framework */,
B6A6F0F20B3D602F000B88E9 /* AudioUnit.framework */,
B64E2A160A6534A3006863D9 /* Carbon.framework */,
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
B6A6F0ED0B3D5F9E000B88E9 /* CoreAudio.framework */,
+ B6BA1A8B04E4F3290017354F /* gcrypt.framework */,
B653532A0B902CB20083F942 /* IOKit.framework */,
B6202BD105BD43D800A1EA8F /* libbz2.framework */,
- 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
F520C8BC038D022E01A804BA /* OpenGL.framework */,
+ B6251C3D0C2EB24500BD5543 /* QuartzCore.framework */,
F541C04303963A9F01C2A5B9 /* spectrum.framework */,
- F541C0750396490901C2A5B9 /* 765.framework */,
- B6BA1A8B04E4F3290017354F /* gcrypt.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
@@ -1548,8 +1552,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
+ i386,
ppc,
- i386,
);
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
Modified: trunk/fuse/fusepb/views/DisplayOpenGLView.h
===================================================================
--- trunk/fuse/fusepb/views/DisplayOpenGLView.h 2007-06-24 01:06:12 UTC (rev 398)
+++ trunk/fuse/fusepb/views/DisplayOpenGLView.h 2007-06-24 21:52:32 UTC (rev 399)
@@ -23,6 +23,7 @@
*/
#import <Cocoa/Cocoa.h>
+#import <QuartzCore/QuartzCore.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
@@ -74,6 +75,9 @@
Emulator *real_emulator;
Emulator *proxy_emulator;
NSConnection *kitConnection;
+
+ CVDisplayLinkRef displayLink;
+ CGDirectDisplayID mainViewDisplayID;
}
+(DisplayOpenGLView *) instance;
@@ -213,4 +217,7 @@
-(void) windowWillMiniaturize:(NSNotification *)aNotification;
-(void) windowDidMiniaturize:(NSNotification *)notification;
+-(CVReturn) displayFrame:(const CVTimeStamp *)timeStamp;
+-(void) windowChangedScreen:(NSNotification*)inNotification;
+
@end
Modified: trunk/fuse/fusepb/views/DisplayOpenGLView.m
===================================================================
--- trunk/fuse/fusepb/views/DisplayOpenGLView.m 2007-06-24 01:06:12 UTC (rev 398)
+++ trunk/fuse/fusepb/views/DisplayOpenGLView.m 2007-06-24 21:52:32 UTC (rev 399)
@@ -89,6 +89,19 @@
return bitmap;
}
+CVReturn MyDisplayLinkCallback (
+ CVDisplayLinkRef displayLink,
+ const CVTimeStamp *inNow,
+ const CVTimeStamp *inOutputTime,
+ CVOptionFlags flagsIn,
+ CVOptionFlags *flagsOut,
+ void *displayLinkContext)
+{
+ CVReturn error =
+ [(DisplayOpenGLView*) displayLinkContext displayFrame:inOutputTime];
+ return error;
+}
+
@implementation DisplayOpenGLView
static DisplayOpenGLView *instance = nil;
@@ -249,6 +262,29 @@
{
/* keep the window in the standard aspect ratio if the user resizes */
[[self window] setContentAspectRatio:NSMakeSize(4.0,3.0)];
+
+ CVReturn error = kCVReturnSuccess;
+ CGDirectDisplayID displayID = CGMainDisplayID();
+
+ mainViewDisplayID = displayID;
+
+ error = CVDisplayLinkCreateWithCGDisplay( displayID, &displayLink );
+ if( error ) {
+ NSLog( @"DisplayLink created with error:%d", error );
+ displayLink = NULL;
+ return;
+ }
+ error = CVDisplayLinkSetOutputCallback( displayLink,
+ MyDisplayLinkCallback, self );
+ if( error ) {
+ NSLog( @"Callback created with error:%d", error );
+ return;
+ }
+
+ error = CVDisplayLinkStart( displayLink );
+ if( error ) {
+ NSLog( @"error starting displayLink:%d", error );
+ }
}
- (void)windowWillClose:(NSNotification *)notification
@@ -393,8 +429,11 @@
int i;
PIG_dirtytable *workdirty = NULL;
- if( NO == screenTexInitialised ) return;
[buffered_screen_lock lock];
+ if( NO == screenTexInitialised ) {
+ [buffered_screen_lock unlock];
+ return;
+ }
if( screenTex[currentScreenTex].dirty )
pig_dirty_copy( &workdirty, screenTex[currentScreenTex].dirty );
@@ -1113,4 +1152,23 @@
[[self window] setOpaque:YES];
}
+-(CVReturn) displayFrame:(const CVTimeStamp *)timeStamp
+{
+ [self drawRect:NSZeroRect];
+
+ return kCVReturnSuccess;
+}
+
+-(void) windowChangedScreen:(NSNotification*)inNotification
+{
+ NSWindow *window = [self window];
+ CGDirectDisplayID displayID = (CGDirectDisplayID)[[[[window screen]
+ deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
+ if((displayID != NULL) && (mainViewDisplayID != displayID))
+ {
+ CVDisplayLinkSetCurrentCGDisplay(displayLink, displayID);
+ mainViewDisplayID = displayID;
+ }
+}
+
@end
Modified: trunk/fuse/ui/cocoa/cocoadisplay.m
===================================================================
--- trunk/fuse/ui/cocoa/cocoadisplay.m 2007-06-24 01:06:12 UTC (rev 398)
+++ trunk/fuse/ui/cocoa/cocoadisplay.m 2007-06-24 21:52:32 UTC (rev 399)
@@ -437,13 +437,6 @@
pig_dirty_merge( buffered_screen.dirty, screen->dirty );
- /* We usually can't call AppKit stuff from other threads, but we seem to be
- able to call setNeedsDisplay as long as we are not in drawRect: in the
- main thread - prefer this to sending a message to the main thread as we
- can send loads of messages when we are fastloading and can clog up the
- pipes, the buffered_screen_lock should protect us from drawRect: */
- [[DisplayOpenGLView instance] setNeedsDisplay:YES];
-
/* release lock for buffered screen */
[buffered_screen_lock unlock];
@@ -490,10 +483,13 @@
int
uidisplay_end( void )
{
+ [buffered_screen_lock lock];
+
if( screen && screen->pixels ) {
[[DisplayOpenGLView instance] destroyTexture];
}
+ [buffered_screen_lock unlock];
[buffered_screen_lock release];
free_screen( &unscaled_screen );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|