summaryrefslogtreecommitdiff
path: root/libavutil/opencl.h
diff options
context:
space:
mode:
authorhighgod0401 <highgod0401@gmail.com>2013-04-11 08:01:53 +0800
committerMichael Niedermayer <michaelni@gmx.at>2013-04-11 03:48:57 +0200
commitdb2de94e95c2095a781892ad7a3d472d952652a8 (patch)
tree5bcd86271cce21117ceae30cff01b80276abdc67 /libavutil/opencl.h
parent3a3d984445f0e49e692f712ebb51a4b7e6bb006c (diff)
avutil/opencl: add opencl device list APIs 20130411
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/opencl.h')
-rw-r--r--libavutil/opencl.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/libavutil/opencl.h b/libavutil/opencl.h
index 6ebde1023b..bcb25ed8be 100644
--- a/libavutil/opencl.h
+++ b/libavutil/opencl.h
@@ -39,6 +39,28 @@
#define AV_OPENCL_MAX_KERNEL_NAME_SIZE 150
+#define AV_OPENCL_MAX_DEVICE_NAME_SIZE 100
+
+#define AV_OPENCL_MAX_PLATFORM_NAME_SIZE 100
+
+typedef struct {
+ int device_type;
+ char device_name[AV_OPENCL_MAX_DEVICE_NAME_SIZE];
+ cl_device_id device_id;
+} AVOpenCLDeviceNode;
+
+typedef struct {
+ cl_platform_id platform_id;
+ char platform_name[AV_OPENCL_MAX_PLATFORM_NAME_SIZE];
+ int device_num;
+ AVOpenCLDeviceNode **device_node;
+} AVOpenCLPlatformNode;
+
+typedef struct {
+ int platform_num;
+ AVOpenCLPlatformNode **platform_node;
+} AVOpenCLDeviceList;
+
typedef struct {
cl_command_queue command_queue;
cl_kernel kernel;
@@ -49,13 +71,32 @@ typedef struct {
cl_platform_id platform_id;
cl_device_type device_type;
cl_context context;
- cl_device_id *device_ids;
cl_device_id device_id;
cl_command_queue command_queue;
char *platform_name;
} AVOpenCLExternalEnv;
/**
+ * Get OpenCL device list.
+ *
+ * It must be freed with av_opencl_free_device_list().
+ *
+ * @param device_list pointer to OpenCL environment device list,
+ * should be released by av_opencl_free_device_list()
+ *
+ * @return >=0 on success, a negative error code in case of failure
+ */
+int av_opencl_get_device_list(AVOpenCLDeviceList **device_list);
+
+/**
+ * Free OpenCL device list.
+ *
+ * @param device_list pointer to OpenCL environment device list
+ * created by av_opencl_get_device_list()
+ */
+void av_opencl_free_device_list(AVOpenCLDeviceList **device_list);
+
+/**
* Allocate OpenCL external environment.
*
* It must be freed with av_opencl_free_external_env().