Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/common/opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1832,26 +1832,26 @@ static char *_strsep(char **stringp,
static void _opencl_priority_parse(dt_opencl_t *cl,
char *configstr,
int *priority_list,
int *mandatory)
gboolean *mandatory)
{
const int devs = cl->num_devs;
int count = 0;
int *full = malloc(sizeof(int) * (devs + 1));
int mnd = 0;
gboolean mnd = FALSE;

// NULL or empty configstring?
if(configstr == NULL || *configstr == '\0')
{
priority_list[0] = -1;
*mandatory = 0;
*mandatory = FALSE;
free(full);
return;
}

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

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

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

free(full);
}
Expand Down Expand Up @@ -1980,7 +1980,7 @@ static void _opencl_update_priorities(const char *configstr)
" \t\timage\tpreview\texport\tthumbs\tpreview2\n");
for(int i = 0; i < cl->num_devs; i++)
dt_print_nts(DT_DEBUG_OPENCL,
"[dt_opencl_update_priorities]\t\t%d\t%d\t%d\t%d\t%d\n",
"[opencl_update_priorities]\t\t%d\t%d\t%d\t%d\t%d\n",
cl->dev_priority_image[i],
cl->dev_priority_preview[i], cl->dev_priority_export[i],
cl->dev_priority_thumbnail[i], cl->dev_priority_preview2[i]);
Expand All @@ -1991,9 +1991,10 @@ static void _opencl_update_priorities(const char *configstr)
"[opencl_update_priorities]"
" \t\timage\tpreview\texport\tthumbs\tpreview2\n");
dt_print_nts(DT_DEBUG_OPENCL,
"[opencl_update_priorities]\t\t%d\t%d\t%d\t%d\t%d\n",
cl->mandatory[0], cl->mandatory[1], cl->mandatory[2],
cl->mandatory[3], cl->mandatory[4]);
"[opencl_update_priorities]\t\t%s\t%s\t%s\t%s\t%s\n",
STR_YESNO(cl->mandatory[0]), STR_YESNO(cl->mandatory[1]),
STR_YESNO(cl->mandatory[2]), STR_YESNO(cl->mandatory[3]),
STR_YESNO(cl->mandatory[4]));
}

int dt_opencl_lock_device(const int pipetype)
Expand All @@ -2005,7 +2006,7 @@ int dt_opencl_lock_device(const int pipetype)

const size_t prio_size = sizeof(int) * (cl->num_devs + 1);
int *priority = malloc(prio_size);
int mandatory;
gboolean mandatory;
gboolean heavy = FALSE;

switch(pipetype & DT_DEV_PIXELPIPE_ANY)
Expand Down Expand Up @@ -2036,7 +2037,7 @@ int dt_opencl_lock_device(const int pipetype)
default:
free(priority);
priority = NULL;
mandatory = 0;
mandatory = FALSE;
}

dt_pthread_mutex_unlock(&cl->lock);
Expand Down
2 changes: 1 addition & 1 deletion src/common/opencl.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ typedef struct dt_opencl_t
int opencl_synchronization_timeout;
dt_opencl_scheduling_profile_t scheduling_profile;
uint32_t crc;
int mandatory[5];
gboolean mandatory[5];
int *dev_priority_image;
int *dev_priority_preview;
int *dev_priority_preview2;
Expand Down
Loading