From: Hermet Park Date: Thu, 25 Apr 2019 09:41:43 +0000 (+0900) Subject: evas wayland_egl: set up config depth/stencil/msaa properly. X-Git-Tag: accepted/tizen/unified/20190429.103734~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F204744%2F4;p=platform%2Fupstream%2Fefl.git evas wayland_egl: set up config depth/stencil/msaa properly. Change-Id: I8c1c0af0efa10f1536f292609e6266ff892e4544 --- diff --git a/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h b/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h index 0c7bc00..2dddfc4 100755 --- a/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h +++ b/src/modules/evas/engines/wayland_common/Evas_Engine_Wayland.h @@ -39,18 +39,18 @@ struct _Evas_Engine_Info_Wayland int x_cursor, y_cursor; int resizing; uint32_t timestamp; + /* window surface should be made with these config */ + int depth_bits; + int stencil_bits; + int msaa_bits; + + //TIZEN_ONLY(20171115): support output transform + int window_rotation; + Eina_Bool dragging : 1; Eina_Bool drag_start : 1; Eina_Bool drag_stop : 1; Eina_Bool drag_ack : 1; - - //TIZEN_ONLY(20171115): support output transform - int window_rotation; - // - /* window surface should be made with these config */ - int depth_bits; - int stencil_bits; - int msaa_bits; }; #endif diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.h b/src/modules/evas/engines/wayland_egl/evas_engine.h index a57085b..889163d 100755 --- a/src/modules/evas/engines/wayland_egl/evas_engine.h +++ b/src/modules/evas/engines/wayland_egl/evas_engine.h @@ -70,7 +70,7 @@ struct _Outbuf int vsync; int frame_cnt; - struct + struct { Eina_Bool drew : 1; } draw; @@ -81,9 +81,6 @@ struct _Outbuf EGLDisplay egl_disp; EGLSyncKHR egl_fence; - Eina_Bool lost_back : 1; - Eina_Bool surf : 1; - struct { unsigned char depth_buffer_size; unsigned char stencil_buffer_size; @@ -96,6 +93,9 @@ struct _Outbuf //TIZEN_ONLY(20161121) : Support PreRotation int support_pre_rotation; + + Eina_Bool lost_back : 1; + Eina_Bool surf : 1; }; struct _Context_3D diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c b/src/modules/evas/engines/wayland_egl/evas_wl_main.c index 7bf4051..73d6fcc 100755 --- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c +++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c @@ -92,17 +92,15 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap int context_attrs[3]; int config_attrs[40]; int major_version, minor_version; - int num_config, n = 0; + int num_config, n; const GLubyte *vendor, *renderer, *version; Eina_Bool blacklist = EINA_FALSE; struct wl_display *wl_disp; + int val = 0; //TIZEN_ONLY(20171123) : bug fixed : using wl_surface struct wl_surface *wl_surface; -// -//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach - int val = 0; -// + /* try to allocate space for our window */ if (!(gw = calloc(1, sizeof(Outbuf)))) return NULL; @@ -120,6 +118,9 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap gw->depth = einfo->info.depth; gw->alpha = einfo->info.destination_alpha; gw->rot = einfo->info.rotation; + gw->depth_bits = einfo->depth_bits; + gw->stencil_bits = einfo->stencil_bits; + gw->msaa_bits = einfo->msaa_bits; //TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach gw->depth_bits = einfo->depth_bits; @@ -134,40 +135,6 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap context_attrs[1] = 2; context_attrs[2] = EGL_NONE; - config_attrs[n++] = EGL_SURFACE_TYPE; - config_attrs[n++] = EGL_WINDOW_BIT; - config_attrs[n++] = EGL_RENDERABLE_TYPE; - config_attrs[n++] = EGL_OPENGL_ES2_BIT; - - config_attrs[n++] = EGL_RED_SIZE; - config_attrs[n++] = 1; - config_attrs[n++] = EGL_GREEN_SIZE; - config_attrs[n++] = 1; - config_attrs[n++] = EGL_BLUE_SIZE; - config_attrs[n++] = 1; - - config_attrs[n++] = EGL_ALPHA_SIZE; - config_attrs[n++] = 8 * !!gw->alpha; - config_attrs[n++] = EGL_DEPTH_SIZE; -//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach -// config_attrs[n++] = 0; - config_attrs[n++] = gw->depth_bits; -// - config_attrs[n++] = EGL_STENCIL_SIZE; - -//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach -// config_attrs[n++] = 0; - config_attrs[n++] = gw->stencil_bits; - if (gw->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 * gets fixed. Currently it is incorrectly detecting wl_display and * returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND. @@ -197,11 +164,65 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap return NULL; } +try_again: + n = 0; + config_attrs[n++] = EGL_SURFACE_TYPE; + config_attrs[n++] = EGL_WINDOW_BIT; + config_attrs[n++] = EGL_RENDERABLE_TYPE; + config_attrs[n++] = EGL_OPENGL_ES2_BIT; + + config_attrs[n++] = EGL_RED_SIZE; + config_attrs[n++] = 1; + config_attrs[n++] = EGL_GREEN_SIZE; + config_attrs[n++] = 1; + config_attrs[n++] = EGL_BLUE_SIZE; + config_attrs[n++] = 1; + + config_attrs[n++] = EGL_ALPHA_SIZE; + config_attrs[n++] = 8 * !!gw->alpha; + config_attrs[n++] = EGL_DEPTH_SIZE; + config_attrs[n++] = gw->depth_bits; + config_attrs[n++] = EGL_STENCIL_SIZE; + config_attrs[n++] = gw->stencil_bits; + if (gw->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; + num_config = 0; if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config, 1, &num_config) || (num_config != 1)) { ERR("eglChooseConfig() fail. code=%#x", eglGetError()); + + if ((gw->depth_bits > 24) || (gw->stencil_bits > 8)) + { + WRN("Please note that your driver might not support 32-bit depth or " + "16-bit stencil buffers, so depth24, stencil8 are the maximum " + "recommended values."); + if (gw->depth_bits > 24) gw->depth_bits = 24; + if (gw->stencil_bits > 8) gw->stencil_bits = 8; + DBG("Trying again with depth:%d, stencil:%d", gw->depth_bits, gw->stencil_bits); + goto try_again; + } + else if (gw->msaa_bits) + { + gw->msaa_bits /= 2; + DBG("Trying again with msaa_samples: %d", gw->msaa_bits); + goto try_again; + } + else if (gw->depth_bits || gw->stencil_bits) + { + gw->depth_bits = 0; + gw->stencil_bits = 0; + DBG("Trying again without any depth or stencil buffer"); + goto try_again; + } + eng_window_free(gw); return NULL; } @@ -310,7 +331,6 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap return NULL; } -//TIZEN_ONLY(20171127): do not call ecore_wl2_window_buffer_attach eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_DEPTH_SIZE, &val); gw->detected.depth_buffer_size = val; DBG("Detected depth size %d", val); @@ -320,7 +340,6 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_SAMPLES, &val); gw->detected.msaa = val; DBG("Detected msaa %d", val); -// if (!gw->gl_context) { @@ -348,7 +367,7 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap return gw; } -void +void eng_window_free(Outbuf *gw) { Outbuf *wl_win;