1/*
2 * include/video/tegrafb.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Erik Gilling <konkers@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _LINUX_TEGRAFB_H_
19#define _LINUX_TEGRAFB_H_
20
21#include <linux/fb.h>
22#include <linux/types.h>
23#include <asm/ioctl.h>
24
25#define TEGRA_FB_WIN_FMT_P1		0
26#define TEGRA_FB_WIN_FMT_P2		1
27#define TEGRA_FB_WIN_FMT_P4		2
28#define TEGRA_FB_WIN_FMT_P8		3
29#define TEGRA_FB_WIN_FMT_B4G4R4A4	4
30#define TEGRA_FB_WIN_FMT_B5G5R5A	5
31#define TEGRA_FB_WIN_FMT_B5G6R5		6
32#define TEGRA_FB_WIN_FMT_AB5G5R5	7
33#define TEGRA_FB_WIN_FMT_B8G8R8A8	12
34#define TEGRA_FB_WIN_FMT_R8G8B8A8	13
35#define TEGRA_FB_WIN_FMT_B6x2G6x2R6x2A8	14
36#define TEGRA_FB_WIN_FMT_R6x2G6x2B6x2A8	15
37#define TEGRA_FB_WIN_FMT_YCbCr422	16
38#define TEGRA_FB_WIN_FMT_YUV422		17
39#define TEGRA_FB_WIN_FMT_YCbCr420P	18
40#define TEGRA_FB_WIN_FMT_YUV420P	19
41#define TEGRA_FB_WIN_FMT_YCbCr422P	20
42#define TEGRA_FB_WIN_FMT_YUV422P	21
43#define TEGRA_FB_WIN_FMT_YCbCr422R	22
44#define TEGRA_FB_WIN_FMT_YUV422R	23
45#define TEGRA_FB_WIN_FMT_YCbCr422RA	24
46#define TEGRA_FB_WIN_FMT_YUV422RA	25
47
48#define TEGRA_FB_WIN_BLEND_NONE		0
49#define TEGRA_FB_WIN_BLEND_PREMULT	1
50#define TEGRA_FB_WIN_BLEND_COVERAGE	2
51
52#define TEGRA_FB_WIN_FLAG_INVERT_H	(1 << 0)
53#define TEGRA_FB_WIN_FLAG_INVERT_V	(1 << 1)
54#define TEGRA_FB_WIN_FLAG_TILED		(1 << 2)
55
56/* set index to -1 to ignore window data */
57struct tegra_fb_windowattr {
58	__s32	index;
59	__u32	buff_id;
60	__u32	flags;
61	__u32	blend;
62	__u32	offset;
63	__u32	offset_u;
64	__u32	offset_v;
65	__u32	stride;
66	__u32	stride_uv;
67	__u32	pixformat;
68	__u32	x;
69	__u32	y;
70	__u32	w;
71	__u32	h;
72	__u32	out_x;
73	__u32	out_y;
74	__u32	out_w;
75	__u32	out_h;
76	__u32	z;
77	__u32	pre_syncpt_id;
78	__u32	pre_syncpt_val;
79};
80
81#define TEGRA_FB_FLIP_N_WINDOWS		3
82
83struct tegra_fb_flip_args {
84	struct tegra_fb_windowattr win[TEGRA_FB_FLIP_N_WINDOWS];
85	__u32 post_syncpt_id;
86	__u32 post_syncpt_val;
87};
88
89struct tegra_fb_modedb {
90	struct fb_var_screeninfo *modedb;
91	__u32 modedb_len;
92};
93
94#define FBIO_TEGRA_SET_NVMAP_FD	_IOW('F', 0x40, __u32)
95#define FBIO_TEGRA_FLIP		_IOW('F', 0x41, struct tegra_fb_flip_args)
96#define FBIO_TEGRA_GET_MODEDB	_IOWR('F', 0x42, struct tegra_fb_modedb)
97
98#endif
99