mirror of https://github.com/commaai/cereal.git
Add optional CLContext argument to VisionIpcClient (#510)
* Add optional CLContext argument to VisionIpcClient * Remove CL_DEVICE_TYPE_DEFAULT
This commit is contained in:
parent
774bf79f4d
commit
a5378db82d
|
@ -8,7 +8,12 @@ from libc.stdint cimport uint32_t, uint64_t
|
|||
from libcpp cimport bool, int
|
||||
|
||||
cdef extern from "cereal/visionipc/visionbuf.h":
|
||||
struct _cl_device_id
|
||||
struct _cl_context
|
||||
struct _cl_mem
|
||||
|
||||
ctypedef _cl_device_id * cl_device_id
|
||||
ctypedef _cl_context * cl_context
|
||||
ctypedef _cl_mem * cl_mem
|
||||
|
||||
cdef enum VisionStreamType:
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
#cython: language_level=3
|
||||
|
||||
from .visionipc cimport VisionBuf as cppVisionBuf
|
||||
from .visionipc cimport cl_device_id, cl_context
|
||||
|
||||
cdef class CLContext:
|
||||
cdef cl_device_id device_id
|
||||
cdef cl_context context
|
||||
|
||||
cdef class VisionBuf:
|
||||
cdef cppVisionBuf * buf
|
||||
|
|
|
@ -98,8 +98,11 @@ cdef class VisionIpcClient:
|
|||
cdef cppVisionIpcClient * client
|
||||
cdef VisionIpcBufExtra extra
|
||||
|
||||
def __cinit__(self, string name, VisionStreamType stream, bool conflate):
|
||||
self.client = new cppVisionIpcClient(name, stream, conflate, NULL, NULL)
|
||||
def __cinit__(self, string name, VisionStreamType stream, bool conflate, CLContext context = None):
|
||||
if context:
|
||||
self.client = new cppVisionIpcClient(name, stream, conflate, context.device_id, context.context)
|
||||
else:
|
||||
self.client = new cppVisionIpcClient(name, stream, conflate, NULL, NULL)
|
||||
|
||||
def __dealloc__(self):
|
||||
del self.client
|
||||
|
|
Loading…
Reference in New Issue