IOSurface

RSS for tag

Share hardware-accelerated buffer data across multiple processes and frameworks using IOSurface.

IOSurface Documentation

Posts under IOSurface tag

10 Posts
Sort by:
Post not yet marked as solved
5 Replies
1.7k Views
I have a background process which is updating an IOSurface-backed CVPixelBuffer at 30fps. I want to render a preview of that pixel buffer in my window, scaled to the size of the NSView that's displaying it. I get a callback every time the pixelbuffer/IOSurface is updated. I've tried using a custom layer-backed NSView and setting the layer contents to the IOsurface -- which works when the view is created but it's never updated unless the window is resized or another window is in front of it. I've tried setting both my view and my layer SetNeedsDisplay(), I've tried changing the layerContentsRedrawPolicy to .onSetNeedsDisplay, I've tried making sure all my content and update code is happening on the UI thread, but I can't get it to dynamically update. Is there a way to bind my layer or view to the IOSurface once and then just have it reflect the updates as they happen, or, if not, at least mark the layer as dirty each frame when it changes? I've pored over the docs but I don't see a lot about the relationship between IOSurface and CALayer.contents, and when in the lifecycle to mark things dirty (especially when updates are happening outside the view). Here's example code: class VideoPreviewThumbnail: NSView, VideoFeedConsumer {   let testCard = TestCardHelper()       override var wantsUpdateLayer: Bool {     get { return true }   }   required init?(coder decoder: NSCoder) {     super.init(coder: decoder)     self.wantsLayer = true     self.layerContentsRedrawPolicy = .onSetNeedsDisplay      		/* Scale the incoming data to the size of the view */      self.layer?.transform = CATransform3DMakeScale(       (self.layer?.contentsScale)! * self.frame.width / CGFloat(VideoSettings.width),       (self.layer?.contentsScale)! * self.frame.height / CGFloat(VideoSettings.height),       CGFloat(1)) 	 /* Register us with the content provider */     VideoFeedBrowser.instance.registerConsumer(self)   }       deinit{     VideoFeedBrowser.instance.deregisterConsumer(self)   }       override func updateLayer() { 		/* ideally we woudln't need to do this */     updateLayer(pixelBuffer: VideoFeedBrowser.instance.renderer.pixelBuffer)   }    	/* This gets called every time our pixelbuffer is updated (30fps) */   @objc   func updateFrame(pixelBuffer: CVPixelBuffer) {     updateLayer(pixelBuffer: pixelBuffer)   }       func updateLayer(pixelBuffer: CVPixelBuffer) {     guard let surface = CVPixelBufferGetIOSurface(pixelBuffer)?.takeUnretainedValue() else {      print("pixelbuffer isn't IOsurface backed! noooooo!")       return;     } 	 /* these don't have any effect */ 	 //		self.layer?.setNeedsDisplay() //		self.setNeedsDisplay(invalidRect: self.visibleRect)     self.layer?.contents = surface   } }
Posted
by
Post not yet marked as solved
1 Replies
730 Views
recently i have purchased iphone x and updated to ios14.03 after which i found that my camera app is taking blurry photos on 1X normal but when i do 2x it takes clear pictures which is causing me a lot of problem i tried to reset all the setting but unable to clear the problem.
Posted
by
Post not yet marked as solved
3 Replies
827 Views
I'm trying to send an IOSurfaceRef across an NSXPCConnection on osx 10.13 and I'm having trouble with the solution that was provided in the forum thread "Efficiently sending data from an XPC process to the host application." https://developer.apple.com/forums/thread/126716 From that thread: > However, that specific problem got resolved on 10.12 where we introduced a new Objective-C IOSurface object, and that object is transportable directly over NSXPCConnection . So double yay! But it doesn’t seem to work. I have a very simple service protocol that includes (void)sendFrame:(IOSurfaceRef)frame; along with some basic NSString sending methods that successfully transfer across my NSXPCConnection. I have a valid (non-NULL) IOSurface in my app that I send to my helper app with sendFrame, and when the call is executed in the helper, the resulting frame is always NULL. On the other hand, I’ve also tried creating an IOSurface with the (deprecated) kIOSurfaceIsGlobal property and sending the IOSurface’s ID instead with: (void)sendFrameID:(uint32_t)frameID; and [_service sendFrameID:IOSurfaceGetID(surface)]; And on the helper app side, I look up the IO to get an IOSurfaceRef: IOSurfaceRef frame = IOSurfaceLookup(frameID); and it works correctly – I get a valid IOSurface which I can display and see the same pixel contents in both the app and the helper. So what is meant by the new IOSurface object in 10.12 is “transportable directly” over NSXPCConnection? How is it supposed to work? I’m specifically interested in no-copy transfer. Thanks!
Posted
by
Post not yet marked as solved
3 Replies
2.5k Views
Im trying to get the best reasons & understanding to why my iphone 11 pro max is constantly using this operating system on my iphone? * Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1;browserLanguage:en-us;siteLanguage:en-us****
Posted
by
Post not yet marked as solved
0 Replies
249 Views
Test device version: iPad iOS 15.2、 iPhone iOS15.3。 set UITextFiled.selectedTextRange in -(void)textFieldDidBeginEditing: method. When the selected text range is too long, the text will not be highlighted, but will actually be selected. Text is highlighted when tapped, or be replaced when typing.
Posted
by
Post not yet marked as solved
0 Replies
223 Views
0 libdispatch.dylib _dispatch_assert_queue_fail + 116 1 libdispatch.dylib _dispatch_assert_queue_fail + 198 arrow_right 2 ShareSheet -[SHSheetMainPresenter mainInteractor:didPerformActivityWithResult:] + 72 3 ShareSheet -[SHSheetMainInteractor _didPerformActivityWithResult:] + 88 4 ShareSheet __38-[SHSheetMainInteractor _runActivity:]_block_invoke + 60 5 ShareSheet -[SHSheetActivityPerformer _completePerformingActivityWithState:returnedItems:error:] + 812 6 ShareSheet __57-[SHSheetActivityPerformer performWithCompletionHandler:]_block_invoke + 100 7 ShareSheet -[UIActivity activityDidFinish:items:error:] + 184 8 ShareSheet __41-[UIOpenInIBooksActivity performActivity]_block_invoke + 244 9 UIKitCore __61-[UIPrintInteractionController _endPrintJobWithAction:error:]_block_invoke + 432 10 Foundation -[_NSBarrierOperation main] + 76 11 Foundation __NSOPERATION_IS_INVOKING_MAIN__ + 24 12 Foundation -[NSOperation start] + 804 13 Foundation __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 24 14 Foundation __NSOQSchedule_f + 184 15 libdispatch.dylib _dispatch_block_async_invoke2 + 148 16 libdispatch.dylib _dispatch_client_callout + 20 17 libdispatch.dylib _dispatch_lane_concurrent_drain + 1000 18 libdispatch.dylib _dispatch_lane_invoke + 504 19 libdispatch.dylib _dispatch_queue_override_invoke + 500 20 libdispatch.dylib _dispatch_root_queue_drain + 396 21 libdispatch.dylib _dispatch_worker_thread2 + 164 22 libsystem_pthread.dylib _pthread_wqthread + 228 23 libsystem_pthread.dylib start_wqthread + 8
Posted
by
Post not yet marked as solved
0 Replies
306 Views
Hello dear kindly I need your support about this problem since I update my iOS 15.3.1 every time I have a call and get waiting I can’t close this sound beep beep beep beep beep only solution to end this sound press on lock bottom so both of call will end or I can reject and answer second call or I can reject only or I can answer and hold So please I need solution for this problem
Posted
by