Skip to content

Commit d393fd9

Browse files
Mandatory for pipes is a gboolean
It's not an int but a bool so let's declare it so and report it too.
1 parent ca35370 commit d393fd9

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/common/opencl.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,26 +1832,26 @@ static char *_strsep(char **stringp,
18321832
static void _opencl_priority_parse(dt_opencl_t *cl,
18331833
char *configstr,
18341834
int *priority_list,
1835-
int *mandatory)
1835+
gboolean *mandatory)
18361836
{
18371837
const int devs = cl->num_devs;
18381838
int count = 0;
18391839
int *full = malloc(sizeof(int) * (devs + 1));
1840-
int mnd = 0;
1840+
gboolean mnd = FALSE;
18411841

18421842
// NULL or empty configstring?
18431843
if(configstr == NULL || *configstr == '\0')
18441844
{
18451845
priority_list[0] = -1;
1846-
*mandatory = 0;
1846+
*mandatory = FALSE;
18471847
free(full);
18481848
return;
18491849
}
18501850

18511851
// check if user wants us to force-use opencl device(s)
18521852
if(configstr[0] == '+')
18531853
{
1854-
mnd = 1;
1854+
mnd = TRUE;
18551855
configstr++;
18561856
}
18571857

@@ -1921,7 +1921,7 @@ static void _opencl_priority_parse(dt_opencl_t *cl,
19211921
while(count < devs + 1) priority_list[count++] = -1;
19221922

19231923
// opencl use can only be mandatory if at least one opencl device is given
1924-
*mandatory = (priority_list[0] != -1) ? mnd : 0;
1924+
*mandatory = (priority_list[0] != -1) ? mnd : FALSE;
19251925

19261926
free(full);
19271927
}
@@ -1980,7 +1980,7 @@ static void _opencl_update_priorities(const char *configstr)
19801980
" \t\timage\tpreview\texport\tthumbs\tpreview2\n");
19811981
for(int i = 0; i < cl->num_devs; i++)
19821982
dt_print_nts(DT_DEBUG_OPENCL,
1983-
"[dt_opencl_update_priorities]\t\t%d\t%d\t%d\t%d\t%d\n",
1983+
"[opencl_update_priorities]\t\t%d\t%d\t%d\t%d\t%d\n",
19841984
cl->dev_priority_image[i],
19851985
cl->dev_priority_preview[i], cl->dev_priority_export[i],
19861986
cl->dev_priority_thumbnail[i], cl->dev_priority_preview2[i]);
@@ -1991,9 +1991,10 @@ static void _opencl_update_priorities(const char *configstr)
19911991
"[opencl_update_priorities]"
19921992
" \t\timage\tpreview\texport\tthumbs\tpreview2\n");
19931993
dt_print_nts(DT_DEBUG_OPENCL,
1994-
"[opencl_update_priorities]\t\t%d\t%d\t%d\t%d\t%d\n",
1995-
cl->mandatory[0], cl->mandatory[1], cl->mandatory[2],
1996-
cl->mandatory[3], cl->mandatory[4]);
1994+
"[opencl_update_priorities]\t\t%s\t%s\t%s\t%s\t%s\n",
1995+
cl->mandatory[0] ? "yes" : "no", cl->mandatory[1] ? "yes" : "no",
1996+
cl->mandatory[2] ? "yes" : "no", cl->mandatory[3] ? "yes" : "no",
1997+
cl->mandatory[4] ? "yes" : "no");
19971998
}
19981999

19992000
int dt_opencl_lock_device(const int pipetype)
@@ -2005,7 +2006,7 @@ int dt_opencl_lock_device(const int pipetype)
20052006

20062007
const size_t prio_size = sizeof(int) * (cl->num_devs + 1);
20072008
int *priority = malloc(prio_size);
2008-
int mandatory;
2009+
gboolean mandatory;
20092010
gboolean heavy = FALSE;
20102011

20112012
switch(pipetype & DT_DEV_PIXELPIPE_ANY)
@@ -2036,7 +2037,7 @@ int dt_opencl_lock_device(const int pipetype)
20362037
default:
20372038
free(priority);
20382039
priority = NULL;
2039-
mandatory = 0;
2040+
mandatory = FALSE;
20402041
}
20412042

20422043
dt_pthread_mutex_unlock(&cl->lock);

src/common/opencl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ typedef struct dt_opencl_t
241241
int opencl_synchronization_timeout;
242242
dt_opencl_scheduling_profile_t scheduling_profile;
243243
uint32_t crc;
244-
int mandatory[5];
244+
gboolean mandatory[5];
245245
int *dev_priority_image;
246246
int *dev_priority_preview;
247247
int *dev_priority_preview2;

0 commit comments

Comments
 (0)