1 /**************************************************************************
5 Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
7 Contact: SooChan Lim <sc1.lim@samsung.com>,
8 Sangjin Lee <lsj119@samsung.com>,
9 Boram Park <boram1288.park@samsung.com>,
10 Changyeon Lee <cyeon.lee@samsung.com>
12 Permission is hereby granted, free of charge, to any person obtaining a
13 copy of this software and associated documentation files (the
14 "Software"), to deal in the Software without restriction, including
15 without limitation the rights to use, copy, modify, merge, publish,
16 distribute, sub license, and/or sell copies of the Software, and to
17 permit persons to whom the Software is furnished to do so, subject to
18 the following conditions:
20 The above copyright notice and this permission notice (including the
21 next paragraph) shall be included in all copies or substantial portions
24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
27 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
28 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 **************************************************************************/
35 #include "tbm_bufmgr_int.h"
39 tbm_backend_bufmgr_query_display_server(tbm_bufmgr bufmgr, tbm_error_e *error)
45 *error = TBM_ERROR_INVALID_PARAMETER;
49 /* TODO: TBM_DISPLAY_SERVER will be removed */
50 value = (const char*)getenv("TBM_DISPLAY_SERVER");
52 if (value || gBufMgr->display_server) {
54 *error = TBM_ERROR_NONE;
59 *error = TBM_ERROR_NONE;
64 tbm_backend_bufmgr_func *
65 tbm_backend_bufmgr_alloc_bufmgr_func(tbm_bufmgr bufmgr, tbm_error_e *error)
67 tbm_backend_bufmgr_func *bufmgr_func;
69 bufmgr_func = calloc(1, sizeof(struct _tbm_backend_bufmgr_func));
71 TBM_ERR("error: fail to allocate the tbm_backend_bufmgr_func\n");
73 *error = TBM_ERROR_OUT_OF_MEMORY;
78 *error = TBM_ERROR_NONE;
84 tbm_backend_bufmgr_free_bufmgr_func(tbm_bufmgr bufmgr, tbm_backend_bufmgr_func *func)
86 TBM_RETURN_IF_FAIL(bufmgr);
93 tbm_backend_bufmgr_register_bufmgr_func(tbm_bufmgr bufmgr, tbm_backend_bufmgr_func *func)
95 TBM_RETURN_VAL_IF_FAIL(bufmgr, TBM_ERROR_INVALID_PARAMETER);
96 TBM_RETURN_VAL_IF_FAIL(func, TBM_ERROR_INVALID_PARAMETER);
98 bufmgr->bufmgr_func = func;
100 return TBM_ERROR_NONE;
103 tbm_backend_bo_func *
104 tbm_backend_bufmgr_alloc_bo_func(tbm_bufmgr bufmgr, tbm_error_e *error)
106 tbm_backend_bo_func *bufmgr_bo;
108 bufmgr_bo = calloc(1, sizeof(struct _tbm_backend_bo_func));
110 TBM_ERR("error: fail to allocate the tbm_backend_bo_func\n");
112 *error = TBM_ERROR_OUT_OF_MEMORY;
117 *error = TBM_ERROR_NONE;
123 tbm_backend_bufmgr_free_bo_func(tbm_bufmgr bufmgr, tbm_backend_bo_func *func)
125 TBM_RETURN_IF_FAIL(bufmgr);
132 tbm_backend_bufmgr_register_bo_func(tbm_bufmgr bufmgr, tbm_backend_bo_func *func)
134 TBM_RETURN_VAL_IF_FAIL(bufmgr, TBM_ERROR_INVALID_PARAMETER);
135 TBM_RETURN_VAL_IF_FAIL(func, TBM_ERROR_INVALID_PARAMETER);
137 bufmgr->bo_func = func;
139 return TBM_ERROR_NONE;