From ac6ceb0b99282be4059e5fcae4d4ca0e6f022736 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 8 Aug 2019 23:54:09 +0100 Subject: [PATCH] reduce getenv calls by only getting once we do egetvn's quite frequently and this is more costly than remembering once and getting it once... fix that in some cases. --- src/bin/e_config.c | 9 +++++++-- src/bin/e_pixmap.c | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 0be0d7795..521e7c4e7 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -2049,9 +2049,14 @@ e_config_profile_save(void) char buf[4096], buf2[4096]; const char *s; int ok = 0; + static signed char nosave = -1; - if ((s = getenv("E_CONF_PROFILE_NOSAVE")) && atoi(s)) - return 1; + if (nosave == -1) + { + if ((s = getenv("E_CONF_PROFILE_NOSAVE")) && atoi(s)) nosave = 1; + else nosave = 0; + } + if (nosave == 1) return 1; /* FIXME: check for other sessions fo E running */ e_user_dir_concat_static(buf, "config/profile.cfg"); diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index 1850e5632..8feed3d39 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -796,11 +796,17 @@ e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns) if (!cp->buffer) return EINA_FALSE; if (cp->buffer->dmabuf_buffer) { + static signed char use_hw_planes = -1; ns->type = EVAS_NATIVE_SURFACE_WL_DMABUF; ns->data.wl_dmabuf.attr = &cp->buffer->dmabuf_buffer->attributes; ns->data.wl_dmabuf.resource = cp->buffer->resource; - if (getenv("E_USE_HARDWARE_PLANES")) + if (use_hw_planes == -1) + { + if (getenv("E_USE_HARDWARE_PLANES")) use_hw_planes = 1; + else use_hw_planes = 0; + } + if (use_hw_planes) { ns->data.wl_dmabuf.scanout.handler = _e_pixmap_scanout_handler; ns->data.wl_dmabuf.scanout.data = cp->buffer;