summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/gsp_gpu.cpp13
-rw-r--r--src/video_core/command_processor.cpp6
-rw-r--r--src/video_core/pica.h10
3 files changed, 21 insertions, 8 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index b03060ed3..34eabac45 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -173,6 +173,7 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
173 * Signals that the specified interrupt type has occurred to userland code 173 * Signals that the specified interrupt type has occurred to userland code
174 * @param interrupt_id ID of interrupt that is being signalled 174 * @param interrupt_id ID of interrupt that is being signalled
175 * @todo This should probably take a thread_id parameter and only signal this thread? 175 * @todo This should probably take a thread_id parameter and only signal this thread?
176 * @todo This probably does not belong in the GSP module, instead move to video_core
176 */ 177 */
177void SignalInterrupt(InterruptId interrupt_id) { 178void SignalInterrupt(InterruptId interrupt_id) {
178 if (0 == g_interrupt_event) { 179 if (0 == g_interrupt_event) {
@@ -211,6 +212,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
211 memcpy(Memory::GetPointer(command.dma_request.dest_address), 212 memcpy(Memory::GetPointer(command.dma_request.dest_address),
212 Memory::GetPointer(command.dma_request.source_address), 213 Memory::GetPointer(command.dma_request.source_address),
213 command.dma_request.size); 214 command.dma_request.size);
215 SignalInterrupt(InterruptId::DMA);
214 break; 216 break;
215 217
216 // ctrulib homebrew sends all relevant command list data with this command, 218 // ctrulib homebrew sends all relevant command list data with this command,
@@ -219,13 +221,13 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
219 case CommandId::SET_COMMAND_LIST_LAST: 221 case CommandId::SET_COMMAND_LIST_LAST:
220 { 222 {
221 auto& params = command.set_command_list_last; 223 auto& params = command.set_command_list_last;
224
222 WriteGPURegister(GPU_REG_INDEX(command_processor_config.address), Memory::VirtualToPhysicalAddress(params.address) >> 3); 225 WriteGPURegister(GPU_REG_INDEX(command_processor_config.address), Memory::VirtualToPhysicalAddress(params.address) >> 3);
223 WriteGPURegister(GPU_REG_INDEX(command_processor_config.size), params.size); 226 WriteGPURegister(GPU_REG_INDEX(command_processor_config.size), params.size);
224 227
225 // TODO: Not sure if we are supposed to always write this .. seems to trigger processing though 228 // TODO: Not sure if we are supposed to always write this .. seems to trigger processing though
226 WriteGPURegister(GPU_REG_INDEX(command_processor_config.trigger), 1); 229 WriteGPURegister(GPU_REG_INDEX(command_processor_config.trigger), 1);
227 230
228 SignalInterrupt(InterruptId::P3D);
229 break; 231 break;
230 } 232 }
231 233
@@ -243,6 +245,8 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
243 WriteGPURegister(GPU_REG_INDEX(memory_fill_config[1].address_end), Memory::VirtualToPhysicalAddress(params.end2) >> 3); 245 WriteGPURegister(GPU_REG_INDEX(memory_fill_config[1].address_end), Memory::VirtualToPhysicalAddress(params.end2) >> 3);
244 WriteGPURegister(GPU_REG_INDEX(memory_fill_config[1].size), params.end2 - params.start2); 246 WriteGPURegister(GPU_REG_INDEX(memory_fill_config[1].size), params.end2 - params.start2);
245 WriteGPURegister(GPU_REG_INDEX(memory_fill_config[1].value), params.value2); 247 WriteGPURegister(GPU_REG_INDEX(memory_fill_config[1].value), params.value2);
248
249 SignalInterrupt(InterruptId::PSC0);
246 break; 250 break;
247 } 251 }
248 252
@@ -256,14 +260,9 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
256 WriteGPURegister(GPU_REG_INDEX(display_transfer_config.flags), params.flags); 260 WriteGPURegister(GPU_REG_INDEX(display_transfer_config.flags), params.flags);
257 WriteGPURegister(GPU_REG_INDEX(display_transfer_config.trigger), 1); 261 WriteGPURegister(GPU_REG_INDEX(display_transfer_config.trigger), 1);
258 262
259 // TODO(bunnei): Signalling all of these interrupts here is totally wrong, but it seems to 263 // TODO(bunnei): Determine if these interrupts should be signalled here.
260 // work well enough for running demos. Need to figure out how these all work and trigger
261 // them correctly.
262 SignalInterrupt(InterruptId::PSC0);
263 SignalInterrupt(InterruptId::PSC1); 264 SignalInterrupt(InterruptId::PSC1);
264 SignalInterrupt(InterruptId::PPF); 265 SignalInterrupt(InterruptId::PPF);
265 SignalInterrupt(InterruptId::P3D);
266 SignalInterrupt(InterruptId::DMA);
267 266
268 // Update framebuffer information if requested 267 // Update framebuffer information if requested
269 for (int screen_id = 0; screen_id < 2; ++screen_id) { 268 for (int screen_id = 0; screen_id < 2; ++screen_id) {
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 585323a81..431139cc2 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -8,6 +8,7 @@
8#include "pica.h" 8#include "pica.h"
9#include "primitive_assembly.h" 9#include "primitive_assembly.h"
10#include "vertex_shader.h" 10#include "vertex_shader.h"
11#include "core/hle/service/gsp_gpu.h"
11 12
12#include "debug_utils/debug_utils.h" 13#include "debug_utils/debug_utils.h"
13 14
@@ -40,6 +41,11 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
40 DebugUtils::OnPicaRegWrite(id, registers[id]); 41 DebugUtils::OnPicaRegWrite(id, registers[id]);
41 42
42 switch(id) { 43 switch(id) {
44 // Trigger IRQ
45 case PICA_REG_INDEX(trigger_irq):
46 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::P3D);
47 return;
48
43 // It seems like these trigger vertex rendering 49 // It seems like these trigger vertex rendering
44 case PICA_REG_INDEX(trigger_draw): 50 case PICA_REG_INDEX(trigger_draw):
45 case PICA_REG_INDEX(trigger_draw_indexed): 51 case PICA_REG_INDEX(trigger_draw_indexed):
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index e7ca38978..8bac178ca 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -45,10 +45,16 @@ struct Regs {
45#define INSERT_PADDING_WORDS_HELPER2(x, y) INSERT_PADDING_WORDS_HELPER1(x, y) 45#define INSERT_PADDING_WORDS_HELPER2(x, y) INSERT_PADDING_WORDS_HELPER1(x, y)
46#define INSERT_PADDING_WORDS(num_words) u32 INSERT_PADDING_WORDS_HELPER2(pad, __LINE__)[(num_words)]; 46#define INSERT_PADDING_WORDS(num_words) u32 INSERT_PADDING_WORDS_HELPER2(pad, __LINE__)[(num_words)];
47 47
48 INSERT_PADDING_WORDS(0x41); 48 INSERT_PADDING_WORDS(0x10);
49
50 u32 trigger_irq;
51
52 INSERT_PADDING_WORDS(0x30);
49 53
50 BitField<0, 24, u32> viewport_size_x; 54 BitField<0, 24, u32> viewport_size_x;
55
51 INSERT_PADDING_WORDS(0x1); 56 INSERT_PADDING_WORDS(0x1);
57
52 BitField<0, 24, u32> viewport_size_y; 58 BitField<0, 24, u32> viewport_size_y;
53 59
54 INSERT_PADDING_WORDS(0x9); 60 INSERT_PADDING_WORDS(0x9);
@@ -544,6 +550,7 @@ struct Regs {
544 map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \ 550 map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \
545 } while(false) 551 } while(false)
546 552
553 ADD_FIELD(trigger_irq);
547 ADD_FIELD(viewport_size_x); 554 ADD_FIELD(viewport_size_x);
548 ADD_FIELD(viewport_size_y); 555 ADD_FIELD(viewport_size_y);
549 ADD_FIELD(viewport_depth_range); 556 ADD_FIELD(viewport_depth_range);
@@ -607,6 +614,7 @@ private:
607#ifndef _MSC_VER 614#ifndef _MSC_VER
608#define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(Regs, field_name) == position * 4, "Field "#field_name" has invalid position") 615#define ASSERT_REG_POSITION(field_name, position) static_assert(offsetof(Regs, field_name) == position * 4, "Field "#field_name" has invalid position")
609 616
617ASSERT_REG_POSITION(trigger_irq, 0x10);
610ASSERT_REG_POSITION(viewport_size_x, 0x41); 618ASSERT_REG_POSITION(viewport_size_x, 0x41);
611ASSERT_REG_POSITION(viewport_size_y, 0x43); 619ASSERT_REG_POSITION(viewport_size_y, 0x43);
612ASSERT_REG_POSITION(viewport_depth_range, 0x4d); 620ASSERT_REG_POSITION(viewport_depth_range, 0x4d);