@geastack/targets 0.1.100 → 0.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/targets/cmake/geatsc-generated-archive-build.mjs +32 -1
- package/targets/esp32/app_project.cmake +2 -2
- package/targets/esp32/chip_bindings/audio/echo_cancellation.cpp +392 -28
- package/targets/esp32/chip_bindings/audio/echo_cancellation.h +18 -2
- package/targets/esp32/chip_bindings/audio/es8311.cpp +117 -13
- package/targets/esp32/chip_bindings/displays/co5300.cpp +68 -28
- package/targets/esp32/components/gea_framework/CMakeLists.txt +17 -1
- package/targets/esp32/components/gea_framework/idf_component.yml +4 -0
- package/targets/esp32/components/gea_vpx/CMakeLists.txt +1 -1
- package/targets/esp32/connectivity/wifi.cpp +800 -543
- package/targets/esp32/display.cpp +121 -26
- package/targets/esp32/gea_framework.cmake +22 -28
- package/targets/esp32/host_sources.cmake +1 -0
- package/targets/esp32/services/comparison_benchmark.h +137 -0
- package/targets/esp32/services/comparison_gesture.h +133 -0
- package/targets/esp32/services/comparison_input_trace.h +64 -0
- package/targets/esp32/services/comparison_upload_capture.h +125 -0
- package/targets/esp32/services/debugger.h +634 -0
- package/targets/esp32/services/device_control.cpp +965 -20
- package/targets/esp32/services/frame_scheduler.cpp +128 -4
- package/targets/esp32/services/heap.cpp +125 -0
- package/targets/esp32/services/opus_benchmark.h +1 -1
- package/targets/esp32/services/storage_service.cpp +119 -104
- package/targets/esp32-p4-m5stack-tab5/dependencies.lock +27 -16
- package/targets/esp32-s3-m5stack-stopwatch/.clang-format +10 -0
- package/targets/esp32-s3-m5stack-stopwatch/README.md +14 -9
- package/targets/esp32-s3-m5stack-stopwatch/dependencies.lock +54 -1
- package/targets/esp32-s3-m5stack-stopwatch/main/CMakeLists.txt +10 -7
- package/targets/esp32-s3-m5stack-stopwatch/main/buttons.cpp +80 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/idf_component.yml +18 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/include/board.h +38 -17
- package/targets/esp32-s3-m5stack-stopwatch/main/panel_reset.cpp +132 -129
- package/targets/esp32-s3-m5stack-stopwatch/main/power.cpp +253 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/touch.cpp +158 -88
- package/targets/esp32-s3-m5stack-stopwatch/sdkconfig.defaults +13 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +30 -3
- package/targets/esp32-s3-touch-amoled-2.06/dependencies.lock +10 -148
- package/targets/esp32-s31-espressif-mosaico/CMakeLists.txt +8 -0
- package/targets/esp32-s31-espressif-mosaico/README.md +54 -2
- package/targets/esp32-s31-espressif-mosaico/dependencies.lock +405 -1
- package/targets/esp32-s31-espressif-mosaico/main/CMakeLists.txt +31 -1
- package/targets/esp32-s31-espressif-mosaico/main/board_power.cpp +117 -0
- package/targets/esp32-s31-espressif-mosaico/main/camera.cpp +389 -0
- package/targets/esp32-s31-espressif-mosaico/main/idf_component.yml +17 -3
- package/targets/esp32-s31-espressif-mosaico/main/include/board.h +23 -0
- package/targets/esp32-s31-espressif-mosaico/main/nand_mount.cpp +172 -0
- package/targets/esp32-s31-espressif-mosaico/partitions.csv +7 -3
- package/targets/esp32-s31-espressif-mosaico/sdkconfig.defaults +24 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#include "display_present.h"
|
|
8
8
|
#include "graphics/font.h"
|
|
9
9
|
#include "memory_config.h"
|
|
10
|
+
#include "services/comparison_benchmark.h"
|
|
10
11
|
#include "services/frame_scheduler.h" // setVSync → FrameScheduler::setVsyncDriven (TE single-clock)
|
|
11
12
|
#if GEA_EMBEDDED_DISPLAY_SOFTWARE_LANDSCAPE_PRIMARY
|
|
12
13
|
#include "host/display_orientation.h"
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
#include "freertos/idf_additions.h"
|
|
46
47
|
#include "ui/state_init.h"
|
|
47
48
|
#include "ui/dirty_regions.h"
|
|
49
|
+
#include "ui/tree_internal.h"
|
|
48
50
|
|
|
49
51
|
#if GEA_BOARD_PREPARE_DISPLAY_PANEL
|
|
50
52
|
namespace gea::platform::board
|
|
@@ -675,6 +677,13 @@ namespace gea::platform::esp32::display
|
|
|
675
677
|
pixels = flushOdometerPixels_.load(std::memory_order_relaxed);
|
|
676
678
|
}
|
|
677
679
|
|
|
680
|
+
#if GEA_EMBEDDED_COMPARISON_BENCHMARK
|
|
681
|
+
bool diagnosticWaitForUploads()
|
|
682
|
+
{
|
|
683
|
+
return !flushSlots_ || waitForFlushCompleteSpin(4000);
|
|
684
|
+
}
|
|
685
|
+
#endif
|
|
686
|
+
|
|
678
687
|
const char *flushStageName() const
|
|
679
688
|
{
|
|
680
689
|
return stageName(flushStage_.load(std::memory_order_acquire));
|
|
@@ -710,7 +719,16 @@ namespace gea::platform::esp32::display
|
|
|
710
719
|
// framebuffer pixels, but a private clip stack + dirty tracker — so the two cores
|
|
711
720
|
// never race on clip/dirty state. Everything else (single-core, the panel flush,
|
|
712
721
|
// console/fillRect helpers) keeps using the primary canvas_.
|
|
713
|
-
bool onWorkerCore() const
|
|
722
|
+
bool onWorkerCore() const
|
|
723
|
+
{
|
|
724
|
+
// Snapshot replay binds the primary canvas to an offscreen allocation.
|
|
725
|
+
// The control task is unpinned, so every draw and alpha access must keep
|
|
726
|
+
// using that canvas even if the task migrates CPUs during the capture.
|
|
727
|
+
// The snapshot scope then restores the same canvas to the framebuffer;
|
|
728
|
+
// the worker canvas never retains a pointer to the freed snapshot.
|
|
729
|
+
return !gea::embedded::ui::gSnapshotRasterActive &&
|
|
730
|
+
renderCoreId_ >= 0 && xPortGetCoreID() != renderCoreId_;
|
|
731
|
+
}
|
|
714
732
|
gea::framework::graphics::Canvas &replayCanvas() { return onWorkerCore() ? workerCanvas_ : canvas_; }
|
|
715
733
|
void setRenderCore(int core) { renderCoreId_ = core; }
|
|
716
734
|
// After a parallel band-replay joins, fold the worker canvas's dirty rects into
|
|
@@ -756,16 +774,58 @@ namespace gea::platform::esp32::display
|
|
|
756
774
|
// The TE edge is only a clock while vsync is on. Left armed it is a
|
|
757
775
|
// ~60 Hz interrupt whose handler preempts whatever else runs on this
|
|
758
776
|
// core, for nothing.
|
|
777
|
+
armTeInterrupt();
|
|
778
|
+
}
|
|
779
|
+
bool vsyncEnabled() const { return vsyncEnabled_; }
|
|
780
|
+
|
|
781
|
+
void armTeInterrupt()
|
|
782
|
+
{
|
|
783
|
+
if (!teSync_)
|
|
784
|
+
return;
|
|
785
|
+
const gpio_num_t te = gea::platform::board::display.te;
|
|
786
|
+
if (vsyncEnabled_ || streamVsync_)
|
|
787
|
+
gpio_intr_enable(te);
|
|
788
|
+
else
|
|
789
|
+
gpio_intr_disable(te);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// Stream vsync: tear-free streamed presents WITHOUT making TE the frame clock.
|
|
793
|
+
// The streamed (raster-callback) flush writes GRAM slower than the panel scans
|
|
794
|
+
// it out (~16.7 ms). With TE fired at scan row 0, a write of duration T started
|
|
795
|
+
// at scan phase p (time since that edge) is never crossed by the scan iff
|
|
796
|
+
// p <= 2*period - T: the first scan pass stays ahead of the writer (old frame),
|
|
797
|
+
// the second finds every row already written (new frame). So the flush starts
|
|
798
|
+
// at once when the phase allows it and otherwise waits for the next edge —
|
|
799
|
+
// no 33/50 ms frame quantization unless the write itself needs it.
|
|
800
|
+
void setStreamVSync(bool on)
|
|
801
|
+
{
|
|
802
|
+
streamVsync_ = on && (teSync_ != nullptr);
|
|
759
803
|
if (teSync_)
|
|
760
804
|
{
|
|
761
|
-
const
|
|
762
|
-
if (
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
gpio_intr_disable(te);
|
|
805
|
+
const int tearLine = streamVsync_ ? 0 : platform_display::kHeight - 120;
|
|
806
|
+
if (panel().setTearScanline(tearLine) != ESP_OK)
|
|
807
|
+
ESP_LOGW(kTag, "stream vsync: set tear scanline %d failed", tearLine);
|
|
808
|
+
ESP_LOGI(kTag, "stream vsync %s (tear scanline %d)", streamVsync_ ? "on" : "off", tearLine);
|
|
766
809
|
}
|
|
810
|
+
armTeInterrupt();
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
void streamVsyncGate()
|
|
814
|
+
{
|
|
815
|
+
const int64_t period = tePeriodUs_;
|
|
816
|
+
const int64_t write = lastStreamWriteUs_ + kStreamVsyncMarginUs;
|
|
817
|
+
const int64_t edge = lastTeUs_;
|
|
818
|
+
const int64_t now = esp_timer_get_time();
|
|
819
|
+
if (edge == 0)
|
|
820
|
+
return;
|
|
821
|
+
const int64_t phase = (now - edge) % period;
|
|
822
|
+
if (write < 2 * period && phase <= 2 * period - write)
|
|
823
|
+
return;
|
|
824
|
+
const int64_t t0 = now;
|
|
825
|
+
waitForVsync();
|
|
826
|
+
streamVsyncWaitUs_ += esp_timer_get_time() - t0;
|
|
827
|
+
streamVsyncWaits_++;
|
|
767
828
|
}
|
|
768
|
-
bool vsyncEnabled() const { return vsyncEnabled_; }
|
|
769
829
|
|
|
770
830
|
// Damage-all: the next present treats the whole panel as changed and skips both
|
|
771
831
|
// the dirtyRects compare and the persistent previous-frame copy (see present()).
|
|
@@ -1575,7 +1635,10 @@ namespace gea::platform::esp32::display
|
|
|
1575
1635
|
{
|
|
1576
1636
|
setFlushStage(FlushStage::WaitComplete, row);
|
|
1577
1637
|
const int64_t paceWaitStartUs = esp_timer_get_time();
|
|
1578
|
-
|
|
1638
|
+
// Preserve the periodic DMA drain without paying a scheduler tick
|
|
1639
|
+
// for a completion that normally arrives within one wire chunk.
|
|
1640
|
+
// The shared helper bounds the whole spin and then blocks safely.
|
|
1641
|
+
if (!waitForFlushCompleteSpin(4000))
|
|
1579
1642
|
{
|
|
1580
1643
|
setFlushStage(FlushStage::Idle, 0);
|
|
1581
1644
|
return false;
|
|
@@ -1900,6 +1963,10 @@ namespace gea::platform::esp32::display
|
|
|
1900
1963
|
}
|
|
1901
1964
|
#endif
|
|
1902
1965
|
bool ok = true;
|
|
1966
|
+
const bool streamGate = raster && streamVsync_ && !vsyncEnabled_ && n > 0;
|
|
1967
|
+
if (streamGate)
|
|
1968
|
+
streamVsyncGate();
|
|
1969
|
+
const int64_t writeStartUs = esp_timer_get_time();
|
|
1903
1970
|
for (int i = 0; i < n; i++)
|
|
1904
1971
|
{
|
|
1905
1972
|
if (!flushFramebufferRect(win[i].x0, win[i].y0, win[i].x1, win[i].y1, allowPerChunkDrain, raster, rasterUser))
|
|
@@ -1914,6 +1981,19 @@ namespace gea::platform::esp32::display
|
|
|
1914
1981
|
for (int i = 0; i < n; i++)
|
|
1915
1982
|
addPresentDamageRect(win[i].x0, win[i].y0, win[i].x1, win[i].y1);
|
|
1916
1983
|
}
|
|
1984
|
+
if (streamGate)
|
|
1985
|
+
{
|
|
1986
|
+
lastStreamWriteUs_ = esp_timer_get_time() - writeStartUs;
|
|
1987
|
+
if (++streamVsyncFrames_ >= 300)
|
|
1988
|
+
{
|
|
1989
|
+
ESP_LOGI(kTag, "stream vsync: waits=%d/%d waitUs=%lld period=%lldus write=%lldus",
|
|
1990
|
+
streamVsyncWaits_, streamVsyncFrames_, static_cast<long long>(streamVsyncWaitUs_),
|
|
1991
|
+
static_cast<long long>(tePeriodUs_), static_cast<long long>(lastStreamWriteUs_));
|
|
1992
|
+
streamVsyncFrames_ = 0;
|
|
1993
|
+
streamVsyncWaits_ = 0;
|
|
1994
|
+
streamVsyncWaitUs_ = 0;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1917
1997
|
flushStats_.totalUs += esp_timer_get_time() - profileStartUs;
|
|
1918
1998
|
}
|
|
1919
1999
|
|
|
@@ -3003,6 +3083,11 @@ namespace gea::platform::esp32::display
|
|
|
3003
3083
|
auto *self = static_cast<DisplayBackend *>(arg);
|
|
3004
3084
|
if (!self || !self->teSync_)
|
|
3005
3085
|
return;
|
|
3086
|
+
const int64_t nowUs = esp_timer_get_time();
|
|
3087
|
+
const int64_t dt = nowUs - self->lastTeUs_;
|
|
3088
|
+
if (self->lastTeUs_ != 0 && dt > 10000 && dt < 25000)
|
|
3089
|
+
self->tePeriodUs_ += (dt - self->tePeriodUs_) / 8;
|
|
3090
|
+
self->lastTeUs_ = nowUs;
|
|
3006
3091
|
// Single-clock: when TE-sync is on, the TE edge IS the frame producer — post one
|
|
3007
3092
|
// (coalesced) frame to the scheduler. The scheduler's own timer steps out (see
|
|
3008
3093
|
// queueFrameEvent), so the panel TE is the only frame clock. The semaphore give
|
|
@@ -3059,7 +3144,7 @@ namespace gea::platform::esp32::display
|
|
|
3059
3144
|
return;
|
|
3060
3145
|
}
|
|
3061
3146
|
// Vsync starts off; setVSync(true) arms the interrupt.
|
|
3062
|
-
if (!vsyncEnabled_)
|
|
3147
|
+
if (!vsyncEnabled_ && !streamVsync_)
|
|
3063
3148
|
gpio_intr_disable(te);
|
|
3064
3149
|
// Lead time: fire TE ~kVsyncLeadLines before the frame's last line so the
|
|
3065
3150
|
// host has time to write the NEXT frame's top rows into GRAM before scanout
|
|
@@ -3392,24 +3477,19 @@ namespace gea::platform::esp32::display
|
|
|
3392
3477
|
|
|
3393
3478
|
bool canUseFramebufferColorStream(int x0, int width, int totalRows, bool /*waitAtEnd*/) const
|
|
3394
3479
|
{
|
|
3395
|
-
if (flushQueueDepth_ < 2)
|
|
3396
|
-
|
|
3397
|
-
|
|
3480
|
+
if (flushQueueDepth_ < 2 || x0 < 0 || x0 >= logicalDisplayWidth() ||
|
|
3481
|
+
width <= 0 || width > logicalDisplayWidth() - x0 ||
|
|
3482
|
+
totalRows <= 0 || totalRows > logicalDisplayHeight())
|
|
3398
3483
|
return false;
|
|
3399
|
-
//
|
|
3400
|
-
//
|
|
3401
|
-
//
|
|
3402
|
-
//
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
// width-only for exactly this reason (the centered honeycomb starts mid-screen). Narrow
|
|
3409
|
-
// partial-width flushes (e.g. the ~42-row FPS-text region) stay on the serial path via
|
|
3410
|
-
// the totalRows>flushChunkRows_ gate above.
|
|
3411
|
-
(void)x0;
|
|
3412
|
-
return width >= (logicalDisplayWidth() * 3) / 4;
|
|
3484
|
+
// A windowed RAMWRC transfer wraps at this region's right edge, so
|
|
3485
|
+
// partial-width windows preserve the same pixels as full-width ones.
|
|
3486
|
+
// Stream only when it saves repeated window commands: narrow windows
|
|
3487
|
+
// can pack more rows into a slot than the full-width pipeline setting.
|
|
3488
|
+
const int fits = flushBufferCapacity_ / width;
|
|
3489
|
+
const int requested = normalizeFlushChunkRows(requestedFlushChunkRows_);
|
|
3490
|
+
const int rows = (fits < requested ? fits : requested);
|
|
3491
|
+
const int packedRows = rows - rows % kFlushChunkMin;
|
|
3492
|
+
return packedRows > 0 && totalRows > packedRows;
|
|
3413
3493
|
}
|
|
3414
3494
|
|
|
3415
3495
|
// A full-width region flushes as one streamed window (window set once, RAMWRC
|
|
@@ -5066,6 +5146,13 @@ namespace gea::platform::esp32::display
|
|
|
5066
5146
|
SemaphoreHandle_t flushSlots_ = nullptr;
|
|
5067
5147
|
SemaphoreHandle_t teSync_ = nullptr; // released by teEdgeIsr on each TE (VBlank) edge
|
|
5068
5148
|
bool vsyncEnabled_ = false; // opt-in (Display.setVSync); gates the in-present VBlank wait
|
|
5149
|
+
bool streamVsync_ = false; // opt-in (gea_display_set_stream_vsync); phase-gates streamed flushes
|
|
5150
|
+
static constexpr int64_t kStreamVsyncMarginUs = 2000;
|
|
5151
|
+
volatile int64_t lastTeUs_ = 0; // esp_timer time of the last TE edge (scan row 0 under stream vsync)
|
|
5152
|
+
volatile int64_t tePeriodUs_ = 16667;
|
|
5153
|
+
int64_t lastStreamWriteUs_ = 0; // duration of the previous streamed flush (predicts this one)
|
|
5154
|
+
int64_t streamVsyncWaitUs_ = 0;
|
|
5155
|
+
int streamVsyncWaits_ = 0, streamVsyncFrames_ = 0;
|
|
5069
5156
|
// [present.split] per-present-path timing accumulators (dumped every 30 frames).
|
|
5070
5157
|
int64_t splitExtractUs_ = 0, splitDiffUs_ = 0, splitDrainUs_ = 0, splitVsyncUs_ = 0, splitFlushUs_ = 0;
|
|
5071
5158
|
long long splitPx_ = 0;
|
|
@@ -5154,6 +5241,13 @@ void platform_display::Display::flushOdometerRead(uint32_t &calls, uint64_t &pix
|
|
|
5154
5241
|
DisplayBackend::instance().flushOdometerRead(calls, pixels);
|
|
5155
5242
|
}
|
|
5156
5243
|
|
|
5244
|
+
#if GEA_EMBEDDED_COMPARISON_BENCHMARK
|
|
5245
|
+
extern "C" bool gea_display_wait_for_uploads()
|
|
5246
|
+
{
|
|
5247
|
+
return DisplayBackend::instance().diagnosticWaitForUploads();
|
|
5248
|
+
}
|
|
5249
|
+
#endif
|
|
5250
|
+
|
|
5157
5251
|
void platform_display::Display::flushStatsReset()
|
|
5158
5252
|
{
|
|
5159
5253
|
DisplayBackend::instance().flushStatsReset();
|
|
@@ -5185,6 +5279,7 @@ void platform_display::Display::setBrightness(int brightnessPercent) { DisplayBa
|
|
|
5185
5279
|
bool platform_display::Display::setHighBrightnessMode(bool enabled) { return DisplayBackend::instance().setHighBrightnessMode(enabled); }
|
|
5186
5280
|
bool platform_display::Display::highBrightnessMode() { return DisplayBackend::instance().highBrightnessMode(); }
|
|
5187
5281
|
void platform_display::Display::setVSync(bool on) { DisplayBackend::instance().setVSync(on); }
|
|
5282
|
+
extern "C" void gea_display_set_stream_vsync(bool on) { DisplayBackend::instance().setStreamVSync(on); }
|
|
5188
5283
|
void platform_display::Display::invalidate() { DisplayBackend::instance().invalidate(); }
|
|
5189
5284
|
bool platform_display::Display::vsyncEnabled() { return DisplayBackend::instance().vsyncEnabled(); }
|
|
5190
5285
|
void platform_display::Display::vsyncWaitForFrame() { DisplayBackend::instance().vsyncWaitForFrame(); }
|
|
@@ -205,6 +205,7 @@ endforeach()
|
|
|
205
205
|
# changing generated app code, network capability, or render-tuning flags no
|
|
206
206
|
# longer recompiles the whole framework.
|
|
207
207
|
set(GEA_FW_APP_SENSITIVE_SOURCES
|
|
208
|
+
"${GEA_HOST}/host/audio_buffer_runtime.cpp"
|
|
208
209
|
"${GEA_ENGINE}/ui/tree_render.cpp"
|
|
209
210
|
"${GEA_ENGINE}/ui/tree_style.cpp"
|
|
210
211
|
"${GEA_HOST}/host/fetch.cpp"
|
|
@@ -301,35 +302,28 @@ function(gea_framework_inherit_build_settings)
|
|
|
301
302
|
target_compile_options(${_gea_framework_lib} PRIVATE ${_gea_framework_stable_options})
|
|
302
303
|
endif()
|
|
303
304
|
|
|
304
|
-
#
|
|
305
|
-
#
|
|
306
|
-
#
|
|
307
|
-
#
|
|
308
|
-
#
|
|
309
|
-
#
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
get_target_property(_gea_lib_type ${_gea_lib} TYPE)
|
|
321
|
-
if(_gea_lib_type STREQUAL "STATIC_LIBRARY")
|
|
322
|
-
list(APPEND _gea_rescan "$<TARGET_FILE:${_gea_lib}>")
|
|
323
|
-
endif()
|
|
305
|
+
# Generated app code can first pull a host bridge from the framework and a
|
|
306
|
+
# platform driver from main after IDF has already visited that driver's SDK
|
|
307
|
+
# libraries. This cycle applies to every runtime (e.g. the Mosaico DVP/JPEG
|
|
308
|
+
# camera), not only the small canvas graph. Rescan the generated app and the
|
|
309
|
+
# complete selected IDF component set together. Only referenced members are
|
|
310
|
+
# extracted; this does not force unused SDK objects into the firmware.
|
|
311
|
+
# main is a static archive, so publish the group through its link interface
|
|
312
|
+
# for the final ELF link rather than setting archive-private link options.
|
|
313
|
+
idf_build_get_property(_gea_components BUILD_COMPONENTS)
|
|
314
|
+
set(_gea_rescan "${GEATSC_ARCHIVE}")
|
|
315
|
+
foreach(_gea_component IN LISTS _gea_components)
|
|
316
|
+
idf_component_get_property(_gea_lib ${_gea_component} COMPONENT_LIB)
|
|
317
|
+
if(TARGET ${_gea_lib})
|
|
318
|
+
get_target_property(_gea_lib_type ${_gea_lib} TYPE)
|
|
319
|
+
if(_gea_lib_type STREQUAL "STATIC_LIBRARY")
|
|
320
|
+
list(APPEND _gea_rescan "$<TARGET_FILE:${_gea_lib}>")
|
|
324
321
|
endif()
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
target_link_libraries(${COMPONENT_LIB} INTERFACE
|
|
331
|
-
"-Wl$<COMMA>--start-group$<COMMA>${CMAKE_BINARY_DIR}/esp-idf/main/libmain.a$<COMMA>${CMAKE_BINARY_DIR}/esp-idf/gea_framework/libgea_framework.a$<COMMA>--end-group")
|
|
332
|
-
endif()
|
|
322
|
+
endif()
|
|
323
|
+
endforeach()
|
|
324
|
+
list(JOIN _gea_rescan "$<COMMA>" _gea_rescan_args)
|
|
325
|
+
target_link_libraries(${COMPONENT_LIB} INTERFACE
|
|
326
|
+
"-Wl$<COMMA>--start-group$<COMMA>${_gea_rescan_args}$<COMMA>--end-group")
|
|
333
327
|
|
|
334
328
|
endfunction()
|
|
335
329
|
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
#ifndef GEA_EMBEDDED_COMPARISON_BENCHMARK
|
|
5
|
+
#define GEA_EMBEDDED_COMPARISON_BENCHMARK 0
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#if GEA_EMBEDDED_COMPARISON_BENCHMARK
|
|
9
|
+
#include <algorithm>
|
|
10
|
+
#include <array>
|
|
11
|
+
#include <atomic>
|
|
12
|
+
#include <cstdint>
|
|
13
|
+
#include <cstdio>
|
|
14
|
+
#include <mutex>
|
|
15
|
+
|
|
16
|
+
namespace gea::platform::comparison {
|
|
17
|
+
|
|
18
|
+
struct Distribution {
|
|
19
|
+
static constexpr unsigned kBinUs = 1000;
|
|
20
|
+
std::array<std::uint32_t, 256> bins{};
|
|
21
|
+
std::uint64_t count = 0, sum = 0, maximum = 0, over16667 = 0;
|
|
22
|
+
|
|
23
|
+
void add(std::uint64_t us) {
|
|
24
|
+
++count;
|
|
25
|
+
sum += us;
|
|
26
|
+
maximum = std::max(maximum, us);
|
|
27
|
+
if (us > 16667) {
|
|
28
|
+
++over16667;
|
|
29
|
+
}
|
|
30
|
+
++bins[std::min<std::uint64_t>(us / kBinUs, bins.size() - 1)];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// -1 means no samples or an unbounded overflow bin, never a fabricated bound.
|
|
34
|
+
std::int64_t percentileUpper(unsigned percent) const {
|
|
35
|
+
std::uint64_t cumulative = 0;
|
|
36
|
+
if (!count) {
|
|
37
|
+
return -1;
|
|
38
|
+
}
|
|
39
|
+
for (unsigned bin = 0; bin < bins.size(); ++bin) {
|
|
40
|
+
cumulative += bins[bin];
|
|
41
|
+
if (cumulative * 100 >= count * percent) {
|
|
42
|
+
return bin + 1 == bins.size() ? std::int64_t{-1}
|
|
43
|
+
: static_cast<std::int64_t>((bin + 1) * kBinUs);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return -1;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
struct Sample {
|
|
51
|
+
char runId[64]{}, scenario[64]{};
|
|
52
|
+
std::int64_t startUs = 0, endUs = 0, previousDoneUs = 0, previousPresentedUs = 0;
|
|
53
|
+
std::uint64_t schedulerFrames = 0, renderedFrames = 0, presentedFrames = 0;
|
|
54
|
+
std::uint64_t presentChunks = 0, presentPixels = 0;
|
|
55
|
+
std::uint64_t completionWaitSum = 0, completionWaitMax = 0;
|
|
56
|
+
std::uint32_t completionFailures = 0;
|
|
57
|
+
bool completionFence = true;
|
|
58
|
+
Distribution work, cadence, presentedCadence;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
struct Token {
|
|
62
|
+
std::uint32_t generation = 0;
|
|
63
|
+
bool active = false;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
inline std::mutex mutex;
|
|
67
|
+
inline std::atomic<bool> enabled{false};
|
|
68
|
+
inline std::atomic<bool> completionFence{true};
|
|
69
|
+
// Static captures only; monotonic frame/input clocks remain untouched.
|
|
70
|
+
inline std::atomic<std::int64_t> frozenEpochSeconds{0};
|
|
71
|
+
inline std::uint32_t generation = 0;
|
|
72
|
+
inline Sample sample;
|
|
73
|
+
|
|
74
|
+
inline void begin(const char* runId, const char* scenario, std::int64_t nowUs) {
|
|
75
|
+
const std::lock_guard<std::mutex> guard(mutex);
|
|
76
|
+
enabled.store(false, std::memory_order_release);
|
|
77
|
+
sample = {};
|
|
78
|
+
std::snprintf(sample.runId, sizeof(sample.runId), "%s", runId);
|
|
79
|
+
std::snprintf(sample.scenario, sizeof(sample.scenario), "%s", scenario);
|
|
80
|
+
sample.startUs = nowUs;
|
|
81
|
+
sample.completionFence = completionFence.load(std::memory_order_relaxed);
|
|
82
|
+
++generation;
|
|
83
|
+
enabled.store(true, std::memory_order_release);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
inline Token frameBegin() {
|
|
87
|
+
if (!enabled.load(std::memory_order_acquire)) {
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
const std::lock_guard<std::mutex> guard(mutex);
|
|
91
|
+
return {generation, enabled.load(std::memory_order_relaxed)};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
inline void frameDone(Token token, std::int64_t startUs, std::int64_t doneUs,
|
|
95
|
+
std::uint32_t flushCalls, std::uint64_t pixels, std::uint32_t chunks,
|
|
96
|
+
std::uint64_t completionWaitUs = 0, bool completionSucceeded = true) {
|
|
97
|
+
if (!token.active || !enabled.load(std::memory_order_acquire)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const std::lock_guard<std::mutex> guard(mutex);
|
|
101
|
+
if (!enabled.load(std::memory_order_relaxed) || token.generation != generation) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
++sample.schedulerFrames;
|
|
105
|
+
if (flushCalls && pixels) {
|
|
106
|
+
++sample.renderedFrames;
|
|
107
|
+
}
|
|
108
|
+
sample.completionWaitSum += completionWaitUs;
|
|
109
|
+
sample.completionWaitMax = std::max(sample.completionWaitMax, completionWaitUs);
|
|
110
|
+
if (sample.completionFence && !completionSucceeded) {
|
|
111
|
+
++sample.completionFailures;
|
|
112
|
+
}
|
|
113
|
+
if (chunks && flushCalls && pixels && sample.completionFence && completionSucceeded) {
|
|
114
|
+
++sample.presentedFrames;
|
|
115
|
+
if (sample.previousPresentedUs) {
|
|
116
|
+
sample.presentedCadence.add(doneUs - sample.previousPresentedUs);
|
|
117
|
+
}
|
|
118
|
+
sample.previousPresentedUs = doneUs;
|
|
119
|
+
}
|
|
120
|
+
sample.presentChunks += chunks;
|
|
121
|
+
sample.presentPixels += pixels;
|
|
122
|
+
sample.work.add(static_cast<std::uint64_t>(std::max<std::int64_t>(0, doneUs - startUs)));
|
|
123
|
+
if (sample.previousDoneUs) {
|
|
124
|
+
sample.cadence.add(doneUs - sample.previousDoneUs);
|
|
125
|
+
}
|
|
126
|
+
sample.previousDoneUs = doneUs;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
inline Sample end(std::int64_t nowUs) {
|
|
130
|
+
const std::lock_guard<std::mutex> guard(mutex);
|
|
131
|
+
enabled.store(false, std::memory_order_release);
|
|
132
|
+
sample.endUs = nowUs;
|
|
133
|
+
return sample;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
} // namespace gea::platform::comparison
|
|
137
|
+
#endif
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
#include "services/comparison_input_trace.h"
|
|
5
|
+
|
|
6
|
+
#if GEA_EMBEDDED_COMPARISON_BENCHMARK
|
|
7
|
+
namespace gea::platform::comparison::gesture {
|
|
8
|
+
|
|
9
|
+
inline constexpr unsigned kCapacity = 128, kNodeCapacity = 64;
|
|
10
|
+
inline constexpr unsigned kGestureClassCount = 8;
|
|
11
|
+
inline constexpr const char* kClasses[] = {"menu-icon",
|
|
12
|
+
"menu-title",
|
|
13
|
+
"dot",
|
|
14
|
+
"roller",
|
|
15
|
+
"roller-row",
|
|
16
|
+
"settings",
|
|
17
|
+
"list-button",
|
|
18
|
+
"roller-track",
|
|
19
|
+
"percentage",
|
|
20
|
+
"slider-fill",
|
|
21
|
+
"slider-knob",
|
|
22
|
+
"switch",
|
|
23
|
+
"sw-left",
|
|
24
|
+
"sw-right",
|
|
25
|
+
"elapsed",
|
|
26
|
+
"lap",
|
|
27
|
+
"no-laps",
|
|
28
|
+
"wheel-label",
|
|
29
|
+
"wheel-pointer",
|
|
30
|
+
"frequency",
|
|
31
|
+
"accel",
|
|
32
|
+
"classic-time",
|
|
33
|
+
"classic-weekday",
|
|
34
|
+
"classic-date",
|
|
35
|
+
"simple-time",
|
|
36
|
+
"simple-date",
|
|
37
|
+
"simple-hint",
|
|
38
|
+
"alarm-row",
|
|
39
|
+
"alarm-time",
|
|
40
|
+
"ringing",
|
|
41
|
+
"dialog",
|
|
42
|
+
"adjust-title",
|
|
43
|
+
"about",
|
|
44
|
+
"progress",
|
|
45
|
+
"battery",
|
|
46
|
+
"badge-hint",
|
|
47
|
+
"adjust-summary",
|
|
48
|
+
"ok",
|
|
49
|
+
"crash-progress",
|
|
50
|
+
"section-title",
|
|
51
|
+
"laps"};
|
|
52
|
+
|
|
53
|
+
struct NodeState {
|
|
54
|
+
int id, kind, parent, x, y, width, height, scrollX, scrollY, contentWidth, contentHeight,
|
|
55
|
+
selected, children;
|
|
56
|
+
bool textTruncated;
|
|
57
|
+
std::int16_t cornerX[4], cornerY[4];
|
|
58
|
+
char text[96];
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
struct Observation {
|
|
62
|
+
int requestedMs = 0;
|
|
63
|
+
std::int64_t actualUs = 0;
|
|
64
|
+
unsigned count = 0, dropped = 0;
|
|
65
|
+
NodeState nodes[kNodeCapacity];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
struct Event {
|
|
69
|
+
int requestedMs = 0, state = 0, x = 0, y = 0, phase = 0;
|
|
70
|
+
std::int64_t actualUs = 0;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
struct Plan {
|
|
74
|
+
Event events[kCapacity];
|
|
75
|
+
Observation observations[kCapacity];
|
|
76
|
+
unsigned eventCount = 0, observationCount = 0;
|
|
77
|
+
std::int64_t originUs = 0;
|
|
78
|
+
bool complete = false;
|
|
79
|
+
input::Snapshot pointerReads;
|
|
80
|
+
|
|
81
|
+
bool addTouch(int ms, int state, int x, int y) {
|
|
82
|
+
if (complete || eventCount == kCapacity || ms < 0 || ms > 15000 || (state != 0 && state != 1) ||
|
|
83
|
+
(eventCount && ms < events[eventCount - 1].requestedMs)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
events[eventCount++] = {ms, state, x, y, 0, 0};
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
bool addObservation(int ms) {
|
|
91
|
+
if (complete || observationCount == kCapacity || ms < 0 || ms > 15000 ||
|
|
92
|
+
(observationCount && ms < observations[observationCount - 1].requestedMs)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
observations[observationCount++].requestedMs = ms;
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
bool valid() const {
|
|
100
|
+
return !complete && eventCount && events[0].state == 1 && events[eventCount - 1].state == 0;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Events and observations use one device clock, without host transport pacing.
|
|
105
|
+
// Injectable operations keep the real queue/coalescing/dispatch path intact.
|
|
106
|
+
template <typename Clock, typename Wait, typename Inject, typename Observe>
|
|
107
|
+
void play(Plan& plan, Clock clock, Wait wait, Inject inject, Observe observe) {
|
|
108
|
+
plan.originUs = clock();
|
|
109
|
+
unsigned event = 0, observation = 0;
|
|
110
|
+
bool pressed = false;
|
|
111
|
+
while (event < plan.eventCount || observation < plan.observationCount) {
|
|
112
|
+
const int nextEvent = event < plan.eventCount ? plan.events[event].requestedMs : 16000;
|
|
113
|
+
const int nextObservation =
|
|
114
|
+
observation < plan.observationCount ? plan.observations[observation].requestedMs : 16000;
|
|
115
|
+
const std::int64_t deadline = plan.originUs + std::min(nextEvent, nextObservation) * 1000;
|
|
116
|
+
while (clock() < deadline) {
|
|
117
|
+
wait(deadline - clock());
|
|
118
|
+
}
|
|
119
|
+
if (nextEvent <= nextObservation) {
|
|
120
|
+
auto& sample = plan.events[event++];
|
|
121
|
+
sample.phase = sample.state ? (pressed ? 2 : 1) : 3;
|
|
122
|
+
sample.actualUs = clock();
|
|
123
|
+
inject(sample.phase, sample.state != 0, sample.x, sample.y);
|
|
124
|
+
pressed = sample.state != 0;
|
|
125
|
+
} else {
|
|
126
|
+
observe(plan.observations[observation++]);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
plan.complete = true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
} // namespace gea::platform::comparison::gesture
|
|
133
|
+
#endif
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
#include "services/comparison_benchmark.h"
|
|
5
|
+
|
|
6
|
+
#if GEA_EMBEDDED_COMPARISON_BENCHMARK
|
|
7
|
+
namespace gea::platform::comparison::input {
|
|
8
|
+
|
|
9
|
+
struct Entry {
|
|
10
|
+
std::int64_t timestampUs;
|
|
11
|
+
int phase, touching, x, y, pointerId, handlerX, handlerY;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
struct Snapshot {
|
|
15
|
+
Entry* entries = nullptr;
|
|
16
|
+
unsigned count = 0, dropped = 0;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
inline std::mutex traceMutex;
|
|
20
|
+
inline std::atomic<bool> recording{false};
|
|
21
|
+
inline Entry* entries = nullptr;
|
|
22
|
+
inline unsigned capacity = 0, count = 0, dropped = 0;
|
|
23
|
+
|
|
24
|
+
// The caller owns storage. END detaches it while locked, so it can be printed
|
|
25
|
+
// and freed without blocking input dispatch or racing the next consumed event.
|
|
26
|
+
inline bool begin(Entry* storage, unsigned size) {
|
|
27
|
+
const std::lock_guard<std::mutex> guard(traceMutex);
|
|
28
|
+
if (!storage || !size || entries || enabled.load(std::memory_order_acquire)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
entries = storage;
|
|
32
|
+
capacity = size;
|
|
33
|
+
count = dropped = 0;
|
|
34
|
+
recording.store(true, std::memory_order_release);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
inline void consumed(std::int64_t timestampUs, int phase, bool touching, int x, int y,
|
|
39
|
+
int pointerId, int handlerX, int handlerY) {
|
|
40
|
+
if (!recording.load(std::memory_order_acquire) || enabled.load(std::memory_order_acquire)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const std::lock_guard<std::mutex> guard(traceMutex);
|
|
44
|
+
if (!recording.load(std::memory_order_relaxed) || enabled.load(std::memory_order_relaxed)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (count < capacity) {
|
|
48
|
+
entries[count++] = {timestampUs, phase, touching ? 1 : 0, x, y, pointerId, handlerX, handlerY};
|
|
49
|
+
} else {
|
|
50
|
+
++dropped;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
inline Snapshot end() {
|
|
55
|
+
const std::lock_guard<std::mutex> guard(traceMutex);
|
|
56
|
+
recording.store(false, std::memory_order_release);
|
|
57
|
+
const Snapshot result{entries, count, dropped};
|
|
58
|
+
entries = nullptr;
|
|
59
|
+
capacity = count = dropped = 0;
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
} // namespace gea::platform::comparison::input
|
|
64
|
+
#endif
|