3 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 * Author: Rob Clark <rob@ti.com>
5 * Andy Gross <andy.gross@ti.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 #ifndef OMAP_DMM_TILER_H
17 #define OMAP_DMM_TILER_H
38 struct list_head alloc_node
; /* node for global block list */
39 struct tcm_area area
; /* area */
40 enum tiler_fmt fmt
; /* format */
43 /* bits representing the same slot in DMM-TILER hw-block */
44 #define SLOT_WIDTH_BITS 6
45 #define SLOT_HEIGHT_BITS 6
47 /* bits reserved to describe coordinates in DMM-TILER hw-block */
48 #define CONT_WIDTH_BITS 14
49 #define CONT_HEIGHT_BITS 13
51 /* calculated constants */
52 #define TILER_PAGE (1 << (SLOT_WIDTH_BITS + SLOT_HEIGHT_BITS))
53 #define TILER_WIDTH (1 << (CONT_WIDTH_BITS - SLOT_WIDTH_BITS))
54 #define TILER_HEIGHT (1 << (CONT_HEIGHT_BITS - SLOT_HEIGHT_BITS))
57 Table 15-11. Coding and Description of TILER Orientations
58 S Y X Description Alternate description
59 0 0 0 0-degree view Natural view
60 0 0 1 0-degree view with vertical mirror 180-degree view with horizontal mirror
61 0 1 0 0-degree view with horizontal mirror 180-degree view with vertical mirror
63 1 0 0 90-degree view with vertical mirror 270-degree view with horizontal mirror
66 1 1 1 90-degree view with horizontal mirror 270-degree view with vertical mirror
68 #define MASK_XY_FLIP (1 << 31)
69 #define MASK_Y_INVERT (1 << 30)
70 #define MASK_X_INVERT (1 << 29)
71 #define SHIFT_ACC_MODE 27
72 #define MASK_ACC_MODE 3
74 #define MASK(bits) ((1 << (bits)) - 1)
76 #define TILVIEW_8BIT 0x60000000u
77 #define TILVIEW_16BIT (TILVIEW_8BIT + VIEW_SIZE)
78 #define TILVIEW_32BIT (TILVIEW_16BIT + VIEW_SIZE)
79 #define TILVIEW_PAGE (TILVIEW_32BIT + VIEW_SIZE)
80 #define TILVIEW_END (TILVIEW_PAGE + VIEW_SIZE)
82 /* create tsptr by adding view orientation and access mode */
83 #define TIL_ADDR(x, orient, a)\
84 ((u32) (x) | (orient) | ((a) << SHIFT_ACC_MODE))
86 #ifdef CONFIG_DEBUG_FS
87 int tiler_map_show(struct seq_file
*s
, void *arg
);
91 int tiler_pin(struct tiler_block
*block
, struct page
**pages
,
92 uint32_t npages
, uint32_t roll
, bool wait
);
93 int tiler_unpin(struct tiler_block
*block
);
96 struct tiler_block
*tiler_reserve_2d(enum tiler_fmt fmt
, uint16_t w
, uint16_t h
,
98 struct tiler_block
*tiler_reserve_1d(size_t size
);
99 int tiler_release(struct tiler_block
*block
);
102 dma_addr_t
tiler_ssptr(struct tiler_block
*block
);
103 dma_addr_t
tiler_tsptr(struct tiler_block
*block
, uint32_t orient
,
104 uint32_t x
, uint32_t y
);
105 uint32_t tiler_stride(enum tiler_fmt fmt
, uint32_t orient
);
106 size_t tiler_size(enum tiler_fmt fmt
, uint16_t w
, uint16_t h
);
107 size_t tiler_vsize(enum tiler_fmt fmt
, uint16_t w
, uint16_t h
);
108 void tiler_align(enum tiler_fmt fmt
, uint16_t *w
, uint16_t *h
);
109 uint32_t tiler_get_cpu_cache_flags(void);
110 bool dmm_is_available(void);
112 extern struct platform_driver omap_dmm_driver
;
114 /* GEM bo flags -> tiler fmt */
115 static inline enum tiler_fmt
gem2fmt(uint32_t flags
)
117 switch (flags
& OMAP_BO_TILED
) {
118 case OMAP_BO_TILED_8
:
120 case OMAP_BO_TILED_16
:
122 case OMAP_BO_TILED_32
:
129 static inline bool validfmt(enum tiler_fmt fmt
)