blob: 529d7fe73b0feec73d30764a58fae16ff3a53cbf [file] [log] [blame]
Gurchetan Singh46faf6b2016-08-05 14:40:07 -07001/*
Daniele Castagna7a755de2016-12-16 17:32:30 -05002 * Copyright 2016 The Chromium OS Authors. All rights reserved.
Gurchetan Singh46faf6b2016-08-05 14:40:07 -07003 * 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 Singh46faf6b2016-08-05 14:40:07 -070013uint64_t gbm_convert_flags(uint32_t flags)
14{
Gurchetan Singh458976f2016-11-23 17:32:33 -080015 uint64_t usage = BO_USE_NONE;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070016
17 if (flags & GBM_BO_USE_SCANOUT)
Gurchetan Singh458976f2016-11-23 17:32:33 -080018 usage |= BO_USE_SCANOUT;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070019 if (flags & GBM_BO_USE_CURSOR)
Gurchetan Singh458976f2016-11-23 17:32:33 -080020 usage |= BO_USE_CURSOR;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070021 if (flags & GBM_BO_USE_CURSOR_64X64)
Gurchetan Singh458976f2016-11-23 17:32:33 -080022 usage |= BO_USE_CURSOR_64X64;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070023 if (flags & GBM_BO_USE_RENDERING)
Gurchetan Singh458976f2016-11-23 17:32:33 -080024 usage |= BO_USE_RENDERING;
Dongseong Hwang3909dc02017-06-23 16:11:50 -070025 if (flags & GBM_BO_USE_TEXTURING)
26 usage |= BO_USE_TEXTURE;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070027 if (flags & GBM_BO_USE_LINEAR)
Gurchetan Singh458976f2016-11-23 17:32:33 -080028 usage |= BO_USE_LINEAR;
Tomasz Figa11f3d082017-07-06 15:40:05 +090029 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 Singh46faf6b2016-08-05 14:40:07 -070033
34 return usage;
35}