# 遷移至 Qualcomm Linux 1.4 以後版本

請參考以下重點更新與改進內容，以瞭解如何從 Qualcomm^®^ Linux^®^ 1.3 版本移轉到 Qualcomm Linux 1.4 以後版本。

Qualcomm Linux 1.4 及後續版本採用 Yocto 5.0 的最新長期支援 (LTS) 版本，稱為 Yocto `scarthgap`。通用緩衝區管理 (GBM) 記憶體管理程式和 Weston 驅動程式已改為上游版本，取代 1.3 及更早版本所使用的下游版本。

如果您是首次使用 Qualcomm Linux 並使用最新的 1.5 版本，則不必移轉軟體。有關最新版本的新功能、增強功能和限制，請參閱 [Qualcomm Linux 1.5 Release Notes](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-250630224842/)。

## 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。為避免相容性問題，請使用最新的 Qualcomm Linux 版本重新編譯所有預先建置的應用程式。

## 記憶體管理器的變更

在 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) 後端。IQ-8275 和 IQ-9075 SoC 平台則早已採用上游顯示堆疊。

因為這項移轉，部分依賴 SDM 元件的功能預設將無法使用。若有需要，可將顯示堆疊切換回下游版本。

若要在 1.4 以後版本中啟用這些功能，請參考下表中的資訊：

| 功能 | 在 1.4 以後版本中啟用 |
| --- | --- |
| Embedded DisplayPort (eDP) 支援 | 如 [Qualcomm Linux Display Guide - Addendum](https://docs.qualcomm.com/bundle/resource/topics/80-70020-18A/configure.html#enable-display-downstream-drivers) 中所述啟用下游路徑。 |
| Type-C over DisplayPort (DP) | 如 [Qualcomm Linux Display Guide - Addendum](https://docs.qualcomm.com/bundle/resource/topics/80-70020-18A/configure.html#enable-display-downstream-drivers) 中所述啟用下游路徑。 |
| 預先建置的 modetest 二進位檔案 | 在 `libdrm_2.4.120.bb` 檔案中，啟用 `install-test-programs` 選項。如需詳細資訊，請參閱 [Qualcomm Linux Display Guide](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-18/samples.html#run-drm-mode-test)。 |

## 攝影機相關變更

在 1.4 及後續版本中，緩衝區管理工具改為使用上游 GBM 元件，取代原本的下游版本。因此，請調整呼叫攝影機緩衝區管理的 Qualcomm Intelligent Multimedia (IM) 指令。

原始緩衝區的預設格式目前為 `memory:GBM`。請勿在 `gst` 指令中指定記憶體格式。

**Pipeline 範例**

- 1.3 版本的pipeline 如下：

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 以後版本的pipeline 如下：

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

如需有關外掛程式變更的詳細資訊，請參閱 [Qualcomm IM SDK 的變更](https://docs.qualcomm.com/doc/80-70020-150T/topic/introduction.html#qim-sdk)。

## 視訊相關變更

為了管理視訊編碼或解碼的緩衝區，1.4 以後版本支援直接記憶體存取 (DMA) 匯出模式 (4)、DMA 匯入模式 (5)，以及記憶體映射 (MMAP) 模式 (2)。請依照實際使用情境選擇合適的模式。

**範例**

當您在攝影機中編碼時，已經產生了 DMA 緩衝區。在此情況下，請進行下列動作：

> 
> 
> - 設定編碼器輸入為 DMA 匯入模式 (5)。此模式可確保直接使用攝影機緩衝區檔案描述元 (FD)，而不會在視訊驅動程式端分配新的緩衝區並複製內容。
> - 設定編碼器輸出為 DMA 匯入模式 (5)。此模式可確保視訊驅動程式分配輸出緩衝區。

適用此範例的視訊pipeline如下：

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

在此pipeline中，`output-io-mode` 為 DMA 匯入模式 (5)，代表輸入至編碼器，而 `capture-io-mode` 則為 DMA 匯出模式 (4)，代表輸出至編碼器。

## Qualcomm IM SDK 的變更

在 Qualcomm IM SDK 的 1.4 以後版本中，`waylandsink`、`qtiqmmfsrc`、`v4l2h264dec` 和 `v4l2h264enc` 外掛程式的行為已因為記憶體管理元件的上游移轉而改變。如需詳細資訊，請參閱 [記憶體管理器的變更](https://docs.qualcomm.com/doc/80-70020-150T/topic/introduction.html#memory-manager)。

若要反映 Qualcomm IM SDK 外掛程式和上游 GBM 對齊的變更，請如下所述更新範例應用程式。

### waylandsink 外掛程式

Qualcomm IM SDK 的早期版本使用 `waylandsink` 外掛程式的下游版本，其中包含 `x,y,width,height` 座標作為額外引數。在後續版本中，由於切換至上游 `waylandsink` 外掛程式，因此不再提供此功能。如果需要此功能，請改用 `qtivcomposer` 外掛程式。

外掛程式的變更以及您必須採取的相應操作如下：

| 變更 | 變更 | 動作 |
| --- | --- | --- |
| 1.3 | 1.4 以後版本 | 動作 |
| 有 `x,y,width,height` 座標。 | 透過 `qtivcomposer` 外掛程式提供功能。 | 使用 `qtivcomposer` 外掛程式進行組合。 |
|  |  |  |

**Pipeline 範例**

- 1.3 版本的pipeline 如下：

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 以後版本的pipeline 如下：

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> |
|  |  |  |

**Pipeline 範例**

- 1.3 版本的pipeline 如下：

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 以後版本的pipeline 如下：

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> |
|  |  |  |  |

**Pipeline 範例**

- 1.3 版本的視訊解碼器pipeline 如下：

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 以後版本的視訊解碼器pipeline 如下：

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 版本的視訊編碼器pipeline 如下：

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 以後版本的視訊編碼器pipeline 如下：

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

## 下一步

- 若要透過 OTA (over-the-air )更新 Qualcomm Linux，請參閱 [Qualcomm Linux Yocto Guide](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-27/ota_update_for_qualcomm_linux.html#ota-update-for-qualcomm-linux)。
- 若想瞭解 Qualcomm Intelligent Multimedia (IM) SDK 的新功能、強化項目與限制，請參閱 [Qualcomm Intelligent Multimedia (IM) SDK Release Notes](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-52/qim-sdk-release-1-5.html)。
- 若要進一步瞭解最新版本的新功能、增強功能和限制，請參閱 [Qualcomm Linux 1.5 Release Notes](https://docs.qualcomm.com/bundle/publicresource/topics/RNO-250630224842/)。

Last Published: Dec 23, 2025

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

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