widget/gonk/libdisplay/GonkDisplay.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/gonk/libdisplay/GonkDisplay.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +/* Copyright 2013 Mozilla Foundation and Mozilla contributors
     1.5 + *
     1.6 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.7 + * you may not use this file except in compliance with the License.
     1.8 + * You may obtain a copy of the License at
     1.9 + *
    1.10 + *     http://www.apache.org/licenses/LICENSE-2.0
    1.11 + *
    1.12 + * Unless required by applicable law or agreed to in writing, software
    1.13 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.15 + * See the License for the specific language governing permissions and
    1.16 + * limitations under the License.
    1.17 + */
    1.18 +
    1.19 +#ifndef GONKDISPLAY_H
    1.20 +#define GONKDISPLAY_H
    1.21 +
    1.22 +#include <system/window.h>
    1.23 +
    1.24 +namespace mozilla {
    1.25 +
    1.26 +namespace layers {
    1.27 +class Layer;
    1.28 +}
    1.29 +
    1.30 +typedef void * EGLDisplay;
    1.31 +typedef void * EGLSurface;
    1.32 +
    1.33 +class GonkDisplay {
    1.34 +public:
    1.35 +    virtual ANativeWindow* GetNativeWindow() = 0;
    1.36 +
    1.37 +    virtual void SetEnabled(bool enabled) = 0;
    1.38 +
    1.39 +    typedef void (*OnEnabledCallbackType)(bool enabled);
    1.40 +
    1.41 +    virtual void OnEnabled(OnEnabledCallbackType callback) = 0;
    1.42 +
    1.43 +    virtual void* GetHWCDevice() = 0;
    1.44 +
    1.45 +    virtual void* GetFBSurface() = 0;
    1.46 +
    1.47 +    virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur) = 0;
    1.48 +
    1.49 +    virtual ANativeWindowBuffer* DequeueBuffer() = 0;
    1.50 +
    1.51 +    virtual bool QueueBuffer(ANativeWindowBuffer* buf) = 0;
    1.52 +
    1.53 +    virtual void UpdateFBSurface(EGLDisplay dpy, EGLSurface sur) = 0;
    1.54 +
    1.55 +    /**
    1.56 +     * Set FramebufferSurface ReleaseFence's file descriptor.
    1.57 +     * ReleaseFence will be signaled after the HWC has finished reading
    1.58 +     * from a buffer.
    1.59 +     */
    1.60 +    virtual void SetFBReleaseFd(int fd) = 0;
    1.61 +
    1.62 +    /**
    1.63 +     * Get FramebufferSurface AcquireFence's file descriptor
    1.64 +     * AcquireFence will be signaled when a buffer's content is available.
    1.65 +     */
    1.66 +    virtual int GetPrevFBAcquireFd() = 0;
    1.67 +
    1.68 +    float xdpi;
    1.69 +    uint32_t surfaceformat;
    1.70 +};
    1.71 +
    1.72 +__attribute__ ((weak))
    1.73 +GonkDisplay* GetGonkDisplay();
    1.74 +
    1.75 +}
    1.76 +#endif /* GONKDISPLAY_H */

mercurial