Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWayland Server
Commits
9aeff4af
Commit
9aeff4af
authored
Feb 04, 2021
by
Vlad Zahorodnii
Browse files
Drop SurfaceInterface::trackedDamage()
There is no need for both kwin and kwaylandserver track damage.
parent
e600663f
Pipeline
#56135
passed with stage
in 7 minutes and 17 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
autotests/client/test_wayland_surface.cpp
View file @
9aeff4af
...
...
@@ -46,7 +46,6 @@ private Q_SLOTS:
void
testScale
();
void
testDestroy
();
void
testUnmapOfNotMappedSurface
();
void
testDamageTracking
();
void
testSurfaceAt
();
void
testDestroyAttachedBuffer
();
void
testDestroyWithPendingCallback
();
...
...
@@ -868,69 +867,6 @@ void TestWaylandSurface::testUnmapOfNotMappedSurface()
QVERIFY
(
unmappedSpy
.
isEmpty
());
}
void
TestWaylandSurface
::
testDamageTracking
()
{
// this tests the damage tracking feature
using
namespace
KWayland
::
Client
;
using
namespace
KWaylandServer
;
// create surface
QSignalSpy
serverSurfaceCreated
(
m_compositorInterface
,
&
CompositorInterface
::
surfaceCreated
);
QVERIFY
(
serverSurfaceCreated
.
isValid
());
QScopedPointer
<
Surface
>
s
(
m_compositor
->
createSurface
());
QVERIFY
(
serverSurfaceCreated
.
wait
());
SurfaceInterface
*
serverSurface
=
serverSurfaceCreated
.
first
().
first
().
value
<
KWaylandServer
::
SurfaceInterface
*>
();
// before first commit, the tracked damage should be empty
QVERIFY
(
serverSurface
->
trackedDamage
().
isEmpty
());
// Now let's damage the surface
QSignalSpy
damagedSpy
(
serverSurface
,
&
SurfaceInterface
::
damaged
);
QImage
image
(
QSize
(
100
,
100
),
QImage
::
Format_ARGB32_Premultiplied
);
image
.
fill
(
Qt
::
red
);
s
->
attachBuffer
(
m_shm
->
createBuffer
(
image
));
s
->
damage
(
QRect
(
0
,
0
,
100
,
100
));
s
->
commit
(
Surface
::
CommitFlag
::
None
);
QVERIFY
(
damagedSpy
.
wait
());
QCOMPARE
(
serverSurface
->
trackedDamage
(),
QRegion
(
0
,
0
,
100
,
100
));
QCOMPARE
(
serverSurface
->
damage
(),
QRegion
(
0
,
0
,
100
,
100
));
// resetting the tracked damage should empty it
serverSurface
->
resetTrackedDamage
();
QVERIFY
(
serverSurface
->
trackedDamage
().
isEmpty
());
// but not affect the actual damage
QCOMPARE
(
serverSurface
->
damage
(),
QRegion
(
0
,
0
,
100
,
100
));
// let's damage some parts of the surface
QPainter
p
;
p
.
begin
(
&
image
);
p
.
fillRect
(
QRect
(
0
,
0
,
10
,
10
),
Qt
::
blue
);
p
.
end
();
s
->
attachBuffer
(
m_shm
->
createBuffer
(
image
));
s
->
damage
(
QRect
(
0
,
0
,
10
,
10
));
s
->
commit
(
Surface
::
CommitFlag
::
None
);
QVERIFY
(
damagedSpy
.
wait
());
QCOMPARE
(
serverSurface
->
trackedDamage
(),
QRegion
(
0
,
0
,
10
,
10
));
QCOMPARE
(
serverSurface
->
damage
(),
QRegion
(
0
,
0
,
10
,
10
));
// and damage some part completely not bounding to the current damage region
p
.
begin
(
&
image
);
p
.
fillRect
(
QRect
(
50
,
40
,
20
,
30
),
Qt
::
blue
);
p
.
end
();
s
->
attachBuffer
(
m_shm
->
createBuffer
(
image
));
s
->
damage
(
QRect
(
50
,
40
,
20
,
30
));
s
->
commit
(
Surface
::
CommitFlag
::
None
);
QVERIFY
(
damagedSpy
.
wait
());
QCOMPARE
(
serverSurface
->
trackedDamage
(),
QRegion
(
0
,
0
,
10
,
10
).
united
(
QRegion
(
50
,
40
,
20
,
30
)));
QCOMPARE
(
serverSurface
->
trackedDamage
().
rectCount
(),
2
);
QCOMPARE
(
serverSurface
->
damage
(),
QRegion
(
50
,
40
,
20
,
30
));
// now let's reset the tracked damage again
serverSurface
->
resetTrackedDamage
();
QVERIFY
(
serverSurface
->
trackedDamage
().
isEmpty
());
// but not affect the actual damage
QCOMPARE
(
serverSurface
->
damage
(),
QRegion
(
50
,
40
,
20
,
30
));
}
void
TestWaylandSurface
::
testSurfaceAt
()
{
// this test verifies that surfaceAt(const QPointF&) works as expected for the case of no children
...
...
src/server/surface_interface.cpp
View file @
9aeff4af
...
...
@@ -635,7 +635,6 @@ void SurfaceInterfacePrivate::swapStates(State *source, State *target, bool emit
const
QRegion
windowRegion
=
QRegion
(
0
,
0
,
q
->
size
().
width
(),
q
->
size
().
height
());
const
QRegion
bufferDamage
=
q
->
mapFromBuffer
(
target
->
bufferDamage
);
target
->
damage
=
windowRegion
.
intersected
(
target
->
damage
.
united
(
bufferDamage
));
trackedDamage
|=
target
->
damage
;
emit
q
->
damaged
(
target
->
damage
);
// workaround for https://bugreports.qt.io/browse/QTBUG-52092
// if the surface is a sub-surface, but the main surface is not yet mapped, fake frame rendered
...
...
@@ -805,16 +804,6 @@ bool SurfaceInterface::isMapped() const
return
d
->
current
.
buffer
!=
nullptr
;
}
QRegion
SurfaceInterface
::
trackedDamage
()
const
{
return
d
->
trackedDamage
;
}
void
SurfaceInterface
::
resetTrackedDamage
()
{
d
->
trackedDamage
=
QRegion
();
}
QVector
<
OutputInterface
*>
SurfaceInterface
::
outputs
()
const
{
return
d
->
outputs
;
...
...
src/server/surface_interface.h
View file @
9aeff4af
...
...
@@ -239,32 +239,6 @@ public:
*/
bool
isMapped
()
const
;
/**
* Returns the tracked damage since the last call to {@link resetTrackedDamage}.
* In contrast to {@link damage} this method does not reset the damage when
* a new BufferInterface gets committed. This allows a compositor to properly
* track the damage over multiple commits even if it didn't render each new
* BufferInterface.
*
* The damage gets reset whenever {@link resetTrackedDamage} is called.
* This allows a compositor to properly track the change in its rendering scene
* for this SurfaceInterface. After it updates its internal state (e.g. by creating
* an OpenGL texture from the BufferInterface) it can invoke {@link resetTrackedDamage}
* and the damage tracker will start to track further damage changes.
*
* @returns Combined damage since last call to resetTrackedDamage
* @see damage
* @see resetTrackedDamage
*/
QRegion
trackedDamage
()
const
;
/**
* Reset the damage tracking. The compositor should invoke this method once it updated
* it's internal state and processed the current damage.
* @see trackedDamage
*/
void
resetTrackedDamage
();
/**
* Finds the SurfaceInterface at the given @p position in surface-local coordinates.
* This can be either a descendant SurfaceInterface honoring the stacking order or
...
...
src/server/surface_interface_p.h
View file @
9aeff4af
...
...
@@ -99,7 +99,6 @@ public:
State
pending
;
State
cached
;
SubSurfaceInterface
*
subSurface
=
nullptr
;
QRegion
trackedDamage
;
QMatrix4x4
surfaceToBufferMatrix
;
QMatrix4x4
bufferToSurfaceMatrix
;
QSize
bufferSize
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment