-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Xcode9] Add IOSurface bindings #2363
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
79a593c
[Xcode9] Add IOSurface bindings
migueldeicaza 7d45675
Make dictionary internal, change the naming of these methods per Seba…
migueldeicaza e8372bf
Let tooling know about IOSurface
dalexsoto 849eb56
Move the availability to the top definition
migueldeicaza 12d9c87
Merge branch 'xcode9' into xcode9-iosurface
migueldeicaza 8275514
Add trailing comma in last enum value
rolfbjarne 9294510
Fix registrar error
dalexsoto ddd24a9
Merge remote-tracking branch 'origin/xcode9' into xcode9-iosurface
rolfbjarne 8408b2e
[src] Fix whitespace changes.
rolfbjarne d5beb91
[IOSurface] This framework was a private framework before iOS 11.
rolfbjarne 5bc4782
[introspection] Expand vocabulary to include 'Copyback'.
rolfbjarne ed599c8
[introspection/mtouch] The IOSurface only works in the simulator.
rolfbjarne 35318a7
[IOSurface] Remove unneeded comment.
rolfbjarne f3d172b
[IOSurface] Add missing availability attribute.
rolfbjarne 9236060
[introspection] IOSurface is only available in the simulator starting…
rolfbjarne 3c99edb
[IOSurface] Disable code to make IOSurface work on iOS 10.
rolfbjarne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// IOSurface | ||
// | ||
// Authors: | ||
// Miguel de Icaza (miguel@xamarin.com) | ||
// | ||
// Copyright 2017 Microsoft | ||
// | ||
|
||
using System; | ||
using XamCore.ObjCRuntime; | ||
|
||
namespace XamCore.IOSurface { | ||
|
||
public enum IOSurfaceLockOptions : uint { | ||
ReadOnly = 1, | ||
AvoidSync = 2 | ||
} | ||
|
||
public enum IOSurfacePurgeabilityState : uint { | ||
NonVolatile = 0, | ||
Volatile = 1, | ||
Empty = 2, | ||
KeepCurrent = 3 | ||
} | ||
|
||
// To be used with kIOSurfaceCacheMode or IOSurfacePropertyKeyCacheMode | ||
public enum IOSurfaceMemoryMap { | ||
DefaultCache = 0, | ||
InhibitCache = 1 << 8, | ||
WriteThruCache = 2 << 8, | ||
CopybackCache = 3 << 8, | ||
WriteCombineCache = 4 << 8, | ||
CopybackInnerCache = 5 << 8 | ||
}; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// | ||
// IOSurface.cs | ||
// | ||
// Copyright 2016 Microsoft | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
#if XAMCORE_2_0 | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using XamCore.CoreFoundation; | ||
using XamCore.ObjCRuntime; | ||
|
||
namespace XamCore.IOSurface { | ||
public partial class IOSurface { | ||
|
||
// kern_return_t | ||
[iOS (10,0), Mac(10,12)] | ||
public int Lock (IOSurfaceLockOptions options, ref int seed) | ||
{ | ||
unsafe { | ||
fixed (int *p = &seed){ | ||
return _Lock (options, (IntPtr) p); | ||
} | ||
} | ||
} | ||
|
||
// kern_return_t | ||
[iOS (10,0), Mac(10,12)] | ||
public int Lock (IOSurfaceLockOptions options) | ||
{ | ||
return _Lock (options, IntPtr.Zero); | ||
} | ||
|
||
// kern_return_t | ||
[iOS (10,0), Mac(10,12)] | ||
public int Unlock (IOSurfaceLockOptions options, ref int seed) | ||
{ | ||
unsafe { | ||
fixed (int *p = &seed){ | ||
return _Unlock (options, (IntPtr) p); | ||
} | ||
} | ||
} | ||
|
||
// kern_return_t | ||
[iOS (10,0), Mac(10,12)] | ||
public int Unlock (IOSurfaceLockOptions options) | ||
{ | ||
return _Unlock (options, IntPtr.Zero); | ||
} | ||
|
||
#if !MONOMAC | ||
// kern_return_t | ||
[iOS (11, 0)] | ||
public int SetPurgeable (IOSurfacePurgeabilityState newState, ref IOSurfacePurgeabilityState oldState) | ||
{ | ||
unsafe { | ||
fixed (IOSurfacePurgeabilityState *p = &oldState){ | ||
return _SetPurgeable (newState, (IntPtr) p); | ||
} | ||
} | ||
} | ||
|
||
[iOS (11, 0)] | ||
public int SetPurgeable (IOSurfacePurgeabilityState newState) | ||
{ | ||
return _SetPurgeable (newState, IntPtr.Zero); | ||
} | ||
#endif | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks incorrect, it's a new framework in iOS 11 and macOS 10.13.
Have you run the tests on an older simulator or devices ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not run this on older devices, but the API descriptions state that these APIs are available on iOS 10. It is not the first time that Apple makes these APIs available retroactively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested on an iOS 10.3 device, and it works (with some hacks since it's a private framework).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check that this (having strings pointing to a private framework) pass App Store submission
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also say we only support IOSurface.framework in iOS 11 (and remove the hack), and if someone requests it, we can add it then.