14static constexpr uint32_t s_version = 1;
18 , QtWaylandServer::frog_color_management_factory_v1(*display, s_version)
26void FrogColorManagementV1::frog_color_management_factory_v1_get_color_managed_surface(Resource *resource, wl_resource *surface, uint32_t callback)
32void FrogColorManagementV1::frog_color_management_factory_v1_destroy(Resource *resource)
34 wl_resource_destroy(resource->handle);
38 : QtWaylandServer::frog_color_managed_surface(client, id, s_version)
48 priv->pending->colorDescriptionIsSet =
true;
49 priv->frogColorManagement =
nullptr;
53static QtWaylandServer::frog_color_managed_surface::transfer_function kwinToFrogTransferFunction(
NamedTransferFunction tf)
57 return QtWaylandServer::frog_color_managed_surface::transfer_function_srgb;
59 return QtWaylandServer::frog_color_managed_surface::transfer_function_gamma_22;
61 return QtWaylandServer::frog_color_managed_surface::transfer_function_st2084_pq;
63 return QtWaylandServer::frog_color_managed_surface::transfer_function_scrgb_linear;
65 return QtWaylandServer::frog_color_managed_surface::transfer_function_scrgb_linear;
67 return QtWaylandServer::frog_color_managed_surface::transfer_function_undefined;
72 return uint16_t(std::clamp<float>(std::round(primary / 0.00002), 0, 0xC350));
78 send_preferred_metadata(kwinToFrogTransferFunction(colorDescription.
transferFunction()),
88void FrogColorManagementSurfaceV1::frog_color_managed_surface_set_known_transfer_function(Resource *resource, uint32_t transfer_function)
90 switch (transfer_function) {
91 case transfer_function_undefined:
92 case transfer_function_srgb:
93 case transfer_function_gamma_22:
96 case transfer_function_st2084_pq:
99 case transfer_function_scrgb_linear:
103 updateColorDescription();
106void FrogColorManagementSurfaceV1::frog_color_managed_surface_set_known_container_color_volume(Resource *resource, uint32_t primaries)
109 case primaries_undefined:
110 case primaries_rec709:
113 case primaries_rec2020:
117 updateColorDescription();
120void FrogColorManagementSurfaceV1::frog_color_managed_surface_set_render_intent(Resource *resource, uint32_t render_intent)
125void FrogColorManagementSurfaceV1::frog_color_managed_surface_set_hdr_metadata(Resource *resource,
126 uint32_t mastering_display_primary_red_x, uint32_t mastering_display_primary_red_y,
127 uint32_t mastering_display_primary_green_x, uint32_t mastering_display_primary_green_y,
128 uint32_t mastering_display_primary_blue_x, uint32_t mastering_display_primary_blue_y,
129 uint32_t mastering_white_point_x, uint32_t mastering_white_point_y,
130 uint32_t max_display_mastering_luminance, uint32_t min_display_mastering_luminance,
131 uint32_t max_cll, uint32_t max_fall)
133 m_maxPeakBrightness = max_cll;
134 m_maxFrameAverageBrightness = max_fall;
135 updateColorDescription();
138void FrogColorManagementSurfaceV1::frog_color_managed_surface_destroy(Resource *resource)
140 wl_resource_destroy(resource->handle);
143void FrogColorManagementSurfaceV1::frog_color_managed_surface_destroy_resource(Resource *resource)
148void FrogColorManagementSurfaceV1::updateColorDescription()
153 priv->pending->colorDescription = ColorDescription(m_colorimetry, m_transferFunction, 0, 0, m_maxFrameAverageBrightness, m_maxPeakBrightness);
154 priv->pending->colorDescriptionIsSet =
true;
160#include "moc_frog_colormanagement_v1.cpp"
NamedTransferFunction transferFunction() const
double minHdrBrightness() const
static const ColorDescription sRGB
double maxHdrHighlightBrightness() const
const Colorimetry & colorimetry() const
double maxFrameAverageBrightness() const
Class holding the Wayland server display loop.
void setPreferredColorDescription(const ColorDescription &colorDescription)
FrogColorManagementSurfaceV1(SurfaceInterface *surface, wl_client *client, uint32_t id)
~FrogColorManagementSurfaceV1() override
~FrogColorManagementV1() override
FrogColorManagementV1(Display *display, QObject *parent)
Resource representing a wl_surface.
static SurfaceInterface * get(wl_resource *native)
FrogColorManagementSurfaceV1 * frogColorManagement
static SurfaceInterfacePrivate * get(SurfaceInterface *surface)
uint16_t encodePrimary(float primary)