# Video debug

Source: [https://docs.qualcomm.com/doc/80-88500-4/topic/135_Video_debug.html](https://docs.qualcomm.com/doc/80-88500-4/topic/135_Video_debug.html)

The video debug messages are controlled by vendor.qc2.log.msg, which is a 32-bit
    property (0xPPQRSTUU).

Table : Debug QC2 Video HAL

| Log domain (Bit 24 to Bit 31) | Private mask (Bit 8 to Bit 23) | Log level (Bit 0 to Bit 7) |
| --- | --- | --- |
| <ul class="ul" id="Video_debug_135__ul_xx4_ztd_cxb"><br>                  <li class="li">All = 0x00 or 0xFF</li><br><br>                  <li class="li">General = 0x01</li><br><br>                  <li class="li">QC2Component = 0x02</li><br><br>                  <li class="li">QC2PipelineCodec = 0x04</li><br><br>                  <li class="li">QC2V4l2Codec = 0x08</li><br><br>                  <li class="li">QC2VPPFilter = 0x10</li><br><br>                </ul> | Set it to 0x0000 | <ul class="ul" id="Video_debug_135__ul_yx4_ztd_cxb"><br>                  <li class="li">Debug = 0x01</li><br><br>                  <li class="li">Verbose = 0x02</li><br><br>                  <li class="li">Statistics = 0x04</li><br><br>                  <li class="li">Buffer flow = 0x08</li><br><br>                </ul> |

- Examples 

| Log domain (PP) | Private mask (QRST) | Log level (UU) | vendor.qc2.log.msg value (0xPPQRSTUU) |
    | --- | --- | --- | --- |
    | All (0x00 or 0xFF) | 0x0000 | All (0xFF) | 0x000000FF or 0xFF0000FF |
    | QC2V4l2Codec|QC2Component (0x0A) | 0x0000 | Debug|Verbose (0x03) | 0x0A000003 |
    | QC2VPPFilter|QC2PipelineCodec (0x14) | 0x0000 | Statistics (0x04) | 0x14000004 |
    | General|QC2Component|QC2V4l2Codec (0x0B) | 0x0000 | All (0xFF) | 0x0B0000FF |

- Enable Trace in video QC2 component: 

| Trace event levels | Command to enable all trace events |
    | --- | --- |
    | <ul class="ul" id="Video_debug_135__ul_wbb_b5d_cxb"><br>                    <li class="li">Debug = 0x01</li><br><br>                    <li class="li">Verbose = 0x02</li><br><br>                    <li class="li">QC2Component = 0x10</li><br><br>                    <li class="li">QC2V4l2Codec = 0x20</li><br><br>                    <li class="li">QC2Event = 0x40</li><br><br>                  </ul> | `adb shell setprop vendor.qc2.log.trace 115` |

## Capture Bit stream and YUV at QC2 video HAL

- The vendor.qc2.log.buffers property controls dumping buffers to file and combination of masks can be used.
- The dump files are located at /data/vendor/media/qc2/.

| Type of Buffer | Mask |
| --- | --- |
| Decoder input (Bitstream) | 0x00000001 |
| Decoder output (YUV) | 0x00000002 |
| Decoder output after color conversion (YUV) | 0x00000004 |
| Encoder input (YUV) | 0x00000010 |
| Encoder output (Bitstream) | 0x00000020 |
| Encoder input before conversion (RGB/YUV) | 0x00000040 |
| Force YUV dump to non-UBWC (linear) format | 0x00001000 |

- Command to dump only the decoder
          input:

        adb shell setprop vendor.qc2.log.buffers 0x01Copy to clipboard
- Command to dump decoder input and decoder output:
          c

        adb shell setprop vendor.qc2.log.buffers 0x03Copy to clipboard
- Command to dump decoder output in linear format:

        adb shell setprop vendor.qc2.log.buffers 0x1002Copy to clipboard
- Command to dump encoder input alone:

        adb shell setprop vendor.qc2.log.buffers 0x10Copy to clipboard
- Command to dump encoder input and encoder
          output:

        adb shell setprop vendor.qc2.log.buffers 0x30Copy to clipboard
- Command to dump decoder output and encoder
          input:

        adb shell setprop vendor.qc2.log.buffers 0x12Copy to clipboard
- Command to dump all types of
          buffers:

        adb shell setprop vendor.qc2.log.buffers 0x77Copy to clipboard

Note: Ensure to disable SELinux before capturing the dumps. Run `adb shell setenforce 0.`

## Debug mask levels for firmware and video driver debug

Predefined dprintk() messages in kernel are output depending on the message debug level

Levels:

    VIDC_ERR    = 0x00000001
    VIDC_HIGH    = 0x00000002
    VIDC_LOW    = 0x00000004
    VIDC_PERF    = 0x00000008
    VIDC_PKT    = 0x00000010
    VIDC_BUS    = 0x00000020
    VIDC_ENCODER  = 0x00000100
    VIDC_DECODER  = 0x00000200
    VIDC_CVP    = 0x00000400
    VIDC_PRINTK   = 0x00001000
    VIDC_FTRACE   = 0x00002000
    FW_LOW     = 0x00010000
    FW_MEDIUM    = 0x00020000
    FW_HIGH     = 0x00040000
    FW_ERROR    = 0x00080000
    FW_FATAL    = 0x00100000
    FW_PERF     = 0x00200000
    FW_PRINTK    = 0x10000000
    FW_FTRACE    = 0x20000000Copy to clipboard

The default debug level is set to VIDC\_ERR | VIDC\_PRINTK | FW\_ERROR | FW\_FATAL | FW\_FTRACE.
        Host logs are printed in dmesg and firmware logs are printed in Ftrace.

The debugfs node overwrites the default debug level.

- Node: /d/msm\_vidc/debug\_level“
- Value: 8-bit
    - LSB 4 bits are used for VIDC\_\*
    - MSB 4 bits are used for FW\_\*

| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Firmware log dump selection<br><br><br>                <br>FW\_PRINTK = 0x10000000<br><br><br>                <br>FW\_FTRACE = 0x20000000 | Reserved | Firmware log advanced levels<br><br><br>                <br>FW\_FATAL = 0x00100000<br><br><br>                <br>FW\_PERF = 0x00200000 | Firmware log levels<br><br><br>                <br>FW\_LOW = 0x00010000<br><br><br>                <br>FW\_MEDIUM = 0x00020000<br><br><br>                <br>FW\_HIGH = 0x00040000<br><br><br>                <br>FW\_ERROR = 0x00080000 | VIDC log dump selection<br><br><br>                <br>VIDE\_PRINTK = 0x00001000<br><br><br>                <br>VIDC\_FTRACE = 0x00002000 | VIDC session type<br><br><br>                <br>VIDC\_ENCODER = 0x00000100<br><br><br>                <br>VIDC\_DECODER = 0x00000200<br><br><br>                <br>VIDC\_CVP = 0x00000400 | VIDC log advanced levels<br><br><br>                <br>VIDC\_PKT = 0x00000010<br><br><br>                <br>VIDC\_BUS = 0x00000020 | VIDC log levels<br><br><br>                <br>VIDC\_ERR = 0x00000001<br><br><br>                <br>VIDC\_HIGH = 0x00000002<br><br><br>                <br>VIDC\_LOW = 0x00000004<br><br><br>                <br>VIDC\_PERF = 0x00000008 |
| To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for encoder session, run the command:<br>                <br>adb shell "echo 0x103F113F >   /d/msm_vidc/debug_level"Copy to clipboard |
| 1 | 0 | 3 | F | 1 | 1 | 3 | F |
| To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC<br>                driver in ftrace log for encoder session, run the command:<br>                <br><br>    adb shell "echo 0x203F213F >   /d/msm_vidc/debug_level"Copy to clipboard |
| 2 | 0 | 3 | F | 2 | 1 | 3 | F |
| To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for decoder session, run the command:<br>                <br>adb shell                "echo 0x103F123F >   /d/msm_vidc/debug_level"Copy to clipboard |
| 1 | 0 | 3 | F | 1 | 2 | 3 | F |
| To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in ftrace log for decoder session, run the command:<br>                <br>adb shell "echo 0x203F223F > /d/msm_vidc/debug_level"Copy to clipboard |
| 2 | 0 | 3 | F | 2 | 2 | 3 | F |
| To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard | To enable all debug levels for firmware and VIDC driver in kernel log for both decoder and encoder session, run the command:<br>                <br>adb shell "echo 0x103F133F >   /d/msm_vidc/debug_level"Copy to clipboard |
| 1 | **0** | 3 | F | 1 | 3 | 3 | F |

## Debug core

- To set video core clock to specific value:
    - Allowed clock values can be identified in the corresponding dtsi file
    - Run the following command to set clock to 366
              MHz:

            adb shell "echo 366000000 > /d/msm_vidc/core_clock_voting”Copy to clipboard
- The debugfs core debug messages provide the core instance information at runtime
- Structure
    - \d\msm\_vidc\core0\info
    - \d\msm\_vidc\core0\instance\_&lt;0..N&gt;\info
- Run the following command: 

        adb shell mount -t debugfs none /d
        /d/msm_vidc/core0/inst_ec024000 # cat infoCopy to clipboard
- Core instance information is displayed as:
    - Adreno VPU firmware version
    - Height
    - Width
    - Codec
    - Color
    - Plane size
    - Input and output buffer count

**Parent Topic:** [Video](https://docs.qualcomm.com/doc/80-88500-4/topic/130_Video.html)

Last Published: Aug 18, 2023

[Previous Topic
UVC](https://docs.qualcomm.com/bundle/publicresource/80-88500-4/topics/134_UVC.md) [Next Topic
Display](https://docs.qualcomm.com/bundle/publicresource/80-88500-4/topics/136_Display.md)