vcomp/cmpto_j2k: disable CUDA buffers with |GPU|>1

Disable copying to CUDA buffers if there is more CUDA devices configured,
it does cause the following error:
```
[J2K enc.] Setting image samples: Cannot configure input samples in CUDA
buffer because argument 'device_id' doesn't match the configured CUDA
device in encoder. Single CUDA encoder must be configured.
```
This commit is contained in:
Martin Pulec
2024-08-29 11:49:32 +02:00
parent c2e7811152
commit ca71f59b9c

View File

@@ -44,8 +44,7 @@
* the GPU encoder.
*
* @todo
* - check multiple CUDA devices - now the data are always copied to
* the first CUDA device
* - check support for multiple CUDA devices with CUDA buffers
*/
#ifdef HAVE_CONFIG_H
@@ -220,13 +219,17 @@ static bool configure_with(struct state_video_compress_j2k *s, struct video_desc
s->pool_in_device_memory = false;
#ifdef HAVE_CUDA
if (s->convertFunc == nullptr) {
if (s->convertFunc == nullptr && cuda_devices_count == 1) {
s->pool_in_device_memory = true;
s->pool = video_frame_pool(
s->max_in_frames,
cmpto_j2k_enc_cuda_buffer_data_allocator<
cuda_wrapper_malloc, cuda_wrapper_free>());
} else {
if (cuda_devices_count > 1) {
MSG(WARNING, "More than 1 CUDA device will use CPU "
"buffers. Please report...\n");
}
s->pool = video_frame_pool(
s->max_in_frames,
cmpto_j2k_enc_cuda_buffer_data_allocator<
@@ -438,10 +441,6 @@ static struct module * j2k_compress_init(struct module *parent, const char *c_cf
CHECK_OK(cmpto_j2k_enc_ctx_cfg_add_cuda_device(ctx_cfg, cuda_devices[i], mem_limit, tile_limit),
"Setting CUDA device", goto error);
}
if (cuda_devices_count > 1) {
MSG(WARNING, "More than one CUDA device is not tested and may "
"not work. Please report...\n");
}
CHECK_OK(cmpto_j2k_enc_ctx_create(ctx_cfg, &s->context), "Context create",
goto error);