1 /**************************************************************************
5 Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
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>
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:
22 The above copyright notice and this permission notice (including the
23 next paragraph) shall be included in all copies or substantial portions
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.
34 **************************************************************************/
41 * @author Boram Park, boram1288.park@samsung.com
44 * TDM stands for Tizen Display Manager. It's the display HAL layer for tizen
45 * display server. It offers the frontend APIs(@ref tdm.h) for a frontend user
46 * and the abstraction interface(@ref tdm_backend.h) for a hardware vendor.
49 * TDM consists of display/output/layer/pp/capture objects. A frontend user can
50 * get the output/layer/pp/capture hardware information with each object.
51 * Basically, TDM supposes that all display devices have fixed outputs and
52 * layers. A frontend user can get these outputs and layers with
53 * #tdm_display_get_output_count, #tdm_display_get_output, #tdm_output_get_layer_count
54 * and #tdm_output_get_layer. To get a pp/capture object, however, a frontend
55 * user need to create a object with #tdm_display_create_pp, #tdm_output_create_capture
56 * and #tdm_layer_create_capture if available.\n
58 * All changes of output/layer/pp/capture objects are applied when committed.
59 * See #tdm_output_commit, #tdm_pp_commit and #tdm_capture_commit.
61 * @par Buffer management
62 * TDM has its own buffer release mechanism to let an user know when a TDM buffer
63 * becomes available for a next job. A frontend user can add a user release handler
64 * to a TDM buffer with #tdm_buffer_add_release_handler, and this handler will be
65 * called when it's disappered from screen or when pp/capture operation is done.
67 * @par Implementing a TDM backend module(for a hardware vendor)
68 * A backend module @b SHOULD define the global data symbol of which name is
69 * @b "tdm_backend_module_data". TDM will read this symbol, @b "tdm_backend_module_data",
70 * at the initial time and call init() function of #tdm_backend_module.
71 * A backend module at least @b SHOULD register the #tdm_func_display,
72 * #tdm_func_output, #tdm_func_layer functions to a display object via
73 * #tdm_backend_register_func_display(), #tdm_backend_register_func_output(),
74 * #tdm_backend_register_func_layer() functions in initial time.\n
76 #include <tdm_backend.h>
78 static tdm_drm_data *drm_data;
81 tdm_drm_init(tdm_display *dpy, tdm_error *error)
83 tdm_func_display drm_func_display;
84 tdm_func_output drm_func_output;
85 tdm_func_layer drm_func_layer;
88 drm_data = calloc(1, sizeof(tdm_drm_data));
91 memset(&drm_func_display, 0, sizeof(drm_func_display));
92 drm_func_display.display_get_capabilitiy = drm_display_get_capabilitiy;
94 ret = tdm_backend_register_func_display(dpy, &drm_func_display);
95 if (ret != TDM_ERROR_NONE)
98 memset(&drm_func_output, 0, sizeof(drm_func_output));
99 drm_func_output.output_get_capability = drm_output_get_capability;
101 ret = tdm_backend_register_func_output(dpy, &drm_func_output);
102 if (ret != TDM_ERROR_NONE)
105 memset(&drm_func_layer, 0, sizeof(drm_func_layer));
106 drm_func_layer.layer_get_capability = drm_layer_get_capability;
108 ret = tdm_backend_register_func_layer(dpy, &drm_func_layer);
109 if (ret != TDM_ERROR_NONE)
112 return (tdm_backend_data*)drm_data;
116 tdm_drm_deinit(tdm_backend_data *bdata)
122 tdm_backend_module tdm_backend_module_data =
126 TDM_BACKEND_SET_ABI_VERSION(1,2),
132 * A sample backend source code can be downloaded.
134 $ git clone ssh://{user_id}@review.tizen.org:29418/platform/core/uifw/libtdm-drm
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
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
147 * The @b "Remarks" part of <tdm_backend.h> explains what things should be
148 * careful for vendor to implement a TDM backend module.
151 #endif /* _TDM_DOC_H_ */