From 0eebe2536c8e76cd20867d1ca00ba4735736f629 Mon Sep 17 00:00:00 2001 From: Luo Xionghu Date: Sat, 23 Apr 2016 00:37:18 +0800 Subject: standalone utest for unified OpenCL implementation. use the variable NOT_BUILD_STAND_ALONE_UTEST to control the build type: for beignet build, set it to 1; for stand alone build, do NOT need set it. remove all clXXXIntel extension call and such kind of tests since we intend to provide the unit test independently for viariant OpenCL implementation; replace the clMapBufferIntel/clMapBufferGTTIntel with clEnqueueMapBuffer/clEnqueueMapImage; link the utest binary to libOpenCL to follow the icd standard; remove the useless env in setenv.sh since we need make install the package after build. v2: fix the indent error; use function pointer for extesion case like vme and libva since we link to libOpenCL; v3: builtin_kernel_block_motion_estimate_intel released kernel twice; v4: find OpenCL library for standalone utest and link to libcl for not standalone utest; check default variables in setenv.sh whether empty before use. Signed-off-by: Luo Xionghu Reviewed-by: Yang Rong --- utests/runtime_climage_from_boname.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'utests/runtime_climage_from_boname.cpp') diff --git a/utests/runtime_climage_from_boname.cpp b/utests/runtime_climage_from_boname.cpp index 4e7f06a6..21608862 100644 --- a/utests/runtime_climage_from_boname.cpp +++ b/utests/runtime_climage_from_boname.cpp @@ -22,6 +22,9 @@ extern "C" #include } +typedef cl_mem (OCLCREATEIMAGEFROMLIBVAINTEL)(cl_context, const cl_libva_image *, cl_int *); +OCLCREATEIMAGEFROMLIBVAINTEL *oclCreateImageFromLibvaIntel = NULL; + // part of following code is copy from beignet/src/x11/ typedef struct { CARD8 reqType; @@ -151,7 +154,16 @@ void runtime_climage_from_boname(void) imageParam.height = h - hStart; imageParam.row_pitch = w; - cl_mem dst = clCreateImageFromLibvaIntel(ctx, &imageParam, NULL); +#ifdef CL_VERSION_1_2 + oclCreateImageFromLibvaIntel = (OCLCREATEIMAGEFROMLIBVAINTEL *)clGetExtensionFunctionAddressForPlatform(platform, "clCreateImageFromLibvaIntel"); +#else + oclCreateImageFromLibvaIntel = (OCLCREATEIMAGEFROMLIBVAINTEL *)clGetExtensionFunctionAddress("clCreateImageFromLibvaIntel"); +#endif + if(!oclCreateImageFromLibvaIntel){ + fprintf(stderr, "Failed to get extension clCreateImageFromLibvaIntel\n"); + exit(1); + } + cl_mem dst = oclCreateImageFromLibvaIntel(ctx, &imageParam, NULL); // Run the kernel OCL_SET_ARG(0, sizeof(cl_mem), &dst); -- cgit v1.2.1