[vlc-devel] [PATCH] linux: kernel mode setting (KMS) vout plugin

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Tue May 15 14:09:59 CEST 2018


I made vout plugin for Linux which uses kernel mode setting API. This plugin
mostly recreates what FB plugin does with following highlights:

* FB could only do RGB but with KMS plugin one get access to all kernel
  enabled video modes. I have successfully ran through all packed and planar
  YUV modes I found from my HW -- as well as all RGB modes.
* No tearing (I hope) I used two hw buffers and kernel plane handling
  takes care of the flipping for me. Only way I see tearing could happen is
  if VLC is decoding video frames faster than hardware video refresh rate.
* libFB to my knowledge is in maintenance mode, no more new features.
* My plugin can be run over ssh.

Then the other things:
* I am employee of Intel Corporation thus I have to have special disclaimer
  on top of my plugin. I developed this plugin as part of my work when
  playing with KMS, this can be used to test video modes where it doesn't
  need to be totally boring all the time :)
* I have had access only to Intel hardware but I'm wishful my plugin works
  equally on other manufacturer's hardware. I tried to use only simple
  features to be able to maintain functionality on other platforms too.
* VLC and libdrm has some FourCC codes which are equal on both worlds but
  then there are others which have different names while seemingly same
  functionality. By default my plugin asks for XR24 type framebuffer from
  DRM and at the same time tells VLC it is RV32. Then again things like YUYV
  or NV12 are the same in both worlds. If VLC is run in verbose mode one
  can see my plugin listing all modes which KMS advertises. I didn't go
  write match making table for these.


a bit of howto:

I ran configure with this line where $BUILDOPT is just directory for all my
experimental projects.
PKG_CONFIG_PATH=$BUILDOPT/lib/pkgconfig CFLAGS="$CFLAGS -L$BUILDOPT/lib -g -O0 -fPIC" CXXFLAGS="$CXXFLAGS -L$BUILDOPT/lib -g -O0 -fPIC" ./configure --prefix=$BUILDOPT --disable-lua --disable-a52 --disable-alsa --disable-chromecast --without-x --disable-xcb --disable-vdpau --disable-skins2 --disable-xvideo --disable-dbus --enable-run-as-root --disable-screen --disable-freetype

The box where this is run cannot have DRM master running, this mean no X
server or similar running. If there is already DRM master present there will
be error reported.

I run this over ssh like this:
DISPLAY=localhost sudo vlc rc -I "dummy" --verbose=2 --no-audio -V kms,none video.mp4

To try out other framebuffer formats:
DISPLAY=localhost sudo vlc rc -I "dummy" --verbose=2 --no-audio -V kms,none --kms-drm-chroma=YUYV --kms-vlc-chroma=YUYV video.mp4

kms-drm-chroma is those modes my plugin lists and find matching
kms-vlc-chroma from vlc_fourcc.h under title 'Chromas'

/Juha-Pekka

Juha-Pekka Heikkila (1):
  linux: kernel mode setting (KMS) vout plugin

 configure.ac                     |   5 +
 modules/video_output/Makefile.am |  10 +
 modules/video_output/kms.c       | 794 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 809 insertions(+)
 create mode 100644 modules/video_output/kms.c

-- 
2.7.4



More information about the vlc-devel mailing list