summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp21
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h22
2 files changed, 21 insertions, 22 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
index 189b15655..2f618b122 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
@@ -223,28 +223,23 @@ NvResult nvhost_ctrl_gpu::ZCullGetInfo(IoctlNvgpuGpuZcullGetInfoArgs& params) {
}
NvResult nvhost_ctrl_gpu::ZBCSetTable(IoctlZbcSetTable& params) {
- LOG_DEBUG(Service_NVDRV, "called with index={}, format={}, mode={}",
+ LOG_DEBUG(Service_NVDRV, "called. index={}, format={}, mode={}",
params.color_ds_table_index, params.format, params.mode);
- // Validate parameters
if (params.color_ds_table_index >= MaxZBCTableSize || params.format >= MaxZBCFormats) {
- return NvResult::InvalidArgument;
+ return NvResult::BadParameter;
}
- // 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));
+ case 0: // Color table
+ 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));
+ case 1: // Depth table
+ zbc_depth_table[params.color_ds_table_index].depth[0] = params.depth;
break;
default:
- return NvResult::InvalidArgument;
+ return NvResult::BadParameter;
}
return NvResult::Success;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
index 2009de8c5..2ad752c07 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
@@ -45,11 +45,11 @@ private:
struct ZBCColorEntry {
u32 color_ds[4];
- };
+ } __attribute__((packed));
struct ZBCDepthEntry {
u32 depth[4];
- };
+ } __attribute__((packed));
std::array<ZBCColorEntry, MaxZBCTableSize> zbc_color_table{};
std::array<ZBCDepthEntry, MaxZBCTableSize> zbc_depth_table{};
@@ -139,14 +139,18 @@ private:
static_assert(sizeof(IoctlNvgpuGpuZcullGetInfoArgs) == 40,
"IoctlNvgpuGpuZcullGetInfoArgs is incorrect size");
+#pragma pack(push, 1)
struct IoctlZbcSetTable {
- u32_le color_ds[4];
- u32_le color_l2[4];
- u32_le depth;
- u32_le format;
- u32_le type;
- };
- static_assert(sizeof(IoctlZbcSetTable) == 44, "IoctlZbcSetTable is incorrect size");
+ u32 color_ds_table_index;
+ u32 format;
+ u32 mode;
+ u32 color_ds[4]; // 16 bytes
+ u32 color_l2[4]; // 16 bytes
+ u32 depth; // 4 bytes
+ } __attribute__((packed)); // Use GCC's packed attribute
+#pragma pack(pop)
+
+ static_assert(sizeof(IoctlZbcSetTable) == 48, "IoctlZbcSetTable is incorrect size");
struct IoctlZbcQueryTable {
u32_le color_ds[4];