Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 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 | |
Yuly Novikov | 96c7a3b | 2015-12-08 22:48:29 -0500 | [diff] [blame] | 15 | #define GBM_MAX_PLANES 4 |
| 16 | |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 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; |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 33 | uint32_t format; |
Lauri Peltonen | 7842d8f | 2014-12-17 23:01:37 -0800 | [diff] [blame] | 34 | uint32_t tiling; |
Yuly Novikov | 96c7a3b | 2015-12-08 22:48:29 -0500 | [diff] [blame] | 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]; |
Vince Hsu | a6878fe | 2016-05-23 10:32:25 +0800 | [diff] [blame] | 40 | uint64_t format_modifiers[GBM_MAX_PLANES]; |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 41 | void *priv; |
| 42 | void *user_data; |
| 43 | void (*destroy_user_data)(struct gbm_bo *, void *); |
| 44 | }; |
| 45 | |
| 46 | struct 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 Hwang | b26f26d | 2016-04-07 14:51:29 +0300 | [diff] [blame] | 57 | format_list[18]; |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | #endif |