~sergiusens/libhybris/autotests

« back to all changes in this revision

Viewing changes to hybris/include/android/hardware/fb.h

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2013-06-04 07:33:11 UTC
  • Revision ID: package-import@ubuntu.com-20130604073311-20ldi2hm1axkvjl1
Tags: upstream-0.1.0+git20130601+dfb2e26
ImportĀ upstreamĀ versionĀ 0.1.0+git20130601+dfb2e26

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2008 The Android Open Source Project
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
 
 
18
#ifndef ANDROID_FB_INTERFACE_H
 
19
#define ANDROID_FB_INTERFACE_H
 
20
 
 
21
#include <stdint.h>
 
22
#include <sys/cdefs.h>
 
23
#include <sys/types.h>
 
24
 
 
25
#include <android/version.h>
 
26
#include <android/cutils/native_handle.h>
 
27
#include <android/hardware/hardware.h>
 
28
 
 
29
__BEGIN_DECLS
 
30
 
 
31
#define GRALLOC_HARDWARE_FB0 "fb0"
 
32
 
 
33
/*****************************************************************************/
 
34
 
 
35
 
 
36
/*****************************************************************************/
 
37
 
 
38
typedef struct framebuffer_device_t {
 
39
    struct hw_device_t common;
 
40
 
 
41
    /* flags describing some attributes of the framebuffer */
 
42
    const uint32_t  flags;
 
43
 
 
44
    /* dimensions of the framebuffer in pixels */
 
45
    const uint32_t  width;
 
46
    const uint32_t  height;
 
47
 
 
48
    /* frambuffer stride in pixels */
 
49
    const int       stride;
 
50
 
 
51
    /* framebuffer pixel format */
 
52
    const int       format;
 
53
 
 
54
    /* resolution of the framebuffer's display panel in pixel per inch*/
 
55
    const float     xdpi;
 
56
    const float     ydpi;
 
57
 
 
58
    /* framebuffer's display panel refresh rate in frames per second */
 
59
    const float     fps;
 
60
 
 
61
    /* min swap interval supported by this framebuffer */
 
62
    const int       minSwapInterval;
 
63
 
 
64
    /* max swap interval supported by this framebuffer */
 
65
    const int       maxSwapInterval;
 
66
 
 
67
#if defined(ANDROID_VERSION) && ANDROID_VERSION>=0x410
 
68
    /* Number of framebuffers supported*/
 
69
    const int       numFramebuffers;
 
70
 
 
71
    int reserved[7];
 
72
#else
 
73
    int reserved[8];
 
74
#endif
 
75
 
 
76
    /*
 
77
     * requests a specific swap-interval (same definition than EGL)
 
78
     *
 
79
     * Returns 0 on success or -errno on error.
 
80
     */
 
81
    int (*setSwapInterval)(struct framebuffer_device_t* window,
 
82
            int interval);
 
83
 
 
84
    /*
 
85
     * This hook is OPTIONAL.
 
86
     *
 
87
     * It is non NULL If the framebuffer driver supports "update-on-demand"
 
88
     * and the given rectangle is the area of the screen that gets
 
89
     * updated during (*post)().
 
90
     *
 
91
     * This is useful on devices that are able to DMA only a portion of
 
92
     * the screen to the display panel, upon demand -- as opposed to
 
93
     * constantly refreshing the panel 60 times per second, for instance.
 
94
     *
 
95
     * Only the area defined by this rectangle is guaranteed to be valid, that
 
96
     * is, the driver is not allowed to post anything outside of this
 
97
     * rectangle.
 
98
     *
 
99
     * The rectangle evaluated during (*post)() and specifies which area
 
100
     * of the buffer passed in (*post)() shall to be posted.
 
101
     *
 
102
     * return -EINVAL if width or height <=0, or if left or top < 0
 
103
     */
 
104
    int (*setUpdateRect)(struct framebuffer_device_t* window,
 
105
            int left, int top, int width, int height);
 
106
 
 
107
    /*
 
108
     * Post <buffer> to the display (display it on the screen)
 
109
     * The buffer must have been allocated with the
 
110
     *   GRALLOC_USAGE_HW_FB usage flag.
 
111
     * buffer must be the same width and height as the display and must NOT
 
112
     * be locked.
 
113
     *
 
114
     * The buffer is shown during the next VSYNC.
 
115
     *
 
116
     * If the same buffer is posted again (possibly after some other buffer),
 
117
     * post() will block until the the first post is completed.
 
118
     *
 
119
     * Internally, post() is expected to lock the buffer so that a
 
120
     * subsequent call to gralloc_module_t::(*lock)() with USAGE_RENDER or
 
121
     * USAGE_*_WRITE will block until it is safe; that is typically once this
 
122
     * buffer is shown and another buffer has been posted.
 
123
     *
 
124
     * Returns 0 on success or -errno on error.
 
125
     */
 
126
    int (*post)(struct framebuffer_device_t* dev, buffer_handle_t buffer);
 
127
 
 
128
 
 
129
    /*
 
130
     * The (*compositionComplete)() method must be called after the
 
131
     * compositor has finished issuing GL commands for client buffers.
 
132
     */
 
133
 
 
134
    int (*compositionComplete)(struct framebuffer_device_t* dev);
 
135
 
 
136
    /*
 
137
     * This hook is OPTIONAL.
 
138
     *
 
139
     * If non NULL it will be caused by SurfaceFlinger on dumpsys
 
140
     */
 
141
    void (*dump)(struct framebuffer_device_t* dev, char *buff, int buff_len);
 
142
 
 
143
    /*
 
144
     * (*enableScreen)() is used to either blank (enable=0) or
 
145
     * unblank (enable=1) the screen this framebuffer is attached to.
 
146
     *
 
147
     * Returns 0 on success or -errno on error.
 
148
     */
 
149
    int (*enableScreen)(struct framebuffer_device_t* dev, int enable);
 
150
 
 
151
    void* reserved_proc[6];
 
152
 
 
153
} framebuffer_device_t;
 
154
 
 
155
 
 
156
/** convenience API for opening and closing a supported device */
 
157
 
 
158
static inline int framebuffer_open(const struct hw_module_t* module,
 
159
        struct framebuffer_device_t** device) {
 
160
    return module->methods->open(module,
 
161
            GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device);
 
162
}
 
163
 
 
164
static inline int framebuffer_close(struct framebuffer_device_t* device) {
 
165
    return device->common.close(&device->common);
 
166
}
 
167
 
 
168
 
 
169
__END_DECLS
 
170
 
 
171
#endif  // ANDROID_FB_INTERFACE_H