7d4c85645dfa15cf76bb0f96ee1543da602862d4
[platform/core/uifw/libtdm.git] / doc / tdm_doc.h
1 /**************************************************************************
2
3 libtdm
4
5 Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
6
7 Contact: Eunchul Kim <chulspro.kim@samsung.com>,
8          JinYoung Jeon <jy0.jeon@samsung.com>,
9          Taeheon Kim <th908.kim@samsung.com>,
10          YoungJun Cho <yj44.cho@samsung.com>,
11          SooChan Lim <sc1.lim@samsung.com>,
12          Boram Park <sc1.lim@samsung.com>
13
14 Permission is hereby granted, free of charge, to any person obtaining a
15 copy of this software and associated documentation files (the
16 "Software"), to deal in the Software without restriction, including
17 without limitation the rights to use, copy, modify, merge, publish,
18 distribute, sub license, and/or sell copies of the Software, and to
19 permit persons to whom the Software is furnished to do so, subject to
20 the following conditions:
21
22 The above copyright notice and this permission notice (including the
23 next paragraph) shall be included in all copies or substantial portions
24 of the Software.
25
26 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
29 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
30 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
34 **************************************************************************/
35
36 #ifndef _TDM_DOC_H_
37 #define _TDM_DOC_H_
38
39 /**
40  * @mainpage TDM
41  * @author     Boram Park, boram1288.park@samsung.com
42  * @date       Mar 17, 2016
43  * @version    1.1.0
44  * @par Introduction
45  * TDM stands for Tizen Display Manager. It's the display HAL layer for tizen
46  * display server. It offers the frontend APIs(@ref tdm.h) for a frontend user
47  * and the abstraction interface(@ref tdm_backend.h) for a hardware vendor.
48  * \n
49  * @par Objects
50  * TDM consists of display/output/layer/pp/capture objects. A frontend user can
51  * get the output/layer/pp/capture hardware information with each object.
52  * Basically, TDM supposes that all display devices have fixed outputs and
53  * layers. A frontend user can get these outputs and layers with
54  * #tdm_display_get_output_count, #tdm_display_get_output, #tdm_output_get_layer_count
55  * and #tdm_output_get_layer. To get a pp/capture object, however, a frontend
56  * user need to create a object with #tdm_display_create_pp, #tdm_output_create_capture
57  * and #tdm_layer_create_capture if available.\n
58  * \n
59  * All changes of output/layer/pp/capture objects are applied when committed.
60  * See #tdm_output_commit, #tdm_pp_commit and #tdm_capture_commit.
61  * \n
62  * @par Buffer management
63  * TDM has its own buffer release mechanism to let an user know when a TDM buffer
64  * becomes available for a next job. A frontend user can add a user release handler
65  * to a TDM buffer with #tdm_buffer_add_release_handler, and this handler will be
66  * called when it's disappered from screen or when pp/capture operation is done.
67  * \n
68  * @par Implementing a TDM backend module(for a hardware vendor)
69  * A backend module @b SHOULD define the global data symbol of which name is
70  * @b "tdm_backend_module_data". TDM will read this symbol, @b "tdm_backend_module_data",
71  * at the initial time and call init() function of #tdm_backend_module.
72  * A backend module at least @b SHOULD register the #tdm_func_display,
73  * #tdm_func_output, #tdm_func_layer functions to a display object via
74  * #tdm_backend_register_func_display(), #tdm_backend_register_func_output(),
75  * #tdm_backend_register_func_layer() functions in initial time.\n
76  * @code
77     #include <tdm_backend.h>
78
79     static tdm_func_display drm_func_display = {
80         drm_display_get_capabilitiy,
81         ...
82     };
83
84     static tdm_func_output drm_func_output = {
85         drm_output_get_capability,
86         ...
87     };
88
89     static tdm_func_layer drm_func_layer = {
90         drm_layer_get_capability,
91         ...
92     };
93
94     static tdm_drm_data *drm_data;
95
96     tdm_backend_data*
97     tdm_drm_init(tdm_display *dpy, tdm_error *error)
98     {
99         ...
100         drm_data = calloc(1, sizeof(tdm_drm_data));
101         ...
102         ret = tdm_backend_register_func_display(dpy, &drm_func_display);
103         if (ret != TDM_ERROR_NONE)
104             goto failed;
105         ret = tdm_backend_register_func_output(dpy, &drm_func_output);
106         if (ret != TDM_ERROR_NONE)
107             goto failed;
108         ret = tdm_backend_register_func_layer(dpy, &drm_func_layer);
109         if (ret != TDM_ERROR_NONE)
110             goto failed;
111         ...
112         return (tdm_backend_data*)drm_data;
113     }
114
115     void
116     tdm_drm_deinit(tdm_backend_data *bdata)
117     {
118         ...
119         free(bdata);
120     }
121
122     tdm_backend_module tdm_backend_module_data =
123     {
124         "drm",
125         "Samsung",
126         TDM_BACKEND_ABI_VERSION,
127         tdm_drm_init,
128         tdm_drm_deinit
129     };
130  * @endcode
131  * \n
132  * A sample backend source code can be downloaded.
133  * @code
134  $ git clone ssh://{user_id}@review.tizen.org:29418/platform/core/uifw/libtdm-drm
135  * @endcode
136  * \n
137  * After loading a TDM backend module, TDM will call @b display_get_capabilitiy(),
138  * @b display_get_outputs(), @b output_get_capability(), @b output_get_layers(),
139  * @b layer_get_capability() functions to get the hardware information. That is,
140  * a TDM backend module @b SHOULD implement these 5 functions basically.\n
141  * \n
142  * In addition, if a hardware has a memory-to-memory converting device and the
143  * capture device, a backend module can register the #tdm_func_pp functions and
144  * #tdm_func_capture functions with #tdm_backend_register_func_pp() and
145  * #tdm_backend_register_func_capture().\n
146  * \n
147  * The @b "Remarks" part of <tdm_backend.h> explains what things should be
148  * careful for vendor to implement a TDM backend module.
149  */
150
151 #endif /* _TDM_DOC_H_ */