Class IOSurface


  • public final class IOSurface
    extends java.lang.Object
    • Method Detail

      • IOSurfaceGetTypeID

        public static long IOSurfaceGetTypeID()
      • IOSurfaceLookup

        public static IOSurfaceRef IOSurfaceLookup​(int csid)
        Perform an atomic lookup and retain of a IOSurface by its IOSurfaceID. Note: Performing multiple lookups of the same IOSurface will *NOT* return the same IOSurfaceRef. If you need to compare two IOSurface objects for equality, you must either do so by comparing their IOSurfaceIDs, or by using CFEqual().
      • IOSurfaceGetID

        public static int IOSurfaceGetID​(IOSurfaceRef buffer)
        Retrieve the unique IOSurfaceID value for a IOSurface
      • IOSurfaceLock

        public static int IOSurfaceLock​(IOSurfaceRef buffer,
                                        int options,
                                        org.moe.natj.general.ptr.IntPtr seed)
        "Lock" or "Unlock" a IOSurface for reading or writing. The term "lock" is used loosely in this context, and is simply used along with the "unlock" information to put a bound on CPU access to the raw IOSurface data. If the seed parameter is non-NULL, IOSurfaceLock() will store the buffer's internal modification seed value at the time you made the lock call. You can compare this value to a value returned previously to determine of the contents of the buffer has been changed since the last lock. In the case of IOSurfaceUnlock(), the seed value returned will be the internal seed value at the time of the unlock. If you locked the buffer for writing, this value will be incremented as the unlock is performed and the new value will be returned. See the kIOSurfaceLock enums for more information. Note: Locking and unlocking a IOSurface is not a particularly cheap operation, so care should be taken to avoid the calls whenever possible. The seed values are particularly useful for keeping a cache of the buffer contents.
      • IOSurfaceUnlock

        public static int IOSurfaceUnlock​(IOSurfaceRef buffer,
                                          int options,
                                          org.moe.natj.general.ptr.IntPtr seed)
      • IOSurfaceGetAllocSize

        public static long IOSurfaceGetAllocSize​(IOSurfaceRef buffer)
        These routines are all fairly self explanatory. 0 is returned if buffer is invalid or NULL
      • IOSurfaceGetWidth

        public static long IOSurfaceGetWidth​(IOSurfaceRef buffer)
      • IOSurfaceGetHeight

        public static long IOSurfaceGetHeight​(IOSurfaceRef buffer)
      • IOSurfaceGetBytesPerElement

        public static long IOSurfaceGetBytesPerElement​(IOSurfaceRef buffer)
      • IOSurfaceGetBytesPerRow

        public static long IOSurfaceGetBytesPerRow​(IOSurfaceRef buffer)
      • IOSurfaceGetBaseAddress

        public static org.moe.natj.general.ptr.VoidPtr IOSurfaceGetBaseAddress​(IOSurfaceRef buffer)
      • IOSurfaceGetElementWidth

        public static long IOSurfaceGetElementWidth​(IOSurfaceRef buffer)
      • IOSurfaceGetElementHeight

        public static long IOSurfaceGetElementHeight​(IOSurfaceRef buffer)
      • IOSurfaceGetPixelFormat

        public static int IOSurfaceGetPixelFormat​(IOSurfaceRef buffer)
      • IOSurfaceGetSeed

        public static int IOSurfaceGetSeed​(IOSurfaceRef buffer)
        This will return the current seed value of the buffer and is a cheap call to make to see if the contents of the buffer have changed since the last lock/unlock.
      • IOSurfaceGetPlaneCount

        public static long IOSurfaceGetPlaneCount​(IOSurfaceRef buffer)
        Return the number of planes in this buffer. May be 0. Returns 0 for an invalid or NULL buffer pointer.
      • IOSurfaceGetWidthOfPlane

        public static long IOSurfaceGetWidthOfPlane​(IOSurfaceRef buffer,
                                                    long planeIndex)
        These routines return information about a particular plane of a IOSurface. If the planeIndex is greater than or equal to the plane count of the IOSurface, zero is returned.... with one exception. If this IOSurface has zero planes and a planeIndex of zero is passed in, the routines function just like the non-planar APIs. This is to allow higher level code to treat planar and non-planar buffers is a more uniform fashion.
      • IOSurfaceGetHeightOfPlane

        public static long IOSurfaceGetHeightOfPlane​(IOSurfaceRef buffer,
                                                     long planeIndex)
      • IOSurfaceGetBytesPerElementOfPlane

        public static long IOSurfaceGetBytesPerElementOfPlane​(IOSurfaceRef buffer,
                                                              long planeIndex)
      • IOSurfaceGetBytesPerRowOfPlane

        public static long IOSurfaceGetBytesPerRowOfPlane​(IOSurfaceRef buffer,
                                                          long planeIndex)
      • IOSurfaceGetBaseAddressOfPlane

        public static org.moe.natj.general.ptr.VoidPtr IOSurfaceGetBaseAddressOfPlane​(IOSurfaceRef buffer,
                                                                                      long planeIndex)
      • IOSurfaceGetElementWidthOfPlane

        public static long IOSurfaceGetElementWidthOfPlane​(IOSurfaceRef buffer,
                                                           long planeIndex)
      • IOSurfaceGetElementHeightOfPlane

        public static long IOSurfaceGetElementHeightOfPlane​(IOSurfaceRef buffer,
                                                            long planeIndex)
      • IOSurfaceGetNumberOfComponentsOfPlane

        public static long IOSurfaceGetNumberOfComponentsOfPlane​(IOSurfaceRef buffer,
                                                                 long planeIndex)
        These routines return information about a particular component of a particular plane of a IOSurface. For non-planar IOSurfaces, pass zero for planeIndex.
      • IOSurfaceGetNameOfComponentOfPlane

        public static int IOSurfaceGetNameOfComponentOfPlane​(IOSurfaceRef buffer,
                                                             long planeIndex,
                                                             long componentIndex)
      • IOSurfaceGetTypeOfComponentOfPlane

        public static int IOSurfaceGetTypeOfComponentOfPlane​(IOSurfaceRef buffer,
                                                             long planeIndex,
                                                             long componentIndex)
      • IOSurfaceGetRangeOfComponentOfPlane

        public static int IOSurfaceGetRangeOfComponentOfPlane​(IOSurfaceRef buffer,
                                                              long planeIndex,
                                                              long componentIndex)
      • IOSurfaceGetBitDepthOfComponentOfPlane

        public static long IOSurfaceGetBitDepthOfComponentOfPlane​(IOSurfaceRef buffer,
                                                                  long planeIndex,
                                                                  long componentIndex)
      • IOSurfaceGetBitOffsetOfComponentOfPlane

        public static long IOSurfaceGetBitOffsetOfComponentOfPlane​(IOSurfaceRef buffer,
                                                                   long planeIndex,
                                                                   long componentIndex)
      • IOSurfaceGetSubsampling

        public static int IOSurfaceGetSubsampling​(IOSurfaceRef buffer)
      • IOSurfaceSetValue

        public static void IOSurfaceSetValue​(IOSurfaceRef buffer,
                                             CFStringRef key,
                                             org.moe.natj.general.ptr.ConstVoidPtr value)
        These calls let you attach CF property list types to a IOSurface buffer. These calls are expensive (they essentially must serialize the data into the kernel) and thus should be avoided whenever possible. Note: These functions can not be used to change the underlying surface properties.
      • IOSurfaceCopyValue

        public static org.moe.natj.general.ptr.ConstVoidPtr IOSurfaceCopyValue​(IOSurfaceRef buffer,
                                                                               CFStringRef key)
      • IOSurfaceSetValues

        public static void IOSurfaceSetValues​(IOSurfaceRef buffer,
                                              CFDictionaryRef keysAndValues)
        Bulk setters and getters for setting, retrieving or removing the entire set of values at once .
      • IOSurfaceRemoveAllValues

        public static void IOSurfaceRemoveAllValues​(IOSurfaceRef buffer)
      • IOSurfaceCreateMachPort

        public static int IOSurfaceCreateMachPort​(IOSurfaceRef buffer)
        This call lets you get a mach_port_t that holds a reference to the IOSurface. This is useful if you need to atomically or securely pass an IOSurface to another task without making the surface global to the entire system. The returned port must be deallocated with mach_port_deallocate or the equivalent. Note: Any live mach ports created from an IOSurfaceRef implicity increase the IOSurface's global use count by one until the port is deleted.
      • IOSurfaceLookupFromMachPort

        public static IOSurfaceRef IOSurfaceLookupFromMachPort​(int port)
        This call lets you take a mach_port_t created via IOSurfaceCreatePort() and recreate an IOSurfaceRef from it. Note: This call does NOT destroy the port.
      • IOSurfaceGetPropertyMaximum

        public static long IOSurfaceGetPropertyMaximum​(CFStringRef property)
        IOSurfaceGetPropertyMaximum() will return the maximum of a given property that is guaranteed to be compatible with all of the current devices (GPUs, etc.) in the system. The most important ones being: kIOSurfaceBytesPerRow kIOSurfaceWidth kIOSurfaceHeight kIOSurfacePlaneBytesPerRow kIOSurfacePlaneWidth kIOSurfacePlaneHeight For the width and height properties, the maximum values are the largest that are guaranteed to work for both reading and writing. In OpenGL terms this translates into the largest size that will work for both textures and render targets. This function returns 0 for properties that have no predefined limit or where the concept of a limit would be considered invalid (such as kIOSurfacePixelFormat).
      • IOSurfaceGetPropertyAlignment

        public static long IOSurfaceGetPropertyAlignment​(CFStringRef property)
        If a property has a particular alignment requirement, then IOSurfaceGetPropertyAlignment() will return it. If the property has no alignment requirement then 1 will be returned. The following properties should always be aligned if you choose calculate them yourself: kIOSurfaceBytesPerRow kIOSurfaceOffset kIOSurfacePlaneBase kIOSurfacePlaneOffset kIOSurfacePlaneBytesPerRow
      • IOSurfaceAlignProperty

        public static long IOSurfaceAlignProperty​(CFStringRef property,
                                                  long value)
        This is a convenience function to automatically align property values. For properties with no alignment requirements, the original value will be returned.
      • IOSurfaceIncrementUseCount

        public static void IOSurfaceIncrementUseCount​(IOSurfaceRef buffer)
        Increment the per-process usage count for an IOSurface
      • IOSurfaceDecrementUseCount

        public static void IOSurfaceDecrementUseCount​(IOSurfaceRef buffer)
        Decrement the per-process usage count for an IOSurface
      • IOSurfaceGetUseCount

        public static int IOSurfaceGetUseCount​(IOSurfaceRef buffer)
        Return the per-process usage count for an IOSurface
      • IOSurfaceIsInUse

        public static byte IOSurfaceIsInUse​(IOSurfaceRef buffer)
        Returns true of an IOSurface is in use by any process in the system, otherwise false.
      • IOSurfaceAllowsPixelSizeCasting

        public static byte IOSurfaceAllowsPixelSizeCasting​(IOSurfaceRef buffer)
        Rerturns true if this IOSurface allows pixel size casting
      • IOSurfaceSetPurgeable

        public static int IOSurfaceSetPurgeable​(IOSurfaceRef buffer,
                                                int newState,
                                                org.moe.natj.general.ptr.IntPtr oldState)
        You should assume that if you mark an IOSurface as Purgeable/Empty and mark it NonVolatile and it comes back with the old state being Empty that any texture objects bound to the IOSurface now have undefined content in them. If oldState is non-NULL, it will return the previous state of the IOSurface. kIOSurfacePurgeableNonVolatile - The IOSurface was not volatile and the contents are still valid kIOSurfacePurgeableVolatile - The IOSurface was volatile, but the contents were not discarded kIOSurfacePurgeableEmpty - The IOSurface was empty and the contents have been discarded. kIOSurfacePurgeableKeepCurrent - Don't change the current status, just return what the state is now.
      • kIOSurfaceAllocSize

        public static CFStringRef kIOSurfaceAllocSize()
        kIOSurfaceAllocSize - CFNumber of the total allocation size of the buffer including all planes. Defaults to BufferHeight * BytesPerRow if not specified. Must be specified for dimensionless buffers.
      • kIOSurfaceWidth

        public static CFStringRef kIOSurfaceWidth()
        kIOSurfaceWidth - CFNumber for the width of the IOSurface buffer in pixels. Required for planar IOSurfaces.
      • kIOSurfaceHeight

        public static CFStringRef kIOSurfaceHeight()
        kIOSurfaceHeight - CFNumber for the height of the IOSurface buffer in pixels. Required for planar IOSurfaces.
      • kIOSurfaceBytesPerRow

        public static CFStringRef kIOSurfaceBytesPerRow()
        kIOSurfaceBytesPerRow - CFNumber for the bytes per row of the buffer. If not specified, IOSurface will first calculate the number full elements required on each row (by rounding up), multiplied by the bytes per element for this buffer. That value will then be appropriately aligned.
      • kIOSurfaceBytesPerElement

        public static CFStringRef kIOSurfaceBytesPerElement()
        kIOSurfaceBytesPerElement - CFNumber for the total number of bytes in an element. Default to 1.
      • kIOSurfaceElementWidth

        public static CFStringRef kIOSurfaceElementWidth()
        kIOSurfaceElementWidth - CFNumber for how many pixels wide each element is. Defaults to 1.
      • kIOSurfaceElementHeight

        public static CFStringRef kIOSurfaceElementHeight()
        kIOSurfaceElementHeight - CFNumber for how many pixels high each element is. Defaults to 1.
      • kIOSurfaceOffset

        public static CFStringRef kIOSurfaceOffset()
        kIOSurfaceOffset - CFNumber for the starting offset into the buffer. Defaults to 0.
      • kIOSurfacePlaneInfo

        public static CFStringRef kIOSurfacePlaneInfo()
        kIOSurfacePlaneInfo - CFArray describing each image plane in the buffer as a CFDictionary. The CFArray must have at least one entry.
      • kIOSurfacePlaneWidth

        public static CFStringRef kIOSurfacePlaneWidth()
        kIOSurfacePlaneWidth - CFNumber for the width of this plane in pixels. Required for image planes.
      • kIOSurfacePlaneHeight

        public static CFStringRef kIOSurfacePlaneHeight()
        kIOSurfacePlaneHeight - CFNumber for the height of this plane in pixels. Required for image planes.
      • kIOSurfacePlaneBytesPerRow

        public static CFStringRef kIOSurfacePlaneBytesPerRow()
        kIOSurfacePlaneBytesPerRow - CFNumber for the bytes per row of this plane. If not specified, IOSurface will first calculate the number full elements required on each row (by rounding up), multiplied by the bytes per element for this plane. That value will then be appropriately aligned.
      • kIOSurfacePlaneOffset

        public static CFStringRef kIOSurfacePlaneOffset()
        kIOSurfacePlaneOffset - CFNumber for the offset into the buffer for this plane. If not specified then IOSurface will lay out each plane sequentially based on the previous plane's allocation size.
      • kIOSurfacePlaneSize

        public static CFStringRef kIOSurfacePlaneSize()
        kIOSurfacePlaneSize - CFNumber for the total data size of this plane. Defaults to plane height * plane bytes per row if not specified.
      • kIOSurfacePlaneBase

        public static CFStringRef kIOSurfacePlaneBase()
        kIOSurfacePlaneBase - CFNumber for the base offset into the buffer for this plane. Optional, defaults to the plane offset
      • kIOSurfacePlaneBitsPerElement

        public static CFStringRef kIOSurfacePlaneBitsPerElement()
        kIOSurfacePlaneBitsPerElement - CFNumber for the bits per element of this plane. Optional, default is 1. For use in cases where kIOSurfacePlaneBytesPerElement doesn't allow sufficient precision.
      • kIOSurfacePlaneBytesPerElement

        public static CFStringRef kIOSurfacePlaneBytesPerElement()
        kIOSurfacePlaneBytesPerElement - CFNumber for the bytes per element of this plane. Optional, default is 1.
      • kIOSurfacePlaneElementWidth

        public static CFStringRef kIOSurfacePlaneElementWidth()
        kIOSurfacePlaneElementWidth - CFNumber for the element width of this plane. Optional, default is 1.
      • kIOSurfacePlaneElementHeight

        public static CFStringRef kIOSurfacePlaneElementHeight()
        kIOSurfacePlaneElementHeight - CFNumber for the element height of this plane. Optional, default is 1.
      • kIOSurfaceCacheMode

        public static CFStringRef kIOSurfaceCacheMode()
        kIOSurfaceCacheMode - CFNumber for the CPU cache mode to be used for the allocation. Default is kIOMapDefaultCache.
      • kIOSurfaceIsGlobal

        public static CFStringRef kIOSurfaceIsGlobal()
        kIOSurfaceIsGlobal - CFBoolean If true, the IOSurface may be looked up by any task in the system by its ID.
      • kIOSurfacePixelFormat

        public static CFStringRef kIOSurfacePixelFormat()
        kIOSurfacePixelFormat - CFNumber A 32-bit unsigned integer that stores the traditional Mac OS X buffer format
      • kIOSurfacePixelSizeCastingAllowed

        public static CFStringRef kIOSurfacePixelSizeCastingAllowed()
        kIOSurfacePixelSizeCastingAllowed - If false the creator promises that there will be no pixel size casting when used on the GPU. Default is true.
      • kIOSurfacePlaneComponentBitDepths

        public static CFStringRef kIOSurfacePlaneComponentBitDepths()
        kIOSurfacePlaneComponentBitDepths - CFArray[CFNumber] for bit depth of each component in this plane.
      • kIOSurfacePlaneComponentBitOffsets

        public static CFStringRef kIOSurfacePlaneComponentBitOffsets()
        kIOSurfacePlaneComponentBitOffsets - CFArray[CFNumber] for bit offset of each component in this plane, (low bit zero, high bit 7). For example 'BGRA' would be {0, 8, 16, 24}
      • kIOSurfacePlaneComponentNames

        public static CFStringRef kIOSurfacePlaneComponentNames()
        kIOSurfacePlaneComponentNames - CFArray[CFNumber] for IOSurfaceComponentName of each component in this plane. For example 'BGRA' would be {4, 3, 2, 1}
      • kIOSurfacePlaneComponentTypes

        public static CFStringRef kIOSurfacePlaneComponentTypes()
        kIOSurfacePlaneComponentTypes - CFArray[CFNumber] for IOSurfaceComponentType of each component in this plane.
      • kIOSurfacePlaneComponentRanges

        public static CFStringRef kIOSurfacePlaneComponentRanges()
        kIOSurfacePlaneComponentRanges - CFArray[CFNumber] for IOSurfaceComponentRange of each component in this plane.
      • kIOSurfaceSubsampling

        public static CFStringRef kIOSurfaceSubsampling()
        kIOSurfaceSubsampling - CFNumber(IOSurfaceSubsampling) describing the chroma subsampling.
      • IOSurfacePropertyAllocSizeKey

        public static java.lang.String IOSurfacePropertyAllocSizeKey()
        This key was misnamed.
      • IOSurfacePropertyKeyWidth

        public static java.lang.String IOSurfacePropertyKeyWidth()
        IOSurfacePropertyKeyWidth - NSNumber for the width of the IOSurface buffer in pixels. Required for planar IOSurfaces.
      • IOSurfacePropertyKeyHeight

        public static java.lang.String IOSurfacePropertyKeyHeight()
        IOSurfacePropertyKeyHeight - NSNumber for the height of the IOSurface buffer in pixels. Required for planar IOSurfaces.
      • IOSurfacePropertyKeyBytesPerRow

        public static java.lang.String IOSurfacePropertyKeyBytesPerRow()
        IOSurfacePropertyKeyBytesPerRow - NSNumber for the bytes per row of the buffer. If not specified, IOSurface will first calculate the number full elements required on each row (by rounding up), multiplied by the bytes per element for this surface. That value will then be appropriately aligned.
      • IOSurfacePropertyKeyBytesPerElement

        public static java.lang.String IOSurfacePropertyKeyBytesPerElement()
        IOSurfacePropertyKeyBytesPerElement - NSNumber for the total number of bytes in an element. Default to 1.
      • IOSurfacePropertyKeyElementWidth

        public static java.lang.String IOSurfacePropertyKeyElementWidth()
        IOSurfacePropertyKeyElementWidth - NSNumber for how many pixels wide each element is. Defaults to 1.
      • IOSurfacePropertyKeyElementHeight

        public static java.lang.String IOSurfacePropertyKeyElementHeight()
        IOSurfacePropertyKeyElementHeight - NSNumber for how many pixels high each element is. Defaults to 1.
      • IOSurfacePropertyKeyOffset

        public static java.lang.String IOSurfacePropertyKeyOffset()
        IOSurfacePropertyKeyOffset - NSNumber for the starting offset into the buffer. Defaults to 0.
      • IOSurfacePropertyKeyPlaneInfo

        public static java.lang.String IOSurfacePropertyKeyPlaneInfo()
        IOSurfacePropertyKeyPlaneInfo - NSArray describing each image plane in the buffer as a CFDictionary. The CFArray must have at least one entry.
      • IOSurfacePropertyKeyPlaneWidth

        public static java.lang.String IOSurfacePropertyKeyPlaneWidth()
        IOSurfacePropertyKeyPlaneWidth - NSNumber for the width of this plane in pixels. Required for image planes.
      • IOSurfacePropertyKeyPlaneHeight

        public static java.lang.String IOSurfacePropertyKeyPlaneHeight()
        IOSurfacePropertyKeyPlaneHeight - NSNumber for the height of this plane in pixels. Required for image planes.
      • IOSurfacePropertyKeyPlaneBytesPerRow

        public static java.lang.String IOSurfacePropertyKeyPlaneBytesPerRow()
        IOSurfacePropertyKeyPlaneBytesPerRow - NSNumber for the bytes per row of this plane. If not specified, IOSurface will first calculate the number full elements required on each row (by rounding up), multiplied by the bytes per element for this plane. That value will then be appropriately aligned.
      • IOSurfacePropertyKeyPlaneOffset

        public static java.lang.String IOSurfacePropertyKeyPlaneOffset()
        IOSurfacePropertyKeyPlaneOffset - NSNumber for the offset into the buffer for this plane. If not specified then IOSurface will lay out each plane sequentially based on the previous plane's allocation size.
      • IOSurfacePropertyKeyPlaneSize

        public static java.lang.String IOSurfacePropertyKeyPlaneSize()
        IOSurfacePropertyKeyPlaneSize - NSNumber for the total data size of this plane. Defaults to plane height * plane bytes per row if not specified.
      • IOSurfacePropertyKeyPlaneBase

        public static java.lang.String IOSurfacePropertyKeyPlaneBase()
        IOSurfacePropertyKeyPlaneBase - NSNumber for the base offset into the buffer for this plane. Optional, defaults to the plane offset
      • IOSurfacePropertyKeyPlaneBytesPerElement

        public static java.lang.String IOSurfacePropertyKeyPlaneBytesPerElement()
        IOSurfacePropertyKeyPlaneBytesPerElement - NSNumber for the bytes per element of this plane. Optional, default is 1.
      • IOSurfacePropertyKeyPlaneElementWidth

        public static java.lang.String IOSurfacePropertyKeyPlaneElementWidth()
        IOSurfacePropertyKeyPlaneElementWidth - NSNumber for the element width of this plane. Optional, default is 1.
      • IOSurfacePropertyKeyPlaneElementHeight

        public static java.lang.String IOSurfacePropertyKeyPlaneElementHeight()
        IOSurfacePropertyKeyPlaneElementHeight - NSNumber for the element height of this plane. Optional, default is 1.
      • IOSurfacePropertyKeyCacheMode

        public static java.lang.String IOSurfacePropertyKeyCacheMode()
        IOSurfacePropertyKeyCacheMode - NSNumber for the CPU cache mode to be used for the allocation. Default is kIOMapDefaultCache.
      • IOSurfacePropertyKeyPixelFormat

        public static java.lang.String IOSurfacePropertyKeyPixelFormat()
        IOSurfacePropertyKeyPixelFormat - NSNumber A 32-bit unsigned integer that stores the traditional Mac OS X buffer format
      • IOSurfacePropertyKeyPixelSizeCastingAllowed

        public static java.lang.String IOSurfacePropertyKeyPixelSizeCastingAllowed()
        IOSurfacePropertyKeyPixelSizeCastingAllowed - If false the creator promises that there will be no pixel size casting when used on the GPU. Default is true.
      • IOSurfacePropertyKeyAllocSize

        public static java.lang.String IOSurfacePropertyKeyAllocSize()
        IOSurfacePropertyKeyAllocSize - NSNumber of the total allocation size of the buffer including all planes. Defaults to BufferHeight * BytesPerRow if not specified. Must be specified for dimensionless buffers.