1/* include/linux/s3c-fb.h
2 *
3 * Copyright 2008 Openmoko Inc.
4 * Copyright 2008-2010 Simtec Electronics
5 *      Ben Dooks <ben@simtec.co.uk>
6 *      http://armlinux.simtec.co.uk/
7 *
8 * Samsung SoC Framebuffer driver
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software FoundatIon.
13*/
14
15#ifndef __S3C_FB_H__
16#define __S3C_FB_H__
17
18struct s3c_fb_user_window {
19	int x;
20	int y;
21};
22
23struct s3c_fb_user_plane_alpha {
24	int		channel;
25	unsigned char	red;
26	unsigned char	green;
27	unsigned char	blue;
28};
29
30struct s3c_fb_user_chroma {
31	int		enabled;
32	unsigned char	red;
33	unsigned char	green;
34	unsigned char	blue;
35};
36
37struct s3c_fb_user_ion_client {
38	int	fd;
39	int	offset;
40};
41
42enum s3c_fb_pixel_format {
43	S3C_FB_PIXEL_FORMAT_RGBA_8888 = 0,
44	S3C_FB_PIXEL_FORMAT_RGBX_8888 = 1,
45	S3C_FB_PIXEL_FORMAT_RGBA_5551 = 2,
46	S3C_FB_PIXEL_FORMAT_RGB_565 = 3,
47	S3C_FB_PIXEL_FORMAT_BGRA_8888 = 4,
48	S3C_FB_PIXEL_FORMAT_MAX = 5,
49};
50
51enum s3c_fb_blending {
52	S3C_FB_BLENDING_NONE = 0,
53	S3C_FB_BLENDING_PREMULT = 1,
54	S3C_FB_BLENDING_COVERAGE = 2,
55	S3C_FB_BLENDING_MAX = 3,
56};
57
58struct s3c_fb_win_config {
59	enum {
60		S3C_FB_WIN_STATE_DISABLED = 0,
61		S3C_FB_WIN_STATE_COLOR,
62		S3C_FB_WIN_STATE_BUFFER,
63	} state;
64
65	union {
66		__u32 color;
67		struct {
68			int				fd;
69			__u32				offset;
70			__u32				stride;
71			enum s3c_fb_pixel_format	format;
72			enum s3c_fb_blending		blending;
73			int				fence_fd;
74		};
75	};
76
77	int	x;
78	int	y;
79	__u32	w;
80	__u32	h;
81};
82
83/* S3C_FB_MAX_WIN
84 * Set to the maximum number of windows that any of the supported hardware
85 * can use. Since the platform data uses this for an array size, having it
86 * set to the maximum of any version of the hardware can do is safe.
87 */
88#define S3C_FB_MAX_WIN	(5)
89
90struct s3c_fb_win_config_data {
91	int	fence;
92	struct s3c_fb_win_config config[S3C_FB_MAX_WIN];
93};
94
95/* IOCTL commands */
96#define S3CFB_WIN_POSITION		_IOW('F', 203, \
97						struct s3c_fb_user_window)
98#define S3CFB_WIN_SET_PLANE_ALPHA	_IOW('F', 204, \
99						struct s3c_fb_user_plane_alpha)
100#define S3CFB_WIN_SET_CHROMA		_IOW('F', 205, \
101						struct s3c_fb_user_chroma)
102#define S3CFB_SET_VSYNC_INT		_IOW('F', 206, __u32)
103
104#define S3CFB_GET_ION_USER_HANDLE	_IOWR('F', 208, \
105						struct s3c_fb_user_ion_client)
106#define S3CFB_WIN_CONFIG		_IOW('F', 209, \
107						struct s3c_fb_win_config_data)
108
109#endif /* __S3C_FB_H__ */
110