mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01b45d0f08 | ||
|
|
0a7d0929b7 | ||
|
|
6dc3d01674 | ||
|
|
df2cfa40b3 |
No files matched your search
@@ -242,6 +242,10 @@ struct surface {
|
||||
enum surface_role role;
|
||||
struct wl_resource *idle_buffer;
|
||||
struct wl_listener idle_buffer_destroy;
|
||||
struct surface_state *waiting;
|
||||
struct wl_event_source *waiting_source, *waiting_timer;
|
||||
int waiting_fd;
|
||||
int64_t waiting_since_ns;
|
||||
uint32_t *idle_px;
|
||||
int idle_w, idle_h;
|
||||
struct wl_resource *xdg_surface, *xdg_toplevel;
|
||||
@@ -373,6 +377,8 @@ static struct {
|
||||
unsigned copy_scenes;
|
||||
unsigned releases, releases_held;
|
||||
int64_t release_ns, release_max_ns;
|
||||
unsigned commit_waits, commit_wait_limits;
|
||||
int64_t commit_wait_ns, commit_wait_max_ns;
|
||||
} g_perf;
|
||||
|
||||
static void schedule_render(void);
|
||||
@@ -846,6 +852,55 @@ static void on_pending_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
s->pending_buffer = NULL;
|
||||
}
|
||||
|
||||
struct surface_state {
|
||||
struct wl_resource *buffer;
|
||||
struct wl_listener buffer_destroy;
|
||||
int attach;
|
||||
int src_set, dst_set, opaque_set;
|
||||
float src[4];
|
||||
int dst[2], opaque[4];
|
||||
struct damage_list damage_buf, damage_local;
|
||||
struct wl_list frames, feedback;
|
||||
};
|
||||
|
||||
static void on_state_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
struct surface_state *st = wl_container_of(l, st, buffer_destroy);
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
st->buffer = NULL;
|
||||
st->attach = 0;
|
||||
}
|
||||
|
||||
static void surface_state_take(struct surface *s, struct surface_state *st) {
|
||||
st->attach = s->pending_attach;
|
||||
st->buffer = s->pending_buffer;
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
if (st->buffer) {
|
||||
wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
st->buffer_destroy.notify = on_state_buffer_destroyed;
|
||||
wl_resource_add_destroy_listener(st->buffer, &st->buffer_destroy);
|
||||
}
|
||||
s->pending_buffer = NULL;
|
||||
s->pending_attach = 0;
|
||||
st->src_set = s->pending_src_set;
|
||||
memcpy(st->src, s->pending_src, sizeof(st->src));
|
||||
st->dst_set = s->pending_dst_set;
|
||||
memcpy(st->dst, s->pending_dst, sizeof(st->dst));
|
||||
st->opaque_set = s->pending_opaque_set;
|
||||
memcpy(st->opaque, s->pending_opaque, sizeof(st->opaque));
|
||||
s->pending_src_set = s->pending_dst_set = s->pending_opaque_set = 0;
|
||||
st->damage_buf = s->pending_damage_buf;
|
||||
st->damage_local = s->pending_damage_local;
|
||||
s->pending_damage_buf.n = s->pending_damage_local.n = 0;
|
||||
wl_list_init(&st->frames);
|
||||
wl_list_insert_list(&st->frames, &s->pending_frames);
|
||||
wl_list_init(&s->pending_frames);
|
||||
wl_list_init(&st->feedback);
|
||||
wl_list_insert_list(&st->feedback, &s->pending_feedback);
|
||||
wl_list_init(&s->pending_feedback);
|
||||
}
|
||||
|
||||
static void fire_frames(struct wl_list *frames) {
|
||||
struct wl_resource *cb, *tmp;
|
||||
uint32_t t;
|
||||
@@ -1363,35 +1418,23 @@ static void surface_drop_idle(struct surface *s) {
|
||||
if (buffer) send_buffer_release(buffer);
|
||||
}
|
||||
|
||||
static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
struct surface *s = wl_resource_get_user_data(r);
|
||||
static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
struct surface *child;
|
||||
|
||||
if (s->xdg_toplevel && !s->toplevel_committed) {
|
||||
s->toplevel_committed = 1;
|
||||
send_toplevel_configure(s);
|
||||
if (st->src_set) {
|
||||
s->src_set = st->src[2] > 0;
|
||||
memcpy(s->src, st->src, sizeof(s->src));
|
||||
}
|
||||
if (st->dst_set) {
|
||||
s->dst_set = st->dst[0] > 0;
|
||||
memcpy(s->dst, st->dst, sizeof(s->dst));
|
||||
}
|
||||
if (st->opaque_set) memcpy(s->opaque, st->opaque, sizeof(s->opaque));
|
||||
|
||||
if (s->pending_src_set) {
|
||||
s->src_set = s->pending_src[2] > 0;
|
||||
memcpy(s->src, s->pending_src, sizeof(s->src));
|
||||
s->pending_src_set = 0;
|
||||
}
|
||||
if (s->pending_dst_set) {
|
||||
s->dst_set = s->pending_dst[0] > 0;
|
||||
memcpy(s->dst, s->pending_dst, sizeof(s->dst));
|
||||
s->pending_dst_set = 0;
|
||||
}
|
||||
if (s->pending_opaque_set) {
|
||||
memcpy(s->opaque, s->pending_opaque, sizeof(s->opaque));
|
||||
s->pending_opaque_set = 0;
|
||||
}
|
||||
|
||||
s->damage_buf = s->pending_damage_buf;
|
||||
s->damage_local = s->pending_damage_local;
|
||||
s->pending_damage_buf.n = s->pending_damage_local.n = 0;
|
||||
if (s->pending_attach) {
|
||||
struct wl_resource *buffer = s->pending_buffer;
|
||||
s->damage_buf = st->damage_buf;
|
||||
s->damage_local = st->damage_local;
|
||||
if (st->attach) {
|
||||
struct wl_resource *buffer = st->buffer;
|
||||
struct dmabuf_buffer *db = get_dmabuf(buffer);
|
||||
struct wl_shm_buffer *shm = buffer && !db ? wl_shm_buffer_get(buffer) : NULL;
|
||||
uint8_t pixel[4];
|
||||
@@ -1400,12 +1443,10 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
if (!buffer) g_pace.null_attaches++;
|
||||
else if (!db) s->last_dmabuf = NULL;
|
||||
|
||||
if (buffer) {
|
||||
wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
}
|
||||
s->pending_buffer = NULL;
|
||||
s->pending_attach = 0;
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
st->buffer = NULL;
|
||||
st->attach = 0;
|
||||
|
||||
surface_drop_idle(s);
|
||||
buf_trace_attach(buffer);
|
||||
@@ -1442,10 +1483,10 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
}
|
||||
}
|
||||
|
||||
wl_list_insert_list(s->frames.prev, &s->pending_frames);
|
||||
wl_list_init(&s->pending_frames);
|
||||
wl_list_insert_list(s->feedback.prev, &s->pending_feedback);
|
||||
wl_list_init(&s->pending_feedback);
|
||||
wl_list_insert_list(s->frames.prev, &st->frames);
|
||||
wl_list_init(&st->frames);
|
||||
wl_list_insert_list(s->feedback.prev, &st->feedback);
|
||||
wl_list_init(&st->feedback);
|
||||
constraints_surface_commit(s);
|
||||
droiddeck_color_commit(s->resource);
|
||||
|
||||
@@ -1455,6 +1496,186 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
}
|
||||
schedule_render();
|
||||
}
|
||||
|
||||
#define COMMIT_WAIT_LIMIT_MS 1000
|
||||
|
||||
static struct surface *g_zero_copy_shown, *g_unwaited;
|
||||
|
||||
static int state_unfinished_fd(const struct surface *s, const struct surface_state *st, int *unwaited) {
|
||||
struct dmabuf_buffer *db = st->attach ? get_dmabuf(st->buffer) : NULL;
|
||||
int fd = -1;
|
||||
*unwaited = 0;
|
||||
for (int i = 0; db && fd < 0 && i < db->n_planes; i++) {
|
||||
if (db->fd[i] < 0) continue;
|
||||
struct pollfd p = {.fd = db->fd[i], .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 0); } while (r < 0 && errno == EINTR);
|
||||
if (r == 0) fd = db->fd[i];
|
||||
}
|
||||
if (fd >= 0 && s == g_zero_copy_shown && ahb_swapchain_has_ahb(db)) {
|
||||
*unwaited = 1;
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void settle_unwaited(void) {
|
||||
struct surface *s = g_unwaited;
|
||||
if (!s) return;
|
||||
g_unwaited = NULL;
|
||||
struct dmabuf_buffer *db = s->dmabuf_buf;
|
||||
const int64_t deadline = now_ns() + 100000000LL;
|
||||
for (int i = 0; db && i < db->n_planes; i++) {
|
||||
if (db->fd[i] < 0) continue;
|
||||
struct pollfd p = {.fd = db->fd[i], .events = POLLIN};
|
||||
for (;;) {
|
||||
const int64_t left = deadline - now_ns();
|
||||
const int r = poll(&p, 1, left > 0 ? (int)((left + 999999) / 1000000) : 0);
|
||||
if (r >= 0 || errno != EINTR || left <= 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void surface_state_discard(struct surface_state *st) {
|
||||
struct wl_resource *cb, *tmp;
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_resource_for_each_safe(cb, tmp, &st->frames) wl_resource_destroy(cb);
|
||||
feedback_discard_all(&st->feedback);
|
||||
free(st);
|
||||
}
|
||||
|
||||
static void surface_state_merge(struct surface_state *older, struct surface_state *newer) {
|
||||
if (older->attach && !newer->attach) {
|
||||
newer->attach = 1;
|
||||
newer->buffer = older->buffer;
|
||||
wl_list_remove(&older->buffer_destroy.link);
|
||||
wl_list_init(&older->buffer_destroy.link);
|
||||
if (newer->buffer) {
|
||||
newer->buffer_destroy.notify = on_state_buffer_destroyed;
|
||||
wl_resource_add_destroy_listener(newer->buffer, &newer->buffer_destroy);
|
||||
}
|
||||
wl_list_insert_list(&newer->feedback, &older->feedback);
|
||||
wl_list_init(&older->feedback);
|
||||
} else if (older->attach) {
|
||||
if (older->buffer && older->buffer != newer->buffer) send_buffer_release(older->buffer);
|
||||
g_pace.replaced += feedback_discard_all(&older->feedback);
|
||||
}
|
||||
if (older->src_set && !newer->src_set) {
|
||||
newer->src_set = 1;
|
||||
memcpy(newer->src, older->src, sizeof(newer->src));
|
||||
}
|
||||
if (older->dst_set && !newer->dst_set) {
|
||||
newer->dst_set = 1;
|
||||
memcpy(newer->dst, older->dst, sizeof(newer->dst));
|
||||
}
|
||||
if (older->opaque_set && !newer->opaque_set) {
|
||||
newer->opaque_set = 1;
|
||||
memcpy(newer->opaque, older->opaque, sizeof(newer->opaque));
|
||||
}
|
||||
for (int i = 0; i < older->damage_buf.n; i++)
|
||||
note_damage(&newer->damage_buf, older->damage_buf.r[i][0], older->damage_buf.r[i][1],
|
||||
older->damage_buf.r[i][2], older->damage_buf.r[i][3]);
|
||||
for (int i = 0; i < older->damage_local.n; i++)
|
||||
note_damage(&newer->damage_local, older->damage_local.r[i][0], older->damage_local.r[i][1],
|
||||
older->damage_local.r[i][2], older->damage_local.r[i][3]);
|
||||
wl_list_insert_list(&newer->frames, &older->frames);
|
||||
wl_list_init(&older->frames);
|
||||
surface_state_discard(older);
|
||||
}
|
||||
|
||||
static void surface_wait_stop(struct surface *s) {
|
||||
if (s->waiting_source) wl_event_source_remove(s->waiting_source);
|
||||
if (s->waiting_timer) wl_event_source_remove(s->waiting_timer);
|
||||
if (s->waiting_fd >= 0) close(s->waiting_fd);
|
||||
s->waiting_source = s->waiting_timer = NULL;
|
||||
s->waiting_fd = -1;
|
||||
}
|
||||
|
||||
static void surface_wait_end(struct surface *s, int over_limit) {
|
||||
struct surface_state *st = s->waiting;
|
||||
if (!st) return;
|
||||
surface_wait_stop(s);
|
||||
s->waiting = NULL;
|
||||
const int64_t waited = now_ns() - s->waiting_since_ns;
|
||||
g_perf.commit_waits++;
|
||||
g_perf.commit_wait_ns += waited;
|
||||
if (waited > g_perf.commit_wait_max_ns) g_perf.commit_wait_max_ns = waited;
|
||||
if (over_limit) g_perf.commit_wait_limits++;
|
||||
if (st->attach && g_unwaited == s) g_unwaited = NULL;
|
||||
surface_state_apply(s, st);
|
||||
free(st);
|
||||
}
|
||||
|
||||
static int on_commit_ready(int fd, uint32_t mask, void *data) {
|
||||
surface_wait_end(data, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int on_commit_wait_limit(void *data) {
|
||||
static int said;
|
||||
if (!said) {
|
||||
said = 1;
|
||||
droiddeck_log("compositor", "a client's GPU writes ran past %d ms; its frame is shown as it is", COMMIT_WAIT_LIMIT_MS);
|
||||
}
|
||||
surface_wait_end(data, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int surface_wait_start(struct surface *s, int fd, int timeout_ms) {
|
||||
struct wl_event_loop *loop = wl_display_get_event_loop(g_display);
|
||||
s->waiting_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
||||
if (s->waiting_fd >= 0) {
|
||||
s->waiting_source = wl_event_loop_add_fd(loop, s->waiting_fd, WL_EVENT_READABLE, on_commit_ready, s);
|
||||
s->waiting_timer = wl_event_loop_add_timer(loop, on_commit_wait_limit, s);
|
||||
}
|
||||
if (!s->waiting_source || !s->waiting_timer ||
|
||||
wl_event_source_timer_update(s->waiting_timer, timeout_ms) != 0) {
|
||||
surface_wait_stop(s);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
struct surface *s = wl_resource_get_user_data(r);
|
||||
|
||||
if (s->xdg_toplevel && !s->toplevel_committed) {
|
||||
s->toplevel_committed = 1;
|
||||
send_toplevel_configure(s);
|
||||
}
|
||||
struct surface_state *st = calloc(1, sizeof(*st));
|
||||
if (!st) {
|
||||
struct surface_state now;
|
||||
surface_state_take(s, &now);
|
||||
surface_state_apply(s, &now);
|
||||
return;
|
||||
}
|
||||
surface_state_take(s, st);
|
||||
const int was_waiting = s->waiting != NULL;
|
||||
if (was_waiting) {
|
||||
surface_wait_stop(s);
|
||||
surface_state_merge(s->waiting, st);
|
||||
s->waiting = NULL;
|
||||
}
|
||||
int unwaited;
|
||||
const int fd = state_unfinished_fd(s, st, &unwaited);
|
||||
if (!was_waiting) s->waiting_since_ns = now_ns();
|
||||
const int64_t left_ms = COMMIT_WAIT_LIMIT_MS - (now_ns() - s->waiting_since_ns) / 1000000;
|
||||
if (fd >= 0 && left_ms > 0 && surface_wait_start(s, fd, (int)left_ms) == 0) {
|
||||
s->waiting = st;
|
||||
return;
|
||||
}
|
||||
const int attaches = st->attach;
|
||||
if (was_waiting) {
|
||||
s->waiting = st;
|
||||
surface_wait_end(s, fd >= 0 && left_ms <= 0);
|
||||
} else {
|
||||
surface_state_apply(s, st);
|
||||
free(st);
|
||||
}
|
||||
if (unwaited) g_unwaited = s;
|
||||
else if (attaches && g_unwaited == s) g_unwaited = NULL;
|
||||
}
|
||||
static void surface_set_buffer_transform(struct wl_client *c, struct wl_resource *r, int32_t t) {}
|
||||
static void surface_set_buffer_scale(struct wl_client *c, struct wl_resource *r, int32_t s) {}
|
||||
static void surface_damage_buffer(struct wl_client *c, struct wl_resource *r,
|
||||
@@ -1516,6 +1737,13 @@ static void surface_resource_destroy(struct wl_resource *r) {
|
||||
child->parent = NULL;
|
||||
}
|
||||
if (s->pending_buffer) wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
if (s->waiting) {
|
||||
surface_wait_stop(s);
|
||||
surface_state_discard(s->waiting);
|
||||
s->waiting = NULL;
|
||||
}
|
||||
if (g_zero_copy_shown == s) g_zero_copy_shown = NULL;
|
||||
if (g_unwaited == s) g_unwaited = NULL;
|
||||
pending_releases_forget_surface(s);
|
||||
drop_dmabuf(s, 0);
|
||||
ahb_swapchain_surface_gone(s);
|
||||
@@ -1579,6 +1807,7 @@ static void compositor_create_surface(struct wl_client *c, struct wl_resource *r
|
||||
wl_list_init(&s->child_link);
|
||||
wl_list_init(&s->toplevel_link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
s->waiting_fd = -1;
|
||||
wl_list_init(&s->idle_buffer_destroy.link);
|
||||
wl_list_insert(&g_surfaces, &s->link);
|
||||
wl_resource_set_implementation(s->resource, &surface_impl, s, surface_resource_destroy);
|
||||
@@ -2502,7 +2731,13 @@ static int64_t scene_next_due(int64_t now, int64_t due, int limit) {
|
||||
|
||||
static void render_scene(void) {
|
||||
g_scene_due_ns = scene_next_due(now_ns(), g_scene_due_ns, g_fps_limit);
|
||||
if (atomic_load(&g_stream_on)) { g_dirty_since_ns = 0; render_stream(); return; }
|
||||
if (atomic_load(&g_stream_on)) {
|
||||
g_dirty_since_ns = 0;
|
||||
g_zero_copy_shown = NULL;
|
||||
settle_unwaited();
|
||||
render_stream();
|
||||
return;
|
||||
}
|
||||
struct draw_list dl = {0};
|
||||
struct surface *s;
|
||||
int w, h;
|
||||
@@ -2576,6 +2811,8 @@ static void render_scene(void) {
|
||||
} else {
|
||||
cursor_hdr_said = 0;
|
||||
}
|
||||
g_zero_copy_shown = NULL;
|
||||
if (hdr_route == 1 || hdr_route == 2) settle_unwaited();
|
||||
if (hdr_route == 1) {
|
||||
static int fell_back;
|
||||
vkp_apply_window_request();
|
||||
@@ -2609,6 +2846,7 @@ static void render_scene(void) {
|
||||
}
|
||||
if (hdr_route == 0 && vkp_quest_layer_presentation() && !framegen && !cardboard && !cursor_on &&
|
||||
!ahb_only) {
|
||||
settle_unwaited();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
} else if (hdr_route == 0 || hdr_route == 3) {
|
||||
const int pass_on = fx_on || framegen;
|
||||
@@ -2658,6 +2896,7 @@ static void render_scene(void) {
|
||||
vkp_apply_window_request();
|
||||
int r = -1;
|
||||
const int fg_pass = framegen && fx_on && li >= 0;
|
||||
if (framegen && li >= 0) settle_unwaited();
|
||||
const int generated = (framegen && li >= 0)
|
||||
? sc_layer_present_generated(&dl.d[li], 1, NULL, w, h, fg_pass,
|
||||
ls ? droiddeck_surface_color(ls) : NULL) : 0;
|
||||
@@ -2671,6 +2910,8 @@ static void render_scene(void) {
|
||||
r = generated >= 0 ? 0 : -1;
|
||||
else if (generated >= 0 && !(fx_on && li >= 0) && ls && ls->dmabuf_buf && ahb_swapchain_has_ahb(ls->dmabuf_buf))
|
||||
r = ahb_swapchain_present(ls->dmabuf_buf, ls, w, h, ld);
|
||||
if (r == 0 && !fg_pass) g_zero_copy_shown = ls;
|
||||
else settle_unwaited();
|
||||
if (!fg_pass && generated >= 0 && r != 0 && li >= 0)
|
||||
r = fx_on ? sc_layer_present_pass(&dl.d[li], 1, w, h)
|
||||
: sc_layer_present(dl.d[li].img, w, h, ld, ls ? droiddeck_surface_color(ls) : NULL);
|
||||
@@ -2681,6 +2922,7 @@ static void render_scene(void) {
|
||||
ov = sc_layer_present_overlay(dl.d[li + 1].img, go, dl.d[li + 1].blend) == 0 ? 1 : -1;
|
||||
if (ov <= 0) sc_layer_hide_overlay();
|
||||
if (ov < 0) {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
@@ -2690,12 +2932,14 @@ static void render_scene(void) {
|
||||
g_scene_queues = sc_layer_queues();
|
||||
}
|
||||
} else {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
hdr_copy = "its display layer was unavailable this frame";
|
||||
}
|
||||
} else {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
@@ -4344,11 +4588,12 @@ static int on_stats_timer(void *data) {
|
||||
unsigned aimed_next, aimed_later, aimed_even;
|
||||
sc_layer_aim_take(&aimed_next, &aimed_later, &aimed_even);
|
||||
#define PERF_MS(sum, n) ((n) ? (double)(sum) / 1e6 / (double)(n) : 0.0)
|
||||
if (g_perf.scenes || vp.presents || g_perf.releases || drops)
|
||||
if (g_perf.scenes || vp.presents || g_perf.releases || drops || g_perf.commit_waits)
|
||||
droiddeck_log("perf", "last 10 s: %u ticks, %u scenes, %u on screen (copy %u, zero-copy %u, layer copy %u) | "
|
||||
"render_scene %.2f/%.2f ms | base %u black kept, %u presented | acquire %.2f/%.2f ms | "
|
||||
"present %.2f/%.2f ms (%u) | fence wait %.2f/%.2f ms (%u, %u GPU release waits) | "
|
||||
"release %.2f/%.2f ms (%u, %u held) | %u pool drops | layer frames timed for the next refresh %u, "
|
||||
"release %.2f/%.2f ms (%u, %u held) | commits held for client writes %.2f/%.2f ms (%u, %u past the limit) | "
|
||||
"%u pool drops | layer frames timed for the next refresh %u, "
|
||||
"the one after %u, held to an even step %u",
|
||||
g_perf.ticks, g_perf.scenes, g_stat_frames, g_perf.copy_scenes, zero_copy, layer_frames,
|
||||
PERF_MS(g_perf.scene_ns, g_perf.scenes), (double)g_perf.scene_max_ns / 1e6,
|
||||
@@ -4357,7 +4602,9 @@ static int on_stats_timer(void *data) {
|
||||
PERF_MS(vp.present_ns, vp.presents), (double)vp.present_max_ns / 1e6, vp.presents,
|
||||
PERF_MS(vp.wait_ns, vp.waits), (double)vp.wait_max_ns / 1e6, vp.waits, vp.gpu_release_waits,
|
||||
PERF_MS(g_perf.release_ns, g_perf.releases), (double)g_perf.release_max_ns / 1e6,
|
||||
g_perf.releases, g_perf.releases_held, drops, aimed_next, aimed_later, aimed_even);
|
||||
g_perf.releases, g_perf.releases_held,
|
||||
PERF_MS(g_perf.commit_wait_ns, g_perf.commit_waits), (double)g_perf.commit_wait_max_ns / 1e6,
|
||||
g_perf.commit_waits, g_perf.commit_wait_limits, drops, aimed_next, aimed_later, aimed_even);
|
||||
#undef PERF_MS
|
||||
memset(&g_perf, 0, sizeof(g_perf));
|
||||
}
|
||||
|
||||
@@ -212,6 +212,7 @@ object BattleNetInstall {
|
||||
reason == null -> "exit $code"
|
||||
reason == "client" -> return context.getString(R.string.bnet_dl_client_first)
|
||||
reason == STALLED -> return context.getString(R.string.bnet_dl_stalled)
|
||||
reason == "agent 703" || reason?.contains("(error 703)") == true -> return context.getString(R.string.bnet_dl_folder_access)
|
||||
reason.startsWith("agent ") -> context.getString(R.string.bnet_dl_agent_error, reason.removePrefix("agent "))
|
||||
else -> reason.removePrefix("stopped ")
|
||||
}
|
||||
|
||||
@@ -2658,6 +2658,7 @@
|
||||
<string name="bnet_dl_failed">توقفت أداة التنزيل من Blizzard: %1$s</string>
|
||||
<string name="bnet_dl_stalled">توقفت أداة التنزيل من Blizzard عن التقدم.</string>
|
||||
<string name="bnet_dl_agent_error">خطأ Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">تعذر على Blizzard الوصول إلى مجلد اللعبة (خطأ 703). تحقّق من أذوناته أو اختر مجلدًا مختلفًا.</string>
|
||||
<string name="bnet_update">تحديث</string>
|
||||
<string name="bnet_store">ألعاب Blizzard</string>
|
||||
<string name="stores_resume_install">استئناف التثبيت</string>
|
||||
|
||||
@@ -2650,6 +2650,7 @@
|
||||
<string name="bnet_dl_failed">El descargador de Blizzard se detuvo: %1$s</string>
|
||||
<string name="bnet_dl_stalled">El descargador de Blizzard dejó de avanzar.</string>
|
||||
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard no pudo acceder a la carpeta del juego (error 703). Verifica sus permisos o elige otra carpeta.</string>
|
||||
<string name="bnet_update">Actualizar</string>
|
||||
<string name="bnet_store">Juegos de Blizzard</string>
|
||||
<string name="stores_resume_install">Reanudar instalación</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Програмата за изтегляне на Blizzard спря: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Програмата за изтегляне на Blizzard спря да напредва.</string>
|
||||
<string name="bnet_dl_agent_error">Грешка на Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не успя да получи достъп до папката на играта (грешка 703). Проверете разрешенията ѝ или изберете друга папка.</string>
|
||||
<string name="bnet_update">Актуализиране</string>
|
||||
<string name="bnet_store">Игри на Blizzard</string>
|
||||
<string name="stores_resume_install">Продължи инсталацията</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">Stahovač Blizzardu se zastavil: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Stahovač Blizzardu přestal postupovat.</string>
|
||||
<string name="bnet_dl_agent_error">Chyba Blizzardu %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nemohl získat přístup ke složce hry (chyba 703). Zkontrolujte její oprávnění nebo vyberte jinou složku.</string>
|
||||
<string name="bnet_update">Aktualizovat</string>
|
||||
<string name="bnet_store">Hry od Blizzardu</string>
|
||||
<string name="stores_resume_install">Pokračovat v instalaci</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards downloader stoppede: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards downloader holdt op med at gøre fremskridt.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fejl %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kunne ikke få adgang til spilmappen (fejl 703). Kontrollér dens tilladelser, eller vælg en anden mappe.</string>
|
||||
<string name="bnet_update">Opdater</string>
|
||||
<string name="bnet_store">Blizzard-spil</string>
|
||||
<string name="stores_resume_install">Genoptag installation</string>
|
||||
|
||||
@@ -2546,6 +2546,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards Downloader wurde beendet: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards Downloader kommt nicht mehr voran.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-Fehler %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard konnte nicht auf den Spielordner zugreifen (Fehler 703). Prüfe die Berechtigungen oder wähle einen anderen Ordner.</string>
|
||||
<string name="bnet_update">Aktualisieren</string>
|
||||
<string name="bnet_store">Blizzard-Spiele</string>
|
||||
<string name="stores_resume_install">Installation fortsetzen</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Το πρόγραμμα λήψης της Blizzard σταμάτησε: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Το πρόγραμμα λήψης της Blizzard σταμάτησε να προχωρά.</string>
|
||||
<string name="bnet_dl_agent_error">Σφάλμα Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Το Blizzard δεν μπόρεσε να αποκτήσει πρόσβαση στον φάκελο του παιχνιδιού (σφάλμα 703). Ελέγξτε τα δικαιώματά του ή επιλέξτε διαφορετικό φάκελο.</string>
|
||||
<string name="bnet_update">Ενημέρωση</string>
|
||||
<string name="bnet_store">Παιχνίδια της Blizzard</string>
|
||||
<string name="stores_resume_install">Συνέχιση εγκατάστασης</string>
|
||||
|
||||
@@ -2580,6 +2580,7 @@
|
||||
<string name="bnet_dl_failed">El descargador de Blizzard se ha detenido: %1$s</string>
|
||||
<string name="bnet_dl_stalled">El descargador de Blizzard ha dejado de avanzar.</string>
|
||||
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard no pudo acceder a la carpeta del juego (error 703). Comprueba sus permisos o elige otra carpeta.</string>
|
||||
<string name="bnet_update">Actualizar</string>
|
||||
<string name="bnet_store">Juegos de Blizzard</string>
|
||||
<string name="stores_resume_install">Reanudar instalación</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzardin latausohjelma pysähtyi: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzardin latausohjelma lakkasi etenemästä.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-virhe %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard ei voinut käyttää pelikansiota (virhe 703). Tarkista sen käyttöoikeudet tai valitse toinen kansio.</string>
|
||||
<string name="bnet_update">Päivitä</string>
|
||||
<string name="bnet_store">Blizzardin pelit</string>
|
||||
<string name="stores_resume_install">Jatka asennusta</string>
|
||||
|
||||
@@ -2579,6 +2579,7 @@
|
||||
<string name="bnet_dl_failed">Le téléchargeur de Blizzard s\'est arrêté : %1$s</string>
|
||||
<string name="bnet_dl_stalled">Le téléchargeur de Blizzard n\'avance plus.</string>
|
||||
<string name="bnet_dl_agent_error">Erreur Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard n’a pas pu accéder au dossier du jeu (erreur 703). Vérifiez ses autorisations ou choisissez un autre dossier.</string>
|
||||
<string name="bnet_update">Mettre à jour</string>
|
||||
<string name="bnet_store">Jeux Blizzard</string>
|
||||
<string name="stores_resume_install">Reprendre l\'installation</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard का डाउनलोडर रुक गया: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard का डाउनलोडर आगे नहीं बढ़ रहा।</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard त्रुटि %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard गेम फ़ोल्डर तक नहीं पहुँच सका (त्रुटि 703)। इसकी अनुमतियाँ जाँचें या कोई दूसरा फ़ोल्डर चुनें।</string>
|
||||
<string name="bnet_update">अपडेट करें</string>
|
||||
<string name="bnet_store">Blizzard के गेम</string>
|
||||
<string name="stores_resume_install">इंस्टॉल फिर से शुरू करें</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">A Blizzard letöltője leállt: %1$s</string>
|
||||
<string name="bnet_dl_stalled">A Blizzard letöltője nem halad tovább.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-hiba: %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard nem tudott hozzáférni a játékmappához (703-as hiba). Ellenőrizd a jogosultságait, vagy válassz másik mappát.</string>
|
||||
<string name="bnet_update">Frissítés</string>
|
||||
<string name="bnet_store">Blizzard-játékok</string>
|
||||
<string name="stores_resume_install">Telepítés folytatása</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Pengunduh Blizzard berhenti: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Pengunduh Blizzard berhenti berjalan.</string>
|
||||
<string name="bnet_dl_agent_error">Kesalahan Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard tidak dapat mengakses folder game (kesalahan 703). Periksa izinnya atau pilih folder lain.</string>
|
||||
<string name="bnet_update">Perbarui</string>
|
||||
<string name="bnet_store">Game Blizzard</string>
|
||||
<string name="stores_resume_install">Lanjutkan instalasi</string>
|
||||
|
||||
@@ -2571,6 +2571,7 @@
|
||||
<string name="bnet_dl_failed">Il downloader di Blizzard si è fermato: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Il downloader di Blizzard ha smesso di avanzare.</string>
|
||||
<string name="bnet_dl_agent_error">Errore Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard non è riuscito ad accedere alla cartella del gioco (errore 703). Controlla i permessi o scegli un\'altra cartella.</string>
|
||||
<string name="bnet_update">Aggiorna</string>
|
||||
<string name="bnet_store">Giochi Blizzard</string>
|
||||
<string name="stores_resume_install">Riprendi installazione</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard のダウンローダーが停止しました: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard のダウンローダーが進まなくなりました。</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard エラー %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard はゲームフォルダーにアクセスできませんでした(エラー 703)。権限を確認するか、別のフォルダーを選択してください。</string>
|
||||
<string name="bnet_update">アップデート</string>
|
||||
<string name="bnet_store">Blizzard のゲーム</string>
|
||||
<string name="stores_resume_install">インストールを再開</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard 다운로더가 중지됨: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard 다운로더가 더 이상 진행되지 않습니다.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard 오류 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard가 게임 폴더에 액세스할 수 없습니다(오류 703). 권한을 확인하거나 다른 폴더를 선택하세요.</string>
|
||||
<string name="bnet_update">업데이트</string>
|
||||
<string name="bnet_store">Blizzard 게임</string>
|
||||
<string name="stores_resume_install">설치 재개</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Pemuat turun Blizzard berhenti: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Pemuat turun Blizzard berhenti bergerak.</string>
|
||||
<string name="bnet_dl_agent_error">Ralat Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard tidak dapat mengakses folder permainan (ralat 703). Semak kebenarannya atau pilih folder lain.</string>
|
||||
<string name="bnet_update">Kemas kini</string>
|
||||
<string name="bnet_store">Permainan Blizzard</string>
|
||||
<string name="stores_resume_install">Sambung pemasangan</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards nedlaster stoppet: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards nedlaster sluttet å gjøre fremgang.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-feil %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard fikk ikke tilgang til spillmappen (feil 703). Sjekk tillatelsene eller velg en annen mappe.</string>
|
||||
<string name="bnet_update">Oppdater</string>
|
||||
<string name="bnet_store">Blizzard-spill</string>
|
||||
<string name="stores_resume_install">Gjenoppta installasjon</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards downloader is gestopt: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards downloader maakt geen voortgang meer.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fout %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kon geen toegang krijgen tot de gamemap (fout 703). Controleer de machtigingen of kies een andere map.</string>
|
||||
<string name="bnet_update">Bijwerken</string>
|
||||
<string name="bnet_store">Blizzard-games</string>
|
||||
<string name="stores_resume_install">Installatie hervatten</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">Program pobierający Blizzarda zatrzymał się: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Program pobierający Blizzarda przestał robić postępy.</string>
|
||||
<string name="bnet_dl_agent_error">Błąd Blizzarda %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nie mógł uzyskać dostępu do folderu gry (błąd 703). Sprawdź jego uprawnienia lub wybierz inny folder.</string>
|
||||
<string name="bnet_update">Aktualizuj</string>
|
||||
<string name="bnet_store">Gry Blizzarda</string>
|
||||
<string name="stores_resume_install">Wznów instalację</string>
|
||||
|
||||
@@ -2586,6 +2586,7 @@
|
||||
<string name="bnet_dl_failed">O programa de transferência da Blizzard parou: %1$s</string>
|
||||
<string name="bnet_dl_stalled">O programa de transferência da Blizzard deixou de avançar.</string>
|
||||
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard não conseguiu aceder à pasta do jogo (erro 703). Verifica as permissões ou escolhe outra pasta.</string>
|
||||
<string name="bnet_update">Atualizar</string>
|
||||
<string name="bnet_store">Jogos da Blizzard</string>
|
||||
<string name="stores_resume_install">Retomar instalação</string>
|
||||
|
||||
@@ -2596,6 +2596,7 @@
|
||||
<string name="bnet_dl_failed">O downloader da Blizzard parou: %1$s</string>
|
||||
<string name="bnet_dl_stalled">O downloader da Blizzard parou de avançar.</string>
|
||||
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard não conseguiu acessar a pasta do jogo (erro 703). Verifique as permissões ou escolha outra pasta.</string>
|
||||
<string name="bnet_update">Atualizar</string>
|
||||
<string name="bnet_store">Jogos da Blizzard</string>
|
||||
<string name="stores_resume_install">Retomar instalação</string>
|
||||
|
||||
@@ -2580,6 +2580,7 @@
|
||||
<string name="bnet_dl_failed">Programul de descărcare Blizzard s-a oprit: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Programul de descărcare Blizzard nu mai avansează.</string>
|
||||
<string name="bnet_dl_agent_error">Eroare Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nu a putut accesa folderul jocului (eroare 703). Verifică permisiunile acestuia sau alege un alt folder.</string>
|
||||
<string name="bnet_update">Actualizează</string>
|
||||
<string name="bnet_store">Jocuri Blizzard</string>
|
||||
<string name="stores_resume_install">Reia instalarea</string>
|
||||
|
||||
@@ -2607,6 +2607,7 @@
|
||||
<string name="bnet_dl_failed">Загрузчик Blizzard остановился: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Загрузчик Blizzard перестал продвигаться.</string>
|
||||
<string name="bnet_dl_agent_error">Ошибка Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не удалось получить доступ к папке игры (ошибка 703). Проверьте права доступа или выберите другую папку.</string>
|
||||
<string name="bnet_update">Обновить</string>
|
||||
<string name="bnet_store">Игры Blizzard</string>
|
||||
<string name="stores_resume_install">Продолжить установку</string>
|
||||
|
||||
@@ -2554,6 +2554,7 @@
|
||||
<string name="bnet_dl_failed">Blizzards nedladdare stoppades: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards nedladdare slutade göra framsteg.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fel %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kunde inte komma åt spelmappen (fel 703). Kontrollera behörigheterna eller välj en annan mapp.</string>
|
||||
<string name="bnet_update">Uppdatera</string>
|
||||
<string name="bnet_store">Blizzard-spel</string>
|
||||
<string name="stores_resume_install">Återuppta installation</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">ตัวดาวน์โหลดของ Blizzard หยุดทำงาน: %1$s</string>
|
||||
<string name="bnet_dl_stalled">ตัวดาวน์โหลดของ Blizzard ไม่คืบหน้า</string>
|
||||
<string name="bnet_dl_agent_error">ข้อผิดพลาดของ Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard ไม่สามารถเข้าถึงโฟลเดอร์เกมได้ (ข้อผิดพลาด 703) ตรวจสอบสิทธิ์หรือเลือกโฟลเดอร์อื่น</string>
|
||||
<string name="bnet_update">อัปเดต</string>
|
||||
<string name="bnet_store">เกมของ Blizzard</string>
|
||||
<string name="stores_resume_install">ดำเนินการติดตั้งต่อ</string>
|
||||
|
||||
@@ -2546,6 +2546,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard indiricisi durdu: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard indiricisi ilerlemeyi durdurdu.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard hatası %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard oyun klasörüne erişemedi (hata 703). İzinlerini kontrol edin veya farklı bir klasör seçin.</string>
|
||||
<string name="bnet_update">Güncelle</string>
|
||||
<string name="bnet_store">Blizzard oyunları</string>
|
||||
<string name="stores_resume_install">Yüklemeyi sürdür</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">Завантажувач Blizzard зупинився: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Завантажувач Blizzard перестав просуватися.</string>
|
||||
<string name="bnet_dl_agent_error">Помилка Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не вдалося отримати доступ до папки гри (помилка 703). Перевірте дозволи або виберіть іншу папку.</string>
|
||||
<string name="bnet_update">Оновити</string>
|
||||
<string name="bnet_store">Ігри Blizzard</string>
|
||||
<string name="stores_resume_install">Продовжити встановлення</string>
|
||||
|
||||
@@ -2529,6 +2529,7 @@
|
||||
<string name="bnet_dl_failed">Trình tải xuống của Blizzard đã dừng: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Trình tải xuống của Blizzard không còn tiến triển.</string>
|
||||
<string name="bnet_dl_agent_error">Lỗi Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard không thể truy cập thư mục trò chơi (lỗi 703). Hãy kiểm tra quyền hoặc chọn một thư mục khác.</string>
|
||||
<string name="bnet_update">Cập nhật</string>
|
||||
<string name="bnet_store">Trò chơi Blizzard</string>
|
||||
<string name="stores_resume_install">Tiếp tục cài</string>
|
||||
|
||||
@@ -2606,6 +2606,7 @@
|
||||
<string name="bnet_dl_failed">暴雪下载器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下载器已停止进展。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪错误 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪无法访问游戏文件夹(错误 703)。请检查其权限或选择其他文件夹。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">暴雪游戏</string>
|
||||
<string name="stores_resume_install">继续安装</string>
|
||||
|
||||
@@ -2526,6 +2526,7 @@
|
||||
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下載器已停止進展。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪無法存取遊戲資料夾(錯誤 703)。請檢查其權限或選擇其他資料夾。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">Blizzard 遊戲</string>
|
||||
<string name="stores_resume_install">繼續安裝</string>
|
||||
|
||||
@@ -2526,6 +2526,7 @@
|
||||
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下載器已停止進度。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪無法存取遊戲資料夾(錯誤 703)。請檢查其權限或選擇其他資料夾。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">Blizzard 遊戲</string>
|
||||
<string name="stores_resume_install">繼續安裝</string>
|
||||
|
||||
@@ -2863,6 +2863,7 @@
|
||||
<string name="bnet_dl_failed">Blizzard\'s downloader stopped: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard\'s downloader stopped making progress.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard error %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard could not access the game folder (error 703). Check its permissions or choose a different folder.</string>
|
||||
<string name="bnet_update">Update</string>
|
||||
<string name="bnet_store">Blizzard games</string>
|
||||
<string name="stores_resume_install">Resume install</string>
|
||||
|
||||
@@ -9,6 +9,25 @@ import org.junit.Test
|
||||
class XodusDiagnosticsTest {
|
||||
private val rejected = Regex(Xodus.SIGN_IN_REJECTED)
|
||||
|
||||
@Test fun aDeviceLimitReachesTheInstallerWithoutBecomingASignInFailure() {
|
||||
val line = "NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200"
|
||||
val tail = listOf(line).filter { it.matches(Xodus.reportable) }
|
||||
assertEquals(listOf(line), tail)
|
||||
assertFalse(line.matches(rejected))
|
||||
assertEquals(com.droiddeck.launcher.R.string.stores_xbox_device_group_full, XboxInstaller.licenseRefusal(tail))
|
||||
}
|
||||
|
||||
@Test fun aLaterLicenseSuccessClearsTheDeviceLimitThroughTheDiagnosticFilter() {
|
||||
val stderr = listOf(
|
||||
"NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200",
|
||||
"NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-parsed 200",
|
||||
"NEXUS_EXTRACT_DIAGNOSTIC_V1 extract-failed"
|
||||
)
|
||||
val tail = stderr.filter { it.matches(Xodus.reportable) }
|
||||
assertEquals(stderr, tail)
|
||||
assertNull(XboxInstaller.licenseRefusal(tail))
|
||||
}
|
||||
|
||||
@Test fun aContentLicenseRejectionIsRecognised() {
|
||||
assertTrue("Microsoft content licensing rejected sign-in (HTTP 401). Sign in again in Settings.".matches(rejected))
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ import http.client
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import signal
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
@@ -156,7 +158,13 @@ function watch(path) {
|
||||
save(".json", s);
|
||||
if (/"form"\s*:\s*\{/.test(s)) {
|
||||
var refused = /"error"\s*:\s*(\d+)/.exec(object(s, "game_dir"));
|
||||
if (refused && +refused[1] != 0) throw new Error(+refused[1] == 800 ? "the game folder already holds a game" : "Battle.net refused the game folder (error " + refused[1] + ")");
|
||||
if (refused && +refused[1] != 0) {
|
||||
var code = +refused[1];
|
||||
var reason = "Battle.net refused the game folder (error " + code + ")";
|
||||
if (code == 703) reason = "Battle.net could not access the game folder (error 703)";
|
||||
if (code == 800) reason = "the game folder already holds a game";
|
||||
throw new Error(reason);
|
||||
}
|
||||
} else if (/"error"\s*:\s*[1-9]/.test(s)) break;
|
||||
var state = /"state"\s*:\s*(\d+)/.exec(s.replace(/"extended_status"\s*:\s*\{[^}]*\}/, "")), complete = /"download_complete"\s*:\s*true/.test(s);
|
||||
state = state ? +state[1] : 0;
|
||||
@@ -341,6 +349,58 @@ def install_path(root, library):
|
||||
return letter.upper() + ":\\" + path[len(target):].strip("/").replace("/", "\\")
|
||||
|
||||
|
||||
def _heal_install_permissions(folder):
|
||||
root = Path(folder)
|
||||
if any(path.is_symlink() for path in (root, *root.parents)) or not root.exists():
|
||||
return
|
||||
pending = [root]
|
||||
while pending:
|
||||
path = pending.pop()
|
||||
try:
|
||||
st = path.lstat()
|
||||
except OSError:
|
||||
continue
|
||||
if stat.S_ISLNK(st.st_mode):
|
||||
continue
|
||||
mode = stat.S_IMODE(st.st_mode)
|
||||
wanted = mode | stat.S_IRUSR | stat.S_IWUSR
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
wanted |= stat.S_IXUSR
|
||||
if wanted != mode:
|
||||
try:
|
||||
os.chmod(path, wanted, follow_symlinks=False)
|
||||
except OSError:
|
||||
continue
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
try:
|
||||
with os.scandir(path) as entries:
|
||||
for entry in entries:
|
||||
try:
|
||||
if not entry.is_symlink():
|
||||
pending.append(Path(entry.path))
|
||||
except OSError:
|
||||
continue
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
|
||||
def heal_install_folder(folder):
|
||||
folder = Path(folder).absolute()
|
||||
try:
|
||||
if any(path.is_symlink() for path in (folder, *folder.parents)):
|
||||
return
|
||||
_heal_install_permissions(folder)
|
||||
except (OSError, RuntimeError, ValueError):
|
||||
return
|
||||
try:
|
||||
game_env = runpy.run_path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "droiddeck-game-env"))
|
||||
unlocked, cleared = game_env["heal_shared_data_locked"](folder)
|
||||
except (OSError, KeyError, TypeError, ValueError):
|
||||
unlocked, cleared = [], []
|
||||
if cleared:
|
||||
say("cleared %d stale Windows owners in the game folder; unlocked: %s" % (len(cleared), ", ".join(unlocked) or "none"))
|
||||
|
||||
|
||||
def keeps_open(root):
|
||||
try:
|
||||
with open(os.path.join(drive_c(root), *CONFIG), encoding="utf-8-sig") as f:
|
||||
@@ -1550,6 +1610,7 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country="
|
||||
stop_leftovers(pfx)
|
||||
if action == "install":
|
||||
windows = install_path(root, folder)
|
||||
heal_install_folder(folder)
|
||||
emit("STATE", "starting")
|
||||
base = os.path.join(CACHE, "agent-%s" % uid)
|
||||
os.makedirs(CACHE, exist_ok=True)
|
||||
@@ -1613,6 +1674,8 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country="
|
||||
except OSError:
|
||||
reason = None
|
||||
code = status.get("error")
|
||||
if reason is None and code == 703:
|
||||
reason = "Battle.net could not access the game folder (error 703)"
|
||||
if reason is None and isinstance(code, int) and code > 0:
|
||||
emit("ERROR", "agent %d" % code)
|
||||
say("the %s of %s stopped: Agent error %d" % (action, uid, code))
|
||||
|
||||
@@ -5,6 +5,8 @@ from pathlib import Path
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
@@ -1493,6 +1495,103 @@ class AgentTest(Temp):
|
||||
self.assertIn('var patch = zone == "cn" ? "cn.patch.battlenet.com.cn" : zone + ".patch.battle.net";', script)
|
||||
self.assertIn("+ patch + ':1119/'", script)
|
||||
|
||||
def test_the_driver_maps_game_dir_errors_to_readable_reasons(self):
|
||||
script = BNET["AGENT_SCRIPT"]
|
||||
self.assertIn('if (code == 703) reason = "Battle.net could not access the game folder (error 703)";', script)
|
||||
self.assertIn('if (code == 800) reason = "the game folder already holds a game";', script)
|
||||
|
||||
|
||||
class InstallFolderHealTest(Temp):
|
||||
def test_stale_owners_in_the_install_folder_are_cleared(self):
|
||||
roots, notes = [], []
|
||||
|
||||
def heal(root):
|
||||
roots.append(root)
|
||||
return ["Data"], [".", "Data"]
|
||||
|
||||
with mock.patch.object(BNET["runpy"], "run_path", return_value={"heal_shared_data_locked": heal}), \
|
||||
mock.patch.dict(BNET, {"say": notes.append}):
|
||||
BNET["heal_install_folder"](str(self.tmp / "install"))
|
||||
self.assertEqual(roots, [self.tmp / "install"])
|
||||
self.assertEqual(notes, ["cleared 2 stale Windows owners in the game folder; unlocked: Data"])
|
||||
|
||||
def test_a_folder_that_cannot_be_checked_does_not_stop_the_install(self):
|
||||
for error in (OSError("xattrs"), KeyError("heal_shared_data_locked")):
|
||||
with self.subTest(error=error), mock.patch.object(BNET["runpy"], "run_path", side_effect=error):
|
||||
self.assertIsNone(BNET["heal_install_folder"](str(self.tmp / "install")))
|
||||
|
||||
def test_unreadable_install_folder_entries_are_made_writable(self):
|
||||
folder = self.tmp / "install"
|
||||
data = folder / "Data"
|
||||
data.mkdir(parents=True)
|
||||
blocked = data / "data"
|
||||
blocked.write_bytes(b"x")
|
||||
blocked.chmod(0o400)
|
||||
data.chmod(0o500)
|
||||
folder.chmod(0o500)
|
||||
try:
|
||||
with mock.patch.object(BNET["runpy"], "run_path", return_value={"heal_shared_data_locked": lambda root: ([], [])}):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
self.assertEqual(stat.S_IMODE(folder.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(data.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(blocked.stat().st_mode), 0o600)
|
||||
finally:
|
||||
folder.chmod(0o700)
|
||||
data.chmod(0o700)
|
||||
blocked.chmod(0o600)
|
||||
|
||||
def test_unreadable_descendants_are_repaired_before_windows_cleanup(self):
|
||||
folder = self.tmp / "install"
|
||||
data = folder / "Data"
|
||||
data.mkdir(parents=True)
|
||||
blocked = data / "payload"
|
||||
blocked.write_bytes(b"x")
|
||||
sibling = self.write("other/payload", "keep", 0o440)
|
||||
linked = self.write("external/payload", "keep", 0o440)
|
||||
(folder / "link").symlink_to(linked.parent, target_is_directory=True)
|
||||
subs = (21, 0x0badf00d, 0x0ddba11, 10122, 1000)
|
||||
sid = bytes([1, len(subs)]) + (5).to_bytes(6, "big") + struct.pack("<5I", *subs)
|
||||
descriptor = b"\x01\x00" + struct.pack("<BBHIIII", 1, 0, 0x8004, len(sid), 0, 0, 0) + sid
|
||||
try:
|
||||
os.setxattr(blocked, "user.wine.sd", descriptor)
|
||||
except OSError:
|
||||
self.skipTest("needs user xattrs")
|
||||
blocked.chmod(0)
|
||||
data.chmod(0o300)
|
||||
folder.chmod(0o2510)
|
||||
scan = os.scandir
|
||||
|
||||
def checked_scan(path):
|
||||
self.assertEqual(stat.S_IMODE(os.stat(path).st_mode) & 0o700, 0o700)
|
||||
return scan(path)
|
||||
|
||||
try:
|
||||
with mock.patch.object(BNET["os"], "scandir", side_effect=checked_scan):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
self.assertEqual(stat.S_IMODE(folder.stat().st_mode), 0o2710)
|
||||
self.assertEqual(stat.S_IMODE(data.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(blocked.stat().st_mode), 0o600)
|
||||
self.assertNotIn("user.wine.sd", os.listxattr(blocked))
|
||||
self.assertEqual(stat.S_IMODE(sibling.stat().st_mode), 0o440)
|
||||
self.assertEqual(stat.S_IMODE(linked.stat().st_mode), 0o440)
|
||||
finally:
|
||||
folder.chmod(0o700)
|
||||
data.chmod(0o700)
|
||||
blocked.chmod(0o600)
|
||||
|
||||
def test_symlinked_roots_and_ancestors_are_not_repaired(self):
|
||||
target = self.tmp / "external"
|
||||
target.mkdir()
|
||||
payload = self.write("external/install/payload", "keep", 0o400)
|
||||
link = self.tmp / "link"
|
||||
link.symlink_to(target, target_is_directory=True)
|
||||
with mock.patch.object(BNET["runpy"], "run_path") as cleanup:
|
||||
for folder in (link, link / "install"):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
BNET["_heal_install_permissions"](str(folder))
|
||||
cleanup.assert_not_called()
|
||||
self.assertEqual(stat.S_IMODE(payload.stat().st_mode), 0o400)
|
||||
|
||||
|
||||
class AgentJobTest(Harness):
|
||||
def setUp(self):
|
||||
@@ -1520,6 +1619,7 @@ class AgentJobTest(Harness):
|
||||
"stop_leftovers": lambda pfx: True, "CACHE": str(self.tmp / "cache")})
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
self.child = Child
|
||||
popen = mock.patch.object(BNET["subprocess"], "Popen", Child)
|
||||
popen.start()
|
||||
self.addCleanup(popen.stop)
|
||||
@@ -1547,6 +1647,25 @@ class AgentJobTest(Harness):
|
||||
self.assertEqual([kind for kind, _ in self.lines], ["STATE", "PROGRESS", "DONE"])
|
||||
self.assertEqual(json.loads(self.lines[-1][1]), {"install_dir": "Z:" + folder, "exe": "WarcraftRumble.exe", "version": "16.1.2.119725"})
|
||||
|
||||
def test_an_install_heals_stale_owners_before_it_starts_the_agent(self):
|
||||
self.install()
|
||||
folder = str(self.tmp / "Games/Battle.net/World of Warcraft")
|
||||
self.files = {".json": json.dumps({"state": 1004, "download_complete": True}),
|
||||
".game": json.dumps({"installed": True, "playable": True, "install_dir": "Z:" + folder,
|
||||
"local_version": "1"})}
|
||||
events = []
|
||||
|
||||
class Recording(self.child):
|
||||
def __init__(self, cmd, **kwargs):
|
||||
events.append("popen")
|
||||
super().__init__(cmd, **kwargs)
|
||||
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": lambda path: events.append(("heal", path))}), \
|
||||
mock.patch.object(BNET["subprocess"], "Popen", Recording):
|
||||
code = BNET["agent_job"](self.root, "install", "wow", "wow", folder, "enUS", "USA", "US", poll=0)
|
||||
self.assertEqual(code, 0)
|
||||
self.assertEqual(events, [("heal", folder), "popen"])
|
||||
|
||||
def test_an_install_on_another_volume_is_handed_over_by_its_drive_once_the_prefix_is_stopped(self):
|
||||
self.install()
|
||||
card = self.tmp / "card"
|
||||
@@ -1597,7 +1716,9 @@ class AgentJobTest(Harness):
|
||||
self.install()
|
||||
self.files = {".json": json.dumps({"progress": 1.0}),
|
||||
".game": json.dumps({"installed": True, "playable": True, "install_dir": "Z:/g", "local_version": "2"})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "update", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "update", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertIn("agent-serve", self.started[0])
|
||||
self.assertEqual(json.loads(self.lines[-1][1])["version"], "2")
|
||||
|
||||
@@ -1748,7 +1869,9 @@ class AgentJobTest(Harness):
|
||||
def test_an_uninstall_is_done_once_the_agent_no_longer_lists_it(self):
|
||||
self.install()
|
||||
self.files = {".json": json.dumps({}), ".game": json.dumps({"installed": False})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(self.lines[-1], ("DONE", json.dumps({"uninstalled": "gryphon"})))
|
||||
|
||||
def test_a_gamescope_that_cannot_start_is_reported(self):
|
||||
@@ -1784,7 +1907,9 @@ class AgentJobTest(Harness):
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 1)
|
||||
self.assertEqual(self.lines[-1][0], "ERROR")
|
||||
self.files = {".game": json.dumps({})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(self.lines[-1], ("DONE", json.dumps({"uninstalled": "gryphon"})))
|
||||
|
||||
def test_without_battle_net_nothing_starts(self):
|
||||
@@ -1796,7 +1921,9 @@ class AgentJobTest(Harness):
|
||||
self.install()
|
||||
self.states = [self.clients() + [(40, self.GAME)], [(40, self.GAME)], []]
|
||||
self.files = {".game": json.dumps({"installed": False})}
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(self.lines[0], ("STATE", "waiting"))
|
||||
self.assertEqual(self.lines[1], ("STATE", "starting"))
|
||||
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
"""A commit whose dma-buf the client's GPU is still writing is held until the buffer polls readable.
|
||||
|
||||
The compiled functions come from compositor.c; libwayland's lists and event loop, poll and the clock are faked.
|
||||
"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
SOURCE = Path(__file__).resolve().parents[2] / 'app/src/main/cpp/waylandcomp/src/compositor.c'
|
||||
|
||||
|
||||
def function(text, name):
|
||||
match = re.search(r'^(?:static )?[^\n;]+\b' + name + r'\([^;]*?\)\s*\{', text, re.M)
|
||||
if not match:
|
||||
raise AssertionError('Production function not found: ' + name)
|
||||
pos = text.index('{', match.start())
|
||||
depth, end = 1, pos + 1
|
||||
while depth:
|
||||
depth += (text[end] == '{') - (text[end] == '}')
|
||||
end += 1
|
||||
return text[match.start():end]
|
||||
|
||||
|
||||
def block(text, start):
|
||||
begin = text.index(start)
|
||||
return text[begin:text.index('\n};\n', begin) + 4]
|
||||
|
||||
|
||||
HARNESS = r'''
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#define DAMAGE_RECTS 4
|
||||
#define POLLIN 1
|
||||
#define F_DUPFD_CLOEXEC 1030
|
||||
#define WL_EVENT_READABLE 1
|
||||
struct pollfd { int fd; short events, revents; };
|
||||
struct wl_list { struct wl_list *prev, *next; };
|
||||
struct wl_listener { struct wl_list link; void (*notify)(struct wl_listener *, void *); };
|
||||
static void wl_list_init(struct wl_list *l) { l->prev = l->next = l; }
|
||||
static void wl_list_remove(struct wl_list *l) { l->prev->next = l->next; l->next->prev = l->prev; l->prev = l->next = NULL; }
|
||||
static void wl_list_insert(struct wl_list *list, struct wl_list *elm) {
|
||||
elm->prev = list; elm->next = list->next; list->next = elm; elm->next->prev = elm;
|
||||
}
|
||||
static void wl_list_insert_list(struct wl_list *list, struct wl_list *other) {
|
||||
if (other->next == other) return;
|
||||
other->next->prev = list; other->prev->next = list->next; list->next->prev = other->prev; list->next = other->next;
|
||||
}
|
||||
static int wl_list_length(const struct wl_list *l) { int n = 0; for (struct wl_list *e = l->next; e != l; e = e->next) n++; return n; }
|
||||
#define wl_container_of(ptr, sample, member) (__typeof__(sample))((char *)(ptr) - offsetof(__typeof__(*sample), member))
|
||||
|
||||
struct dmabuf_buffer { int fd[4]; int n_planes; int ahb; };
|
||||
struct wl_resource { struct wl_list link; struct wl_listener *listener; struct dmabuf_buffer *db; int released, destroyed; };
|
||||
static struct wl_resource *from_link(struct wl_list *l) { return wl_container_of(l, (struct wl_resource *)0, link); }
|
||||
#define wl_resource_for_each_safe(r, t, list) \
|
||||
for (r = from_link((list)->next), t = from_link(r->link.next); &r->link != (list); r = t, t = from_link(t->link.next))
|
||||
static void wl_resource_destroy(struct wl_resource *r) { wl_list_remove(&r->link); r->destroyed = 1; }
|
||||
static void wl_resource_add_destroy_listener(struct wl_resource *r, struct wl_listener *l) { r->listener = l; wl_list_init(&l->link); }
|
||||
static void client_destroys(struct wl_resource *r) {
|
||||
if (r->listener) { struct wl_listener *l = r->listener; r->listener = NULL; l->notify(l, r); }
|
||||
}
|
||||
|
||||
static int ready[64], dup_of[64], next_dup = 40, closed[64];
|
||||
static int poll(struct pollfd *p, unsigned n, int timeout) {
|
||||
if (n != 1 || timeout != 0 || p->events != POLLIN) { puts("FAIL poll args"); exit(1); }
|
||||
return ready[p->fd] ? 1 : 0;
|
||||
}
|
||||
static int fcntl(int fd, int cmd, int arg) { (void)cmd; (void)arg; dup_of[next_dup] = fd; return next_dup++; }
|
||||
static int close(int fd) { closed[fd]++; return 0; }
|
||||
|
||||
struct wl_event_source { int fd; int (*fd_cb)(int, uint32_t, void *); int (*timer_cb)(void *); void *data; int armed_ms, removed; };
|
||||
struct wl_event_loop;
|
||||
struct wl_display;
|
||||
static struct wl_display *g_display;
|
||||
static struct wl_event_source sources[32];
|
||||
static int n_sources;
|
||||
static struct wl_event_loop *wl_display_get_event_loop(struct wl_display *d) { (void)d; return NULL; }
|
||||
static struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *l, int fd, uint32_t mask,
|
||||
int (*cb)(int, uint32_t, void *), void *data) {
|
||||
(void)l; (void)mask; struct wl_event_source *s = &sources[n_sources++]; memset(s, 0, sizeof(*s));
|
||||
s->fd = fd; s->fd_cb = cb; s->data = data; return s;
|
||||
}
|
||||
static struct wl_event_source *wl_event_loop_add_timer(struct wl_event_loop *l, int (*cb)(void *), void *data) {
|
||||
(void)l; struct wl_event_source *s = &sources[n_sources++]; memset(s, 0, sizeof(*s));
|
||||
s->fd = -1; s->timer_cb = cb; s->data = data; return s;
|
||||
}
|
||||
static int wl_event_source_timer_update(struct wl_event_source *s, int ms) { s->armed_ms = ms; return 0; }
|
||||
static int wl_event_source_remove(struct wl_event_source *s) { s->removed = 1; return 0; }
|
||||
static void dispatch(int timers_expire) {
|
||||
for (int i = 0; i < n_sources; i++) {
|
||||
struct wl_event_source *s = &sources[i];
|
||||
if (s->removed) continue;
|
||||
if (s->fd_cb && ready[dup_of[s->fd]]) s->fd_cb(s->fd, WL_EVENT_READABLE, s->data);
|
||||
else if (s->timer_cb && s->armed_ms && timers_expire) { s->armed_ms = 0; s->timer_cb(s->data); }
|
||||
}
|
||||
}
|
||||
|
||||
static int64_t clock_ns;
|
||||
static int64_t now_ns(void) { return clock_ns; }
|
||||
static struct { unsigned replaced; } g_pace;
|
||||
static struct { unsigned commit_waits, commit_wait_limits; int64_t commit_wait_ns, commit_wait_max_ns; } g_perf;
|
||||
static int logged;
|
||||
static void droiddeck_log(const char *tag, const char *fmt, ...) { (void)tag; (void)fmt; logged++; }
|
||||
static void send_buffer_release(struct wl_resource *r) { r->released++; }
|
||||
static unsigned feedback_discard_all(struct wl_list *list) {
|
||||
unsigned n = 0; struct wl_resource *r, *t; wl_resource_for_each_safe(r, t, list) { wl_resource_destroy(r); n++; } return n;
|
||||
}
|
||||
static struct dmabuf_buffer *get_dmabuf(struct wl_resource *r) { return r ? r->db : NULL; }
|
||||
static int ahb_swapchain_has_ahb(const struct dmabuf_buffer *b) { return b->ahb; }
|
||||
static int64_t rect_area(const int32_t *r, int bw, int bh) { (void)bw; (void)bh; return (int64_t)r[2] * r[3]; }
|
||||
|
||||
struct damage_list { int32_t r[DAMAGE_RECTS][4]; int n; };
|
||||
struct surface {
|
||||
struct wl_resource *resource, *xdg_toplevel;
|
||||
int toplevel_committed;
|
||||
struct wl_resource *pending_buffer;
|
||||
struct wl_listener pending_buffer_destroy;
|
||||
int pending_attach, pending_src_set, pending_dst_set, pending_opaque_set;
|
||||
float pending_src[4];
|
||||
int pending_dst[2], pending_opaque[4];
|
||||
struct damage_list pending_damage_buf, pending_damage_local;
|
||||
struct wl_list pending_frames, pending_feedback;
|
||||
struct surface_state *waiting;
|
||||
struct wl_event_source *waiting_source, *waiting_timer;
|
||||
int waiting_fd;
|
||||
int64_t waiting_since_ns;
|
||||
};
|
||||
static void send_toplevel_configure(struct surface *s) { (void)s; }
|
||||
struct wl_client;
|
||||
static struct surface surf;
|
||||
|
||||
STATE_STRUCT
|
||||
|
||||
static int applies, applied_attach, applied_frames, applied_opaque, applied_damage;
|
||||
static struct wl_resource *applied_buffer;
|
||||
static void surface_state_apply(struct surface *s, struct surface_state *st);
|
||||
|
||||
FUNCTIONS
|
||||
|
||||
static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
(void)s;
|
||||
applies++;
|
||||
applied_attach = st->attach;
|
||||
applied_buffer = st->attach ? st->buffer : NULL;
|
||||
applied_frames = wl_list_length(&st->frames);
|
||||
applied_opaque = st->opaque_set ? st->opaque[2] : -1;
|
||||
applied_damage = st->damage_buf.n;
|
||||
if (st->attach) { wl_list_remove(&st->buffer_destroy.link); wl_list_init(&st->buffer_destroy.link); }
|
||||
struct wl_resource *r, *t;
|
||||
wl_resource_for_each_safe(r, t, &st->frames) wl_resource_destroy(r);
|
||||
feedback_discard_all(&st->feedback);
|
||||
}
|
||||
|
||||
static struct wl_resource frame_res[16];
|
||||
static int n_frames;
|
||||
static void attach(struct wl_resource *b) {
|
||||
if (surf.pending_buffer) wl_list_remove(&surf.pending_buffer_destroy.link);
|
||||
wl_list_init(&surf.pending_buffer_destroy.link);
|
||||
surf.pending_buffer = b; surf.pending_attach = 1;
|
||||
}
|
||||
static void frame(void) { struct wl_resource *f = &frame_res[n_frames++]; wl_list_insert(surf.pending_frames.prev, &f->link); }
|
||||
static void damage(int w) { surf.pending_damage_buf.r[surf.pending_damage_buf.n][2] = w;
|
||||
surf.pending_damage_buf.r[surf.pending_damage_buf.n][3] = 1; surf.pending_damage_buf.n++; }
|
||||
static void commit(void) { surface_commit(NULL, NULL); }
|
||||
#define CHECK(c, what) do { if (!(c)) { printf("FAIL %s (line %d)\n", what, __LINE__); return 1; } } while (0)
|
||||
|
||||
int main(void) {
|
||||
wl_list_init(&surf.pending_frames); wl_list_init(&surf.pending_feedback);
|
||||
wl_list_init(&surf.pending_buffer_destroy.link);
|
||||
surf.waiting_fd = -1;
|
||||
struct dmabuf_buffer d1 = {{10, -1}, 1, 0}, d2 = {{11, -1}, 1, 0}, d3 = {{12, -1}, 1, 0}, dz = {{13, -1}, 1, 1};
|
||||
struct wl_resource b1 = {.db = &d1}, b2 = {.db = &d2}, b3 = {.db = &d3}, bz = {.db = &dz};
|
||||
|
||||
ready[10] = 1;
|
||||
attach(&b1); frame(); commit();
|
||||
CHECK(applies == 1 && applied_buffer == &b1 && applied_frames == 1 && !surf.waiting && n_sources == 0, "ready buffer");
|
||||
|
||||
ready[11] = 0;
|
||||
clock_ns = 1000000;
|
||||
attach(&b2); frame(); damage(5); commit();
|
||||
CHECK(applies == 1 && surf.waiting && surf.waiting_fd >= 40 && dup_of[surf.waiting_fd] == 11, "held");
|
||||
CHECK(sources[0].armed_ms == 0 && sources[1].armed_ms == 1000, "waits on the buffer with a 1 s limit");
|
||||
dispatch(0);
|
||||
CHECK(applies == 1, "nothing before the writes end");
|
||||
clock_ns = 4000000;
|
||||
ready[11] = 1;
|
||||
dispatch(0);
|
||||
CHECK(applies == 2 && applied_buffer == &b2 && applied_frames == 1 && applied_damage == 1 && !surf.waiting, "applied once ready");
|
||||
CHECK(closed[40] == 1 && sources[0].removed && sources[1].removed, "wait cleaned up");
|
||||
CHECK(g_perf.commit_waits == 1 && g_perf.commit_wait_max_ns == 3000000, "wait counted");
|
||||
|
||||
ready[11] = 0; ready[12] = 0;
|
||||
attach(&b2); frame(); damage(7); commit();
|
||||
attach(&b3); frame(); damage(9); commit();
|
||||
CHECK(applies == 2 && b2.released == 1 && dup_of[surf.waiting_fd] == 12, "replaced while waiting");
|
||||
ready[12] = 1;
|
||||
dispatch(0);
|
||||
CHECK(applies == 3 && applied_buffer == &b3 && applied_frames == 2 && applied_damage == 2, "newest shown with both callbacks");
|
||||
CHECK(g_perf.commit_waits == 2, "merged wait counted once");
|
||||
|
||||
ready[11] = 0;
|
||||
attach(&b2); commit();
|
||||
surf.pending_opaque[2] = 640; surf.pending_opaque_set = 1; frame(); commit();
|
||||
CHECK(applies == 3 && b2.released == 1 && dup_of[surf.waiting_fd] == 11, "the waiting buffer is not released");
|
||||
ready[11] = 1;
|
||||
dispatch(0);
|
||||
CHECK(applies == 4 && applied_buffer == &b2 && applied_opaque == 640 && applied_frames == 1, "buffer kept, opaque applied");
|
||||
|
||||
g_zero_copy_shown = &surf;
|
||||
attach(&bz); commit();
|
||||
CHECK(applies == 5 && applied_buffer == &bz && !surf.waiting && g_unwaited == &surf, "zero-copy buffer");
|
||||
g_zero_copy_shown = NULL;
|
||||
ready[13] = 0;
|
||||
attach(&bz); commit();
|
||||
CHECK(applies == 5 && surf.waiting, "a droiddeck-ahb buffer not shown zero-copy waits");
|
||||
ready[13] = 1;
|
||||
dispatch(0);
|
||||
CHECK(applies == 6 && !g_unwaited, "waited buffer clears the mark");
|
||||
ready[13] = 0;
|
||||
|
||||
ready[10] = 0;
|
||||
attach(&b1); frame(); commit();
|
||||
client_destroys(&b1);
|
||||
ready[10] = 1;
|
||||
dispatch(0);
|
||||
CHECK(applies == 7 && !applied_attach && applied_frames == 1, "destroyed buffer dropped from the commit");
|
||||
|
||||
ready[11] = 0;
|
||||
attach(&b2); commit();
|
||||
dispatch(1);
|
||||
CHECK(applies == 8 && applied_buffer == &b2 && g_perf.commit_wait_limits == 1 && logged == 1 && !surf.waiting, "limit");
|
||||
|
||||
ready[11] = 0; ready[12] = 0;
|
||||
clock_ns = 10000000000;
|
||||
attach(&b2); commit();
|
||||
CHECK(applies == 8 && sources[n_sources - 1].armed_ms == 1000, "held again");
|
||||
clock_ns += 600000000;
|
||||
attach(&b3); commit();
|
||||
CHECK(applies == 8 && surf.waiting && sources[n_sources - 1].armed_ms == 400, "a newer commit keeps the first deadline");
|
||||
clock_ns += 500000000;
|
||||
attach(&b2); commit();
|
||||
CHECK(applies == 9 && applied_buffer == &b2 && g_perf.commit_wait_limits == 2 && !surf.waiting, "commits past the deadline are applied at once");
|
||||
puts("PASS");
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
class CommitWaitsForClientWritesTest(unittest.TestCase):
|
||||
def test_commits_wait_for_the_clients_gpu_writes(self):
|
||||
compiler = shutil.which(os.environ.get('CC', 'cc'))
|
||||
if not compiler:
|
||||
self.skipTest('A host C compiler is required')
|
||||
source = SOURCE.read_text()
|
||||
functions = '\n'.join(re.search(pattern, source, re.M).group(0) for pattern in
|
||||
(r'^#define COMMIT_WAIT_LIMIT_MS .*$', r'^static struct surface \*g_zero_copy_shown, \*g_unwaited;$')) + '\n' + '\n'.join(
|
||||
function(source, name) for name in
|
||||
('note_damage', 'on_state_buffer_destroyed', 'surface_state_take', 'state_unfinished_fd',
|
||||
'surface_state_discard', 'surface_state_merge', 'surface_wait_stop', 'surface_wait_end', 'on_commit_ready',
|
||||
'on_commit_wait_limit', 'surface_wait_start', 'surface_commit'))
|
||||
probe = HARNESS.replace('STATE_STRUCT', block(source, 'struct surface_state {')).replace('FUNCTIONS', functions)
|
||||
probe = probe.replace('struct surface *s = wl_resource_get_user_data(r);', 'struct surface *s = &surf; (void)r;')
|
||||
with tempfile.TemporaryDirectory(prefix='droiddeck-commit-wait-') as temp:
|
||||
folder = Path(temp)
|
||||
(folder / 'probe.c').write_text(probe)
|
||||
built = subprocess.run([compiler, '-std=gnu11', '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wno-unused-function',
|
||||
str(folder / 'probe.c'), '-o', str(folder / 'probe')],
|
||||
capture_output=True, text=True)
|
||||
self.assertEqual(built.returncode, 0, built.stdout + built.stderr)
|
||||
run = subprocess.run([str(folder / 'probe')], capture_output=True, text=True, timeout=10)
|
||||
self.assertEqual(run.returncode, 0, run.stdout + run.stderr)
|
||||
self.assertEqual(run.stdout.strip(), 'PASS')
|
||||
|
||||
def test_scenes_settle_an_unwaited_buffer_before_copying_it(self):
|
||||
body = function(SOURCE.read_text(), 'render_scene').splitlines()
|
||||
copies = [i for i, line in enumerate(body) if 'vkp_render(w, h, dl.d, dl.n)' in line]
|
||||
self.assertGreaterEqual(len(copies), 4)
|
||||
for i in copies:
|
||||
self.assertTrue(any('settle_unwaited();' in line for line in body[max(0, i - 3):i]), body[i])
|
||||
text = '\n'.join(body)
|
||||
self.assertIn('if (hdr_route == 1 || hdr_route == 2) settle_unwaited();', text)
|
||||
self.assertIn('settle_unwaited();\n render_stream();', text)
|
||||
self.assertIn('if (r == 0 && !fg_pass) g_zero_copy_shown = ls;\n else settle_unwaited();', text)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -95,7 +95,7 @@ class SubsurfaceReleaseTest(unittest.TestCase):
|
||||
|
||||
def test_compositor_attach_and_commit_use_the_release_hold(self):
|
||||
self.assertIn('pending_releases_cancel(buffer);', function_body(self.source, 'take_dmabuf'))
|
||||
commit = function_body(self.source, 'surface_commit')
|
||||
commit = function_body(self.source, 'surface_state_apply')
|
||||
self.assertIn('pending_releases_apply(s);', commit)
|
||||
self.assertLess(commit.index('take_dmabuf(s, db, buffer);'), commit.index('pending_releases_apply(s);'))
|
||||
self.assertLess(commit.index('buf_trace_attach(buffer);'), commit.index('if (s->role == ROLE_CURSOR)'))
|
||||
|
||||
Reference in new issue
Block a user