summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-07-10 17:02:24 -0700
committerTom Stellard <thomas.stellard@amd.com>2013-07-10 17:02:24 -0700
commit6fce3fc33ff189a7c179c79e93c3025eaf88dd4f (patch)
treed557d16931816ca03107b0c8a8d68075e0413dc0
parentd6af8d8075a6665733e305a25f4cf5565566c652 (diff)
XXX: Eventclover-icd-v2
-rw-r--r--src/gallium/state_trackers/clover/api/event.cpp55
-rw-r--r--src/gallium/state_trackers/clover/api/icd.hpp3
2 files changed, 37 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/clover/api/event.cpp b/src/gallium/state_trackers/clover/api/event.cpp
index 0a9a1d6ccb3..cd3159f28ac 100644
--- a/src/gallium/state_trackers/clover/api/event.cpp
+++ b/src/gallium/state_trackers/clover/api/event.cpp
@@ -27,12 +27,13 @@
using namespace clover;
PUBLIC cl_event
-clCreateUserEvent(cl_context ctx, cl_int *errcode_ret) try {
+clCreateUserEvent(cl_context _ctx, cl_int *errcode_ret) try {
+ UNWRAP_ICD_PARAM_CONTEXT(ctx)
if (!ctx)
throw error(CL_INVALID_CONTEXT);
ret_error(errcode_ret, CL_SUCCESS);
- return new soft_event(*ctx, {}, false);
+ return WRAP_ICD_EVENT(new soft_event(*ctx, {}, false));
} catch(error &e) {
ret_error(errcode_ret, e);
@@ -40,7 +41,8 @@ clCreateUserEvent(cl_context ctx, cl_int *errcode_ret) try {
}
PUBLIC cl_int
-clSetUserEventStatus(cl_event ev, cl_int status) {
+clSetUserEventStatus(cl_event _ev, cl_int status) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!dynamic_cast<soft_event *>(ev))
return CL_INVALID_EVENT;
@@ -63,11 +65,12 @@ clWaitForEvents(cl_uint num_evs, const cl_event *evs) try {
if (!num_evs || !evs)
throw error(CL_INVALID_VALUE);
- std::for_each(evs, evs + num_evs, [&](const cl_event ev) {
+ std::for_each(evs, evs + num_evs, [&](const cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
throw error(CL_INVALID_EVENT);
- if (&ev->ctx != &evs[0]->ctx)
+ if (&ev->ctx != &UNWRAP_ICD_OBJECT(evs[0])->ctx)
throw error(CL_INVALID_CONTEXT);
if (ev->status() < 0)
@@ -77,7 +80,8 @@ clWaitForEvents(cl_uint num_evs, const cl_event *evs) try {
// Create a temporary soft event that depends on all the events in
// the wait list
ref_ptr<soft_event> sev = transfer(
- new soft_event(evs[0]->ctx, { evs, evs + num_evs }, true));
+ new soft_event(UNWRAP_ICD_OBJECT(evs[0])->ctx,
+ { evs, evs + num_evs }, true));
// ...and wait on it.
sev->wait();
@@ -89,17 +93,18 @@ clWaitForEvents(cl_uint num_evs, const cl_event *evs) try {
}
PUBLIC cl_int
-clGetEventInfo(cl_event ev, cl_event_info param,
+clGetEventInfo(cl_event _ev, cl_event_info param,
size_t size, void *buf, size_t *size_ret) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
return CL_INVALID_EVENT;
switch (param) {
case CL_EVENT_COMMAND_QUEUE:
- return scalar_property<cl_command_queue>(buf, size, size_ret, ev->queue());
+ return scalar_property<clover::command_queue*>(buf, size, size_ret, ev->queue());
case CL_EVENT_CONTEXT:
- return scalar_property<cl_context>(buf, size, size_ret, &ev->ctx);
+ return scalar_property<clover::context*>(buf, size, size_ret, &ev->ctx);
case CL_EVENT_COMMAND_TYPE:
return scalar_property<cl_command_type>(buf, size, size_ret, ev->command());
@@ -116,10 +121,11 @@ clGetEventInfo(cl_event ev, cl_event_info param,
}
PUBLIC cl_int
-clSetEventCallback(cl_event ev, cl_int type,
+clSetEventCallback(cl_event _ev, cl_int type,
void (CL_CALLBACK *pfn_event_notify)(cl_event, cl_int,
void *),
void *user_data) try {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
throw error(CL_INVALID_EVENT);
@@ -129,10 +135,10 @@ clSetEventCallback(cl_event ev, cl_int type,
// Create a temporary soft event that depends on ev, with
// pfn_event_notify as completion action.
ref_ptr<soft_event> sev = transfer(
- new soft_event(ev->ctx, { ev }, true,
+ new soft_event(ev->ctx, { _ev }, true,
[=](event &) {
ev->wait();
- pfn_event_notify(ev, ev->status(), user_data);
+ pfn_event_notify(_ev, ev->status(), user_data);
}));
return CL_SUCCESS;
@@ -142,7 +148,8 @@ clSetEventCallback(cl_event ev, cl_int type,
}
PUBLIC cl_int
-clRetainEvent(cl_event ev) {
+clRetainEvent(cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
return CL_INVALID_EVENT;
@@ -151,7 +158,8 @@ clRetainEvent(cl_event ev) {
}
PUBLIC cl_int
-clReleaseEvent(cl_event ev) {
+clReleaseEvent(cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
return CL_INVALID_EVENT;
@@ -162,14 +170,15 @@ clReleaseEvent(cl_event ev) {
}
PUBLIC cl_int
-clEnqueueMarker(cl_command_queue q, cl_event *ev) try {
+clEnqueueMarker(cl_command_queue _q, cl_event *ev) try {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
throw error(CL_INVALID_COMMAND_QUEUE);
if (!ev)
throw error(CL_INVALID_VALUE);
- *ev = new hard_event(*q, CL_COMMAND_MARKER, {});
+ *ev = WRAP_ICD_EVENT(new hard_event(*q, CL_COMMAND_MARKER, {}));
return CL_SUCCESS;
@@ -178,7 +187,8 @@ clEnqueueMarker(cl_command_queue q, cl_event *ev) try {
}
PUBLIC cl_int
-clEnqueueBarrier(cl_command_queue q) {
+clEnqueueBarrier(cl_command_queue _q) {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
return CL_INVALID_COMMAND_QUEUE;
@@ -187,15 +197,17 @@ clEnqueueBarrier(cl_command_queue q) {
}
PUBLIC cl_int
-clEnqueueWaitForEvents(cl_command_queue q, cl_uint num_evs,
+clEnqueueWaitForEvents(cl_command_queue _q, cl_uint num_evs,
const cl_event *evs) try {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
throw error(CL_INVALID_COMMAND_QUEUE);
if (!num_evs || !evs)
throw error(CL_INVALID_VALUE);
- std::for_each(evs, evs + num_evs, [&](const cl_event ev) {
+ std::for_each(evs, evs + num_evs, [&](const cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
throw error(CL_INVALID_EVENT);
@@ -216,13 +228,14 @@ clEnqueueWaitForEvents(cl_command_queue q, cl_uint num_evs,
}
PUBLIC cl_int
-clGetEventProfilingInfo(cl_event ev, cl_profiling_info param,
+clGetEventProfilingInfo(cl_event _ev, cl_profiling_info param,
size_t size, void *buf, size_t *size_ret) {
return CL_PROFILING_INFO_NOT_AVAILABLE;
}
PUBLIC cl_int
-clFinish(cl_command_queue q) try {
+clFinish(cl_command_queue _q) try {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
throw error(CL_INVALID_COMMAND_QUEUE);
diff --git a/src/gallium/state_trackers/clover/api/icd.hpp b/src/gallium/state_trackers/clover/api/icd.hpp
index c79564cbfc8..a6e7a8ddc97 100644
--- a/src/gallium/state_trackers/clover/api/icd.hpp
+++ b/src/gallium/state_trackers/clover/api/icd.hpp
@@ -50,6 +50,8 @@ extern const cl_icd_dispatch clover_icd_dispatch;
UNWRAP_ICD_PARAM(clover::context, name)
#define UNWRAP_ICD_PARAM_DEVICE(name) \
UNWRAP_ICD_PARAM(clover::device, name)
+#define UNWRAP_ICD_PARAM_EVENT(name) \
+ UNWRAP_ICD_PARAM(clover::event, name)
#define UNWRAP_ICD_PARAM_MEM(name) \
UNWRAP_ICD_PARAM(clover::memory_obj, name)
#define UNWRAP_ICD_PARAM_PLATFORM(name) \
@@ -58,6 +60,7 @@ extern const cl_icd_dispatch clover_icd_dispatch;
UNWRAP_ICD_PARAM(clover::sampler, name)
#define WRAP_ICD_CONTEXT(ctx) new _cl_context(ctx)
+#define WRAP_ICD_EVENT(event) new _cl_event(event)
#define WRAP_ICD_MEM(mem) new _cl_mem(mem)
#define WRAP_ICD_SAMPLER(sampler) new _cl_sampler(sampler)