output protocols: add rgb range setting
This commit is contained in:
parent
a9458fa031
commit
e31d10c18d
6 changed files with 72 additions and 0 deletions
|
@ -111,4 +111,13 @@ OutputDeviceV2Interface::VrrPolicy OutputChangeSetV2::vrrPolicy() const
|
||||||
return d->vrrPolicy;
|
return d->vrrPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OutputChangeSetV2::rgbRangeChanged() const
|
||||||
|
{
|
||||||
|
return d->rgbRange != d->outputDevice->rgbRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputDeviceV2Interface::RgbRange OutputChangeSetV2::rgbRange() const
|
||||||
|
{
|
||||||
|
return d->rgbRange;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,12 @@ public:
|
||||||
*/
|
*/
|
||||||
bool vrrPolicyChanged() const;
|
bool vrrPolicyChanged() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the rgbRange() property of the outputdevice changed.
|
||||||
|
* @returns @c true if the rgbRange() property of the outputdevice has changed.
|
||||||
|
*/
|
||||||
|
bool rgbRangeChanged() const;
|
||||||
|
|
||||||
/** The new value for enabled. */
|
/** The new value for enabled. */
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
|
|
||||||
|
@ -97,6 +103,9 @@ public:
|
||||||
/** The new value for vrrPolicy */
|
/** The new value for vrrPolicy */
|
||||||
OutputDeviceV2Interface::VrrPolicy vrrPolicy() const;
|
OutputDeviceV2Interface::VrrPolicy vrrPolicy() const;
|
||||||
|
|
||||||
|
/** The new value for rgbRange */
|
||||||
|
OutputDeviceV2Interface::RgbRange rgbRange() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class OutputConfigurationV2InterfacePrivate;
|
friend class OutputConfigurationV2InterfacePrivate;
|
||||||
explicit OutputChangeSetV2(OutputDeviceV2Interface *outputdevice, QObject *parent = nullptr);
|
explicit OutputChangeSetV2(OutputDeviceV2Interface *outputdevice, QObject *parent = nullptr);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
qreal scale;
|
qreal scale;
|
||||||
uint32_t overscan;
|
uint32_t overscan;
|
||||||
OutputDeviceV2Interface::VrrPolicy vrrPolicy = OutputDeviceV2Interface::VrrPolicy::Automatic;
|
OutputDeviceV2Interface::VrrPolicy vrrPolicy = OutputDeviceV2Interface::VrrPolicy::Automatic;
|
||||||
|
OutputDeviceV2Interface::RgbRange rgbRange = OutputDeviceV2Interface::RgbRange::Automatic;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ protected:
|
||||||
void kde_output_configuration_v2_destroy_resource(Resource *resource) override;
|
void kde_output_configuration_v2_destroy_resource(Resource *resource) override;
|
||||||
void kde_output_configuration_v2_overscan(Resource *resource, wl_resource *outputdevice, uint32_t overscan) override;
|
void kde_output_configuration_v2_overscan(Resource *resource, wl_resource *outputdevice, uint32_t overscan) override;
|
||||||
void kde_output_configuration_v2_set_vrr_policy(Resource *resource, struct ::wl_resource *outputdevice, uint32_t policy) override;
|
void kde_output_configuration_v2_set_vrr_policy(Resource *resource, struct ::wl_resource *outputdevice, uint32_t policy) override;
|
||||||
|
void kde_output_configuration_v2_set_rgb_range(Resource *resource, wl_resource *outputdevice, uint32_t rgbRange) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_enable(Resource *resource, wl_resource *outputdevice, int32_t enable)
|
void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_enable(Resource *resource, wl_resource *outputdevice, int32_t enable)
|
||||||
|
@ -143,6 +144,17 @@ void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_set_vrr_
|
||||||
pendingChanges(output)->d->vrrPolicy = static_cast<OutputDeviceV2Interface::VrrPolicy>(policy);
|
pendingChanges(output)->d->vrrPolicy = static_cast<OutputDeviceV2Interface::VrrPolicy>(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_set_rgb_range(Resource *resource, wl_resource *outputdevice, uint32_t rgbRange)
|
||||||
|
{
|
||||||
|
Q_UNUSED(resource)
|
||||||
|
if (rgbRange > static_cast<uint32_t>(OutputDeviceV2Interface::RgbRange::Limited)) {
|
||||||
|
qCWarning(KWAYLAND_SERVER) << "Invalid Rgb Range requested:" << rgbRange;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OutputDeviceV2Interface *output = OutputDeviceV2Interface::get(outputdevice);
|
||||||
|
pendingChanges(output)->d->rgbRange = static_cast<OutputDeviceV2Interface::RgbRange>(rgbRange);
|
||||||
|
}
|
||||||
|
|
||||||
void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_destroy(Resource *resource)
|
void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_destroy(Resource *resource)
|
||||||
{
|
{
|
||||||
wl_resource_destroy(resource->handle);
|
wl_resource_destroy(resource->handle);
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
void updateCapabilities();
|
void updateCapabilities();
|
||||||
void updateOverscan();
|
void updateOverscan();
|
||||||
void updateVrrPolicy();
|
void updateVrrPolicy();
|
||||||
|
void updateRgbRange();
|
||||||
|
|
||||||
void sendGeometry(Resource *resource);
|
void sendGeometry(Resource *resource);
|
||||||
wl_resource *sendNewMode(Resource *resource, OutputDeviceModeV2Interface *mode);
|
wl_resource *sendNewMode(Resource *resource, OutputDeviceModeV2Interface *mode);
|
||||||
|
@ -52,6 +53,7 @@ public:
|
||||||
void sendCapabilities(Resource *resource);
|
void sendCapabilities(Resource *resource);
|
||||||
void sendOverscan(Resource *resource);
|
void sendOverscan(Resource *resource);
|
||||||
void sendVrrPolicy(Resource *resource);
|
void sendVrrPolicy(Resource *resource);
|
||||||
|
void sendRgbRange(Resource *resource);
|
||||||
|
|
||||||
QSize physicalSize;
|
QSize physicalSize;
|
||||||
QPoint globalPosition;
|
QPoint globalPosition;
|
||||||
|
@ -72,6 +74,7 @@ public:
|
||||||
OutputDeviceV2Interface::Capabilities capabilities;
|
OutputDeviceV2Interface::Capabilities capabilities;
|
||||||
uint32_t overscan = 0;
|
uint32_t overscan = 0;
|
||||||
OutputDeviceV2Interface::VrrPolicy vrrPolicy = OutputDeviceV2Interface::VrrPolicy::Automatic;
|
OutputDeviceV2Interface::VrrPolicy vrrPolicy = OutputDeviceV2Interface::VrrPolicy::Automatic;
|
||||||
|
OutputDeviceV2Interface::RgbRange rgbRange = OutputDeviceV2Interface::RgbRange::Automatic;
|
||||||
|
|
||||||
QPointer<Display> display;
|
QPointer<Display> display;
|
||||||
OutputDeviceV2Interface *q;
|
OutputDeviceV2Interface *q;
|
||||||
|
@ -701,6 +704,33 @@ void OutputDeviceV2InterfacePrivate::updateVrrPolicy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OutputDeviceV2Interface::RgbRange OutputDeviceV2Interface::rgbRange() const
|
||||||
|
{
|
||||||
|
return d->rgbRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputDeviceV2Interface::setRgbRange(RgbRange rgbRange)
|
||||||
|
{
|
||||||
|
if (d->rgbRange != rgbRange) {
|
||||||
|
d->rgbRange = rgbRange;
|
||||||
|
d->updateRgbRange();
|
||||||
|
Q_EMIT rgbRangeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputDeviceV2InterfacePrivate::sendRgbRange(Resource *resource)
|
||||||
|
{
|
||||||
|
send_rgb_range(resource->handle, static_cast<uint32_t>(rgbRange));
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputDeviceV2InterfacePrivate::updateRgbRange()
|
||||||
|
{
|
||||||
|
const auto clientResources = resourceMap();
|
||||||
|
for (const auto &resource : clientResources) {
|
||||||
|
sendRgbRange(resource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OutputDeviceV2Interface *OutputDeviceV2Interface::get(wl_resource *native)
|
OutputDeviceV2Interface *OutputDeviceV2Interface::get(wl_resource *native)
|
||||||
{
|
{
|
||||||
if (auto devicePrivate = resource_cast<OutputDeviceV2InterfacePrivate *>(native)) {
|
if (auto devicePrivate = resource_cast<OutputDeviceV2InterfacePrivate *>(native)) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ class KWAYLANDSERVER_EXPORT OutputDeviceV2Interface : public QObject
|
||||||
Q_PROPERTY(Capabilities capabilities READ capabilities WRITE setCapabilities NOTIFY capabilitiesChanged)
|
Q_PROPERTY(Capabilities capabilities READ capabilities WRITE setCapabilities NOTIFY capabilitiesChanged)
|
||||||
Q_PROPERTY(uint32_t overscan READ overscan WRITE setOverscan NOTIFY overscanChanged)
|
Q_PROPERTY(uint32_t overscan READ overscan WRITE setOverscan NOTIFY overscanChanged)
|
||||||
Q_PROPERTY(VrrPolicy vrrPolicy READ vrrPolicy WRITE setVrrPolicy NOTIFY vrrPolicyChanged)
|
Q_PROPERTY(VrrPolicy vrrPolicy READ vrrPolicy WRITE setVrrPolicy NOTIFY vrrPolicyChanged)
|
||||||
|
Q_PROPERTY(RgbRange rgbRange READ rgbRange WRITE setRgbRange NOTIFY rgbRangeChanged)
|
||||||
public:
|
public:
|
||||||
enum class SubPixel {
|
enum class SubPixel {
|
||||||
Unknown,
|
Unknown,
|
||||||
|
@ -72,6 +73,7 @@ public:
|
||||||
enum class Capability {
|
enum class Capability {
|
||||||
Overscan = 0x1,
|
Overscan = 0x1,
|
||||||
Vrr = 0x2,
|
Vrr = 0x2,
|
||||||
|
RgbRange = 0x4,
|
||||||
};
|
};
|
||||||
Q_ENUM(Capability)
|
Q_ENUM(Capability)
|
||||||
Q_DECLARE_FLAGS(Capabilities, Capability)
|
Q_DECLARE_FLAGS(Capabilities, Capability)
|
||||||
|
@ -81,6 +83,12 @@ public:
|
||||||
Automatic = 2
|
Automatic = 2
|
||||||
};
|
};
|
||||||
Q_ENUM(VrrPolicy)
|
Q_ENUM(VrrPolicy)
|
||||||
|
enum class RgbRange {
|
||||||
|
Automatic = 0,
|
||||||
|
Full = 1,
|
||||||
|
Limited = 2,
|
||||||
|
};
|
||||||
|
Q_ENUM(RgbRange)
|
||||||
|
|
||||||
explicit OutputDeviceV2Interface(Display *display, QObject *parent = nullptr);
|
explicit OutputDeviceV2Interface(Display *display, QObject *parent = nullptr);
|
||||||
~OutputDeviceV2Interface() override;
|
~OutputDeviceV2Interface() override;
|
||||||
|
@ -107,6 +115,7 @@ public:
|
||||||
Capabilities capabilities() const;
|
Capabilities capabilities() const;
|
||||||
uint32_t overscan() const;
|
uint32_t overscan() const;
|
||||||
VrrPolicy vrrPolicy() const;
|
VrrPolicy vrrPolicy() const;
|
||||||
|
RgbRange rgbRange() const;
|
||||||
|
|
||||||
void setPhysicalSize(const QSize &size);
|
void setPhysicalSize(const QSize &size);
|
||||||
void setGlobalPosition(const QPoint &pos);
|
void setGlobalPosition(const QPoint &pos);
|
||||||
|
@ -135,6 +144,7 @@ public:
|
||||||
void setCapabilities(Capabilities cap);
|
void setCapabilities(Capabilities cap);
|
||||||
void setOverscan(uint32_t overscan);
|
void setOverscan(uint32_t overscan);
|
||||||
void setVrrPolicy(VrrPolicy policy);
|
void setVrrPolicy(VrrPolicy policy);
|
||||||
|
void setRgbRange(RgbRange rgbRange);
|
||||||
|
|
||||||
static OutputDeviceV2Interface *get(wl_resource *native);
|
static OutputDeviceV2Interface *get(wl_resource *native);
|
||||||
|
|
||||||
|
@ -158,6 +168,7 @@ Q_SIGNALS:
|
||||||
void capabilitiesChanged();
|
void capabilitiesChanged();
|
||||||
void overscanChanged();
|
void overscanChanged();
|
||||||
void vrrPolicyChanged();
|
void vrrPolicyChanged();
|
||||||
|
void rgbRangeChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<OutputDeviceV2InterfacePrivate> d;
|
QScopedPointer<OutputDeviceV2InterfacePrivate> d;
|
||||||
|
|
Loading…
Reference in a new issue