clover: add trivial clCreateCommandQueueWithProperties implementation
authorKarol Herbst <kherbst@redhat.com>
Mon, 12 Mar 2018 10:04:38 +0000 (11:04 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 4 Feb 2020 18:09:23 +0000 (18:09 +0000)
It's not adding 2.0 features, but it's enough to run the 2.0 CTS on top of
clover and probably most CL applications using it.

We just fail if we hit unknown properties and that's probably good enough
until we implement the other bits properly.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2370>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2370>

src/gallium/state_trackers/clover/api/dispatch.cpp
src/gallium/state_trackers/clover/api/queue.cpp

index 5671fe398141affab515cce7eb12a4f83e9e8681..a2d270ea05b239cf33cc1019067129464944bae7 100644 (file)
@@ -147,7 +147,7 @@ namespace clover {
       NULL, // clEnqueueAcquireEGLObjectsKHR
       NULL, // clEnqueueReleaseEGLObjectsKHR
       NULL, // clCreateEventFromEGLSyncKHR
-      NULL, // clCreateCommandQueueWithProperties
+      clCreateCommandQueueWithProperties,
       NULL, // clCreatePipe
       NULL, // clGetPipeInfo
       NULL, // clSVMAlloc
index 06a2863800284862b2b080403e2012693c6cdf16..65b271b216fcc85dacabf5b9472284c02d5445fa 100644 (file)
@@ -112,3 +112,24 @@ clFlush(cl_command_queue d_q) try {
 } catch (error &e) {
    return e.get();
 }
+
+CLOVER_API cl_command_queue
+clCreateCommandQueueWithProperties(cl_context context, cl_device_id device,
+                                   const cl_queue_properties *properties,
+                                   cl_int *errcode_ret) try {
+   cl_command_queue_properties props = 0;
+   if (properties) {
+      for (auto idx = 0; properties[idx]; idx += 2) {
+         if (properties[idx] == CL_QUEUE_PROPERTIES)
+            props |= properties[idx + 1];
+         else
+            throw error(CL_INVALID_VALUE);
+      }
+   }
+
+   return clCreateCommandQueue(context, device, props, errcode_ret);
+
+} catch (error &e) {
+   ret_error(errcode_ret, e);
+   return NULL;
+}