diff options
Diffstat (limited to 'src/gallium/frontends/clover/core/queue.cpp')
-rw-r--r-- | src/gallium/frontends/clover/core/queue.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/gallium/frontends/clover/core/queue.cpp b/src/gallium/frontends/clover/core/queue.cpp index c7d08a8c6d2..b5e36e57f4a 100644 --- a/src/gallium/frontends/clover/core/queue.cpp +++ b/src/gallium/frontends/clover/core/queue.cpp @@ -44,7 +44,33 @@ namespace { command_queue::command_queue(clover::context &ctx, clover::device &dev, cl_command_queue_properties props) : - context(ctx), device(dev), props(props) { + context(ctx), device(dev), _props(props) { + pipe = dev.pipe->context_create(dev.pipe, NULL, PIPE_CONTEXT_COMPUTE_ONLY); + if (!pipe) + throw error(CL_INVALID_DEVICE); + + if (ctx.notify) { + struct pipe_debug_callback cb; + memset(&cb, 0, sizeof(cb)); + cb.debug_message = &debug_notify_callback; + cb.data = this; + if (pipe->set_debug_callback) + pipe->set_debug_callback(pipe, &cb); + } +} +command_queue::command_queue(clover::context &ctx, clover::device &dev, + std::vector<cl_queue_properties> properties) : + context(ctx), device(dev), _properties(properties) { + + for(std::vector<cl_queue_properties>::size_type i = 0; i != properties.size(); i += 2) { + if (properties[i] == 0) + break; + if (properties[i] == CL_QUEUE_PROPERTIES) + _props |= properties[i + 1]; + else if (properties[i] != CL_QUEUE_SIZE) + throw error(CL_INVALID_VALUE); + } + pipe = dev.pipe->context_create(dev.pipe, NULL, PIPE_CONTEXT_COMPUTE_ONLY); if (!pipe) throw error(CL_INVALID_DEVICE); @@ -88,13 +114,18 @@ command_queue::flush_unlocked() { } cl_command_queue_properties +command_queue::props() const { + return _props; +} + +std::vector<cl_queue_properties> command_queue::properties() const { - return props; + return _properties; } bool command_queue::profiling_enabled() const { - return props & CL_QUEUE_PROFILING_ENABLE; + return _props & CL_QUEUE_PROFILING_ENABLE; } void |