diff --git a/src/common/darktable.c b/src/common/darktable.c index 9a48b38bc72d..9e1f094667be 100644 --- a/src/common/darktable.c +++ b/src/common/darktable.c @@ -2468,7 +2468,7 @@ void dt_configure_runtime_performance(const int old, char *info) dt_conf_set_bool("cache_disk_backend_full", largedisk); dt_print(DT_DEBUG_DEV, "[dt_configure_runtime_performance] cache_disk_backend_full=%s", - (largedisk) ? "TRUE" : "FALSE"); + STR_TRUEFALSE(largedisk)); } gboolean updated_mandatory = FALSE; diff --git a/src/common/darktable.h b/src/common/darktable.h index 40a2e3c375e7..54191d1aa119 100644 --- a/src/common/darktable.h +++ b/src/common/darktable.h @@ -158,6 +158,10 @@ G_BEGIN_DECLS #define __DT_CLONE_TARGETS__ #endif + +#define STR_YESNO(b) ((b) ? "YES" : "NO") +#define STR_TRUEFALSE(b) ((b) ? "TRUE" : "FALSE") + typedef int32_t dt_imgid_t; typedef int32_t dt_filmid_t; #define NO_IMGID (0) diff --git a/src/common/opencl.c b/src/common/opencl.c index a1f5ca4a6cc2..a377cfe34a2d 100644 --- a/src/common/opencl.c +++ b/src/common/opencl.c @@ -544,7 +544,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, char *filename = calloc(PATH_MAX, sizeof(char)); char *confentry = calloc(PATH_MAX, sizeof(char)); char *binname = calloc(PATH_MAX, sizeof(char)); - dt_print_nts(DT_DEBUG_OPENCL, "\n[dt_opencl_device_init]\n"); + dt_print_nts(DT_DEBUG_OPENCL, "\n[dt_opencl_device_init] "); // test GPU availability, vendor, memory, image support etc: (cl->dlocl->symbols->dt_clGetDeviceInfo)(devid, CL_DEVICE_AVAILABLE, @@ -555,7 +555,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, if(err != CL_SUCCESS) { dt_print_nts(DT_DEBUG_OPENCL, - " *** could not get vendor name of device %d: %s\n", k, cl_errstr(err)); + "*** could not get vendor name of device %d: %s\n", k, cl_errstr(err)); res = TRUE; goto end; } @@ -568,7 +568,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, if(err != CL_SUCCESS) { dt_print_nts(DT_DEBUG_OPENCL, - " *** could not get device name of device %d: %s\n", + "*** could not get device name of device %d: %s\n", k, cl_errstr(err)); res = TRUE; goto end; @@ -584,7 +584,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, g_strlcpy(platform_vendor, "no platform id", DT_OPENCL_CBUFFSIZE); g_strlcpy(platform_display_name, "no platform id", DT_OPENCL_CBUFFSIZE); dt_print_nts(DT_DEBUG_OPENCL, - " *** could not get platform id for device `%s' : %s\n", + "*** could not get platform id for device `%s' : %s\n", device_name, cl_errstr(err)); } else @@ -596,7 +596,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, has_platform_name = FALSE; g_strlcpy(platform_display_name, "???", DT_OPENCL_CBUFFSIZE); dt_print_nts(DT_DEBUG_OPENCL, - " *** could not get platform name for device `%s' : %s\n", + "*** could not get platform name for device `%s' : %s\n", device_name, cl_errstr(err)); } @@ -605,7 +605,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, if(err != CL_SUCCESS) { dt_print_nts(DT_DEBUG_OPENCL, - " *** could not get platform vendor for device `%s' : %s\n", + "*** could not get platform vendor for device `%s' : %s\n", device_name, cl_errstr(err)); g_strlcpy(platform_vendor, "???", DT_OPENCL_CBUFFSIZE); } @@ -626,7 +626,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, { device_name_cleaned = g_strchomp(_strsep(&device_name_cleaned, "(")); dt_print_nts(DT_DEBUG_OPENCL, - "OpenCL Mesa platform `%s' --> `%s'\n", + "%s %s ", platform_vendor, device_name_cleaned); is_mesa = TRUE; } @@ -648,7 +648,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, const gboolean newdevice = dt_opencl_read_device_config(dev); dt_print_nts(DT_DEBUG_OPENCL, - " DEVICE: %d: '%s'%s\n", + "\n DEVICE: %d: '%s'%s\n", k, device_name, (newdevice) ? ", NEW" : "" ); dt_print_nts(DT_DEBUG_OPENCL, " CONF KEY: %s%s\n", @@ -867,11 +867,11 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, } dt_print_nts(DT_DEBUG_OPENCL, - " ASYNC PIXELPIPE: %s\n", cl->dev[dev].asyncmode ? "YES" : "NO"); + " ASYNC PIXELPIPE: %s\n", STR_YESNO(cl->dev[dev].asyncmode)); dt_print_nts(DT_DEBUG_OPENCL, - " PINNED MEMORY TRANSFER: %s\n", cl->dev[dev].pinned_memory ? "YES" : "NO"); + " PINNED MEMORY TRANSFER: %s\n", STR_YESNO(cl->dev[dev].pinned_memory)); dt_print_nts(DT_DEBUG_OPENCL, - " AVOID ATOMICS: %s\n", cl->dev[dev].avoid_atomics ? "YES" : "NO"); + " AVOID ATOMICS: %s\n", STR_YESNO(cl->dev[dev].avoid_atomics)); dt_print_nts(DT_DEBUG_OPENCL, " MICRO NAP: %i\n", cl->dev[dev].micro_nap); dt_print_nts(DT_DEBUG_OPENCL, @@ -881,7 +881,7 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, dt_print_nts(DT_DEBUG_OPENCL, " TILING ADVANTAGE: %.3f\n", cl->dev[dev].advantage); dt_print_nts(DT_DEBUG_OPENCL, - " DEFAULT DEVICE: %s\n", (type & CL_DEVICE_TYPE_DEFAULT) ? "YES" : "NO"); + " DEFAULT DEVICE: %s\n", STR_YESNO(type & CL_DEVICE_TYPE_DEFAULT)); if(cl->dev[dev].disabled) { @@ -1061,9 +1061,9 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, if(!programname || programname[0] == '\0' || prog < 0) { - dt_print(DT_DEBUG_OPENCL, + dt_print_nts(DT_DEBUG_OPENCL, "[dt_opencl_device_init] malformed entry in programs.conf `%s';" - " ignoring it!", confentry); + " ignoring it\n", confentry); continue; } @@ -1071,16 +1071,16 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, "%s" G_DIR_SEPARATOR_S "%s", kerneldir, programname); snprintf(binname, PATH_MAX * sizeof(char), "%s" G_DIR_SEPARATOR_S "%s.bin", cachedir, programname); - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, - "[dt_opencl_device_init] testing program `%s' ..", programname); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + "[dt_opencl_device_init] testing program `%s'\n", programname); gboolean loaded_cached; char md5sum[33]; if(_opencl_load_program(dev, prog, programname, filename, binname, cachedir, md5sum, includemd5, &loaded_cached) && _opencl_build_program(dev, prog, binname, cachedir, md5sum, loaded_cached)) { - dt_print(DT_DEBUG_OPENCL, - "[dt_opencl_device_init] failed to compile program `%s'!", + dt_print_nts(DT_DEBUG_OPENCL, + "[dt_opencl_device_init] failed to compile program `%s'\n", programname); fclose(f); g_strfreev(tokens); @@ -1093,12 +1093,12 @@ static gboolean _opencl_device_init(dt_opencl_t *cl, fclose(f); dt_print_nts(DT_DEBUG_OPENCL, - " KERNEL LOADING TIME: %2.4lf sec\n", dt_get_lap_time(&tstart)); + " KERNEL LOADING TIME: %.4lf sec\n", dt_get_lap_time(&tstart)); } else { dt_print_nts(DT_DEBUG_OPENCL, - "[dt_opencl_device_init] could not open `%s'!\n", filename); + "[dt_opencl_device_init] could not open `%s'\n", filename); res = TRUE; goto end; } @@ -1165,14 +1165,14 @@ void dt_opencl_init(dt_opencl_t *cl, if(exclude_opencl) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] opencl disabled due to explicit user request"); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] opencl disabled due to explicit user request\n"); goto finally; } if(!opencl_requested) - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] opencl disabled via darktable preferences"); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] opencl disabled via darktable preferences\n"); // look for explicit definition of opencl_runtime library in preferences const char *library = dt_conf_get_string_const("opencl_library"); @@ -1182,17 +1182,17 @@ void dt_opencl_init(dt_opencl_t *cl, if(cl->dlocl == NULL) { logerror = _("no working OpenCL library found"); - dt_print(DT_DEBUG_OPENCL, + dt_print_nts(DT_DEBUG_OPENCL, "[opencl_init] no working opencl '%s' library found." - " Continue with opencl disabled", + " Continue with opencl disabled\n", (strlen(library) == 0) ? "default path" : library); goto finally; } else { - dt_print(DT_DEBUG_OPENCL, + dt_print_nts(DT_DEBUG_OPENCL, "[opencl_init] opencl library '%s' found on your system and loaded," - " preference '%s'", + " preference '%s'\n", cl->dlocl->library, (strlen(library) == 0) ? "default path" : library); } @@ -1212,8 +1212,8 @@ void dt_opencl_init(dt_opencl_t *cl, cl_int err = (cl->dlocl->symbols->dt_clGetPlatformIDs)(0, NULL, &num_platforms); if((err != CL_SUCCESS) || (num_platforms == 0)) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] %i platforms detected, error: %s", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] %i platforms detected, error: %s\n", num_platforms, cl_errstr(err)); goto finally; } @@ -1223,19 +1223,19 @@ void dt_opencl_init(dt_opencl_t *cl, (DT_OPENCL_MAX_PLATFORMS, all_platforms, &num_platforms); if(err != CL_SUCCESS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] could not get platforms IDs: %s", cl_errstr(err)); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] could not get platforms IDs: %s\n", cl_errstr(err)); goto finally; } if(num_platforms == 0) { - dt_print(DT_DEBUG_OPENCL, "[opencl_init] no opencl platform available"); + dt_print_nts(DT_DEBUG_OPENCL, "[opencl_init] no opencl platform available\n"); goto finally; } logerror = NULL; - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] found %d platform%s", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] found %d platform%s\n", num_platforms, num_platforms > 1 ? "s" : ""); // safety check for platforms; we must not have several versions for the same platform @@ -1252,8 +1252,8 @@ void dt_opencl_init(dt_opencl_t *cl, for(int k = 0; k < n; k++) { if(!strcmp(platforms + n * DT_OPENCL_CBUFFSIZE, platforms + k * DT_OPENCL_CBUFFSIZE)) - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] possibly a multiple platform problem for `%s'", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] WARNING possibly a multiple platform problem for `%s'\n", platforms + n * DT_OPENCL_CBUFFSIZE); } } @@ -1304,18 +1304,18 @@ void dt_opencl_init(dt_opencl_t *cl, { if(!valid_platform) { - dt_print(DT_DEBUG_OPENCL, - "[check platform] platform '%s' with key '%s' is NOT active", + dt_print_nts(DT_DEBUG_OPENCL, + "[check platform] platform '%s' with key '%s' is NOT active\n", platform_name, platform_key); } else if((errn == CL_SUCCESS) && (errv == CL_SUCCESS)) - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] no devices found for %s (vendor) - %s (name)", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] no devices found for %s (vendor) - %s (name)\n", platform_vendor, platform_name); else { - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] no devices found for unknown platform"); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] no devices found for unknown platform\n"); logerror = _("no devices found for unknown platform"); } all_num_devices[n] = 0; @@ -1329,8 +1329,8 @@ void dt_opencl_init(dt_opencl_t *cl, if(err != CL_SUCCESS) { all_num_devices[n] = 0; - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] could not get profile for platform '%s': %s", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] could not get profile for platform '%s': %s\n", platform_name, cl_errstr(err)); } else @@ -1338,8 +1338,8 @@ void dt_opencl_init(dt_opencl_t *cl, if(strcmp("FULL_PROFILE", profile) != 0) { all_num_devices[n] = 0; - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] platform '%s' is not FULL_PROFILE", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] platform '%s' is not FULL_PROFILE\n", platform_name); } } @@ -1361,8 +1361,8 @@ void dt_opencl_init(dt_opencl_t *cl, cl->dev = NULL; free(devices); devices = NULL; - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] could not allocate memory for device resources"); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] could not allocate memory for device resources\n"); logerror = _("not enough memory for OpenCL devices"); goto finally; } @@ -1382,8 +1382,8 @@ void dt_opencl_init(dt_opencl_t *cl, if(err != CL_SUCCESS) { num_devices -= all_num_devices[n]; - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] could not get devices list: %s", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] could not get devices list: %s\n", cl_errstr(err)); } devs += all_num_devices[n]; @@ -1449,9 +1449,9 @@ void dt_opencl_init(dt_opencl_t *cl, } finally: - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] FINALLY: opencl PREFERENCE=%s is %sAVAILABLE and %sENABLED.", - opencl_requested ? "ON" : "OFF", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] FINALLY: opencl PREFERENCE=%s is %sAVAILABLE and %sENABLED\n", + STR_YESNO(opencl_requested), cl->inited ? "" : "NOT ", cl->enabled ? "" : "NOT "); if(cl->inited && cl->enabled) @@ -1502,8 +1502,8 @@ void dt_opencl_init(dt_opencl_t *cl, dt_conf_set_string("opencl_checksum", checksum); // set scheduling profile to "default" dt_conf_set_string("opencl_scheduling_profile", "default"); - dt_print(DT_DEBUG_OPENCL, - "[opencl_init] set scheduling profile to default, setup has changed."); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_init] set scheduling profile to default, setup has changed\n"); dt_control_log(_("OpenCL scheduling profile set to default, setup has changed")); } // apply config settings for scheduling profile: sets device @@ -1600,7 +1600,7 @@ void dt_opencl_cleanup(dt_opencl_t *cl) if(cl->print_statistics && (darktable.unmuted & DT_DEBUG_MEMORY)) { dt_print_nts(DT_DEBUG_OPENCL, - " [opencl_summary_statistics] device '%s' id=%d:" + "[opencl_summary_statistics] device '%s' id=%d:" " peak memory usage %.1f MB%s\n", cl->dev[i].fullname, i, (float)cl->dev[i].peak_memory/(1024*1024), @@ -1614,7 +1614,7 @@ void dt_opencl_cleanup(dt_opencl_t *cl) if(cl->dev[i].totalevents) { dt_print_nts(DT_DEBUG_OPENCL, - " [opencl_summary_statistics] device '%s' id=%d: %d" + "[opencl_summary_statistics] device '%s' id=%d: %d" " out of %d events were " "successful and %d events lost. max event=%d%s%s\n", cl->dev[i].fullname, i, cl->dev[i].totalsuccess, @@ -1630,7 +1630,7 @@ void dt_opencl_cleanup(dt_opencl_t *cl) else { dt_print_nts(DT_DEBUG_OPENCL, - " [opencl_summary_statistics] device '%s' id=%d: NOT utilized\n", + "[opencl_summary_statistics] device '%s' id=%d: NOT utilized\n", cl->dev[i].fullname, i); } } @@ -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]); @@ -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) @@ -2073,7 +2074,7 @@ int dt_opencl_lock_device(const int pipetype) } dt_print(DT_DEBUG_OPENCL, "[opencl_lock_device] reached opencl_mandatory_timeout trying" - " to lock mandatory device, fallback to CPU\n"); + " to lock mandatory device, fallback to CPU"); } else { @@ -2105,15 +2106,15 @@ static FILE *_fopen_stat(const char *filename, struct stat *st) FILE *f = g_fopen(filename, "rb"); if(!f) { - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, - "[opencl_fopen_stat] could not open file `%s'!", filename); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + "[opencl_fopen_stat] could not open file `%s'\n", filename); return NULL; } const int fd = fileno(f); if(fstat(fd, st) < 0) { - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, - "[opencl_fopen_stat] could not stat file `%s'!", filename); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + "[opencl_fopen_stat] could not stat file `%s'\n", filename); return NULL; } return f; @@ -2141,8 +2142,8 @@ static void _opencl_md5sum(const char **files, if(!f) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_md5sums] could not open file `%s'!", filename); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_md5sums] could not open file `%s'\n", filename); *md5sums = NULL; continue; } @@ -2152,8 +2153,8 @@ static void _opencl_md5sum(const char **files, if(!file) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_md5sums] could not allocate buffer for file `%s'!", filename); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_md5sums] could not allocate buffer for file `%s'\n", filename); *md5sums = NULL; fclose(f); continue; @@ -2165,8 +2166,8 @@ static void _opencl_md5sum(const char **files, if(rd != filesize) { free(file); - dt_print(DT_DEBUG_OPENCL, - "[opencl_md5sums] could not read all of file `%s'!", filename); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_md5sums] could not read all of file `%s'\n", filename); *md5sums = NULL; continue; } @@ -2196,17 +2197,17 @@ static gboolean _opencl_load_program(const int dev, if(prog < 0 || prog >= DT_OPENCL_MAX_PROGRAMS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_load_source] invalid program number `%d' of file `%s'!", prog, + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_load_source] invalid program number `%d' of file `%s'\n", prog, filename); return FALSE; } if(cl->dev[dev].program_used[prog]) { - dt_print(DT_DEBUG_OPENCL, + dt_print_nts(DT_DEBUG_OPENCL, "[opencl_load_source] program number `%d' already in use" - " when loading file `%s'!", prog, + " when loading file `%s'\n", prog, filename); return FALSE; } @@ -2223,9 +2224,9 @@ static gboolean _opencl_load_program(const int dev, if(rd != filesize) { free(file); - dt_print(DT_DEBUG_OPENCL, + dt_print_nts(DT_DEBUG_OPENCL, "[opencl_load_source] could not read all" - " of file `%s' for program number %d!", + " of file `%s' for program number %d\n", filename, prog); return FALSE; } @@ -2304,8 +2305,8 @@ static gboolean _opencl_load_program(const int dev, rd = 0; if(rd != cached_filesize) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_load_program] could not read all of file '%s' MD5: %s!", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_load_program] could not read all of file '%s' MD5: %s\n", binname, md5sum); } else @@ -2315,9 +2316,9 @@ static gboolean _opencl_load_program(const int dev, (const unsigned char **)&cached_content, NULL, &err); if(err != CL_SUCCESS) { - dt_print(DT_DEBUG_OPENCL, + dt_print_nts(DT_DEBUG_OPENCL, "[opencl_load_program] could not load cached binary" - " program from file '%s' MD5: '%s'! (%s)", + " program from file '%s' MD5: '%s'! (%s)\n", binname, md5sum, cl_errstr(err)); } else @@ -2351,7 +2352,7 @@ static gboolean _opencl_load_program(const int dev, g_unlink(dup); #endif //!defined(_WIN32) - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, "[opencl_load_program] could not load cached binary program," " trying to compile source\n"); @@ -2362,8 +2363,8 @@ static gboolean _opencl_load_program(const int dev, free(file); if((err != CL_SUCCESS) || (cl->dev[dev].program[prog] == NULL)) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_load_source] could not create program from file `%s'! (%s)", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_load_source] could not create program from file `%s' (%s)\n", filename, cl_errstr(err)); return FALSE; } @@ -2375,13 +2376,13 @@ static gboolean _opencl_load_program(const int dev, else { free(file); - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, "[opencl_load_program] loaded cached" - " binary program from file '%s' MD5: '%s' ", binname, md5sum); + " binary program from file '%s' MD5: '%s'\n", binname, md5sum); } - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, - "[opencl_load_program] successfully loaded program from '%s' MD5: '%s'", + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + "[opencl_load_program] successfully loaded program from '%s' MD5: '%s'\n", filename, md5sum); return TRUE; @@ -2417,26 +2418,26 @@ static gboolean _opencl_build_program(const int dev, } if(err != CL_SUCCESS) - dt_print(DT_DEBUG_OPENCL, - "[opencl_build_program] could not build program: %s", cl_errstr(err)); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_build_program] could not build program: %s\n", cl_errstr(err)); else - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, - "[opencl_build_program] successfully built program"); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + "[opencl_build_program] successfully built program\n"); cl_build_status build_status; (cl->dlocl->symbols->dt_clGetProgramBuildInfo)(program, cl->dev[dev].devid, CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status), &build_status, NULL); - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, - "[opencl_build_program] BUILD STATUS: %d", build_status); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + "[opencl_build_program] BUILD STATUS: %d\n", build_status); char *build_log; size_t ret_val_size; (cl->dlocl->symbols->dt_clGetProgramBuildInfo)(program, cl->dev[dev].devid, CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size); - if(ret_val_size != SIZE_MAX) + if(ret_val_size > 2 && ret_val_size < 0x100000) // we don't want to see nothing or crazy things { build_log = malloc(sizeof(char) * (ret_val_size + 1)); if(build_log) @@ -2447,8 +2448,8 @@ static gboolean _opencl_build_program(const int dev, build_log[ret_val_size] = '\0'; - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, "BUILD LOG:"); - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, "%s", build_log); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, "BUILD LOG:\n"); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, "%s\n", build_log); free(build_log); } @@ -2459,8 +2460,8 @@ static gboolean _opencl_build_program(const int dev, if(!loaded_cached) { - dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, - "[opencl_build_program] saving binary"); + dt_print_nts(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE, + "[opencl_build_program] saving binary\n"); cl_uint numdev = 0; err = (cl->dlocl->symbols->dt_clGetProgramInfo)(program, CL_PROGRAM_NUM_DEVICES, @@ -2468,8 +2469,8 @@ static gboolean _opencl_build_program(const int dev, &numdev, NULL); if(err != CL_SUCCESS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_build_program] CL_PROGRAM_NUM_DEVICES failed: %s", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_build_program] CL_PROGRAM_NUM_DEVICES failed: %s\n", cl_errstr(err)); return TRUE; } @@ -2480,8 +2481,8 @@ static gboolean _opencl_build_program(const int dev, devices, NULL); if(err != CL_SUCCESS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_build_program] CL_PROGRAM_DEVICES failed: %s", cl_errstr(err)); + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_build_program] CL_PROGRAM_DEVICES failed: %s\n", cl_errstr(err)); free(devices); return TRUE; } @@ -2492,8 +2493,8 @@ static gboolean _opencl_build_program(const int dev, binary_sizes, NULL); if(err != CL_SUCCESS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_build_program] CL_PROGRAM_BINARY_SIZES failed: %s", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_build_program] CL_PROGRAM_BINARY_SIZES failed: %s\n", cl_errstr(err)); free(binary_sizes); free(devices); @@ -2508,8 +2509,8 @@ static gboolean _opencl_build_program(const int dev, binaries, NULL); if(err != CL_SUCCESS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_build_program] CL_PROGRAM_BINARIES failed: %s", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_build_program] CL_PROGRAM_BINARIES failed: %s\n", cl_errstr(err)); goto ret; } @@ -2558,8 +2559,8 @@ static gboolean _opencl_build_program(const int dev, free(binary_sizes); free(devices); if(err != CL_SUCCESS) - dt_print(DT_DEBUG_OPENCL, - "[dt_opencl_build_program] problems while writing OpenCL kernel files"); + dt_print_nts(DT_DEBUG_OPENCL, + "[dt_opencl_build_program] problems while writing OpenCL kernel files\n"); } return err != CL_SUCCESS; @@ -2576,8 +2577,8 @@ int dt_opencl_create_kernel(const int prog, if(k >= DT_OPENCL_MAX_KERNELS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_create_kernel] too many kernels! can't create kernel `%s'", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_create_kernel] too many kernels! can't create kernel `%s'\n", name); return -1; } @@ -2608,8 +2609,8 @@ static gboolean _check_kernel(const int dev, (cl->dev[dev].program[prog], cl->name_saved[kernel], &err); if(err != CL_SUCCESS) { - dt_print(DT_DEBUG_OPENCL, - "[opencl_create_kernel] could not create kernel `%s' for '%s' id=%d: (%s)", + dt_print_nts(DT_DEBUG_OPENCL, + "[opencl_create_kernel] could not create kernel `%s' for '%s' id=%d: (%s)\n", cl->name_saved[kernel], cl->dev[dev].fullname, dev, cl_errstr(err)); cl->dev[dev].kernel_used[kernel] = FALSE; cl->name_saved[kernel] = NULL; // don't try again diff --git a/src/imageio/imageio.c b/src/imageio/imageio.c index dc20eed1cd56..2660c06a3aed 100644 --- a/src/imageio/imageio.c +++ b/src/imageio/imageio.c @@ -852,7 +852,7 @@ gboolean dt_imageio_has_mono_preview(const char *filename) dt_print(DT_DEBUG_IMAGEIO, "[dt_imageio_has_mono_preview] testing `%s', monochrome=%s, %ix%i", - filename, mono ? "YES" : "FALSE", thumb_width, thumb_height); + filename, STR_YESNO(mono), thumb_width, thumb_height); dt_free_align(tmp); return mono; } @@ -1302,8 +1302,8 @@ gboolean dt_imageio_export_with_flags(const dt_imgid_t imgid, thumbnail_export ? "thumbnail" : "export", imgid, pipe.processed_width, pipe.processed_height, processed_width, processed_height, scale, max_scale, - upscale ? "yes" : "no", - high_quality_processing || scale > 1.0f ? "yes" : "no", + STR_YESNO(upscale), + STR_YESNO(high_quality_processing || scale > 1.0f), dt_check_gimpmode("file") ? " GIMP" : ""); const int bpp = format->bpp(format_params); diff --git a/src/iop/channelmixerrgb.c b/src/iop/channelmixerrgb.c index 657cf81b3793..e32ee65ebdc9 100644 --- a/src/iop/channelmixerrgb.c +++ b/src/iop/channelmixerrgb.c @@ -2042,7 +2042,7 @@ static void _set_trouble_messages(dt_iop_module_t *self) problem1 ? "white balance applied twice, " : "", problem2 ? "double CAT applied, " : "", problem3 ? "white balance missing, " : "", - _dev_is_D65_chroma(dev) ? "YES" : "NO", + STR_YESNO(_dev_is_D65_chroma(dev)), chr->D65coeffs[0], chr->D65coeffs[1], chr->D65coeffs[2], chr->as_shot[0], chr->as_shot[1], chr->as_shot[2], img->id); diff --git a/src/iop/temperature.c b/src/iop/temperature.c index 4b7c5a7cd0ff..0e858c64a062 100644 --- a/src/iop/temperature.c +++ b/src/iop/temperature.c @@ -1596,9 +1596,9 @@ void reload_defaults(dt_iop_module_t *self) dt_print(DT_DEBUG_PARAMS, "[dt_iop_reload_defaults] scene=%s, modern=%s, CAT=%s. D65 %.3f %.3f %.3f, AS-SHOT %.3f %.3f %.3f", - dt_is_scene_referred() ? "YES" : "NO", - is_modern ? "YES" : "NO", - another_cat_defined ? "YES" : "NO", + STR_YESNO(dt_is_scene_referred()), + STR_YESNO(is_modern), + STR_YESNO(another_cat_defined), daylights[0], daylights[1], daylights[2], as_shot[0], as_shot[1], as_shot[2]); d->preset = p->preset = DT_IOP_TEMP_AS_SHOT;