OSDN Git Service

187970460ce86fcac593bba47d8e01d98d9f95c4
[android-x86/external-minigbm.git] / gbm_priv.h
1 /*
2  * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 #ifndef GBM_PRIV_H
8 #define GBM_PRIV_H
9
10 #include <stdint.h>
11 #include <sys/types.h>
12 #include <stdlib.h>
13 #include "gbm.h"
14
15 #define GBM_MAX_PLANES 4
16
17 struct gbm_device
18 {
19         int fd;
20         struct gbm_driver *driver;
21         void *priv;
22 };
23
24 struct gbm_surface
25 {
26 };
27
28 struct gbm_bo
29 {
30         struct gbm_device *gbm;
31         uint32_t width;
32         uint32_t height;
33         uint32_t format;
34         uint32_t tiling;
35         size_t num_planes;
36         union gbm_bo_handle handles[GBM_MAX_PLANES];
37         uint32_t offsets[GBM_MAX_PLANES];
38         uint32_t sizes[GBM_MAX_PLANES];
39         uint32_t strides[GBM_MAX_PLANES];
40         void *priv;
41         void *user_data;
42         void (*destroy_user_data)(struct gbm_bo *, void *);
43 };
44
45 struct gbm_driver
46 {
47         char *name;
48         int (*init)(struct gbm_device *gbm);
49         void (*close)(struct gbm_device *gbm);
50         int (*bo_create)(struct gbm_bo *bo, uint32_t width, uint32_t height, uint32_t format, uint32_t flags);
51         int (*bo_destroy)(struct gbm_bo *bo);
52         struct format_supported {
53                 uint32_t format;
54                 enum gbm_bo_flags usage;
55         }
56         format_list[16];
57 };
58
59 #endif