/* * Copyright (C) 2007-2012 Allwinner Technology Co., Ltd. * * 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 __SUNXI_DISP_IOCTL_H__ #define __SUNXI_DISP_IOCTL_H__ #define __bool signed char /* for tracking the ioctls API/ABI */ #define SUNXI_DISP_VERSION_MAJOR 1 #define SUNXI_DISP_VERSION_MINOR 0 #define SUNXI_DISP_VERSION ((SUNXI_DISP_VERSION_MAJOR << 16) | SUNXI_DISP_VERSION_MINOR) #define SUNXI_DISP_VERSION_MAJOR_GET(x) (((x) >> 16) & 0x7FFF) #define SUNXI_DISP_VERSION_MINOR_GET(x) ((x) & 0xFFFF) typedef struct { __u8 alpha; __u8 red; __u8 green; __u8 blue; } __disp_color_t; typedef struct { __s32 x; __s32 y; __u32 width; __u32 height; } __disp_rect_t; typedef struct { __u32 width; __u32 height; } __disp_rectsz_t; typedef struct { __s32 x; __s32 y; } __disp_pos_t; typedef enum { DISP_FORMAT_1BPP = 0x0, DISP_FORMAT_2BPP = 0x1, DISP_FORMAT_4BPP = 0x2, DISP_FORMAT_8BPP = 0x3, DISP_FORMAT_RGB655 = 0x4, DISP_FORMAT_RGB565 = 0x5, DISP_FORMAT_RGB556 = 0x6, DISP_FORMAT_ARGB1555 = 0x7, DISP_FORMAT_RGBA5551 = 0x8, DISP_FORMAT_ARGB888 = 0x9, /* alpha padding to 0xff */ DISP_FORMAT_ARGB8888 = 0xa, DISP_FORMAT_RGB888 = 0xb, DISP_FORMAT_ARGB4444 = 0xc, DISP_FORMAT_YUV444 = 0x10, DISP_FORMAT_YUV422 = 0x11, DISP_FORMAT_YUV420 = 0x12, DISP_FORMAT_YUV411 = 0x13, DISP_FORMAT_CSIRGB = 0x14, } __disp_pixel_fmt_t; typedef enum { /* interleaved,1 address */ DISP_MOD_INTERLEAVED = 0x1, /* * No macroblock plane mode, 3 address, RGB/YUV each channel were stored */ DISP_MOD_NON_MB_PLANAR = 0x0, /* No macroblock UV packaged mode, 2 address, Y and UV were stored */ DISP_MOD_NON_MB_UV_COMBINED = 0x2, /* Macroblock plane mode, 3 address,RGB/YUV each channel were stored */ DISP_MOD_MB_PLANAR = 0x4, /* Macroblock UV packaged mode, 2 address, Y and UV were stored */ DISP_MOD_MB_UV_COMBINED = 0x6, } __disp_pixel_mod_t; typedef enum { /* for interleave argb8888 */ DISP_SEQ_ARGB = 0x0, /* A at a high level */ DISP_SEQ_BGRA = 0x2, /* for interleaved yuv422 */ DISP_SEQ_UYVY = 0x3, DISP_SEQ_YUYV = 0x4, DISP_SEQ_VYUY = 0x5, DISP_SEQ_YVYU = 0x6, /* for interleaved yuv444 */ DISP_SEQ_AYUV = 0x7, DISP_SEQ_VUYA = 0x8, /* for uv_combined yuv420 */ DISP_SEQ_UVUV = 0x9, DISP_SEQ_VUVU = 0xa, /* for 16bpp rgb */ DISP_SEQ_P10 = 0xd, /* p1 high */ DISP_SEQ_P01 = 0xe, /* p0 high */ /* for planar format or 8bpp rgb */ DISP_SEQ_P3210 = 0xf, /* p3 high */ DISP_SEQ_P0123 = 0x10, /* p0 high */ /* for 4bpp rgb */ DISP_SEQ_P76543210 = 0x11, DISP_SEQ_P67452301 = 0x12, DISP_SEQ_P10325476 = 0x13, DISP_SEQ_P01234567 = 0x14, /* for 2bpp rgb */ /* 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 */ DISP_SEQ_2BPP_BIG_BIG = 0x15, /* 12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3 */ DISP_SEQ_2BPP_BIG_LITTER = 0x16, /* 3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12 */ DISP_SEQ_2BPP_LITTER_BIG = 0x17, /* 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 */ DISP_SEQ_2BPP_LITTER_LITTER = 0x18, /* for 1bpp rgb */ /* * 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16, * 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 */ DISP_SEQ_1BPP_BIG_BIG = 0x19, /* * 24,25,26,27,28,29,30,31,16,17,18,19,20,21,22,23, * 8, 9,10,11,12,13,14,15, 0, 1, 2, 3, 4, 5, 6, 7 */ DISP_SEQ_1BPP_BIG_LITTER = 0x1a, /* * 7, 6, 5, 4, 3, 2, 1, 0,15,14,13,12,11,10, 9, 8, * 23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 */ DISP_SEQ_1BPP_LITTER_BIG = 0x1b, /* * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, * 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 */ DISP_SEQ_1BPP_LITTER_LITTER = 0x1c, } __disp_pixel_seq_t; typedef enum { DISP_3D_SRC_MODE_TB = 0x0, /* top bottom */ DISP_3D_SRC_MODE_FP = 0x1, /* frame packing */ DISP_3D_SRC_MODE_SSF = 0x2, /* side by side full */ DISP_3D_SRC_MODE_SSH = 0x3, /* side by side half */ DISP_3D_SRC_MODE_LI = 0x4, /* line interleaved */ } __disp_3d_src_mode_t; typedef enum { DISP_3D_OUT_MODE_CI_1 = 0x5, /* column interlaved 1 */ DISP_3D_OUT_MODE_CI_2 = 0x6, /* column interlaved 2 */ DISP_3D_OUT_MODE_CI_3 = 0x7, /* column interlaved 3 */ DISP_3D_OUT_MODE_CI_4 = 0x8, /* column interlaved 4 */ DISP_3D_OUT_MODE_LIRGB = 0x9, /* line interleaved rgb */ DISP_3D_OUT_MODE_TB = 0x0, /* top bottom */ DISP_3D_OUT_MODE_FP = 0x1, /* frame packing */ DISP_3D_OUT_MODE_SSF = 0x2, /* side by side full */ DISP_3D_OUT_MODE_SSH = 0x3, /* side by side half */ DISP_3D_OUT_MODE_LI = 0x4, /* line interleaved */ DISP_3D_OUT_MODE_FA = 0xa, /* field alternative */ } __disp_3d_out_mode_t; typedef enum { DISP_BT601 = 0, DISP_BT709 = 1, DISP_YCC = 2, DISP_VXYCC = 3, } __disp_cs_mode_t; typedef enum { DISP_COLOR_RANGE_16_255 = 0, DISP_COLOR_RANGE_0_255 = 1, DISP_COLOR_RANGE_16_235 = 2, } __disp_color_range_t; typedef enum { DISP_OUTPUT_TYPE_NONE = 0, DISP_OUTPUT_TYPE_LCD = 1, DISP_OUTPUT_TYPE_TV = 2, DISP_OUTPUT_TYPE_HDMI = 4, DISP_OUTPUT_TYPE_VGA = 8, } __disp_output_type_t; typedef enum { DISP_TV_NONE = 0, DISP_TV_CVBS = 1, DISP_TV_YPBPR = 2, DISP_TV_SVIDEO = 4, } __disp_tv_output_t; typedef enum { DISP_TV_MOD_480I = 0, DISP_TV_MOD_576I = 1, DISP_TV_MOD_480P = 2, DISP_TV_MOD_576P = 3, DISP_TV_MOD_720P_50HZ = 4, DISP_TV_MOD_720P_60HZ = 5, DISP_TV_MOD_1080I_50HZ = 6, DISP_TV_MOD_1080I_60HZ = 7, DISP_TV_MOD_1080P_24HZ = 8, DISP_TV_MOD_1080P_50HZ = 9, DISP_TV_MOD_1080P_60HZ = 0xa, DISP_TV_MOD_1080P_24HZ_3D_FP = 0x17, DISP_TV_MOD_720P_50HZ_3D_FP = 0x18, DISP_TV_MOD_720P_60HZ_3D_FP = 0x19, DISP_TV_MOD_PAL = 0xb, DISP_TV_MOD_PAL_SVIDEO = 0xc, DISP_TV_MOD_NTSC = 0xe, DISP_TV_MOD_NTSC_SVIDEO = 0xf, DISP_TV_MOD_PAL_M = 0x11, DISP_TV_MOD_PAL_M_SVIDEO = 0x12, DISP_TV_MOD_PAL_NC = 0x14, DISP_TV_MOD_PAL_NC_SVIDEO = 0x15, DISP_TV_MOD_H1360_V768_60HZ = 0x1a, DISP_TV_MOD_H1280_V1024_60HZ = 0x1b, DISP_TV_MODE_NUM = 0x1c, /* Reserved, do not use in fex files */ DISP_TV_MODE_EDID = 0xff } __disp_tv_mode_t; typedef enum { DISP_TV_DAC_SRC_COMPOSITE = 0, DISP_TV_DAC_SRC_LUMA = 1, DISP_TV_DAC_SRC_CHROMA = 2, DISP_TV_DAC_SRC_Y = 4, DISP_TV_DAC_SRC_PB = 5, DISP_TV_DAC_SRC_PR = 6, DISP_TV_DAC_SRC_NONE = 7, } __disp_tv_dac_source; typedef enum { DISP_VGA_H1680_V1050 = 0, DISP_VGA_H1440_V900 = 1, DISP_VGA_H1360_V768 = 2, DISP_VGA_H1280_V1024 = 3, DISP_VGA_H1024_V768 = 4, DISP_VGA_H800_V600 = 5, DISP_VGA_H640_V480 = 6, DISP_VGA_H1440_V900_RB = 7, /* not support yet */ DISP_VGA_H1680_V1050_RB = 8, /* not support yet */ DISP_VGA_H1920_V1080_RB = 9, DISP_VGA_H1920_V1080 = 0xa, DISP_VGA_H1280_V720 = 0xb, DISP_VGA_MODE_NUM = 0xc, } __disp_vga_mode_t; typedef enum { DISP_LCDC_SRC_DE_CH1 = 0, DISP_LCDC_SRC_DE_CH2 = 1, DISP_LCDC_SRC_DMA = 2, DISP_LCDC_SRC_WHITE = 3, DISP_LCDC_SRC_BLACK = 4, DISP_LCDC_SRC_BLUT = 5, } __disp_lcdc_src_t; typedef enum { DISP_LAYER_WORK_MODE_NORMAL = 0, /* normal work mode */ DISP_LAYER_WORK_MODE_PALETTE = 1, /* palette work mode */ /* internal frame buffer work mode */ DISP_LAYER_WORK_MODE_INTER_BUF = 2, DISP_LAYER_WORK_MODE_GAMMA = 3, /* gamma correction work mode */ DISP_LAYER_WORK_MODE_SCALER = 4, /* scaler work mode */ } __disp_layer_work_mode_t; typedef enum { DISP_VIDEO_NATUAL = 0, DISP_VIDEO_SOFT = 1, DISP_VIDEO_VERYSOFT = 2, DISP_VIDEO_SHARP = 3, DISP_VIDEO_VERYSHARP = 4 } __disp_video_smooth_t; typedef enum { DISP_HWC_MOD_H32_V32_8BPP = 0, DISP_HWC_MOD_H64_V64_2BPP = 1, DISP_HWC_MOD_H64_V32_4BPP = 2, DISP_HWC_MOD_H32_V64_4BPP = 3, } __disp_hwc_mode_t; typedef enum { DISP_EXIT_MODE_CLEAN_ALL = 0, DISP_EXIT_MODE_CLEAN_PARTLY = 1, /* only clean interrupt temply */ } __disp_exit_mode_t; typedef enum { /* only for debug!!! */ DISP_REG_SCALER0 = 0, DISP_REG_SCALER1 = 1, DISP_REG_IMAGE0 = 2, DISP_REG_IMAGE1 = 3, DISP_REG_LCDC0 = 4, DISP_REG_LCDC1 = 5, DISP_REG_TVEC0 = 6, DISP_REG_TVEC1 = 7, DISP_REG_CCMU = 8, DISP_REG_PIOC = 9, DISP_REG_PWM = 10, } __disp_reg_index_t; typedef struct { /* * The way these are treated today, these are physical addresses. Are * there any actual userspace applications out there that use this? * -- libv. */ /* * the contents of the frame buffer address for rgb type only addr[0] * valid */ __u32 addr[3]; __disp_rectsz_t size; /* unit is pixel */ __disp_pixel_fmt_t format; __disp_pixel_seq_t seq; __disp_pixel_mod_t mode; /* * blue red color swap flag, FALSE:RGB; TRUE:BGR,only used in rgb format */ __bool br_swap; __disp_cs_mode_t cs_mode; /* color space */ __bool b_trd_src; /* if 3d source, used for scaler mode layer */ /* source 3d mode, used for scaler mode layer */ __disp_3d_src_mode_t trd_mode; __u32 trd_right_addr[3]; /* used when in frame packing 3d mode */ } __disp_fb_t; typedef struct { __disp_layer_work_mode_t mode; /* layer work mode */ __bool b_from_screen; /* * layer pipe,0/1,if in scaler mode, scaler0 must be pipe0, * scaler1 must be pipe1 */ __u8 pipe; /* * layer priority,can get layer prio,but never set layer prio. * From bottom to top, priority from low to high */ __u8 prio; __bool alpha_en; /* layer global alpha enable */ __u16 alpha_val; /* layer global alpha value */ __bool ck_enable; /* layer color key enable */ /* framebuffer source window,only care x,y if is not scaler mode */ __disp_rect_t src_win; __disp_rect_t scn_win; /* screen window */ __disp_fb_t fb; /* framebuffer */ __bool b_trd_out; /* if output 3d mode, used for scaler mode layer */ /* output 3d mode, used for scaler mode layer */ __disp_3d_out_mode_t out_trd_mode; } __disp_layer_info_t; typedef struct { __disp_color_t ck_max; __disp_color_t ck_min; /* * 0/1:always match; * 2:match if min<=color<=max; * 3:match if color>max or color