early-access version 2731

This commit is contained in:
pineappleEA
2022-05-19 07:27:35 +02:00
parent c7aa528a40
commit e1efbad3be
33 changed files with 1092 additions and 1006 deletions

View File

@@ -37,16 +37,18 @@ NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>&
void nvdisp_disp0::OnOpen(DeviceFD fd) {}
void nvdisp_disp0::OnClose(DeviceFD fd) {}
void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width,
u32 height, u32 stride, android::BufferTransformFlags transform,
void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height,
u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform,
const Common::Rectangle<int>& crop_rect) {
const VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle);
LOG_TRACE(Service,
"Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}",
addr, offset, width, height, stride, format);
const Tegra::FramebufferConfig framebuffer{addr, offset, width, height,
stride, format, transform, crop_rect};
const auto pixel_format = static_cast<Tegra::FramebufferConfig::PixelFormat>(format);
const auto transform_flags = static_cast<Tegra::FramebufferConfig::TransformFlags>(transform);
const Tegra::FramebufferConfig framebuffer{addr, offset, width, height,
stride, pixel_format, transform_flags, crop_rect};
system.GetPerfStats().EndSystemFrame();
system.GPU().SwapBuffers(&framebuffer);

View File

@@ -8,8 +8,7 @@
#include "common/common_types.h"
#include "common/math_util.h"
#include "core/hle/service/nvdrv/devices/nvdevice.h"
#include "core/hle/service/nvflinger/buffer_transform_flags.h"
#include "core/hle/service/nvflinger/pixel_format.h"
#include "core/hle/service/nvflinger/buffer_queue.h"
namespace Service::Nvidia::Devices {
@@ -31,8 +30,8 @@ public:
void OnClose(DeviceFD fd) override;
/// Performs a screen flip, drawing the buffer pointed to by the handle.
void flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width, u32 height,
u32 stride, android::BufferTransformFlags transform,
void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride,
NVFlinger::BufferQueue::BufferTransformFlags transform,
const Common::Rectangle<int>& crop_rect);
private:

View File

@@ -186,7 +186,7 @@ NvResult nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::ve
return NvResult::Success;
}
static std::vector<Tegra::CommandHeader> BuildWaitCommandList(NvFence fence) {
static std::vector<Tegra::CommandHeader> BuildWaitCommandList(Fence fence) {
return {
Tegra::BuildCommandHeader(Tegra::BufferMethods::FenceValue, 1,
Tegra::SubmissionMode::Increasing),
@@ -197,8 +197,7 @@ static std::vector<Tegra::CommandHeader> BuildWaitCommandList(NvFence fence) {
};
}
static std::vector<Tegra::CommandHeader> BuildIncrementCommandList(NvFence fence,
u32 add_increment) {
static std::vector<Tegra::CommandHeader> BuildIncrementCommandList(Fence fence, u32 add_increment) {
std::vector<Tegra::CommandHeader> result{
Tegra::BuildCommandHeader(Tegra::BufferMethods::FenceValue, 1,
Tegra::SubmissionMode::Increasing),
@@ -213,7 +212,7 @@ static std::vector<Tegra::CommandHeader> BuildIncrementCommandList(NvFence fence
return result;
}
static std::vector<Tegra::CommandHeader> BuildIncrementWithWfiCommandList(NvFence fence,
static std::vector<Tegra::CommandHeader> BuildIncrementWithWfiCommandList(Fence fence,
u32 add_increment) {
std::vector<Tegra::CommandHeader> result{
Tegra::BuildCommandHeader(Tegra::BufferMethods::WaitForInterrupt, 1,

View File

@@ -108,7 +108,7 @@ private:
static_assert(sizeof(IoctlGetErrorNotification) == 16,
"IoctlGetErrorNotification is incorrect size");
static_assert(sizeof(NvFence) == 8, "Fence is incorrect size");
static_assert(sizeof(Fence) == 8, "Fence is incorrect size");
struct IoctlAllocGpfifoEx {
u32_le num_entries{};
@@ -126,7 +126,7 @@ private:
u32_le num_entries{}; // in
u32_le flags{}; // in
u32_le unk0{}; // in (1 works)
NvFence fence_out{}; // out
Fence fence_out{}; // out
u32_le unk1{}; // in
u32_le unk2{}; // in
u32_le unk3{}; // in
@@ -152,13 +152,13 @@ private:
BitField<4, 1, u32_le> suppress_wfi; // suppress wait for interrupt
BitField<8, 1, u32_le> increment; // increment the returned fence
} flags;
NvFence fence_out{}; // returned new fence object for others to wait on
Fence fence_out{}; // returned new fence object for others to wait on
u32 AddIncrementValue() const {
return flags.add_increment.Value() << 1;
}
};
static_assert(sizeof(IoctlSubmitGpfifo) == 16 + sizeof(NvFence),
static_assert(sizeof(IoctlSubmitGpfifo) == 16 + sizeof(Fence),
"IoctlSubmitGpfifo is incorrect size");
struct IoctlGetWaitbase {
@@ -193,7 +193,7 @@ private:
std::shared_ptr<nvmap> nvmap_dev;
SyncpointManager& syncpoint_manager;
NvFence channel_fence;
Fence channel_fence;
};
} // namespace Service::Nvidia::Devices

View File

@@ -15,11 +15,17 @@ using DeviceFD = s32;
constexpr DeviceFD INVALID_NVDRV_FD = -1;
struct NvFence {
struct Fence {
s32 id;
u32 value;
};
static_assert(sizeof(NvFence) == 8, "NvFence has wrong size");
static_assert(sizeof(Fence) == 8, "Fence has wrong size");
struct MultiFence {
u32 num_fences;
std::array<Fence, 4> fences;
};
enum class NvResult : u32 {
Success = 0x0,

View File

@@ -11,7 +11,6 @@
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/nvdrv/nvdata.h"
#include "core/hle/service/nvdrv/syncpoint_manager.h"
#include "core/hle/service/nvflinger/ui/fence.h"
#include "core/hle/service/service.h"
namespace Core {
@@ -37,7 +36,7 @@ class nvdevice;
/// Represents an Nvidia event
struct NvEvent {
Kernel::KEvent* event{};
NvFence fence{};
Fence fence{};
};
struct EventInterface {