RenderLoop: restrict repaint scheduling with fullscreen windows
With an opaque fullscreen window we can be sure that items under it don't actually require us to repaint. This should yield some small efficiency improvements and resolves stutter with adaptive sync. BUG: 443872 FIXED-IN: 5.23.3
This commit is contained in:
parent
84a5c7b314
commit
75863454a0
4 changed files with 13 additions and 13 deletions
|
@ -261,12 +261,12 @@ void Item::scheduleRepaintInternal(const QRegion ®ion)
|
||||||
const QRegion dirtyRegion = globalRegion & output->geometry();
|
const QRegion dirtyRegion = globalRegion & output->geometry();
|
||||||
if (!dirtyRegion.isEmpty()) {
|
if (!dirtyRegion.isEmpty()) {
|
||||||
m_repaints[output] += dirtyRegion;
|
m_repaints[output] += dirtyRegion;
|
||||||
output->renderLoop()->scheduleRepaint();
|
output->renderLoop()->scheduleRepaint(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_repaints[nullptr] += globalRegion;
|
m_repaints[nullptr] += globalRegion;
|
||||||
kwinApp()->platform()->renderLoop()->scheduleRepaint();
|
kwinApp()->platform()->renderLoop()->scheduleRepaint(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,11 +280,11 @@ void Item::scheduleFrame()
|
||||||
const QVector<AbstractOutput *> outputs = kwinApp()->platform()->enabledOutputs();
|
const QVector<AbstractOutput *> outputs = kwinApp()->platform()->enabledOutputs();
|
||||||
for (const AbstractOutput *output : outputs) {
|
for (const AbstractOutput *output : outputs) {
|
||||||
if (output->geometry().intersects(geometry)) {
|
if (output->geometry().intersects(geometry)) {
|
||||||
output->renderLoop()->scheduleRepaint();
|
output->renderLoop()->scheduleRepaint(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kwinApp()->platform()->renderLoop()->scheduleRepaint();
|
kwinApp()->platform()->renderLoop()->scheduleRepaint(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void RenderLoopPrivate::scheduleRepaint()
|
||||||
if (kwinApp()->isTerminating() || compositeTimer.isActive()) {
|
if (kwinApp()->isTerminating() || compositeTimer.isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vrrPolicy == RenderLoop::VrrPolicy::Always || (vrrPolicy == RenderLoop::VrrPolicy::Automatic && hasFullscreenSurface)) {
|
if (vrrPolicy == RenderLoop::VrrPolicy::Always || (vrrPolicy == RenderLoop::VrrPolicy::Automatic && fullscreenItem != nullptr)) {
|
||||||
presentMode = SyncMode::Adaptive;
|
presentMode = SyncMode::Adaptive;
|
||||||
} else {
|
} else {
|
||||||
presentMode = SyncMode::Fixed;
|
presentMode = SyncMode::Fixed;
|
||||||
|
@ -216,9 +216,9 @@ void RenderLoop::setRefreshRate(int refreshRate)
|
||||||
Q_EMIT refreshRateChanged();
|
Q_EMIT refreshRateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderLoop::scheduleRepaint()
|
void RenderLoop::scheduleRepaint(Item *item)
|
||||||
{
|
{
|
||||||
if (d->pendingRepaint) {
|
if (d->pendingRepaint || (d->fullscreenItem != nullptr && item != nullptr && item != d->fullscreenItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!d->pendingFrameCount && !d->inhibitCount) {
|
if (!d->pendingFrameCount && !d->inhibitCount) {
|
||||||
|
@ -238,9 +238,9 @@ std::chrono::nanoseconds RenderLoop::nextPresentationTimestamp() const
|
||||||
return d->nextPresentationTimestamp;
|
return d->nextPresentationTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderLoop::setFullscreenSurface(SurfaceItem *surfaceItem)
|
void RenderLoop::setFullscreenSurface(Item *surfaceItem)
|
||||||
{
|
{
|
||||||
d->hasFullscreenSurface = surfaceItem != nullptr;
|
d->fullscreenItem = surfaceItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderLoop::VrrPolicy RenderLoop::vrrPolicy() const
|
RenderLoop::VrrPolicy RenderLoop::vrrPolicy() const
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
class RenderLoopPrivate;
|
class RenderLoopPrivate;
|
||||||
class SurfaceItem;
|
class Item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The RenderLoop class represents the compositing scheduler on a particular output.
|
* The RenderLoop class represents the compositing scheduler on a particular output.
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Schedules a compositing cycle at the next available moment.
|
* Schedules a compositing cycle at the next available moment.
|
||||||
*/
|
*/
|
||||||
void scheduleRepaint();
|
void scheduleRepaint(Item *item = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the timestamp of the last frame that has been presented on the screen.
|
* Returns the timestamp of the last frame that has been presented on the screen.
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
* Sets the surface that currently gets scanned out,
|
* Sets the surface that currently gets scanned out,
|
||||||
* so that this RenderLoop can adjust its timing behavior to that surface
|
* so that this RenderLoop can adjust its timing behavior to that surface
|
||||||
*/
|
*/
|
||||||
void setFullscreenSurface(SurfaceItem *surface);
|
void setFullscreenSurface(Item *surface);
|
||||||
|
|
||||||
enum class VrrPolicy : uint32_t {
|
enum class VrrPolicy : uint32_t {
|
||||||
Never = 0,
|
Never = 0,
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
bool pendingReschedule = false;
|
bool pendingReschedule = false;
|
||||||
bool pendingRepaint = false;
|
bool pendingRepaint = false;
|
||||||
RenderLoop::VrrPolicy vrrPolicy = RenderLoop::VrrPolicy::Never;
|
RenderLoop::VrrPolicy vrrPolicy = RenderLoop::VrrPolicy::Never;
|
||||||
bool hasFullscreenSurface = false;
|
Item *fullscreenItem = nullptr;
|
||||||
|
|
||||||
enum class SyncMode {
|
enum class SyncMode {
|
||||||
Fixed,
|
Fixed,
|
||||||
|
|
Loading…
Reference in a new issue