diff options
-rw-r--r-- | hwc/hwc.c | 113 | ||||
-rw-r--r-- | kernel-headers/linux/omapfb.h | 231 | ||||
-rw-r--r-- | omap4.mk | 1 | ||||
-rw-r--r-- | original-kernel-headers/linux/omapfb.h | 274 |
4 files changed, 597 insertions, 22 deletions
@@ -22,7 +22,9 @@ #include <poll.h> #include <sys/ioctl.h> #include <linux/fb.h> +#include <linux/omapfb.h> #include <sys/mman.h> +#include <sys/resource.h> #include <cutils/properties.h> #include <cutils/log.h> @@ -30,15 +32,12 @@ #include <hardware/hardware.h> #include <hardware/hwcomposer.h> #include <EGL/egl.h> -#include <utils/Timers.h> #include <hardware_legacy/uevent.h> #include <png.h> -#define ASPECT_RATIO_TOLERANCE 0.02f +#include <system/graphics.h> -#ifndef FBIO_WAITFORVSYNC -#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) -#endif +#define ASPECT_RATIO_TOLERANCE 0.02f #define min(a, b) ( { typeof(a) __a = (a), __b = (b); __a < __b ? __a : __b; } ) #define max(a, b) ( { typeof(a) __a = (a), __b = (b); __a > __b ? __a : __b; } ) @@ -1733,26 +1732,45 @@ static void handle_hotplug(omap4_hwc_device_t *hwc_dev) hwc_dev->procs->invalidate(hwc_dev->procs); } -static void handle_uevents(omap4_hwc_device_t *hwc_dev, const char *s) +static void handle_uevents(omap4_hwc_device_t *hwc_dev, const char *buff, int len) { - int dock = !strcmp(s, "change@/devices/virtual/switch/dock"); - if (!dock && - strcmp(s, "change@/devices/virtual/switch/hdmi")) - return; + int dock; + int hdmi; + int vsync; + int state = 0; + uint64_t timestamp = 0; + const char *s = buff; + + dock = !strcmp(s, "change@/devices/virtual/switch/dock"); + hdmi = !strcmp(s, "change@/devices/virtual/switch/hdmi"); + vsync = !strcmp(s, "change@/devices/virtual/switch/omapfb-vsync"); + + if (!dock && !vsync && !hdmi) + return; s += strlen(s) + 1; while(*s) { - if (!strncmp(s, "SWITCH_STATE=", strlen("SWITCH_STATE="))) { - int state = atoi(s + strlen("SWITCH_STATE=")); - if (dock) - hwc_dev->ext.force_dock = state == 1; - else - hwc_dev->ext.hdmi_state = state == 1; - handle_hotplug(hwc_dev); - } + if (!strncmp(s, "SWITCH_STATE=", strlen("SWITCH_STATE="))) + state = atoi(s + strlen("SWITCH_STATE=")); + else if (!strncmp(s, "SWITCH_TIME=", strlen("SWITCH_TIME="))) + timestamp = strtoull(s + strlen("SWITCH_TIME="), NULL, 0); s += strlen(s) + 1; + if (s - buff >= len) + break; + } + + if (vsync) { + if (hwc_dev->procs && hwc_dev->procs->vsync) { + hwc_dev->procs->vsync(hwc_dev->procs, 0, timestamp); + } + } else { + if (dock) + hwc_dev->ext.force_dock = state == 1; + else + hwc_dev->ext.hdmi_state = state == 1; + handle_hotplug(hwc_dev); } } @@ -1765,6 +1783,8 @@ static void *omap4_hwc_hdmi_thread(void *data) int timeout; int err; + setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY); + uevent_init(); fds[0].fd = uevent_get_fd(); @@ -1814,8 +1834,8 @@ static void *omap4_hwc_hdmi_thread(void *data) if (fds[0].revents & POLLIN) { /* keep last 2 zeroes to ensure double 0 termination */ - uevent_next_event(uevent_desc, sizeof(uevent_desc) - 2); - handle_uevents(hwc_dev, uevent_desc); + int len = uevent_next_event(uevent_desc, sizeof(uevent_desc) - 2); + handle_uevents(hwc_dev, uevent_desc, len); } } while (1); @@ -1830,6 +1850,53 @@ static void omap4_hwc_registerProcs(struct hwc_composer_device* dev, hwc_dev->procs = (typeof(hwc_dev->procs)) procs; } +static int omap4_hwc_query(struct hwc_composer_device* dev, + int what, int* value) +{ + omap4_hwc_device_t *hwc_dev = (omap4_hwc_device_t *) dev; + + switch (what) { + case HWC_BACKGROUND_LAYER_SUPPORTED: + // we don't support the background layer yet + value[0] = 0; + break; + case HWC_VSYNC_PERIOD: + // vsync period in nanosecond + value[0] = 1000000000.0 / hwc_dev->fb_dev->base.fps; + break; + default: + // unsupported query + return -EINVAL; + } + return 0; +} + +static int omap4_hwc_event_control(struct hwc_composer_device* dev, + int event, int enabled) +{ + omap4_hwc_device_t *hwc_dev = (omap4_hwc_device_t *) dev; + + switch (event) { + case HWC_EVENT_VSYNC: + { + int val = !!enabled; + int err; + + err = ioctl(hwc_dev->fb_fd, OMAPFB_ENABLEVSYNC, &val); + if (err < 0) + return -errno; + + return 0; + } + default: + return -EINVAL; + } +} + +struct hwc_methods omap4_hwc_methods = { + .eventControl = &omap4_hwc_event_control, +}; + static int omap4_hwc_device_open(const hw_module_t* module, const char* name, hw_device_t** device) { @@ -1860,13 +1927,15 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name, memset(hwc_dev, 0, sizeof(*hwc_dev)); hwc_dev->base.common.tag = HARDWARE_DEVICE_TAG; - hwc_dev->base.common.version = HWC_DEVICE_API_VERSION; + hwc_dev->base.common.version = HWC_DEVICE_API_VERSION_0_3; hwc_dev->base.common.module = (hw_module_t *)module; hwc_dev->base.common.close = omap4_hwc_device_close; hwc_dev->base.prepare = omap4_hwc_prepare; hwc_dev->base.set = omap4_hwc_set; hwc_dev->base.dump = omap4_hwc_dump; hwc_dev->base.registerProcs = omap4_hwc_registerProcs; + hwc_dev->base.query = omap4_hwc_query; + hwc_dev->base.methods = &omap4_hwc_methods; hwc_dev->fb_dev = hwc_mod->fb_dev; *device = &hwc_dev->base.common; @@ -2009,7 +2078,7 @@ omap4_hwc_module_t HAL_MODULE_INFO_SYM = { .base = { .common = { .tag = HARDWARE_MODULE_TAG, - .module_api_version = HWC_MODULE_API_VERSION, + .module_api_version = HWC_MODULE_API_VERSION_0_1, .hal_api_version = HARDWARE_HAL_API_VERSION, .id = HWC_HARDWARE_MODULE_ID, .name = "OMAP 44xx Hardware Composer HAL", diff --git a/kernel-headers/linux/omapfb.h b/kernel-headers/linux/omapfb.h new file mode 100644 index 0000000..08ab25e --- /dev/null +++ b/kernel-headers/linux/omapfb.h @@ -0,0 +1,231 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __LINUX_OMAPFB_H__ +#define __LINUX_OMAPFB_H__ +#include <linux/fb.h> +#include <linux/ioctl.h> +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#include <linux/types.h> +#define OMAP_IOW(num, dtype) _IOW('O', num, dtype) +#define OMAP_IOR(num, dtype) _IOR('O', num, dtype) +#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAP_IO(num) _IO('O', num) +#define OMAPFB_MIRROR OMAP_IOW(31, int) +#define OMAPFB_SYNC_GFX OMAP_IO(37) +#define OMAPFB_VSYNC OMAP_IO(38) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) +#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps) +#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) +#define OMAPFB_LCD_TEST OMAP_IOW(45, int) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_CTRL_TEST OMAP_IOW(46, int) +#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old) +#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) +#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info) +#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info) +#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window) +#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info) +#define OMAPFB_WAITFORVSYNC OMAP_IO(57) +#define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read) +#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_WAITFORGO OMAP_IO(60) +#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) +#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) +#define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_ENABLEVSYNC OMAP_IOW(64, int) +#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff +#define OMAPFB_CAPS_LCDC_MASK 0x00fff000 +#define OMAPFB_CAPS_PANEL_MASK 0xff000000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 +#define OMAPFB_CAPS_TEARSYNC 0x00002000 +#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000 +#define OMAPFB_CAPS_PLANE_SCALE 0x00008000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000 +#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000 +#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000 +#define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 +#define OMAPFB_FORMAT_MASK 0x00ff +#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 +#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400 +#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800 +#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000 +#define OMAPFB_MEMTYPE_SDRAM 0 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define OMAPFB_MEMTYPE_SRAM 1 +#define OMAPFB_MEMTYPE_MAX 1 +#define OMAPFB_MEM_IDX_ENABLED 0x80 +#define OMAPFB_MEM_IDX_MASK 0x7f +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +enum omapfb_color_format { + OMAPFB_COLOR_RGB565 = 0, + OMAPFB_COLOR_YUV422, + OMAPFB_COLOR_YUV420, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + OMAPFB_COLOR_CLUT_8BPP, + OMAPFB_COLOR_CLUT_4BPP, + OMAPFB_COLOR_CLUT_2BPP, + OMAPFB_COLOR_CLUT_1BPP, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + OMAPFB_COLOR_RGB444, + OMAPFB_COLOR_YUY422, + OMAPFB_COLOR_ARGB16, + OMAPFB_COLOR_RGB24U, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + OMAPFB_COLOR_RGB24P, + OMAPFB_COLOR_ARGB32, + OMAPFB_COLOR_RGBA32, + OMAPFB_COLOR_RGBX32, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct omapfb_update_window { + __u32 x, y; + __u32 width, height; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 format; + __u32 out_x, out_y; + __u32 out_width, out_height; + __u32 reserved[8]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct omapfb_update_window_old { + __u32 x, y; + __u32 width, height; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 format; +}; +enum omapfb_plane { + OMAPFB_PLANE_GFX = 0, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + OMAPFB_PLANE_VID1, + OMAPFB_PLANE_VID2, +}; +enum omapfb_channel_out { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + OMAPFB_CHANNEL_OUT_LCD = 0, + OMAPFB_CHANNEL_OUT_DIGIT, +}; +struct omapfb_plane_info { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 pos_x; + __u32 pos_y; + __u8 enabled; + __u8 channel_out; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u8 mirror; + __u8 mem_idx; + __u32 out_width; + __u32 out_height; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 reserved2[12]; +}; +struct omapfb_mem_info { + __u32 size; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u8 type; + __u8 reserved[3]; +}; +struct omapfb_caps { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 ctrl; + __u32 plane_color; + __u32 wnd_color; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +enum omapfb_color_key_type { + OMAPFB_COLOR_KEY_DISABLED = 0, + OMAPFB_COLOR_KEY_GFX_DST, + OMAPFB_COLOR_KEY_VID_SRC, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct omapfb_color_key { + __u8 channel_out; + __u32 background; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 trans_key; + __u8 key_type; +}; +enum omapfb_update_mode { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + OMAPFB_UPDATE_DISABLED = 0, + OMAPFB_AUTO_UPDATE, + OMAPFB_MANUAL_UPDATE +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct omapfb_memory_read { + __u16 x; + __u16 y; + __u16 w; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u16 h; + size_t buffer_size; + void __user *buffer; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct omapfb_ovl_colormode { + __u8 overlay_idx; + __u8 mode_idx; + __u32 bits_per_pixel; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 nonstd; + struct fb_bitfield red; + struct fb_bitfield green; + struct fb_bitfield blue; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct fb_bitfield transp; +}; +struct omapfb_vram_info { + __u32 total; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 free; + __u32 largest_free_block; + __u32 reserved[5]; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct omapfb_tearsync_info { + __u8 enabled; + __u8 reserved1[3]; + __u16 line; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u16 reserved2; +}; +struct omapfb_display_info { + __u16 xres; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u16 yres; + __u32 width; + __u32 height; + __u32 reserved[5]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#endif + @@ -36,3 +36,4 @@ PRODUCT_PACKAGES := \ tf_daemon \ libtf_crypto_sst +PRODUCT_VENDOR_KERNEL_HEADERS := hardware/ti/omap4xxx/kernel-headers diff --git a/original-kernel-headers/linux/omapfb.h b/original-kernel-headers/linux/omapfb.h new file mode 100644 index 0000000..80c5dc6 --- /dev/null +++ b/original-kernel-headers/linux/omapfb.h @@ -0,0 +1,274 @@ +/* + * File: include/linux/omapfb.h + * + * Framebuffer driver for TI OMAP boards + * + * Copyright (C) 2004 Nokia Corporation + * Author: Imre Deak <imre.deak@nokia.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __LINUX_OMAPFB_H__ +#define __LINUX_OMAPFB_H__ + +#include <linux/fb.h> +#include <linux/ioctl.h> +#include <linux/types.h> + +/* IOCTL commands. */ + +#define OMAP_IOW(num, dtype) _IOW('O', num, dtype) +#define OMAP_IOR(num, dtype) _IOR('O', num, dtype) +#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype) +#define OMAP_IO(num) _IO('O', num) + +#define OMAPFB_MIRROR OMAP_IOW(31, int) +#define OMAPFB_SYNC_GFX OMAP_IO(37) +#define OMAPFB_VSYNC OMAP_IO(38) +#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) +#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps) +#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) +#define OMAPFB_LCD_TEST OMAP_IOW(45, int) +#define OMAPFB_CTRL_TEST OMAP_IOW(46, int) +#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old) +#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) +#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key) +#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info) +#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info) +#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window) +#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info) +#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info) +#define OMAPFB_WAITFORVSYNC OMAP_IO(57) +#define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read) +#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode) +#define OMAPFB_WAITFORGO OMAP_IO(60) +#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) +#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) +#define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info) +#define OMAPFB_ENABLEVSYNC OMAP_IOW(64, int) + +#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff +#define OMAPFB_CAPS_LCDC_MASK 0x00fff000 +#define OMAPFB_CAPS_PANEL_MASK 0xff000000 + +#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 +#define OMAPFB_CAPS_TEARSYNC 0x00002000 +#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000 +#define OMAPFB_CAPS_PLANE_SCALE 0x00008000 +#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000 +#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000 +#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000 +#define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000 +#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 + +/* Values from DSP must map to lower 16-bits */ +#define OMAPFB_FORMAT_MASK 0x00ff +#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 +#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200 +#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400 +#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800 +#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000 + +#define OMAPFB_MEMTYPE_SDRAM 0 +#define OMAPFB_MEMTYPE_SRAM 1 +#define OMAPFB_MEMTYPE_MAX 1 + +#define OMAPFB_MEM_IDX_ENABLED 0x80 +#define OMAPFB_MEM_IDX_MASK 0x7f + +enum omapfb_color_format { + OMAPFB_COLOR_RGB565 = 0, + OMAPFB_COLOR_YUV422, + OMAPFB_COLOR_YUV420, + OMAPFB_COLOR_CLUT_8BPP, + OMAPFB_COLOR_CLUT_4BPP, + OMAPFB_COLOR_CLUT_2BPP, + OMAPFB_COLOR_CLUT_1BPP, + OMAPFB_COLOR_RGB444, + OMAPFB_COLOR_YUY422, + + OMAPFB_COLOR_ARGB16, + OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */ + OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */ + OMAPFB_COLOR_ARGB32, + OMAPFB_COLOR_RGBA32, + OMAPFB_COLOR_RGBX32, +}; + +struct omapfb_update_window { + __u32 x, y; + __u32 width, height; + __u32 format; + __u32 out_x, out_y; + __u32 out_width, out_height; + __u32 reserved[8]; +}; + +struct omapfb_update_window_old { + __u32 x, y; + __u32 width, height; + __u32 format; +}; + +enum omapfb_plane { + OMAPFB_PLANE_GFX = 0, + OMAPFB_PLANE_VID1, + OMAPFB_PLANE_VID2, +}; + +enum omapfb_channel_out { + OMAPFB_CHANNEL_OUT_LCD = 0, + OMAPFB_CHANNEL_OUT_DIGIT, +}; + +struct omapfb_plane_info { + __u32 pos_x; + __u32 pos_y; + __u8 enabled; + __u8 channel_out; + __u8 mirror; + __u8 mem_idx; + __u32 out_width; + __u32 out_height; + __u32 reserved2[12]; +}; + +struct omapfb_mem_info { + __u32 size; + __u8 type; + __u8 reserved[3]; +}; + +struct omapfb_caps { + __u32 ctrl; + __u32 plane_color; + __u32 wnd_color; +}; + +enum omapfb_color_key_type { + OMAPFB_COLOR_KEY_DISABLED = 0, + OMAPFB_COLOR_KEY_GFX_DST, + OMAPFB_COLOR_KEY_VID_SRC, +}; + +struct omapfb_color_key { + __u8 channel_out; + __u32 background; + __u32 trans_key; + __u8 key_type; +}; + +enum omapfb_update_mode { + OMAPFB_UPDATE_DISABLED = 0, + OMAPFB_AUTO_UPDATE, + OMAPFB_MANUAL_UPDATE +}; + +struct omapfb_memory_read { + __u16 x; + __u16 y; + __u16 w; + __u16 h; + size_t buffer_size; + void __user *buffer; +}; + +struct omapfb_ovl_colormode { + __u8 overlay_idx; + __u8 mode_idx; + __u32 bits_per_pixel; + __u32 nonstd; + struct fb_bitfield red; + struct fb_bitfield green; + struct fb_bitfield blue; + struct fb_bitfield transp; +}; + +struct omapfb_vram_info { + __u32 total; + __u32 free; + __u32 largest_free_block; + __u32 reserved[5]; +}; + +struct omapfb_tearsync_info { + __u8 enabled; + __u8 reserved1[3]; + __u16 line; + __u16 reserved2; +}; + +struct omapfb_display_info { + __u16 xres; + __u16 yres; + __u32 width; /* phys width of the display in micrometers */ + __u32 height; /* phys height of the display in micrometers */ + __u32 reserved[5]; +}; + +#ifdef __KERNEL__ + +#include <plat/board.h> + +#ifdef CONFIG_ARCH_OMAP1 +#define OMAPFB_PLANE_NUM 1 +#else +#define OMAPFB_PLANE_NUM 3 +#endif + +struct omapfb_mem_region { + u32 paddr; + void __iomem *vaddr; + unsigned long size; + u8 type; /* OMAPFB_PLANE_MEM_* */ + enum omapfb_color_format format;/* OMAPFB_COLOR_* */ + unsigned format_used:1; /* Must be set when format is set. + * Needed b/c of the badly chosen 0 + * base for OMAPFB_COLOR_* values + */ + unsigned alloc:1; /* allocated by the driver */ + unsigned map:1; /* kernel mapped by the driver */ +}; + +struct omapfb_mem_desc { + int region_cnt; + struct omapfb_mem_region region[OMAPFB_PLANE_NUM]; +}; + +struct omapfb_platform_data { + struct omap_lcd_config lcd; + struct omapfb_mem_desc mem_desc; + void *ctrl_platform_data; +}; + +/* in arch/arm/plat-omap/fb.c */ +extern void omapfb_set_platform_data(struct omapfb_platform_data *data); +extern void omapfb_set_ctrl_platform_data(void *pdata); +extern void omapfb_reserve_sdram_memblock(void); + +/* helper methods that may be used by other modules */ +enum omap_color_mode; +struct omap_video_timings; +int omapfb_mode_to_dss_mode(struct fb_var_screeninfo *var, + enum omap_color_mode *mode); +void omapfb_fb2dss_timings(struct fb_videomode *fb_timings, + struct omap_video_timings *dss_timings); +void omapfb_dss2fb_timings(struct omap_video_timings *dss_timings, + struct fb_videomode *fb_timings); + +#endif + +#endif /* __OMAPFB_H */ |