optional garbage tuning
This commit is contained in:
parent
ae72f62025
commit
456470fb7d
|
@ -15,9 +15,10 @@
|
||||||
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 {
|
-(instancetype)initWithSurfaceInfo:(IOSurfaceRef)screenSurface rfbScreenInfo:(rfbScreenInfoPtr)rfbScreenInfo accelerator:(IOSurfaceAcceleratorRef)accelerator staticBuffer:(IOSurfaceRef)staticBuffer width:(size_t)width height:(size_t)height useCADisplayLink:(BOOL)useCADisplayLink {
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
_q = [[NSOperationQueue alloc] init];
|
_q = [[NSOperationQueue alloc] init];
|
||||||
_updatingFrames = NO;
|
_updatingFrames = NO;
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
_staticBuffer = staticBuffer;
|
_staticBuffer = staticBuffer;
|
||||||
_width = width;
|
_width = width;
|
||||||
_height = height;
|
_height = height;
|
||||||
|
_useCADisplayLink = useCADisplayLink;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -58,17 +60,25 @@
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
if (_useCADisplayLink) {
|
||||||
|
CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_updateFrame)];
|
||||||
|
displayLink.preferredFramesPerSecond = 60; // Adjust as needed
|
||||||
|
[displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
|
||||||
|
_updateFrameTimer = (NSTimer *)displayLink;
|
||||||
|
} else {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^(void){
|
dispatch_async(dispatch_get_main_queue(), ^(void){
|
||||||
_updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_updateFrame) userInfo:nil repeats:YES];
|
_updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_updateFrame) userInfo:nil repeats:YES];
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc {
|
-(void)dealloc {
|
||||||
|
|
|
@ -142,7 +142,9 @@
|
||||||
|
|
||||||
free(arg0);
|
free(arg0);
|
||||||
|
|
||||||
_frameUpdater = [[FrameUpdater alloc] initWithSurfaceInfo:_screenSurface rfbScreenInfo:_rfbScreenInfo accelerator:_accelerator staticBuffer:_staticBuffer width:_width height:_height];
|
NSDictionary* defaults = getPrefsForAppId(@"ru.mostmodest.screendump");
|
||||||
|
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 {
|
||||||
|
|
|
@ -81,6 +81,26 @@
|
||||||
<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>
|
||||||
|
|
Loading…
Reference in New Issue