mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-06 19:07:20 +03:00
Replaces sriov flag with explicit path to the Intel GPU device (#19136)
* Replaces `sriov` flag with an explicit path to the GPU device for intel GPUs * Sort imports
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from .base import FrigateBaseModel
|
||||
@@ -11,8 +13,8 @@ class StatsConfig(FrigateBaseModel):
|
||||
network_bandwidth: bool = Field(
|
||||
default=False, title="Enable network bandwidth for ffmpeg processes."
|
||||
)
|
||||
sriov: bool = Field(
|
||||
default=False, title="Treat device as SR-IOV to support GPU stats."
|
||||
intel_gpu_device: Optional[str] = Field(
|
||||
default=None, title="Define the device to use when gathering SR-IOV stats."
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ async def set_gpu_stats(
|
||||
continue
|
||||
|
||||
# intel QSV GPU
|
||||
intel_usage = get_intel_gpu_stats(config.telemetry.stats.sriov)
|
||||
intel_usage = get_intel_gpu_stats(config.telemetry.stats.intel_gpu_device)
|
||||
|
||||
if intel_usage is not None:
|
||||
stats["intel-qsv"] = intel_usage or {"gpu": "", "mem": ""}
|
||||
@@ -226,7 +226,9 @@ async def set_gpu_stats(
|
||||
continue
|
||||
|
||||
# intel VAAPI GPU
|
||||
intel_usage = get_intel_gpu_stats(config.telemetry.stats.sriov)
|
||||
intel_usage = get_intel_gpu_stats(
|
||||
config.telemetry.stats.intel_gpu_device
|
||||
)
|
||||
|
||||
if intel_usage is not None:
|
||||
stats["intel-vaapi"] = intel_usage or {"gpu": "", "mem": ""}
|
||||
|
||||
@@ -257,7 +257,7 @@ def get_amd_gpu_stats() -> Optional[dict[str, str]]:
|
||||
return results
|
||||
|
||||
|
||||
def get_intel_gpu_stats(sriov: bool) -> Optional[dict[str, str]]:
|
||||
def get_intel_gpu_stats(intel_gpu_device: Optional[str]) -> Optional[dict[str, str]]:
|
||||
"""Get stats using intel_gpu_top."""
|
||||
|
||||
def get_stats_manually(output: str) -> dict[str, str]:
|
||||
@@ -304,8 +304,8 @@ def get_intel_gpu_stats(sriov: bool) -> Optional[dict[str, str]]:
|
||||
"1",
|
||||
]
|
||||
|
||||
if sriov:
|
||||
intel_gpu_top_command += ["-d", "sriov"]
|
||||
if intel_gpu_device:
|
||||
intel_gpu_top_command += ["-d", intel_gpu_device]
|
||||
|
||||
try:
|
||||
p = sp.run(
|
||||
|
||||
Reference in New Issue
Block a user