diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-10-07 14:23:09 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-10-10 05:56:27 +0000 |
| commit | c50b1f990093a2a453288b976ef7f6d9a303f793 (patch) | |
| tree | 015ed6f477ea3175191ceeea85505455629ce448 /shm.c | |
| parent | config: log_contextual_errno(): sync with log_contextual() (diff) | |
render: more fine-grained wayland surface damage tracking
Before this patch. Wayland surface damage tracking was done on a
per-row basis. That is, even if just one cell was updated, the entire
row was "damaged".
Now, damage is per cell. This hopefully results in lower latencies in
many use cases, and especially on high DPI monitors.
Diffstat (limited to 'shm.c')
| -rw-r--r-- | shm.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -157,7 +157,9 @@ buffer_destroy(struct buffer_private *buf) pool_unref(buf->pool); buf->pool = NULL; - pixman_region32_fini(&buf->public.dirty); + for (size_t i = 0; i < buf->public.pix_instances; i++) + pixman_region32_fini(&buf->public.dirty[i]); + free(buf->public.dirty); free(buf); } @@ -476,7 +478,12 @@ get_new_buffers(struct buffer_chain *chain, size_t count, else tll_push_front(chain->bufs, buf); - pixman_region32_init(&buf->public.dirty); + buf->public.dirty = malloc( + chain->pix_instances * sizeof(buf->public.dirty[0])); + + for (size_t j = 0; j < chain->pix_instances; j++) + pixman_region32_init(&buf->public.dirty[j]); + pool->ref_count++; offset += buf->size; bufs[i] = &buf->public; @@ -585,7 +592,8 @@ shm_get_buffer(struct buffer_chain *chain, int width, int height) if (cached != NULL) { LOG_DBG("re-using buffer %p from cache", (void *)cached); cached->busy = true; - pixman_region32_clear(&cached->public.dirty); + for (size_t i = 0; i < cached->public.pix_instances; i++) + pixman_region32_clear(&cached->public.dirty[i]); xassert(cached->public.pix_instances == chain->pix_instances); return &cached->public; } |
