diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 23:41:31 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 23:41:31 +0300 |
| commit | 76073fe5fad8799e5850805f2f090af2cb62c741 (patch) | |
| tree | 9658019babe4760a3634bdab4da0731a10e42e68 /src/common/timing.c | |
| parent | dd1775a9927922c14f8679ccbc4d3ca8d5917e20 (diff) | |
Simplify the public event and CPU API
Applications now need far less ceremony: hello.c is a 20-line loop that
handles REFRESH, CLOSE and QUIT and draws into the surface's own pixels.
- Fold GEOMETRY, STATE and FOCUS into one WINDOW event carrying size,
scale and state; unchanged values send nothing.
- Guarantee REFRESH once a window has a size and after every resize,
never at size zero.
- Merge DROP_HOVER into DROP with over/leave/data actions and give drag
and drop actions enums.
- Keep event strings valid until the next wait and drop
yasl_event_release; empty or failed waits report NONE.
- Replace copy-in presentation with a lent pixel buffer:
yasl_cpu_pixels and yasl_cpu_present.
- Remove yasl_poll_event, yasl_cpu_read_pixels, unused event fields and
comments that restated names.
- Wayland: resize floating windows in request_size instead of reporting
it unsupported, and stop marking new GPU surfaces as Vulkan so
yasl_vulkan_create_surface no longer fails with NATIVE_WINDOW_IN_USE.
Also includes the in-progress public API refactor that was uncommitted
in the tree (removal of the app/loop layer, new surface, GL and Vulkan
entry points).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/common/timing.c')
| -rw-r--r-- | src/common/timing.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/timing.c b/src/common/timing.c index 7a91327..69c25cf 100644 --- a/src/common/timing.c +++ b/src/common/timing.c @@ -1,6 +1,6 @@ #include "timing.h" -uint64_t yasl_clock_extend_ms(uint32_t ms, uint64_t now_ns) +uint64_t yasl_private_clock_extend_ms(uint32_t ms, uint64_t now_ns) { uint64_t now_ms = now_ns / 1000000; int64_t ahead = (int32_t)(ms - (uint32_t)now_ms); @@ -9,7 +9,7 @@ uint64_t yasl_clock_extend_ms(uint32_t ms, uint64_t now_ns) return (uint64_t)((int64_t)now_ms + ahead) * 1000000ull; } -void yasl_clock_presented(struct yasl_frame_clock *c, uint64_t now, bool sample) +void yasl_private_clock_presented(struct yasl_private_frame_clock *c, uint64_t now, bool sample) { if (c->last_present_ns) { double dt = (double)(now - c->last_present_ns); @@ -17,10 +17,10 @@ void yasl_clock_presented(struct yasl_frame_clock *c, uint64_t now, bool sample) c->refresh_ns += 0.125 * (dt - c->refresh_ns); } c->last_present_ns = now; - c->source = YASL_TIMING_SUBMISSION; + c->source = YASL_PRIVATE_TIMING_SUBMISSION; } -void yasl_clock_note_resize(struct yasl_frame_clock *c, uint64_t dt_ns) +void yasl_private_clock_note_resize(struct yasl_private_frame_clock *c, uint64_t dt_ns) { c->resize_count++; c->resize_sum_ns += dt_ns; @@ -28,8 +28,8 @@ void yasl_clock_note_resize(struct yasl_frame_clock *c, uint64_t dt_ns) c->resize_max_ns = dt_ns; } -void yasl_clock_resize_stats(const struct yasl_frame_clock *c, - struct yasl_resize_stats *out) +void yasl_private_clock_resize_stats(const struct yasl_private_frame_clock *c, + struct yasl_private_resize_stats *out) { out->count = c->resize_count; out->avg_us = c->resize_count @@ -39,13 +39,13 @@ void yasl_clock_resize_stats(const struct yasl_frame_clock *c, out->minflt = c->resize_minflt; } -uint64_t yasl_clock_next_present_ns(const struct yasl_frame_clock *c) +uint64_t yasl_private_clock_next_present_ns(const struct yasl_private_frame_clock *c) { uint64_t next = c->last_present_ns + (uint64_t)c->refresh_ns; return (uint64_t)-(c->last_present_ns != 0) & next; } -uint64_t yasl_clock_frame_timestamp_ns(struct yasl_frame_clock *c, uint64_t now) +uint64_t yasl_private_clock_frame_timestamp_ns(struct yasl_private_frame_clock *c, uint64_t now) { if (!c->last_present_ns || c->refresh_ns <= 0.0) { c->frame_time_ns = now; |
