summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/clover/core
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2015-10-30 23:25:59 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2015-11-05 11:22:19 -0500
commit6706cc1671bfd8e6c021db8b68815959fa7fceba (patch)
treee226393229f409f35d5bd4d9676b21ec366f98b8 /src/gallium/state_trackers/clover/core
parentc93c9d220baa60fdd0e685a072a61857d3a2846b (diff)
downloadexternal_mesa3d-6706cc1671bfd8e6c021db8b68815959fa7fceba.zip
external_mesa3d-6706cc1671bfd8e6c021db8b68815959fa7fceba.tar.gz
external_mesa3d-6706cc1671bfd8e6c021db8b68815959fa7fceba.tar.bz2
st/clover: provide a path for drivers to call through to pfn_notify
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> [ Francisco Jerez: Clean up clover::context interface by passing around a function object. ]
Diffstat (limited to 'src/gallium/state_trackers/clover/core')
-rw-r--r--src/gallium/state_trackers/clover/core/context.cpp5
-rw-r--r--src/gallium/state_trackers/clover/core/context.hpp7
-rw-r--r--src/gallium/state_trackers/clover/core/queue.cpp21
3 files changed, 30 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/clover/core/context.cpp b/src/gallium/state_trackers/clover/core/context.cpp
index bf4df39..c3e2082 100644
--- a/src/gallium/state_trackers/clover/core/context.cpp
+++ b/src/gallium/state_trackers/clover/core/context.cpp
@@ -25,8 +25,9 @@
using namespace clover;
context::context(const property_list &props,
- const ref_vector<device> &devs) :
- props(props), devs(devs) {
+ const ref_vector<device> &devs,
+ const notify_action &notify) :
+ notify(notify), props(props), devs(devs) {
}
bool
diff --git a/src/gallium/state_trackers/clover/core/context.hpp b/src/gallium/state_trackers/clover/core/context.hpp
index 0ec4ff4..7b22cca 100644
--- a/src/gallium/state_trackers/clover/core/context.hpp
+++ b/src/gallium/state_trackers/clover/core/context.hpp
@@ -36,7 +36,10 @@ namespace clover {
typedef clover::property_list<cl_context_properties> property_list;
public:
- context(const property_list &props, const ref_vector<device> &devs);
+ typedef std::function<void (const char *)> notify_action;
+
+ context(const property_list &props, const ref_vector<device> &devs,
+ const notify_action &notify);
context(const context &ctx) = delete;
context &
@@ -53,6 +56,8 @@ namespace clover {
device_range
devices() const;
+ const notify_action notify;
+
private:
property_list props;
const std::vector<intrusive_ref<device>> devs;
diff --git a/src/gallium/state_trackers/clover/core/queue.cpp b/src/gallium/state_trackers/clover/core/queue.cpp
index 4aaf67d..24d71f1 100644
--- a/src/gallium/state_trackers/clover/core/queue.cpp
+++ b/src/gallium/state_trackers/clover/core/queue.cpp
@@ -24,15 +24,36 @@
#include "core/event.hpp"
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
+#include "pipe/p_state.h"
using namespace clover;
+namespace {
+ void
+ debug_notify_callback(void *data,
+ unsigned *id,
+ enum pipe_debug_type type,
+ const char *fmt,
+ va_list args) {
+ const command_queue *queue = (const command_queue *)data;
+ char buffer[1024];
+ vsnprintf(buffer, sizeof(buffer), fmt, args);
+ queue->context().notify(buffer);
+ }
+}
+
command_queue::command_queue(clover::context &ctx, clover::device &dev,
cl_command_queue_properties 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 = { &debug_notify_callback, this };
+ if (pipe->set_debug_callback)
+ pipe->set_debug_callback(pipe, &cb);
+ }
}
command_queue::~command_queue() {