Compare commits

...

5 Commits

Author SHA1 Message Date
Levent Duivel 456470fb7d optional garbage tuning 2024-11-11 03:22:39 +05:00
Levent Duivel ae72f62025 Bump version to 0.1.1 2024-11-10 03:43:46 +05:00
Levent Duivel 22f3e44ad9 Revert "cursor ai garbage tuning"
This reverts commit b88f0b7151.
2024-11-10 03:39:37 +05:00
Levent Duivel b88f0b7151 cursor ai garbage tuning 2024-11-08 02:15:45 +05:00
Levent Duivel 07296e74cb small fix 2024-11-08 01:30:55 +05:00
4 changed files with 40 additions and 9 deletions

View File

@ -15,9 +15,10 @@
IOSurfaceRef _staticBuffer;
size_t _width;
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])) {
_q = [[NSOperationQueue alloc] init];
_updatingFrames = NO;
@ -30,6 +31,7 @@
_staticBuffer = staticBuffer;
_width = width;
_height = height;
_useCADisplayLink = useCADisplayLink;
}
return self;
}
@ -58,18 +60,25 @@
dispatch_async(dispatch_get_main_queue(), ^(void){
[_updateFrameTimer invalidate];
_updateFrameTimer = nil;
_updatingFrames = NO;
});
}
-(void)startFrameLoop {
// if (size_image == 0) VNCSetup();
[self stopFrameLoop];
_updatingFrames = YES;
dispatch_async(dispatch_get_main_queue(), ^(void){
// TODO: can we make VSync happen here?
_updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/500 target:self selector:@selector(_updateFrame) userInfo:nil repeats: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){
_updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_updateFrame) userInfo:nil repeats:YES];
});
}
}
-(void)dealloc {

View File

@ -114,7 +114,7 @@
_staticBuffer = IOSurfaceCreate((CFDictionaryRef) [NSDictionary dictionaryWithObjectsAndKeys:
@"PurpleEDRAM", kIOSurfaceMemoryRegion,
[NSNumber numberWithBool:YES], kIOSurfaceIsGlobal,
// [NSNumber numberWithBool:YES], kIOSurfaceIsGlobal,
[NSNumber numberWithInt:bytesPerPixel*_width], kIOSurfaceBytesPerRow,
[NSNumber numberWithInt:bytesPerPixel], kIOSurfaceBytesPerElement,
[NSNumber numberWithInt:_width], kIOSurfaceWidth,
@ -142,7 +142,9 @@
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 {

View File

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

View File

@ -81,6 +81,26 @@
<key>isNumeric</key>
<true/>
</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>
</dict>
</plist>