summaryrefslogtreecommitdiff
path: root/src/common/backend.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-12 15:23:19 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-12 15:23:19 +0300
commit41c25aac6384e6e429a51ace166fffcf219efeca (patch)
treebe57952589cadffdd5b34b2a8cfa17d3462f1d6e /src/common/backend.c
parent4145406fae437dce2f0af6e078e35566634f2c19 (diff)
Unify surface input queue, frame clock, and optimize scaling and timers
Diffstat (limited to 'src/common/backend.c')
-rw-r--r--src/common/backend.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/common/backend.c b/src/common/backend.c
index cab1dce..ccb9c27 100644
--- a/src/common/backend.c
+++ b/src/common/backend.c
@@ -179,6 +179,7 @@ void yasl_surface_destroy(struct yasl_surface *s)
if (!s || !s->display->ops->surface_destroy)
return;
yasl_surface_clear_timers(s);
+ input_queue_clear(&s->input);
s->display->ops->surface_destroy(s);
}
@@ -244,9 +245,11 @@ bool yasl_surface_present(struct yasl_surface *s, const struct yasl_framebuffer
bool yasl_surface_input_poll(struct yasl_surface *s, struct yasl_input_event *ev)
{
- if (!s || !ev || !s->display->ops->surface_input_poll)
- return 0;
- return s->display->ops->surface_input_poll(s, ev);
+ if (!s || !ev)
+ return false;
+ if (s->display && s->display->ops && s->display->ops->surface_input_poll)
+ return s->display->ops->surface_input_poll(s, ev);
+ return input_queue_pop(&s->input, ev);
}
struct yasl_geometry yasl_surface_geometry(const struct yasl_surface *s)
@@ -269,16 +272,28 @@ uint32_t yasl_surface_state(const struct yasl_surface *s)
struct yasl_timing yasl_surface_timing(const struct yasl_surface *s)
{
- if (!s || !s->display->ops->surface_timing)
+ if (!s)
return (struct yasl_timing){0};
- return s->display->ops->surface_timing(s);
+ if (s->display && s->display->ops && s->display->ops->surface_timing)
+ return s->display->ops->surface_timing(s);
+ struct yasl_timing t = {
+ .refresh_ns = s->clock.refresh_ns,
+ .last_present_ns = s->clock.last_present_ns,
+ .next_present_ns = yasl_clock_next_present_ns(&s->clock),
+ .frames_skipped = s->frames_skipped,
+ .source = s->clock.source,
+ };
+ yasl_clock_resize_stats(&s->clock, &t.resize);
+ return t;
}
uint64_t yasl_surface_frame_time_ns(struct yasl_surface *s, uint64_t now)
{
- if (!s || !s->display->ops->surface_frame_time_ns)
+ if (!s)
return 0;
- return s->display->ops->surface_frame_time_ns(s, now);
+ if (s->display && s->display->ops && s->display->ops->surface_frame_time_ns)
+ return s->display->ops->surface_frame_time_ns(s, now);
+ return yasl_clock_frame_timestamp_ns(&s->clock, now);
}
void yasl_surface_set_cursor(struct yasl_surface *s, enum yasl_cursor cursor)