|
1 /* Copyright 2013 Mozilla Foundation and Mozilla contributors |
|
2 * |
|
3 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 * you may not use this file except in compliance with the License. |
|
5 * You may obtain a copy of the License at |
|
6 * |
|
7 * http://www.apache.org/licenses/LICENSE-2.0 |
|
8 * |
|
9 * Unless required by applicable law or agreed to in writing, software |
|
10 * distributed under the License is distributed on an "AS IS" BASIS, |
|
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 * See the License for the specific language governing permissions and |
|
13 * limitations under the License. |
|
14 */ |
|
15 |
|
16 #ifndef GONKDISPLAY_H |
|
17 #define GONKDISPLAY_H |
|
18 |
|
19 #include <system/window.h> |
|
20 |
|
21 namespace mozilla { |
|
22 |
|
23 namespace layers { |
|
24 class Layer; |
|
25 } |
|
26 |
|
27 typedef void * EGLDisplay; |
|
28 typedef void * EGLSurface; |
|
29 |
|
30 class GonkDisplay { |
|
31 public: |
|
32 virtual ANativeWindow* GetNativeWindow() = 0; |
|
33 |
|
34 virtual void SetEnabled(bool enabled) = 0; |
|
35 |
|
36 typedef void (*OnEnabledCallbackType)(bool enabled); |
|
37 |
|
38 virtual void OnEnabled(OnEnabledCallbackType callback) = 0; |
|
39 |
|
40 virtual void* GetHWCDevice() = 0; |
|
41 |
|
42 virtual void* GetFBSurface() = 0; |
|
43 |
|
44 virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur) = 0; |
|
45 |
|
46 virtual ANativeWindowBuffer* DequeueBuffer() = 0; |
|
47 |
|
48 virtual bool QueueBuffer(ANativeWindowBuffer* buf) = 0; |
|
49 |
|
50 virtual void UpdateFBSurface(EGLDisplay dpy, EGLSurface sur) = 0; |
|
51 |
|
52 /** |
|
53 * Set FramebufferSurface ReleaseFence's file descriptor. |
|
54 * ReleaseFence will be signaled after the HWC has finished reading |
|
55 * from a buffer. |
|
56 */ |
|
57 virtual void SetFBReleaseFd(int fd) = 0; |
|
58 |
|
59 /** |
|
60 * Get FramebufferSurface AcquireFence's file descriptor |
|
61 * AcquireFence will be signaled when a buffer's content is available. |
|
62 */ |
|
63 virtual int GetPrevFBAcquireFd() = 0; |
|
64 |
|
65 float xdpi; |
|
66 uint32_t surfaceformat; |
|
67 }; |
|
68 |
|
69 __attribute__ ((weak)) |
|
70 GonkDisplay* GetGonkDisplay(); |
|
71 |
|
72 } |
|
73 #endif /* GONKDISPLAY_H */ |