diff options
| author | 2020-04-20 02:16:56 -0400 | |
|---|---|---|
| committer | 2020-04-23 08:52:55 -0400 | |
| commit | 3fedcc2f6e001f0ed1fd791de4f9692570359eef (patch) | |
| tree | 49109516beab33d825cc653d4e885107304da332 /src/video_core/engines | |
| parent | Merge pull request #3730 from lioncash/time (diff) | |
| download | yuzu-3fedcc2f6e001f0ed1fd791de4f9692570359eef.tar.gz yuzu-3fedcc2f6e001f0ed1fd791de4f9692570359eef.tar.xz yuzu-3fedcc2f6e001f0ed1fd791de4f9692570359eef.zip | |
DMAPusher: Propagate multimethod writes into the engines.
Diffstat (limited to 'src/video_core/engines')
| -rw-r--r-- | src/video_core/engines/fermi_2d.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/engines/fermi_2d.h | 3 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.h | 3 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_memory.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_memory.h | 3 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 52 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 4 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.h | 3 |
10 files changed, 92 insertions, 0 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index bace6affb..8a47614d2 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp | |||
| @@ -28,6 +28,12 @@ void Fermi2D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | void Fermi2D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { | ||
| 32 | for (std::size_t i = 0; i < amount; i++) { | ||
| 33 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 31 | static std::pair<u32, u32> DelimitLine(u32 src_1, u32 src_2, u32 dst_1, u32 dst_2, u32 src_line) { | 37 | static std::pair<u32, u32> DelimitLine(u32 src_1, u32 src_2, u32 dst_1, u32 dst_2, u32 src_line) { |
| 32 | const u32 line_a = src_2 - src_1; | 38 | const u32 line_a = src_2 - src_1; |
| 33 | const u32 line_b = dst_2 - dst_1; | 39 | const u32 line_b = dst_2 - dst_1; |
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h index dba342c70..939a5966d 100644 --- a/src/video_core/engines/fermi_2d.h +++ b/src/video_core/engines/fermi_2d.h | |||
| @@ -39,6 +39,9 @@ public: | |||
| 39 | /// Write the value to the register identified by method. | 39 | /// Write the value to the register identified by method. |
| 40 | void CallMethod(const GPU::MethodCall& method_call); | 40 | void CallMethod(const GPU::MethodCall& method_call); |
| 41 | 41 | ||
| 42 | /// Write multiple values to the register identified by method. | ||
| 43 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | ||
| 44 | |||
| 42 | enum class Origin : u32 { | 45 | enum class Origin : u32 { |
| 43 | Center = 0, | 46 | Center = 0, |
| 44 | Corner = 1, | 47 | Corner = 1, |
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp index 368c75a66..894300f57 100644 --- a/src/video_core/engines/kepler_compute.cpp +++ b/src/video_core/engines/kepler_compute.cpp | |||
| @@ -51,6 +51,12 @@ void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) { | |||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void KeplerCompute::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { | ||
| 55 | for (std::size_t i = 0; i < amount; i++) { | ||
| 56 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 54 | Texture::FullTextureInfo KeplerCompute::GetTexture(std::size_t offset) const { | 60 | Texture::FullTextureInfo KeplerCompute::GetTexture(std::size_t offset) const { |
| 55 | const std::bitset<8> cbuf_mask = launch_description.const_buffer_enable_mask.Value(); | 61 | const std::bitset<8> cbuf_mask = launch_description.const_buffer_enable_mask.Value(); |
| 56 | ASSERT(cbuf_mask[regs.tex_cb_index]); | 62 | ASSERT(cbuf_mask[regs.tex_cb_index]); |
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h index eeb79c56f..fe55fdfd0 100644 --- a/src/video_core/engines/kepler_compute.h +++ b/src/video_core/engines/kepler_compute.h | |||
| @@ -202,6 +202,9 @@ public: | |||
| 202 | /// Write the value to the register identified by method. | 202 | /// Write the value to the register identified by method. |
| 203 | void CallMethod(const GPU::MethodCall& method_call); | 203 | void CallMethod(const GPU::MethodCall& method_call); |
| 204 | 204 | ||
| 205 | /// Write multiple values to the register identified by method. | ||
| 206 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | ||
| 207 | |||
| 205 | Texture::FullTextureInfo GetTexture(std::size_t offset) const; | 208 | Texture::FullTextureInfo GetTexture(std::size_t offset) const; |
| 206 | 209 | ||
| 207 | /// Given a texture handle, returns the TSC and TIC entries. | 210 | /// Given a texture handle, returns the TSC and TIC entries. |
diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp index 597872e43..e906a1124 100644 --- a/src/video_core/engines/kepler_memory.cpp +++ b/src/video_core/engines/kepler_memory.cpp | |||
| @@ -41,4 +41,10 @@ void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) { | |||
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { | ||
| 45 | for (std::size_t i = 0; i < amount; i++) { | ||
| 46 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 44 | } // namespace Tegra::Engines | 50 | } // namespace Tegra::Engines |
diff --git a/src/video_core/engines/kepler_memory.h b/src/video_core/engines/kepler_memory.h index 396fb6e86..bb26fb030 100644 --- a/src/video_core/engines/kepler_memory.h +++ b/src/video_core/engines/kepler_memory.h | |||
| @@ -40,6 +40,9 @@ public: | |||
| 40 | /// Write the value to the register identified by method. | 40 | /// Write the value to the register identified by method. |
| 41 | void CallMethod(const GPU::MethodCall& method_call); | 41 | void CallMethod(const GPU::MethodCall& method_call); |
| 42 | 42 | ||
| 43 | /// Write multiple values to the register identified by method. | ||
| 44 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | ||
| 45 | |||
| 43 | struct Regs { | 46 | struct Regs { |
| 44 | static constexpr size_t NUM_REGS = 0x7F; | 47 | static constexpr size_t NUM_REGS = 0x7F; |
| 45 | 48 | ||
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 2824ed707..879ce542a 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -280,6 +280,36 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 280 | } | 280 | } |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { | ||
| 284 | switch (method) { | ||
| 285 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]): | ||
| 286 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]): | ||
| 287 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]): | ||
| 288 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[3]): | ||
| 289 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[4]): | ||
| 290 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[5]): | ||
| 291 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[6]): | ||
| 292 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[7]): | ||
| 293 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[8]): | ||
| 294 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[9]): | ||
| 295 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[10]): | ||
| 296 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[11]): | ||
| 297 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[12]): | ||
| 298 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[13]): | ||
| 299 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[14]): | ||
| 300 | case MAXWELL3D_REG_INDEX(const_buffer.cb_data[15]): { | ||
| 301 | ProcessCBMultiData(method, base_start, amount); | ||
| 302 | break; | ||
| 303 | } | ||
| 304 | default: { | ||
| 305 | for (std::size_t i = 0; i < amount; i++) { | ||
| 306 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | ||
| 307 | } | ||
| 308 | } | ||
| 309 | } | ||
| 310 | |||
| 311 | } | ||
| 312 | |||
| 283 | void Maxwell3D::StepInstance(const MMEDrawMode expected_mode, const u32 count) { | 313 | void Maxwell3D::StepInstance(const MMEDrawMode expected_mode, const u32 count) { |
| 284 | if (mme_draw.current_mode == MMEDrawMode::Undefined) { | 314 | if (mme_draw.current_mode == MMEDrawMode::Undefined) { |
| 285 | if (mme_draw.gl_begin_consume) { | 315 | if (mme_draw.gl_begin_consume) { |
| @@ -570,6 +600,28 @@ void Maxwell3D::StartCBData(u32 method) { | |||
| 570 | ProcessCBData(regs.const_buffer.cb_data[cb_data_state.id]); | 600 | ProcessCBData(regs.const_buffer.cb_data[cb_data_state.id]); |
| 571 | } | 601 | } |
| 572 | 602 | ||
| 603 | void Maxwell3D::ProcessCBMultiData(u32 method, const u32* start_base, u32 amount) { | ||
| 604 | if (cb_data_state.current != method) { | ||
| 605 | if (cb_data_state.current != null_cb_data) { | ||
| 606 | FinishCBData(); | ||
| 607 | } | ||
| 608 | constexpr u32 first_cb_data = MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]); | ||
| 609 | cb_data_state.start_pos = regs.const_buffer.cb_pos; | ||
| 610 | cb_data_state.id = method - first_cb_data; | ||
| 611 | cb_data_state.current = method; | ||
| 612 | cb_data_state.counter = 0; | ||
| 613 | } | ||
| 614 | const std::size_t id = cb_data_state.id; | ||
| 615 | const std::size_t size = amount; | ||
| 616 | std::size_t i = 0; | ||
| 617 | for (; i < size; i++) { | ||
| 618 | cb_data_state.buffer[id][cb_data_state.counter] = start_base[i]; | ||
| 619 | cb_data_state.counter++; | ||
| 620 | } | ||
| 621 | // Increment the current buffer position. | ||
| 622 | regs.const_buffer.cb_pos = regs.const_buffer.cb_pos + 4 * amount; | ||
| 623 | } | ||
| 624 | |||
| 573 | void Maxwell3D::FinishCBData() { | 625 | void Maxwell3D::FinishCBData() { |
| 574 | // Write the input value to the current const buffer at the current position. | 626 | // Write the input value to the current const buffer at the current position. |
| 575 | const GPUVAddr buffer_address = regs.const_buffer.BufferAddress(); | 627 | const GPUVAddr buffer_address = regs.const_buffer.BufferAddress(); |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 59d5752d2..cfcda4f53 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -1358,6 +1358,9 @@ public: | |||
| 1358 | /// Write the value to the register identified by method. | 1358 | /// Write the value to the register identified by method. |
| 1359 | void CallMethod(const GPU::MethodCall& method_call); | 1359 | void CallMethod(const GPU::MethodCall& method_call); |
| 1360 | 1360 | ||
| 1361 | /// Write multiple values to the register identified by method. | ||
| 1362 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | ||
| 1363 | |||
| 1361 | /// Write the value to the register identified by method. | 1364 | /// Write the value to the register identified by method. |
| 1362 | void CallMethodFromMME(const GPU::MethodCall& method_call); | 1365 | void CallMethodFromMME(const GPU::MethodCall& method_call); |
| 1363 | 1366 | ||
| @@ -1511,6 +1514,7 @@ private: | |||
| 1511 | /// Handles a write to the CB_DATA[i] register. | 1514 | /// Handles a write to the CB_DATA[i] register. |
| 1512 | void StartCBData(u32 method); | 1515 | void StartCBData(u32 method); |
| 1513 | void ProcessCBData(u32 value); | 1516 | void ProcessCBData(u32 value); |
| 1517 | void ProcessCBMultiData(u32 method, const u32* start_base, u32 amount); | ||
| 1514 | void FinishCBData(); | 1518 | void FinishCBData(); |
| 1515 | 1519 | ||
| 1516 | /// Handles a write to the CB_BIND register. | 1520 | /// Handles a write to the CB_BIND register. |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 3bfed6ab8..51e606a10 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -36,6 +36,12 @@ void MaxwellDMA::CallMethod(const GPU::MethodCall& method_call) { | |||
| 36 | #undef MAXWELLDMA_REG_INDEX | 36 | #undef MAXWELLDMA_REG_INDEX |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { | ||
| 40 | for (std::size_t i = 0; i < amount; i++) { | ||
| 41 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 39 | void MaxwellDMA::HandleCopy() { | 45 | void MaxwellDMA::HandleCopy() { |
| 40 | LOG_TRACE(HW_GPU, "Requested a DMA copy"); | 46 | LOG_TRACE(HW_GPU, "Requested a DMA copy"); |
| 41 | 47 | ||
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index 4f40d1d1f..c43ed8194 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -35,6 +35,9 @@ public: | |||
| 35 | /// Write the value to the register identified by method. | 35 | /// Write the value to the register identified by method. |
| 36 | void CallMethod(const GPU::MethodCall& method_call); | 36 | void CallMethod(const GPU::MethodCall& method_call); |
| 37 | 37 | ||
| 38 | /// Write multiple values to the register identified by method. | ||
| 39 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | ||
| 40 | |||
| 38 | struct Regs { | 41 | struct Regs { |
| 39 | static constexpr std::size_t NUM_REGS = 0x1D6; | 42 | static constexpr std::size_t NUM_REGS = 0x1D6; |
| 40 | 43 | ||