Skip to content

Commit d7da0bf

Browse files
Remove some unused OpenCL functions from codebase
dt_opencl_read_host_from_device_non_blocking() dt_opencl_read_host_from_device_rowpitch_non_blocking() dt_opencl_write_host_to_device_non_blocking() dt_opencl_write_host_to_device_rowpitch_non_blocking() dt_opencl_alloc_device_use_host_pointer()
1 parent df1ea2d commit d7da0bf

File tree

2 files changed

+9
-161
lines changed

2 files changed

+9
-161
lines changed

src/common/opencl.c

Lines changed: 9 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,35 +2865,6 @@ int dt_opencl_read_host_from_device_rowpitch(const int devid,
28652865
region, rowpitch, CL_TRUE);
28662866
}
28672867

2868-
int dt_opencl_read_host_from_device_non_blocking(const int devid,
2869-
void *host,
2870-
void *device,
2871-
const int width,
2872-
const int height,
2873-
const int bpp)
2874-
{
2875-
return dt_opencl_read_host_from_device_rowpitch_non_blocking(devid, host, device,
2876-
width, height,
2877-
bpp * width);
2878-
}
2879-
2880-
int dt_opencl_read_host_from_device_rowpitch_non_blocking(const int devid,
2881-
void *host,
2882-
void *device,
2883-
const int width,
2884-
const int height,
2885-
const int rowpitch)
2886-
{
2887-
if(!_cldev_running(devid))
2888-
return DT_OPENCL_NODEVICE;
2889-
const size_t origin[] = { 0, 0, 0 };
2890-
const size_t region[] = { width, height, 1 };
2891-
// non-blocking.
2892-
return dt_opencl_read_host_from_device_raw(devid, host, device, origin,
2893-
region, rowpitch, CL_FALSE);
2894-
}
2895-
2896-
28972868
int dt_opencl_read_host_from_device_raw(const int devid,
28982869
void *host,
28992870
void *device,
@@ -2950,37 +2921,6 @@ int dt_opencl_write_host_to_device_rowpitch(const int devid,
29502921
region, rowpitch, CL_TRUE);
29512922
}
29522923

2953-
int dt_opencl_write_host_to_device_non_blocking(const int devid,
2954-
void *host,
2955-
void *device,
2956-
const int width,
2957-
const int height,
2958-
const int bpp)
2959-
{
2960-
return dt_opencl_write_host_to_device_rowpitch_non_blocking(devid, host, device,
2961-
width, height, width * bpp);
2962-
}
2963-
2964-
int dt_opencl_write_host_to_device_rowpitch_non_blocking(const int devid,
2965-
void *host,
2966-
void *device,
2967-
const int width,
2968-
const int height,
2969-
const int rowpitch)
2970-
{
2971-
if(!_cldev_running(devid))
2972-
return DT_OPENCL_NODEVICE;
2973-
2974-
const size_t origin[] = { 0, 0, 0 };
2975-
const size_t region[] = { width, height, 1 };
2976-
// non-blocking.
2977-
2978-
const cl_int err = dt_opencl_write_host_to_device_raw(devid, host, device,
2979-
origin, region, rowpitch, CL_FALSE);
2980-
_check_clmem_err(devid, err);
2981-
return err;
2982-
}
2983-
29842924
int dt_opencl_write_host_to_device_raw(const int devid,
29852925
void *host,
29862926
void *device,
@@ -3178,16 +3118,8 @@ void *dt_opencl_copy_host_to_device_constant(const int devid,
31783118
return dev;
31793119
}
31803120

3181-
void *dt_opencl_copy_host_to_device(const int devid,
3182-
void *host,
3183-
const int width,
3184-
const int height,
3185-
const int bpp)
3186-
{
3187-
return dt_opencl_copy_host_to_device_rowpitch(devid, host, width, height, bpp, 0);
3188-
}
31893121

3190-
void *dt_opencl_copy_host_to_device_rowpitch(const int devid,
3122+
static void *_opencl_copy_host_to_device_rowpitch(const int devid,
31913123
void *host,
31923124
const int width,
31933125
const int height,
@@ -3228,6 +3160,14 @@ void *dt_opencl_copy_host_to_device_rowpitch(const int devid,
32283160
return dev;
32293161
}
32303162

3163+
void *dt_opencl_copy_host_to_device(const int devid,
3164+
void *host,
3165+
const int width,
3166+
const int height,
3167+
const int bpp)
3168+
{
3169+
return _opencl_copy_host_to_device_rowpitch(devid, host, width, height, bpp, 0);
3170+
}
32313171

32323172
void dt_opencl_release_mem_object(cl_mem mem)
32333173
{
@@ -3334,56 +3274,6 @@ void *dt_opencl_alloc_device(const int devid,
33343274
return dev;
33353275
}
33363276

3337-
3338-
void *dt_opencl_alloc_device_use_host_pointer(const int devid,
3339-
const int width,
3340-
const int height,
3341-
const int bpp,
3342-
const int rowpitch,
3343-
void *host)
3344-
{
3345-
if(!_cldev_running(devid))
3346-
return NULL;
3347-
3348-
dt_opencl_t *cl = darktable.opencl;
3349-
if(cl->dev[devid].max_image_width < width || cl->dev[devid].max_image_height < height)
3350-
return NULL;
3351-
3352-
cl_int err = CL_SUCCESS;
3353-
cl_image_format fmt;
3354-
// guess pixel format from bytes per pixel
3355-
if(bpp == 4 * sizeof(float))
3356-
fmt = (cl_image_format){ CL_RGBA, CL_FLOAT };
3357-
else if(bpp == 2 * sizeof(float))
3358-
fmt = (cl_image_format){ CL_RG, CL_FLOAT };
3359-
else if(bpp == sizeof(float))
3360-
fmt = (cl_image_format){ CL_R, CL_FLOAT };
3361-
else if(bpp == sizeof(uint16_t))
3362-
fmt = (cl_image_format){ CL_R, CL_UNSIGNED_INT16 };
3363-
else
3364-
return NULL;
3365-
3366-
const cl_image_desc desc = (cl_image_desc)
3367-
{CL_MEM_OBJECT_IMAGE2D, width, height, 0, 0, rowpitch, 0, 0, 0, NULL};
3368-
3369-
cl_mem dev = (cl->dlocl->symbols->dt_clCreateImage)
3370-
(cl->dev[devid].context,
3371-
CL_MEM_READ_WRITE | ((host == NULL) ? CL_MEM_ALLOC_HOST_PTR : CL_MEM_USE_HOST_PTR),
3372-
&fmt, &desc, host, &err);
3373-
3374-
if(err != CL_SUCCESS || dev == NULL)
3375-
dt_print(DT_DEBUG_OPENCL,
3376-
"[opencl alloc_device_use_host_pointer]"
3377-
" could not allocate cl image on device '%s' id=%d: %s",
3378-
cl->dev[devid].fullname, devid, cl_errstr(err));
3379-
3380-
_check_clmem_err(devid, err);
3381-
dt_opencl_memory_statistics(devid, dev, OPENCL_MEMORY_ADD);
3382-
3383-
return dev;
3384-
}
3385-
3386-
33873277
void *dt_opencl_alloc_device_buffer(const int devid,
33883278
const size_t size)
33893279
{

src/common/opencl.h

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -432,20 +432,6 @@ int dt_opencl_read_host_from_device_rowpitch(const int devid,
432432
const int height,
433433
const int rowpitch);
434434

435-
int dt_opencl_read_host_from_device_non_blocking(const int devid,
436-
void *host,
437-
void *device,
438-
const int width,
439-
const int height,
440-
const int bpp);
441-
442-
int dt_opencl_read_host_from_device_rowpitch_non_blocking(const int devid,
443-
void *host,
444-
void *device,
445-
const int width,
446-
const int height,
447-
const int rowpitch);
448-
449435
int dt_opencl_read_host_from_device_raw(const int devid,
450436
void *host,
451437
void *device,
@@ -468,20 +454,6 @@ int dt_opencl_write_host_to_device_rowpitch(const int devid,
468454
const int height,
469455
const int rowpitch);
470456

471-
int dt_opencl_write_host_to_device_non_blocking(const int devid,
472-
void *host,
473-
void *device,
474-
const int width,
475-
const int height,
476-
const int bpp);
477-
478-
int dt_opencl_write_host_to_device_rowpitch_non_blocking(const int devid,
479-
void *host,
480-
void *device,
481-
const int width,
482-
const int height,
483-
const int rowpitch);
484-
485457
int dt_opencl_write_host_to_device_raw(const int devid,
486458
void *host,
487459
void *device,
@@ -496,13 +468,6 @@ void *dt_opencl_copy_host_to_device(const int devid,
496468
const int height,
497469
const int bpp);
498470

499-
void *dt_opencl_copy_host_to_device_rowpitch(const int devid,
500-
void *host,
501-
const int width,
502-
const int height,
503-
const int bpp,
504-
const int rowpitch);
505-
506471
void *dt_opencl_copy_host_to_device_constant(const int devid,
507472
const size_t size,
508473
void *host);
@@ -519,13 +484,6 @@ void *dt_opencl_alloc_device(const int devid,
519484
const int height,
520485
const int bpp);
521486

522-
void *dt_opencl_alloc_device_use_host_pointer(const int devid,
523-
const int width,
524-
const int height,
525-
const int bpp,
526-
const int rowpitch,
527-
void *host);
528-
529487
int dt_opencl_enqueue_copy_image_to_buffer(const int devid,
530488
cl_mem src_image,
531489
cl_mem dst_buffer,

0 commit comments

Comments
 (0)