Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show All 19 Lines | |||||
20 | #include "composite.h" | 20 | #include "composite.h" | ||
21 | 21 | | |||
22 | #include "dbusinterface.h" | 22 | #include "dbusinterface.h" | ||
23 | #include "client.h" | 23 | #include "client.h" | ||
24 | #include "decorations/decoratedclient.h" | 24 | #include "decorations/decoratedclient.h" | ||
25 | #include "deleted.h" | 25 | #include "deleted.h" | ||
26 | #include "effects.h" | 26 | #include "effects.h" | ||
27 | #include "overlaywindow.h" | 27 | #include "overlaywindow.h" | ||
28 | #include "perf.h" | ||||
zzag: Wrap it in #ifdef KWIN_BUILD_PERF | |||||
davidedmundson: it's fine here.
perf is the public API wrapper around ftracemarker | |||||
28 | #include "platform.h" | 29 | #include "platform.h" | ||
29 | #include "scene.h" | 30 | #include "scene.h" | ||
30 | #include "screens.h" | 31 | #include "screens.h" | ||
31 | #include "shadow.h" | 32 | #include "shadow.h" | ||
32 | #include "shell_client.h" | 33 | #include "shell_client.h" | ||
33 | #include "unmanaged.h" | 34 | #include "unmanaged.h" | ||
34 | #include "useractions.h" | 35 | #include "useractions.h" | ||
35 | #include "utils.h" | 36 | #include "utils.h" | ||
▲ Show 20 Lines • Show All 559 Lines • ▼ Show 20 Line(s) | 592 | { | |||
595 | emit bufferSwapCompleted(); | 596 | emit bufferSwapCompleted(); | ||
596 | 597 | | |||
597 | if (m_composeAtSwapCompletion) { | 598 | if (m_composeAtSwapCompletion) { | ||
598 | m_composeAtSwapCompletion = false; | 599 | m_composeAtSwapCompletion = false; | ||
599 | performCompositing(); | 600 | performCompositing(); | ||
600 | } | 601 | } | ||
601 | } | 602 | } | ||
602 | 603 | | |||
604 | static ulong s_msc = 0; | ||||
605 | | ||||
603 | void Compositor::performCompositing() | 606 | void Compositor::performCompositing() | ||
604 | { | 607 | { | ||
605 | // If a buffer swap is still pending, we return to the event loop and | 608 | // If a buffer swap is still pending, we return to the event loop and | ||
606 | // continue processing events until the swap has completed. | 609 | // continue processing events until the swap has completed. | ||
607 | if (m_bufferSwapPending) { | 610 | if (m_bufferSwapPending) { | ||
608 | m_composeAtSwapCompletion = true; | 611 | m_composeAtSwapCompletion = true; | ||
609 | compositeTimer.stop(); | 612 | compositeTimer.stop(); | ||
610 | return; | 613 | return; | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 663 | if (repaints_region.isEmpty() && !windowRepaintsPending()) { | |||
663 | // Note: It would seem here we should undo suspended unredirect, but when scenes need | 666 | // Note: It would seem here we should undo suspended unredirect, but when scenes need | ||
664 | // it for some reason, e.g. transformations or translucency, the next pass that does not | 667 | // it for some reason, e.g. transformations or translucency, the next pass that does not | ||
665 | // need this anymore and paints normally will also reset the suspended unredirect. | 668 | // need this anymore and paints normally will also reset the suspended unredirect. | ||
666 | // Otherwise the window would not be painted normally anyway. | 669 | // Otherwise the window would not be painted normally anyway. | ||
667 | compositeTimer.stop(); | 670 | compositeTimer.stop(); | ||
668 | return; | 671 | return; | ||
669 | } | 672 | } | ||
670 | 673 | | |||
674 | Perf::ftrace(s_msc, QStringLiteral("Paint")); | ||||
675 | | ||||
671 | // Skip windows that are not yet ready for being painted and if screen is locked skip windows | 676 | // Skip windows that are not yet ready for being painted and if screen is locked skip windows | ||
672 | // that are neither lockscreen nor inputmethod windows. | 677 | // that are neither lockscreen nor inputmethod windows. | ||
673 | // | 678 | // | ||
674 | // TODO? This cannot be used so carelessly - needs protections against broken clients, the | 679 | // TODO? This cannot be used so carelessly - needs protections against broken clients, the | ||
675 | // window should not get focus before it's displayed, handle unredirected windows properly and | 680 | // window should not get focus before it's displayed, handle unredirected windows properly and | ||
676 | // so on. | 681 | // so on. | ||
677 | for (Toplevel *win : windows) { | 682 | for (Toplevel *win : windows) { | ||
678 | if (!win->readyForPainting()) { | 683 | if (!win->readyForPainting()) { | ||
Show All 33 Lines | 714 | for (Toplevel *win : qAsConst(windows)) { | |||
712 | } | 717 | } | ||
713 | } | 718 | } | ||
714 | } | 719 | } | ||
715 | 720 | | |||
716 | // Stop here to ensure *we* cause the next repaint schedule - not some effect | 721 | // Stop here to ensure *we* cause the next repaint schedule - not some effect | ||
717 | // through m_scene->paint(). | 722 | // through m_scene->paint(). | ||
718 | compositeTimer.stop(); | 723 | compositeTimer.stop(); | ||
719 | 724 | | |||
725 | Perf::ftrace(QStringLiteral("Paint"), s_msc); | ||||
726 | s_msc++; | ||||
727 | | ||||
720 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | 728 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | ||
721 | // is called the next time. If there would be nothing pending, it will not restart the timer and | 729 | // is called the next time. If there would be nothing pending, it will not restart the timer and | ||
722 | // scheduleRepaint() would restart it again somewhen later, called from functions that | 730 | // scheduleRepaint() would restart it again somewhen later, called from functions that | ||
723 | // would again add something pending. | 731 | // would again add something pending. | ||
724 | if (m_bufferSwapPending && m_scene->syncsToVBlank()) { | 732 | if (m_bufferSwapPending && m_scene->syncsToVBlank()) { | ||
725 | m_composeAtSwapCompletion = true; | 733 | m_composeAtSwapCompletion = true; | ||
726 | } else { | 734 | } else { | ||
727 | scheduleRepaint(); | 735 | scheduleRepaint(); | ||
▲ Show 20 Lines • Show All 342 Lines • Show Last 20 Lines |
Wrap it in #ifdef KWIN_BUILD_PERF