1 /**************************************************************************
5 Copyright 2011 Samsung Electronics co., Ltd. All Rights Reserved.
7 Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
9 Permission is hereby granted, free of charge, to any person obtaining a
10 copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sub license, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial portions
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
24 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
25 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 **************************************************************************/
33 #include <sys/types.h>
36 #include "drm_slp_bufmgr.h"
37 #include "tbm_bufmgr.h"
38 #include "tbm_bufmgr_int.h"
41 drm_slp_bufmgr_init(int fd, void *arg)
43 tbm_bufmgr bufmgr = NULL;
45 bufmgr = tbm_bufmgr_init (fd);
48 TBM_LOG ("[libdrm_slp:%d]: error bufmgr is null\n", getpid());
52 return (drm_slp_bufmgr)bufmgr;
56 drm_slp_bufmgr_destroy(drm_slp_bufmgr bufmgr)
58 tbm_bufmgr_deinit ((tbm_bufmgr)bufmgr);
62 drm_slp_bo_unref(drm_slp_bo bo)
64 tbm_bo_unref ((tbm_bo)bo);
68 drm_slp_bo_import(drm_slp_bufmgr bufmgr, unsigned int key)
72 bo = tbm_bo_import ((tbm_bufmgr)bufmgr, key);
75 TBM_LOG ("[libdrm_slp:%d]: error bo is null\n", getpid());
79 return (drm_slp_bo)bo;
83 drm_slp_bo_map(drm_slp_bo bo, int device, int opt)
85 tbm_bo_handle bo_handle;
86 unsigned long ret = 0;
88 bo_handle = tbm_bo_map ((tbm_bo)bo, device, opt);
89 if (bo_handle.ptr == NULL)
91 TBM_LOG ("[libdrm_slp:%d]: error bo_handle is null\n", getpid());
97 case TBM_DEVICE_DEFAULT:
101 ret = (unsigned long)bo_handle.u32;
104 ret = (unsigned long)bo_handle.ptr;
107 TBM_LOG ("[libdrm_slp:%d]: error wrong device type\n", getpid());
115 drm_slp_bo_unmap(drm_slp_bo bo, int device)
117 tbm_bo_unmap ((tbm_bo)bo);