mirror of
https://git.citron-emu.org/Citron/Citron.git
synced 2025-01-22 08:36:32 +01:00
nvdrv: Implement ZBCSetTable functionality
Implements basic Zero Bandwidth Clear (ZBC) table support in nvhost_ctrl_gpu. This adds storage and validation for both color and depth clear values, replacing the previous stub implementation. ZBC is a hardware optimization technique used by NVIDIA GPUs to efficiently handle buffer clearing operations. Changes include: - Added ZBC table storage structures - Implemented parameter validation - Added separate handling for color and depth modes - Improved debug logging - Added documentation explaining ZBC functionality
This commit is contained in:
parent
e11c6c03ec
commit
9be4bf9aa5
2 changed files with 44 additions and 2 deletions
|
@ -223,8 +223,30 @@ NvResult nvhost_ctrl_gpu::ZCullGetInfo(IoctlNvgpuGpuZcullGetInfoArgs& params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::ZBCSetTable(IoctlZbcSetTable& params) {
|
NvResult nvhost_ctrl_gpu::ZBCSetTable(IoctlZbcSetTable& params) {
|
||||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
LOG_DEBUG(Service_NVDRV, "called with index={}, format={}, mode={}",
|
||||||
// TODO(ogniK): What does this even actually do?
|
params.color_ds_table_index, params.format, params.mode);
|
||||||
|
|
||||||
|
// Validate parameters
|
||||||
|
if (params.color_ds_table_index >= MaxZBCTableSize || params.format >= MaxZBCFormats) {
|
||||||
|
return NvResult::InvalidArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the color/depth values
|
||||||
|
switch (params.mode) {
|
||||||
|
case ZBCTableMode::COLOR:
|
||||||
|
// Store color values
|
||||||
|
std::memcpy(zbc_color_table[params.color_ds_table_index].color_ds,
|
||||||
|
params.color_ds, sizeof(params.color_ds));
|
||||||
|
break;
|
||||||
|
case ZBCTableMode::DEPTH:
|
||||||
|
// Store depth values
|
||||||
|
std::memcpy(zbc_depth_table[params.color_ds_table_index].depth,
|
||||||
|
params.depth, sizeof(params.depth));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NvResult::InvalidArgument;
|
||||||
|
}
|
||||||
|
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -34,6 +35,25 @@ public:
|
||||||
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr std::size_t MaxZBCTableSize = 16;
|
||||||
|
static constexpr std::size_t MaxZBCFormats = 32;
|
||||||
|
|
||||||
|
enum class ZBCTableMode : u32 {
|
||||||
|
COLOR = 0,
|
||||||
|
DEPTH = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ZBCColorEntry {
|
||||||
|
u32 color_ds[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ZBCDepthEntry {
|
||||||
|
u32 depth[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
std::array<ZBCColorEntry, MaxZBCTableSize> zbc_color_table{};
|
||||||
|
std::array<ZBCDepthEntry, MaxZBCTableSize> zbc_depth_table{};
|
||||||
|
|
||||||
struct IoctlGpuCharacteristics {
|
struct IoctlGpuCharacteristics {
|
||||||
u32_le arch; // 0x120 (NVGPU_GPU_ARCH_GM200)
|
u32_le arch; // 0x120 (NVGPU_GPU_ARCH_GM200)
|
||||||
u32_le impl; // 0xB (NVGPU_GPU_IMPL_GM20B)
|
u32_le impl; // 0xB (NVGPU_GPU_IMPL_GM20B)
|
||||||
|
|
Loading…
Reference in a new issue