From: Junyan He <[email protected]> V2: Rebase to OpenCL 2.0
Signed-off-by: Junyan He <[email protected]> --- src/CMakeLists.txt | 1 + src/cl_utils.c | 36 ++++++++++++++++++++++++++++++++++++ src/cl_utils.h | 3 +++ 3 files changed, 40 insertions(+) create mode 100644 src/cl_utils.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 26cccea..80e78fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,6 +67,7 @@ MakeKernelBinStr ("${CMAKE_CURRENT_SOURCE_DIR}/kernels/" "${BUILT_IN_NAME}") set(OPENCL_SRC ${KERNEL_STR_FILES} cl_base_object.c + cl_utils.c cl_api.c cl_api_mem.c cl_api_kernel.c diff --git a/src/cl_utils.c b/src/cl_utils.c new file mode 100644 index 0000000..c660b2d --- /dev/null +++ b/src/cl_utils.c @@ -0,0 +1,36 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "cl_utils.h" +#include <string.h> + +LOCAL cl_int +cl_get_info_helper(const void *src, size_t src_size, void *dst, size_t dst_size, size_t *ret_size) +{ + if (dst && dst_size < src_size) + return CL_INVALID_VALUE; + + if (dst_size) { + memset(dst, 0, dst_size); + memcpy(dst, src, src_size); + } + + if (ret_size) + *ret_size = src_size; + return CL_SUCCESS; +} diff --git a/src/cl_utils.h b/src/cl_utils.h index 4af727e..d12a527 100644 --- a/src/cl_utils.h +++ b/src/cl_utils.h @@ -20,6 +20,8 @@ #ifndef __CL_UTILS_H__ #define __CL_UTILS_H__ +#include "CL/cl.h" + /* INLINE is forceinline */ #define INLINE __attribute__((always_inline)) inline @@ -450,4 +452,5 @@ static inline void list_splice_tail(struct list_head *list, struct list_head *he for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) +extern cl_int cl_get_info_helper(const void *src, size_t src_size, void *dst, size_t dst_size, size_t *ret_size); #endif /* __CL_UTILS_H__ */ -- 2.7.4 _______________________________________________ Beignet mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/beignet
