<!--
{
  "documentType" : "article",
  "framework" : "IOSurface",
  "identifier" : "/documentation/IOSurface/iosurface-functions",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "IOSurface Functions"
}
-->

# IOSurface Functions

## Topics

### Functions

[`func IOSurfaceAlignProperty(CFString, Int) -> Int`](/documentation/IOSurface/IOSurfaceAlignProperty(_:_:))

Returns the smallest aligned value greater than or equal to the specified value.

[`func IOSurfaceAllowsPixelSizeCasting(IOSurfaceRef) -> Bool`](/documentation/IOSurface/IOSurfaceAllowsPixelSizeCasting(_:))

[`func IOSurfaceCopyAllValues(IOSurfaceRef) -> CFDictionary?`](/documentation/IOSurface/IOSurfaceCopyAllValues(_:))

[`func IOSurfaceCopyValue(IOSurfaceRef, CFString) -> CFTypeRef?`](/documentation/IOSurface/IOSurfaceCopyValue(_:_:))

Retrieves a value from the dictionary associated with the buffer.

[`func IOSurfaceCreate(CFDictionary) -> IOSurfaceRef?`](/documentation/IOSurface/IOSurfaceCreate(_:))

Creates a brand new IOSurface object

[`func IOSurfaceCreateMachPort(IOSurfaceRef) -> mach_port_t`](/documentation/IOSurface/IOSurfaceCreateMachPort(_:))

Returns a mach_port_t that holds a reference to the IOSurface.

[`func IOSurfaceCreateXPCObject(IOSurfaceRef) -> xpc_object_t`](/documentation/IOSurface/IOSurfaceCreateXPCObject(_:))

Returns an xpc_object_t that holds a reference to the IOSurface.

[`func IOSurfaceDecrementUseCount(IOSurfaceRef)`](/documentation/IOSurface/IOSurfaceDecrementUseCount(_:))

Decrements the per-process usage count for an [`IOSurface`](/documentation/IOSurface/IOSurface).

[`func IOSurfaceGetAllocSize(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetAllocSize(_:))

Returns the total allocation size of the buffer including all planes.

[`func IOSurfaceGetBaseAddress(IOSurfaceRef) -> UnsafeMutableRawPointer`](/documentation/IOSurface/IOSurfaceGetBaseAddress(_:))

Returns the address of the first byte of data in a particular buffer.

[`func IOSurfaceGetBaseAddressOfPlane(IOSurfaceRef, Int) -> UnsafeMutableRawPointer`](/documentation/IOSurface/IOSurfaceGetBaseAddressOfPlane(_:_:))

Returns the address of the first byte of data in the specified plane.

[`func IOSurfaceGetBitDepthOfComponentOfPlane(IOSurfaceRef, Int, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetBitDepthOfComponentOfPlane(_:_:_:))

[`func IOSurfaceGetBitOffsetOfComponentOfPlane(IOSurfaceRef, Int, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetBitOffsetOfComponentOfPlane(_:_:_:))

[`func IOSurfaceGetBytesPerElement(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetBytesPerElement(_:))

Returns the length (in bytes) of each element in a particular buffer.

[`func IOSurfaceGetBytesPerElementOfPlane(IOSurfaceRef, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetBytesPerElementOfPlane(_:_:))

Returns the size of each element (in bytes) in the specified plane.

[`func IOSurfaceGetBytesPerRow(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetBytesPerRow(_:))

Returns the length (in bytes) of each row in a particular buffer.

[`func IOSurfaceGetBytesPerRowOfPlane(IOSurfaceRef, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetBytesPerRowOfPlane(_:_:))

Returns the size of each row (in bytes) in the specified plane.

[`func IOSurfaceGetElementHeight(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetElementHeight(_:))

Returns the height (in pixels) of each element in a particular buffer.

[`func IOSurfaceGetElementHeightOfPlane(IOSurfaceRef, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetElementHeightOfPlane(_:_:))

Returns the height (in pixels) of each element in the specified plane.

[`func IOSurfaceGetElementWidth(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetElementWidth(_:))

Returns the width (in pixels) of each element in a particular buffer.

[`func IOSurfaceGetElementWidthOfPlane(IOSurfaceRef, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetElementWidthOfPlane(_:_:))

Returns the width (in pixels) of each element in the specified plane.

[`func IOSurfaceGetHeight(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetHeight(_:))

Returns the height of the IOSurface buffer in pixels.

[`func IOSurfaceGetHeightOfPlane(IOSurfaceRef, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetHeightOfPlane(_:_:))

Returns the height of the specified plane (in pixels).

[`func IOSurfaceGetID(IOSurfaceRef) -> IOSurfaceID`](/documentation/IOSurface/IOSurfaceGetID(_:))

Retrieves the unique [`IOSurfaceID`](/documentation/IOSurface/IOSurfaceID) value for an [`IOSurface`](/documentation/IOSurface/IOSurface).

[`func IOSurfaceGetNameOfComponentOfPlane(IOSurfaceRef, Int, Int) -> IOSurfaceComponentName`](/documentation/IOSurface/IOSurfaceGetNameOfComponentOfPlane(_:_:_:))

[`func IOSurfaceGetNumberOfComponentsOfPlane(IOSurfaceRef, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetNumberOfComponentsOfPlane(_:_:))

[`func IOSurfaceGetPixelFormat(IOSurfaceRef) -> OSType`](/documentation/IOSurface/IOSurfaceGetPixelFormat(_:))

Returns an unsigned integer that contains the traditional macOS buffer format.

[`func IOSurfaceGetPlaneCount(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetPlaneCount(_:))

[`func IOSurfaceGetPropertyAlignment(CFString) -> Int`](/documentation/IOSurface/IOSurfaceGetPropertyAlignment(_:))

Returns the alignment requirements for a property (if any).

[`func IOSurfaceGetPropertyMaximum(CFString) -> Int`](/documentation/IOSurface/IOSurfaceGetPropertyMaximum(_:))

Returns the maximum value for a given property that is guaranteed to be compatible with all of the current devices (GPUs, etc.) in the system.

[`func IOSurfaceGetRangeOfComponentOfPlane(IOSurfaceRef, Int, Int) -> IOSurfaceComponentRange`](/documentation/IOSurface/IOSurfaceGetRangeOfComponentOfPlane(_:_:_:))

[`func IOSurfaceGetSeed(IOSurfaceRef) -> UInt32`](/documentation/IOSurface/IOSurfaceGetSeed(_:))

[`func IOSurfaceGetSubsampling(IOSurfaceRef) -> IOSurfaceSubsampling`](/documentation/IOSurface/IOSurfaceGetSubsampling(_:))

[`func IOSurfaceGetTypeID() -> CFTypeID`](/documentation/IOSurface/IOSurfaceGetTypeID())

[`func IOSurfaceGetTypeOfComponentOfPlane(IOSurfaceRef, Int, Int) -> IOSurfaceComponentType`](/documentation/IOSurface/IOSurfaceGetTypeOfComponentOfPlane(_:_:_:))

[`func IOSurfaceGetUseCount(IOSurfaceRef) -> Int32`](/documentation/IOSurface/IOSurfaceGetUseCount(_:))

Returns the per-process usage count for an [`IOSurface`](/documentation/IOSurface/IOSurface).

[`func IOSurfaceGetWidth(IOSurfaceRef) -> Int`](/documentation/IOSurface/IOSurfaceGetWidth(_:))

Returns the width of the IOSurface buffer in pixels.

[`func IOSurfaceGetWidthOfPlane(IOSurfaceRef, Int) -> Int`](/documentation/IOSurface/IOSurfaceGetWidthOfPlane(_:_:))

Returns the width of the specified plane (in pixels).

[`func IOSurfaceIncrementUseCount(IOSurfaceRef)`](/documentation/IOSurface/IOSurfaceIncrementUseCount(_:))

Increments the per-process usage count for an [`IOSurface`](/documentation/IOSurface/IOSurface).

[`func IOSurfaceIsInUse(IOSurfaceRef) -> Bool`](/documentation/IOSurface/IOSurfaceIsInUse(_:))

Returns true of an IOSurface is in use by any process in the system, otherwise false.

[`func IOSurfaceLock(IOSurfaceRef, IOSurfaceLockOptions, UnsafeMutablePointer<UInt32>?) -> kern_return_t`](/documentation/IOSurface/IOSurfaceLock(_:_:_:))

“Lock” an IOSurface for reading or writing.

[`func IOSurfaceLookup(IOSurfaceID) -> IOSurfaceRef?`](/documentation/IOSurface/IOSurfaceLookup(_:))

Performs an atomic lookup and retain of an IOSurface by its IOSurfaceID.

[`func IOSurfaceLookupFromMachPort(mach_port_t) -> IOSurfaceRef?`](/documentation/IOSurface/IOSurfaceLookupFromMachPort(_:))

Recreates an IOSurfaceRef from a mach port.

[`func IOSurfaceLookupFromXPCObject(xpc_object_t) -> IOSurfaceRef?`](/documentation/IOSurface/IOSurfaceLookupFromXPCObject(_:))

[`func IOSurfaceRemoveAllValues(IOSurfaceRef)`](/documentation/IOSurface/IOSurfaceRemoveAllValues(_:))

[`func IOSurfaceRemoveValue(IOSurfaceRef, CFString)`](/documentation/IOSurface/IOSurfaceRemoveValue(_:_:))

Deletes a value in the dictionary associated with the buffer.

[`func IOSurfaceSetOwnershipIdentity(IOSurfaceRef, task_id_token_t, Int32, UInt32) -> kern_return_t`](/documentation/IOSurface/IOSurfaceSetOwnershipIdentity(_:_:_:_:))

[`func IOSurfaceSetPurgeable(IOSurfaceRef, UInt32, UnsafeMutablePointer<UInt32>?) -> kern_return_t`](/documentation/IOSurface/IOSurfaceSetPurgeable(_:_:_:))

[`func IOSurfaceSetValue(IOSurfaceRef, CFString, CFTypeRef)`](/documentation/IOSurface/IOSurfaceSetValue(_:_:_:))

Sets a value in the dictionary associated with the buffer.

[`func IOSurfaceSetValues(IOSurfaceRef, CFDictionary)`](/documentation/IOSurface/IOSurfaceSetValues(_:_:))

[`func IOSurfaceUnlock(IOSurfaceRef, IOSurfaceLockOptions, UnsafeMutablePointer<UInt32>?) -> kern_return_t`](/documentation/IOSurface/IOSurfaceUnlock(_:_:_:))

“Unlock” an [`IOSurface`](/documentation/IOSurface/IOSurface) for reading or writing.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)