Skip to content

Latest commit

 

History

History
132 lines (98 loc) · 4.06 KB

File metadata and controls

132 lines (98 loc) · 4.06 KB

Amlogic Meson V4L2 Video Decoder Driver

A stateless multi-codec V4L2 Linux kernel driver for Amlogic Meson SoCs providing hardware-accelerated video decoding through standard Video4Linux2 APIs.

Features

  • Stateless V4L2 Interface: Standard Linux video codec API
  • Multi-Codec Support: MPEG1/2, H.264, VP9, HEVC (phased implementation)
  • Hardware Acceleration: Direct hardware video decoding units
  • Memory-to-Memory Framework: V4L2 M2M framework integration
  • Modern Kernel APIs: Uses latest Linux kernel development practices

Supported Hardware

  • Amlogic Meson SoCs with video decoding units
  • Tested on: [Hardware testing status to be updated]

Directory Structure

drivers/media/platform/amlogic/meson-vdec/  # Main driver implementation
├── meson-vdec-core.c                       # Core V4L2 M2M framework integration
├── meson-vdec-core.h                       # Core data structures and interfaces
├── meson-vdec-firmware.c                   # Firmware management
├── meson-vdec-firmware.h                   # Firmware interface definitions
├── meson-vdec-regs.h                       # Hardware register definitions
├── Kconfig                                 # Kernel configuration options
└── Makefile                                # Build configuration

Documentation/devicetree/bindings/media/    # Device tree bindings
└── amlogic,meson-vdec.yaml                 # DT schema definition

Building

In-Tree Build (Recommended)

# Copy driver to kernel source tree
cp -r drivers/ /path/to/linux/
cp Documentation/devicetree/bindings/media/amlogic,meson-vdec.yaml \
   /path/to/linux/Documentation/devicetree/bindings/media/

# Configure kernel
make menuconfig
# Enable: Device Drivers -> Multimedia support -> Media drivers -> 
#         Platform devices -> Amlogic Meson Video Decoder

# Build
make modules

Out-of-Tree Build

# Build against running kernel
make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/media/platform/amlogic/meson-vdec modules

# Or build against specific kernel source
make -C /path/to/kernel/source M=$(pwd)/drivers/media/platform/amlogic/meson-vdec modules

Installation

# Load module
sudo insmod drivers/media/platform/amlogic/meson-vdec/meson-vdec.ko

# Verify device creation
ls -la /dev/video*

Testing

V4L2 Compliance

# Install v4l-utils
sudo apt install v4l-utils

# Run compliance tests
v4l2-compliance -d /dev/video0

FFmpeg Integration

# Test H.264 decoding
ffmpeg -f v4l2m2m -i input.h264 -f rawvideo output.yuv

# List available formats
ffmpeg -f v4l2m2m -list_formats all -i /dev/video0

Development Status

Phase 1: Core Infrastructure ✅

  • V4L2 M2M framework integration
  • Hardware abstraction layer
  • Firmware management system
  • Memory management (Canvas, DMA)
  • Device tree bindings

Phase 2: MPEG1/2 Codec 🚧

  • MPEG1/2 stateless implementation
  • V4L2 stateless controls integration
  • Hardware decode pipeline
  • Buffer management

Phase 3: H.264 Codec 📋

  • H.264 stateless implementation
  • DPB (Decoded Picture Buffer) management
  • Reference frame handling

Phase 4: Advanced Codecs 📋

  • VP9 codec implementation
  • HEVC codec implementation

Contributing

This driver follows Linux kernel coding standards and modern kernel development practices:

  • Code Style: Linux kernel coding style (checkpatch.pl clean)
  • Resource Management: Uses cleanup.h and devm_ patterns
  • Documentation: Kernel-doc format for all public APIs
  • Testing: V4L2 compliance and application compatibility

License

This driver is licensed under the GPL v2, consistent with the Linux kernel.

References