blob: 53b8da6cdf5bd38e9fd93ee1488206f8fd7ae535 [file] [log] [blame]
Gurchetan Singh46faf6b2016-08-05 14:40:07 -07001/*
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
16struct 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];
Gurchetan Singha40ca9e2016-08-29 19:51:45 -070029 size_t total_size;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070030 void *priv;
Gurchetan Singhef920532016-08-12 16:38:25 -070031 void *map_data;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070032};
33
34struct driver {
35 int fd;
36 struct backend *backend;
37 void *priv;
Gurchetan Singh1647fbe2016-08-03 17:14:55 -070038 void *buffer_table;
39 pthread_mutex_t table_lock;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070040};
41
42struct backend
43{
44 char *name;
45 int (*init)(struct driver *drv);
46 void (*close)(struct driver *drv);
47 int (*bo_create)(struct bo *bo, uint32_t width, uint32_t height,
48 drv_format_t format, uint32_t flags);
Gurchetan Singhef920532016-08-12 16:38:25 -070049 void* (*bo_map)(struct bo *bo);
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070050 int (*bo_destroy)(struct bo *bo);
Gurchetan Singhbfba8c22016-08-16 17:57:10 -070051 drv_format_t (*resolve_format)(drv_format_t format);
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070052 struct format_supported {
53 drv_format_t format;
54 uint64_t usage;
55 }
56 format_list[18];
57};
58
59#endif