Skip to content
/ pivid Public

Experimental video code for Linux / Raspberry Pi

License

Notifications You must be signed in to change notification settings

egnor/pivid

Repository files navigation

pivid

Experimental video code for Linux / Raspberry Pi

Building

  1. Run ./dev_setup.py. (Works On My Machine™, YMMV)
  2. Run ninja -C build to run the actual build (this is the only part to repeat after edits).
  3. Run binaries from build (like build/pivid_test_decode).
  4. If things get weird, rm -rf build and start over with dev_setup.py.

Notable programs:

  • pivid_test_decode - play an H.264 video file via KMS/DRM (stop X first)
  • pivid_inspect_avformat - print a summary of streams in a video file
  • pivid_inspect_kms - print capabilities & properties of KMS/DRM devices
  • pivid_inspect_v4l2 - print capabilities & properties of V4L2 devices

Use --help to see usage (and/or read the source).

Notes and links

Raspberry Pi specifics

Graphics output: DRM and KMS

Notes on DRM and KMS:

  • These interfaces are almost completely undocumented. Learn by examples.
  • But, many examples use "legacy" interfaces, prefer "atomic" update interfaces.

Video decoding: V4L2

Zero-copy buffer sharing

Notes on memory management:

  • GPUs have all kinds of memory architectures. The RPi is simple, everything is in system RAM (no dedicated GPU RAM).
  • DRM/KMS requires you to create a "framebuffer" object, giving it a "buffer object" ("BO") handle (opaque int32).
  • How a "buffer object" is allocated and managed is dependent on the kernel GPU driver.
  • Most drivers use the "Graphics Execution Manager" (GEM), their buffer object handles are "GEM handles".
  • Most drivers support "dumb buffers", allowing simple creation of a buffer in system RAM.
  • Many drivers have more elaborate driver-specific interfaces for allocating various kinds of memory.
  • The libgbm ("Generic Buffer Manager") library tries to abstract over those driver-specific interfaces.
  • "DRM-PRIME" is a fancy name for ioctl's (see libdrm drmPrimeHandleToFD and drmPrimeFDToHandle) to convert GEM handles to/from "dma-buf" descriptors.
  • These "dma-buf" descriptors can be used with other systems like V4L2, of course you have to get the data format right.

About

Experimental video code for Linux / Raspberry Pi

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages