1 /*
2  * Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
3  * Copyright (C) 2010-2011 LunarG Inc.
4  * Copyright (C) 2016 Linaro, Ltd., Rob Herring <robh@kernel.org>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef _GRALLOC_GBM_PRIV_H_
26 #define _GRALLOC_GBM_PRIV_H_
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct gbm_device;
33 struct gbm_bo;
34 
35 int gralloc_gbm_handle_register(buffer_handle_t handle, struct gbm_device *gbm);
36 int gralloc_gbm_handle_unregister(buffer_handle_t handle);
37 
38 buffer_handle_t gralloc_gbm_bo_create(struct gbm_device *gbm,
39 		int width, int height, int format, int usage, int *stride);
40 void gbm_free(buffer_handle_t handle);
41 
42 struct gbm_bo *gralloc_gbm_bo_from_handle(buffer_handle_t handle);
43 buffer_handle_t gralloc_gbm_bo_get_handle(struct gbm_bo *bo);
44 int gralloc_gbm_get_gem_handle(buffer_handle_t handle);
45 
46 int gralloc_gbm_bo_lock(buffer_handle_t handle, int usage, int x, int y, int w, int h, void **addr);
47 int gralloc_gbm_bo_unlock(buffer_handle_t handle);
48 int gralloc_gbm_bo_lock_ycbcr(buffer_handle_t handle, int usage,
49 		int x, int y, int w, int h, struct android_ycbcr *ycbcr);
50 
51 struct gbm_device *gbm_dev_create(void);
52 void gbm_dev_destroy(struct gbm_device *gbm);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 #endif /* _GRALLOC_GBM_PRIV_H_ */
58