]> git.saurik.com Git - veency.git/commitdiff
Unaccelerated video should not try to use buffer_.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 10 Nov 2014 04:32:56 +0000 (20:32 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 10 Nov 2014 04:32:56 +0000 (20:32 -0800)
Tweak.mm

index b10572cadb4afe10da4949c544f641f48d8fafc8..dc0b1aa3da015d1f942be00a574df66bf057f031 100644 (file)
--- a/Tweak.mm
+++ b/Tweak.mm
@@ -906,7 +906,9 @@ static void VNCSetup() {
     if (opengles2 != NULL)
         CFRelease(opengles2);
 
-    if (accelerator_ != NULL)
+    if (accelerator_ == NULL)
+        VNCBlack();
+    else {
         buffer_ = IOSurfaceCreate((CFDictionaryRef) [NSDictionary dictionaryWithObjectsAndKeys:
             @"PurpleEDRAM", kIOSurfaceMemoryRegion,
             [NSNumber numberWithBool:YES], kIOSurfaceIsGlobal,
@@ -916,14 +918,11 @@ static void VNCSetup() {
             [NSNumber numberWithInt:'BGRA'], kIOSurfacePixelFormat,
             [NSNumber numberWithInt:(width_ * height_ * BytesPerPixel)], kIOSurfaceAllocSize,
         nil]);
-    else
-        VNCBlack();
-
-    //screen_->frameBuffer = reinterpret_cast<char *>(mmap(NULL, sizeof(rfbPixel) * width_ * height_, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_NOCACHE, VM_FLAGS_PURGABLE, 0));
 
-    IOSurfaceLock(buffer_, 3);
-    screen_->frameBuffer = reinterpret_cast<char *>(IOSurfaceGetBaseAddress(buffer_));
-    IOSurfaceUnlock(buffer_);
+        IOSurfaceLock(buffer_, 3);
+        screen_->frameBuffer = reinterpret_cast<char *>(IOSurfaceGetBaseAddress(buffer_));
+        IOSurfaceUnlock(buffer_);
+    }
 
     screen_->kbdAddEvent = &VNCKeyboard;
     screen_->ptrAddEvent = &VNCPointer;