Files
libreoffice/opencl
Giuseppe Bilotta 0d4204e87f OpenCL: correctly handle platforms without devices
When an OpenCL platform has no devices (of the requested type), calls to
clGetDeviceIDs() are required to return with the error value
CL_DEVICE_NOT_FOUND.

Some platforms (e.g. Clover as of Mesa 10.4.2) do not touch their output
parameters in such cases, which means that in some conditions the `num`
variable where the number of devices of the platform should be stored
may be used uninitialized. This can lead to segmentations faults in the
subsequent calls to clGetDeviceInfo().

Simply reinitializing num to 0 is sufficient to prevent the segfault in
the case of Mesa, but proper error handling is included for
completeness.

Change-Id: Ia25192f6aa953838a545a9e7c9fca050d2703b60
Reviewed-on: https://gerrit.libreoffice.org/14700
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2015-03-02 11:24:08 +00:00
..

OpenCL-related code that is not specific to any particular
functionality OpenCL is used for. (Like formula group calculation in
Calc.)

Not compiled on platforms where OpenCL is not available (iOS and
Android). On other platforms OpenCL is optional at run-time, but not
at build time.