summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2.c
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/lib/ecore_drm2/ecore_drm2.c
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/lib/ecore_drm2/ecore_drm2.c')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2.c74
1 files changed, 74 insertions, 0 deletions
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}