[iOS] Fix iphoneos SDK builds for ios-ews queue
[WebKit-https.git] / Source / WebCore / platform / spi / cocoa / IOSurfaceSPI.h
1 /*
2  * Copyright (C) 2015 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #ifndef IOSurfaceSPI_h
27 #define IOSurfaceSPI_h
28
29 #if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK)
30
31 #include <IOSurface/IOSurface.h>
32
33 #else
34
35 #include "IOReturnSPI.h"
36 #include "IOTypesSPI.h"
37 #include <CoreFoundation/CFBase.h>
38 #include <mach/mach_port.h>
39
40 typedef struct __IOSurface *IOSurfaceRef;
41
42 enum {
43     kIOSurfaceLockReadOnly  = 0x00000001,
44 };
45
46 #endif
47
48 WTF_EXTERN_C_BEGIN
49
50 extern const CFStringRef kIOSurfaceAllocSize;
51 extern const CFStringRef kIOSurfaceBytesPerElement;
52 extern const CFStringRef kIOSurfaceBytesPerRow;
53 extern const CFStringRef kIOSurfaceCacheMode;
54 extern const CFStringRef kIOSurfaceHeight;
55 extern const CFStringRef kIOSurfacePixelFormat;
56 extern const CFStringRef kIOSurfaceWidth;
57
58 size_t IOSurfaceAlignProperty(CFStringRef property, size_t value);
59 IOSurfaceRef IOSurfaceCreate(CFDictionaryRef properties);
60 mach_port_t IOSurfaceCreateMachPort(IOSurfaceRef buffer);
61 size_t IOSurfaceGetAllocSize(IOSurfaceRef buffer);
62 void *IOSurfaceGetBaseAddress(IOSurfaceRef buffer);
63 size_t IOSurfaceGetBytesPerRow(IOSurfaceRef buffer);
64 size_t IOSurfaceGetHeight(IOSurfaceRef buffer);
65 size_t IOSurfaceGetPropertyMaximum(CFStringRef property);
66 size_t IOSurfaceGetWidth(IOSurfaceRef buffer);
67 Boolean IOSurfaceIsInUse(IOSurfaceRef buffer);
68 IOReturn IOSurfaceLock(IOSurfaceRef buffer, uint32_t options, uint32_t *seed);
69 IOSurfaceRef IOSurfaceLookupFromMachPort(mach_port_t);
70 IOReturn IOSurfaceUnlock(IOSurfaceRef buffer, uint32_t options, uint32_t *seed);
71
72 WTF_EXTERN_C_END
73
74 #if USE(APPLE_INTERNAL_SDK)
75
76 #import <IOSurface/IOSurfacePrivate.h>
77
78 #else
79
80 enum {
81     kIOSurfacePurgeableNonVolatile = 0,
82     kIOSurfacePurgeableVolatile = 1,
83     kIOSurfacePurgeableEmpty = 2,
84     kIOSurfacePurgeableKeepCurrent = 3,
85 };
86
87 #endif
88
89 WTF_EXTERN_C_BEGIN
90
91 IOReturn IOSurfaceSetPurgeable(IOSurfaceRef buffer, uint32_t newState, uint32_t *oldState);
92
93 WTF_EXTERN_C_END
94
95 #endif // IOSurfaceSPI_h