This source file includes following definitions.
- gem2fmt
- validfmt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #ifndef OMAP_DMM_TILER_H
16 #define OMAP_DMM_TILER_H
17
18 #include "omap_drv.h"
19 #include "tcm.h"
20
21 enum tiler_fmt {
22 TILFMT_8BIT = 0,
23 TILFMT_16BIT,
24 TILFMT_32BIT,
25 TILFMT_PAGE,
26 TILFMT_NFORMATS
27 };
28
29 struct pat_area {
30 u32 x0:8;
31 u32 y0:8;
32 u32 x1:8;
33 u32 y1:8;
34 };
35
36 struct tiler_block {
37 struct list_head alloc_node;
38 struct tcm_area area;
39 enum tiler_fmt fmt;
40 };
41
42
43 #define SLOT_WIDTH_BITS 6
44 #define SLOT_HEIGHT_BITS 6
45
46
47 #define CONT_WIDTH_BITS 14
48 #define CONT_HEIGHT_BITS 13
49
50
51 #define TILER_PAGE (1 << (SLOT_WIDTH_BITS + SLOT_HEIGHT_BITS))
52 #define TILER_WIDTH (1 << (CONT_WIDTH_BITS - SLOT_WIDTH_BITS))
53 #define TILER_HEIGHT (1 << (CONT_HEIGHT_BITS - SLOT_HEIGHT_BITS))
54
55
56
57
58
59
60
61
62
63
64
65
66
67 #define MASK_XY_FLIP (1 << 31)
68 #define MASK_Y_INVERT (1 << 30)
69 #define MASK_X_INVERT (1 << 29)
70 #define SHIFT_ACC_MODE 27
71 #define MASK_ACC_MODE 3
72
73 #define MASK(bits) ((1 << (bits)) - 1)
74
75 #define TILVIEW_8BIT 0x60000000u
76 #define TILVIEW_16BIT (TILVIEW_8BIT + VIEW_SIZE)
77 #define TILVIEW_32BIT (TILVIEW_16BIT + VIEW_SIZE)
78 #define TILVIEW_PAGE (TILVIEW_32BIT + VIEW_SIZE)
79 #define TILVIEW_END (TILVIEW_PAGE + VIEW_SIZE)
80
81
82 #define TIL_ADDR(x, orient, a)\
83 ((u32) (x) | (orient) | ((a) << SHIFT_ACC_MODE))
84
85 #ifdef CONFIG_DEBUG_FS
86 int tiler_map_show(struct seq_file *s, void *arg);
87 #endif
88
89
90 int tiler_pin(struct tiler_block *block, struct page **pages,
91 u32 npages, u32 roll, bool wait);
92 int tiler_unpin(struct tiler_block *block);
93
94
95 struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w, u16 h,
96 u16 align);
97 struct tiler_block *tiler_reserve_1d(size_t size);
98 int tiler_release(struct tiler_block *block);
99
100
101 dma_addr_t tiler_ssptr(struct tiler_block *block);
102 dma_addr_t tiler_tsptr(struct tiler_block *block, u32 orient,
103 u32 x, u32 y);
104 u32 tiler_stride(enum tiler_fmt fmt, u32 orient);
105 size_t tiler_size(enum tiler_fmt fmt, u16 w, u16 h);
106 size_t tiler_vsize(enum tiler_fmt fmt, u16 w, u16 h);
107 void tiler_align(enum tiler_fmt fmt, u16 *w, u16 *h);
108 u32 tiler_get_cpu_cache_flags(void);
109 bool dmm_is_available(void);
110
111 extern struct platform_driver omap_dmm_driver;
112
113
114 static inline enum tiler_fmt gem2fmt(u32 flags)
115 {
116 switch (flags & OMAP_BO_TILED) {
117 case OMAP_BO_TILED_8:
118 return TILFMT_8BIT;
119 case OMAP_BO_TILED_16:
120 return TILFMT_16BIT;
121 case OMAP_BO_TILED_32:
122 return TILFMT_32BIT;
123 default:
124 return TILFMT_PAGE;
125 }
126 }
127
128 static inline bool validfmt(enum tiler_fmt fmt)
129 {
130 switch (fmt) {
131 case TILFMT_8BIT:
132 case TILFMT_16BIT:
133 case TILFMT_32BIT:
134 case TILFMT_PAGE:
135 return true;
136 default:
137 return false;
138 }
139 }
140
141 #endif