[gegl] creating an opencl log to keep messages, instead of using g_warning and g_printf
- From: Victor Matheus de Araujo Oliveira <vmaolive src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] creating an opencl log to keep messages, instead of using g_warning and g_printf
- Date: Fri, 23 Mar 2012 17:47:26 +0000 (UTC)
commit 608bd4e2b41520f2ce8dbc4d2a711207d936b120
Author: Victor Oliveira <victormatheus gmail com>
Date: Fri Mar 23 14:46:30 2012 -0300
creating an opencl log to keep messages, instead of using g_warning and g_printf
gegl/buffer/gegl-buffer-cl-cache.c | 3 +-
gegl/buffer/gegl-buffer-cl-iterator.c | 3 +-
gegl/gegl-debug.h | 3 +-
gegl/gegl-init.c | 2 +-
gegl/opencl/gegl-cl-color.c | 4 +-
gegl/opencl/gegl-cl-init.c | 35 ++++++++++++-----------
gegl/operation/gegl-operation-point-composer.c | 11 ++++---
gegl/operation/gegl-operation-point-filter.c | 21 +++++++-------
operations/common/box-blur.c | 3 +-
tests/Makefile.am | 3 +-
10 files changed, 47 insertions(+), 41 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-cl-cache.c b/gegl/buffer/gegl-buffer-cl-cache.c
index 675139b..bfd44fc 100644
--- a/gegl/buffer/gegl-buffer-cl-cache.c
+++ b/gegl/buffer/gegl-buffer-cl-cache.c
@@ -1,6 +1,7 @@
#include <glib.h>
#include "gegl.h"
+#include "gegl/gegl-debug.h"
#include "gegl-utils.h"
#include "gegl-types-internal.h"
#include "gegl-buffer-types.h"
@@ -70,7 +71,7 @@ gegl_buffer_cl_cache_new (GeglBuffer *buffer,
g_static_mutex_unlock (&cache_mutex);
}
-#define CL_ERROR {g_printf("[OpenCL] Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(cl_err)); goto error;}
+#define CL_ERROR {GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(cl_err)); goto error;}
gboolean
gegl_buffer_cl_cache_merge (GeglBuffer *buffer,
diff --git a/gegl/buffer/gegl-buffer-cl-iterator.c b/gegl/buffer/gegl-buffer-cl-iterator.c
index 7a8cf2c..864141a 100644
--- a/gegl/buffer/gegl-buffer-cl-iterator.c
+++ b/gegl/buffer/gegl-buffer-cl-iterator.c
@@ -7,6 +7,7 @@
#include <glib/gprintf.h>
#include "gegl.h"
+#include "gegl/gegl-debug.h"
#include "gegl-buffer-types.h"
#include "gegl-buffer-cl-iterator.h"
@@ -15,7 +16,7 @@
#include "gegl-tile-storage.h"
#include "gegl-utils.h"
-#define CL_ERROR {g_printf("[OpenCL] Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(cl_err)); goto error;}
+#define CL_ERROR {GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(cl_err)); goto error;}
typedef struct GeglBufferClIterators
{
diff --git a/gegl/gegl-debug.h b/gegl/gegl-debug.h
index 3e76318..342cfc1 100644
--- a/gegl/gegl-debug.h
+++ b/gegl/gegl-debug.h
@@ -14,7 +14,8 @@ typedef enum {
GEGL_DEBUG_PROCESSOR = 1 << 4,
GEGL_DEBUG_CACHE = 1 << 5,
GEGL_DEBUG_MISC = 1 << 6,
- GEGL_DEBUG_INVALIDATION = 1 << 7
+ GEGL_DEBUG_INVALIDATION = 1 << 7,
+ GEGL_DEBUG_OPENCL = 1 << 8
} GeglDebugFlag;
/* only compiled in from gegl-init.c but kept here to
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index 89e12d0..3d5b13f 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -598,7 +598,7 @@ gegl_post_parse_hook (GOptionContext *context,
if (gegl_config()->use_opencl)
gegl_cl_init (NULL);
- g_printf("[OpenCL] Using OpenCL: %d\n", gegl_config()->use_opencl && gegl_cl_is_accelerated ());
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Using OpenCL: %d\n", gegl_config()->use_opencl && gegl_cl_is_accelerated ());
return TRUE;
}
diff --git a/gegl/opencl/gegl-cl-color.c b/gegl/opencl/gegl-cl-color.c
index 71cca06..bc20f8e 100644
--- a/gegl/opencl/gegl-cl-color.c
+++ b/gegl/opencl/gegl-cl-color.c
@@ -1,5 +1,5 @@
#include "gegl.h"
-#include <glib/gprintf.h>
+#include "gegl/gegl-debug.h"
#include "gegl-cl-color.h"
#include "gegl-cl-init.h"
@@ -189,7 +189,7 @@ gegl_cl_color_supported (const Babl *in_format, const Babl *out_format)
return GEGL_CL_COLOR_NOT_SUPPORTED;
}
-#define CL_ERROR {g_printf("[OpenCL] Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(errcode)); return FALSE;}
+#define CL_ERROR {GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s:%d %s - %s\n", __FILE__, __LINE__, __func__, gegl_cl_errstring(errcode)); return FALSE;}
gboolean
gegl_cl_color_conv (cl_mem in_tex, cl_mem out_tex, const size_t size,
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index fc32328..5af6ea9 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -5,10 +5,11 @@
#include <gmodule.h>
#include <string.h>
#include <stdio.h>
-#include <glib/gprintf.h>
#include "gegl-cl-color.h"
+#include "gegl/gegl-debug.h"
+
const char *gegl_cl_errstring(cl_int err) {
static const char* strings[] =
{
@@ -235,7 +236,7 @@ gegl_cl_init (GError **error)
err = gegl_clGetPlatformIDs (1, &cl_state.platform, NULL);
if(err != CL_SUCCESS)
{
- g_printf("[OpenCL] Could not create platform\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Could not create platform");
return FALSE;
}
@@ -246,7 +247,7 @@ gegl_cl_init (GError **error)
err = gegl_clGetDeviceIDs (cl_state.platform, CL_DEVICE_TYPE_DEFAULT, 1, &cl_state.device, NULL);
if(err != CL_SUCCESS)
{
- g_printf("[OpenCL] Could not create device\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Could not create device");
return FALSE;
}
@@ -259,12 +260,12 @@ gegl_cl_init (GError **error)
cl_state.iter_width = 4096;
cl_state.iter_height = 4096;
- g_printf("[OpenCL] Platform Name:%s\n", cl_state.platform_name);
- g_printf("[OpenCL] Version:%s\n", cl_state.platform_version);
- g_printf("[OpenCL] Extensions:%s\n", cl_state.platform_ext);
- g_printf("[OpenCL] Default Device Name:%s\n", cl_state.device_name);
- g_printf("[OpenCL] Max Alloc: %lu bytes\n", (unsigned long)cl_state.max_mem_alloc);
- g_printf("[OpenCL] Local Mem: %lu bytes\n", (unsigned long)cl_state.local_mem_size);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Platform Name:%s", cl_state.platform_name);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, " Version:%s", cl_state.platform_version);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Extensions:%s", cl_state.platform_ext);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Default Device Name:%s", cl_state.device_name);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Max Alloc: %lu bytes", (unsigned long)cl_state.max_mem_alloc);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Local Mem: %lu bytes", (unsigned long)cl_state.local_mem_size);
while (cl_state.iter_width * cl_state.iter_height * 16 > cl_state.max_mem_alloc)
{
@@ -275,22 +276,22 @@ gegl_cl_init (GError **error)
}
cl_state.iter_width /= 2;
- g_printf("[OpenCL] Iteration size: (%d, %d)\n", cl_state.iter_width, cl_state.iter_height);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Iteration size: (%d, %d)", cl_state.iter_width, cl_state.iter_height);
if (cl_state.image_support)
{
- g_printf("[OpenCL] Image Support OK\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Image Support OK");
}
else
{
- g_printf("[OpenCL] Image Support Error\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Image Support Error");
return FALSE;
}
cl_state.ctx = gegl_clCreateContext(0, 1, &cl_state.device, NULL, NULL, &err);
if(err != CL_SUCCESS)
{
- g_printf("[OpenCL] Could not create context\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Could not create context");
return FALSE;
}
@@ -298,7 +299,7 @@ gegl_cl_init (GError **error)
if(err != CL_SUCCESS)
{
- g_printf("[OpenCL] Could not create command queue\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Could not create command queue");
return FALSE;
}
@@ -312,7 +313,7 @@ gegl_cl_init (GError **error)
if (cl_state.is_accelerated)
gegl_cl_color_compile_kernels();
- g_printf("[OpenCL] OK\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "OK");
return TRUE;
}
@@ -358,14 +359,14 @@ gegl_cl_compile_and_build (const char *program_source, const char *kernel_name[]
gegl_cl_get_device(),
CL_PROGRAM_BUILD_LOG,
s, msg, NULL) );
- g_printf("[OpenCL] Build Error:%s\n%s", gegl_cl_errstring(build_errcode), msg);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Build Error:%s\n%s", gegl_cl_errstring(build_errcode), msg);
g_free (msg);
return NULL;
}
else
{
- g_printf("[OpenCL] Compiling successful\n");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Compiling successful\n");
}
for (i=0; i<kernel_n; i++)
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index a26c8a2..aa33a17 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -22,6 +22,7 @@
#include <glib-object.h>
#include "gegl.h"
+#include "gegl/gegl-debug.h"
#include "gegl-types-internal.h"
#include "gegl-operation-point-composer.h"
#include "gegl-utils.h"
@@ -156,7 +157,7 @@ gegl_operation_point_composer_cl_process (GeglOperation *operation,
!gegl_cl_color_babl (aux_format, NULL) ||
!gegl_cl_color_babl (out_format, NULL))
{
- g_warning ("[OpenCL] Non-texturizable format!");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Non-texturizable format!");
return FALSE;
}
@@ -177,8 +178,8 @@ gegl_operation_point_composer_cl_process (GeglOperation *operation,
i->size[0][j], &i->roi[0][j]);
if (cl_err != CL_SUCCESS)
{
- g_warning("[OpenCL] Error in %s [GeglOperationPointComposer] Kernel\n",
- GEGL_OPERATION_CLASS (operation)->name);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s [GeglOperationPointComposer] Kernel",
+ GEGL_OPERATION_CLASS (operation)->name);
return FALSE;
}
}
@@ -195,8 +196,8 @@ gegl_operation_point_composer_cl_process (GeglOperation *operation,
i->size[0][j], &i->roi[0][j]);
if (cl_err != CL_SUCCESS)
{
- g_warning("[OpenCL] Error in %s [GeglOperationPointComposer] Kernel\n",
- GEGL_OPERATION_CLASS (operation)->name);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s [GeglOperationPointComposer] Kernel",
+ GEGL_OPERATION_CLASS (operation)->name);
return FALSE;
}
}
diff --git a/gegl/operation/gegl-operation-point-filter.c b/gegl/operation/gegl-operation-point-filter.c
index db694ad..67a8da1 100644
--- a/gegl/operation/gegl-operation-point-filter.c
+++ b/gegl/operation/gegl-operation-point-filter.c
@@ -22,6 +22,7 @@
#include <glib-object.h>
#include "gegl.h"
+#include "gegl/gegl-debug.h"
#include "gegl-types-internal.h"
#include "gegl-operation-point-filter.h"
#include "graph/gegl-pad.h"
@@ -91,17 +92,17 @@ gegl_operation_point_filter_cl_process (GeglOperation *operation,
if (!gegl_cl_color_babl (in_format, NULL) ||
!gegl_cl_color_babl (out_format, NULL))
{
- g_warning ("[OpenCL] Non-texturizable format!");
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Non-texturizable format!");
return FALSE;
}
- g_printf("[OpenCL] BABL formats: (%s,%s) (%s,%s)\n \t Tile Size:(%d, %d)\n",
- babl_get_name(input->format),
- babl_get_name(in_format),
- babl_get_name(out_format),
- babl_get_name(output->format),
- input->tile_storage->tile_width,
- input->tile_storage->tile_height);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "BABL formats: (%s,%s) (%s,%s)\n \t Tile Size:(%d, %d)\n",
+ babl_get_name(input->format),
+ babl_get_name(in_format),
+ babl_get_name(out_format),
+ babl_get_name(output->format),
+ input->tile_storage->tile_width,
+ input->tile_storage->tile_height);
/* Process */
{
@@ -116,8 +117,8 @@ gegl_operation_point_filter_cl_process (GeglOperation *operation,
i->size[0][j], &i->roi[0][j]);
if (cl_err != CL_SUCCESS)
{
- g_warning("[OpenCL] Error in %s [GeglOperationPointFilter] Kernel\n",
- GEGL_OPERATION_CLASS (operation)->name);
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in %s [GeglOperationPointFilter] Kernel",
+ GEGL_OPERATION_CLASS (operation)->name);
return FALSE;
}
}
diff --git a/operations/common/box-blur.c b/operations/common/box-blur.c
index 150aeba..21f55d1 100644
--- a/operations/common/box-blur.c
+++ b/operations/common/box-blur.c
@@ -30,6 +30,7 @@ gegl_chant_double (radius, _("Radius"), 0.0, 200.0, 4.0,
#define GEGL_CHANT_C_FILE "box-blur.c"
#include "gegl-chant.h"
+#include "gegl/gegl-debug.h"
#include <stdio.h>
#include <math.h>
@@ -349,7 +350,7 @@ cl_process (GeglOperation *operation,
cl_err = cl_box_blur(i->tex[read][j], i->tex[aux][j], i->tex[0][j], i->size[0][j], &i->roi[0][j], ceil (o->radius));
if (cl_err != CL_SUCCESS)
{
- g_warning("[OpenCL] Error in box-blur: %s\n", gegl_cl_errstring(cl_err));
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Error in gegl:box-blur: %s", gegl_cl_errstring(cl_err));
return FALSE;
}
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index baa321d..87b2cf5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,5 +4,4 @@ SUBDIRS = \
compositions \
simple \
xml \
- python \
- opencl
+ python
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]