forked from enlightenment/efl
wayland: stop creating 1x1 surfaces on init
fix T5226 #IGot99TicketsBut1x1AintOne
This commit is contained in:
parent
5070ecc99a
commit
93bac8ce4a
|
@ -184,9 +184,6 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
|||
wdata = ee->engine.data;
|
||||
if (!wdata) return;
|
||||
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
|
||||
ee->req.w = w;
|
||||
ee->req.h = h;
|
||||
|
||||
|
@ -2275,9 +2272,6 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, unsigned int parent, i
|
|||
ee->driver = engine_name;
|
||||
if (disp_name) ee->name = strdup(disp_name);
|
||||
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
|
||||
ee->x = x;
|
||||
ee->y = y;
|
||||
ee->w = w;
|
||||
|
|
|
@ -86,6 +86,7 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
|
|||
else if (ob->priv.num > 4) ob->priv.num = 4;
|
||||
}
|
||||
|
||||
if ((!w) || (!h)) return ob;
|
||||
for (i = 0; i < ob->priv.num; i++)
|
||||
{
|
||||
if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i])))
|
||||
|
@ -179,6 +180,7 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
|
|||
for (i = 0; i < ob->priv.num; i++)
|
||||
_outbuf_fb_destroy(&ob->priv.ofb[i]);
|
||||
|
||||
if ((!w) || (!h)) return;
|
||||
for (i = 0; i < ob->priv.num; i++)
|
||||
{
|
||||
if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i])))
|
||||
|
|
|
@ -701,7 +701,7 @@ eng_update(void *engine EINA_UNUSED, void *data, void *info, unsigned int w, uns
|
|||
return 1;
|
||||
}
|
||||
|
||||
if ((ob) && (_re_wincheck(ob)))
|
||||
if (ob)
|
||||
{
|
||||
ob->info = inf;
|
||||
if ((ob->info->info.wl_display != ob->disp) ||
|
||||
|
|
|
@ -101,22 +101,6 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Engine_Swap
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if ((gw->rot == 0) || (gw->rot == 180))
|
||||
gw->win = wl_egl_window_create(gw->surface, gw->w, gw->h);
|
||||
else if ((gw->rot == 90) || (gw->rot == 270))
|
||||
gw->win = wl_egl_window_create(gw->surface, gw->h, gw->w);
|
||||
|
||||
gw->egl_surface =
|
||||
eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
(EGLNativeWindowType)gw->win, NULL);
|
||||
if (gw->egl_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
|
||||
gw->win, eglGetError());
|
||||
eng_window_free(gw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gw->egl_context =
|
||||
eglCreateContext(gw->egl_disp, gw->egl_config, context, context_attrs);
|
||||
if (gw->egl_context == EGL_NO_CONTEXT)
|
||||
|
@ -128,14 +112,6 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Engine_Swap
|
|||
|
||||
if (context == EGL_NO_CONTEXT) context = gw->egl_context;
|
||||
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface,
|
||||
gw->egl_surface, gw->egl_context) == EGL_FALSE)
|
||||
{
|
||||
ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
|
||||
eng_window_free(gw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vendor = glGetString(GL_VENDOR);
|
||||
renderer = glGetString(GL_RENDERER);
|
||||
version = glGetString(GL_VERSION);
|
||||
|
@ -168,22 +144,29 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Engine_Swap
|
|||
return NULL;
|
||||
}
|
||||
|
||||
eng_gl_symbols(gw->egl_disp);
|
||||
|
||||
if (!(gw->gl_context = glsym_evas_gl_common_context_new()))
|
||||
if (w && h)
|
||||
eng_window_resurf(gw);
|
||||
else
|
||||
{
|
||||
eng_window_free(gw);
|
||||
return NULL;
|
||||
if (eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, gw->egl_context) == EGL_FALSE)
|
||||
{
|
||||
ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
|
||||
eng_window_free(gw);
|
||||
return NULL;
|
||||
}
|
||||
eng_gl_symbols(gw->egl_disp);
|
||||
|
||||
if (!(gw->gl_context = glsym_evas_gl_common_context_new()))
|
||||
{
|
||||
eng_window_free(gw);
|
||||
return NULL;
|
||||
}
|
||||
gw->gl_context->egldisp = gw->egl_disp;
|
||||
gw->gl_context->eglctxt = gw->egl_context;
|
||||
eng_window_use(gw);
|
||||
|
||||
}
|
||||
|
||||
gw->gl_context->egldisp = gw->egl_disp;
|
||||
gw->gl_context->eglctxt = gw->egl_context;
|
||||
|
||||
eng_window_use(gw);
|
||||
glsym_evas_gl_common_context_resize(gw->gl_context, w, h, gw->rot);
|
||||
|
||||
gw->surf = EINA_TRUE;
|
||||
|
||||
return gw;
|
||||
}
|
||||
|
||||
|
@ -298,11 +281,18 @@ eng_window_resurf(Outbuf *gw)
|
|||
{
|
||||
if (gw->surf) return;
|
||||
if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", gw);
|
||||
if ((!gw->w) || (!gw->h)) return;
|
||||
if (!gw->win)
|
||||
{
|
||||
if ((gw->rot == 0) || (gw->rot == 180))
|
||||
gw->win = wl_egl_window_create(gw->surface, gw->w, gw->h);
|
||||
else if ((gw->rot == 90) || (gw->rot == 270))
|
||||
gw->win = wl_egl_window_create(gw->surface, gw->h, gw->w);
|
||||
}
|
||||
|
||||
gw->egl_surface =
|
||||
eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
|
||||
(EGLNativeWindowType)gw->win, NULL);
|
||||
|
||||
if (gw->egl_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
ERR("eglCreateWindowSurface() fail for %p. code=%#x",
|
||||
|
@ -310,9 +300,12 @@ eng_window_resurf(Outbuf *gw)
|
|||
return;
|
||||
}
|
||||
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface, gw->egl_surface,
|
||||
gw->egl_context) == EGL_FALSE)
|
||||
ERR("eglMakeCurrent() failed!");
|
||||
if (eglMakeCurrent(gw->egl_disp, gw->egl_surface,
|
||||
gw->egl_surface, gw->egl_context) == EGL_FALSE)
|
||||
{
|
||||
ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
gw->surf = EINA_TRUE;
|
||||
}
|
||||
|
@ -323,6 +316,9 @@ eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth EIN
|
|||
ob->w = w;
|
||||
ob->h = h;
|
||||
ob->rot = rot;
|
||||
|
||||
if (!ob->win)
|
||||
eng_window_resurf(ob);
|
||||
eng_window_use(ob);
|
||||
glsym_evas_gl_common_context_resize(ob->gl_context, w, h, rot);
|
||||
|
||||
|
|
|
@ -562,20 +562,24 @@ _evas_dmabuf_surface_reconfigure(Surface *s, int w, int h, uint32_t flags EINA_U
|
|||
Dmabuf_Surface *surface;
|
||||
int i;
|
||||
|
||||
if ((!w) || (!h)) return;
|
||||
surface = s->surf.dmabuf;
|
||||
for (i = 0; i < surface->nbuf; i++)
|
||||
{
|
||||
Dmabuf_Buffer *b = surface->buffer[i];
|
||||
int stride = b->stride;
|
||||
|
||||
/* If stride is a little bigger than width we still fit */
|
||||
if (!force && (w >= b->w) && (w <= stride / 4) && (h == b->h))
|
||||
if (surface->buffer[i])
|
||||
{
|
||||
b->w = w;
|
||||
continue;
|
||||
}
|
||||
Dmabuf_Buffer *b = surface->buffer[i];
|
||||
int stride = b->stride;
|
||||
|
||||
_evas_dmabuf_buffer_destroy(b);
|
||||
/* If stride is a little bigger than width we still fit */
|
||||
if (!force && (w >= b->w) && (w <= stride / 4) && (h == b->h))
|
||||
{
|
||||
b->w = w;
|
||||
continue;
|
||||
}
|
||||
|
||||
_evas_dmabuf_buffer_destroy(b);
|
||||
}
|
||||
buf = _evas_dmabuf_buffer_init(surface, w, h);
|
||||
surface->buffer[i] = buf;
|
||||
if (!buf)
|
||||
|
@ -795,14 +799,17 @@ _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff)
|
|||
|
||||
if (!_buffer_manager_get()) goto err;
|
||||
|
||||
for (i = 0; i < num_buff; i++)
|
||||
if (w && h)
|
||||
{
|
||||
surf->buffer[i] = _evas_dmabuf_buffer_init(surf, w, h);
|
||||
if (!surf->buffer[i])
|
||||
for (i = 0; i < num_buff; i++)
|
||||
{
|
||||
DBG("Could not create buffers");
|
||||
/* _init() handled surface cleanup when it failed */
|
||||
return EINA_FALSE;
|
||||
surf->buffer[i] = _evas_dmabuf_buffer_init(surf, w, h);
|
||||
if (!surf->buffer[i])
|
||||
{
|
||||
DBG("Could not create buffers");
|
||||
/* _init() handled surface cleanup when it failed */
|
||||
return EINA_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -431,6 +431,7 @@ _evas_shm_surface_reconfigure(Surface *s, int w, int h, uint32_t flags, Eina_Boo
|
|||
surface->w = w;
|
||||
surface->h = h;
|
||||
|
||||
if ((!w) || (!h)) return;
|
||||
for (i = 0; i < surface->num_buff; i++)
|
||||
{
|
||||
if (surface->leaf[i].busy) continue;
|
||||
|
@ -600,13 +601,16 @@ _evas_shm_surface_create(Surface *s, int w, int h, int num_buff)
|
|||
surf->alpha = s->info->info.destination_alpha;
|
||||
surf->compositor_version = s->info->info.compositor_version;
|
||||
|
||||
/* create surface buffers */
|
||||
for (; i < surf->num_buff; i++)
|
||||
if (w && h)
|
||||
{
|
||||
if (!_shm_leaf_create(surf, &(surf->leaf[i]), w, h))
|
||||
/* create surface buffers */
|
||||
for (; i < surf->num_buff; i++)
|
||||
{
|
||||
ERR("Could not create surface leaf");
|
||||
goto err;
|
||||
if (!_shm_leaf_create(surf, &(surf->leaf[i]), w, h))
|
||||
{
|
||||
ERR("Could not create surface leaf");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue