[FFmpeg-devel] [PATCH 1/3] libavutil/opencl: add user spec opencl device APIs 20130408
Michael Niedermayer
michaelni at gmx.at
Tue Apr 9 03:00:53 CEST 2013
On Mon, Apr 08, 2013 at 02:48:59PM +0800, Wei Gao wrote:
>
> opencl.c | 381 +++++++++++++++++++++++++++++++++++----------------------------
> opencl.h | 67 +++++++++--
> 2 files changed, 275 insertions(+), 173 deletions(-)
> e6174fab6b4906a073e8eb5d075653cc9ff659a7 0001-add-user-spec-opencl-device-APIs-20130408.patch
> From 6bdb99cfde715bb0b25e7ec92df146757d2d883c Mon Sep 17 00:00:00 2001
> From: highgod0401 <highgod0401 at gmail.com>
> Date: Mon, 8 Apr 2013 14:36:58 +0800
> Subject: [PATCH 1/3] add user spec opencl device APIs 20130408
>
> ---
> libavutil/opencl.c | 381 ++++++++++++++++++++++++++++++-----------------------
> libavutil/opencl.h | 67 +++++++++-
> 2 files changed, 275 insertions(+), 173 deletions(-)
[...]
> diff --git a/libavutil/opencl.h b/libavutil/opencl.h
> index 6ebde10..9679129 100644
> --- a/libavutil/opencl.h
> +++ b/libavutil/opencl.h
> @@ -39,6 +39,32 @@
>
> #define AV_OPENCL_MAX_KERNEL_NAME_SIZE 150
>
> +#define AV_OPENCL_MAX_PLATFORM_NUM 200
> +
> +#define AV_OPENCL_MAX_DEVICE_NUM 200
> +
> +#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[AV_OPENCL_MAX_DEVICE_NUM];
> +}AVOpenCLPlatformNode;
> +
> +typedef struct {
> + int platform_num;
> + AVOpenCLPlatformNode platform_node[AV_OPENCL_MAX_PLATFORM_NUM];
> +}AVOpenCLDeviceList;
> +
> typedef struct {
> cl_command_queue command_queue;
> cl_kernel kernel;
> @@ -49,13 +75,45 @@ 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().
> + *
> + * @return pointer to allocated device list
> + */
> +AVOpenCLDeviceList *av_opencl_get_device_list(void);
> +
> +/**
> + * 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);
> +
> +/**
> +* Currently, the only accepted option are "buildoptions", "platform", "device".
> +*
> +* buildoptions:used to set options to compile registered kernels code. See reference "OpenCL
> +* Specification Version: 1.2 chapter 5.6.4".
> +*
> +* platform: index of platform in device list
> +*
> +* device: index of device in device list
> +*
> +* @param key key of options
> +* @param value value of options
> +* @return >=0 on success, a negative error code in case of failure
> +*/
> +int av_opencl_set_option(const char *key, const char *val);
adding a av_opencl_get_option() might make sense as well for
symmetry so users can also read out the used/choosen values
> +
> +/**
> * Allocate OpenCL external environment.
> *
> * It must be freed with av_opencl_free_external_env().
> @@ -87,16 +145,11 @@ int av_opencl_register_kernel_code(const char *kernel_code);
> * Initialize the run time OpenCL environment and compile the kernel
> * code registered with av_opencl_register_kernel_code().
> *
> - * Currently, the only accepted option is "build_options", used to set
> - * options to compile registered kernels code. See reference "OpenCL
> - * Specification Version: 1.2 chapter 5.6.4".
> - *
> - * @param options dictionary of key/value options
> * @param ext_opencl_env external OpenCL environment, created by an
> * application program, ignored if set to NULL
> * @return >=0 on success, a negative error code in case of failure
> */
> - int av_opencl_init(AVDictionary *options, AVOpenCLExternalEnv *ext_opencl_env);
> + int av_opencl_init(AVOpenCLExternalEnv *ext_opencl_env);
for changing recently added API its probably a good idea to also bump
the libavutil minor version number
[...]
PS: also you probably want to add yourself to the MAINTAINERS file
though thats seperate from this patch
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130409/0e2aca2c/attachment.asc>
More information about the ffmpeg-devel
mailing list