OSDN Git Service

minigbm: Add mmap() in backends
[android-x86/external-minigbm.git] / drv_priv.h
1 /*
2  * Copyright (c) 2016 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 DRV_PRIV_H
8 #define DRV_PRIV_H
9
10 #include <stdint.h>
11 #include <stdlib.h>
12 #include <sys/types.h>
13
14 #include "drv.h"
15
16 struct bo
17 {
18         struct driver *drv;
19         uint32_t width;
20         uint32_t height;
21         uint32_t format;
22         uint32_t tiling;
23         size_t num_planes;
24         union bo_handle handles[DRV_MAX_PLANES];
25         uint32_t offsets[DRV_MAX_PLANES];
26         uint32_t sizes[DRV_MAX_PLANES];
27         uint32_t strides[DRV_MAX_PLANES];
28         uint64_t format_modifiers[DRV_MAX_PLANES];
29         void *priv;
30         void *map_data;
31 };
32
33 struct driver {
34         int fd;
35         struct backend *backend;
36         void *priv;
37         void *buffer_table;
38         pthread_mutex_t table_lock;
39 };
40
41 struct backend
42 {
43         char *name;
44         int (*init)(struct driver *drv);
45         void (*close)(struct driver *drv);
46         int (*bo_create)(struct bo *bo, uint32_t width, uint32_t height,
47                          drv_format_t format, uint32_t flags);
48         void* (*bo_map)(struct bo *bo);
49         int (*bo_destroy)(struct bo *bo);
50         struct format_supported {
51                 drv_format_t format;
52                 uint64_t usage;
53         }
54         format_list[18];
55 };
56
57 #endif