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.
16 #define DRV_MAX_PLANES 4
18 /* Vendor ids and mod_code fourcc function must match gbm.h */
19 #define DRV_FORMAT_MOD_NONE 0
20 #define DRV_FORMAT_MOD_VENDOR_INTEL 0x01
21 #define DRV_FORMAT_MOD_VENDOR_AMD 0x02
22 #define DRV_FORMAT_MOD_VENDOR_NV 0x03
23 #define DRV_FORMAT_MOD_VENDOR_SAMSUNG 0x04
24 #define DRV_FORMAT_MOD_VENDOR_QCOM 0x05
26 #define drv_fourcc_mod_code(vendor, val) \
27 ((((__u64)DRV_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL))
30 #define DRV_BO_USE_NONE 0
31 #define DRV_BO_USE_SCANOUT (1ull << 0)
32 #define DRV_BO_USE_CURSOR (1ull << 1)
33 #define DRV_BO_USE_CURSOR_64X64 DRV_BO_USE_CURSOR
34 #define DRV_BO_USE_RENDERING (1ull << 2)
35 #define DRV_BO_USE_LINEAR (1ull << 3)
36 #define DRV_BO_USE_SW_READ_NEVER (1ull << 4)
37 #define DRV_BO_USE_SW_READ_RARELY (1ull << 5)
38 #define DRV_BO_USE_SW_READ_OFTEN (1ull << 6)
39 #define DRV_BO_USE_SW_WRITE_NEVER (1ull << 7)
40 #define DRV_BO_USE_SW_WRITE_RARELY (1ull << 8)
41 #define DRV_BO_USE_SW_WRITE_OFTEN (1ull << 9)
42 #define DRV_BO_USE_HW_TEXTURE (1ull << 10)
43 #define DRV_BO_USE_HW_RENDER (1ull << 11)
44 #define DRV_BO_USE_HW_2D (1ull << 12)
45 #define DRV_BO_USE_HW_COMPOSER (1ull << 13)
46 #define DRV_BO_USE_HW_FB (1ull << 14)
47 #define DRV_BO_USE_EXTERNAL_DISP (1ull << 15)
48 #define DRV_BO_USE_PROTECTED (1ull << 16)
49 #define DRV_BO_USE_HW_VIDEO_ENCODE (1ull << 17)
50 #define DRV_BO_USE_HW_CAMERA_WRITE (1ull << 18)
51 #define DRV_BO_USE_HW_CAMERA_READ (1ull << 19)
52 #define DRV_BO_USE_HW_CAMERA_ZSL (1ull << 20)
53 #define DRV_BO_USE_RENDERSCRIPT (1ull << 21)
91 DRV_FORMAT_XRGB2101010,
92 DRV_FORMAT_XBGR2101010,
93 DRV_FORMAT_RGBX1010102,
94 DRV_FORMAT_BGRX1010102,
95 DRV_FORMAT_ARGB2101010,
96 DRV_FORMAT_ABGR2101010,
97 DRV_FORMAT_RGBA1010102,
98 DRV_FORMAT_BGRA1010102,
118 DRV_FORMAT_FLEX_IMPLEMENTATION_DEFINED,
119 DRV_FORMAT_FLEX_YCbCr_420_888,
133 struct drv_import_fd_data {
134 int fds[DRV_MAX_PLANES];
135 uint32_t strides[DRV_MAX_PLANES];
136 uint32_t offsets[DRV_MAX_PLANES];
137 uint32_t sizes[DRV_MAX_PLANES];
147 drv_destroy(struct driver *drv);
150 drv_get_fd(struct driver *drv);
153 drv_get_name(struct driver *drv);
156 drv_is_format_supported(struct driver *drv, drv_format_t format,
160 drv_bo_new(struct driver *drv, uint32_t width, uint32_t height,
161 drv_format_t format);
164 drv_bo_create(struct driver *drv, uint32_t width, uint32_t height,
165 drv_format_t format, uint64_t flags);
168 drv_bo_destroy(struct bo *bo);
171 drv_bo_map(struct bo *bo);
174 drv_bo_unmap(struct bo *bo);
177 drv_bo_import(struct driver *drv, struct drv_import_fd_data *data);
180 drv_bo_get_width(struct bo *bo);
183 drv_bo_get_height(struct bo *bo);
186 drv_bo_get_stride_or_tiling(struct bo *bo);
189 drv_bo_get_num_planes(struct bo *bo);
192 drv_bo_get_plane_handle(struct bo *bo, size_t plane);
195 drv_bo_get_plane_fd(struct bo *bo, size_t plane);
198 drv_bo_get_plane_offset(struct bo *bo, size_t plane);
201 drv_bo_get_plane_size(struct bo *bo, size_t plane);
204 drv_bo_get_plane_stride(struct bo *bo, size_t plane);
207 drv_bo_get_plane_format_modifier(struct bo *bo, size_t plane);
210 drv_resolve_format(struct driver *drv, drv_format_t format);