Lines Matching defs:tcm
40 struct tcm;
51 struct tcm *tcm; /* parent */
56 struct tcm {
67 s32 (*reserve_2d)(struct tcm *tcm, u16 height, u16 width, u16 align,
70 s32 (*reserve_1d)(struct tcm *tcm, u32 slots, struct tcm_area *area);
71 s32 (*free)(struct tcm *tcm, struct tcm_area *area);
72 void (*deinit)(struct tcm *tcm);
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)
106 if (tcm)
107 tcm->deinit(tcm);
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,
136 s32 res = tcm == NULL ? -ENODEV :
140 (height > tcm->height || width > tcm->width) ? -ENOMEM : 0;
144 res = tcm->reserve_2d(tcm, height, width, align, offset,
146 area->tcm = res ? NULL : tcm;
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,
169 s32 res = tcm == NULL ? -ENODEV :
171 slots > (tcm->width * (u32) tcm->height) ? -ENOMEM : 0;
175 res = tcm->reserve_1d(tcm, slots, area);
176 area->tcm = res ? NULL : tcm;
190 * @return 0 on success. Non-0 error code on failure. Also, the tcm
199 if (area && area->tcm) {
200 res = area->tcm->free(area->tcm, area);
202 area->tcm = NULL;
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 &&
229 (slice->p0.x || (slice->p1.x != slice->tcm->width - 1))) {
231 slice->p1.x = slice->tcm->width - 1;
238 parent->tcm = NULL;
242 /* Verify if a tcm area is logically valid */
245 return area && area->tcm &&
247 area->p1.x < area->tcm->width &&
248 area->p1.y < area->tcm->height &&
252 area->p0.x < area->tcm->width &&
253 area->p0.x + area->p0.y * area->tcm->width <=
254 area->p1.x + area->p1.y * area->tcm->width) ||
269 i = p->x + p->y * a->tcm->width;
270 return i >= a->p0.x + a->p0.y * a->tcm->width &&
271 i <= a->p1.x + a->p1.y * a->tcm->width;
293 area->tcm->width;
308 a->p1.x = (a->p0.x + num_pg - 1) % a->tcm->width;
309 a->p1.y = a->p0.y + ((a->p0.x + num_pg - 1) / a->tcm->width);
328 var.tcm; tcm_slice(&safe, &var))