> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IQ-X5121

## 调试 DisplayPort

选择显示路径。测试 USB Type-C 端口时，请保持 eDP 面板处于连接状态。

<Note>
  通过 SSH 连接到目标设备，并在 root shell 中运行目标设备命令。有关说明，请参阅 [使用 SSH 登录](https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh)。
</Note>

<Tabs>
  <Tab title="eDP 面板">
    在执行以下检查之前，请运行 `connector=eDP-1`。此命令会选择集成的 eDP 面板。

    <div className="flex flex-col items-center gap-2">
      <img src="https://mintcdn.com/qualcomm-staging/uWQLnBcS9sxlZhgB/Technologies/Display/media/qli-display/iq-x5121-edp-setup.jpg?fit=max&auto=format&n=uWQLnBcS9sxlZhgB&q=85&s=dcb98195a50500d4ab0109576ebdcedd" alt="图：IQ-X5121 eDP 连接器" width="500" height="500" data-path="Technologies/Display/media/qli-display/iq-x5121-edp-setup.jpg" />

      <p className="text-sm text-gray-700">**图：IQ-X5121 eDP 连接器**</p>
    </div>
  </Tab>

  <Tab title="USB Type-C DisplayPort">
    | **板载端口** | **Linux DRM 连接器** |
    | - | - |
    | USB0 | DP-1 |
    | USB1 | DP-2 |
    | USB2 | DP-3 |

    在执行以下检查之前，请运行 `connector=DP-1`、`connector=DP-2` 或 `connector=DP-3`。此命令会选择要测试的端口。

    <div className="flex flex-col items-center gap-2">
      <img src="https://mintcdn.com/qualcomm-staging/uWQLnBcS9sxlZhgB/Technologies/Display/media/qli-display/iq-x5121-usbc-dp-setup.jpg?fit=max&auto=format&n=uWQLnBcS9sxlZhgB&q=85&s=1782b88dbf8431f0ada19f1257e29d2d" alt="图：IQ-X5121 USB Type-C DisplayPort 连接器" width="500" height="500" data-path="Technologies/Display/media/qli-display/iq-x5121-usbc-dp-setup.jpg" />

      <p className="text-sm text-gray-700">**图：IQ-X5121 USB Type-C DisplayPort 连接器**</p>
    </div>
  </Tab>
</Tabs>

上述连接器映射因平台而异，并决定了后续步骤中使用的 connector 值。除此之外，所有 DisplayPort 页面上的七个故障排除步骤均相同。

### 1. 识别连接器

<div style={{ marginLeft: "1.5rem" }}>
  运行以下命令：

  > ```text theme={null}
  > modetest -M msm -c
  > ```

  此命令会列出 DRM 连接器及其 ID 和连接状态。
</div>

### 2. 检查连接器状态和模式

<div style={{ marginLeft: "1.5rem" }}>
  运行以下命令：

  > ```text theme={null}
  > cat "/sys/class/drm/card0-${connector}/status"
  > ```

  此命令会报告所选连接器是否已连接。预期结果为 `connected`。

  <p><strong>参考输出</strong></p>

  ```text theme={null}
  connected
  ```

  运行以下命令：

  > ```text theme={null}
  > cat "/sys/class/drm/card0-${connector}/modes"
  > ```

  此命令会列出所连接显示器报告的模式。

  已连接的输出通常会报告至少一种模式。如果状态为 `disconnected`，请检查电缆、显示器电源以及所选的显示器输入源。如果不存在 `card0`，请使用 `modetest` 报告的 DRM 卡。
</div>

### 3. 检查活动 DRM 状态

<div style={{ marginLeft: "1.5rem" }}>
  如果尚未挂载 `debugfs`，请运行以下命令：

  > ```text theme={null}
  > mount -t debugfs none /sys/kernel/debug
  > ```

  此命令会使 DRM 状态和接口调试数据可用。

  运行以下命令：

  > ```text theme={null}
  > modetest -M msm -c -p
  > ```

  此命令会显示所选连接器的编码器、CRTC、模式和平面。

  <p><strong>参考输出</strong></p>

  ```text theme={null}
  CRTCs:
  id      fb      pos     size
  75      78      (0,0)   (1920x1080)
    #0 1920x1080 60.00
  ```

  运行以下命令：

  > ```text theme={null}
  > cat /sys/kernel/debug/dri/0/state
  > ```

  此命令会显示每个连接器、编码器、CRTC 和平面的内核 DRM 状态。

  对于所选连接器，请确认存在一条活动显示管线：

  * `status: connected`
  * 已为该连接器分配编码器
  * 该编码器对应的 CRTC ID 不为零
  * 该 CRTC 的状态为 `active=yes`
  * 存在一个 `crtc` 字段与该 CRTC ID 匹配的平面

  只有满足以上所有条件，才能获得可见输出。

  <Note>
    **测试显示模式后恢复 Weston。**

    要测试其他模式，请按照 [运行 DRM modetest](run-drm-modetest) 操作，然后在返回 Weston 测试之前执行 [重新启动 Weston](troubleshoot-relaunch-weston)。
  </Note>
</div>

### 4. 检查接口信号

<div style={{ marginLeft: "1.5rem" }}>
  运行以下命令：

  > ```text theme={null}
  > cat "/sys/kernel/debug/dri/0/${connector}/dp_debug"
  > ```

  当驱动程序提供 `dp_debug` 时，此命令会显示 DisplayPort 链路速率、通道数和面板时序。

  <p><strong>参考输出</strong></p>

  ```text theme={null}
  name = msm_dp
  drm_dp_link
          rate = 270000
          num_lanes = 4
  dp_panel_info:
          active = 1920x1080
          refresh rate = 60
  ```

  运行以下命令：

  > ```text theme={null}
  > cat /sys/kernel/debug/clk/*dp*link_clk/clk_rate
  > ```

  此命令会以 Hz 为单位打印 DisplayPort 链路时钟频率。

  <p><strong>参考输出</strong></p>

  ```text theme={null}
  disp_cc_mdss_dp_link_clk: 270000000
  ```

  运行以下命令：

  > ```text theme={null}
  > cat /sys/kernel/debug/clk/*dp*pixel*clk/clk_rate
  > ```

  此命令会以 Hz 为单位打印 DisplayPort 像素时钟频率。

  <p><strong>参考输出</strong></p>

  ```text theme={null}
  disp_cc_mdss_dp_pixel_clk: 74250000
  ```

  正常工作的链路具有非零的速率和通道数值，并报告至少一种模式。请将像素时钟与活动 CRTC 模式进行比较，`modetest` 以 kHz 为单位报告该模式。
</div>

### 5. 检查本次启动的内核消息和实时显示事件

<div style={{ marginLeft: "1.5rem" }}>
  运行以下命令：

  > ```text theme={null}
  > journalctl -k -b --no-pager -o short-monotonic | grep -Ei 'msm[_-]dp|displayport|edp|dp_aux|link.*train|hpd|typec|ucsi|pmic_glink|dpu|drm'
  > ```

  此命令仅显示本次启动的 DisplayPort 和 DRM 消息。如果未返回任何内容，请在重现问题的同时捕获实时数据。

  <p><strong>参考输出</strong></p>

  ```text theme={null}
  [   12.512759] [drm] Initialized msm 1.13.0 for ae01000.display-controller
  ```

  要在重现问题时捕获显示事件，请运行以下命令：

  > ```text theme={null}
  > journalctl -f
  > ```

  此命令会持续跟踪新的 Weston 和内核消息。运行时请勿使用 `-k`，以便输出中包含合成器的连接器变化和输出启用信息。重现问题后，按 `Ctrl+C`。

  查找连接器状态变化、EDID 或模式检测、输出启用以及驱动程序错误。将相关消息与连接器状态和活动 DRM 状态进行比较。

  AUX 或 DPCD 超时表明电缆或端口存在问题，链路训练失败则表明链路质量存在问题。
</div>

### 6. 解读结果

<div style={{ marginLeft: "1.5rem" }}>
  | **结果** | **可能的问题区域** | **后续操作** |
  | - | - | - |
  | `disconnected` | 电缆或显示器输入源 | 重新插拔电缆，并选择正确的显示器输入源。 |
  | 已连接但无模式，或出现 AUX/DPCD 超时 | 电缆、端口或 EDID | 检查电缆和显示器，然后在跟踪实时日志的同时重新连接。 |
  | 链路训练失败 | 电缆或信号质量 | 尝试使用已知良好的电缆和较低带宽的模式。 |
  | 存在模式，但连接器、编码器、CRTC 和平面未构成一条活动管线 | DRM 或合成器 | 检查活动 DRM 状态和 Weston 状态。 |
  | 重新连接后没有新的显示消息，连接器状态也未变化 | HPD 或 Type-C 备用模式 | 检查端口、Type-C 插入方向和电缆。 |

  <Note>
    **在检查输出布局之前验证 Weston 服务。**

    运行以下命令：

    ```text theme={null}
    systemctl is-active weston
    ```

    预期结果为 `active`。如果该服务未处于活动状态，请先执行 [重新启动 Weston](troubleshoot-relaunch-weston)，然后再继续。
  </Note>
</div>

### 7. 检查 Weston 和输出布局

<div style={{ marginLeft: "1.5rem" }}>
  运行以下命令：

  > ```text theme={null}
  > journalctl -b -u weston -n 40 --no-pager
  > ```

  此命令会显示本次启动中最新的 Weston 消息。

  如果 Weston 处于活动状态但显示屏为黑屏，请运行以下命令：

  > ```text theme={null}
  > find /run/user/<weston-uid> -maxdepth 1 -type s -name 'wayland-*' -printf '%f\n'
  > ```

  此命令会列出可用的 Wayland 套接字名称。

  替换占位符后，运行以下命令：

  > ```text theme={null}
  > runuser -u weston -- env XDG_RUNTIME_DIR=/run/user/<weston-uid> WAYLAND_DISPLAY=<socket-name> wayland-info
  > ```

  <Note>
    **将 Weston 输出与 DRM 状态进行比较。**

    此命令会打印 Weston 输出信息。找到所选的显示输出，并将其与 DRM 连接器和 CRTC 状态进行比较。如果 Weston 未处于活动状态，请先执行 [重新启动 Weston](troubleshoot-relaunch-weston)，然后再继续。
  </Note>
</div>
