Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
3b7a43e5
Commit
3b7a43e5
authored
Mar 14, 2021
by
Xaver Hugl
Browse files
Add VRR to OutputDevice and OutputConfiguration
parent
6a3e80d1
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/wayland/server/outputchangeset.cpp
View file @
3b7a43e5
...
...
@@ -100,4 +100,14 @@ uint32_t OutputChangeSet::overscan() const
return
d
->
overscan
;
}
bool
OutputChangeSet
::
vrrPolicyChanged
()
const
{
return
d
->
vrrPolicy
!=
d
->
outputDevice
->
vrrPolicy
();
}
OutputDeviceInterface
::
VrrPolicy
OutputChangeSet
::
vrrPolicy
()
const
{
return
d
->
vrrPolicy
;
}
}
src/wayland/server/outputchangeset.h
View file @
3b7a43e5
...
...
@@ -67,6 +67,12 @@ public:
*/
bool
overscanChanged
()
const
;
/**
* Whether the vrrPolicy() property of the outputdevice changed.
* @returns @c true if the vrrPolicy() property of the outputdevice has changed.
*/
bool
vrrPolicyChanged
()
const
;
/** The new value for enabled. */
OutputDeviceInterface
::
Enablement
enabled
()
const
;
...
...
@@ -83,13 +89,15 @@ public:
*/
qreal
scaleF
()
const
;
/** The new value for colorCurves.
*/
/** The new value for colorCurves. */
OutputDeviceInterface
::
ColorCurves
colorCurves
()
const
;
/** the overscan value in % */
uint32_t
overscan
()
const
;
/** The new value for vrrPolicy */
OutputDeviceInterface
::
VrrPolicy
vrrPolicy
()
const
;
private:
friend
class
OutputConfigurationInterfacePrivate
;
explicit
OutputChangeSet
(
OutputDeviceInterface
*
outputdevice
,
QObject
*
parent
=
nullptr
);
...
...
src/wayland/server/outputchangeset_p.h
View file @
3b7a43e5
...
...
@@ -25,6 +25,7 @@ public:
qreal
scale
;
OutputDeviceInterface
::
ColorCurves
colorCurves
;
uint32_t
overscan
;
OutputDeviceInterface
::
VrrPolicy
vrrPolicy
=
OutputDeviceInterface
::
VrrPolicy
::
Automatic
;
};
}
src/wayland/server/outputconfiguration_interface.cpp
View file @
3b7a43e5
...
...
@@ -45,6 +45,7 @@ protected:
void
org_kde_kwin_outputconfiguration_apply
(
Resource
*
resource
)
override
;
void
org_kde_kwin_outputconfiguration_scalef
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
wl_fixed_t
scale
)
override
;
void
org_kde_kwin_outputconfiguration_colorcurves
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
wl_array
*
red
,
wl_array
*
green
,
wl_array
*
blue
)
override
;
void
org_kde_kwin_outputconfiguration_set_vrr_policy
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
uint32_t
policy
)
override
;
void
org_kde_kwin_outputconfiguration_destroy
(
Resource
*
resource
)
override
;
void
org_kde_kwin_outputconfiguration_destroy_resource
(
Resource
*
resource
)
override
;
void
org_kde_kwin_outputconfiguration_overscan
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
uint32_t
overscan
)
override
;
...
...
@@ -194,6 +195,17 @@ void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_overs
pendingChanges
(
output
)
->
d
->
overscan
=
overscan
;
}
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_set_vrr_policy
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
uint32_t
policy
)
{
Q_UNUSED
(
resource
)
if
(
policy
>
static_cast
<
uint32_t
>
(
OutputDeviceInterface
::
VrrPolicy
::
Automatic
))
{
qCWarning
(
KWAYLAND_SERVER
)
<<
"Invalid Vrr Policy requested:"
<<
policy
;
return
;
}
OutputDeviceInterface
*
output
=
OutputDeviceInterface
::
get
(
outputdevice
);
pendingChanges
(
output
)
->
d
->
vrrPolicy
=
static_cast
<
OutputDeviceInterface
::
VrrPolicy
>
(
policy
);
}
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_destroy
(
Resource
*
resource
)
{
wl_resource_destroy
(
resource
->
handle
);
...
...
src/wayland/server/outputdevice_interface.cpp
View file @
3b7a43e5
...
...
@@ -17,7 +17,7 @@
namespace
KWaylandServer
{
static
const
quint32
s_version
=
3
;
static
const
quint32
s_version
=
4
;
class
OutputDeviceInterfacePrivate
:
public
QtWaylandServer
::
org_kde_kwin_outputdevice
{
...
...
@@ -35,6 +35,7 @@ public:
void
updateSerialNumber
();
void
updateCapabilities
();
void
updateOverscan
();
void
updateVrrPolicy
();
void
sendGeometry
(
Resource
*
resource
);
void
sendMode
(
Resource
*
resource
,
const
OutputDeviceInterface
::
Mode
&
mode
);
...
...
@@ -48,6 +49,7 @@ public:
void
sendSerialNumber
(
Resource
*
resource
);
void
sendCapabilities
(
Resource
*
resource
);
void
sendOverscan
(
Resource
*
resource
);
void
sendVrrPolicy
(
Resource
*
resource
);
static
OutputDeviceInterface
*
get
(
wl_resource
*
native
);
...
...
@@ -69,6 +71,8 @@ public:
QUuid
uuid
;
OutputDeviceInterface
::
Capabilities
capabilities
;
uint32_t
overscan
=
0
;
OutputDeviceInterface
::
VrrPolicy
vrrPolicy
=
OutputDeviceInterface
::
VrrPolicy
::
Automatic
;
QPointer
<
Display
>
display
;
OutputDeviceInterface
*
q
;
...
...
@@ -323,6 +327,7 @@ void OutputDeviceInterfacePrivate::org_kde_kwin_outputdevice_bind_resource(Resou
sendEnabled
(
resource
);
sendCapabilities
(
resource
);
sendOverscan
(
resource
);
sendVrrPolicy
(
resource
);
sendDone
(
resource
);
}
...
...
@@ -701,6 +706,36 @@ void OutputDeviceInterfacePrivate::updateOverscan()
}
}
void
OutputDeviceInterfacePrivate
::
sendVrrPolicy
(
Resource
*
resource
)
{
if
(
resource
->
version
()
<
ORG_KDE_KWIN_OUTPUTDEVICE_VRR_POLICY_SINCE_VERSION
)
{
return
;
}
send_vrr_policy
(
resource
->
handle
,
static_cast
<
uint32_t
>
(
vrrPolicy
));
}
OutputDeviceInterface
::
VrrPolicy
OutputDeviceInterface
::
vrrPolicy
()
const
{
return
d
->
vrrPolicy
;
}
void
OutputDeviceInterface
::
setVrrPolicy
(
VrrPolicy
policy
)
{
if
(
d
->
vrrPolicy
!=
policy
)
{
d
->
vrrPolicy
=
policy
;
d
->
updateVrrPolicy
();
emit
vrrPolicyChanged
();
}
}
void
OutputDeviceInterfacePrivate
::
updateVrrPolicy
()
{
const
auto
clientResources
=
resourceMap
();
for
(
const
auto
&
resource
:
clientResources
)
{
sendVrrPolicy
(
resource
);
}
}
OutputDeviceInterface
*
OutputDeviceInterfacePrivate
::
get
(
wl_resource
*
native
)
{
if
(
auto
devicePrivate
=
resource_cast
<
OutputDeviceInterfacePrivate
*>
(
native
))
{
...
...
src/wayland/server/outputdevice_interface.h
View file @
3b7a43e5
...
...
@@ -45,6 +45,7 @@ class KWAYLANDSERVER_EXPORT OutputDeviceInterface : public QObject
Q_PROPERTY
(
QUuid
uuid
READ
uuid
WRITE
setUuid
NOTIFY
uuidChanged
)
Q_PROPERTY
(
Capabilities
capabilities
READ
capabilities
WRITE
setCapabilities
NOTIFY
capabilitiesChanged
)
Q_PROPERTY
(
uint32_t
overscan
READ
overscan
WRITE
setOverscan
NOTIFY
overscanChanged
)
Q_PROPERTY
(
VrrPolicy
vrrPolicy
READ
vrrPolicy
WRITE
setVrrPolicy
NOTIFY
vrrPolicyChanged
)
public:
enum
class
SubPixel
{
Unknown
,
...
...
@@ -90,9 +91,16 @@ public:
};
enum
class
Capability
{
Overscan
=
0x1
,
Vrr
=
0x2
,
};
Q_ENUM
(
Capability
)
Q_DECLARE_FLAGS
(
Capabilities
,
Capability
)
enum
class
VrrPolicy
{
Never
=
0
,
Always
=
1
,
Automatic
=
2
};
Q_ENUM
(
VrrPolicy
)
explicit
OutputDeviceInterface
(
Display
*
display
,
QObject
*
parent
=
nullptr
);
~
OutputDeviceInterface
()
override
;
...
...
@@ -119,6 +127,7 @@ public:
Capabilities
capabilities
()
const
;
uint32_t
overscan
()
const
;
VrrPolicy
vrrPolicy
()
const
;
void
setPhysicalSize
(
const
QSize
&
size
);
void
setGlobalPosition
(
const
QPoint
&
pos
);
...
...
@@ -152,6 +161,7 @@ public:
void
setCapabilities
(
Capabilities
cap
);
void
setOverscan
(
uint32_t
overscan
);
void
setVrrPolicy
(
VrrPolicy
policy
);
static
OutputDeviceInterface
*
get
(
wl_resource
*
native
);
static
QList
<
OutputDeviceInterface
*>
list
();
...
...
@@ -179,6 +189,7 @@ Q_SIGNALS:
void
capabilitiesChanged
();
void
overscanChanged
();
void
vrrPolicyChanged
();
private:
QScopedPointer
<
OutputDeviceInterfacePrivate
>
d
;
...
...
src/wayland/server/outputmanagement_interface.cpp
View file @
3b7a43e5
...
...
@@ -16,7 +16,7 @@
namespace
KWaylandServer
{
static
const
quint32
s_version
=
2
;
static
const
quint32
s_version
=
4
;
class
OutputManagementInterfacePrivate
:
public
QtWaylandServer
::
org_kde_kwin_outputmanagement
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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