Lines Matching full:area

48 /* 1d or 2d area */
50 bool is2d; /* whether area is 1d or 2d */
69 struct tcm_area *area);
70 s32 (*reserve_1d)(struct tcm *tcm, u32 slots, struct tcm_area *area);
71 s32 (*free)(struct tcm *tcm, struct tcm_area *area);
85 * area pointer is NULL
111 * Reserves a 2D area in the container.
114 * @param height Height(in pages) of area to be reserved.
115 * @param width Width(in pages) of area to be reserved.
116 * @param align Alignment requirement for top-left corner of area. Not
123 * @param area Pointer to where the reserved area should be stored.
126 * the tcm field of the area will be set to NULL on
128 * -EINVAL: invalid area, -ENOMEM: not enough space for
133 struct tcm_area *area) in tcm_reserve_2d() argument
137 (area == NULL || width == 0 || height == 0 || in tcm_reserve_2d()
143 area->is2d = true; in tcm_reserve_2d()
145 slot_bytes, area); in tcm_reserve_2d()
146 area->tcm = res ? NULL : tcm; in tcm_reserve_2d()
153 * Reserves a 1D area in the container.
157 * @param area Pointer to where the reserved area should be stored.
160 * the tcm field of the area will be set to NULL on
162 * -EINVAL: invalid area, -ENOMEM: not enough space for
166 struct tcm_area *area) in tcm_reserve_1d() argument
170 (area == NULL || slots == 0) ? -EINVAL : in tcm_reserve_1d()
174 area->is2d = false; 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()
183 * Free a previously reserved area from the container.
185 * @param area Pointer to area reserved by a prior call to
191 * field of the area is set to NULL on success to avoid subsequent
193 * the area from a failed reserved call.
195 static inline s32 tcm_free(struct tcm_area *area) in tcm_free() argument
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()
213 * This method slices off the topmost 2D slice from the parent area, and stores
215 * contain the remaining portion of the area. If the whole parent area can
217 * longer a valid area.
219 * @param parent Pointer to a VALID parent area that will get modified
220 * @param slice Pointer to the slice area that will get modified
233 /* adjust remaining area */ in tcm_slice()
242 /* Verify if a tcm area is logically valid */
243 static inline bool tcm_area_is_valid(struct tcm_area *area) in tcm_area_is_valid() argument
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()
249 area->p0.y <= area->p1.y && in tcm_area_is_valid()
251 ((!area->is2d && 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()
256 (area->is2d && in tcm_area_is_valid()
257 area->p0.x <= area->p1.x)); in tcm_area_is_valid()
260 /* see if a coordinate is within an area */
275 /* calculate area width */
276 static inline u16 __tcm_area_width(struct tcm_area *area) in __tcm_area_width() argument
278 return area->p1.x - area->p0.x + 1; in __tcm_area_width()
281 /* calculate area height */
282 static inline u16 __tcm_area_height(struct tcm_area *area) in __tcm_area_height() argument
284 return area->p1.y - area->p0.y + 1; in __tcm_area_height()
287 /* calculate number of slots in an area */
288 static inline u16 __tcm_sizeof(struct tcm_area *area) in __tcm_sizeof() argument
290 return area->is2d ? in __tcm_sizeof()
291 __tcm_area_width(area) * __tcm_area_height(area) : in __tcm_sizeof()
292 (area->p1.x - area->p0.x + 1) + (area->p1.y - area->p0.y) * in __tcm_sizeof()
293 area->tcm->width; in __tcm_sizeof()
295 #define tcm_sizeof(area) __tcm_sizeof(&(area)) argument
296 #define tcm_awidth(area) __tcm_area_width(&(area)) argument
297 #define tcm_aheight(area) __tcm_area_height(&(area)) argument
298 #define tcm_is_in(pt, area) __tcm_is_in(&(pt), &(area)) argument
300 /* limit a 1D area to the first N pages */
314 * Iterate through 2D slices of a valid area. Behaves
320 * @param area Pointer to the VALID parent area. This
325 #define tcm_for_each_slice(var, area, safe) \ argument
326 for (safe = area, \