forked from enlightenment/efl
wayland-shm: re-organize some of the swap/redraw logic
Summary: The way things were, we'd be committing a buffer we hadn't rendered to yet. Now redraw() contains all the attach/damage/commit logic, and swap() is called afterwards to set up a new target buffer for the next render. @fix Reviewers: zmike, devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2875
This commit is contained in:
parent
f2caeff9c2
commit
0b284d0914
|
@ -121,9 +121,9 @@ struct _Outbuf
|
|||
Shm_Surface *_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *surface, int w, int h, int num_buff, Eina_Bool alpha);
|
||||
void _evas_shm_surface_destroy(Shm_Surface *surface);
|
||||
void _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h, int num_buff, uint32_t flags);
|
||||
void _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count);
|
||||
void _evas_shm_surface_swap(Shm_Surface *surface);
|
||||
void *_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h);
|
||||
void _evas_shm_surface_redraw(Shm_Surface *surface);
|
||||
void _evas_shm_surface_redraw(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count);
|
||||
|
||||
Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
|
||||
void _evas_outbuf_free(Outbuf *ob);
|
||||
|
|
|
@ -162,10 +162,10 @@ _evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode
|
|||
EINA_ARRAY_ITER_NEXT(&ob->priv.onebuf_regions, i, rect, it)
|
||||
result[i] = *rect;
|
||||
|
||||
/* force a buffer swap */
|
||||
_evas_shm_surface_swap(ob->surface, result, n);
|
||||
_evas_shm_surface_redraw(ob->surface, result, n);
|
||||
|
||||
_evas_shm_surface_redraw(ob->surface);
|
||||
/* force a buffer swap */
|
||||
_evas_shm_surface_swap(ob->surface);
|
||||
|
||||
/* clean array */
|
||||
eina_array_clean(&ob->priv.onebuf_regions);
|
||||
|
@ -247,10 +247,10 @@ _evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode
|
|||
i++;
|
||||
}
|
||||
|
||||
/* force a buffer swap */
|
||||
_evas_shm_surface_swap(ob->surface, result, n);
|
||||
_evas_shm_surface_redraw(ob->surface, result, n);
|
||||
|
||||
_evas_shm_surface_redraw(ob->surface);
|
||||
/* force a buffer swap */
|
||||
_evas_shm_surface_swap(ob->surface);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -405,9 +405,9 @@ _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h
|
|||
}
|
||||
|
||||
void
|
||||
_evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count)
|
||||
_evas_shm_surface_swap(Shm_Surface *surface)
|
||||
{
|
||||
Shm_Leaf *leaf = NULL;
|
||||
Shm_Leaf *leaf;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
|
@ -424,20 +424,6 @@ _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int
|
|||
|
||||
surface->last_buff = surface->curr_buff;
|
||||
|
||||
wl_surface_attach(surface->surface, leaf->data->buffer, 0, 0);
|
||||
|
||||
if ((rects) && (count > 0))
|
||||
{
|
||||
unsigned int k = 0;
|
||||
|
||||
for (; k < count; k++)
|
||||
wl_surface_damage(surface->surface,
|
||||
rects[k].x, rects[k].y,
|
||||
rects[k].w, rects[k].h);
|
||||
}
|
||||
else
|
||||
wl_surface_damage(surface->surface, 0, 0, leaf->w, leaf->h);
|
||||
|
||||
surface->dx = 0;
|
||||
surface->dy = 0;
|
||||
surface->mapped = EINA_TRUE;
|
||||
|
@ -480,16 +466,33 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
|
|||
return leaf->data->map;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_shm_surface_redraw(Shm_Surface *surface)
|
||||
void
|
||||
_evas_shm_surface_redraw(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count)
|
||||
{
|
||||
Shm_Leaf *leaf = NULL;
|
||||
struct wl_callback *frame_cb;
|
||||
Shm_Leaf *leaf;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
leaf = &surface->leaf[surface->curr_buff];
|
||||
if (!leaf) return;
|
||||
|
||||
if (!surface->surface) return;
|
||||
|
||||
wl_surface_attach(surface->surface, leaf->data->buffer, 0, 0);
|
||||
|
||||
if ((rects) && (count > 0))
|
||||
{
|
||||
unsigned int k = 0;
|
||||
|
||||
for (; k < count; k++)
|
||||
wl_surface_damage(surface->surface,
|
||||
rects[k].x, rects[k].y,
|
||||
rects[k].w, rects[k].h);
|
||||
}
|
||||
else
|
||||
wl_surface_damage(surface->surface, 0, 0, leaf->w, leaf->h);
|
||||
|
||||
frame_cb = wl_surface_frame(surface->surface);
|
||||
wl_callback_add_listener(frame_cb, &_shm_frame_listener, surface);
|
||||
|
||||
|
|
Loading…
Reference in New Issue