OSDN Git Service

gralloc0_register_buffer: initialize gralloc0 when needed
[android-x86/external-minigbm.git] / cros_gralloc / cros_gralloc_helpers.h
1 /*
2  * Copyright 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 CROS_GRALLOC_HELPERS_H
8 #define CROS_GRALLOC_HELPERS_H
9
10 #include "../drv.h"
11 #include "cros_gralloc_handle.h"
12 #include "cros_gralloc_types.h"
13
14 #include <system/graphics.h>
15 #ifdef USE_VNDK
16 #include <vndk/window.h>
17 #else
18 #include <system/window.h>
19 #endif
20
21 constexpr uint32_t cros_gralloc_magic = 0xABCDDCBA;
22 constexpr uint32_t handle_data_size =
23     ((sizeof(struct cros_gralloc_handle) - offsetof(cros_gralloc_handle, fds[0])) / sizeof(int));
24
25 const char *drmFormat2Str(int format);
26 uint32_t cros_gralloc_convert_format(int32_t format);
27
28 cros_gralloc_handle_t cros_gralloc_convert_handle(buffer_handle_t handle);
29
30 int32_t cros_gralloc_sync_wait(int32_t acquire_fence);
31
32 __attribute__((format(printf, 4, 5))) void cros_gralloc_log(const char *prefix, const char *file,
33                                                             int line, const char *format, ...);
34
35 #define cros_gralloc_error(...)                                                                    \
36         do {                                                                                       \
37                 cros_gralloc_log("CROS_GRALLOC_ERROR", __FILE__, __LINE__, __VA_ARGS__);           \
38         } while (0)
39
40 #endif