this is not a big change - not worth changelog, but allow gl partial

updates to be rounded up to specific tile sizes (and make it 16x16 by
default).
This commit is contained in:
Carsten Haitzler 2013-04-11 21:23:07 +09:00
parent 25843ac65e
commit 7fd0cf1731
3 changed files with 42 additions and 11 deletions

View File

@ -933,6 +933,12 @@ evas_common_tilebuf_get_tile_size(Tilebuf *tb, int *tw, int *th)
if (th) *th = tb->tile_size.h;
}
EAPI void
evas_common_tilebuf_tile_strict_set(Tilebuf *tb, Eina_Bool strict)
{
tb->strict_tiles = strict;
}
#ifdef EVAS_RECT_SPLIT
static inline int
_add_redraw(list_t *rects, int x, int y, int w, int h)
@ -1166,17 +1172,37 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
*/
#elif defined(EVAS_RECT_SPLIT)
list_node_t *n;
list_t to_merge;
Tilebuf_Rect *rects = NULL;
int bx1 = 0, bx2 = 0, by1 = 0, by2 = 0, num = 0;
if (tb->need_merge)
{
list_t to_merge;
to_merge = tb->rects;
tb->rects = list_zeroed;
rect_list_merge_rects(&tb->rects, &to_merge, FUZZ * FUZZ);
tb->need_merge = 0;
}
if (tb->strict_tiles)
{
// round up rects to tb->tile_size.w and tb->tile_size.h
to_merge = list_zeroed;
for (n = tb->rects.head; n; n = n->next)
{
int x1, x2, y1, y2;
x1 = ((rect_node_t *)n)->rect.left;
x2 = x1 + ((rect_node_t *)n)->rect.width;
y1 = ((rect_node_t *)n)->rect.top;
y2 = y1 + ((rect_node_t *)n)->rect.height;
x1 = tb->tile_size.w * (x1 / tb->tile_size.w);
y1 = tb->tile_size.h * (y1 / tb->tile_size.h);
x2 = tb->tile_size.w * ((x2 + tb->tile_size.w - 1) / tb->tile_size.w);
y2 = tb->tile_size.h * ((y2 + tb->tile_size.h - 1) / tb->tile_size.h);
_add_redraw(&to_merge, x1, y1, x2 - x1, y2 - y1);
}
rect_list_merge_rects(&tb->rects, &to_merge, FUZZ * FUZZ);
}
n = tb->rects.head;
if (n)

View File

@ -1042,16 +1042,10 @@ struct rect_node
struct _Tilebuf
{
int outbuf_w;
int outbuf_h;
int outbuf_w, outbuf_h;
struct {
int w, h;
short w, h;
} tile_size;
struct {
int x, y, w, h;
} prev_add, prev_del;
#ifdef RECTUPDATE
/*
Regionbuf *rb;
@ -1067,6 +1061,10 @@ struct _Tilebuf
} tiles;
*/
#endif
struct {
int x, y, w, h;
} prev_add, prev_del;
Eina_Bool strict_tiles : 1;
};
struct _Tilebuf_Tile
@ -1224,6 +1222,7 @@ EAPI Tilebuf *evas_common_tilebuf_new (int w, int h);
EAPI void evas_common_tilebuf_free (Tilebuf *tb);
EAPI void evas_common_tilebuf_set_tile_size (Tilebuf *tb, int tw, int th);
EAPI void evas_common_tilebuf_get_tile_size (Tilebuf *tb, int *tw, int *th);
EAPI void evas_common_tilebuf_tile_strict_set (Tilebuf *tb, Eina_Bool strict);
EAPI int evas_common_tilebuf_add_redraw (Tilebuf *tb, int x, int y, int w, int h);
EAPI int evas_common_tilebuf_del_redraw (Tilebuf *tb, int x, int y, int w, int h);
EAPI int evas_common_tilebuf_add_motion_vector (Tilebuf *tb, int x, int y, int w, int h, int dx, int dy, int alpha);

View File

@ -17,6 +17,8 @@
#define EVAS_GL_NO_GL_H_CHECK 1
#include "Evas_GL.h"
#define EVAS_GL_UPDATE_TILE_SIZE 16
enum {
MERGE_BOUNDING,
MERGE_FULL
@ -992,7 +994,8 @@ eng_setup(Evas *eo_e, void *in)
free(re);
return 0;
}
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
evas_common_tilebuf_set_tile_size(re->tb, EVAS_GL_UPDATE_TILE_SIZE, EVAS_GL_UPDATE_TILE_SIZE);
evas_common_tilebuf_tile_strict_set(re->tb, EINA_TRUE);
if (!e->engine.data.context)
e->engine.data.context =
@ -1070,7 +1073,10 @@ eng_output_resize(void *data, int w, int h)
evas_common_tilebuf_free(re->tb);
re->tb = evas_common_tilebuf_new(w, h);
if (re->tb)
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
{
evas_common_tilebuf_set_tile_size(re->tb, EVAS_GL_UPDATE_TILE_SIZE, EVAS_GL_UPDATE_TILE_SIZE);
evas_common_tilebuf_tile_strict_set(re->tb, EINA_TRUE);
}
}
static void