evas gl - tune gl engine to use a bit less cpu overhead

we have used a fair bit of cpu to avoid gpu overhead and this tunes
the balance back a bit to throwing more at the gpu and less at the cpu
by reducing the number of pipes and max vertex counts per pipe by
default and only resetting pipe state vars if adding the first pipe
member.

@opt
This commit is contained in:
Carsten Haitzler 2020-06-02 11:39:06 +01:00
parent d992a319a8
commit 7dbe886f58
2 changed files with 410 additions and 367 deletions

View File

@ -165,7 +165,7 @@ struct _Evas_GL_Shared
#define DEF_CUTOUT 4096
#define MAX_PIPES 32
#define DEF_PIPES 32
#define DEF_PIPES 8
#define DEF_PIPES_SGX_540 24
#define DEF_PIPES_TEGRA_2 8
#define DEF_PIPES_TEGRA_3 24

View File

@ -988,7 +988,7 @@ evas_gl_common_context_new(void)
&(shared->info.max_texture_units));
glGetIntegerv(GL_MAX_TEXTURE_SIZE,
&(shared->info.max_texture_size));
shared->info.max_vertex_elements = 6 * 100000;
shared->info.max_vertex_elements = 6 * 100;
#ifdef GL_MAX_ELEMENTS_VERTICES
/* only applies to glDrawRangeElements. don't really need to get it.
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES,
@ -1847,14 +1847,13 @@ vertex_array_size_check(Evas_Engine_GL_Context *gc EINA_UNUSED, int pn EINA_UNUS
{
return 1;
// this fixup breaks for expedite test 32. why?
/* for reference
// for reference
if ((gc->pipe[pn].array.num + n) > gc->shared->info.max_vertex_elements)
{
shader_array_flush(gc);
return 0;
}
return 1;
*/
}
static int
@ -1966,6 +1965,8 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_LINE;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = 0;
@ -1990,6 +1991,7 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
gc->pipe[pn].array.use_mask = !!mtex;
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 2);
@ -2031,7 +2033,8 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
EINA_FALSE,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_RECT;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = 0;
@ -2054,6 +2057,7 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
gc->pipe[pn].array.use_mask = !!mtex;
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -2250,6 +2254,8 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_IMAGE;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = pt->texture;
@ -2273,6 +2279,7 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = (sam != SHD_SAM11);
gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -2452,6 +2459,8 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_FONT;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -2474,6 +2483,7 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -2532,6 +2542,8 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_YUV;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -2556,6 +2568,7 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -2612,6 +2625,8 @@ evas_gl_common_context_yuv_709_push(Evas_Engine_GL_Context *gc,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_YUV_709;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -2636,6 +2651,7 @@ evas_gl_common_context_yuv_709_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -2692,6 +2708,8 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_YUY2;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -2715,6 +2733,7 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -2770,6 +2789,8 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
0, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_NV12;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -2795,6 +2816,7 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -2855,6 +2877,8 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
EINA_FALSE, 0, 0, 0, 0,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_RGB_A_PAIR;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -2879,6 +2903,7 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_mask = !!mtex;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -3040,6 +3065,8 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
smooth,
clip, cx, cy, cw, ch,
mask_smooth);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_MAP;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -3077,6 +3104,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texa = use_texa;
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_masksam = (masksam != SHD_SAM11);
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -3238,6 +3266,8 @@ evas_gl_common_filter_displace_push(Evas_Engine_GL_Context *gc,
x, y, w, h, blend, smooth,
0, 0, 0, 0, 0, EINA_FALSE);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_FILTER_DISPLACE;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -3261,6 +3291,7 @@ evas_gl_common_filter_displace_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = (sam != SHD_SAM11);
gc->pipe[pn].array.use_mask = 0;
gc->pipe[pn].array.use_masksam = 0;
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -3357,6 +3388,8 @@ evas_gl_common_filter_curve_push(Evas_Engine_GL_Context *gc,
x, y, w, h, blend, smooth,
0, 0, 0, 0, 0, EINA_FALSE);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = SHD_FILTER_CURVE;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -3380,6 +3413,7 @@ evas_gl_common_filter_curve_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = (sam != SHD_SAM11);
gc->pipe[pn].array.use_mask = 0;
gc->pipe[pn].array.use_masksam = 0;
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -3586,6 +3620,8 @@ evas_gl_common_filter_blur_push(Evas_Engine_GL_Context *gc,
sx, sy, dw, dh, blend, smooth,
0, 0, 0, 0, 0, EINA_FALSE);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = type;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -3609,6 +3645,7 @@ evas_gl_common_filter_blur_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_mask = 0;
gc->pipe[pn].array.use_masksam = 0;
}
pipe_region_expand(gc, pn, dx, dy, dw, dh);
PIPE_GROW(gc, pn, 6);
@ -3711,6 +3748,8 @@ evas_gl_common_filter_grayscale_push(Evas_Engine_GL_Context *gc,
x, y, w, h, blend, smooth,
0, 0, 0, 0, 0, EINA_FALSE);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = type;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -3734,6 +3773,7 @@ evas_gl_common_filter_grayscale_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_mask = 0;
gc->pipe[pn].array.use_masksam = 0;
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -3804,6 +3844,8 @@ evas_gl_common_filter_inverse_color_push(Evas_Engine_GL_Context *gc,
x, y, w, h, blend, smooth,
0, 0, 0, 0, 0, EINA_FALSE);
if (gc->pipe[pn].array.num == 0)
{
gc->pipe[pn].region.type = type;
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
@ -3827,6 +3869,7 @@ evas_gl_common_filter_inverse_color_push(Evas_Engine_GL_Context *gc,
gc->pipe[pn].array.use_texsam = 0;
gc->pipe[pn].array.use_mask = 0;
gc->pipe[pn].array.use_masksam = 0;
}
pipe_region_expand(gc, pn, x, y, w, h);
PIPE_GROW(gc, pn, 6);
@ -4559,8 +4602,8 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
i,
gc->pipe[i].array.num / 6,
gc->pipe[0].shader.surface,
gc->pipe[0].shader.surface->w,
gc->pipe[0].shader.surface->h,
gc->pipe[0].shader.surface ? gc->pipe[0].shader.surface->w : 0,
gc->pipe[0].shader.surface ? gc->pipe[0].shader.surface->h : 0,
gw, gh,
gc->pipe[i].shader.cur_tex,
types[gc->pipe[i].region.type]