From 34692ab826abc8f8faa61bdb2280b742424528f1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 7 Dec 2013 15:14:29 -0500 Subject: Remove unnecessary Src/ folders --- Source/Core/VideoCommon/OpcodeDecoding.h | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Source/Core/VideoCommon/OpcodeDecoding.h (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h new file mode 100644 index 0000000000..3263d2c7b0 --- /dev/null +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -0,0 +1,42 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#ifndef _OPCODE_DECODING_H +#define _OPCODE_DECODING_H + +#define GX_NOP 0x00 + +#define GX_LOAD_BP_REG 0x61 +#define GX_LOAD_CP_REG 0x08 +#define GX_LOAD_XF_REG 0x10 +#define GX_LOAD_INDX_A 0x20 +#define GX_LOAD_INDX_B 0x28 +#define GX_LOAD_INDX_C 0x30 +#define GX_LOAD_INDX_D 0x38 + +#define GX_CMD_CALL_DL 0x40 +#define GX_CMD_UNKNOWN_METRICS 0x44 +#define GX_CMD_INVL_VC 0x48 + +#define GX_PRIMITIVE_MASK 0x78 +#define GX_PRIMITIVE_SHIFT 3 +#define GX_VAT_MASK 0x07 + +//these are defined 1/8th of their real values and without their top bit +#define GX_DRAW_QUADS 0x0 // 0x80 +#define GX_DRAW_TRIANGLES 0x2 // 0x90 +#define GX_DRAW_TRIANGLE_STRIP 0x3 // 0x98 +#define GX_DRAW_TRIANGLE_FAN 0x4 // 0xA0 +#define GX_DRAW_LINES 0x5 // 0xA8 +#define GX_DRAW_LINE_STRIP 0x6 // 0xB0 +#define GX_DRAW_POINTS 0x7 // 0xB8 +#define GX_DRAW_NONE 0x1; // This is a fake value to used in the backends + +extern bool g_bRecordFifoData; + +void OpcodeDecoder_Init(); +void OpcodeDecoder_Shutdown(); +u32 OpcodeDecoder_Run(bool skipped_frame); +void ExecuteDisplayList(u32 address, u32 size); +#endif // _OPCODE_DECODING_H -- cgit v1.2.3 From 010a0d481ad0f5dd19182eafc411feec387404db Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 30 Jan 2014 15:51:20 +0100 Subject: VideoCommon: remove Cache Displaylist This option was known to break every second game and only boost a bit. It also seems to be broken because of streaming into pinned memory and buffer storage buffers. v2: also remove dlc_desc --- Source/Core/VideoCommon/OpcodeDecoding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 3263d2c7b0..36d130a8b5 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -38,5 +38,5 @@ extern bool g_bRecordFifoData; void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); u32 OpcodeDecoder_Run(bool skipped_frame); -void ExecuteDisplayList(u32 address, u32 size); +void InterpretDisplayList(u32 address, u32 size); #endif // _OPCODE_DECODING_H -- cgit v1.2.3 From d2038049f51192fbb55fbde2fc08128bacfb7707 Mon Sep 17 00:00:00 2001 From: lioncash Date: Mon, 10 Feb 2014 13:54:46 -0500 Subject: Replace all include guard ifdefs with "#pragma once" --- Source/Core/VideoCommon/OpcodeDecoding.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 36d130a8b5..bdc4976825 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -2,8 +2,7 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#ifndef _OPCODE_DECODING_H -#define _OPCODE_DECODING_H +#pragma once #define GX_NOP 0x00 @@ -39,4 +38,3 @@ void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); u32 OpcodeDecoder_Run(bool skipped_frame); void InterpretDisplayList(u32 address, u32 size); -#endif // _OPCODE_DECODING_H -- cgit v1.2.3 From 39d439fc48ef44d0a28113a10cb796cd8989f944 Mon Sep 17 00:00:00 2001 From: magumagu Date: Thu, 8 May 2014 16:53:18 -0700 Subject: Opcode decoding: handle missing opcodes 0x88 etc. Hardware testing shows that they do the same thing as the 0x80 family of opcodes: they draw quads. --- Source/Core/VideoCommon/OpcodeDecoding.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index bdc4976825..baf44bd40f 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -22,15 +22,17 @@ #define GX_PRIMITIVE_SHIFT 3 #define GX_VAT_MASK 0x07 -//these are defined 1/8th of their real values and without their top bit +// These values are the values extracted using GX_PRIMITIVE_MASK +// and GX_PRIMITIVE_SHIFT. +// GX_DRAW_QUADS_2 behaves the same way as GX_DRAW_QUADS. #define GX_DRAW_QUADS 0x0 // 0x80 +#define GX_DRAW_QUADS_2 0x1 // 0x88 #define GX_DRAW_TRIANGLES 0x2 // 0x90 #define GX_DRAW_TRIANGLE_STRIP 0x3 // 0x98 #define GX_DRAW_TRIANGLE_FAN 0x4 // 0xA0 #define GX_DRAW_LINES 0x5 // 0xA8 #define GX_DRAW_LINE_STRIP 0x6 // 0xB0 #define GX_DRAW_POINTS 0x7 // 0xB8 -#define GX_DRAW_NONE 0x1; // This is a fake value to used in the backends extern bool g_bRecordFifoData; -- cgit v1.2.3 From 608f9bcd6724c77fef9be8e45ec8f14b49e2b3fb Mon Sep 17 00:00:00 2001 From: comex Date: Mon, 1 Sep 2014 01:11:32 -0400 Subject: Refactor opcode decoding a bit to kill FifoCommandRunnable. Separated out from my gpu-determinism branch by request. It's not a big commit; I just like to write long commit messages. The main reason to kill it is hopefully a slight performance improvement from avoiding the double switch (especially in single core mode); however, this also improves cycle calculation, as described below. - FifoCommandRunnable is removed; in its stead, Decode returns the number of cycles (which only matters for "sync" GPU mode), or 0 if there was not enough data, and is also responsible for unknown opcode alerts. Decode and DecodeSemiNop are almost identical, so the latter is replaced with a skipped_frame parameter to Decode. Doesn't mean we can't improve skipped_frame mode to do less work; if, at such a point, branching on it has too much overhead (it certainly won't now), it can always be changed to a template parameter. - FifoCommandRunnable used a fixed, large cycle count for display lists, regardless of the contents. Presumably the actual hardware's processing time is mostly the processing time of whatever commands are in the list, and with this change InterpretDisplayList can just return the list's cycle count to be added to the total. (Since the calculation for this is part of Decode, it didn't seem easy to split this change up.) To facilitate this, Decode also gains an explicit 'end' parameter in lieu of FifoCommandRunnable's call to GetVideoBufferEndPtr, which can point to there or to the end of a display list (or elsewhere in gpu-determinism, but that's another story). Also, as a small optimization, InterpretDisplayList now calls OpcodeDecoder_Run rather than having its own Decode loop, to allow Decode to be inlined (haven't checked whether this actually happens though). skipped_frame mode still does not traverse display lists and uses the old fake value of 45 cycles. degasus has suggested that this hack is not essential for performance and can be removed, but I want to separate any potential performance impact of that from this commit. --- Source/Core/VideoCommon/OpcodeDecoding.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index baf44bd40f..2944863bbc 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -38,5 +38,4 @@ extern bool g_bRecordFifoData; void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); -u32 OpcodeDecoder_Run(bool skipped_frame); -void InterpretDisplayList(u32 address, u32 size); +u32 OpcodeDecoder_Run(bool skipped_frame, u8* end); -- cgit v1.2.3 From 8b84ddce9a3e9c889996e2022279f78ef7a4ab5c Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 3 Sep 2014 21:49:15 +0200 Subject: VideoCommon: rewrite frame skipping code --- Source/Core/VideoCommon/OpcodeDecoding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 2944863bbc..1702969825 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -38,4 +38,4 @@ extern bool g_bRecordFifoData; void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); -u32 OpcodeDecoder_Run(bool skipped_frame, u8* end); +u32 OpcodeDecoder_Run(u8* end); -- cgit v1.2.3 From 65af90669bd5f9e02bbaa994d51d5c83d147b868 Mon Sep 17 00:00:00 2001 From: comex Date: Wed, 27 Aug 2014 22:56:19 -0400 Subject: Add the 'desynced GPU thread' mode. It's a relatively big commit (less big with -w), but it's hard to test any of this separately... The basic problem is that in netplay or movies, the state of the CPU must be deterministic, including when the game receives notification that the GPU has processed FIFO data. Dual core mode notifies the game whenever the GPU thread actually gets around to doing the work, so it isn't deterministic. Single core mode is because it notifies the game 'instantly' (after processing the data synchronously), but it's too slow for many systems and games. My old dc-netplay branch worked as follows: everything worked as normal except the state of the CP registers was a lie, and the CPU thread only delivered results when idle detection triggered (waiting for the GPU if they weren't ready at that point). Usually, a game is idle iff all the work for the frame has been done, except for a small amount of work depending on the GPU result, so neither the CPU or the GPU waiting on the other affected performance much. However, it's possible that the game could be waiting for some earlier interrupt, and any of several games which, for whatever reason, never went into a detectable idle (even when I tried to improve the detection) would never receive results at all. (The current method should have better compatibility, but it also has slightly higher overhead and breaks some other things, so I want to reimplement this, hopefully with less impact on the code, in the future.) With this commit, the basic idea is that the CPU thread acts as if the work has been done instantly, like single core mode, but actually hands it off asynchronously to the GPU thread (after backing up some data that the game might change in memory before it's actually done). Since the work isn't done, any feedback from the GPU to the CPU, such as real XFB/EFB copies (virtual are OK), EFB pokes, performance queries, etc. is broken; but most games work with these options disabled, and there is no need to try to detect what the CPU thread is doing. Technically: when the flag g_use_deterministic_gpu_thread (currently stuck on) is on, the CPU thread calls RunGpu like in single core mode. This function synchronously copies the data from the FIFO to the internal video buffer and updates the CP registers, interrupts, etc. However, instead of the regular ReadDataFromFifo followed by running the opcode decoder, it runs ReadDataFromFifoOnCPU -> OpcodeDecoder_Preprocess, which relatively quickly scans through the FIFO data, detects SetFinish calls etc., which are immediately fired, and saves certain associated data from memory (e.g. display lists) in AuxBuffers (a parallel stream to the main FIFO, which is a bit slow at the moment), before handing the data off to the GPU thread to actually render. That makes up the bulk of this commit. In various circumstances, including the aforementioned EFB pokes and performance queries as well as swap requests (i.e. the end of a frame - we don't want the CPU potentially pumping out frames too quickly and the GPU falling behind*), SyncGPU is called to wait for actual completion. The overhead mainly comes from OpcodeDecoder_Preprocess (which is, again, synchronous), as well as the actual copying. Currently, display lists and such are escrowed from main memory even though they usually won't change over the course of a frame, and textures are not even though they might, resulting in a small chance of graphical glitches. When the texture locking (i.e. fault on write) code lands, I can make this all correct and maybe a little faster. * This suggests an alternate determinism method of just delaying results until a short time before the end of each frame. For all I know this might mostly work - I haven't tried it - but if any significant work hinges on the competion of render to texture etc., the frame will be missed. --- Source/Core/VideoCommon/OpcodeDecoding.h | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 1702969825..e5b1b23e89 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -39,3 +39,4 @@ extern bool g_bRecordFifoData; void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); u32 OpcodeDecoder_Run(u8* end); +void OpcodeDecoder_Preprocess(u8* write_ptr); -- cgit v1.2.3 From 6e774f1b6457939c61c7fe5a0b19c4751e8bb61e Mon Sep 17 00:00:00 2001 From: comex Date: Tue, 21 Oct 2014 02:01:38 -0400 Subject: Add missing includes where headers depend on other headers having been included first. This is good hygiene, and also happens to be required to build Dolphin using Clang modules. (Under this setup, each header file becomes a module, and each #include is automatically translated to a module import. Recursive includes still leak through (by default), but modules are compiled independently, and can't depend on defines or types having previously been set up. The main reason to retrofit it onto Dolphin is compilation performance - no more textual includes whatsoever, rather than putting a few blessed common headers into a PCH. Unfortunately, I found multiple Clang bugs while trying to build Dolphin this way, so it's not ready yet, but I can start with this prerequisite.) --- Source/Core/VideoCommon/OpcodeDecoding.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index e5b1b23e89..c454590f24 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -4,6 +4,8 @@ #pragma once +#include "Common/CommonTypes.h" + #define GX_NOP 0x00 #define GX_LOAD_BP_REG 0x61 -- cgit v1.2.3 From 90613a1bda4d80e4c2760ad5f3ebdefd53a19a87 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 15 Nov 2014 16:24:06 +0100 Subject: OpcodeDecoder: Skip recursiv display lists --- Source/Core/VideoCommon/OpcodeDecoding.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index c454590f24..a217da556e 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -40,5 +40,5 @@ extern bool g_bRecordFifoData; void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); -u32 OpcodeDecoder_Run(u8* end); -void OpcodeDecoder_Preprocess(u8* write_ptr); +u32 OpcodeDecoder_Run(u8* end, bool in_display_list); +void OpcodeDecoder_Preprocess(u8* end, bool in_display_list); -- cgit v1.2.3 From 4b22885ed8b7c56f5332b855defb83a24a0aa33c Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 26 Nov 2014 22:12:54 +0100 Subject: VideoCommon: fifo cleanups --- Source/Core/VideoCommon/OpcodeDecoding.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index a217da556e..96a79f35c7 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -40,5 +40,5 @@ extern bool g_bRecordFifoData; void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); -u32 OpcodeDecoder_Run(u8* end, bool in_display_list); -void OpcodeDecoder_Preprocess(u8* end, bool in_display_list); +u8* OpcodeDecoder_Run(u8* start, u8* end, u32* cycles, bool in_display_list); +u8* OpcodeDecoder_Preprocess(u8* start, u8* end, bool in_display_list); -- cgit v1.2.3 From 21970c4a2a728669687a687f61a8f7453319dd54 Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 27 Nov 2014 23:53:11 +0100 Subject: VideoCommon: cleanup OpcodeDecoder --- Source/Core/VideoCommon/OpcodeDecoding.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 96a79f35c7..5fd03e26f3 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -5,6 +5,7 @@ #pragma once #include "Common/CommonTypes.h" +#include "VideoCommon/DataReader.h" #define GX_NOP 0x00 @@ -40,5 +41,6 @@ extern bool g_bRecordFifoData; void OpcodeDecoder_Init(); void OpcodeDecoder_Shutdown(); -u8* OpcodeDecoder_Run(u8* start, u8* end, u32* cycles, bool in_display_list); -u8* OpcodeDecoder_Preprocess(u8* start, u8* end, bool in_display_list); + +template +u8* OpcodeDecoder_Run(DataReader src, u32* cycles, bool in_display_list); -- cgit v1.2.3 From cdff138c671c260527108e6771427c05f265f6a7 Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 13 Mar 2015 23:25:15 +1100 Subject: Show no more than one FIFO error per session. --- Source/Core/VideoCommon/OpcodeDecoding.h | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 5fd03e26f3..18be50eb35 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -8,6 +8,7 @@ #include "VideoCommon/DataReader.h" #define GX_NOP 0x00 +#define GX_UNKNOWN_RESET 0x01 #define GX_LOAD_BP_REG 0x61 #define GX_LOAD_CP_REG 0x08 -- cgit v1.2.3 From cefcb0ace9d363b3679b4e93bcc9ec05f1e5f4f8 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 18 May 2015 01:08:10 +0200 Subject: Update license headers to GPLv2+ --- Source/Core/VideoCommon/OpcodeDecoding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index 18be50eb35..cfc5a96917 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -1,5 +1,5 @@ // Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once -- cgit v1.2.3 From 30ebb2459eb97ba544547183854775df8460b475 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 24 May 2015 06:55:12 +0200 Subject: Set copyright year to when a file was created --- Source/Core/VideoCommon/OpcodeDecoding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/OpcodeDecoding.h') diff --git a/Source/Core/VideoCommon/OpcodeDecoding.h b/Source/Core/VideoCommon/OpcodeDecoding.h index cfc5a96917..ec1b2652e4 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/OpcodeDecoding.h @@ -1,4 +1,4 @@ -// Copyright 2013 Dolphin Emulator Project +// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -- cgit v1.2.3