aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/commandqueue.cpp12
-rw-r--r--src/core/commandqueue.h13
-rw-r--r--src/core/cpu/worker.cpp6
-rw-r--r--src/core/dsp/worker.cpp10
4 files changed, 27 insertions, 14 deletions
diff --git a/src/core/commandqueue.cpp b/src/core/commandqueue.cpp
index 504b61c..22c55f2 100644
--- a/src/core/commandqueue.cpp
+++ b/src/core/commandqueue.cpp
@@ -631,8 +631,10 @@ void Event::freeDeviceData()
{
if (parent() && p_device_data)
{
- DeviceInterface *device = 0;
- ((CommandQueue *)parent())->info(CL_QUEUE_DEVICE, sizeof(DeviceInterface *), &device, 0);
+ DeviceInterface *device = NULL;
+ cl_device_id d_device = 0;
+ ((CommandQueue *)parent())->info(CL_QUEUE_DEVICE, sizeof(cl_device_id), &d_device, 0);
+ device = pobj(d_device);
device->freeEventDeviceData(this);
}
@@ -704,7 +706,7 @@ void Event::setStatus(Status status)
if (type() == Event::User || (parent() && status == CL_COMPLETE))
{
CommandQueue *cq = (CommandQueue *) parent();
- if (cq != NULL) clRetainCommandQueue((cl_command_queue) cq);
+ if (cq != NULL) clRetainCommandQueue(desc(cq));
bool already_pushed = false;
int num_dependent_events = setStatusHelper(status);
@@ -739,7 +741,7 @@ void Event::setStatus(Status status)
if (cq != NULL)
{
if (!already_pushed) cq->pushEventsOnDevice(NULL, true);
- clReleaseCommandQueue((cl_command_queue) cq);
+ clReleaseCommandQueue(desc(cq));
}
}
else
@@ -922,7 +924,7 @@ cl_int Event::info(cl_event_info param_name,
switch (param_name)
{
case CL_EVENT_COMMAND_QUEUE:
- SIMPLE_ASSIGN(cl_command_queue, parent());
+ SIMPLE_ASSIGN(cl_command_queue, desc((CommandQueue *)parent()));
break;
case CL_EVENT_CONTEXT:
diff --git a/src/core/commandqueue.h b/src/core/commandqueue.h
index e8e9b74..8d90ef6 100644
--- a/src/core/commandqueue.h
+++ b/src/core/commandqueue.h
@@ -35,6 +35,7 @@
#define __COMMANDQUEUE_H__
#include "object.h"
+#include "icd.h"
#include <CL/cl.h>
#include <pthread.h>
@@ -45,6 +46,13 @@
namespace Coal
{
+ class CommandQueue;
+}
+struct _cl_command_queue: public Coal::descriptor<Coal::CommandQueue, _cl_command_queue> {};
+
+
+namespace Coal
+{
class Context;
class DeviceInterface;
@@ -57,7 +65,7 @@ class Event;
*
* More details are given on the \ref events page.
*/
-class CommandQueue : public Object
+class CommandQueue : public _cl_command_queue, public Object
{
public:
CommandQueue(Context *ctx,
@@ -468,9 +476,6 @@ class Event : public Object
}
-struct _cl_command_queue : public Coal::CommandQueue
-{};
-
struct _cl_event : public Coal::Event
{};
diff --git a/src/core/cpu/worker.cpp b/src/core/cpu/worker.cpp
index 482bd8a..635706b 100644
--- a/src/core/cpu/worker.cpp
+++ b/src/core/cpu/worker.cpp
@@ -69,12 +69,14 @@ void *worker(void *data)
// Get info about the event and its command queue
Event::Type t = event->type();
- CommandQueue *queue = 0;
+ Coal::CommandQueue * queue = NULL;
+ cl_command_queue d_queue = 0;
cl_command_queue_properties queue_props = 0;
errcode = CL_SUCCESS;
- event->info(CL_EVENT_COMMAND_QUEUE, sizeof(CommandQueue *), &queue, 0);
+ event->info(CL_EVENT_COMMAND_QUEUE, sizeof(cl_command_queue), &d_queue, 0);
+ queue = pobj(d_queue);
if (queue)
queue->info(CL_QUEUE_PROPERTIES, sizeof(cl_command_queue_properties),
diff --git a/src/core/dsp/worker.cpp b/src/core/dsp/worker.cpp
index ace3eec..2d2ab5d 100644
--- a/src/core/dsp/worker.cpp
+++ b/src/core/dsp/worker.cpp
@@ -71,12 +71,14 @@ void handle_event_completion(DSPDevice *device)
ke->free_tmp_bufs();
CommandQueue *queue = 0;
+ cl_command_queue d_queue = 0;
cl_command_queue_properties queue_props = 0;
- event->info(CL_EVENT_COMMAND_QUEUE, sizeof(CommandQueue *), &queue, 0);
+ event->info(CL_EVENT_COMMAND_QUEUE, sizeof(cl_command_queue), &d_queue, 0);
+ queue = pobj(d_queue);
if (queue)
- queue->info(CL_QUEUE_PROPERTIES, sizeof(cl_command_queue_properties),
+ queue->info(CL_QUEUE_PROPERTIES, sizeof(cl_command_queue_properties),
&queue_props, 0);
// an event may be released once it is Complete
@@ -108,11 +110,13 @@ bool handle_event_dispatch(DSPDevice *device)
*--------------------------------------------------------------------*/
Event::Type t = event->type();
CommandQueue * queue = 0;
+ cl_command_queue d_queue = 0;
cl_command_queue_properties queue_props = 0;
errcode = CL_SUCCESS;
- event->info(CL_EVENT_COMMAND_QUEUE, sizeof(CommandQueue *), &queue, 0);
+ event->info(CL_EVENT_COMMAND_QUEUE, sizeof(cl_command_queue), &d_queue, 0);
+ queue = pobj(d_queue);
if (queue)
queue->info(CL_QUEUE_PROPERTIES, sizeof(cl_command_queue_properties),