media/omx-plugin/include/ics/hardware/fb.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial