From d25cb12bffe93bcd2c37cb02d96c0d4c7d006002 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 11 Nov 2021 18:39:29 -0800 Subject: [PATCH] hle: nvflinger: Add implementation for BufferSlot class. --- src/core/CMakeLists.txt | 1 + src/core/hle/service/nvflinger/buffer_slot.h | 39 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/core/hle/service/nvflinger/buffer_slot.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a1139068d..fd2777b11 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -540,6 +540,7 @@ add_library(core STATIC hle/service/nvflinger/binder.h hle/service/nvflinger/buffer_item.h hle/service/nvflinger/buffer_queue_defs.h + hle/service/nvflinger/buffer_slot.h hle/service/nvflinger/buffer_transform_flags.h hle/service/nvflinger/consumer_listener.h hle/service/nvflinger/nvflinger.cpp diff --git a/src/core/hle/service/nvflinger/buffer_slot.h b/src/core/hle/service/nvflinger/buffer_slot.h new file mode 100644 index 000000000..24b806d33 --- /dev/null +++ b/src/core/hle/service/nvflinger/buffer_slot.h @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright 2021 yuzu Emulator Project +// Copyright 2014 The Android Open Source Project +// Parts of this implementation were base on: +// https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/include/gui/BufferSlot.h + +#pragma once + +#include + +#include "common/common_types.h" +#include "core/hle/service/nvflinger/ui/fence.h" + +namespace android { + +class GraphicBuffer; + +enum class BufferState : u32 { + Free = 0, + Dequeued = 1, + Queued = 2, + Acquired = 3, +}; + +struct BufferSlot final { + constexpr BufferSlot() = default; + + std::shared_ptr graphic_buffer; + BufferState buffer_state{BufferState::Free}; + bool request_buffer_called{}; + u64 frame_number{}; + Fence fence; + bool acquire_called{}; + bool needs_cleanup_on_release{}; + bool attached_by_consumer{}; + bool is_preallocated{}; +}; + +} // namespace android