Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_backend.cpp
Show All 25 Lines | |||||
26 | #include "cursor.h" | 26 | #include "cursor.h" | ||
27 | #include "logging.h" | 27 | #include "logging.h" | ||
28 | #include "logind.h" | 28 | #include "logind.h" | ||
29 | #include "main.h" | 29 | #include "main.h" | ||
30 | #include "scene_qpainter_drm_backend.h" | 30 | #include "scene_qpainter_drm_backend.h" | ||
31 | #include "screens_drm.h" | 31 | #include "screens_drm.h" | ||
32 | #include "udev.h" | 32 | #include "udev.h" | ||
33 | #include "wayland_server.h" | 33 | #include "wayland_server.h" | ||
34 | #include <colorcorrection/nightcolor.h> | ||||
34 | #if HAVE_GBM | 35 | #if HAVE_GBM | ||
35 | #include "egl_gbm_backend.h" | 36 | #include "egl_gbm_backend.h" | ||
36 | #include <gbm.h> | 37 | #include <gbm.h> | ||
37 | #endif | 38 | #endif | ||
38 | // KWayland | 39 | // KWayland | ||
39 | #include <KWayland/Server/seat_interface.h> | 40 | #include <KWayland/Server/seat_interface.h> | ||
40 | #include <KWayland/Server/outputconfiguration_interface.h> | 41 | #include <KWayland/Server/outputconfiguration_interface.h> | ||
41 | // KF5 | 42 | // KF5 | ||
Show All 25 Lines | |||||
67 | { | 68 | { | ||
68 | 69 | | |||
69 | DrmBackend::DrmBackend(QObject *parent) | 70 | DrmBackend::DrmBackend(QObject *parent) | ||
70 | : Platform(parent) | 71 | : Platform(parent) | ||
71 | , m_udev(new Udev) | 72 | , m_udev(new Udev) | ||
72 | , m_udevMonitor(m_udev->monitor()) | 73 | , m_udevMonitor(m_udev->monitor()) | ||
73 | , m_dpmsFilter() | 74 | , m_dpmsFilter() | ||
74 | { | 75 | { | ||
76 | setSupportsNightColor(true); | ||||
75 | handleOutputs(); | 77 | handleOutputs(); | ||
76 | m_cursor[0] = nullptr; | 78 | m_cursor[0] = nullptr; | ||
77 | m_cursor[1] = nullptr; | 79 | m_cursor[1] = nullptr; | ||
78 | } | 80 | } | ||
79 | 81 | | |||
80 | DrmBackend::~DrmBackend() | 82 | DrmBackend::~DrmBackend() | ||
81 | { | 83 | { | ||
82 | #if HAVE_GBM | 84 | #if HAVE_GBM | ||
▲ Show 20 Lines • Show All 637 Lines • ▼ Show 20 Line(s) | 719 | { | |||
720 | } | 722 | } | ||
721 | bool enabled = false; | 723 | bool enabled = false; | ||
722 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 724 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
723 | enabled = enabled || (*it)->isDpmsEnabled(); | 725 | enabled = enabled || (*it)->isDpmsEnabled(); | ||
724 | } | 726 | } | ||
725 | setOutputsEnabled(enabled); | 727 | setOutputsEnabled(enabled); | ||
726 | } | 728 | } | ||
727 | 729 | | |||
730 | int DrmBackend::gammaRampSize(int screen) const | ||||
731 | { | ||||
732 | if (m_outputs.size() <= screen) { | ||||
733 | return 0; | ||||
734 | } | ||||
735 | return m_outputs.at(screen)->m_crtc->getGammaRampSize(); | ||||
736 | } | ||||
737 | bool DrmBackend::setGammaRamp(int screen, ColorCorrect::GammaRamp &gamma) | ||||
738 | { | ||||
739 | if (m_outputs.size() <= screen) { | ||||
740 | return false; | ||||
741 | } | ||||
742 | return m_outputs.at(screen)->m_crtc->setGammaRamp(gamma.red); | ||||
743 | } | ||||
744 | | ||||
728 | } | 745 | } |