This is for wayland_egl backend.
please refer https://phab.enlightenment.org/D2144
Change-Id: Ifd88dc50ef335013e33c1e123acb8a19182f5646
ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2
} Ecore_Evas_Object_Associate_Flags;
+#define ECORE_EVAS_OPT_NONE 0
+#define ECORE_EVAS_OPT_INDIRECT 1
+#define ECORE_EVAS_OPT_VSYNC 2
+#define ECORE_EVAS_OPT_SWAP_MODE 3
+#define ECORE_EVAS_OPT_GL_DEPTH 4
+#define ECORE_EVAS_OPT_GL_STENCIL 5
+#define ECORE_EVAS_OPT_GL_MSAA 6
+#define ECORE_EVAS_OPT_LAST 7
+
+#define ECORE_EVAS_SWAP_MODE_AUTO 0
+#define ECORE_EVAS_SWAP_MODE_FULL 1
+#define ECORE_EVAS_SWAP_MODE_COPY 2
+#define ECORE_EVAS_SWAP_MODE_DOUBLE 3
+#define ECORE_EVAS_SWAP_MODE_TRIPLE 4
+#define ECORE_EVAS_SWAP_MODE_QUADRUPLE 5
+
/* module setup/shutdown calls */
EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine);
*/
EAPI Ecore_X_Pixmap ecore_evas_software_x11_pixmap_get(const Ecore_Evas *ee);
-#define ECORE_EVAS_GL_X11_OPT_NONE 0
-#define ECORE_EVAS_GL_X11_OPT_INDIRECT 1
-#define ECORE_EVAS_GL_X11_OPT_VSYNC 2
-#define ECORE_EVAS_GL_X11_OPT_SWAP_MODE 3
-#define ECORE_EVAS_GL_X11_OPT_GL_DEPTH 4
-#define ECORE_EVAS_GL_X11_OPT_GL_STENCIL 5
-#define ECORE_EVAS_GL_X11_OPT_GL_MSAA 6
-#define ECORE_EVAS_GL_X11_OPT_LAST 7
+#define ECORE_EVAS_GL_X11_OPT_NONE ECORE_EVAS_OPT_NONE
+#define ECORE_EVAS_GL_X11_OPT_INDIRECT ECORE_EVAS_OPT_INDIRECT
+#define ECORE_EVAS_GL_X11_OPT_VSYNC ECORE_EVAS_OPT_VSYNC
+#define ECORE_EVAS_GL_X11_OPT_SWAP_MODE ECORE_EVAS_OPT_SWAP_MODE
+#define ECORE_EVAS_GL_X11_OPT_GL_DEPTH ECORE_EVAS_OPT_GL_DEPTH
+#define ECORE_EVAS_GL_X11_OPT_GL_STENCIL ECORE_EVAS_OPT_GL_STENCIL
+#define ECORE_EVAS_GL_X11_OPT_GL_MSAA ECORE_EVAS_OPT_GL_MSAA
+#define ECORE_EVAS_GL_X11_OPT_LAST ECORE_EVAS_OPT_LAST
-#define ECORE_EVAS_GL_X11_SWAP_MODE_AUTO 0
-#define ECORE_EVAS_GL_X11_SWAP_MODE_FULL 1
-#define ECORE_EVAS_GL_X11_SWAP_MODE_COPY 2
-#define ECORE_EVAS_GL_X11_SWAP_MODE_DOUBLE 3
-#define ECORE_EVAS_GL_X11_SWAP_MODE_TRIPLE 4
+#define ECORE_EVAS_GL_X11_SWAP_MODE_AUTO ECORE_EVAS_SWAP_MODE_AUTO
+#define ECORE_EVAS_GL_X11_SWAP_MODE_FULL ECORE_EVAS_SWAP_MODE_FULL
+#define ECORE_EVAS_GL_X11_SWAP_MODE_COPY ECORE_EVAS_SWAP_MODE_COPY
+#define ECORE_EVAS_GL_X11_SWAP_MODE_DOUBLE ECORE_EVAS_SWAP_MODE_DOUBLE
+#define ECORE_EVAS_GL_X11_SWAP_MODE_TRIPLE ECORE_EVAS_SWAP_MODE_TRIPLE
/**
* @brief Create Ecore_Evas using opengl x11.
EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame);
EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame);
+EAPI Ecore_Evas *ecore_evas_wayland_egl_options_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame, const int *opt);
EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
EAPI void ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y);
return new(disp_name, parent, x, y, w, h, frame);
}
+EAPI Ecore_Evas *
+ecore_evas_wayland_egl_options_new(const char *disp_name, unsigned int parent,
+ int x, int y, int w, int h, Eina_Bool frame, const int *opt)
+{
+ Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int, Eina_Bool, const int *);
+ Eina_Module *m = _ecore_evas_engine_load("wayland");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
+
+ new = eina_module_symbol_get(m, "ecore_evas_wayland_egl_options_new_internal");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
+
+ return new(disp_name, parent, x, y, w, h, frame, opt);
+}
+
EAPI void
ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
{
/* external functions */
EAPI Ecore_Evas *
-ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
- int x, int y, int w, int h, Eina_Bool frame)
+ecore_evas_wayland_egl_options_new_internal(const char *disp_name, unsigned int parent,
+ int x, int y, int w, int h, Eina_Bool frame, const int *opt)
{
Ecore_Wl_Window *p = NULL;
Ecore_Wl_Global *global;
if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
{
+ if (opt)
+ {
+ int op;
+
+ for (op = 0; opt[op]; op++)
+ {
+ if (opt[op] == ECORE_EVAS_OPT_VSYNC)
+ {
+ op++;
+ einfo->vsync = opt[op];
+ }
+#ifdef EVAS_ENGINE_WAYLAND_EGL_SWAP_MODE_EXISTS
+ else if (opt[op] == ECORE_EVAS_OPT_SWAP_MODE)
+ {
+ op++;
+ einfo->swap_mode = opt[op];
+ }
+#endif
+ else if (opt[op] == ECORE_EVAS_OPT_GL_DEPTH)
+ {
+ op++;
+ einfo->depth_bits = opt[op];
+ }
+ else if (opt[op] == ECORE_EVAS_OPT_GL_STENCIL)
+ {
+ op++;
+ einfo->stencil_bits = opt[op];
+ }
+ else if (opt[op] == ECORE_EVAS_OPT_GL_MSAA)
+ {
+ op++;
+ einfo->msaa_bits = opt[op];
+ }
+ }
+ }
+
einfo->info.display = ecore_wl_display_get();
einfo->info.compositor = ecore_wl_compositor_get();
einfo->info.destination_alpha = EINA_TRUE;
return NULL;
}
+EAPI Ecore_Evas *
+ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
+ int x, int y, int w, int h, Eina_Bool frame)
+{
+ return ecore_evas_wayland_egl_options_new_internal(disp_name, parent, x, y, w, h, frame, NULL);
+}
+
static void
_ecore_evas_wl_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
{
Eina_Bool vsync : 1;
Eina_Bool indirect : 1;
unsigned char swap_mode : 4;
+
+ /* window surface should be made with these config */
+ int depth_bits;
+ int stencil_bits;
+ int msaa_bits;
};
#endif
return 1;
}
+static void
+evgl_eng_native_win_surface_config_get(void *data, int *win_depth,
+ int *win_stencil, int *win_msaa)
+{
+ Render_Engine *re = data;
+ if (!re) return;
+
+ if (win_depth)
+ *win_depth = eng_get_ob(re)->detected.depth_buffer_size;
+ if (win_stencil)
+ *win_stencil = eng_get_ob(re)->detected.stencil_buffer_size;
+ if (win_msaa)
+ *win_msaa = eng_get_ob(re)->detected.msaa;
+
+ DBG("Window config(depth %d, stencil %d, msaa %d)",
+ eng_get_ob(re)->detected.depth_buffer_size,
+ eng_get_ob(re)->detected.stencil_buffer_size,
+ eng_get_ob(re)->detected.msaa);
+}
+
static const EVGL_Interface evgl_funcs =
{
evgl_eng_display_get,
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
- NULL, // native_win_surface_config_get
+ evgl_eng_native_win_surface_config_get,
};
/* engine functions */
glsym_evas_gl_preload_init();
}
- ob = eng_window_new(evas, inf, epd->output.w, epd->output.h, swap_mode);
+ ob = eng_window_new(evas, inf, epd->output.w, epd->output.h, swap_mode,
+ inf->depth_bits, inf->stencil_bits, inf->msaa_bits);
if (!ob) goto ob_err;
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
ob->gl_context->references++;
gl_wins--;
- ob = eng_window_new(evas, inf, epd->output.w, epd->output.h, swap_mode);
+ ob = eng_window_new(evas, inf, epd->output.w, epd->output.h, swap_mode,
+ inf->depth_bits, inf->stencil_bits, inf->msaa_bits);
if (!ob) goto ob_err;
eng_window_use(ob);
Eina_Bool lost_back : 1;
Eina_Bool surf : 1;
+
+ struct {
+ unsigned char depth_buffer_size;
+ unsigned char stencil_buffer_size;
+ unsigned char msaa;
+ } detected;
+
+ int depth_bits;
+ int stencil_bits;
+ int msaa_bits;
};
struct _Context_3D
extern unsigned int (*glsym_eglSwapBuffersWithDamage) (EGLDisplay a, void *b, const EGLint *d, EGLint c);
extern unsigned int (*glsym_eglSetDamageRegionKHR) (EGLDisplay a, EGLSurface b, EGLint *c, EGLint d);
-Outbuf *eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Render_Engine_Swap_Mode swap_mode);
+Outbuf *eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Render_Engine_Swap_Mode swap_mode,
+ int depth_bits, int stencil_bits, int msaa_bits);
void eng_window_free(Outbuf *gw);
void eng_window_use(Outbuf *gw);
void eng_window_unsurf(Outbuf *gw);
static int win_count = 0;
Outbuf *
-eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Render_Engine_Swap_Mode swap_mode)
+eng_window_new(Evas *evas, Evas_Engine_Info_Wayland_Egl *einfo, int w, int h, Render_Engine_Swap_Mode swap_mode,
+ int depth_bits, int stencil_bits, int msaa_bits)
{
Outbuf *gw;
int context_attrs[3];
int num_config, n = 0;
const GLubyte *vendor, *renderer, *version;
Eina_Bool blacklist = EINA_FALSE;
+ int val = 0;
/* try to allocate space for our window */
if (!(gw = calloc(1, sizeof(Outbuf))))
gw->depth = einfo->info.depth;
gw->alpha = einfo->info.destination_alpha;
gw->rot = einfo->info.rotation;
+ gw->depth_bits = depth_bits;
+ gw->stencil_bits = stencil_bits;
+ gw->msaa_bits = msaa_bits;
context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
context_attrs[1] = 2;
config_attrs[n++] = EGL_ALPHA_SIZE;
config_attrs[n++] = gw->alpha;
config_attrs[n++] = EGL_DEPTH_SIZE;
- config_attrs[n++] = 0;
+ config_attrs[n++] = gw->depth_bits;
config_attrs[n++] = EGL_STENCIL_SIZE;
- config_attrs[n++] = 0;
+ config_attrs[n++] = gw->stencil_bits;
+ if (msaa_bits > 0)
+ {
+ config_attrs[n++] = EGL_SAMPLE_BUFFERS;
+ config_attrs[n++] = 1;
+ config_attrs[n++] = EGL_SAMPLES;
+ config_attrs[n++] = gw->msaa_bits;
+ }
config_attrs[n++] = EGL_NONE;
/* FIXME: Remove this line as soon as eglGetDisplay() autodetection
return NULL;
}
+ eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_DEPTH_SIZE, &val);
+ gw->detected.depth_buffer_size = val;
+ DBG("Detected depth size %d", val);
+ eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_STENCIL_SIZE, &val);
+ gw->detected.stencil_buffer_size = val;
+ DBG("Detected stencil size %d", val);
+ eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_SAMPLES, &val);
+ gw->detected.msaa = val;
+ DBG("Detected msaa %d", val);
+
if (!(gw->gl_context = glsym_evas_gl_common_context_new()))
{
eng_window_free(gw);