提交 e77ee5ac 编写于 作者: L Liangliang He

Fix MT6771 OpenCL 2.0 breakage

上级 dffa57f2
...@@ -364,7 +364,8 @@ OpenCLRuntime::OpenCLRuntime( ...@@ -364,7 +364,8 @@ OpenCLRuntime::OpenCLRuntime(
#endif #endif
} }
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
LOG(ERROR) << "error: " << OpenCLErrorToString(err); LOG(ERROR) << "Failed to create OpenCL Context: "
<< OpenCLErrorToString(err);
return; return;
} }
...@@ -373,7 +374,8 @@ OpenCLRuntime::OpenCLRuntime( ...@@ -373,7 +374,8 @@ OpenCLRuntime::OpenCLRuntime(
properties, properties,
&err); &err);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
LOG(ERROR) << "error: " << OpenCLErrorToString(err); LOG(ERROR) << "Failed to create OpenCL CommandQueue: "
<< OpenCLErrorToString(err);
return; return;
} }
......
...@@ -802,9 +802,20 @@ CL_API_ENTRY cl_command_queue clCreateCommandQueueWithProperties( ...@@ -802,9 +802,20 @@ CL_API_ENTRY cl_command_queue clCreateCommandQueueWithProperties(
MACE_LATENCY_LOGGER(3, "clCreateCommandQueueWithProperties"); MACE_LATENCY_LOGGER(3, "clCreateCommandQueueWithProperties");
return func(context, device, properties, errcode_ret); return func(context, device, properties, errcode_ret);
} else { } else {
// Fix MediaTek MT6771 OpenCL driver breakage
VLOG(2) << "Fallback to clCreateCommandQueue";
if (properties[0] == CL_QUEUE_PROPERTIES) {
// When calling with OpenCL-CLHPP, the 2nd param is provided by caller.
#pragma GCC diagnostic push // disable warning both for clang and gcc
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return clCreateCommandQueue(context, device, properties[1], errcode_ret);
#pragma GCC diagnostic pop
} else {
LOG(FATAL) << "Unknown calling parameters, check the code here";
if (errcode_ret != nullptr) *errcode_ret = CL_INVALID_PLATFORM; if (errcode_ret != nullptr) *errcode_ret = CL_INVALID_PLATFORM;
return nullptr; return nullptr;
} }
}
} }
CL_API_ENTRY cl_int clRetainCommandQueue(cl_command_queue command_queue) CL_API_ENTRY cl_int clRetainCommandQueue(cl_command_queue command_queue)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册