xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.

Changes between Version 2 and Version 16 of Ticket #370

11/05/13 08:01:11 (7 years ago)
Antoine Martin

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


  • Ticket #370

    • Property Summary changed from hardware accelerated encoding: libva and/or nvenc to nvenc hardware accelerated encoding
  • Ticket #370 – Description

    v2 v16  
     1See also #451 (libva accelerated encoding)
    24* [https://developer.nvidia.com/nvidia-video-codec-sdk nvenc]
    35* [http://docs.nvidia.com/cuda/samples/3_Imaging/cudaEncode/doc/nvcuvenc.pdf nvidia cuda video encoder] (specification pdf)
    4 * [http://cgit.freedesktop.org/libva/ libva] (see also #202 for the decoding side)
    5 * [http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg01835.html qemu patch] (good starting point / example)
    77Worth mentioning:
    88* [http://www.behardware.com/articles/828-27/h-264-encoding-cpu-vs-gpu-nvidia-cuda-amd-stream-intel-mediasdk-and-x264.html H.264 encoding - CPU vs GPU: Nvidia CUDA, AMD Stream, Intel MediaSDK and x264] ''What these solutions bring most of all is frustration. Whether NVIDIA, AMD or Intel solutions, rapidity has been accentuated to the detriment of quality. '' - hopefully thing have improved
    9 * libva can encode to other formats (avc, mpeg2, ..) and maybe this can be useful in the future - something to keep in mind when designing the code: maybe each encoder can support more than one format (becomes a constructor argument)