Documentation/process/debugging/media_specific_debugging_guide.rst

Source file repositories/reference/linux-study-clean/Documentation/process/debugging/media_specific_debugging_guide.rst

File Facts

System
Linux kernel
Corpus path
Documentation/process/debugging/media_specific_debugging_guide.rst
Extension
.rst
Size
6567 bytes
Lines
181
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

============================================
Debugging and tracing in the media subsystem
============================================

This document serves as a starting point and lookup for debugging device
drivers in the media subsystem and to debug these drivers from userspace.

.. contents::
    :depth: 3

General debugging advice
------------------------

For general advice see the :doc:`general advice document
</process/debugging/index>`.

The following sections show you some of the available tools.

dev_debug module parameter
--------------------------

Every video device provides a ``dev_debug`` parameter, which allows to get
further insights into the IOCTLs in the background.::

  # cat /sys/class/video4linux/video3/name
  rkvdec
  # echo 0xff > /sys/class/video4linux/video3/dev_debug
  # dmesg -wH
  [...] videodev: v4l2_open: video3: open (0)
  [  +0.000036] video3: VIDIOC_QUERYCAP: driver=rkvdec, card=rkvdec,
  bus=platform:rkvdec, version=0x00060900, capabilities=0x84204000,
  device_caps=0x04204000

For the full documentation see :ref:`driver-api/media/v4l2-dev:video device
debugging`

dev_dbg() / v4l2_dbg()
----------------------

Two debug print statements, which are specific for devices and for the v4l2
subsystem, avoid adding these to your final submission unless they have
long-term value for investigations.

For a general overview please see the
:ref:`process/debugging/driver_development_debugging_guide:printk() & friends`
guide.

- Difference between both?

  - v4l2_dbg() utilizes v4l2_printk() under the hood, which further uses
    printk() directly, thus it cannot be targeted by dynamic debug
  - dev_dbg() can be targeted by dynamic debug
  - v4l2_dbg() has a more specific prefix format for the media subsystem, while
    dev_dbg only highlights the driver name and the location of the log

Dynamic debug
-------------

A method to trim down the debug output to your needs.

For general advice see the
:ref:`process/debugging/userspace_debugging_guide:dynamic debug` guide.

Here is one example, that enables all available pr_debug()'s within the file::

  $ alias ddcmd='echo $* > /proc/dynamic_debug/control'
  $ ddcmd '-p; file v4l2-h264.c +p'
  $ grep =p /proc/dynamic_debug/control

Annotation

Implementation Notes