android_external_minigbm/gbm_helpers.c
Jason Macnak 80f664c422 minigbm: passthrough SENSOR_DIRECT_DATA via gbm frontend
BUG=b:238609372
TEST=vts -m VtsHalSensorsV2_1TargetTest

Change-Id: I37834f80d71e453e6e29b88198efc1584c109456
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3773926
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
2022-07-26 23:41:35 +00:00

55 lines
1.6 KiB
C

/*
* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stddef.h>
#include <stdio.h>
#include "drv.h"
#include "gbm.h"
uint64_t gbm_convert_usage(uint32_t usage)
{
uint64_t use_flags = BO_USE_NONE;
if (usage & GBM_BO_USE_SCANOUT)
use_flags |= BO_USE_SCANOUT;
if (usage & GBM_BO_USE_CURSOR)
use_flags |= BO_USE_CURSOR;
if (usage & GBM_BO_USE_CURSOR_64X64)
use_flags |= BO_USE_CURSOR_64X64;
if (usage & GBM_BO_USE_RENDERING)
use_flags |= BO_USE_RENDERING;
if (usage & GBM_BO_USE_TEXTURING)
use_flags |= BO_USE_TEXTURE;
if (usage & GBM_BO_USE_LINEAR)
use_flags |= BO_USE_LINEAR;
if (usage & GBM_BO_USE_CAMERA_WRITE)
use_flags |= BO_USE_CAMERA_WRITE;
if (usage & GBM_BO_USE_CAMERA_READ)
use_flags |= BO_USE_CAMERA_READ;
if (usage & GBM_BO_USE_PROTECTED)
use_flags |= BO_USE_PROTECTED;
if (usage & GBM_BO_USE_SW_READ_OFTEN)
use_flags |= BO_USE_SW_READ_OFTEN;
if (usage & GBM_BO_USE_SW_READ_RARELY)
use_flags |= BO_USE_SW_READ_RARELY;
if (usage & GBM_BO_USE_SW_WRITE_OFTEN)
use_flags |= BO_USE_SW_WRITE_OFTEN;
if (usage & GBM_BO_USE_SW_WRITE_RARELY)
use_flags |= BO_USE_SW_WRITE_RARELY;
if (usage & GBM_BO_USE_HW_VIDEO_DECODER)
use_flags |= BO_USE_HW_VIDEO_DECODER;
if (usage & GBM_BO_USE_HW_VIDEO_ENCODER)
use_flags |= BO_USE_HW_VIDEO_ENCODER;
if (usage & GBM_BO_USE_FRONT_RENDERING)
use_flags |= BO_USE_FRONT_RENDERING;
if (usage & GBM_BO_USE_GPU_DATA_BUFFER)
use_flags |= BO_USE_GPU_DATA_BUFFER;
if (usage & GBM_BO_USE_SENSOR_DIRECT_DATA)
use_flags |= BO_USE_SENSOR_DIRECT_DATA;
return use_flags;
}