Remaining tasks for nvenc:
- dealing with context limits (32 per device at present)
- workaround slow encoder initialization (could wait one second before trying to avoid wasting cycles, then initialize it in a new thread which becomes the encoding thread once complete)
- handle scaling in cuda kernel
- honour
max_block_sizes
, max_grid_sizes
and max_threads_per_block
- handle other RGB modes in kernel?
- the cuda buffers are bigger than the picture we upload, we should pad the edges with zeroes (rather than the random garbage currently in there?)
- handle YUV444P mode (see
uint32_t separateColourPlaneFlag #[in]: Set to 1 to enable 4:4:4 separate colour planes
)
- multi-threaded issues? re-use the same cuda context from the same encoding thread?
- we should build the cuda kernel at build time and load the "cubin" file and load them with
mod = driver.module_from_file(filename)
- handle resize without re-init when size changes fit in the padded size (and maybe make the padded size a little bit bigger too)
- choose the cuda device using
gpuGetMaxGflopsDeviceId
: max_gflops = device_properties.multiProcessorCount * device_properties.clockRate;
At the moment, running out of contexts does this:
2013-11-05 14:40:58,590 setup_pipeline failed for (65, None, 'BGRX', codec_spec(nvenc))
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/xpra/server/window_video_source.py", line 605, in setup_pipeline
self._video_encoder.init_context(enc_width, enc_height, enc_in_format, encoder_spec.encoding, quality, speed, self.encoding_options)
File "encoder.pyx", line 1291, in xpra.codecs.nvenc.encoder.Encoder.init_context (xpra/codecs/nvenc/encoder.c:5883)
File "encoder.pyx", line 1329, in xpra.codecs.nvenc.encoder.Encoder.init_cuda (xpra/codecs/nvenc/encoder.c:6830)
File "encoder.pyx", line 1344, in xpra.codecs.nvenc.encoder.Encoder.init_nvenc (xpra/codecs/nvenc/encoder.c:6957)
File "encoder.pyx", line 1828, in xpra.codecs.nvenc.encoder.Encoder.open_encode_session (xpra/codecs/nvenc/encoder.c:13775)
File "encoder.pyx", line 1203, in xpra.codecs.nvenc.encoder.raiseNVENC (xpra/codecs/nvenc/encoder.c:5070)
Exception: opening session - returned 2: This indicates that devices pass by the client is not supported.
2013-11-05 14:40:58,593 error processing damage data: failed to setup a video pipeline for h264 encoding with source format BGRX