summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-02 10:21:00 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-27 11:57:53 -0400
commita0d3b955bfa18e807ef1067aa612a63d99bf7681 (patch)
tree5a8b1671da7187b597f12b6b98e8e147ea3ac66e /src
parent072674dbe2118a26d8616b56b4169a6e543805ef (diff)
ecore-drm2: Add start of Ecore_Drm2 library
This new library is going to replace the existing Ecore_Drm. This will refactor a lot of the code, bring improvements over the existing API, and provide additional support for missing features. @feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src')
-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
6 files changed, 240 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index af019a7bc1..523f411037 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 0000000000..2818b0e760
--- /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 12efc0b135..25af963eb2 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 0000000000..b2bbd15e02
--- /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 0000000000..32b6781cc7
--- /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 0000000000..6177e8e436
--- /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