diff options
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/graphic_buffer_producer.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/graphic_buffer_producer.h | 78 |
3 files changed, 100 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 78b1e68ea..045a08648 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -547,6 +547,8 @@ add_library(core STATIC | |||
| 547 | hle/service/nvflinger/consumer_base.cpp | 547 | hle/service/nvflinger/consumer_base.cpp |
| 548 | hle/service/nvflinger/consumer_base.h | 548 | hle/service/nvflinger/consumer_base.h |
| 549 | hle/service/nvflinger/consumer_listener.h | 549 | hle/service/nvflinger/consumer_listener.h |
| 550 | hle/service/nvflinger/graphic_buffer_producer.cpp | ||
| 551 | hle/service/nvflinger/graphic_buffer_producer.h | ||
| 550 | hle/service/nvflinger/nvflinger.cpp | 552 | hle/service/nvflinger/nvflinger.cpp |
| 551 | hle/service/nvflinger/nvflinger.h | 553 | hle/service/nvflinger/nvflinger.h |
| 552 | hle/service/nvflinger/parcel.h | 554 | hle/service/nvflinger/parcel.h |
diff --git a/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp b/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp new file mode 100644 index 000000000..3e3669c99 --- /dev/null +++ b/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 2 | // Copyright 2021 yuzu Emulator Project | ||
| 3 | // Copyright 2010 The Android Open Source Project | ||
| 4 | // Parts of this implementation were base on: | ||
| 5 | // https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/libs/gui/IGraphicBufferProducer.cpp | ||
| 6 | |||
| 7 | #pragma once | ||
| 8 | |||
| 9 | #include "core/hle/service/nvflinger/graphic_buffer_producer.h" | ||
| 10 | #include "core/hle/service/nvflinger/parcel.h" | ||
| 11 | |||
| 12 | namespace android { | ||
| 13 | |||
| 14 | QueueBufferInput::QueueBufferInput(Parcel& parcel) { | ||
| 15 | parcel.ReadFlattened(*this); | ||
| 16 | } | ||
| 17 | |||
| 18 | QueueBufferOutput::QueueBufferOutput() = default; | ||
| 19 | |||
| 20 | } // namespace android | ||
diff --git a/src/core/hle/service/nvflinger/graphic_buffer_producer.h b/src/core/hle/service/nvflinger/graphic_buffer_producer.h new file mode 100644 index 000000000..cad683cd3 --- /dev/null +++ b/src/core/hle/service/nvflinger/graphic_buffer_producer.h | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 2 | // Copyright 2021 yuzu Emulator Project | ||
| 3 | // Copyright 2010 The Android Open Source Project | ||
| 4 | // Parts of this implementation were base on: | ||
| 5 | // https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/include/gui/IGraphicBufferProducer.h | ||
| 6 | |||
| 7 | #pragma once | ||
| 8 | |||
| 9 | #include "common/common_funcs.h" | ||
| 10 | #include "common/common_types.h" | ||
| 11 | #include "core/hle/service/nvflinger/ui/fence.h" | ||
| 12 | #include "core/hle/service/nvflinger/ui/rect.h" | ||
| 13 | #include "core/hle/service/nvflinger/window.h" | ||
| 14 | |||
| 15 | namespace android { | ||
| 16 | |||
| 17 | class Parcel; | ||
| 18 | |||
| 19 | #pragma pack(push, 1) | ||
| 20 | struct QueueBufferInput final { | ||
| 21 | explicit QueueBufferInput(Parcel& parcel); | ||
| 22 | |||
| 23 | void Deflate(s64* timestamp_, bool* is_auto_timestamp_, Rect* crop_, | ||
| 24 | NativeWindowScalingMode* scaling_mode_, NativeWindowTransform* transform_, | ||
| 25 | u32* sticky_transform_, bool* async_, s32* swap_interval_, Fence* fence_) const { | ||
| 26 | *timestamp_ = timestamp; | ||
| 27 | *is_auto_timestamp_ = static_cast<bool>(is_auto_timestamp); | ||
| 28 | *crop_ = crop; | ||
| 29 | *scaling_mode_ = scaling_mode; | ||
| 30 | *transform_ = transform; | ||
| 31 | *sticky_transform_ = sticky_transform; | ||
| 32 | *async_ = static_cast<bool>(async); | ||
| 33 | *swap_interval_ = swap_interval; | ||
| 34 | *fence_ = fence; | ||
| 35 | } | ||
| 36 | |||
| 37 | private: | ||
| 38 | s64 timestamp{}; | ||
| 39 | s32 is_auto_timestamp{}; | ||
| 40 | Rect crop{}; | ||
| 41 | NativeWindowScalingMode scaling_mode{}; | ||
| 42 | NativeWindowTransform transform{}; | ||
| 43 | u32 sticky_transform{}; | ||
| 44 | s32 async{}; | ||
| 45 | s32 swap_interval{}; | ||
| 46 | Fence fence{}; | ||
| 47 | }; | ||
| 48 | #pragma pack(pop) | ||
| 49 | static_assert(sizeof(QueueBufferInput) == 84, "QueueBufferInput has wrong size"); | ||
| 50 | |||
| 51 | #pragma pack(push, 1) | ||
| 52 | struct QueueBufferOutput final { | ||
| 53 | QueueBufferOutput(); | ||
| 54 | |||
| 55 | void Deflate(u32* width_, u32* height_, u32* transform_hint_, u32* num_pending_buffers_) const { | ||
| 56 | *width_ = width; | ||
| 57 | *height_ = height; | ||
| 58 | *transform_hint_ = transform_hint; | ||
| 59 | *num_pending_buffers_ = num_pending_buffers; | ||
| 60 | } | ||
| 61 | |||
| 62 | void Inflate(u32 width_, u32 height_, u32 transform_hint_, u32 num_pending_buffers_) { | ||
| 63 | width = width_; | ||
| 64 | height = height_; | ||
| 65 | transform_hint = transform_hint_; | ||
| 66 | num_pending_buffers = num_pending_buffers_; | ||
| 67 | } | ||
| 68 | |||
| 69 | private: | ||
| 70 | u32 width{}; | ||
| 71 | u32 height{}; | ||
| 72 | u32 transform_hint{}; | ||
| 73 | u32 num_pending_buffers{}; | ||
| 74 | }; | ||
| 75 | #pragma pack(pop) | ||
| 76 | static_assert(sizeof(QueueBufferOutput) == 16, "QueueBufferOutput has wrong size"); | ||
| 77 | |||
| 78 | } // namespace android | ||