1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_ACCELERATED_WIDGET_MAC_SURFACE_HANDLE_TYPES_H_
6 #define UI_ACCELERATED_WIDGET_MAC_SURFACE_HANDLE_TYPES_H_
8 #include <IOSurface/IOSurface.h>
9 #include <OpenGL/CGLIOSurface.h>
11 #include "base/basictypes.h"
12 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h"
13 #include "ui/base/cocoa/remote_layer_api.h"
17 // The surface handle passed between the GPU and browser process may refer to
18 // an IOSurface or a CAContext. These helper functions must be used to identify
19 // and translate between the types.
20 enum SurfaceHandleType
{
21 kSurfaceHandleTypeInvalid
,
22 kSurfaceHandleTypeIOSurface
,
23 kSurfaceHandleTypeCAContext
,
26 SurfaceHandleType
GetSurfaceHandleType(uint64 surface_handle
);
28 CAContextID
CAContextIDFromSurfaceHandle(uint64 surface_handle
);
29 IOSurfaceID
IOSurfaceIDFromSurfaceHandle(uint64 surface_handle
);
31 ACCELERATED_WIDGET_MAC_EXPORT
32 uint64
SurfaceHandleFromIOSurfaceID(IOSurfaceID io_surface_id
);
34 ACCELERATED_WIDGET_MAC_EXPORT
35 uint64
SurfaceHandleFromCAContextID(CAContextID ca_context_id
);
39 #endif // UI_ACCELERATED_WIDGET_MAC_SURFACE_HANDLE_TYPES_H_