Lines Matching +full:align +full:- +full:end
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright 2020-2021 NXP
35 for (pfmt = inst->formats; pfmt->pixfmt; pfmt++) { in vpu_helper_check_type()
36 if (!vpu_iface_check_format(inst, pfmt->pixfmt)) in vpu_helper_check_type()
38 if (pfmt->type == type) in vpu_helper_check_type()
49 if (!inst || !inst->formats) in vpu_helper_find_format()
55 for (pfmt = inst->formats; pfmt->pixfmt; pfmt++) { in vpu_helper_find_format()
56 if (pfmt->pixfmt == pixelfmt && (!type || type == pfmt->type)) in vpu_helper_find_format()
69 if (!fmt || !fmt->sibling) in vpu_helper_find_sibling()
72 sibling = vpu_helper_find_format(inst, type, fmt->sibling); in vpu_helper_find_sibling()
73 if (!sibling || sibling->sibling != fmt->pixfmt || in vpu_helper_find_sibling()
74 sibling->comp_planes != fmt->comp_planes) in vpu_helper_find_sibling()
88 if (sibling && sibling->pixfmt == fmtb) in vpu_helper_match_format()
98 if (!inst || !inst->formats) in vpu_helper_enum_format()
101 for (pfmt = inst->formats; pfmt->pixfmt; pfmt++) { in vpu_helper_enum_format()
102 if (!vpu_iface_check_format(inst, pfmt->pixfmt)) in vpu_helper_enum_format()
105 if (pfmt->type == type) { in vpu_helper_enum_format()
125 if (res->max_width) in vpu_helper_valid_frame_width()
126 width = clamp(width, res->min_width, res->max_width); in vpu_helper_valid_frame_width()
127 if (res->step_width) in vpu_helper_valid_frame_width()
128 width = ALIGN(width, res->step_width); in vpu_helper_valid_frame_width()
143 if (res->max_height) in vpu_helper_valid_frame_height()
144 height = clamp(height, res->min_height, res->max_height); in vpu_helper_valid_frame_height()
145 if (res->step_height) in vpu_helper_valid_frame_height()
146 height = ALIGN(height, res->step_height); in vpu_helper_valid_frame_height()
160 bytesperline = ALIGN(bytesperline, stride); in get_nv12_plane_size()
161 height = ALIGN(height, 2); in get_nv12_plane_size()
188 bytesperline = ALIGN(bytesperline, 1 << ws); in get_tiled_8l128_plane_size()
189 bytesperline = ALIGN(bytesperline, stride); in get_tiled_8l128_plane_size()
190 height = ALIGN(height, 1 << hs); in get_tiled_8l128_plane_size()
194 size = (bytesperline * ALIGN(height, 1 << (hs + 1))) >> 1; in get_tiled_8l128_plane_size()
210 bytesperline = ALIGN(bytesperline, stride); in get_default_plane_size()
241 u32 end; in vpu_helper_copy_from_stream_buffer() local
245 return -EINVAL; in vpu_helper_copy_from_stream_buffer()
251 start = stream_buffer->phys; in vpu_helper_copy_from_stream_buffer()
252 end = start + stream_buffer->length; in vpu_helper_copy_from_stream_buffer()
253 virt = stream_buffer->virt; in vpu_helper_copy_from_stream_buffer()
255 if (offset < start || offset > end) in vpu_helper_copy_from_stream_buffer()
256 return -EINVAL; in vpu_helper_copy_from_stream_buffer()
258 if (offset + size <= end) { in vpu_helper_copy_from_stream_buffer()
259 memcpy(dst, virt + (offset - start), size); in vpu_helper_copy_from_stream_buffer()
261 memcpy(dst, virt + (offset - start), end - offset); in vpu_helper_copy_from_stream_buffer()
262 memcpy(dst + end - offset, virt, size + offset - end); in vpu_helper_copy_from_stream_buffer()
275 u32 end; in vpu_helper_copy_to_stream_buffer() local
279 return -EINVAL; in vpu_helper_copy_to_stream_buffer()
285 start = stream_buffer->phys; in vpu_helper_copy_to_stream_buffer()
286 end = start + stream_buffer->length; in vpu_helper_copy_to_stream_buffer()
287 virt = stream_buffer->virt; in vpu_helper_copy_to_stream_buffer()
288 if (offset < start || offset > end) in vpu_helper_copy_to_stream_buffer()
289 return -EINVAL; in vpu_helper_copy_to_stream_buffer()
291 if (offset + size <= end) { in vpu_helper_copy_to_stream_buffer()
292 memcpy(virt + (offset - start), src, size); in vpu_helper_copy_to_stream_buffer()
294 memcpy(virt + (offset - start), src, end - offset); in vpu_helper_copy_to_stream_buffer()
295 memcpy(virt, src + end - offset, size + offset - end); in vpu_helper_copy_to_stream_buffer()
308 u32 end; in vpu_helper_memset_stream_buffer() local
312 return -EINVAL; in vpu_helper_memset_stream_buffer()
318 start = stream_buffer->phys; in vpu_helper_memset_stream_buffer()
319 end = start + stream_buffer->length; in vpu_helper_memset_stream_buffer()
320 virt = stream_buffer->virt; in vpu_helper_memset_stream_buffer()
321 if (offset < start || offset > end) in vpu_helper_memset_stream_buffer()
322 return -EINVAL; in vpu_helper_memset_stream_buffer()
324 if (offset + size <= end) { in vpu_helper_memset_stream_buffer()
325 memset(virt + (offset - start), val, size); in vpu_helper_memset_stream_buffer()
327 memset(virt + (offset - start), val, end - offset); in vpu_helper_memset_stream_buffer()
328 memset(virt, val, size + offset - end); in vpu_helper_memset_stream_buffer()
332 if (offset >= end) in vpu_helper_memset_stream_buffer()
333 offset -= stream_buffer->length; in vpu_helper_memset_stream_buffer()
348 return desc.rptr - desc.wptr; in vpu_helper_get_free_space()
350 return (desc.end - desc.start + desc.rptr - desc.wptr); in vpu_helper_get_free_space()
352 return desc.end - desc.start; in vpu_helper_get_free_space()
363 return desc.wptr - desc.rptr; in vpu_helper_get_used_space()
365 return (desc.end - desc.start + desc.wptr - desc.rptr); in vpu_helper_get_used_space()
374 switch (ctrl->id) { in vpu_helper_g_volatile_ctrl()
376 ctrl->val = inst->min_buffer_cap; in vpu_helper_g_volatile_ctrl()
379 ctrl->val = inst->min_buffer_out; in vpu_helper_g_volatile_ctrl()
382 return -EINVAL; in vpu_helper_g_volatile_ctrl()
395 int ret = -EINVAL; in vpu_helper_find_startcode()
397 if (!stream_buffer || !stream_buffer->virt) in vpu_helper_find_startcode()
398 return -EINVAL; in vpu_helper_find_startcode()
411 if (i < start_code_size - 1) in vpu_helper_find_startcode()
414 ret = i + 1 - start_code_size; in vpu_helper_find_startcode()
427 return -EINVAL; in vpu_find_dst_by_src()
434 return -EINVAL; in vpu_find_dst_by_src()
442 return -EINVAL; in vpu_find_src_by_dst()
449 return -EINVAL; in vpu_find_src_by_dst()