The openmp can reduce time of memcpy about 30 ~ 50ms on the TM1 target.
Now, it is enabled only in the mobile 32bit target. Other profiles and
architectures should also have this feature after testing.
Change-Id: Ic2655bdbe8e2e348bc9c1081b75278c24f884b01
fi
fi
+# Check for libgomp
+libgomp=no
+AC_ARG_ENABLE([libgomp],
+ AS_HELP_STRING([--enable-libgomp], [enable libgomp @<:@default=disabled@:>@]),
+ [libgomp=$enableval],
+ [libgomp=no])
+AC_MSG_CHECKING([whether libgomp is enabled])
+AC_MSG_RESULT([${libgomp}])
+
+if test "x$libgomp" != "xno"; then
+ AC_DEFINE([HAVE_LIBGOMP], [1], [Enable libgomp])
+ have_libgomp=yes
+else
+ AC_DEFINE([HAVE_LIBGOMP], [0], [Disable libgomp])
+ have_libgomp=no
+fi
+AM_CONDITIONAL([HAVE_LIBGOMP], [test "x${have_libgomp}" = "xyes"])
+
# Check for ttrace header files
PKG_CHECK_MODULES(TTRACE,
[ttrace],
Source0: enlightenment-%{version}.tar.bz2
Source1001: enlightenment.manifest
+# use libgomp only in arm 32bit mobile
+%ifarch %{arm}
+%if "%{?profile}" == "mobile"
+%define LIBGOMP use
+%endif
+%endif
+
BuildRequires: eet-tools
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-creds-socket)
Requires: libwayland-extension-server
+%if "%{LIBGOMP}" == "use"
+Requires: libgomp
+%endif
%description
Enlightenment is a window manager.
--enable-function-trace \
--enable-wayland \
--enable-quick-init \
+%if "%{LIBGOMP}" == "use"
+ --enable-libgomp \
+%endif
--enable-hwc-multi
make %{?_smp_mflags}
src/bin/e_process.c
src_bin_enlightenment_CPPFLAGS = $(E_CPPFLAGS) -DEFL_BETA_API_SUPPORT -DEFL_EO_API_SUPPORT -DE_LOGGING=1 @WAYLAND_CFLAGS@ $(TTRACE_CFLAGS) $(DLOG_CFLAGS) $(POLICY_CFLAGS)
+if HAVE_LIBGOMP
+src_bin_enlightenment_CPPFLAGS += -fopenmp
+endif
if HAVE_WAYLAND_TBM
src_bin_enlightenment_CPPFLAGS += @WAYLAND_TBM_CFLAGS@ @ECORE_DRM_CFLAGS@
if HAVE_REMOTE_SURFACE
$(enlightenment_src)
src_bin_enlightenment_LDFLAGS = -export-dynamic
+if HAVE_LIBGOMP
+src_bin_enlightenment_LDFLAGS += -fopenmp
+endif
src_bin_enlightenment_LDADD = @e_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ @WAYLAND_LIBS@ -lm @SHM_OPEN_LIBS@ $(TTRACE_LIBS) $(DLOG_LIBS) $(POLICY_LIBS)
if HAVE_WAYLAND_TBM
src_bin_enlightenment_LDADD += @WAYLAND_TBM_LIBS@ @ECORE_DRM_LIBS@
# include <wayland-tbm-server.h>
# include <Evas_Engine_GL_Drm.h>
# include <sys/eventfd.h>
+# if HAVE_LIBGOMP
+# include <omp.h>
+# endif
# define E_PLANE_RENDERER_CLIENT_SURFACE_FLAGS_RESERVED 7777
}
/* copy from src to dst */
+#if HAVE_LIBGOMP
+# define LIBGOMP_COPY_THREAD_NUM 4
+ if (src_info.planes[0].size > LIBGOMP_COPY_THREAD_NUM)
+ {
+ size_t step[2];
+ step[0] = src_info.planes[0].size / LIBGOMP_COPY_THREAD_NUM;
+ step[1] = src_info.planes[0].size - (step[0] * (LIBGOMP_COPY_THREAD_NUM - 1));
+
+ omp_set_num_threads(LIBGOMP_COPY_THREAD_NUM);
+ #pragma omp parallel
+ #pragma omp sections
+ {
+ #pragma omp section
+ {
+ memcpy(dst_info.planes[0].ptr,
+ src_info.planes[0].ptr,
+ step[0]);
+ }
+ #pragma omp section
+ {
+ memcpy(dst_info.planes[0].ptr + step[0],
+ src_info.planes[0].ptr + step[0],
+ step[0]);
+ }
+ #pragma omp section
+ {
+ memcpy(dst_info.planes[0].ptr + (step[0] * 2),
+ src_info.planes[0].ptr + (step[0] * 2),
+ step[0]);
+ }
+ #pragma omp section
+ {
+ memcpy(dst_info.planes[0].ptr + (step[0] * 3),
+ src_info.planes[0].ptr + (step[0] * 3),
+ step[1]);
+ }
+ }
+ }
+ else
+ {
+ memcpy(dst_info.planes[0].ptr,
+ src_info.planes[0].ptr,
+ src_info.planes[0].size);
+ }
+#else /* HAVE_LIBGOMP */
memcpy(dst_info.planes[0].ptr, src_info.planes[0].ptr, src_info.planes[0].size);
+#endif /* end of HAVE_LIBGOMP */
tbm_surface_unmap(new_tsurface);
tbm_surface_unmap(tsurface);