michael@0: /* Copyright 2013 Mozilla Foundation and Mozilla contributors michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #ifndef GONKDISPLAY_H michael@0: #define GONKDISPLAY_H michael@0: michael@0: #include michael@0: michael@0: namespace mozilla { michael@0: michael@0: namespace layers { michael@0: class Layer; michael@0: } michael@0: michael@0: typedef void * EGLDisplay; michael@0: typedef void * EGLSurface; michael@0: michael@0: class GonkDisplay { michael@0: public: michael@0: virtual ANativeWindow* GetNativeWindow() = 0; michael@0: michael@0: virtual void SetEnabled(bool enabled) = 0; michael@0: michael@0: typedef void (*OnEnabledCallbackType)(bool enabled); michael@0: michael@0: virtual void OnEnabled(OnEnabledCallbackType callback) = 0; michael@0: michael@0: virtual void* GetHWCDevice() = 0; michael@0: michael@0: virtual void* GetFBSurface() = 0; michael@0: michael@0: virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur) = 0; michael@0: michael@0: virtual ANativeWindowBuffer* DequeueBuffer() = 0; michael@0: michael@0: virtual bool QueueBuffer(ANativeWindowBuffer* buf) = 0; michael@0: michael@0: virtual void UpdateFBSurface(EGLDisplay dpy, EGLSurface sur) = 0; michael@0: michael@0: /** michael@0: * Set FramebufferSurface ReleaseFence's file descriptor. michael@0: * ReleaseFence will be signaled after the HWC has finished reading michael@0: * from a buffer. michael@0: */ michael@0: virtual void SetFBReleaseFd(int fd) = 0; michael@0: michael@0: /** michael@0: * Get FramebufferSurface AcquireFence's file descriptor michael@0: * AcquireFence will be signaled when a buffer's content is available. michael@0: */ michael@0: virtual int GetPrevFBAcquireFd() = 0; michael@0: michael@0: float xdpi; michael@0: uint32_t surfaceformat; michael@0: }; michael@0: michael@0: __attribute__ ((weak)) michael@0: GonkDisplay* GetGonkDisplay(); michael@0: michael@0: } michael@0: #endif /* GONKDISPLAY_H */