OSDN Git Service

minigbm: Make sure no mappings remain when closing a GEM handle
[android-x86/external-minigbm.git] / gbm_helpers.c
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 #include <stddef.h>
8 #include <stdio.h>
9
10 #include "drv.h"
11 #include "gbm.h"
12
13 uint64_t gbm_convert_flags(uint32_t flags)
14 {
15         uint64_t usage = BO_USE_NONE;
16
17         if (flags & GBM_BO_USE_SCANOUT)
18                 usage |= BO_USE_SCANOUT;
19         if (flags & GBM_BO_USE_CURSOR)
20                 usage |= BO_USE_CURSOR;
21         if (flags & GBM_BO_USE_CURSOR_64X64)
22                 usage |= BO_USE_CURSOR_64X64;
23         if (flags & GBM_BO_USE_RENDERING)
24                 usage |= BO_USE_RENDERING;
25         if (flags & GBM_BO_USE_TEXTURING)
26                 usage |= BO_USE_TEXTURE;
27         if (flags & GBM_BO_USE_LINEAR)
28                 usage |= BO_USE_LINEAR;
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;
33
34         return usage;
35 }