mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-11 05:33:55 -04:00
shm: rename buffer.mmapped to buffer.data
This commit is contained in:
parent
75f7f21a48
commit
9b6cee825b
3 changed files with 14 additions and 12 deletions
6
render.c
6
render.c
|
|
@ -954,7 +954,7 @@ grid_render_scroll(struct terminal *term, struct buffer *buf,
|
||||||
term, buf, dmg->region.end - dmg->lines, term->rows, false);
|
term, buf, dmg->region.end - dmg->lines, term->rows, false);
|
||||||
} else {
|
} else {
|
||||||
/* Fallback for when we either cannot do SHM scrolling, or it failed */
|
/* Fallback for when we either cannot do SHM scrolling, or it failed */
|
||||||
uint8_t *raw = buf->mmapped;
|
uint8_t *raw = buf->data;
|
||||||
memmove(raw + dst_y * buf->stride,
|
memmove(raw + dst_y * buf->stride,
|
||||||
raw + src_y * buf->stride,
|
raw + src_y * buf->stride,
|
||||||
height * buf->stride);
|
height * buf->stride);
|
||||||
|
|
@ -1019,7 +1019,7 @@ grid_render_scroll_reverse(struct terminal *term, struct buffer *buf,
|
||||||
term, buf, dmg->region.start, dmg->region.start + dmg->lines, false);
|
term, buf, dmg->region.start, dmg->region.start + dmg->lines, false);
|
||||||
} else {
|
} else {
|
||||||
/* Fallback for when we either cannot do SHM scrolling, or it failed */
|
/* Fallback for when we either cannot do SHM scrolling, or it failed */
|
||||||
uint8_t *raw = buf->mmapped;
|
uint8_t *raw = buf->data;
|
||||||
memmove(raw + dst_y * buf->stride,
|
memmove(raw + dst_y * buf->stride,
|
||||||
raw + src_y * buf->stride,
|
raw + src_y * buf->stride,
|
||||||
height * buf->stride);
|
height * buf->stride);
|
||||||
|
|
@ -2162,7 +2162,7 @@ reapply_old_damage(struct terminal *term, struct buffer *new, struct buffer *old
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new->age > 1) {
|
if (new->age > 1) {
|
||||||
memcpy(new->mmapped, old->mmapped, new->size);
|
memcpy(new->data, old->data, new->size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
18
shm.c
18
shm.c
|
|
@ -108,7 +108,7 @@ buffer_destroy_dont_close(struct buffer *buf)
|
||||||
free(buf->pix);
|
free(buf->pix);
|
||||||
buf->pix = NULL;
|
buf->pix = NULL;
|
||||||
buf->wl_buf = NULL;
|
buf->wl_buf = NULL;
|
||||||
buf->mmapped = NULL;
|
buf->data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -150,6 +150,8 @@ buffer_destroy(struct buffer_private *buf)
|
||||||
void
|
void
|
||||||
shm_fini(void)
|
shm_fini(void)
|
||||||
{
|
{
|
||||||
|
xassert(tll_length(buffers) == 0);
|
||||||
|
|
||||||
tll_foreach(buffers, it) {
|
tll_foreach(buffers, it) {
|
||||||
buffer_destroy(&it->item);
|
buffer_destroy(&it->item);
|
||||||
tll_remove(buffers, it);
|
tll_remove(buffers, it);
|
||||||
|
|
@ -199,7 +201,7 @@ page_size(void)
|
||||||
static bool
|
static bool
|
||||||
instantiate_offset(struct wl_shm *shm, struct buffer_private *buf, off_t new_offset)
|
instantiate_offset(struct wl_shm *shm, struct buffer_private *buf, off_t new_offset)
|
||||||
{
|
{
|
||||||
xassert(buf->public.mmapped == NULL);
|
xassert(buf->public.data == NULL);
|
||||||
xassert(buf->public.pix == NULL);
|
xassert(buf->public.pix == NULL);
|
||||||
xassert(buf->public.wl_buf == NULL);
|
xassert(buf->public.wl_buf == NULL);
|
||||||
xassert(buf->pool != NULL);
|
xassert(buf->pool != NULL);
|
||||||
|
|
@ -233,7 +235,7 @@ instantiate_offset(struct wl_shm *shm, struct buffer_private *buf, off_t new_off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf->public.mmapped = mmapped;
|
buf->public.data = mmapped;
|
||||||
buf->public.wl_buf = wl_buf;
|
buf->public.wl_buf = wl_buf;
|
||||||
buf->public.pix = pix;
|
buf->public.pix = pix;
|
||||||
buf->offset = new_offset;
|
buf->offset = new_offset;
|
||||||
|
|
@ -584,7 +586,7 @@ wrap_buffer(struct wl_shm *shm, struct buffer_private *buf, off_t new_offset)
|
||||||
xassert(diff > buf->public.size);
|
xassert(diff > buf->public.size);
|
||||||
|
|
||||||
memcpy((uint8_t *)pool->real_mmapped + new_offset,
|
memcpy((uint8_t *)pool->real_mmapped + new_offset,
|
||||||
buf->public.mmapped,
|
buf->public.data,
|
||||||
buf->public.size);
|
buf->public.size);
|
||||||
|
|
||||||
off_t trim_ofs, trim_len;
|
off_t trim_ofs, trim_len;
|
||||||
|
|
@ -653,7 +655,7 @@ shm_scroll_forward(struct wl_shm *shm, struct buffer_private *buf, int rows,
|
||||||
if (top_keep_rows > 0) {
|
if (top_keep_rows > 0) {
|
||||||
/* Copy current 'top' region to its new location */
|
/* Copy current 'top' region to its new location */
|
||||||
const int stride = buf->public.stride;
|
const int stride = buf->public.stride;
|
||||||
uint8_t *base = buf->public.mmapped;
|
uint8_t *base = buf->public.data;
|
||||||
|
|
||||||
memmove(
|
memmove(
|
||||||
base + (top_margin + rows) * stride,
|
base + (top_margin + rows) * stride,
|
||||||
|
|
@ -704,7 +706,7 @@ shm_scroll_forward(struct wl_shm *shm, struct buffer_private *buf, int rows,
|
||||||
/* Copy 'bottom' region to its new location */
|
/* Copy 'bottom' region to its new location */
|
||||||
const size_t size = buf->public.size;
|
const size_t size = buf->public.size;
|
||||||
const int stride = buf->public.stride;
|
const int stride = buf->public.stride;
|
||||||
uint8_t *base = buf->public.mmapped;
|
uint8_t *base = buf->public.data;
|
||||||
|
|
||||||
memmove(
|
memmove(
|
||||||
base + size - (bottom_margin + bottom_keep_rows) * stride,
|
base + size - (bottom_margin + bottom_keep_rows) * stride,
|
||||||
|
|
@ -760,7 +762,7 @@ shm_scroll_reverse(struct wl_shm *shm, struct buffer_private *buf, int rows,
|
||||||
/* Copy 'bottom' region to its new location */
|
/* Copy 'bottom' region to its new location */
|
||||||
const size_t size = buf->public.size;
|
const size_t size = buf->public.size;
|
||||||
const int stride = buf->public.stride;
|
const int stride = buf->public.stride;
|
||||||
uint8_t *base = buf->public.mmapped;
|
uint8_t *base = buf->public.data;
|
||||||
|
|
||||||
memmove(
|
memmove(
|
||||||
base + size - (bottom_margin + rows + bottom_keep_rows) * stride,
|
base + size - (bottom_margin + rows + bottom_keep_rows) * stride,
|
||||||
|
|
@ -809,7 +811,7 @@ shm_scroll_reverse(struct wl_shm *shm, struct buffer_private *buf, int rows,
|
||||||
if (ret && top_keep_rows > 0) {
|
if (ret && top_keep_rows > 0) {
|
||||||
/* Copy current 'top' region to its new location */
|
/* Copy current 'top' region to its new location */
|
||||||
const int stride = buf->public.stride;
|
const int stride = buf->public.stride;
|
||||||
uint8_t *base = buf->public.mmapped;
|
uint8_t *base = buf->public.data;
|
||||||
|
|
||||||
memmove(
|
memmove(
|
||||||
base + (top_margin + 0) * stride,
|
base + (top_margin + 0) * stride,
|
||||||
|
|
|
||||||
2
shm.h
2
shm.h
|
|
@ -17,7 +17,7 @@ struct buffer {
|
||||||
int stride;
|
int stride;
|
||||||
|
|
||||||
size_t size; /* Buffer size */
|
size_t size; /* Buffer size */
|
||||||
void *mmapped; /* Raw data (TODO: rename) */
|
void *data; /* Raw data (TODO: rename) */
|
||||||
|
|
||||||
struct wl_buffer *wl_buf;
|
struct wl_buffer *wl_buf;
|
||||||
pixman_image_t **pix;
|
pixman_image_t **pix;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue