[Beignet] [PATCH] Add pfn_notify support in clCreateContext.

Lu, Guanqun guanqun.lu at intel.com
Tue Aug 27 18:26:46 PDT 2013


hi,

sorry to be nitpicked, but this patch does two small things, one is in your description, the other is indention. mixing these two is confusing for reviewers. it would be great if this can be fixed in next version. :)


> -----Original Message-----
> From: beignet-bounces+guanqun.lu=intel.com at lists.freedesktop.org
> [mailto:beignet-bounces+guanqun.lu=intel.com at lists.freedesktop.org] On
> Behalf Of Yang Rong
> Sent: Monday, August 26, 2013 3:45 PM
> To: beignet at lists.freedesktop.org
> Cc: Yang, Rong R
> Subject: [Beignet] [PATCH] Add pfn_notify support in clCreateContext.
> 
> Remove assert in cl_create_context when pfn_notify is not NULL,
> and save it, but don't used now.
> Per spec, driver should call it when devices becomes unavailable.
> Now driver doesn't check the device status.
> 
> Signed-off-by: Yang Rong <rong.r.yang at intel.com>
> ---
>  src/cl_context.c |  5 ++++-
>  src/cl_context.h | 10 +++++++---
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/cl_context.c b/src/cl_context.c
> index a48436c..822fdf5 100644
> --- a/src/cl_context.c
> +++ b/src/cl_context.c
> @@ -123,7 +123,6 @@ cl_create_context(const cl_context_properties *
> properties,
>    cl_int err = CL_SUCCESS;
>    cl_uint prop_len = 0;
>    /* XXX */
> -  FATAL_IF (pfn_notify != NULL || user_data != NULL, "Unsupported call
> back");
>    FATAL_IF (num_devices != 1, "Only one device is supported");
> 
>    /* Check that we are getting the right platform */
> @@ -144,6 +143,10 @@ cl_create_context(const cl_context_properties *
> properties,
>    /* Attach the device to the context */
>    ctx->device = *devices;
> 
> +  /* Save the user callback and user data*/
> +  ctx->pfn_notify = pfn_notify;
> +  ctx->user_data = user_data;
> +
>  exit:
>    if (errcode_ret != NULL)
>      *errcode_ret = err;
> diff --git a/src/cl_context.h b/src/cl_context.h
> index 718d589..b1ef479 100644
> --- a/src/cl_context.h
> +++ b/src/cl_context.h
> @@ -1,4 +1,4 @@
> -/*
> +/*
>   * Copyright © 2012 Intel Corporation
>   *
>   * This library is free software; you can redistribute it and/or
> @@ -44,8 +44,8 @@ struct _cl_context_prop {
>    enum _cl_gl_context_type gl_type;
>    cl_context_properties gl_context;
>    union {
> -    cl_context_properties egl_display;
> -    cl_context_properties glx_display;
> +    cl_context_properties egl_display;
> +    cl_context_properties glx_display;
>      cl_context_properties wgl_hdc;
>      cl_context_properties cgl_sharegroup;
>    };
> @@ -72,6 +72,10 @@ struct _cl_context {
>    struct _cl_context_prop props;
>    cl_context_properties * prop_user; /* a copy of user passed context
> properties when create context */
>    cl_uint                 prop_len;  /* count of the properties */
> +  void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *);
> +                                     /* User's callback when error
> occur in context */
> +  void *user_data;                   /* A pointer to user supplied data
> */
> +
>  };
> 
>  /* Implement OpenCL function */
> --
> 1.8.1.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list