Compare commits

..

No commits in common. "master" and "0.1.0" have entirely different histories.

4 changed files with 9 additions and 40 deletions

View File

@ -15,10 +15,9 @@
IOSurfaceRef _staticBuffer; IOSurfaceRef _staticBuffer;
size_t _width; size_t _width;
size_t _height; size_t _height;
BOOL _useCADisplayLink;
} }
-(instancetype)initWithSurfaceInfo:(IOSurfaceRef)screenSurface rfbScreenInfo:(rfbScreenInfoPtr)rfbScreenInfo accelerator:(IOSurfaceAcceleratorRef)accelerator staticBuffer:(IOSurfaceRef)staticBuffer width:(size_t)width height:(size_t)height useCADisplayLink:(BOOL)useCADisplayLink { -(instancetype)initWithSurfaceInfo:(IOSurfaceRef)screenSurface rfbScreenInfo:(rfbScreenInfoPtr)rfbScreenInfo accelerator:(IOSurfaceAcceleratorRef)accelerator staticBuffer:(IOSurfaceRef)staticBuffer width:(size_t)width height:(size_t)height {
if ((self = [super init])) { if ((self = [super init])) {
_q = [[NSOperationQueue alloc] init]; _q = [[NSOperationQueue alloc] init];
_updatingFrames = NO; _updatingFrames = NO;
@ -31,7 +30,6 @@
_staticBuffer = staticBuffer; _staticBuffer = staticBuffer;
_width = width; _width = width;
_height = height; _height = height;
_useCADisplayLink = useCADisplayLink;
} }
return self; return self;
} }
@ -60,25 +58,18 @@
dispatch_async(dispatch_get_main_queue(), ^(void){ dispatch_async(dispatch_get_main_queue(), ^(void){
[_updateFrameTimer invalidate]; [_updateFrameTimer invalidate];
_updateFrameTimer = nil;
_updatingFrames = NO; _updatingFrames = NO;
}); });
} }
-(void)startFrameLoop { -(void)startFrameLoop {
// if (size_image == 0) VNCSetup();
[self stopFrameLoop]; [self stopFrameLoop];
_updatingFrames = YES; _updatingFrames = YES;
dispatch_async(dispatch_get_main_queue(), ^(void){
if (_useCADisplayLink) { // TODO: can we make VSync happen here?
CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_updateFrame)]; _updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/500 target:self selector:@selector(_updateFrame) userInfo:nil repeats:YES];
displayLink.preferredFramesPerSecond = 60; // Adjust as needed });
[displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
_updateFrameTimer = (NSTimer *)displayLink;
} else {
dispatch_async(dispatch_get_main_queue(), ^(void){
_updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_updateFrame) userInfo:nil repeats:YES];
});
}
} }
-(void)dealloc { -(void)dealloc {

View File

@ -114,7 +114,7 @@
_staticBuffer = IOSurfaceCreate((CFDictionaryRef) [NSDictionary dictionaryWithObjectsAndKeys: _staticBuffer = IOSurfaceCreate((CFDictionaryRef) [NSDictionary dictionaryWithObjectsAndKeys:
@"PurpleEDRAM", kIOSurfaceMemoryRegion, @"PurpleEDRAM", kIOSurfaceMemoryRegion,
// [NSNumber numberWithBool:YES], kIOSurfaceIsGlobal, [NSNumber numberWithBool:YES], kIOSurfaceIsGlobal,
[NSNumber numberWithInt:bytesPerPixel*_width], kIOSurfaceBytesPerRow, [NSNumber numberWithInt:bytesPerPixel*_width], kIOSurfaceBytesPerRow,
[NSNumber numberWithInt:bytesPerPixel], kIOSurfaceBytesPerElement, [NSNumber numberWithInt:bytesPerPixel], kIOSurfaceBytesPerElement,
[NSNumber numberWithInt:_width], kIOSurfaceWidth, [NSNumber numberWithInt:_width], kIOSurfaceWidth,
@ -142,9 +142,7 @@
free(arg0); free(arg0);
NSDictionary* defaults = getPrefsForAppId(@"ru.mostmodest.screendump"); _frameUpdater = [[FrameUpdater alloc] initWithSurfaceInfo:_screenSurface rfbScreenInfo:_rfbScreenInfo accelerator:_accelerator staticBuffer:_staticBuffer width:_width height:_height];
bool useCADisplayLink = [[defaults objectForKey:@"displaysync"]?:@NO boolValue];
_frameUpdater = [[FrameUpdater alloc] initWithSurfaceInfo:_screenSurface rfbScreenInfo:_rfbScreenInfo accelerator:_accelerator staticBuffer:_staticBuffer width:_width height:_height useCADisplayLink:useCADisplayLink];
} }
-(rfbBool)handleVNCAuthorization:(rfbClientPtr)client data:(const char *)data size:(int)size { -(rfbBool)handleVNCAuthorization:(rfbClientPtr)client data:(const char *)data size:(int)size {

View File

@ -8,4 +8,4 @@ Section: Tweaks
Conflicts: ru.mostmodest.screendump.lowframe Conflicts: ru.mostmodest.screendump.lowframe
Depends: mobilesubstrate, preferenceloader Depends: mobilesubstrate, preferenceloader
Icon: file:///Library/PreferenceLoader/Preferences/screendump/ScreenDump@2x.png Icon: file:///Library/PreferenceLoader/Preferences/screendump/ScreenDump@2x.png
Version: 0.1.1 Version: 0.1.0

View File

@ -81,26 +81,6 @@
<key>isNumeric</key> <key>isNumeric</key>
<true/> <true/>
</dict> </dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Tuning</string>
</dict>
<dict>
<key>PostNotification</key>
<string>ru.mostmodest.screendump/restart</string>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>ru.mostmodest.screendump</string>
<key>key</key>
<string>displaysync</string>
<key>label</key>
<string>Update screen using CADisplayLink</string>
</dict>
</array> </array>
</dict> </dict>
</plist> </plist>