summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/CL/cl.h6
-rw-r--r--src/gallium/state_trackers/clover/api/dispatch.cpp2
-rw-r--r--src/gallium/state_trackers/clover/api/queue.cpp34
-rw-r--r--src/gallium/state_trackers/clover/core/queue.cpp3
-rw-r--r--src/gallium/state_trackers/clover/core/queue.hpp1
5 files changed, 45 insertions, 1 deletions
diff --git a/include/CL/cl.h b/include/CL/cl.h
index 316565d6e4..beaec774c2 100644
--- a/include/CL/cl.h
+++ b/include/CL/cl.h
@@ -656,6 +656,12 @@ clGetCommandQueueInfo(cl_command_queue /* command_queue */,
void * /* param_value */,
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetCommandQueueProperty(cl_command_queue /* command_queue */,
+ cl_command_queue_properties /* properties */,
+ cl_bool /* param_value */,
+ cl_command_queue_properties * /* properties */) CL_API_SUFFIX__VERSION_1_0;
+
/* Memory Object APIs */
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateBuffer(cl_context /* context */,
diff --git a/src/gallium/state_trackers/clover/api/dispatch.cpp b/src/gallium/state_trackers/clover/api/dispatch.cpp
index 8f4cfdc7fb..0f649140b3 100644
--- a/src/gallium/state_trackers/clover/api/dispatch.cpp
+++ b/src/gallium/state_trackers/clover/api/dispatch.cpp
@@ -37,7 +37,7 @@ namespace clover {
clRetainCommandQueue,
clReleaseCommandQueue,
clGetCommandQueueInfo,
- NULL, // clSetCommandQueueProperty
+ clSetCommandQueueProperty,
clCreateBuffer,
clCreateImage2D,
clCreateImage3D,
diff --git a/src/gallium/state_trackers/clover/api/queue.cpp b/src/gallium/state_trackers/clover/api/queue.cpp
index 06a2863800..d30fdc6f24 100644
--- a/src/gallium/state_trackers/clover/api/queue.cpp
+++ b/src/gallium/state_trackers/clover/api/queue.cpp
@@ -105,6 +105,40 @@ clGetCommandQueueInfo(cl_command_queue d_q, cl_command_queue_info param,
}
CLOVER_API cl_int
+clSetCommandQueueProperty(cl_command_queue d_q,
+ cl_command_queue_properties props, cl_bool enabled,
+ cl_command_queue_properties *old_props) try {
+ //throws CL_INVALID_COMMAND_QUEUE if command_queue is not a valid.
+ auto &q = obj(d_q);
+
+ if (props & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
+ CL_QUEUE_PROFILING_ENABLE))
+ throw error(CL_INVALID_VALUE);
+
+ if (old_props) // If old_properties is NULL, it is ignored.
+ *old_props = q.propertices();
+
+ if (enabled == CL_TRUE) {
+ if (q.propertices() & props)
+ return CL_SUCCESS;
+ } else { // CL_FALSE
+ if (q.propertices() & ~props)
+ return CL_SUCCESS;
+ }
+
+ // TODO how to determine if device supports props???
+ if (1)
+ q.propertices(props);
+ else
+ throw error(CL_INVALID_QUEUE_PROPERTIES);
+
+ return CL_SUCCESS;
+
+} catch (error &e) {
+ return e.get();
+}
+
+CLOVER_API cl_int
clFlush(cl_command_queue d_q) try {
obj(d_q).flush();
return CL_SUCCESS;
diff --git a/src/gallium/state_trackers/clover/core/queue.cpp b/src/gallium/state_trackers/clover/core/queue.cpp
index c91b97ad15..24b15f3f2a 100644
--- a/src/gallium/state_trackers/clover/core/queue.cpp
+++ b/src/gallium/state_trackers/clover/core/queue.cpp
@@ -87,6 +87,9 @@ command_queue::properties() const {
return props;
}
+void
+command_queue::properties(cl_command_queue_properties props) : props(props);
+
bool
command_queue::profiling_enabled() const {
return props & CL_QUEUE_PROFILING_ENABLE;
diff --git a/src/gallium/state_trackers/clover/core/queue.hpp b/src/gallium/state_trackers/clover/core/queue.hpp
index bddb86c0e4..8c0906d215 100644
--- a/src/gallium/state_trackers/clover/core/queue.hpp
+++ b/src/gallium/state_trackers/clover/core/queue.hpp
@@ -49,6 +49,7 @@ namespace clover {
void flush();
cl_command_queue_properties properties() const;
+ void command_queue::properties(cl_command_queue_properties props);
bool profiling_enabled() const;
const intrusive_ref<clover::context> context;