Skip to content

Commit 3713781

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 e4a126e commit 3713781

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
@@ -2855,35 +2855,6 @@ int dt_opencl_read_host_from_device_rowpitch(const int devid,
28552855
region, rowpitch, CL_TRUE);
28562856
}
28572857

2858-
int dt_opencl_read_host_from_device_non_blocking(const int devid,
2859-
void *host,
2860-
void *device,
2861-
const int width,
2862-
const int height,
2863-
const int bpp)
2864-
{
2865-
return dt_opencl_read_host_from_device_rowpitch_non_blocking(devid, host, device,
2866-
width, height,
2867-
bpp * width);
2868-
}
2869-
2870-
int dt_opencl_read_host_from_device_rowpitch_non_blocking(const int devid,
2871-
void *host,
2872-
void *device,
2873-
const int width,
2874-
const int height,
2875-
const int rowpitch)
2876-
{
2877-
if(!_cldev_running(devid))
2878-
return DT_OPENCL_NODEVICE;
2879-
const size_t origin[] = { 0, 0, 0 };
2880-
const size_t region[] = { width, height, 1 };
2881-
// non-blocking.
2882-
return dt_opencl_read_host_from_device_raw(devid, host, device, origin,
2883-
region, rowpitch, CL_FALSE);
2884-
}
2885-
2886-
28872858
int dt_opencl_read_host_from_device_raw(const int devid,
28882859
void *host,
28892860
void *device,
@@ -2940,37 +2911,6 @@ int dt_opencl_write_host_to_device_rowpitch(const int devid,
29402911
region, rowpitch, CL_TRUE);
29412912
}
29422913

2943-
int dt_opencl_write_host_to_device_non_blocking(const int devid,
2944-
void *host,
2945-
void *device,
2946-
const int width,
2947-
const int height,
2948-
const int bpp)
2949-
{
2950-
return dt_opencl_write_host_to_device_rowpitch_non_blocking(devid, host, device,
2951-
width, height, width * bpp);
2952-
}
2953-
2954-
int dt_opencl_write_host_to_device_rowpitch_non_blocking(const int devid,
2955-
void *host,
2956-
void *device,
2957-
const int width,
2958-
const int height,
2959-
const int rowpitch)
2960-
{
2961-
if(!_cldev_running(devid))
2962-
return DT_OPENCL_NODEVICE;
2963-
2964-
const size_t origin[] = { 0, 0, 0 };
2965-
const size_t region[] = { width, height, 1 };
2966-
// non-blocking.
2967-
2968-
const cl_int err = dt_opencl_write_host_to_device_raw(devid, host, device,
2969-
origin, region, rowpitch, CL_FALSE);
2970-
_check_clmem_err(devid, err);
2971-
return err;
2972-
}
2973-
29742914
int dt_opencl_write_host_to_device_raw(const int devid,
29752915
void *host,
29762916
void *device,
@@ -3164,16 +3104,8 @@ void *dt_opencl_copy_host_to_device_constant(const int devid,
31643104
return dev;
31653105
}
31663106

3167-
void *dt_opencl_copy_host_to_device(const int devid,
3168-
void *host,
3169-
const int width,
3170-
const int height,
3171-
const int bpp)
3172-
{
3173-
return dt_opencl_copy_host_to_device_rowpitch(devid, host, width, height, bpp, 0);
3174-
}
31753107

3176-
void *dt_opencl_copy_host_to_device_rowpitch(const int devid,
3108+
static void *_opencl_copy_host_to_device_rowpitch(const int devid,
31773109
void *host,
31783110
const int width,
31793111
const int height,
@@ -3214,6 +3146,14 @@ void *dt_opencl_copy_host_to_device_rowpitch(const int devid,
32143146
return dev;
32153147
}
32163148

3149+
void *dt_opencl_copy_host_to_device(const int devid,
3150+
void *host,
3151+
const int width,
3152+
const int height,
3153+
const int bpp)
3154+
{
3155+
return _opencl_copy_host_to_device_rowpitch(devid, host, width, height, bpp, 0);
3156+
}
32173157

32183158
void dt_opencl_release_mem_object(cl_mem mem)
32193159
{
@@ -3320,56 +3260,6 @@ void *dt_opencl_alloc_device(const int devid,
33203260
return dev;
33213261
}
33223262

3323-
3324-
void *dt_opencl_alloc_device_use_host_pointer(const int devid,
3325-
const int width,
3326-
const int height,
3327-
const int bpp,
3328-
const int rowpitch,
3329-
void *host)
3330-
{
3331-
if(!_cldev_running(devid))
3332-
return NULL;
3333-
3334-
dt_opencl_t *cl = darktable.opencl;
3335-
if(cl->dev[devid].max_image_width < width || cl->dev[devid].max_image_height < height)
3336-
return NULL;
3337-
3338-
cl_int err = CL_SUCCESS;
3339-
cl_image_format fmt;
3340-
// guess pixel format from bytes per pixel
3341-
if(bpp == 4 * sizeof(float))
3342-
fmt = (cl_image_format){ CL_RGBA, CL_FLOAT };
3343-
else if(bpp == 2 * sizeof(float))
3344-
fmt = (cl_image_format){ CL_RG, CL_FLOAT };
3345-
else if(bpp == sizeof(float))
3346-
fmt = (cl_image_format){ CL_R, CL_FLOAT };
3347-
else if(bpp == sizeof(uint16_t))
3348-
fmt = (cl_image_format){ CL_R, CL_UNSIGNED_INT16 };
3349-
else
3350-
return NULL;
3351-
3352-
const cl_image_desc desc = (cl_image_desc)
3353-
{CL_MEM_OBJECT_IMAGE2D, width, height, 0, 0, rowpitch, 0, 0, 0, NULL};
3354-
3355-
cl_mem dev = (cl->dlocl->symbols->dt_clCreateImage)
3356-
(cl->dev[devid].context,
3357-
CL_MEM_READ_WRITE | ((host == NULL) ? CL_MEM_ALLOC_HOST_PTR : CL_MEM_USE_HOST_PTR),
3358-
&fmt, &desc, host, &err);
3359-
3360-
if(err != CL_SUCCESS || dev == NULL)
3361-
dt_print(DT_DEBUG_OPENCL,
3362-
"[opencl alloc_device_use_host_pointer]"
3363-
" could not allocate cl image on device '%s' id=%d: %s",
3364-
cl->dev[devid].fullname, devid, cl_errstr(err));
3365-
3366-
_check_clmem_err(devid, err);
3367-
dt_opencl_memory_statistics(devid, dev, OPENCL_MEMORY_ADD);
3368-
3369-
return dev;
3370-
}
3371-
3372-
33733263
void *dt_opencl_alloc_device_buffer(const int devid,
33743264
const size_t size)
33753265
{

src/common/opencl.h

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

433-
int dt_opencl_read_host_from_device_non_blocking(const int devid,
434-
void *host,
435-
void *device,
436-
const int width,
437-
const int height,
438-
const int bpp);
439-
440-
int dt_opencl_read_host_from_device_rowpitch_non_blocking(const int devid,
441-
void *host,
442-
void *device,
443-
const int width,
444-
const int height,
445-
const int rowpitch);
446-
447433
int dt_opencl_read_host_from_device_raw(const int devid,
448434
void *host,
449435
void *device,
@@ -466,20 +452,6 @@ int dt_opencl_write_host_to_device_rowpitch(const int devid,
466452
const int height,
467453
const int rowpitch);
468454

469-
int dt_opencl_write_host_to_device_non_blocking(const int devid,
470-
void *host,
471-
void *device,
472-
const int width,
473-
const int height,
474-
const int bpp);
475-
476-
int dt_opencl_write_host_to_device_rowpitch_non_blocking(const int devid,
477-
void *host,
478-
void *device,
479-
const int width,
480-
const int height,
481-
const int rowpitch);
482-
483455
int dt_opencl_write_host_to_device_raw(const int devid,
484456
void *host,
485457
void *device,
@@ -494,13 +466,6 @@ void *dt_opencl_copy_host_to_device(const int devid,
494466
const int height,
495467
const int bpp);
496468

497-
void *dt_opencl_copy_host_to_device_rowpitch(const int devid,
498-
void *host,
499-
const int width,
500-
const int height,
501-
const int bpp,
502-
const int rowpitch);
503-
504469
void *dt_opencl_copy_host_to_device_constant(const int devid,
505470
const size_t size,
506471
void *host);
@@ -517,13 +482,6 @@ void *dt_opencl_alloc_device(const int devid,
517482
const int height,
518483
const int bpp);
519484

520-
void *dt_opencl_alloc_device_use_host_pointer(const int devid,
521-
const int width,
522-
const int height,
523-
const int bpp,
524-
const int rowpitch,
525-
void *host);
526-
527485
int dt_opencl_enqueue_copy_image_to_buffer(const int devid,
528486
cl_mem src_image,
529487
cl_mem dst_buffer,

0 commit comments

Comments
 (0)