summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/include/mach/tiler.h
blob: b8adf1439b6f5ef77f762efbd026ae46293854fc (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * tiler.h
 *
 * TILER driver support functions for TI OMAP processors.
 *
 * Copyright (C) 2009-2010 Texas Instruments, Inc.
 *
 * This package is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef TILER_H
#define TILER_H

#define TILER_PAGE 0x1000
#define TILER_WIDTH    256
#define TILER_HEIGHT   128
#define TILER_BLOCK_WIDTH  64
#define TILER_BLOCK_HEIGHT 64
#define TILER_LENGTH (TILER_WIDTH * TILER_HEIGHT * TILER_PAGE)

#define TILER_MAX_NUM_BLOCKS 16

#define TILIOC_GBUF  _IOWR('z', 100, u32)
#define TILIOC_FBUF  _IOWR('z', 101, u32)
#define TILIOC_GSSP  _IOWR('z', 102, u32)
#define TILIOC_MBUF  _IOWR('z', 103, u32)
#define TILIOC_UMBUF _IOWR('z', 104, u32)
#define TILIOC_QBUF  _IOWR('z', 105, u32)
#define TILIOC_RBUF  _IOWR('z', 106, u32)
#define TILIOC_URBUF _IOWR('z', 107, u32)
#define TILIOC_QUERY_BLK _IOWR('z', 108, u32)

enum tiler_fmt {
	TILFMT_MIN     = -1,
	TILFMT_INVALID = -1,
	TILFMT_NONE    = 0,
	TILFMT_8BIT    = 1,
	TILFMT_16BIT   = 2,
	TILFMT_32BIT   = 3,
	TILFMT_PAGE    = 4,
	TILFMT_MAX     = 4
};

struct area {
	u16 width;
	u16 height;
};

struct tiler_block_info {
	enum tiler_fmt fmt;
	union {
		struct area area;
		u32 len;
	} dim;
	u32 stride;
	void *ptr;
	u32 ssptr;
};

struct tiler_buf_info {
	s32 num_blocks;
	struct tiler_block_info blocks[TILER_MAX_NUM_BLOCKS];
	s32 offset;
};

struct tiler_view_orient {
	u8 rotate_90;
	u8 x_invert;
	u8 y_invert;
};

/**
 * Request a 1-D or 2-D TILER buffer.
 *
 * @param fmt TILER bit mode.
 * @param width buffer width.
 * @param height buffer height.
 * @param sys_addr system space (L3) address.
 *
 * @return an error status.
 */
s32 tiler_alloc(enum tiler_fmt fmt, u32 width, u32 height, u32 *sys_addr);

/**
 * Free TILER memory.
 * @param sys_addr system space (L3) address.
 * @return an error status.
 */
s32 tiler_free(u32 sys_addr);

u32 tiler_reorient_addr(u32 tsptr, struct tiler_view_orient orient);

u32 tiler_get_natural_addr(void *sys_ptr);

u32 tiler_reorient_topleft(u32 tsptr, struct tiler_view_orient orient,
				u32 width, u32 height);

u32 tiler_stride(u32 tsptr);

void tiler_rotate_view(struct tiler_view_orient *orient, u32 rotation);

void tiler_alloc_packed(s32 *count, enum tiler_fmt fmt, u32 width, u32 height,
			void **sysptr, void **allocptr, s32 aligned);

void tiler_alloc_packed_nv12(s32 *count, u32 width, u32 height, void **y_sysptr,
				void **uv_sysptr, void **y_allocptr,
				void **uv_allocptr, s32 aligned);

#endif