feat(vgpu): coherent sub-rect capture in perception

Persistent capture window over a fixed sub-rectangle of the captured surface. open() allocates a stable buffer once; sync() re-fills it all-or-nothing from the current latest frame under one seqlock window (byte-exact, never torn). Pull only - no poll/thread inside; the caller drives. FLAT/ROWS layouts and BGRA/RGB24 formats chosen at open, orthogonal. Strict skip when the rect does not fit the current frame; no frame_id dedup.

Extract read_field into perception-internal.h as vgpup_read_field to share the producer-field read between sample.c and capture.c. Bump version to 0.3.14.
This commit is contained in:
2026-06-29 22:43:38 +03:00
parent 17ad439b9b
commit d66f19cb24
6 changed files with 746 additions and 23 deletions
+11 -1
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
# Single source of truth for the version: CI passes -DVMSIG_VERSION=${TAG#v}, so the project
# version (-> libvgpu-perception SONAME/.so version) and the .deb version come from one tag.
set(VMSIG_VERSION "0.3.13" CACHE STRING "Release version (MAJOR.MINOR.PATCH); CI passes the tag")
set(VMSIG_VERSION "0.3.14" CACHE STRING "Release version (MAJOR.MINOR.PATCH); CI passes the tag")
project(vmsig VERSION ${VMSIG_VERSION} LANGUAGES C)
set(CMAKE_C_STANDARD 17)
@@ -130,6 +130,7 @@ if(VMSIG_WITH_VMIE)
add_library(vgpu-perception SHARED
src/si/vgpu-perception/discover.c
src/si/vgpu-perception/sample.c
src/si/vgpu-perception/capture.c
src/si/vgpu-perception/control.c)
set_target_properties(vgpu-perception PROPERTIES
VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) # libvgpu-perception.so.0
@@ -147,6 +148,15 @@ if(VMSIG_WITH_VMIE)
add_test(NAME vgpu_perception COMMAND vgpu_perceptiontest)
set_tests_properties(vgpu_perception PROPERTIES
ENVIRONMENT "LD_LIBRARY_PATH=${LIBVMIE_PATH}/.build:${CMAKE_BINARY_DIR}")
add_executable(vgpu_capturetest src/test/test_capture.c)
target_include_directories(vgpu_capturetest PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/si/vgpu-perception/include)
target_link_libraries(vgpu_capturetest PRIVATE vgpu-perception)
target_compile_options(vgpu_capturetest PRIVATE -O2 -Wall -Wextra)
add_test(NAME vgpu_capture COMMAND vgpu_capturetest)
set_tests_properties(vgpu_capture PROPERTIES
ENVIRONMENT "LD_LIBRARY_PATH=${LIBVMIE_PATH}/.build:${CMAKE_BINARY_DIR}")
endif()
# ---- vmsigd: the management daemon -----------------------------------------