Record PCI location paths during GVFG device enumeration
- Read Windows PCI location paths for capture devices. - Remove per-query HDMI video debug output and simplify frame descriptor transfer. - Document repository workflow and validation in AGENTS.md. Validation: git diff --cached --check passed. Build and runtime tests were not run for this commit.
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
# AGENTS.md
|
||||||
|
|
||||||
|
本指引適用於 `GVFG_Standalone`。以下路徑及指令以此 Git repository 根目錄為準。
|
||||||
|
|
||||||
|
## 專案入口
|
||||||
|
|
||||||
|
| 改動範圍 | 先看哪裡 |
|
||||||
|
| --- | --- |
|
||||||
|
| 擷取 API、裝置、通道、格式事件與 GPU 轉換 | `GVFG_SDK/sdk/gvfg/`,GigabyteLib adapter 位於 `src/gigabyte/` |
|
||||||
|
| 播放 API、模式、緩衝與影音同步 | `GVFG_SDK/helpers/gvfg_playback/` 與該目錄的 [維護說明](GVFG_SDK/helpers/gvfg_playback/README.md) |
|
||||||
|
| D3D 預覽與 WASAPI 音訊輸出 | `GVFG_SDK/helpers/gvfg_preview/`、`GVFG_SDK/helpers/gvfg_audio_playback/`,兩者都是 Playback 的內部靜態元件 |
|
||||||
|
| OSD | `GVFG_SDK/helpers/gvfg_osd/` |
|
||||||
|
| 建置、Sample 串接與安裝 | [內部建置說明](docs/INTERNAL_BUILD_GUIDE.md) 與各 target 的 `CMakeLists.txt` |
|
||||||
|
|
||||||
|
`../Costomer_SDK_Release/GVFG_Customer_Sample/` 是獨立的 Qt Demo,`../srcroot/` 是完整 Viewer。跨專案驗證可使用這些呼叫端,變更範圍依任務決定。`CaptureDemo/` 有舊範例及驅動參考資料。
|
||||||
|
|
||||||
|
## 實作與相容性
|
||||||
|
|
||||||
|
- 修改前先用 `git status --short` 確認既有變更,讀取相關實作、呼叫端及驗收條件。沿用適用的介面,優先在問題所屬模組修正根因。
|
||||||
|
- 公開 C API 變更應核對標頭、DLL 匯出清單(適用時檢查 `.def`)、呼叫端和安裝規則。保留現有呼叫端依賴的結構配置、狀態碼及資源所有權。版本以 `GVFG_SDK/CMakeLists.txt` 的 `GVFG_SDK_VERSION` 為準,依該檔案的版本政策評估變更。
|
||||||
|
- 擷取改動需追蹤裝置與通道的啟停、格式變更及 frame 的 read/release 配對。涉及 callback、等待或 teardown 時,檢查失敗路徑、重複啟停,以及停止或釋放後是否仍可存取緩衝區。
|
||||||
|
- Playback 管理提交資料的播放副本,模式、時鐘和同步邏輯留在 Playback。涵蓋受影響的 video-only、audio-only、audio-video 或單張影像路徑。預覽略過與錄影掉格分開量測。
|
||||||
|
- 維持 GigabyteLib vendor 介面和播放 backend 的既有邊界。客戶 Release 透過公開 API 使用 SDK,內部診斷依各 target 的組態控制。
|
||||||
|
- 公開契約或用法有變動時,更新對應的 [擷取手冊](docs/GVFG_CUSTOMER_API.md)、[播放手冊](docs/GVFG_PLAYBACK_API.md) 或 [API Reference](docs/GVFG_Customer_doc/GVFG_CUSTOMER_API_REFERENCE.md)。
|
||||||
|
- 修正缺陷時,若同類錯誤能穩定重現,依現有測試入口加入適當的回歸驗證。需要人工判斷時,記下重現步驟與預期結果。
|
||||||
|
|
||||||
|
## 建置與驗證
|
||||||
|
|
||||||
|
SDK 使用 Windows x64、C++17、CMake 3.16 以上及與 vendor `GvfgSdk.lib` 相容的 MSVC x64 工具鏈。SDK 建置無需 Qt。在 MSVC x64 Developer Command Prompt 確認 Ninja 可用後,從 repository 根目錄執行。
|
||||||
|
|
||||||
|
```bat
|
||||||
|
cmake -S GVFG_SDK -B GVFG_SDK/build_release -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build GVFG_SDK/build_release --target gvfg gvfg_playback
|
||||||
|
```
|
||||||
|
|
||||||
|
- 單項建置可將 `--target` 指定為受影響的 target。涉及公開標頭或共用類別配置時,完整重建 SDK,並用同版標頭、匯入庫和 DLL 乾淨重建相關應用程式。切換 generator 或 toolchain 時,使用獨立的 build 目錄。
|
||||||
|
- 封裝或安裝規則變更時,以 `cmake --install GVFG_SDK/build_release --prefix packages/sdk_check` 安裝到新的目錄,再核對公開標頭、匯入庫、DLL 與文件。需要 MinGW 客戶端匯入庫時,依建置說明設定並驗證 `GVFG_MINGW_DLLTOOL`。
|
||||||
|
- 擷取行為變更依影響範圍在有擷取卡、相容驅動及訊號源的環境驗證。播放行為使用對應的視窗或音訊裝置。依改動檢查有訊號、無訊號、格式切換、停止後重啟、輸出或同步。
|
||||||
|
- 修正擷取缺陷時,記錄卡型、驅動版本、輸入格式、重現步驟與預期行為。用相同條件重測,並驗證受影響的格式切換或停止後重啟流程。
|
||||||
|
- 修正影音同步或效能問題時,先量測基準,再用相同輸入、設定與測試時長比較修改前後。依問題記錄同步偏差、掉格數或其他相關指標,並附上單位與量測方式。缺少硬體或量測工具時,列出尚未驗證的情境。
|
||||||
|
- 文件變更核對路徑、指令及來源定義。交付時列出實際執行的檢查、結果與未驗證項目,分別回報編譯、封裝和實機結果。
|
||||||
@@ -438,18 +438,6 @@ namespace gvfg::internal
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
char debugMessage[256];
|
|
||||||
std::snprintf(debugMessage, sizeof(debugMessage),
|
|
||||||
"[GVFG] GvfgGetHdmiVideoInputInfo CH%" PRIu32
|
|
||||||
" | VideoSignalLock=%" PRIu32 " | %" PRIu32 "x%" PRIu32
|
|
||||||
" @ %" PRIu32 " fps | ColorFormat=0x%08" PRIX32
|
|
||||||
" | ColorSpace=0x%08" PRIX32 " | BitsPerPixel=%" PRIu32 "\n",
|
|
||||||
static_cast<uint32_t>(channel_), static_cast<uint32_t>(info.VideoSignalLock),
|
|
||||||
static_cast<uint32_t>(info.Width), static_cast<uint32_t>(info.Height),
|
|
||||||
static_cast<uint32_t>(info.Fps), static_cast<uint32_t>(info.ColorFormat),
|
|
||||||
static_cast<uint32_t>(info.ColorSpace), static_cast<uint32_t>(info.BitsPerPixel));
|
|
||||||
OutputDebugStringA(debugMessage);
|
|
||||||
|
|
||||||
out.connected = info.VideoSignalLock != 0;
|
out.connected = info.VideoSignalLock != 0;
|
||||||
out.width = info.Width;
|
out.width = info.Width;
|
||||||
out.height = info.Height;
|
out.height = info.Height;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <setupapi.h>
|
#include <setupapi.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cwchar>
|
||||||
|
|
||||||
#pragma comment(lib, "SetupAPI.lib")
|
#pragma comment(lib, "SetupAPI.lib")
|
||||||
|
|
||||||
@@ -27,6 +28,26 @@ namespace
|
|||||||
return {};
|
return {};
|
||||||
return reinterpret_cast<const wchar_t *>(bytes.data());
|
return reinterpret_cast<const wchar_t *>(bytes.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::wstring pci_location_path(HDEVINFO info, SP_DEVINFO_DATA &deviceInfo)
|
||||||
|
{
|
||||||
|
DWORD required = 0;
|
||||||
|
SetupDiGetDeviceRegistryPropertyW(info, &deviceInfo, SPDRP_LOCATION_PATHS,
|
||||||
|
nullptr, nullptr, 0, &required);
|
||||||
|
if (required < 2 * sizeof(wchar_t))
|
||||||
|
return {};
|
||||||
|
|
||||||
|
std::vector<wchar_t> paths(required / sizeof(wchar_t) + 2);
|
||||||
|
DWORD type = 0;
|
||||||
|
if (!SetupDiGetDeviceRegistryPropertyW(info, &deviceInfo, SPDRP_LOCATION_PATHS,
|
||||||
|
&type, reinterpret_cast<BYTE *>(paths.data()),
|
||||||
|
required, nullptr) || type != REG_MULTI_SZ)
|
||||||
|
return {};
|
||||||
|
for (const wchar_t *path = paths.data(); *path; path += std::wcslen(path) + 1)
|
||||||
|
if (_wcsnicmp(path, L"PCIROOT(", 8) == 0)
|
||||||
|
return path;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace gvfg::internal
|
namespace gvfg::internal
|
||||||
@@ -58,6 +79,7 @@ namespace gvfg::internal
|
|||||||
|
|
||||||
GigabyteDevice device;
|
GigabyteDevice device;
|
||||||
device.interface_path = detail->DevicePath;
|
device.interface_path = detail->DevicePath;
|
||||||
|
device.pci_location_path = pci_location_path(info, deviceInfo);
|
||||||
device.friendly_name = device_property(info, deviceInfo, SPDRP_FRIENDLYNAME);
|
device.friendly_name = device_property(info, deviceInfo, SPDRP_FRIENDLYNAME);
|
||||||
if (device.friendly_name.empty())
|
if (device.friendly_name.empty())
|
||||||
device.friendly_name = device_property(info, deviceInfo, SPDRP_DEVICEDESC);
|
device.friendly_name = device_property(info, deviceInfo, SPDRP_DEVICEDESC);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace gvfg::internal
|
|||||||
{
|
{
|
||||||
std::wstring interface_path;
|
std::wstring interface_path;
|
||||||
std::wstring friendly_name;
|
std::wstring friendly_name;
|
||||||
|
std::wstring pci_location_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<GigabyteDevice> enumerate_gigabyte_devices();
|
std::vector<GigabyteDevice> enumerate_gigabyte_devices();
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ struct gvfg_channel_session_t
|
|||||||
return stOpen;
|
return stOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentIndex = index;
|
|
||||||
syncSessionEventCallback();
|
syncSessionEventCallback();
|
||||||
selectedChannel = static_cast<uint32_t>(channelIndex);
|
selectedChannel = static_cast<uint32_t>(channelIndex);
|
||||||
resetRuntimeCounters();
|
resetRuntimeCounters();
|
||||||
@@ -254,7 +253,6 @@ struct gvfg_channel_session_t
|
|||||||
session->close();
|
session->close();
|
||||||
session.reset();
|
session.reset();
|
||||||
}
|
}
|
||||||
currentIndex = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gvfg_status_t getSignalStatus(gvfg_signal_status_t &out)
|
gvfg_status_t getSignalStatus(gvfg_signal_status_t &out)
|
||||||
@@ -503,15 +501,7 @@ struct gvfg_channel_session_t
|
|||||||
|
|
||||||
updateRuntimeFps(now_ns());
|
updateRuntimeFps(now_ns());
|
||||||
|
|
||||||
out.data = frame.data;
|
out = frame;
|
||||||
out.data_size = static_cast<uint64_t>(frame.data_size);
|
|
||||||
out.width = static_cast<int>(frame.width);
|
|
||||||
out.height = static_cast<int>(frame.height);
|
|
||||||
out.row_stride_bytes = frame.row_stride_bytes;
|
|
||||||
out.pixel_format = frame.pixel_format;
|
|
||||||
out.bit_depth = static_cast<int>(frame.bit_depth);
|
|
||||||
out.frame_id = frame.frame_id;
|
|
||||||
out.timestamp_ns = frame.timestamp_ns;
|
|
||||||
if (timing)
|
if (timing)
|
||||||
timing->frame_id = out.frame_id;
|
timing->frame_id = out.frame_id;
|
||||||
noteDeliveredFrame(out.width, out.height, out.bit_depth, out.pixel_format);
|
noteDeliveredFrame(out.width, out.height, out.bit_depth, out.pixel_format);
|
||||||
@@ -824,7 +814,6 @@ struct gvfg_channel_session_t
|
|||||||
|
|
||||||
ChannelErrorState &errorState;
|
ChannelErrorState &errorState;
|
||||||
std::unique_ptr<gvfg::internal::GigabyteCaptureSession> session;
|
std::unique_ptr<gvfg::internal::GigabyteCaptureSession> session;
|
||||||
int currentIndex = -1;
|
|
||||||
uint32_t selectedChannel = GVFG_CHANNEL_0;
|
uint32_t selectedChannel = GVFG_CHANNEL_0;
|
||||||
bool zeroCopyRequested = false;
|
bool zeroCopyRequested = false;
|
||||||
bool audioEnabled = false;
|
bool audioEnabled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user