From 1df5ddc58b095c7bf22af2c62ebfd3b500eb1e09 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 9 Nov 2014 20:32:56 -0800 Subject: [PATCH 1/1] Unaccelerated video should not try to use buffer_. --- Tweak.mm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Tweak.mm b/Tweak.mm index b10572c..dc0b1aa 100644 --- 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(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(IOSurfaceGetBaseAddress(buffer_)); - IOSurfaceUnlock(buffer_); + IOSurfaceLock(buffer_, 3); + screen_->frameBuffer = reinterpret_cast(IOSurfaceGetBaseAddress(buffer_)); + IOSurfaceUnlock(buffer_); + } screen_->kbdAddEvent = &VNCKeyboard; screen_->ptrAddEvent = &VNCPointer; -- 2.47.2