[Beignet] [PATCH] enable clGetContextInfo with CL_CONTEXT_DEVICES

Zhigang Gong zhigang.gong at linux.intel.com
Tue May 7 01:06:16 PDT 2013


Thanks for the patch. I pushed with only indent modification. We don't use tab and
the use 2 space indent.

On Mon, May 06, 2013 at 05:49:50PM +0200, Mario Kicherer wrote:
> The following patch enables the clGetContextInfo query with CL_CONTEXT_DEVICES.
> Applications can query the required size of the result buffer and then request
> the cl_device_id of the available devices in this context.
> 
> Signed-off-by: Mario Kicherer <dev at kicherer.org>
> ---
>  src/cl_api.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/src/cl_api.c b/src/cl_api.c
> index 03cc0e6..570ba7d 100644
> --- a/src/cl_api.c
> +++ b/src/cl_api.c
> @@ -159,7 +159,24 @@ clGetContextInfo(cl_context      context,
>                   void *          param_value,
>                   size_t *        param_value_size_ret)
>  {
> -  NOT_IMPLEMENTED;
> +  switch (param_name) {
> +	  case CL_CONTEXT_DEVICES:
> +		  if (param_value) {
> +			  if (param_value_size < sizeof(cl_device_id))
> +				  return CL_INVALID_VALUE;
> +			  cl_device_id *device_list = (cl_device_id*)param_value;
> +			  device_list[0] = context->device;
> +			  if (param_value_size_ret)
> +				  *param_value_size_ret = sizeof(cl_device_id);
> +			  return CL_SUCCESS;
> +		  }
> +		  if (param_value_size_ret) {
> +			  *param_value_size_ret = sizeof(cl_device_id);
> +			  return CL_SUCCESS;
> +		  }
> +	  default:
> +		  NOT_IMPLEMENTED;
> +  }
>    return 0;
>  }
>  
> -- 
> 1.8.1.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list