Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: ui/gl/io_surface_support_mac.h

Issue 77023002: gpu: Add IOSurface backed GpuMemoryBuffer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GL_IO_SURFACE_SUPPORT_MAC_H_ 5 #ifndef UI_GL_IO_SURFACE_SUPPORT_MAC_H_
6 #define UI_GL_IO_SURFACE_SUPPORT_MAC_H_ 6 #define UI_GL_IO_SURFACE_SUPPORT_MAC_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 #include <CoreVideo/CoreVideo.h> 9 #include <CoreVideo/CoreVideo.h>
10 #include <mach/mach.h> 10 #include <mach/mach.h>
11 #include <OpenGL/OpenGL.h> 11 #include <OpenGL/OpenGL.h>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "ui/gl/gl_export.h" 14 #include "ui/gl/gl_export.h"
15 15
16 // This Mac OS X-specific class provides dynamically-linked access to 16 // This Mac OS X-specific class provides dynamically-linked access to
17 // IOSurface.framework, which is only available on 10.6 and later. 17 // IOSurface.framework, which is only available on 10.6 and later.
18 // Since Chromium is built on 10.5 we must dynamically look up all of 18 // Since Chromium is built on 10.5 we must dynamically look up all of
19 // the entry points we need in this framework. 19 // the entry points we need in this framework.
20 20
21 // See IOSurface/IOSurfaceAPI.h and OpenGL/CGLIOSurface.h on 10.6 for 21 // See IOSurface/IOSurfaceAPI.h and OpenGL/CGLIOSurface.h on 10.6 for
22 // documentation of the fields and methods of this class. 22 // documentation of the fields and methods of this class.
23 23
24 class GL_EXPORT IOSurfaceSupport { 24 class GL_EXPORT IOSurfaceSupport {
Ken Russell (switch to Gerrit) 2013/12/03 22:36:13 Now that Chrome doesn't need to run on 10.5 any mo
reveman 2013/12/04 02:00:31 Done. crbug.com/325572
25 public: 25 public:
26 // Returns an instance of the IOSurfaceSupport class if the 26 // Returns an instance of the IOSurfaceSupport class if the
27 // operating system supports it, NULL otherwise. It is safe to call 27 // operating system supports it, NULL otherwise. It is safe to call
28 // this multiple times. 28 // this multiple times.
29 static IOSurfaceSupport* Initialize(); 29 static IOSurfaceSupport* Initialize();
30 30
31 virtual CFStringRef GetKIOSurfaceWidth() = 0; 31 virtual CFStringRef GetKIOSurfaceWidth() = 0;
32 virtual CFStringRef GetKIOSurfaceHeight() = 0; 32 virtual CFStringRef GetKIOSurfaceHeight() = 0;
33 virtual CFStringRef GetKIOSurfaceBytesPerElement() = 0; 33 virtual CFStringRef GetKIOSurfaceBytesPerElement() = 0;
34 virtual CFStringRef GetKIOSurfacePixelFormat() = 0;
34 virtual CFStringRef GetKIOSurfaceIsGlobal() = 0; 35 virtual CFStringRef GetKIOSurfaceIsGlobal() = 0;
35 36
36 virtual CFTypeRef IOSurfaceCreate(CFDictionaryRef properties) = 0; 37 virtual CFTypeRef IOSurfaceCreate(CFDictionaryRef properties) = 0;
37 38
38 // The following two APIs assume the IOSurface was created with the 39 // The following two APIs assume the IOSurface was created with the
39 // kIOSurfaceIsGlobal key set to true 40 // kIOSurfaceIsGlobal key set to true
40 virtual uint32 IOSurfaceGetID(CFTypeRef io_surface) = 0; 41 virtual uint32 IOSurfaceGetID(CFTypeRef io_surface) = 0;
41 virtual CFTypeRef IOSurfaceLookup(uint32 io_surface_id) = 0; 42 virtual CFTypeRef IOSurfaceLookup(uint32 io_surface_id) = 0;
42 43
43 // The following two APIs are more robust and secure, but 44 // The following two APIs are more robust and secure, but
44 // unfortunately it looks like it will be a lot of work to correctly 45 // unfortunately it looks like it will be a lot of work to correctly
45 // transmit a mach port from process to process (possibly requiring 46 // transmit a mach port from process to process (possibly requiring
46 // a side channel for or extension of the Chrome IPC mechanism) 47 // a side channel for or extension of the Chrome IPC mechanism)
47 virtual mach_port_t IOSurfaceCreateMachPort(CFTypeRef io_surface) = 0; 48 virtual mach_port_t IOSurfaceCreateMachPort(CFTypeRef io_surface) = 0;
48 virtual CFTypeRef IOSurfaceLookupFromMachPort(mach_port_t port) = 0; 49 virtual CFTypeRef IOSurfaceLookupFromMachPort(mach_port_t port) = 0;
49 50
50 virtual size_t IOSurfaceGetWidth(CFTypeRef io_surface) = 0; 51 virtual size_t IOSurfaceGetWidth(CFTypeRef io_surface) = 0;
51 virtual size_t IOSurfaceGetHeight(CFTypeRef io_surface) = 0; 52 virtual size_t IOSurfaceGetHeight(CFTypeRef io_surface) = 0;
53 virtual size_t IOSurfaceGetBytesPerRow(CFTypeRef io_surface) = 0;
54 virtual void* IOSurfaceGetBaseAddress(CFTypeRef io_surface) = 0;
55
56 virtual IOReturn IOSurfaceLock(CFTypeRef io_surface,
57 uint32 options,
58 uint32* seed) = 0;
59 virtual IOReturn IOSurfaceUnlock(CFTypeRef io_surface,
60 uint32 options,
61 uint32* seed) = 0;
52 62
53 virtual CGLError CGLTexImageIOSurface2D(CGLContextObj ctx, 63 virtual CGLError CGLTexImageIOSurface2D(CGLContextObj ctx,
54 GLenum target, 64 GLenum target,
55 GLenum internal_format, 65 GLenum internal_format,
56 GLsizei width, 66 GLsizei width,
57 GLsizei height, 67 GLsizei height,
58 GLenum format, 68 GLenum format,
59 GLenum type, 69 GLenum type,
60 CFTypeRef io_surface, 70 CFTypeRef io_surface,
61 GLuint plane) = 0; 71 GLuint plane) = 0;
62 72
63 virtual CFTypeRef CVPixelBufferGetIOSurface( 73 virtual CFTypeRef CVPixelBufferGetIOSurface(
64 CVPixelBufferRef pixel_buffer) = 0; 74 CVPixelBufferRef pixel_buffer) = 0;
65 75
66 protected: 76 protected:
67 IOSurfaceSupport(); 77 IOSurfaceSupport();
68 virtual ~IOSurfaceSupport(); 78 virtual ~IOSurfaceSupport();
69 79
70 DISALLOW_COPY_AND_ASSIGN(IOSurfaceSupport); 80 DISALLOW_COPY_AND_ASSIGN(IOSurfaceSupport);
71 }; 81 };
72 82
73 #endif // UI_GL_IO_SURFACE_SUPPORT_MAC_H_ 83 #endif // UI_GL_IO_SURFACE_SUPPORT_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698