forked from enlightenment/efl
evas-gl-drm: Cleanup gl_drm engine code a bit more
Summary: This cleans up the gl-drm engine code a bit and avoids the need to constantly destroy and recreate the gbm device itself. This also adds checks during Outbuf create to handle the swap_mode as per previously added enum. Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
9315424bac
commit
88cb6b74bf
|
@ -130,6 +130,37 @@ static const EVGL_Interface evgl_funcs =
|
||||||
NULL, // native_win_surface_config_get
|
NULL, // native_win_surface_config_get
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
eng_gbm_init(Evas_Engine_Info_GL_Drm *info)
|
||||||
|
{
|
||||||
|
Ecore_Drm_Device *dev;
|
||||||
|
|
||||||
|
if (!info) return EINA_FALSE;
|
||||||
|
if (!(dev = info->info.dev)) return EINA_FALSE;
|
||||||
|
|
||||||
|
if (!(info->info.gbm = gbm_create_device(dev->drm.fd)))
|
||||||
|
{
|
||||||
|
ERR("Coult not create gbm device: %m");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
eng_gbm_shutdown(Evas_Engine_Info_GL_Drm *info)
|
||||||
|
{
|
||||||
|
if (!info) return EINA_TRUE;
|
||||||
|
|
||||||
|
if (info->info.gbm)
|
||||||
|
{
|
||||||
|
gbm_device_destroy(info->info.gbm);
|
||||||
|
info->info.gbm = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* local inline functions */
|
/* local inline functions */
|
||||||
static inline Outbuf *
|
static inline Outbuf *
|
||||||
eng_get_ob(Render_Engine *re)
|
eng_get_ob(Render_Engine *re)
|
||||||
|
@ -170,9 +201,7 @@ gl_symbols(void)
|
||||||
LINK2GENERIC(evas_gl_preload_init);
|
LINK2GENERIC(evas_gl_preload_init);
|
||||||
LINK2GENERIC(evas_gl_preload_shutdown);
|
LINK2GENERIC(evas_gl_preload_shutdown);
|
||||||
LINK2GENERIC(evgl_engine_shutdown);
|
LINK2GENERIC(evgl_engine_shutdown);
|
||||||
LINK2GENERIC(evgl_current_native_context_get);
|
|
||||||
LINK2GENERIC(evas_gl_symbols);
|
LINK2GENERIC(evas_gl_symbols);
|
||||||
LINK2GENERIC(evas_gl_common_current_context_get);
|
|
||||||
|
|
||||||
#define FINDSYM(dst, sym, typ) \
|
#define FINDSYM(dst, sym, typ) \
|
||||||
if (glsym_eglGetProcAddress) { \
|
if (glsym_eglGetProcAddress) { \
|
||||||
|
@ -351,8 +380,9 @@ evgl_eng_native_window_create(void *data)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = gbm_surface_create(info->info.gbm, 1, 1, info->info.format,
|
surface = gbm_surface_create(info->info.gbm,
|
||||||
info->info.flags);
|
eng_get_ob(re)->w, eng_get_ob(re)->h,
|
||||||
|
info->info.format, info->info.flags);
|
||||||
if (!surface)
|
if (!surface)
|
||||||
{
|
{
|
||||||
ERR("Could not create gl drm window: %m");
|
ERR("Could not create gl drm window: %m");
|
||||||
|
@ -677,52 +707,6 @@ _native_cb_free(void *data, void *image)
|
||||||
free(n);
|
free(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
eng_gbm_init(Evas_Engine_Info_GL_Drm *info, int w, int h)
|
|
||||||
{
|
|
||||||
Ecore_Drm_Device *dev;
|
|
||||||
|
|
||||||
if (!info) return EINA_FALSE;
|
|
||||||
if (!(dev = info->info.dev)) return EINA_FALSE;
|
|
||||||
|
|
||||||
if (!(info->info.gbm = gbm_create_device(dev->drm.fd)))
|
|
||||||
{
|
|
||||||
ERR("Coult not create gbm device: %m");
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(info->info.surface =
|
|
||||||
gbm_surface_create(info->info.gbm, w, h,
|
|
||||||
info->info.format, info->info.flags)))
|
|
||||||
{
|
|
||||||
ERR("Could not create gbm surface: %m");
|
|
||||||
gbm_device_destroy(info->info.gbm);
|
|
||||||
info->info.gbm = NULL;
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
eng_gbm_shutdown(Evas_Engine_Info_GL_Drm *info)
|
|
||||||
{
|
|
||||||
if (!info) return EINA_TRUE;
|
|
||||||
|
|
||||||
if (info->info.surface)
|
|
||||||
{
|
|
||||||
gbm_surface_destroy(info->info.surface);
|
|
||||||
info->info.surface = NULL;
|
|
||||||
}
|
|
||||||
if (info->info.gbm)
|
|
||||||
{
|
|
||||||
gbm_device_destroy(info->info.gbm);
|
|
||||||
info->info.gbm = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* engine specific override functions */
|
/* engine specific override functions */
|
||||||
static void *
|
static void *
|
||||||
eng_info(Evas *eo_e EINA_UNUSED)
|
eng_info(Evas *eo_e EINA_UNUSED)
|
||||||
|
@ -780,6 +764,42 @@ eng_setup(Evas *evas, void *in)
|
||||||
(!strcasecmp(s, "q")) || (!strcasecmp(s, "4")))
|
(!strcasecmp(s, "q")) || (!strcasecmp(s, "4")))
|
||||||
swap_mode = MODE_QUADRUPLE;
|
swap_mode = MODE_QUADRUPLE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// in most gl implementations - egl and glx here that we care about the TEND
|
||||||
|
// to either swap or copy backbuffer and front buffer, but strictly that is
|
||||||
|
// not true. technically backbuffer content is totally undefined after a swap
|
||||||
|
// and thus you MUST re-render all of it, thus MODE_FULL
|
||||||
|
swap_mode = MODE_FULL;
|
||||||
|
// BUT... reality is that lmost every implementation copies or swaps so
|
||||||
|
// triple buffer mode can be used as it is a superset of double buffer and
|
||||||
|
// copy (though using those explicitly is more efficient). so let's play with
|
||||||
|
// triple buffer mdoe as a default and see.
|
||||||
|
// re->mode = MODE_TRIPLE;
|
||||||
|
// XXX: note - the above seems to break on some older intel chipsets and
|
||||||
|
// drivers. it seems we CANT depend on backbuffer staying around. bugger!
|
||||||
|
switch (info->info.swap_mode)
|
||||||
|
{
|
||||||
|
case EVAS_ENGINE_GL_DRM_SWAP_MODE_FULL:
|
||||||
|
swap_mode = MODE_FULL;
|
||||||
|
break;
|
||||||
|
case EVAS_ENGINE_GL_DRM_SWAP_MODE_COPY:
|
||||||
|
swap_mode = MODE_COPY;
|
||||||
|
break;
|
||||||
|
case EVAS_ENGINE_GL_DRM_SWAP_MODE_DOUBLE:
|
||||||
|
swap_mode = MODE_DOUBLE;
|
||||||
|
break;
|
||||||
|
case EVAS_ENGINE_GL_DRM_SWAP_MODE_TRIPLE:
|
||||||
|
swap_mode = MODE_TRIPLE;
|
||||||
|
break;
|
||||||
|
case EVAS_ENGINE_GL_DRM_SWAP_MODE_QUADRUPLE:
|
||||||
|
swap_mode = MODE_QUADRUPLE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
swap_mode = MODE_AUTO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(re = epd->engine.data.output))
|
if (!(re = epd->engine.data.output))
|
||||||
{
|
{
|
||||||
|
@ -794,7 +814,7 @@ eng_setup(Evas *evas, void *in)
|
||||||
|
|
||||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return 0;
|
if (!(re = calloc(1, sizeof(Render_Engine)))) return 0;
|
||||||
|
|
||||||
if (!eng_gbm_init(info, epd->output.w, epd->output.h))
|
if (!eng_gbm_init(info))
|
||||||
{
|
{
|
||||||
free(re);
|
free(re);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -829,9 +849,9 @@ eng_setup(Evas *evas, void *in)
|
||||||
evas_outbuf_gl_context_use,
|
evas_outbuf_gl_context_use,
|
||||||
&evgl_funcs, ob->w, ob->h))
|
&evgl_funcs, ob->w, ob->h))
|
||||||
{
|
{
|
||||||
eng_gbm_shutdown(info);
|
|
||||||
/* free outbuf */
|
/* free outbuf */
|
||||||
evas_outbuf_free(ob);
|
evas_outbuf_free(ob);
|
||||||
|
eng_gbm_shutdown(info);
|
||||||
free(re);
|
free(re);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -860,9 +880,7 @@ eng_setup(Evas *evas, void *in)
|
||||||
{
|
{
|
||||||
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
||||||
{
|
{
|
||||||
if ((info->info.gbm != eng_get_ob(re)->gbm) ||
|
if ((info->info.depth != eng_get_ob(re)->depth) ||
|
||||||
(info->info.surface != eng_get_ob(re)->surface) ||
|
|
||||||
(info->info.depth != eng_get_ob(re)->depth) ||
|
|
||||||
(info->info.destination_alpha != eng_get_ob(re)->destination_alpha))
|
(info->info.destination_alpha != eng_get_ob(re)->destination_alpha))
|
||||||
{
|
{
|
||||||
Outbuf *ob, *ob_old;
|
Outbuf *ob, *ob_old;
|
||||||
|
@ -897,13 +915,6 @@ eng_setup(Evas *evas, void *in)
|
||||||
epd->output.w, epd->output.h,
|
epd->output.w, epd->output.h,
|
||||||
info->info.rotation,
|
info->info.rotation,
|
||||||
info->info.depth);
|
info->info.depth);
|
||||||
if (re->generic.software.tb)
|
|
||||||
evas_common_tilebuf_free(re->generic.software.tb);
|
|
||||||
re->generic.software.tb =
|
|
||||||
evas_common_tilebuf_new(epd->output.w, epd->output.h);
|
|
||||||
if (re->generic.software.tb)
|
|
||||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
|
||||||
TILESIZE, TILESIZE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -926,6 +937,14 @@ eng_setup(Evas *evas, void *in)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (re->generic.software.tb)
|
||||||
|
evas_common_tilebuf_free(re->generic.software.tb);
|
||||||
|
re->generic.software.tb =
|
||||||
|
evas_common_tilebuf_new(epd->output.w, epd->output.h);
|
||||||
|
if (re->generic.software.tb)
|
||||||
|
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||||
|
TILESIZE, TILESIZE);
|
||||||
|
|
||||||
if (re->generic.software.tb)
|
if (re->generic.software.tb)
|
||||||
evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
|
evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
|
||||||
|
|
||||||
|
@ -952,11 +971,11 @@ eng_output_free(void *data)
|
||||||
|
|
||||||
if (gl_wins == 1) glsym_evgl_engine_shutdown(re);
|
if (gl_wins == 1) glsym_evgl_engine_shutdown(re);
|
||||||
|
|
||||||
eng_gbm_shutdown(eng_get_ob(re)->info);
|
|
||||||
|
|
||||||
/* NB: evas_render_engine_software_generic_clean() frees ob */
|
/* NB: evas_render_engine_software_generic_clean() frees ob */
|
||||||
evas_render_engine_software_generic_clean(&re->generic.software);
|
evas_render_engine_software_generic_clean(&re->generic.software);
|
||||||
|
|
||||||
|
eng_gbm_shutdown(eng_get_ob(re)->info);
|
||||||
|
|
||||||
gl_wins--;
|
gl_wins--;
|
||||||
|
|
||||||
free(re);
|
free(re);
|
||||||
|
@ -1217,21 +1236,6 @@ eng_image_native_set(void *data, void *image, void *native)
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
|
||||||
eng_gl_current_context_get(void *data EINA_UNUSED)
|
|
||||||
{
|
|
||||||
EVGL_Context *ctx;
|
|
||||||
EVGLNative_Context context;
|
|
||||||
|
|
||||||
ctx = glsym_evas_gl_common_current_context_get();
|
|
||||||
if (!ctx) return NULL;
|
|
||||||
|
|
||||||
context = glsym_evgl_current_native_context_get(ctx);
|
|
||||||
if (eglGetCurrentContext() == context) return ctx;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* module api functions */
|
/* module api functions */
|
||||||
static int
|
static int
|
||||||
module_open(Evas_Module *em)
|
module_open(Evas_Module *em)
|
||||||
|
@ -1267,7 +1271,6 @@ module_open(Evas_Module *em)
|
||||||
EVAS_API_OVERRIDE(output_free, &func, eng_);
|
EVAS_API_OVERRIDE(output_free, &func, eng_);
|
||||||
EVAS_API_OVERRIDE(output_dump, &func, eng_);
|
EVAS_API_OVERRIDE(output_dump, &func, eng_);
|
||||||
EVAS_API_OVERRIDE(image_native_set, &func, eng_);
|
EVAS_API_OVERRIDE(image_native_set, &func, eng_);
|
||||||
EVAS_API_OVERRIDE(gl_current_context_get, &func, eng_);
|
|
||||||
|
|
||||||
/* Mesa's EGL driver loads wayland egl by default. (called by eglGetProcaddr() )
|
/* Mesa's EGL driver loads wayland egl by default. (called by eglGetProcaddr() )
|
||||||
* implicit env set (EGL_PLATFORM=drm) prevent that. */
|
* implicit env set (EGL_PLATFORM=drm) prevent that. */
|
||||||
|
|
|
@ -5,6 +5,29 @@ static Outbuf *_evas_gl_drm_window = NULL;
|
||||||
static EGLContext context = EGL_NO_CONTEXT;
|
static EGLContext context = EGL_NO_CONTEXT;
|
||||||
static int win_count = 0;
|
static int win_count = 0;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_outbuf_gbm_surface_destroy(Outbuf *ob)
|
||||||
|
{
|
||||||
|
if (!ob) return;
|
||||||
|
if (ob->surface)
|
||||||
|
{
|
||||||
|
gbm_surface_destroy(ob->surface);
|
||||||
|
ob->surface = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_outbuf_gbm_surface_create(Outbuf *ob, int w, int h)
|
||||||
|
{
|
||||||
|
if (!ob) return;
|
||||||
|
|
||||||
|
ob->surface =
|
||||||
|
gbm_surface_create(ob->info->info.gbm, w, h,
|
||||||
|
ob->info->info.format, ob->info->info.flags);
|
||||||
|
|
||||||
|
if (!ob->surface) ERR("Failed to create gbm surface: %m");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evas_outbuf_fb_cb_destroy(struct gbm_bo *bo, void *data)
|
_evas_outbuf_fb_cb_destroy(struct gbm_bo *bo, void *data)
|
||||||
{
|
{
|
||||||
|
@ -129,8 +152,8 @@ _evas_outbuf_egl_setup(Outbuf *ob)
|
||||||
{
|
{
|
||||||
int ctx_attr[3];
|
int ctx_attr[3];
|
||||||
int cfg_attr[40];
|
int cfg_attr[40];
|
||||||
int maj = 0, min = 0;
|
int maj = 0, min = 0, n = 0;
|
||||||
int ncfg = 0, n = 0;
|
EGLint ncfg;
|
||||||
const GLubyte *vendor, *renderer, *version, *glslversion;
|
const GLubyte *vendor, *renderer, *version, *glslversion;
|
||||||
Eina_Bool blacklist = EINA_FALSE;
|
Eina_Bool blacklist = EINA_FALSE;
|
||||||
|
|
||||||
|
@ -139,22 +162,27 @@ _evas_outbuf_egl_setup(Outbuf *ob)
|
||||||
ctx_attr[1] = 2;
|
ctx_attr[1] = 2;
|
||||||
ctx_attr[2] = EGL_NONE;
|
ctx_attr[2] = EGL_NONE;
|
||||||
|
|
||||||
|
/* cfg_attr[n++] = EGL_BUFFER_SIZE; */
|
||||||
|
/* cfg_attr[n++] = 32; */
|
||||||
cfg_attr[n++] = EGL_SURFACE_TYPE;
|
cfg_attr[n++] = EGL_SURFACE_TYPE;
|
||||||
cfg_attr[n++] = EGL_WINDOW_BIT;
|
cfg_attr[n++] = EGL_WINDOW_BIT;
|
||||||
|
cfg_attr[n++] = EGL_RENDERABLE_TYPE;
|
||||||
|
cfg_attr[n++] = EGL_OPENGL_ES2_BIT;
|
||||||
|
#if 0
|
||||||
cfg_attr[n++] = EGL_RED_SIZE;
|
cfg_attr[n++] = EGL_RED_SIZE;
|
||||||
cfg_attr[n++] = 1;
|
cfg_attr[n++] = 1;
|
||||||
cfg_attr[n++] = EGL_GREEN_SIZE;
|
cfg_attr[n++] = EGL_GREEN_SIZE;
|
||||||
cfg_attr[n++] = 1;
|
cfg_attr[n++] = 1;
|
||||||
cfg_attr[n++] = EGL_BLUE_SIZE;
|
cfg_attr[n++] = EGL_BLUE_SIZE;
|
||||||
cfg_attr[n++] = 1;
|
cfg_attr[n++] = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
cfg_attr[n++] = EGL_ALPHA_SIZE;
|
cfg_attr[n++] = EGL_ALPHA_SIZE;
|
||||||
if (ob->destination_alpha) cfg_attr[n++] = 1;
|
if (ob->destination_alpha) cfg_attr[n++] = 1;
|
||||||
else cfg_attr[n++] = 0;
|
else cfg_attr[n++] = 0;
|
||||||
cfg_attr[n++] = EGL_RENDERABLE_TYPE;
|
|
||||||
cfg_attr[n++] = EGL_OPENGL_ES2_BIT;
|
|
||||||
cfg_attr[n++] = EGL_NONE;
|
cfg_attr[n++] = EGL_NONE;
|
||||||
|
|
||||||
ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)(ob->gbm));
|
ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm);
|
||||||
if (ob->egl.disp == EGL_NO_DISPLAY)
|
if (ob->egl.disp == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
ERR("eglGetDisplay() fail. code=%#x", eglGetError());
|
ERR("eglGetDisplay() fail. code=%#x", eglGetError());
|
||||||
|
@ -243,8 +271,6 @@ _evas_outbuf_egl_setup(Outbuf *ob)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eng_gl_symbols(); */
|
|
||||||
|
|
||||||
ob->gl_context = glsym_evas_gl_common_context_new();
|
ob->gl_context = glsym_evas_gl_common_context_new();
|
||||||
if (!ob->gl_context) return EINA_FALSE;
|
if (!ob->gl_context) return EINA_FALSE;
|
||||||
|
|
||||||
|
@ -268,6 +294,8 @@ evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_
|
||||||
Outbuf *ob;
|
Outbuf *ob;
|
||||||
char *num;
|
char *num;
|
||||||
|
|
||||||
|
if (!info) return NULL;
|
||||||
|
|
||||||
/* try to allocate space for outbuf */
|
/* try to allocate space for outbuf */
|
||||||
if (!(ob = calloc(1, sizeof(Outbuf)))) return NULL;
|
if (!(ob = calloc(1, sizeof(Outbuf)))) return NULL;
|
||||||
|
|
||||||
|
@ -280,8 +308,6 @@ evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_
|
||||||
ob->rotation = info->info.rotation;
|
ob->rotation = info->info.rotation;
|
||||||
ob->destination_alpha = info->info.destination_alpha;
|
ob->destination_alpha = info->info.destination_alpha;
|
||||||
/* ob->vsync = info->info.vsync; */
|
/* ob->vsync = info->info.vsync; */
|
||||||
ob->gbm = info->info.gbm;
|
|
||||||
ob->surface = info->info.surface;
|
|
||||||
ob->swap_mode = swap_mode;
|
ob->swap_mode = swap_mode;
|
||||||
ob->priv.num = 2;
|
ob->priv.num = 2;
|
||||||
|
|
||||||
|
@ -295,6 +321,11 @@ evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_
|
||||||
if ((num = getenv("EVAS_GL_DRM_VSYNC")))
|
if ((num = getenv("EVAS_GL_DRM_VSYNC")))
|
||||||
ob->vsync = atoi(num);
|
ob->vsync = atoi(num);
|
||||||
|
|
||||||
|
if ((ob->rotation == 0) || (ob->rotation == 180))
|
||||||
|
_evas_outbuf_gbm_surface_create(ob, w, h);
|
||||||
|
else if ((ob->rotation == 90) || (ob->rotation == 270))
|
||||||
|
_evas_outbuf_gbm_surface_create(ob, h, w);
|
||||||
|
|
||||||
if (!_evas_outbuf_egl_setup(ob))
|
if (!_evas_outbuf_egl_setup(ob))
|
||||||
{
|
{
|
||||||
evas_outbuf_free(ob);
|
evas_outbuf_free(ob);
|
||||||
|
@ -328,13 +359,7 @@ evas_outbuf_free(Outbuf *ob)
|
||||||
if (ob->egl.surface[0] != EGL_NO_SURFACE)
|
if (ob->egl.surface[0] != EGL_NO_SURFACE)
|
||||||
eglDestroySurface(ob->egl.disp, ob->egl.surface[0]);
|
eglDestroySurface(ob->egl.disp, ob->egl.surface[0]);
|
||||||
|
|
||||||
//#if 0
|
_evas_outbuf_gbm_surface_destroy(ob);
|
||||||
if (ob->surface)
|
|
||||||
{
|
|
||||||
gbm_surface_destroy(ob->surface);
|
|
||||||
ob->info->info.surface = NULL;
|
|
||||||
}
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
if (ref == 0)
|
if (ref == 0)
|
||||||
{
|
{
|
||||||
|
@ -435,7 +460,7 @@ evas_outbuf_unsurf(Outbuf *ob)
|
||||||
void
|
void
|
||||||
evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth)
|
evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth)
|
||||||
{
|
{
|
||||||
/* if (depth == OUTBUF_DEPTH_INHERIT) depth = ob->depth; */
|
if (depth == OUTBUF_DEPTH_INHERIT) depth = ob->depth;
|
||||||
|
|
||||||
/* check for changes */
|
/* check for changes */
|
||||||
/* if ((ob->w == w) && (ob->h == h) && */
|
/* if ((ob->w == w) && (ob->h == h) && */
|
||||||
|
@ -447,10 +472,16 @@ evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth)
|
||||||
ob->h = h;
|
ob->h = h;
|
||||||
ob->depth = depth;
|
ob->depth = depth;
|
||||||
ob->rotation = rot;
|
ob->rotation = rot;
|
||||||
|
|
||||||
|
/* _evas_outbuf_gbm_surface_destroy(ob); */
|
||||||
|
|
||||||
|
/* if ((ob->rotation == 0) || (ob->rotation == 180)) */
|
||||||
|
/* _evas_outbuf_gbm_surface_create(ob, w, h); */
|
||||||
|
/* else if ((ob->rotation == 90) || (ob->rotation == 270)) */
|
||||||
|
/* _evas_outbuf_gbm_surface_create(ob, h, w); */
|
||||||
|
|
||||||
evas_outbuf_use(ob);
|
evas_outbuf_use(ob);
|
||||||
glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);
|
glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);
|
||||||
|
|
||||||
//TODO: need drm gbm surface destroy & re-create.?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Render_Engine_Swap_Mode
|
Render_Engine_Swap_Mode
|
||||||
|
@ -486,7 +517,6 @@ evas_outbuf_buffer_state_get(Outbuf *ob)
|
||||||
(ob->priv.last > ob->priv.last ?
|
(ob->priv.last > ob->priv.last ?
|
||||||
0 : ob->priv.num)) % ob->priv.num;
|
0 : ob->priv.num)) % ob->priv.num;
|
||||||
|
|
||||||
/* This is the number of frame since last frame */
|
|
||||||
switch (delta)
|
switch (delta)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -514,14 +544,14 @@ evas_outbuf_rot_get(Outbuf *ob)
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
evas_outbuf_update_region_first_rect(Outbuf *ob)
|
evas_outbuf_update_region_first_rect(Outbuf *ob)
|
||||||
{
|
{
|
||||||
ob->gl_context->preserve_bit = GL_COLOR_BUFFER_BIT0_QCOM;
|
/* ob->gl_context->preserve_bit = GL_COLOR_BUFFER_BIT0_QCOM; */
|
||||||
|
|
||||||
glsym_evas_gl_preload_render_lock(_evas_outbuf_make_current, ob);
|
glsym_evas_gl_preload_render_lock(_evas_outbuf_make_current, ob);
|
||||||
evas_outbuf_use(ob);
|
evas_outbuf_use(ob);
|
||||||
|
|
||||||
if (!_re_wincheck(ob)) return EINA_TRUE;
|
if (!_re_wincheck(ob)) return EINA_TRUE;
|
||||||
|
|
||||||
glsym_evas_gl_common_context_resize(ob->gl_context, ob->w, ob->h, ob->rotation);
|
/* glsym_evas_gl_common_context_resize(ob->gl_context, ob->w, ob->h, ob->rotation); */
|
||||||
glsym_evas_gl_common_context_flush(ob->gl_context);
|
glsym_evas_gl_common_context_flush(ob->gl_context);
|
||||||
glsym_evas_gl_common_context_newframe(ob->gl_context);
|
glsym_evas_gl_common_context_newframe(ob->gl_context);
|
||||||
|
|
||||||
|
@ -584,7 +614,7 @@ evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode
|
||||||
ob->info->callback.pre_swap(ob->info->callback.data, ob->evas);
|
ob->info->callback.pre_swap(ob->info->callback.data, ob->evas);
|
||||||
|
|
||||||
// TODO: Check eglSwapBuffersWithDamage for gl_drm and apply
|
// TODO: Check eglSwapBuffersWithDamage for gl_drm and apply
|
||||||
//#if 0
|
#if 0
|
||||||
if ((glsym_eglSwapBuffersWithDamage) && (ob->swap_mode != MODE_FULL))
|
if ((glsym_eglSwapBuffersWithDamage) && (ob->swap_mode != MODE_FULL))
|
||||||
{
|
{
|
||||||
EGLint num = 0, *result = NULL, i = 0;
|
EGLint num = 0, *result = NULL, i = 0;
|
||||||
|
@ -641,7 +671,7 @@ evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
//#endif
|
#endif
|
||||||
eglSwapBuffers(ob->egl.disp, ob->egl.surface[0]);
|
eglSwapBuffers(ob->egl.disp, ob->egl.surface[0]);
|
||||||
|
|
||||||
if (ob->info->callback.post_swap)
|
if (ob->info->callback.post_swap)
|
||||||
|
@ -699,6 +729,13 @@ error:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_outbuf_gl_context_free(Context_3D *ctx)
|
||||||
|
{
|
||||||
|
eglDestroyContext(ctx->display, ctx->context);
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_outbuf_gl_context_use(Context_3D *ctx)
|
evas_outbuf_gl_context_use(Context_3D *ctx)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue