Home | History | Annotate | Download | only in ocl
      1 /*
      2  * cl_event.h - CL event
      3  *
      4  *  Copyright (c) 2015 Intel Corporation
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  *
     18  * Author: Wind Yuan <feng.yuan (at) intel.com>
     19  */
     20 
     21 #ifndef XCAM_CL_EVENT_H
     22 #define XCAM_CL_EVENT_H
     23 
     24 #include <xcam_std.h>
     25 #include <list>
     26 #include <CL/cl.h>
     27 
     28 namespace XCam {
     29 
     30 class CLEvent;
     31 
     32 typedef std::list<SmartPtr<CLEvent>> CLEventList;
     33 
     34 class CLEvent {
     35 public:
     36     explicit CLEvent (cl_event event_id = NULL);
     37     ~CLEvent ();
     38     void set_event_id (cl_event event_id) {
     39         _event_id = event_id;
     40     }
     41     cl_event &get_event_id () {
     42         return _event_id;
     43     }
     44 
     45     XCamReturn wait ();
     46 
     47     bool get_cl_event_info (
     48         cl_event_info param_name, size_t param_size,
     49         void *param, size_t *param_size_ret = NULL);
     50 
     51 private:
     52 
     53     XCAM_DEAD_COPY (CLEvent);
     54 
     55 public:
     56     static SmartPtr<CLEvent>  NullEvent;
     57     static CLEventList EmptyList;
     58 
     59 private:
     60     cl_event  _event_id;
     61 };
     62 
     63 XCamReturn
     64 cl_events_wait (CLEventList &event_list);
     65 };
     66 
     67 #endif //XCAM_CL_EVENT_H