1 /*
2     This file is part of darktable,
3     Copyright (C) 2016-2020 darktable developers.
4 
5     darktable is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9 
10     darktable is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with darktable.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 
21 #include <string.h>
22 
23 // FIXME: in the future, we may want to also take DRIVER_VERSION into account
24 static const gchar *bad_opencl_drivers[] =
25 {
26   // clang-format off
27 
28   "beignet",
29   "pocl",
30 /*
31   Neo was originally blacklisted due to improper cache invalidation, but this has been fixed.
32   During the discussion of that issue in pull request 2033, it was hinted that Neo may be still be
33   problematic on Windows, so keep it blacklisted there for now
34 
35   TODO:  Determine if Windows failures were due to the same cache invalidation issue.
36 */
37 #if defined _WIN32
38   "neo",
39 #endif
40   NULL
41 
42   // clang-format on
43 };
44 
45 // 0 - ok
46 // else it is blacklisted
dt_opencl_check_driver_blacklist(const char * device_version)47 int dt_opencl_check_driver_blacklist(const char *device_version)
48 {
49   gchar *device = g_ascii_strdown(device_version, -1);
50 
51   for(int i = 0; bad_opencl_drivers[i]; i++)
52   {
53     if(!g_strrstr(device, bad_opencl_drivers[i])) continue;
54 
55     // oops, found in black list
56     g_free(device);
57     return 1;
58   }
59 
60   // did not find in the black list, guess it's ok.
61   g_free(device);
62   return 0;
63 }
64 
65 // modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
66 // vim: shiftwidth=2 expandtab tabstop=2 cindent
67 // kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
68