1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/ics/hardware/fb.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,164 @@ 1.4 +/* 1.5 + * Copyright (C) 2008 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 + 1.21 +#ifndef ANDROID_FB_INTERFACE_H 1.22 +#define ANDROID_FB_INTERFACE_H 1.23 + 1.24 +#include <stdint.h> 1.25 +#include <sys/cdefs.h> 1.26 +#include <sys/types.h> 1.27 + 1.28 +#include <cutils/native_handle.h> 1.29 + 1.30 +#include <hardware/hardware.h> 1.31 + 1.32 +__BEGIN_DECLS 1.33 + 1.34 +#define GRALLOC_HARDWARE_FB0 "fb0" 1.35 + 1.36 +/*****************************************************************************/ 1.37 + 1.38 + 1.39 +/*****************************************************************************/ 1.40 + 1.41 +typedef struct framebuffer_device_t { 1.42 + struct hw_device_t common; 1.43 + 1.44 + /* flags describing some attributes of the framebuffer */ 1.45 + const uint32_t flags; 1.46 + 1.47 + /* dimensions of the framebuffer in pixels */ 1.48 + const uint32_t width; 1.49 + const uint32_t height; 1.50 + 1.51 + /* frambuffer stride in pixels */ 1.52 + const int stride; 1.53 + 1.54 + /* framebuffer pixel format */ 1.55 + const int format; 1.56 + 1.57 + /* resolution of the framebuffer's display panel in pixel per inch*/ 1.58 + const float xdpi; 1.59 + const float ydpi; 1.60 + 1.61 + /* framebuffer's display panel refresh rate in frames per second */ 1.62 + const float fps; 1.63 + 1.64 + /* min swap interval supported by this framebuffer */ 1.65 + const int minSwapInterval; 1.66 + 1.67 + /* max swap interval supported by this framebuffer */ 1.68 + const int maxSwapInterval; 1.69 + 1.70 + int reserved[8]; 1.71 + 1.72 + /* 1.73 + * requests a specific swap-interval (same definition than EGL) 1.74 + * 1.75 + * Returns 0 on success or -errno on error. 1.76 + */ 1.77 + int (*setSwapInterval)(struct framebuffer_device_t* window, 1.78 + int interval); 1.79 + 1.80 + /* 1.81 + * This hook is OPTIONAL. 1.82 + * 1.83 + * It is non NULL If the framebuffer driver supports "update-on-demand" 1.84 + * and the given rectangle is the area of the screen that gets 1.85 + * updated during (*post)(). 1.86 + * 1.87 + * This is useful on devices that are able to DMA only a portion of 1.88 + * the screen to the display panel, upon demand -- as opposed to 1.89 + * constantly refreshing the panel 60 times per second, for instance. 1.90 + * 1.91 + * Only the area defined by this rectangle is guaranteed to be valid, that 1.92 + * is, the driver is not allowed to post anything outside of this 1.93 + * rectangle. 1.94 + * 1.95 + * The rectangle evaluated during (*post)() and specifies which area 1.96 + * of the buffer passed in (*post)() shall to be posted. 1.97 + * 1.98 + * return -EINVAL if width or height <=0, or if left or top < 0 1.99 + */ 1.100 + int (*setUpdateRect)(struct framebuffer_device_t* window, 1.101 + int left, int top, int width, int height); 1.102 + 1.103 + /* 1.104 + * Post <buffer> to the display (display it on the screen) 1.105 + * The buffer must have been allocated with the 1.106 + * GRALLOC_USAGE_HW_FB usage flag. 1.107 + * buffer must be the same width and height as the display and must NOT 1.108 + * be locked. 1.109 + * 1.110 + * The buffer is shown during the next VSYNC. 1.111 + * 1.112 + * If the same buffer is posted again (possibly after some other buffer), 1.113 + * post() will block until the the first post is completed. 1.114 + * 1.115 + * Internally, post() is expected to lock the buffer so that a 1.116 + * subsequent call to gralloc_module_t::(*lock)() with USAGE_RENDER or 1.117 + * USAGE_*_WRITE will block until it is safe; that is typically once this 1.118 + * buffer is shown and another buffer has been posted. 1.119 + * 1.120 + * Returns 0 on success or -errno on error. 1.121 + */ 1.122 + int (*post)(struct framebuffer_device_t* dev, buffer_handle_t buffer); 1.123 + 1.124 + 1.125 + /* 1.126 + * The (*compositionComplete)() method must be called after the 1.127 + * compositor has finished issuing GL commands for client buffers. 1.128 + */ 1.129 + 1.130 + int (*compositionComplete)(struct framebuffer_device_t* dev); 1.131 + 1.132 + /* 1.133 + * This hook is OPTIONAL. 1.134 + * 1.135 + * If non NULL it will be caused by SurfaceFlinger on dumpsys 1.136 + */ 1.137 + void (*dump)(struct framebuffer_device_t* dev, char *buff, int buff_len); 1.138 + 1.139 + /* 1.140 + * (*enableScreen)() is used to either blank (enable=0) or 1.141 + * unblank (enable=1) the screen this framebuffer is attached to. 1.142 + * 1.143 + * Returns 0 on success or -errno on error. 1.144 + */ 1.145 + int (*enableScreen)(struct framebuffer_device_t* dev, int enable); 1.146 + 1.147 + void* reserved_proc[6]; 1.148 + 1.149 +} framebuffer_device_t; 1.150 + 1.151 + 1.152 +/** convenience API for opening and closing a supported device */ 1.153 + 1.154 +static inline int framebuffer_open(const struct hw_module_t* module, 1.155 + struct framebuffer_device_t** device) { 1.156 + return module->methods->open(module, 1.157 + GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device); 1.158 +} 1.159 + 1.160 +static inline int framebuffer_close(struct framebuffer_device_t* device) { 1.161 + return device->common.close(&device->common); 1.162 +} 1.163 + 1.164 + 1.165 +__END_DECLS 1.166 + 1.167 +#endif // ANDROID_FB_INTERFACE_H