~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to include/android_stub/hardware/fb.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

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 <cutils/native_handle.h>
26
 
 
27
 
#include <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
 
    /**
40
 
     * Common methods of the framebuffer device.  This *must* be the first member of
41
 
     * framebuffer_device_t as users of this structure will cast a hw_device_t to
42
 
     * framebuffer_device_t pointer in contexts where it's known the hw_device_t references a
43
 
     * framebuffer_device_t.
44
 
     */
45
 
    struct hw_device_t common;
46
 
 
47
 
    /* flags describing some attributes of the framebuffer */
48
 
    const uint32_t  flags;
49
 
 
50
 
    /* dimensions of the framebuffer in pixels */
51
 
    const uint32_t  width;
52
 
    const uint32_t  height;
53
 
 
54
 
    /* frambuffer stride in pixels */
55
 
    const int       stride;
56
 
 
57
 
    /* framebuffer pixel format */
58
 
    const int       format;
59
 
 
60
 
    /* resolution of the framebuffer's display panel in pixel per inch*/
61
 
    const float     xdpi;
62
 
    const float     ydpi;
63
 
 
64
 
    /* framebuffer's display panel refresh rate in frames per second */
65
 
    const float     fps;
66
 
 
67
 
    /* min swap interval supported by this framebuffer */
68
 
    const int       minSwapInterval;
69
 
 
70
 
    /* max swap interval supported by this framebuffer */
71
 
    const int       maxSwapInterval;
72
 
 
73
 
    /* Number of framebuffers supported*/
74
 
    const int       numFramebuffers;
75
 
 
76
 
    int reserved[7];
77
 
 
78
 
    /*
79
 
     * requests a specific swap-interval (same definition than EGL)
80
 
     *
81
 
     * Returns 0 on success or -errno on error.
82
 
     */
83
 
    int (*setSwapInterval)(struct framebuffer_device_t* window,
84
 
            int interval);
85
 
 
86
 
    /*
87
 
     * This hook is OPTIONAL.
88
 
     *
89
 
     * It is non NULL If the framebuffer driver supports "update-on-demand"
90
 
     * and the given rectangle is the area of the screen that gets
91
 
     * updated during (*post)().
92
 
     *
93
 
     * This is useful on devices that are able to DMA only a portion of
94
 
     * the screen to the display panel, upon demand -- as opposed to
95
 
     * constantly refreshing the panel 60 times per second, for instance.
96
 
     *
97
 
     * Only the area defined by this rectangle is guaranteed to be valid, that
98
 
     * is, the driver is not allowed to post anything outside of this
99
 
     * rectangle.
100
 
     *
101
 
     * The rectangle evaluated during (*post)() and specifies which area
102
 
     * of the buffer passed in (*post)() shall to be posted.
103
 
     *
104
 
     * return -EINVAL if width or height <=0, or if left or top < 0
105
 
     */
106
 
    int (*setUpdateRect)(struct framebuffer_device_t* window,
107
 
            int left, int top, int width, int height);
108
 
 
109
 
    /*
110
 
     * Post <buffer> to the display (display it on the screen)
111
 
     * The buffer must have been allocated with the
112
 
     *   GRALLOC_USAGE_HW_FB usage flag.
113
 
     * buffer must be the same width and height as the display and must NOT
114
 
     * be locked.
115
 
     *
116
 
     * The buffer is shown during the next VSYNC.
117
 
     *
118
 
     * If the same buffer is posted again (possibly after some other buffer),
119
 
     * post() will block until the the first post is completed.
120
 
     *
121
 
     * Internally, post() is expected to lock the buffer so that a
122
 
     * subsequent call to gralloc_module_t::(*lock)() with USAGE_RENDER or
123
 
     * USAGE_*_WRITE will block until it is safe; that is typically once this
124
 
     * buffer is shown and another buffer has been posted.
125
 
     *
126
 
     * Returns 0 on success or -errno on error.
127
 
     */
128
 
    int (*post)(struct framebuffer_device_t* dev, buffer_handle_t buffer);
129
 
 
130
 
 
131
 
    /*
132
 
     * The (*compositionComplete)() method must be called after the
133
 
     * compositor has finished issuing GL commands for client buffers.
134
 
     */
135
 
 
136
 
    int (*compositionComplete)(struct framebuffer_device_t* dev);
137
 
 
138
 
    /*
139
 
     * This hook is OPTIONAL.
140
 
     *
141
 
     * If non NULL it will be caused by SurfaceFlinger on dumpsys
142
 
     */
143
 
    void (*dump)(struct framebuffer_device_t* dev, char *buff, int buff_len);
144
 
 
145
 
    /*
146
 
     * (*enableScreen)() is used to either blank (enable=0) or
147
 
     * unblank (enable=1) the screen this framebuffer is attached to.
148
 
     *
149
 
     * Returns 0 on success or -errno on error.
150
 
     */
151
 
    int (*enableScreen)(struct framebuffer_device_t* dev, int enable);
152
 
 
153
 
    void* reserved_proc[6];
154
 
 
155
 
} framebuffer_device_t;
156
 
 
157
 
 
158
 
/** convenience API for opening and closing a supported device */
159
 
 
160
 
static inline int framebuffer_open(const struct hw_module_t* module,
161
 
        struct framebuffer_device_t** device) {
162
 
    return module->methods->open(module,
163
 
            GRALLOC_HARDWARE_FB0, TO_HW_DEVICE_T_OPEN(device));
164
 
}
165
 
 
166
 
static inline int framebuffer_close(struct framebuffer_device_t* device) {
167
 
    return device->common.close(&device->common);
168
 
}
169
 
 
170
 
 
171
 
__END_DECLS
172
 
 
173
 
#endif  // ANDROID_FB_INTERFACE_H