#ifndef __SUNXI_DISPLAY_H__ #define __SUNXI_DISPLAY_H__ #ifndef bool #define bool signed char #endif #ifndef __bool #define __bool signed char #endif typedef struct {unsigned char alpha;unsigned char red;unsigned char green; unsigned char blue; }disp_color; typedef struct {int x; int y; unsigned int width; unsigned int height;}disp_rect; typedef struct {unsigned int width;unsigned int height; }disp_rectsz; typedef struct {int x; int y; }disp_position; typedef unsigned int u32; typedef enum { DISP_FORMAT_ARGB_8888 = 0x00,//MSB A-R-G-B LSB DISP_FORMAT_ABGR_8888 = 0x01, DISP_FORMAT_RGBA_8888 = 0x02, DISP_FORMAT_BGRA_8888 = 0x03, DISP_FORMAT_XRGB_8888 = 0x04, DISP_FORMAT_XBGR_8888 = 0x05, DISP_FORMAT_RGBX_8888 = 0x06, DISP_FORMAT_BGRX_8888 = 0x07, DISP_FORMAT_RGB_888 = 0x08, DISP_FORMAT_BGR_888 = 0x09, DISP_FORMAT_RGB_565 = 0x0a, DISP_FORMAT_BGR_565 = 0x0b, DISP_FORMAT_ARGB_4444 = 0x0c, DISP_FORMAT_ABGR_4444 = 0x0d, DISP_FORMAT_RGBA_4444 = 0x0e, DISP_FORMAT_BGRA_4444 = 0x0f, DISP_FORMAT_ARGB_1555 = 0x10, DISP_FORMAT_ABGR_1555 = 0x11, DISP_FORMAT_RGBA_5551 = 0x12, DISP_FORMAT_BGRA_5551 = 0x13, /* SP: semi-planar, P:planar, I:interleaved * UVUV: U in the LSBs; VUVU: V in the LSBs */ DISP_FORMAT_YUV444_I_AYUV = 0x40,//MSB A-Y-U-V LSB, reserved DISP_FORMAT_YUV444_I_VUYA = 0x41,//MSB V-U-Y-A LSB DISP_FORMAT_YUV422_I_YVYU = 0x42,//MSB Y-V-Y-U LSB DISP_FORMAT_YUV422_I_YUYV = 0x43,//MSB Y-U-Y-V LSB DISP_FORMAT_YUV422_I_UYVY = 0x44,//MSB U-Y-V-Y LSB DISP_FORMAT_YUV422_I_VYUY = 0x45,//MSB V-Y-U-Y LSB DISP_FORMAT_YUV444_P = 0x46,//MSB P3-2-1-0 LSB, YYYY UUUU VVVV, reserved DISP_FORMAT_YUV422_P = 0x47,//MSB P3-2-1-0 LSB YYYY UU VV DISP_FORMAT_YUV420_P = 0x48,//MSB P3-2-1-0 LSB YYYY U V DISP_FORMAT_YUV411_P = 0x49,//MSB P3-2-1-0 LSB YYYY U V DISP_FORMAT_YUV422_SP_UVUV = 0x4a,//MSB V-U-V-U LSB DISP_FORMAT_YUV422_SP_VUVU = 0x4b,//MSB U-V-U-V LSB DISP_FORMAT_YUV420_SP_UVUV = 0x4c,//nv12 DISP_FORMAT_YUV420_SP_VUVU = 0x4d,//nv21 DISP_FORMAT_YUV411_SP_UVUV = 0x4e, DISP_FORMAT_YUV411_SP_VUVU = 0x4f, }disp_pixel_format; 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; typedef enum { DISP_BT601 = 0, DISP_BT709 = 1, DISP_YCC = 2, }disp_color_space; typedef enum { DISP_CSC_TYPE_RGB = 0, DISP_CSC_TYPE_YUV1 = 1,//HDMI DISP_CSC_TYPE_YUV2 = 2,//TV }disp_csc_type; typedef enum { DISP_COLOR_RANGE_16_255 = 0, DISP_COLOR_RANGE_0_255 = 1, DISP_COLOR_RANGE_16_235 = 2, }disp_color_range; 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; 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_1080P_25HZ = 0x1a, DISP_TV_MOD_1080P_30HZ = 0x1b, 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_3840_2160P_30HZ = 0x1c, DISP_TV_MOD_3840_2160P_25HZ = 0x1d, DISP_TV_MOD_3840_2160P_24HZ = 0x1e, DISP_TV_MODE_NUM = 0x1f, }disp_tv_mode; typedef enum { DISP_VGA_MOD_640x480P_60HZ = 0x0, DISP_VGA_MOD_800x600P_60HZ = 0x1, DISP_VGA_MOD_1024x768P_60HZ = 0x2, DISP_VGA_MOD_1280x768P_60HZ = 0x3, DISP_VGA_MOD_1280x800P_60HZ = 0x4, DISP_VGA_MOD_1366x768P_60HZ = 0x5, DISP_VGA_MOD_1440x900P_60HZ = 0x6, DISP_VGA_MOD_1920x1080P_60HZ = 0x7, DISP_VGA_MOD_1920x1200P_60HZ = 0x8, DISP_VGA_MOD_NUM, } disp_vga_mode; //FIXME:still need? typedef enum { DISP_EXIT_MODE_CLEAN_ALL = 0, DISP_EXIT_MODE_CLEAN_PARTLY = 1,//only clean interrupt temply }disp_exit_mode; typedef enum { DISP_TRANSFORM_ROT_0 = 0, DISP_TRANSFORM_ROT_90 = 1, DISP_TRANSFORM_ROT_180 = 2, DISP_TRANSFORM_ROT_270 = 3, }disp_transform_type; typedef enum { DISP_BF_NORMAL = 0,//non-stereo DISP_BF_STEREO_TB = 1 << 0,//stereo top-bottom DISP_BF_STEREO_FP = 1 << 1,//stereo frame packing DISP_BF_STEREO_SSH = 1 << 2,//stereo side by side half DISP_BF_STEREO_SSF = 1 << 3,//stereo side by side full DISP_BF_STEREO_LI = 1 << 4,//stereo line interlace }disp_buffer_flags; typedef enum { LAYER_MODE_BUFFER = 0, LAYER_MODE_COLOR = 1, }disp_layer_mode; typedef enum { DISP_SCAN_PROGRESSIVE = 0,//non interlace DISP_SCAN_INTERLACED_ODD_FLD_FIRST = 1 << 0,//interlace ,odd field first DISP_SCAN_INTERLACED_EVEN_FLD_FIRST = 1 << 1,//interlace,even field first }disp_scan_flags; typedef struct { unsigned int type; unsigned int mode; }disp_output; typedef struct { long long x; long long y; long long width; long long height; }disp_rect64; typedef struct { unsigned long long addr[3]; /* address of frame buffer, single addr for interleaved fomart, double addr for semi-planar fomart triple addr for planar format */ disp_rectsz size[3]; //size for 3 component,unit: pixels unsigned int align[3]; //align for 3 comonent,unit: bits(align=2^n,i.e. 1/2/4/8/16/32..) disp_pixel_format format; disp_color_space color_space; //color space unsigned int trd_right_addr[3];/* right address of 3d fb, used when in frame packing 3d mode */ bool pre_multiply; //true: pre-multiply fb disp_rect64 crop; //crop rectangle boundaries disp_buffer_flags flags; //indicate stereo or non-stereo buffer disp_scan_flags scan; //scan type & scan order }disp_fb_info; typedef struct { disp_layer_mode mode; unsigned char zorder; /*specifies the front-to-back ordering of the layers on the screen, the top layer having the highest Z value can't set zorder, but can get */ unsigned char alpha_mode; //0: pixel alpha; 1: global alpha; 2: global pixel alpha unsigned char alpha_value; //global alpha value disp_rect screen_win; //display window on the screen bool b_trd_out; //3d display disp_3d_out_mode out_trd_mode;//3d display mode union { unsigned int color; //valid when LAYER_MODE_COLOR disp_fb_info fb; //framebuffer, valid when LAYER_MODE_BUFFER }; unsigned int id; /* frame id, can get the id of frame display currently by DISP_LAYER_GET_FRAME_ID */ }disp_layer_info; typedef struct { disp_layer_info info; bool enable; unsigned int channel; unsigned int layer_id; }disp_layer_config; typedef struct { disp_color ck_max; disp_color ck_min; unsigned int red_match_rule;//0/1:always match; 2:match if min<=color<=max; 3:match if color>max or colormax or colormax or color