# Qualcomm Linux 遷移

本指南將幫助您將軟體遷移到 Qualcomm^®^ Linux^®^ 1.4。它詳細說明了 1.4 版本與 1.3 版本相比的行為變化，重點介紹了主要更新和改進。如果您是現有開發者，並希望將現有軟體更新到最新的 Qualcomm Linux 版本，這些內容特別相關。

如果您是 Qualcomm Linux 的新手並使用最新版本，則無需遷移您的軟體。

隨著 1.4 版本的發布，Qualcomm Linux 已升級到最新的長期支持 (LTS) 版本 Yocto 5.0，稱為 Yocto `scarthgap`。此外，通用緩衝管理 (GBM) 記憶體管理器和 Weston 驅動程式已轉換為上游版本，取代了 1.3 及更早版本中使用的下游版本。

有關最新版本的新功能、增強功能和限制的列表，請參見 [*Qualcomm Linux 1.4 Release Notes*](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-250403001134/ReleaseNote.html) 。

## Yocto 的變更

1.4 版本中 Yocto 的變更如下：

- Yocto 版本已從 kirkstone (v4.0.22) 升級到 `scarthgap` (v5.0.6)。有關 `scarthgap` 的功能和增強功能，[請參見 5.0 版本 (scarthgap) 的發行說明](https://docs.yoctoproject.org/5.0.6/singleindex.html#release-notes-for-5-0-scarthgap)。
- GNU 編譯器集合 (GCC) 編譯器已升級到 v13.2。為避免兼容性問題，請使用最新的 1.4 版本重新編譯任何預編譯的應用程序。

## 記憶體管理器的變更

在 1.4 版本中，上游 [`libgbm` package](https://git.openembedded.org/openembedded-core/tree/meta/recipes-graphics/mesa?h=scarthgap&amp;id=00a662c5e28235fb64348aab4ce9aeb5e7f95d06) 用於記憶體管理，取代了下游變體。此變更影響顯示、圖形、影片和相機模組中的記憶體格式和 GBM 功能。

有關上游 GBM 支援的格式列表，請參見 [`mesa` repository](https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gbm/main/gbm.h)。

## 顯示的變更

在 1.4 版本中，QCS6490 和 QCS5430 系統晶片 (SoC) 平台的顯示堆棧已遷移到完全上游解決方案，消除了對專有 Snapdragon^®^ 顯示管理器 (SDM) 後端的需求。QCS8275 和 QCS9075 SoC 平台已經使用上游顯示解決方案。

由於這次遷移，某些依賴 SDM 元件的功能默認不可用。如果您需要這些功能，可以將顯示堆棧切換到下游實現。

要啟用這些功能，請使用下表中的信息：

| 功能 | 在 1.4 中啟用 |
| --- | --- |
| 嵌入式 DisplayPort (eDP) 支援 | 按照 [*Qualcomm Linux Display Guide - Addendum*](https://docs.qualcomm.com/bundle/resource/topics/80-70018-18A/configure.html#enable-sdm-and-downstream-display-drivers) 中的描述啟用下游路徑。 |
| TypeC over DisplayPort (DP) | 按照 [*Qualcomm Linux Display Guide - Addendum*](https://docs.qualcomm.com/bundle/resource/topics/80-70018-18A/configure.html#enable-sdm-and-downstream-display-drivers) 中的描述啟用下游路徑。 |
| 預建 modetest 二進位檔 | 在 `libdrm_2.4.120.bb` 檔案中，啟用 `install-test-programs` 選項。更多信息請參見 [*Qualcomm Linux Display Guide*](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-18/debug.html#generate-the-drm-mode-test-binary)。 |

## 相機的變更

在 1.4 版本中，緩衝管理工具使用上游 GBM 元件，而不是下游元件。因此，請更改調用相機緩衝管理的 Qualcomm Intelligent Multimedia (QIM) 命令。

原始緩衝區的默認格式現在是 memory:GBM。您無需在 gst 命令中指定記憶體格式。

**管道示例**

- 1.3 版本的管道如下：

gst-launch-1.0 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! waylandsink fullscreen=true async=true sync=false
    Copy to clipboard

- 1.4 版本的管道如下：

gst-launch-1.0 -e qtiqmmfsrc name=camsrc video_1::type=preview ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! waylandsink fullscreen=true sync=false
    Copy to clipboard

有關外掛程式變更的更多信息，請參見 [QIM SDK 的變更](https://docs.qualcomm.com/doc/80-70018-150T/topic/introduction.html#qim-sdk)。

## 影片的變更

為了管理影片編碼或解碼的緩衝區，1.4 版本支援直接記憶體存取 (DMA) 匯出模式 (4)、DMA 匯入模式 (5) 和記憶體映射 (MMAP) 模式 (2)。根據您的具體使用情況選擇適當的模式。

**示例**

當您在相機中進行編碼時，它已經生成 DMA 緩衝區。在這種情況下，請執行以下操作：

> 
> 
> - 將編碼器輸入設置為 DMA 匯入模式 (5)。此模式確保直接使用相機緩衝區檔案描述符 (FD)，而不在影片驅動程式端分配新緩衝區並複製內容。
> - 將編碼器輸出設置為 DMA 匯入模式 (5)。此模式確保影片驅動程式分配輸出緩衝區。

此示例的影片管道如下：

gst-launch-1.0 qtiqmmfsrc ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! v4l2h264enc output-io-mode=5 capture-io-mode=4 ! h264parse ! mp4mux ! filesink location=/opt/cam_enc.mp4
    Copy to clipboard

在此管道中，`output-io-mode` 是 DMA 匯入模式 (5)，表示輸入到編碼器，而 `capture-io-mode` 是 DMA 匯出模式 (4)，表示輸出到編碼器。

## QIM SDK 的變更

在 QIM SDK 1.4 版本中，由於記憶體管理元件的上游遷移，`waylandsink`、`qtiqmmfsrc`、`v4l2h264dec` 和 `v4l2h264enc` 外掛程式的行為發生了變化。更多詳情請參見 [記憶體管理器的變更](https://docs.qualcomm.com/doc/80-70018-150T/topic/introduction.html#memory-manager)。

為了反映 QIM SDK 外掛程式的變更以及上游 GBM 的對齊，請按以下方式更新示例應用程序。

### waylandsink 外掛程式

早期版本的 QIM SDK 使用了下游版本的 `waylandsink` 外掛程式，其中包括 `x,y,width,height` 坐標作為額外參數。在後續版本中，由於切換到上游 `waylandsink` 外掛程式，這一功能不再可用。應用程序現在應使用 `qtivcomposer` 外掛程式來實現此功能。

外掛程式變更及相應的操作如下：

| 變更 | 變更 | 操作 |
| --- | --- | --- |
| 1.3 | 1.4 | 操作 |
| 具有 `x,y,width,height` 坐標。 | 通過 `qtivcomposer` 外掛程式提供功能 | 使用 `qtivcomposer` 外掛程式進行合成。 |
|  |  |  |

**管道示例**

- 1.3 版本的管道如下：

gst-launch-1.0 -e qtivcomposer name=mixer sink_0::position="<0, 0>" sink_0::dimensions="<1280, 720>" sink_1::position="<590, 310>" sink_1::dimensions="<640, 360>" mixer. ! queue ! waylandsink enable-last-sample=false sync=true fullscreen=true filesrc location=/opt/mux1.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=5 output-io-mode=5 ! mixer. filesrc location=/opt/mux1.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=5 output-io-mode=5 ! mixer.
    Copy to clipboard

- 1.4 版本的管道如下：

gst-launch-1.0 -e qtivcomposer name=mixer sink_0::position="<0, 0>" sink_0::dimensions="<1280, 720>" sink_1::position="<590, 310>" sink_1::dimensions="<640, 360>" mixer. ! queue ! waylandsink fullscreen=true filesrc location=/opt/mux1.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw, format=NV12 ! mixer. filesrc location=/opt/mux1.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw, format=NV12 ! mixer.
    Copy to clipboard

### qtiqmmfsrc 外掛程式

從 1.4 版本開始，`qtiqmmfsrc` 外掛程式不再支援通用帶寬壓縮 (UBWC) NV12 的壓縮欄位。取而代之的是，客戶端必須使用專為 UBWC 壓縮 NV12 圖像設計的新格式。

外掛程式變更及相應的操作如下：

| 變更 | 變更 | 操作 |
| --- | --- | --- |
| 1.3 | 1.4 | 操作 |
| `format=NV12`<br><br><br>`compression=ubwc` | 新增 `format=NV12_Q08C` | <ul class="simple"><br><li><p>將格式從 <code class="docutils literal notranslate"><span class="pre">format=NV12</span></code> 更改為 <code class="docutils literal notranslate"><span class="pre">format=NV12_Q08C</span></code>。</p></li><br><li><p>移除 <code class="docutils literal notranslate"><span class="pre">compression=ubwc</span></code> 參數。</p></li><br></ul> |
|  |  |  |

**管道示例**

- 1.3 版本的管道如下：

gst-launch-1.0 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! v4l2h264enc output-io-mode=5 capture-io-mode=5 ! h264parse ! filesink location=/opt/video.h264
    Copy to clipboard

- 1.4 版本的管道如下：

gst-launch-1.0 -ev qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12_Q08C,width=1920,height=1080,framerate=30/1 ! queue ! v4l2h264enc output-io-mode=5 capture-io-mode=4 ! h264parse ! filesink location=/opt/video.h264
    Copy to clipboard

### v4l2h264enc 和 v4l2h264dec 外掛程式

在早期版本中，GST 框架管理應用程序緩衝區。從 1.4 版本開始，`v4l2` 驅動程式內部支援緩衝區管理。

要將此增強功能添加到驅動程式中，請執行以下操作：

- 對於使用 `v4l2h264enc` 外掛程式的相機源應用程序，將管道配置從 `output-io-mode=5`/ `capture-io-mode=5` 更改為 `output-io-mode=5`/ `capture-io-mode=4`。
- 對於使用 `v4l2h264dec` 外掛程式的檔案源應用程序，將管道配置從 `output-io-mode=5`/ `capture-io-mode=5` 更改為 `output-io-mode=4`/ `capture-io-mode=4`。

外掛程式變更及相應的操作如下：

| 使用案例 | 變更 | 變更 | 操作 |
| --- | --- | --- | --- |
| 使用案例 | 1.3 | 1.4 | 操作 |
| 影片編碼 | `format=NV12`<br><br><br>`compression=ubwc` | 新增 `format=NV12_Q08C` | <ul class="simple"><br><li><p>將格式從 <code class="docutils literal notranslate"><span class="pre">format=NV12</span></code> 更改為 <code class="docutils literal notranslate"><span class="pre">format=NV12_Q08C</span></code>。</p></li><br><li><p>移除 <code class="docutils literal notranslate"><span class="pre">compression=ubwc</span></code> 參數。</p></li><br></ul> |
| 影片編碼 | `output-io-mode=5` 和 `capture-io-mode=5` | 更新為 `output-io-mode=5` 和 `capture-io-mode=4` | 將模式更改為 `output-io-mode=5` 和 `capture-io-mode=4`。 |
| 影片解碼 | `output-io-mode=5` 和 `capture-io-mode=5` | <ul class="simple"><br><li><p>新增 caps 和 <code class="docutils literal notranslate"><span class="pre">format=NV12</span></code></p></li><br><li><p>更新為 <code class="docutils literal notranslate"><span class="pre">output-io-mode=4</span></code> 和 <code class="docutils literal notranslate"><span class="pre">capture-io-mode=4</span></code></p></li><br></ul> | <ul class="simple"><br><li><p>新增 <code class="docutils literal notranslate"><span class="pre">video/x-raw,format=NV12</span></code>。</p></li><br><li><p>將模式更改為 <code class="docutils literal notranslate"><span class="pre">output-io-mode=4</span></code> 和 <code class="docutils literal notranslate"><span class="pre">capture-io-mode=4</span></code>。</p></li><br></ul> |
|  |  |  |  |

**管道示例**

- 1.3 版本的影片解碼管道如下：

gst-launch-1.0 -e filesrc location=/opt/mux1.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=5 output-io-mode=5 !  waylandsink fullscreen=true
    Copy to clipboard

- 1.4 版本的影片解碼管道如下：

gst-launch-1.0 -e filesrc location=/opt/mux1.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw,format=NV12 ! waylandsink fullscreen=true
    Copy to clipboard

- 1.3 版本的影片編碼管道如下：

gst-launch-1.0 -e qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=3840,height=2160,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location="/opt/mux1.mp4"
    Copy to clipboard

- 1.4 版本的影片編碼管道如下：

gst-launch-1.0 -e qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12_Q08C,width=3840,height=2160,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location="/opt/mux1.mp4"
    Copy to clipboard

## 下一步

- 要更新 Qualcomm Linux 的空中更新 (OTA)，請參見 [*Qualcomm Linux Yocto Guide*](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-27/qualcomm_linux_software_components.html#ota-update-for-qualcomm-linux)。
- 要了解 Qualcomm Intelligent Multimedia Product (QIMP) SDK 的新功能、增強功能和限制，請參見 [*Qualcomm Linux QIMP SDK Release Notes*](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-52/qimp_sdk_release_1_4.html)。
- 要了解最新版本的新功能、增強功能和限制，請參見 [*Qualcomm Linux 1.4 Release Notes*](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-250403001134/ReleaseNote.html)。

Last Published: Aug 06, 2025

[Next Topic
參考資料](https://docs.qualcomm.com/bundle/publicresource/80-70018-150T/topics/references.md)

Source: [https://docs.qualcomm.com/doc/80-70018-150T/topic/introduction.html](https://docs.qualcomm.com/doc/80-70018-150T/topic/introduction.html)