Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 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 | |
Gurchetan Singh | c67f9e4 | 2016-11-28 15:25:26 -0800 | [diff] [blame] | 10 | #include "../drv.h" |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 11 | #include "cros_gralloc_handle.h" |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 12 | #include "cros_gralloc_types.h" |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 13 | |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 14 | #include <system/graphics.h> |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 15 | #include <system/window.h> |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 16 | |
Gurchetan Singh | b7538e2 | 2017-03-20 14:45:39 -0700 | [diff] [blame] | 17 | constexpr uint32_t cros_gralloc_magic = 0xABCDDCBA; |
Gurchetan Singh | 989873c | 2017-05-26 10:04:29 -0700 | [diff] [blame] | 18 | constexpr uint32_t handle_data_size = |
| 19 | ((sizeof(struct cros_gralloc_handle) - offsetof(cros_gralloc_handle, fds[0])) / sizeof(int)); |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 20 | |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 21 | uint32_t cros_gralloc_convert_format(int32_t format); |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 22 | |
Gurchetan Singh | d6b8b03 | 2017-05-31 14:31:31 -0700 | [diff] [blame] | 23 | cros_gralloc_handle_t cros_gralloc_convert_handle(buffer_handle_t handle); |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 24 | |
Jason Macnak | 1de7f66 | 2020-01-24 15:05:57 -0800 | [diff] [blame] | 25 | int32_t cros_gralloc_sync_wait(int32_t fence, bool close_fence); |
Gurchetan Singh | 4b5d0bf | 2017-06-22 18:38:37 -0700 | [diff] [blame] | 26 | |
Gurchetan Singh | 2d482e0 | 2020-10-05 17:17:13 -0700 | [diff] [blame^] | 27 | std::string get_drm_format_string(uint32_t drm_format); |
| 28 | |
Gurchetan Singh | 2e786ad | 2016-08-24 18:31:23 -0700 | [diff] [blame] | 29 | #endif |