blob: 17dcf1fdf970072dfe1d56425dbe20c3e969e322 [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 Singha1892b22017-09-28 16:40:52 -070013uint64_t gbm_convert_usage(uint32_t usage)
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070014{
Gurchetan Singha1892b22017-09-28 16:40:52 -070015 uint64_t use_flags = BO_USE_NONE;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070016
Gurchetan Singha1892b22017-09-28 16:40:52 -070017 if (usage & GBM_BO_USE_SCANOUT)
18 use_flags |= BO_USE_SCANOUT;
19 if (usage & GBM_BO_USE_CURSOR)
20 use_flags |= BO_USE_CURSOR;
21 if (usage & GBM_BO_USE_CURSOR_64X64)
22 use_flags |= BO_USE_CURSOR_64X64;
23 if (usage & GBM_BO_USE_RENDERING)
24 use_flags |= BO_USE_RENDERING;
25 if (usage & GBM_BO_USE_TEXTURING)
26 use_flags |= BO_USE_TEXTURE;
27 if (usage & GBM_BO_USE_LINEAR)
28 use_flags |= BO_USE_LINEAR;
29 if (usage & GBM_BO_USE_CAMERA_WRITE)
30 use_flags |= BO_USE_CAMERA_WRITE;
31 if (usage & GBM_BO_USE_CAMERA_READ)
32 use_flags |= BO_USE_CAMERA_READ;
Tomasz Figae0807b12017-08-04 12:50:03 +090033 if (usage & GBM_BO_USE_PROTECTED)
34 use_flags |= BO_USE_PROTECTED;
Shirish S355b1562017-10-13 09:54:03 +053035 if (usage & GBM_BO_USE_SW_READ_OFTEN)
36 use_flags |= BO_USE_SW_READ_OFTEN;
37 if (usage & GBM_BO_USE_SW_READ_RARELY)
38 use_flags |= BO_USE_SW_READ_RARELY;
39 if (usage & GBM_BO_USE_SW_WRITE_OFTEN)
40 use_flags |= BO_USE_SW_WRITE_OFTEN;
41 if (usage & GBM_BO_USE_SW_WRITE_RARELY)
42 use_flags |= BO_USE_SW_WRITE_RARELY;
Kristian H. Kristensen3cb5bba2018-04-04 16:10:42 -070043 if (usage & GBM_BO_USE_HW_VIDEO_DECODER)
44 use_flags |= BO_USE_HW_VIDEO_DECODER;
Hirokazu Honda3b8d4d02019-07-31 16:35:52 +090045 if (usage & GBM_BO_USE_HW_VIDEO_ENCODER)
46 use_flags |= BO_USE_HW_VIDEO_ENCODER;
Rob Clark6f83a442020-10-05 12:10:51 -070047 if (usage & GBM_BO_USE_FRONT_RENDERING)
48 use_flags |= BO_USE_FRONT_RENDERING;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070049
Gurchetan Singha1892b22017-09-28 16:40:52 -070050 return use_flags;
Gurchetan Singh46faf6b2016-08-05 14:40:07 -070051}