summaryrefslogtreecommitdiff
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r--src/video_core/gpu.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 609704b33..f4a5d831c 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -274,11 +274,6 @@ struct GPU::Impl {
274 } 274 }
275 } 275 }
276 276
277 /// Swap buffers (render frame)
278 void SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
279 gpu_thread.SwapBuffers(framebuffer);
280 }
281
282 /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory 277 /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory
283 void FlushRegion(DAddr addr, u64 size) { 278 void FlushRegion(DAddr addr, u64 size) {
284 gpu_thread.FlushRegion(addr, size); 279 gpu_thread.FlushRegion(addr, size);
@@ -313,8 +308,9 @@ struct GPU::Impl {
313 gpu_thread.FlushAndInvalidateRegion(addr, size); 308 gpu_thread.FlushAndInvalidateRegion(addr, size);
314 } 309 }
315 310
316 void RequestSwapBuffers(const Tegra::FramebufferConfig* framebuffer, 311 void RequestComposite(std::vector<Tegra::FramebufferConfig>&& layers,
317 std::array<Service::Nvidia::NvFence, 4>& fences, size_t num_fences) { 312 std::vector<Service::Nvidia::NvFence>&& fences) {
313 size_t num_fences{fences.size()};
318 size_t current_request_counter{}; 314 size_t current_request_counter{};
319 { 315 {
320 std::unique_lock<std::mutex> lk(request_swap_mutex); 316 std::unique_lock<std::mutex> lk(request_swap_mutex);
@@ -328,13 +324,12 @@ struct GPU::Impl {
328 } 324 }
329 } 325 }
330 const auto wait_fence = 326 const auto wait_fence =
331 RequestSyncOperation([this, current_request_counter, framebuffer, fences, num_fences] { 327 RequestSyncOperation([this, current_request_counter, &layers, &fences, num_fences] {
332 auto& syncpoint_manager = host1x.GetSyncpointManager(); 328 auto& syncpoint_manager = host1x.GetSyncpointManager();
333 if (num_fences == 0) { 329 if (num_fences == 0) {
334 renderer->SwapBuffers(framebuffer); 330 renderer->Composite(layers);
335 } 331 }
336 const auto executer = [this, current_request_counter, 332 const auto executer = [this, current_request_counter, layers_copy = layers]() {
337 framebuffer_copy = *framebuffer]() {
338 { 333 {
339 std::unique_lock<std::mutex> lk(request_swap_mutex); 334 std::unique_lock<std::mutex> lk(request_swap_mutex);
340 if (--request_swap_counters[current_request_counter] != 0) { 335 if (--request_swap_counters[current_request_counter] != 0) {
@@ -342,7 +337,7 @@ struct GPU::Impl {
342 } 337 }
343 free_swap_counters.push_back(current_request_counter); 338 free_swap_counters.push_back(current_request_counter);
344 } 339 }
345 renderer->SwapBuffers(&framebuffer_copy); 340 renderer->Composite(layers_copy);
346 }; 341 };
347 for (size_t i = 0; i < num_fences; i++) { 342 for (size_t i = 0; i < num_fences; i++) {
348 syncpoint_manager.RegisterGuestAction(fences[i].id, fences[i].value, executer); 343 syncpoint_manager.RegisterGuestAction(fences[i].id, fences[i].value, executer);
@@ -505,9 +500,9 @@ const VideoCore::ShaderNotify& GPU::ShaderNotify() const {
505 return impl->ShaderNotify(); 500 return impl->ShaderNotify();
506} 501}
507 502
508void GPU::RequestSwapBuffers(const Tegra::FramebufferConfig* framebuffer, 503void GPU::RequestComposite(std::vector<Tegra::FramebufferConfig>&& layers,
509 std::array<Service::Nvidia::NvFence, 4>& fences, size_t num_fences) { 504 std::vector<Service::Nvidia::NvFence>&& fences) {
510 impl->RequestSwapBuffers(framebuffer, fences, num_fences); 505 impl->RequestComposite(std::move(layers), std::move(fences));
511} 506}
512 507
513u64 GPU::GetTicks() const { 508u64 GPU::GetTicks() const {
@@ -554,10 +549,6 @@ void GPU::ClearCdmaInstance(u32 id) {
554 impl->ClearCdmaInstance(id); 549 impl->ClearCdmaInstance(id);
555} 550}
556 551
557void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
558 impl->SwapBuffers(framebuffer);
559}
560
561VideoCore::RasterizerDownloadArea GPU::OnCPURead(PAddr addr, u64 size) { 552VideoCore::RasterizerDownloadArea GPU::OnCPURead(PAddr addr, u64 size) {
562 return impl->OnCPURead(addr, size); 553 return impl->OnCPURead(addr, size);
563} 554}