Skip to content
  • Ander Conselvan de Oliveira's avatar
    compositor-drm: Add hardware accelerated capture of screen using libva · 6aae4d39
    Ander Conselvan de Oliveira authored
    This patch adds a feature to the DRM backend that uses libva for
    encoding the screen contents in H.264. Screen recording can be
    activated by pressing mod-shift-space q. A file named capture.h264
    will be created in the current directory, which can be muxed into
    an MP4 file with gstreamer using
    
    gst-launch filesrc location=capture.h264 ! h264parse ! mp4mux ! \
               filesink location=file.mp4
    
    This is limitted to the DRM compositor in order to avoid a copy when
    submitting the front buffer to libva. The code in vaapi-recorder.c
    takes a dma_buf fd referencing it, does a colorspace conversion using
    the video post processing pipeline and then uses that as input to the
    encoder.
    
    I'm sending this now so I get comments, but this is not ready for
    prime time yet. I have a somewhat consistent GPU hang when using
    i915 with SandyBridge. Sometimes a page flip never completes. If you
    want to try this anyway and your system get stuck, you might need to
    run the following:
    
      # echo 1 > /sys/kernel/debug/dri/0/i915_wedged
    
    After that, alt-sysrq [rv] should work.
    
    Once that's fixed it would also be good to make the parameters used by
    the encoder more flexible. For now the QP parameter is hardcoded to 0
    and we have only I and P frames (no B frames), which causes the
    resulting files to be very large.
    6aae4d39