summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac78
-rw-r--r--m4/efl.m43
-rw-r--r--pc/.gitignore1
-rw-r--r--pc/ecore-drm2.pc.in12
-rw-r--r--src/Makefile.am3
-rw-r--r--src/Makefile_Ecore_Drm2.am25
-rw-r--r--src/Makefile_Ecore_Evas.am12
-rw-r--r--src/lib/ecore_drm2/Ecore_Drm2.h74
-rw-r--r--src/lib/ecore_drm2/ecore_drm2.c74
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h58
11 files changed, 323 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am
index 564f332..1efae6e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -290,6 +290,10 @@ if HAVE_ELPUT
290pkgconfig_DATA += pc/elput.pc 290pkgconfig_DATA += pc/elput.pc
291endif 291endif
292 292
293if HAVE_ECORE_DRM2
294pkgconfig_DATA += pc/ecore-drm2.pc
295endif
296
293# Cmake configs: 297# Cmake configs:
294efl_cmakeconfigdir = $(libdir)/cmake/Efl/ 298efl_cmakeconfigdir = $(libdir)/cmake/Efl/
295efl_cmakeconfig_DATA = \ 299efl_cmakeconfig_DATA = \
diff --git a/configure.ac b/configure.ac
index cae4e39..0912ac2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2085,19 +2085,32 @@ if test "x${have_cocoa}" = "xyes"; then
2085fi 2085fi
2086AC_SUBST(cocoa_coreservices_ldflags) 2086AC_SUBST(cocoa_coreservices_ldflags)
2087 2087
2088AC_ARG_ENABLE([elput],
2089 [AS_HELP_STRING([--enable-elput],[enable elput library. @<:@default=disabled@:>@])],
2090 [
2091 if test "x${enableval}" = "xyes" ; then
2092 want_elput="yes"
2093 else
2094 want_elput="no"
2095 fi
2096 ],
2097 [want_elput="no"])
2098
2088# Drm 2099# Drm
2089AC_ARG_ENABLE([drm], 2100AC_ARG_ENABLE([drm],
2090 [AS_HELP_STRING([--enable-drm],[enable drm engine. @<:@default=disabled@:>@])], 2101 [AS_HELP_STRING([--enable-drm],[enable drm engine. @<:@default=disabled@:>@])],
2091 [ 2102 [
2092 if test "x${enableval}" = "xyes" ; then 2103 if test "x${enableval}" = "xyes" ; then
2093 want_drm="yes" 2104 if test "x${want_elput}" != "xyes" ; then
2105 AC_MSG_ERROR([elput is required to build drm support])
2106 fi
2107 want_drm="yes"
2094 else 2108 else
2095 want_drm="no" 2109 want_drm="no"
2096 fi 2110 fi
2097 ], 2111 ],
2098 [want_drm="no"]) 2112 [want_drm="no"])
2099 2113
2100
2101AC_ARG_ENABLE([gl-drm], 2114AC_ARG_ENABLE([gl-drm],
2102 [AC_HELP_STRING([--enable-gl-drm], 2115 [AC_HELP_STRING([--enable-gl-drm],
2103 [enable gl drm engine. @<:@default=disabled@:>@])], 2116 [enable gl drm engine. @<:@default=disabled@:>@])],
@@ -2296,17 +2309,6 @@ AC_ARG_ENABLE([ecore-buffer],
2296 ], 2309 ],
2297 [want_ecore_buffer="no"]) 2310 [want_ecore_buffer="no"])
2298 2311
2299AC_ARG_ENABLE([elput],
2300 [AS_HELP_STRING([--enable-elput],[enable elput library. @<:@default=disabled@:>@])],
2301 [
2302 if test "x${enableval}" = "xyes" ; then
2303 want_elput="yes"
2304 else
2305 want_elput="no"
2306 fi
2307 ],
2308 [want_elput="no"])
2309
2310# Image Loaders 2312# Image Loaders
2311 2313
2312ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static) 2314ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static)
@@ -3633,7 +3635,52 @@ EFL_EVAL_PKGS([ELPUT])
3633### Checks for library functions 3635### Checks for library functions
3634 3636
3635EFL_LIB_END_OPTIONAL([Elput]) 3637EFL_LIB_END_OPTIONAL([Elput])
3636#### End of Ecore_Drm 3638#### End of Elput
3639
3640#### Ecore_Drm2
3641have_libinput_new="no"
3642EFL_LIB_START_OPTIONAL([Ecore_Drm2], [test "${want_drm}" = "yes"])
3643
3644### Additional options to configure
3645SUID_CFLAGS=-fPIE
3646SUID_LDFLAGS=-pie
3647AC_SUBST([SUID_CFLAGS])
3648AC_SUBST([SUID_LDFLAGS])
3649
3650### Default values
3651
3652### Checks for programs
3653
3654### Checks for libraries
3655EFL_INTERNAL_DEPEND_PKG([ECORE_DRM2], [eo])
3656EFL_INTERNAL_DEPEND_PKG([ECORE_DRM2], [efl])
3657EFL_INTERNAL_DEPEND_PKG([ECORE_DRM2], [eina])
3658EFL_INTERNAL_DEPEND_PKG([ECORE_DRM2], [ecore])
3659EFL_INTERNAL_DEPEND_PKG([ECORE_DRM2], [elput])
3660EFL_INTERNAL_DEPEND_PKG([ECORE_DRM2], [eeze])
3661
3662EFL_DEPEND_PKG([ECORE_DRM2], [DRM], [libdrm >= 2.4 gbm])
3663
3664EFL_ADD_LIBS([ECORE_DRM2], [-lm])
3665
3666AC_CHECK_LIB(drm, drmModeAtomicCommit, AC_DEFINE(HAVE_ATOMIC_DRM, [], [Atomic modeset supported]))
3667
3668EFL_EVAL_PKGS([ECORE_DRM2])
3669
3670### Checks for header files
3671
3672### Checks for types
3673
3674### Checks for structures
3675
3676### Checks for compiler characteristics
3677
3678### Checks for linker characteristics
3679
3680### Checks for library functions
3681
3682EFL_LIB_END_OPTIONAL([Ecore_Drm2])
3683#### End of Ecore_Drm2
3637 3684
3638 3685
3639#### Ecore_Audio 3686#### Ecore_Audio
@@ -5260,7 +5307,7 @@ EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${have_ps3}], [ecore_psl1ght])
5260EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_sdl}], [ecore_sdl]) 5307EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_sdl}], [ecore_sdl])
5261EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_ecore_evas_gl_cocoa}], [ecore_cocoa]) 5308EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_ecore_evas_gl_cocoa}], [ecore_cocoa])
5262EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${build_ecore_evas_win32}], [ecore_win32]) 5309EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${build_ecore_evas_win32}], [ecore_win32])
5263EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_drm}], [ecore_drm]) 5310EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_drm}], [ecore_drm2])
5264EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${build_ecore_evas_wayland}], [ecore_wl2]) 5311EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${build_ecore_evas_wayland}], [ecore_wl2])
5265 5312
5266dnl Special case deps for ecore_drm 5313dnl Special case deps for ecore_drm
@@ -5605,6 +5652,7 @@ pc/elua.pc
5605pc/elementary.pc 5652pc/elementary.pc
5606pc/elementary-cxx.pc 5653pc/elementary-cxx.pc
5607pc/elput.pc 5654pc/elput.pc
5655pc/ecore-drm2.pc
5608dbus-services/org.enlightenment.Ethumb.service 5656dbus-services/org.enlightenment.Ethumb.service
5609systemd-services/ethumb.service 5657systemd-services/ethumb.service
5610$po_makefile_in 5658$po_makefile_in
diff --git a/m4/efl.m4 b/m4/efl.m4
index c9e15f3..f1694c5 100644
--- a/m4/efl.m4
+++ b/m4/efl.m4
@@ -174,6 +174,9 @@ case "m4_defn([DOWNOTHER])" in
174 ecore_win32) 174 ecore_win32)
175 depname="ecore-win32" 175 depname="ecore-win32"
176 ;; 176 ;;
177 ecore_drm2)
178 depname="ecore-drm2"
179 ;;
177esac 180esac
178requirements_pc_[]m4_defn([DOWNEFL])="${depname} >= ${PACKAGE_VERSION} ${requirements_pc_[][]m4_defn([DOWNEFL])}" 181requirements_pc_[]m4_defn([DOWNEFL])="${depname} >= ${PACKAGE_VERSION} ${requirements_pc_[][]m4_defn([DOWNEFL])}"
179requirements_cflags_[]m4_defn([DOWNEFL])="-I\$(top_srcdir)/src/lib/${libdirname} -I\$(top_builddir)/src/lib/${libdirname} ${requirements_cflags_[][]m4_defn([DOWNEFL])}" 182requirements_cflags_[]m4_defn([DOWNEFL])="-I\$(top_srcdir)/src/lib/${libdirname} -I\$(top_builddir)/src/lib/${libdirname} ${requirements_cflags_[][]m4_defn([DOWNEFL])}"
diff --git a/pc/.gitignore b/pc/.gitignore
index f66395b..893e937 100644
--- a/pc/.gitignore
+++ b/pc/.gitignore
@@ -74,3 +74,4 @@
74/efl-js.pc 74/efl-js.pc
75/elementary-cxx.pc 75/elementary-cxx.pc
76/elput.pc 76/elput.pc
77/ecore-drm2.pc
diff --git a/pc/ecore-drm2.pc.in b/pc/ecore-drm2.pc.in
new file mode 100644
index 0000000..4530eac
--- /dev/null
+++ b/pc/ecore-drm2.pc.in
@@ -0,0 +1,12 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4includedir=@includedir@
5
6Name: ecore-drm2
7Description: E core library, DRM module
8Requires.private: @requirements_pc_ecore_drm2@
9Version: @VERSION@
10Libs: -L${libdir} -lecore_drm2
11Libs.private: @requirements_libs_ecore_drm2@
12Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/ecore-drm2-@VMAJ@
diff --git a/src/Makefile.am b/src/Makefile.am
index af019a7..523f411 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -54,7 +54,9 @@ include Makefile_Ecore_IMF.am
54include Makefile_Ecore_IMF_Evas.am 54include Makefile_Ecore_IMF_Evas.am
55include Makefile_Eldbus.am 55include Makefile_Eldbus.am
56include Makefile_Eeze.am 56include Makefile_Eeze.am
57include Makefile_Elput.am
57include Makefile_Ecore_Drm.am 58include Makefile_Ecore_Drm.am
59include Makefile_Ecore_Drm2.am
58include Makefile_Ecore_Evas.am 60include Makefile_Ecore_Evas.am
59include Makefile_Ecore_Audio.am 61include Makefile_Ecore_Audio.am
60include Makefile_Ecore_Avahi.am 62include Makefile_Ecore_Avahi.am
@@ -69,7 +71,6 @@ include Makefile_Ethumb.am
69include Makefile_Ethumb_Client.am 71include Makefile_Ethumb_Client.am
70include Makefile_Elocation.am 72include Makefile_Elocation.am
71include Makefile_Elementary.am 73include Makefile_Elementary.am
72include Makefile_Elput.am
73 74
74include Makefile_Cxx.am 75include Makefile_Cxx.am
75include Makefile_Eolian_Cxx.am 76include Makefile_Eolian_Cxx.am
diff --git a/src/Makefile_Ecore_Drm2.am b/src/Makefile_Ecore_Drm2.am
new file mode 100644
index 0000000..2818b0e
--- /dev/null
+++ b/src/Makefile_Ecore_Drm2.am
@@ -0,0 +1,25 @@
1if HAVE_ECORE_DRM2
2
3### Library
4
5lib_LTLIBRARIES += lib/ecore_drm2/libecore_drm2.la
6
7installed_ecoredrm2mainheadersdir = $(includedir)/ecore-drm2-@VMAJ@
8dist_installed_ecoredrm2mainheaders_DATA = \
9 lib/ecore_drm2/Ecore_Drm2.h
10
11lib_ecore_drm2_libecore_drm2_la_SOURCES = \
12lib/ecore_drm2/ecore_drm2.c \
13lib/ecore_drm2/ecore_drm2_private.h
14
15lib_ecore_drm2_libecore_drm2_la_CPPFLAGS = \
16 -I$(top_builddir)/src/lib/efl \
17 @ECORE_DRM2_CFLAGS@ @EFL_CFLAGS@ \
18 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
19 -DMODULE_ARCH=\"$(MODULE_ARCH)\"
20
21lib_ecore_drm2_libecore_drm2_la_LIBADD = @ECORE_DRM2_LIBS@
22lib_ecore_drm2_libecore_drm2_la_DEPENDENCIES = @ECORE_DRM2_INTERNAL_LIBS@
23lib_ecore_drm2_libecore_drm2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
24
25endif
diff --git a/src/Makefile_Ecore_Evas.am b/src/Makefile_Ecore_Evas.am
index 12efc0b..25af963 100644
--- a/src/Makefile_Ecore_Evas.am
+++ b/src/Makefile_Ecore_Evas.am
@@ -271,11 +271,13 @@ modules_ecore_evas_engines_drm_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/ef
271@ECORE_EVAS_CFLAGS@ \ 271@ECORE_EVAS_CFLAGS@ \
272@ECORE_DRM_CFLAGS@ \ 272@ECORE_DRM_CFLAGS@ \
273-I$(top_srcdir)/src/modules/evas/engines/drm \ 273-I$(top_srcdir)/src/modules/evas/engines/drm \
274-I$(top_srcdir)/src/modules/evas/engines/gl_drm \ 274-I$(top_srcdir)/src/modules/evas/engines/gl_drm
275@ecore_evas_engines_gl_drm_cflags@ 275modules_ecore_evas_engines_drm_module_la_LIBADD = \
276modules_ecore_evas_engines_drm_module_la_LIBADD = @USE_ECORE_EVAS_LIBS@ \ 276@USE_ECORE_EVAS_LIBS@ \
277@ecore_evas_engines_gl_drm_libs@ 277@USE_ECORE_DRM2_LIBS@
278modules_ecore_evas_engines_drm_module_la_DEPENDENCIES = @USE_ECORE_EVAS_INTERNAL_LIBS@ 278modules_ecore_evas_engines_drm_module_la_DEPENDENCIES = \
279@USE_ECORE_EVAS_INTERNAL_LIBS@ \
280@USE_ECORE_DRM2_INTERNAL_LIBS@
279modules_ecore_evas_engines_drm_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ 281modules_ecore_evas_engines_drm_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
280modules_ecore_evas_engines_drm_module_la_LIBTOOLFLAGS = --tag=disable-static 282modules_ecore_evas_engines_drm_module_la_LIBTOOLFLAGS = --tag=disable-static
281endif 283endif
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
new file mode 100644
index 0000000..b2bbd15
--- /dev/null
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -0,0 +1,74 @@
1#ifndef _ECORE_DRM2_H
2# define _ECORE_DRM2_H
3
4# include <Ecore.h>
5# include <Elput.h>
6
7# ifdef EAPI
8# undef EAPI
9# endif
10
11# ifdef _MSC_VER
12# ifdef BUILDING_DLL
13# define EAPI __declspec(dllexport)
14# else // ifdef BUILDING_DLL
15# define EAPI __declspec(dllimport)
16# endif // ifdef BUILDING_DLL
17# else // ifdef _MSC_VER
18# ifdef __GNUC__
19# if __GNUC__ >= 4
20# define EAPI __attribute__ ((visibility("default")))
21# else // if __GNUC__ >= 4
22# define EAPI
23# endif // if __GNUC__ >= 4
24# else // ifdef __GNUC__
25# define EAPI
26# endif // ifdef __GNUC__
27# endif // ifdef _MSC_VER
28
29# ifdef EFL_BETA_API_SUPPORT
30
31/**
32 * @file
33 * @brief Ecore functions for dealing with drm, virtual terminals
34 *
35 * @defgroup Ecore_Drm2_Group Ecore_Drm2 - Drm Integration
36 * @ingroup Ecore
37 *
38 * Ecore_Drm2 provides a wrapper and functions for using libdrm
39 *
40 * @li @ref Ecore_Drm2_Init_Group
41 * @li @ref Ecore_Drm2_Device_Group
42 */
43
44/**
45 * @defgroup Ecore_Drm2_Init_Group Drm library Init and Shutdown functions
46 *
47 * Functions that start and shutdown the Ecore_Drm2 library
48 */
49
50/**
51 * Initialize the Ecore_Drm2 library
52 *
53 * @return The number of times the library has been initialized without
54 * being shut down. 0 is returned if an error occurs.
55 *
56 * @ingroup Ecore_Drm2_Init_Group
57 * @since 1.18
58 */
59EAPI int ecore_drm2_init(void);
60
61/**
62 * Shutdown the Ecore_Drm2 library
63 *
64 * @return The number of times the library has been initialized without
65 * being shutdown. 0 is returned if an error occurs.
66 *
67 * @ingroup Ecore_Drm2_Init_Group
68 * @since 1.18
69 */
70EAPI int ecore_drm2_shutdown(void);
71
72# endif
73
74#endif
diff --git a/src/lib/ecore_drm2/ecore_drm2.c b/src/lib/ecore_drm2/ecore_drm2.c
new file mode 100644
index 0000000..32b6781
--- /dev/null
+++ b/src/lib/ecore_drm2/ecore_drm2.c
@@ -0,0 +1,74 @@
1#include "ecore_drm2_private.h"
2
3static int _ecore_drm2_init_count = 0;
4
5int _ecore_drm2_log_dom = -1;
6
7EAPI int
8ecore_drm2_init(void)
9{
10 if (++_ecore_drm2_init_count != 1) return _ecore_drm2_init_count;
11
12 if (!eina_init()) goto eina_err;
13
14 if (!ecore_init())
15 {
16 EINA_LOG_ERR("Could not initialize Ecore library");
17 goto ecore_err;
18 }
19
20 if (!eeze_init())
21 {
22 EINA_LOG_ERR("Could not initialize Eeze library");
23 goto eeze_err;
24 }
25
26 if (!elput_init())
27 {
28 EINA_LOG_ERR("Could not initialize Elput library");
29 goto elput_err;
30 }
31
32 _ecore_drm2_log_dom =
33 eina_log_domain_register("ecore_drm2", ECORE_DRM2_DEFAULT_LOG_COLOR);
34 if (!_ecore_drm2_log_dom)
35 {
36 EINA_LOG_ERR("Could not create logging domain for Ecore_Drm2");
37 goto log_err;
38 }
39
40 return _ecore_drm2_init_count;
41
42log_err:
43 elput_shutdown();
44elput_err:
45 eeze_shutdown();
46eeze_err:
47 ecore_shutdown();
48ecore_err:
49 eina_shutdown();
50eina_err:
51 return --_ecore_drm2_init_count;
52}
53
54EAPI int
55ecore_drm2_shutdown(void)
56{
57 if (_ecore_drm2_init_count < 1)
58 {
59 ERR("Ecore_Drm2 shutdown called without init");
60 return 0;
61 }
62
63 if (--_ecore_drm2_init_count != 0) return _ecore_drm2_init_count;
64
65 eina_log_domain_unregister(_ecore_drm2_log_dom);
66 _ecore_drm2_log_dom = -1;
67
68 elput_shutdown();
69 eeze_shutdown();
70 ecore_shutdown();
71 eina_shutdown();
72
73 return _ecore_drm2_init_count;
74}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
new file mode 100644
index 0000000..6177e8e
--- /dev/null
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -0,0 +1,58 @@
1#ifndef _ECORE_DRM2_PRIVATE_H
2# define _ECORE_DRM2_PRIVATE_H
3
4# ifdef HAVE_CONFIG_H
5# include "config.h"
6# endif
7
8# include "Ecore.h"
9# include "ecore_private.h"
10# include "Eeze.h"
11# include "Elput.h"
12# include <Ecore_Drm2.h>
13
14# include <unistd.h>
15# include <strings.h>
16# include <sys/mman.h>
17# include <fcntl.h>
18# include <ctype.h>
19
20# include <sys/ioctl.h>
21# include <xf86drm.h>
22# include <xf86drmMode.h>
23# include <drm_mode.h>
24# include <drm_fourcc.h>
25
26extern int _ecore_drm2_log_dom;
27
28# ifdef ECORE_DRM2_DEFAULT_LOG_COLOR
29# undef ECORE_DRM2_DEFAULT_LOG_COLOR
30# endif
31# define ECORE_DRM2_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
32
33# ifdef ERR
34# undef ERR
35# endif
36# define ERR(...) EINA_LOG_DOM_ERR(_ecore_drm2_log_dom, __VA_ARGS__)
37
38# ifdef DBG
39# undef DBG
40# endif
41# define DBG(...) EINA_LOG_DOM_DBG(_ecore_drm2_log_dom, __VA_ARGS__)
42
43# ifdef INF
44# undef INF
45# endif
46# define INF(...) EINA_LOG_DOM_INFO(_ecore_drm2_log_dom, __VA_ARGS__)
47
48# ifdef WRN
49# undef WRN
50# endif
51# define WRN(...) EINA_LOG_DOM_WARN(_ecore_drm2_log_dom, __VA_ARGS__)
52
53# ifdef CRIT
54# undef CRIT
55# endif
56# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_drm2_log_dom, __VA_ARGS__)
57
58#endif