2026-04-29 16:41:25 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
2025-07-30 21:08:43 +02:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-10-26 23:07:36 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-10-27 02:09:17 -04:00
|
|
|
#include <memory>
|
2020-10-26 23:07:36 -04:00
|
|
|
#include <vector>
|
2026-04-29 16:41:25 +02:00
|
|
|
#include <variant>
|
2024-04-05 01:58:29 +02:00
|
|
|
|
2020-10-26 23:07:36 -04:00
|
|
|
#include "common/common_types.h"
|
2024-04-05 01:58:29 +02:00
|
|
|
#include "video_core/cdma_pusher.h"
|
|
|
|
|
#include "video_core/host1x/codecs/decoder.h"
|
2026-04-29 16:41:25 +02:00
|
|
|
#include "video_core/host1x/codecs/h264.h"
|
|
|
|
|
#include "video_core/host1x/codecs/vp8.h"
|
|
|
|
|
#include "video_core/host1x/codecs/vp9.h"
|
2020-10-26 23:07:36 -04:00
|
|
|
|
|
|
|
|
namespace Tegra {
|
|
|
|
|
|
2022-01-30 10:31:13 +01:00
|
|
|
namespace Host1x {
|
2022-01-30 22:26:01 +01:00
|
|
|
class Host1x;
|
2024-04-05 01:58:29 +02:00
|
|
|
class FrameQueue;
|
2022-01-30 22:26:01 +01:00
|
|
|
|
2024-04-05 01:58:29 +02:00
|
|
|
class Nvdec final : public CDmaPusher {
|
2020-10-26 23:07:36 -04:00
|
|
|
public:
|
2026-04-29 16:41:25 +02:00
|
|
|
explicit Nvdec(Host1x& host1x, s32 id, u32 syncpt);
|
2020-10-26 23:07:36 -04:00
|
|
|
~Nvdec();
|
|
|
|
|
|
|
|
|
|
/// Writes the method into the state, Invoke Execute() if encountered
|
2024-04-05 01:58:29 +02:00
|
|
|
void ProcessMethod(u32 method, u32 arg) override;
|
|
|
|
|
|
|
|
|
|
u32 GetSyncpoint() const {
|
|
|
|
|
return syncpoint;
|
|
|
|
|
}
|
2020-10-26 23:07:36 -04:00
|
|
|
|
|
|
|
|
private:
|
2024-04-05 01:58:29 +02:00
|
|
|
/// Create the decoder when the codec id is set
|
|
|
|
|
void CreateDecoder(NvdecCommon::VideoCodec codec);
|
|
|
|
|
|
2020-10-26 23:07:36 -04:00
|
|
|
/// Invoke codec to decode a frame
|
|
|
|
|
void Execute();
|
|
|
|
|
|
2026-04-29 16:41:25 +02:00
|
|
|
NvdecCommon::NvdecRegisters regs{};
|
|
|
|
|
std::variant<
|
|
|
|
|
Decoders::H264,
|
|
|
|
|
Decoders::VP8,
|
|
|
|
|
Decoders::VP9,
|
|
|
|
|
std::monostate
|
|
|
|
|
> decoder = std::monostate{};
|
2024-04-05 01:58:29 +02:00
|
|
|
s32 id;
|
|
|
|
|
u32 syncpoint;
|
2020-10-26 23:07:36 -04:00
|
|
|
};
|
2022-01-30 10:31:13 +01:00
|
|
|
|
|
|
|
|
} // namespace Host1x
|
|
|
|
|
|
2020-10-26 23:07:36 -04:00
|
|
|
} // namespace Tegra
|