blob: f8373fc39598be183e4a52162fc924de548aba1f [file] [log] [blame]
Stéphane Marchesin25a26062014-09-12 16:18:59 -07001/*
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
Yuly Novikov96c7a3b2015-12-08 22:48:29 -050015#define GBM_MAX_PLANES 4
16
Stéphane Marchesin25a26062014-09-12 16:18:59 -070017struct gbm_device
18{
19 int fd;
20 struct gbm_driver *driver;
21 void *priv;
22};
23
24struct gbm_surface
25{
26};
27
28struct gbm_bo
29{
30 struct gbm_device *gbm;
31 uint32_t width;
32 uint32_t height;
Stéphane Marchesin25a26062014-09-12 16:18:59 -070033 uint32_t format;
Lauri Peltonen7842d8f2014-12-17 23:01:37 -080034 uint32_t tiling;
Yuly Novikov96c7a3b2015-12-08 22:48:29 -050035 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];
Vince Hsua6878fe2016-05-23 10:32:25 +080040 uint64_t format_modifiers[GBM_MAX_PLANES];
Stéphane Marchesin25a26062014-09-12 16:18:59 -070041 void *priv;
42 void *user_data;
43 void (*destroy_user_data)(struct gbm_bo *, void *);
44};
45
46struct gbm_driver
47{
48 char *name;
49 int (*init)(struct gbm_device *gbm);
50 void (*close)(struct gbm_device *gbm);
51 int (*bo_create)(struct gbm_bo *bo, uint32_t width, uint32_t height, uint32_t format, uint32_t flags);
52 int (*bo_destroy)(struct gbm_bo *bo);
53 struct format_supported {
54 uint32_t format;
55 enum gbm_bo_flags usage;
56 }
Dongseong Hwangb26f26d2016-04-07 14:51:29 +030057 format_list[18];
Stéphane Marchesin25a26062014-09-12 16:18:59 -070058};
59
60#endif