forked from enlightenment/efl
evas gl engines - support tuning of cutouts much more
also re-tune them nby default
This commit is contained in:
parent
510bd04c67
commit
9f3d7b9cff
|
@ -25,6 +25,8 @@ EVAS_API Cutout_Rects *evas_common_draw_context_cutouts_new (vo
|
|||
EVAS_API void evas_common_draw_context_cutouts_free (Cutout_Rects* rects);
|
||||
EVAS_API void evas_common_draw_context_cutouts_real_free (Cutout_Rects* rects);
|
||||
EVAS_API void evas_common_draw_context_cutouts_del (Cutout_Rects* rects, int idx);
|
||||
EVAS_API void evas_common_draw_context_cutout_max_set (RGBA_Draw_Context *dc, int max);
|
||||
EVAS_API void evas_common_draw_context_cutout_size_min_set (RGBA_Draw_Context *dc, int min);
|
||||
EVAS_API void evas_common_draw_context_add_cutout (RGBA_Draw_Context *dc, int x, int y, int w, int h);
|
||||
EVAS_API void evas_common_draw_context_clear_cutouts (RGBA_Draw_Context *dc);
|
||||
EVAS_API Cutout_Rects *evas_common_draw_context_apply_cutouts (RGBA_Draw_Context *dc, Cutout_Rects *recycle);
|
||||
|
|
|
@ -174,6 +174,8 @@ evas_common_draw_context_new(void)
|
|||
dc = _evas_common_draw_context_find();
|
||||
if (!dc) return NULL;
|
||||
memset(dc, 0, sizeof(RGBA_Draw_Context));
|
||||
dc->cutout.count_max = 0x7fffffff;
|
||||
dc->cutout.size_min = 8 * 8;
|
||||
return dc;
|
||||
}
|
||||
|
||||
|
@ -296,11 +298,23 @@ evas_common_draw_context_unset_multiplier(RGBA_Draw_Context *dc)
|
|||
dc->mul.use = 0;
|
||||
}
|
||||
|
||||
EVAS_API void
|
||||
evas_common_draw_context_cutout_max_set(RGBA_Draw_Context *dc, int max)
|
||||
{
|
||||
dc->cutout.count_max = max;
|
||||
}
|
||||
|
||||
EVAS_API void
|
||||
evas_common_draw_context_cutout_size_min_set(RGBA_Draw_Context *dc, int min)
|
||||
{
|
||||
dc->cutout.size_min = min;
|
||||
}
|
||||
|
||||
EVAS_API void
|
||||
evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w, int h)
|
||||
{
|
||||
// if (dc->cutout.rects > 512) return;
|
||||
if (dc->cutout.active >= dc->cutout.count_max) return;
|
||||
if ((w * h) < dc->cutout.size_min) return;
|
||||
if (dc->clip.use)
|
||||
{
|
||||
#if 1 // this is a bit faster
|
||||
|
@ -335,8 +349,8 @@ evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w,
|
|||
RECTS_CLIP_TO_RECT(x, y, w, h,
|
||||
dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
|
||||
#endif
|
||||
if ((w * h) < dc->cutout.size_min) return;
|
||||
}
|
||||
if ((w * h) <= (8 * 8)) return;
|
||||
if (dc->cutout.last_add.w > 0)
|
||||
{
|
||||
if ((dc->cutout.last_add.x == x) && (dc->cutout.last_add.y == y) &&
|
||||
|
|
|
@ -645,6 +645,8 @@ struct _Cutout_Rects
|
|||
Cutout_Rect *rects;
|
||||
int active;
|
||||
int max;
|
||||
int count_max;
|
||||
int size_min;
|
||||
struct {
|
||||
int x, w, y, h;
|
||||
} last_add;
|
||||
|
|
|
@ -158,7 +158,8 @@ struct _Evas_GL_Shared
|
|||
Eina_Bool etc1_subimage : 1;
|
||||
Eina_Bool s3tc : 1;
|
||||
// tuning params - per gpu/cpu combo?
|
||||
#define DEF_CUTOUT 4096
|
||||
#define DEF_CUTOUT 64
|
||||
#define DEF_CUTOUT_SIZE_MIN (64*64)
|
||||
|
||||
#define MAX_PIPES 32
|
||||
#define DEF_PIPES 8
|
||||
|
@ -188,6 +189,9 @@ struct _Evas_GL_Shared
|
|||
struct {
|
||||
int max;
|
||||
} cutout;
|
||||
struct {
|
||||
int min;
|
||||
} cutout_size;
|
||||
struct {
|
||||
int max;
|
||||
} pipes;
|
||||
|
|
|
@ -1004,6 +1004,7 @@ evas_gl_common_context_new(void)
|
|||
// magic numbers that are a result of imperical testing and getting
|
||||
// "best case" performance across a range of systems
|
||||
shared->info.tune.cutout.max = DEF_CUTOUT;
|
||||
shared->info.tune.cutout_size.min = DEF_CUTOUT_SIZE_MIN;
|
||||
shared->info.tune.pipes.max = DEF_PIPES;
|
||||
shared->info.tune.atlas.max_alloc_size = DEF_ATLAS_ALLOC;
|
||||
shared->info.tune.atlas.max_alloc_alpha_size = DEF_ATLAS_ALLOC_ALPHA;
|
||||
|
@ -1040,6 +1041,7 @@ evas_gl_common_context_new(void)
|
|||
} while (0)
|
||||
|
||||
GETENVOPT("EVAS_GL_CUTOUT_MAX", cutout.max, -1, 0x7fffffff);
|
||||
GETENVOPT("EVAS_GL_CUTOUT_SIZE_MIN", cutout_size.min, -1, 0x7fffffff);
|
||||
GETENVOPT("EVAS_GL_PIPES_MAX", pipes.max, 1, MAX_PIPES);
|
||||
GETENVOPT("EVAS_GL_ATLAS_ALLOC_SIZE", atlas.max_alloc_size, MIN_ATLAS_ALLOC, MAX_ATLAS_ALLOC);
|
||||
GETENVOPT("EVAS_GL_ATLAS_ALLOC_ALPHA_SIZE", atlas.max_alloc_alpha_size, MIN_ATLAS_ALLOC_ALPHA, MAX_ATLAS_ALLOC_ALPHA);
|
||||
|
@ -1109,6 +1111,7 @@ evas_gl_common_context_new(void)
|
|||
"\n"
|
||||
"EVAS_GL_GET_PROGRAM_BINARY: %i\n"
|
||||
"EVAS_GL_CUTOUT_MAX: %i\n"
|
||||
"EVAS_GL_CUTOUT_SIZE_MIN: %i\n"
|
||||
"EVAS_GL_PIPES_MAX: %i\n"
|
||||
"EVAS_GL_ATLAS_ALLOC_SIZE: %i\n"
|
||||
"EVAS_GL_ATLAS_ALLOC_ALPHA_SIZE: %i\n"
|
||||
|
@ -1128,6 +1131,7 @@ evas_gl_common_context_new(void)
|
|||
|
||||
(int)shared->info.bin_program,
|
||||
(int)shared->info.tune.cutout.max,
|
||||
(int)shared->info.tune.cutout_size.min,
|
||||
(int)shared->info.tune.pipes.max,
|
||||
(int)shared->info.tune.atlas.max_alloc_size,
|
||||
(int)shared->info.tune.atlas.max_alloc_alpha_size,
|
||||
|
|
|
@ -788,6 +788,10 @@ _rotate_image_data(Render_Engine_GL_Generic *re, Evas_GL_Image *im1)
|
|||
|
||||
// Create a new and temporary context
|
||||
dc = evas_common_draw_context_new();
|
||||
evas_common_draw_context_cutout_max_set
|
||||
(dc, gl_context->shared->info.tune.cutout.max);
|
||||
evas_common_draw_context_cutout_size_min_set
|
||||
(dc, gl_context->shared->info.tune.cutout_size.min);
|
||||
evas_common_draw_context_set_clip(dc, 0, 0, im2->w, im2->h);
|
||||
gl_context->dc = dc;
|
||||
|
||||
|
@ -2317,6 +2321,23 @@ eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, i
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_context_new(void *engine)
|
||||
{
|
||||
Render_Engine_GL_Generic *re = engine;
|
||||
Evas_Engine_GL_Context *gl_context;
|
||||
void *ctx;
|
||||
|
||||
gl_context = gl_generic_context_find(re, 1);
|
||||
|
||||
ctx = pfunc.context_new(&re->software);
|
||||
evas_common_draw_context_cutout_max_set
|
||||
(ctx, gl_context->shared->info.tune.cutout.max);
|
||||
evas_common_draw_context_cutout_size_min_set
|
||||
(ctx, gl_context->shared->info.tune.cutout_size.min);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_context_flush(void *engine)
|
||||
{
|
||||
|
@ -3110,6 +3131,7 @@ module_open(Evas_Module *em)
|
|||
ORD(engine_new);
|
||||
ORD(engine_free);
|
||||
|
||||
ORD(context_new);
|
||||
ORD(context_clip_image_set);
|
||||
ORD(context_clip_image_unset);
|
||||
ORD(context_clip_image_get);
|
||||
|
|
Loading…
Reference in New Issue