evas gl common - reduce data structure sizes got gl common context

this reduced pipes to 32 as default max pipes is 32 and we never
actually go  up beyond 32 unless oyu use env vars to expand... and no
one will... and actual testing shows us top out at about 30 pipes
usage in anything i can find/test. this packs more bool flags together
as bits instead of itns or chars to save memory.

@optimize
This commit is contained in:
Carsten Haitzler 2017-02-01 16:08:04 +09:00
parent 5b8e1a38f5
commit 1d60f42e63
1 changed files with 129 additions and 134 deletions

View File

@ -107,9 +107,9 @@ struct _Evas_GL_Program
struct {
GLuint mvp, rotation_id;
} uniform;
GLuint prog;
GLuint prog;
Eina_Bool reset : 1;
Eina_Bool reset : 1;
Eina_Bool bin_saved : 1;
Eina_Bool delete_me : 1;
};
@ -121,62 +121,62 @@ struct _Evas_GL_Shared
int images_size;
struct {
GLint max_texture_units;
GLint max_texture_size;
GLint max_vertex_elements;
GLfloat anisotropic;
Eina_Bool rgb : 1;
Eina_Bool bgra : 1;
Eina_Bool tex_npo2 : 1;
Eina_Bool tex_rect : 1;
Eina_Bool sec_image_map : 1;
Eina_Bool sec_tbm_surface : 1;
Eina_Bool egl_tbm_ext : 1;
Eina_Bool bin_program : 1;
GLint max_texture_units;
GLint max_texture_size;
GLint max_vertex_elements;
GLfloat anisotropic;
Eina_Bool rgb : 1;
Eina_Bool bgra : 1;
Eina_Bool tex_npo2 : 1;
Eina_Bool tex_rect : 1;
Eina_Bool sec_image_map : 1;
Eina_Bool sec_tbm_surface : 1;
Eina_Bool egl_tbm_ext : 1;
Eina_Bool bin_program : 1;
Eina_Bool unpack_row_length : 1;
Eina_Bool etc1 : 1;
Eina_Bool etc2 : 1;
Eina_Bool etc1_subimage : 1;
Eina_Bool s3tc : 1;
Eina_Bool etc1 : 1;
Eina_Bool etc2 : 1;
Eina_Bool etc1_subimage : 1;
Eina_Bool s3tc : 1;
// tuning params - per gpu/cpu combo?
#define DEF_CUTOUT 4096
#define DEF_CUTOUT 4096
#define MAX_PIPES 128
#define MAX_PIPES 32
#define DEF_PIPES 32
#define DEF_PIPES_SGX_540 24
#define DEF_PIPES_TEGRA_2 8
#define DEF_PIPES_TEGRA_3 24
#define MIN_ATLAS_ALLOC 16
#define MAX_ATLAS_ALLOC 1024
#define DEF_ATLAS_ALLOC 256
#define MIN_ATLAS_ALLOC 16
#define MAX_ATLAS_ALLOC 1024
#define DEF_ATLAS_ALLOC 256
#define MIN_ATLAS_ALLOC_ALPHA 16
#define MAX_ATLAS_ALLOC_ALPHA 4096
#define DEF_ATLAS_ALLOC_ALPHA 512
#define MIN_ATLAS_ALLOC_ALPHA 16
#define MAX_ATLAS_ALLOC_ALPHA 4096
#define DEF_ATLAS_ALLOC_ALPHA 512
#define MAX_ATLAS_W 512
#define MAX_ATLAS_W 512
#define DEF_ATLAS_W 512
#define MAX_ATLAS_H 512
#define MAX_ATLAS_H 512
#define DEF_ATLAS_H 512
#define ATLAS_FORMATS_COUNT 12
#define ATLAS_FORMATS_COUNT 12
Eina_List *cspaces; // depend on the values of etc1, etc2 and st3c
struct {
struct {
int max;
int max;
} cutout;
struct {
int max;
int max;
} pipes;
struct {
int max_alloc_size;
int max_alloc_alpha_size;
int max_w;
int max_h;
int max_alloc_size;
int max_alloc_alpha_size;
int max_w;
int max_h;
} atlas;
} tune;
} info;
@ -210,7 +210,6 @@ struct _Evas_GL_Shared
int ax, ay;
int offx, offy;
GLfloat proj[16];
Eina_Bool needs_shaders_flush : 1;
};
@ -263,77 +262,77 @@ struct _Evas_Engine_GL_Context
Evas_GL_Program *prog;
GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm;
int tex_target;
int render_op;
int cx, cy, cw, ch;
int smooth;
int blend;
int clip;
unsigned char render_op;
Eina_Bool smooth : 1;
Eina_Bool blend : 1;
Eina_Bool clip : 1;
Eina_Bool anti_alias : 1;
} current;
} state;
struct {
int x, y, w, h;
Eina_Bool enabled : 1;
Eina_Bool used : 1;
Eina_Bool enabled : 1;
Eina_Bool used : 1;
} master_clip;
struct {
Eina_Bool size : 1;
} change;
Eina_Bool havestuff : 1;
struct {
struct {
int x, y, w, h;
Shader_Type type;
int x, y, w, h;
Shader_Type type;
} region;
struct {
Evas_GL_Program *prog;
Evas_GL_Image *surface;
GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm;
void *cur_tex_dyn, *cur_texu_dyn, *cur_texv_dyn;
int tex_target;
int render_op;
int cx, cy, cw, ch;
int smooth;
int blend;
int mask_smooth;
int clip;
Evas_GL_Image *surface;
void *cur_tex_dyn, *cur_texu_dyn, *cur_texv_dyn;
GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm;
int tex_target;
int cx, cy, cw, ch;
unsigned char render_op;
Eina_Bool smooth : 1;
Eina_Bool blend : 1;
Eina_Bool mask_smooth : 1;
Eina_Bool clip : 1;
} shader;
struct {
int num, alloc;
GLshort *vertex;
GLubyte *color;
GLfloat *texuv;
GLfloat *texuv2;
GLfloat *texuv3;
GLfloat *texa;
GLfloat *texsam;
GLfloat *mask;
GLfloat *masksam;
Eina_Bool line: 1;
Eina_Bool use_vertex : 1; // always true
Eina_Bool use_color : 1;
Eina_Bool use_texuv : 1;
Eina_Bool use_texuv2 : 1;
Eina_Bool use_texuv3 : 1;
Eina_Bool use_texa : 1;
Eina_Bool use_texsam : 1;
Eina_Bool use_mask : 1;
Eina_Bool use_masksam : 1;
Eina_Bool anti_alias : 1;
int num, alloc;
GLshort *vertex;
GLubyte *color;
GLfloat *texuv;
GLfloat *texuv2;
GLfloat *texuv3;
GLfloat *texa;
GLfloat *texsam;
GLfloat *mask;
GLfloat *masksam;
Evas_GL_Image *im;
GLuint buffer;
int buffer_alloc;
int buffer_use;
GLuint buffer;
int buffer_alloc;
int buffer_use;
Eina_Bool line : 1;
Eina_Bool use_vertex : 1; // always true
Eina_Bool use_color : 1;
Eina_Bool use_texuv : 1;
Eina_Bool use_texuv2 : 1;
Eina_Bool use_texuv3 : 1;
Eina_Bool use_texa : 1;
Eina_Bool use_texsam : 1;
Eina_Bool use_mask : 1;
Eina_Bool use_masksam : 1;
Eina_Bool anti_alias : 1;
} array;
} pipe[MAX_PIPES];
struct {
Eina_Bool size : 1;
} change;
Eina_List *font_glyph_textures;
Eina_Bool havestuff : 1;
Eina_List *font_glyph_textures;
Evas_GL_Image *def_surface;
RGBA_Image *font_surface;
#ifdef GL_GLES
// FIXME: hack. expose egl display to gl core for egl image sec extn.
@ -345,9 +344,7 @@ struct _Evas_Engine_GL_Context
#endif
GLuint preserve_bit;
int gles_version;
RGBA_Image *font_surface;
int gles_version;
};
struct _Evas_GL_Texture_Pool
@ -378,29 +375,28 @@ struct _Evas_GL_Texture_Pool
struct _Evas_GL_Texture_Alloca
{
Evas_GL_Texture *tex;
int x, w;
int x, w;
};
struct _Evas_GL_Texture
{
Evas_Engine_GL_Context *gc;
Evas_GL_Image *im;
Evas_GL_Texture_Pool *pt, *ptu, *ptv, *ptt;
Evas_GL_Texture_Pool *pt2, *ptu2, *ptv2;
Evas_Engine_GL_Context *gc;
Evas_GL_Image *im;
Evas_GL_Texture_Pool *pt, *ptu, *ptv, *ptt;
Evas_GL_Texture_Pool *pt2, *ptu2, *ptv2;
union {
Evas_GL_Texture_Pool *ptuv;
Evas_GL_Texture_Pool *pta;
};
RGBA_Font_Glyph *fglyph;
int references;
int x, y, w, h;
int tx, ty;
double sx1, sy1, sx2, sy2;
int references;
struct
{
struct {
Evas_GL_Texture_Pool *pt[2], *ptuv[2];
int source;
int source;
} double_buffer;
Eina_List *targets;
@ -415,56 +411,55 @@ struct _Evas_GL_Texture
struct _Evas_GL_Image
{
Evas_Engine_GL_Context *gc;
RGBA_Image *im;
Evas_GL_Texture *tex;
Evas_Image_Load_Opts load_opts;
int references;
RGBA_Image *im;
Evas_GL_Texture *tex;
Evas_Image_Load_Opts load_opts;
int references;
// if im->im == NULL, it's a render-surface so these here are used
int w, h;
int w, h;
struct {
Evas_Colorspace space;
void *data;
unsigned char no_free : 1;
Evas_Colorspace space;
void *data;
unsigned char no_free : 1;
} cs;
struct {
void *data;
void *data;
struct {
void (*bind) (void *image);
void (*unbind) (void *image);
void (*free) (void *image);
int (*yinvert) (void *image);
void (*bind) (void *image);
void (*unbind) (void *image);
void (*free) (void *image);
int (*yinvert) (void *image);
} func;
int yinvert;
int target;
int mipmap;
unsigned char loose : 1;
void *disp;
Evas_GL_Shared *shared;
void *disp;
Evas_GL_Shared *shared;
int target;
Eina_Bool yinvert : 1;
Eina_Bool mipmap : 1;
Eina_Bool loose : 1;
} native;
struct {
Evas_GL_Image *origin;
Eina_Bool smooth : 1;
Evas_GL_Image *origin;
Eina_Bool smooth : 1;
} scaled;
int scale_hint, content_hint;
int csize;
Eina_List *filtered;
Eina_List *targets;
Evas_Image_Orient orient;
Eina_Inlist *maps; /* Evas_GL_Image_Data_Map */
Eina_Inlist *maps; /* Evas_GL_Image_Data_Map */
Evas_Image_Orient orient;
int scale_hint, content_hint;
int csize;
unsigned char dirty : 1;
unsigned char cached : 1;
unsigned char alpha : 1;
unsigned char tex_only : 1;
unsigned char locked : 1; // gl_surface_lock/unlock
unsigned char direct : 1; // evas gl direct renderable
Eina_Bool dirty : 1;
Eina_Bool cached : 1;
Eina_Bool alpha : 1;
Eina_Bool tex_only : 1;
Eina_Bool locked : 1; // gl_surface_lock/unlock
Eina_Bool direct : 1; // evas gl direct renderable
/*Disable generate atlas for texture unit, EINA_FALSE by default*/
Eina_Bool disable_atlas : 1;
Eina_Bool disable_atlas : 1;
};
struct _Evas_GL_Font_Texture
@ -486,9 +481,9 @@ struct _Evas_GL_Polygon_Point
struct _Evas_GL_Texture_Async_Preload
{
Evas_GL_Texture *tex;
RGBA_Image *im;
RGBA_Image *im;
Eina_Bool unpack_row_length;
Eina_Bool unpack_row_length;
};
struct _Evas_GL_Image_Data_Map