Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 1 | /* |
Daniele Castagna | 7a755de | 2016-12-16 17:32:30 -0500 | [diff] [blame] | 2 | * Copyright 2016 The Chromium OS Authors. All rights reserved. |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 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 | #include <stddef.h> |
| 8 | #include <stdio.h> |
| 9 | |
| 10 | #include "drv.h" |
| 11 | #include "gbm.h" |
| 12 | |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 13 | uint64_t gbm_convert_flags(uint32_t flags) |
| 14 | { |
Gurchetan Singh | 458976f | 2016-11-23 17:32:33 -0800 | [diff] [blame] | 15 | uint64_t usage = BO_USE_NONE; |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 16 | |
| 17 | if (flags & GBM_BO_USE_SCANOUT) |
Gurchetan Singh | 458976f | 2016-11-23 17:32:33 -0800 | [diff] [blame] | 18 | usage |= BO_USE_SCANOUT; |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 19 | if (flags & GBM_BO_USE_CURSOR) |
Gurchetan Singh | 458976f | 2016-11-23 17:32:33 -0800 | [diff] [blame] | 20 | usage |= BO_USE_CURSOR; |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 21 | if (flags & GBM_BO_USE_CURSOR_64X64) |
Gurchetan Singh | 458976f | 2016-11-23 17:32:33 -0800 | [diff] [blame] | 22 | usage |= BO_USE_CURSOR_64X64; |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 23 | if (flags & GBM_BO_USE_RENDERING) |
Gurchetan Singh | 458976f | 2016-11-23 17:32:33 -0800 | [diff] [blame] | 24 | usage |= BO_USE_RENDERING; |
Dongseong Hwang | 3909dc0 | 2017-06-23 16:11:50 -0700 | [diff] [blame] | 25 | if (flags & GBM_BO_USE_TEXTURING) |
| 26 | usage |= BO_USE_TEXTURE; |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 27 | if (flags & GBM_BO_USE_LINEAR) |
Gurchetan Singh | 458976f | 2016-11-23 17:32:33 -0800 | [diff] [blame] | 28 | usage |= BO_USE_LINEAR; |
Tomasz Figa | 11f3d08 | 2017-07-06 15:40:05 +0900 | [diff] [blame] | 29 | if (flags & GBM_BO_USE_CAMERA_WRITE) |
| 30 | usage |= BO_USE_CAMERA_WRITE; |
| 31 | if (flags & GBM_BO_USE_CAMERA_READ) |
| 32 | usage |= BO_USE_CAMERA_READ; |
Gurchetan Singh | 46faf6b | 2016-08-05 14:40:07 -0700 | [diff] [blame] | 33 | |
| 34 | return usage; |
| 35 | } |