Lines Matching full:tcm
40 struct tcm;
51 struct tcm *tcm; /* parent */ member
56 struct tcm { struct
67 s32 (*reserve_2d)(struct tcm *tcm, u16 height, u16 width, u16 align, argument
70 s32 (*reserve_1d)(struct tcm *tcm, u32 slots, struct tcm_area *area); argument
71 s32 (*free)(struct tcm *tcm, struct tcm_area *area); argument
72 void (*deinit)(struct tcm *tcm); argument
82 * Since some basic parameter checking is done outside the TCM algorithms,
83 * TCM implementation do NOT have to check the following:
91 struct tcm *sita_init(u16 width, u16 height);
97 * @param tcm Pointer to container manager.
104 static inline void tcm_deinit(struct tcm *tcm) in tcm_deinit() argument
106 if (tcm) in tcm_deinit()
107 tcm->deinit(tcm); in tcm_deinit()
113 * @param tcm Pointer to container manager.
126 * the tcm field of the area will be set to NULL on
131 static inline s32 tcm_reserve_2d(struct tcm *tcm, u16 width, u16 height, in tcm_reserve_2d() argument
136 s32 res = tcm == NULL ? -ENODEV : in tcm_reserve_2d()
140 (height > tcm->height || width > tcm->width) ? -ENOMEM : 0; in tcm_reserve_2d()
144 res = tcm->reserve_2d(tcm, height, width, align, offset, in tcm_reserve_2d()
146 area->tcm = res ? NULL : tcm; in tcm_reserve_2d()
155 * @param tcm Pointer to container manager.
160 * the tcm field of the area will be set to NULL on
165 static inline s32 tcm_reserve_1d(struct tcm *tcm, u32 slots, in tcm_reserve_1d() argument
169 s32 res = tcm == NULL ? -ENODEV : in tcm_reserve_1d()
171 slots > (tcm->width * (u32) tcm->height) ? -ENOMEM : 0; in tcm_reserve_1d()
175 res = tcm->reserve_1d(tcm, slots, area); in tcm_reserve_1d()
176 area->tcm = res ? NULL : tcm; in tcm_reserve_1d()
190 * @return 0 on success. Non-0 error code on failure. Also, the tcm
199 if (area && area->tcm) { in tcm_free()
200 res = area->tcm->free(area->tcm, area); in tcm_free()
202 area->tcm = NULL; in tcm_free()
216 * fit in a 2D slice, its tcm pointer is set to NULL to mark that it is no
227 if (slice->tcm && !slice->is2d && in tcm_slice()
229 (slice->p0.x || (slice->p1.x != slice->tcm->width - 1))) { in tcm_slice()
231 slice->p1.x = slice->tcm->width - 1; in tcm_slice()
238 parent->tcm = NULL; in tcm_slice()
242 /* Verify if a tcm area is logically valid */
245 return area && area->tcm && in tcm_area_is_valid()
247 area->p1.x < area->tcm->width && in tcm_area_is_valid()
248 area->p1.y < area->tcm->height && in tcm_area_is_valid()
252 area->p0.x < area->tcm->width && in tcm_area_is_valid()
253 area->p0.x + area->p0.y * area->tcm->width <= in tcm_area_is_valid()
254 area->p1.x + area->p1.y * area->tcm->width) || in tcm_area_is_valid()
269 i = p->x + p->y * a->tcm->width; in __tcm_is_in()
270 return i >= a->p0.x + a->p0.y * a->tcm->width && in __tcm_is_in()
271 i <= a->p1.x + a->p1.y * a->tcm->width; in __tcm_is_in()
293 area->tcm->width; in __tcm_sizeof()
308 a->p1.x = (a->p0.x + num_pg - 1) % a->tcm->width; in tcm_1d_limit()
309 a->p1.y = a->p0.y + ((a->p0.x + num_pg - 1) / a->tcm->width); in tcm_1d_limit()
328 var.tcm; tcm_slice(&safe, &var))