summaryrefslogtreecommitdiffstats
path: root/src/video_core/host1x/vic.h
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2022-10-06 21:29:53 +0200
committerGitHub <noreply@github.com>2022-10-06 21:29:53 +0200
commit1effa578f12f79d7816e3543291f302f126cc1d2 (patch)
tree14803b31b6817294d40d57446f6fa94c5ff3fe9a /src/video_core/host1x/vic.h
parentMerge pull request #9025 from FernandoS27/slava-ukrayini (diff)
parentvulkan_blitter: Fix pool allocation double free. (diff)
downloadyuzu-1effa578f12f79d7816e3543291f302f126cc1d2.tar
yuzu-1effa578f12f79d7816e3543291f302f126cc1d2.tar.gz
yuzu-1effa578f12f79d7816e3543291f302f126cc1d2.tar.bz2
yuzu-1effa578f12f79d7816e3543291f302f126cc1d2.tar.lz
yuzu-1effa578f12f79d7816e3543291f302f126cc1d2.tar.xz
yuzu-1effa578f12f79d7816e3543291f302f126cc1d2.tar.zst
yuzu-1effa578f12f79d7816e3543291f302f126cc1d2.zip
Diffstat (limited to 'src/video_core/host1x/vic.h')
-rw-r--r--src/video_core/host1x/vic.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/video_core/host1x/vic.h b/src/video_core/host1x/vic.h
new file mode 100644
index 000000000..2b78786e8
--- /dev/null
+++ b/src/video_core/host1x/vic.h
@@ -0,0 +1,66 @@
+// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <memory>
+#include <vector>
+#include "common/common_types.h"
+
+struct SwsContext;
+
+namespace Tegra {
+
+namespace Host1x {
+
+class Host1x;
+class Nvdec;
+union VicConfig;
+
+class Vic {
+public:
+ enum class Method : u32 {
+ Execute = 0xc0,
+ SetControlParams = 0x1c1,
+ SetConfigStructOffset = 0x1c2,
+ SetOutputSurfaceLumaOffset = 0x1c8,
+ SetOutputSurfaceChromaOffset = 0x1c9,
+ SetOutputSurfaceChromaUnusedOffset = 0x1ca
+ };
+
+ explicit Vic(Host1x& host1x, std::shared_ptr<Nvdec> nvdec_processor);
+
+ ~Vic();
+
+ /// Write to the device state.
+ void ProcessMethod(Method method, u32 argument);
+
+private:
+ void Execute();
+
+ void WriteRGBFrame(const AVFrame* frame, const VicConfig& config);
+
+ void WriteYUVFrame(const AVFrame* frame, const VicConfig& config);
+
+ Host1x& host1x;
+ std::shared_ptr<Tegra::Host1x::Nvdec> nvdec_processor;
+
+ /// Avoid reallocation of the following buffers every frame, as their
+ /// size does not change during a stream
+ using AVMallocPtr = std::unique_ptr<u8, decltype(&av_free)>;
+ AVMallocPtr converted_frame_buffer;
+ std::vector<u8> luma_buffer;
+ std::vector<u8> chroma_buffer;
+
+ GPUVAddr config_struct_address{};
+ GPUVAddr output_surface_luma_address{};
+ GPUVAddr output_surface_chroma_address{};
+
+ SwsContext* scaler_ctx{};
+ s32 scaler_width{};
+ s32 scaler_height{};
+};
+
+} // namespace Host1x
+
+} // namespace Tegra