Skip to content

Commit c7b061e

Browse files
committed
DisplayServer (Linux): fix errors on KDE beta
Fix #1765
1 parent a0f5790 commit c7b061e

File tree

4 files changed

+164
-4
lines changed

4 files changed

+164
-4
lines changed

src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <stdint.h>
77
#include <stddef.h>
8-
#include <wayland-util.h>
8+
#include <wayland-client.h>
99

1010
#ifdef __cplusplus
1111
extern "C" {
@@ -214,6 +214,26 @@ enum kde_output_device_v2_capability {
214214
* @since 9
215215
*/
216216
KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS = 0x80,
217+
/**
218+
* if this outputdevice supports the built-in color profile
219+
* @since 12
220+
*/
221+
KDE_OUTPUT_DEVICE_V2_CAPABILITY_BUILT_IN_COLOR = 0x100,
222+
/**
223+
* if this outputdevice supports DDC/CI
224+
* @since 14
225+
*/
226+
KDE_OUTPUT_DEVICE_V2_CAPABILITY_DDC_CI = 0x200,
227+
/**
228+
* if this outputdevice supports setting max bpc
229+
* @since 15
230+
*/
231+
KDE_OUTPUT_DEVICE_V2_CAPABILITY_MAX_BITS_PER_COLOR = 0x400,
232+
/**
233+
* if this outputdevice supports EDR
234+
* @since 16
235+
*/
236+
KDE_OUTPUT_DEVICE_V2_CAPABILITY_EDR = 0x800,
217237
};
218238
/**
219239
* @ingroup iface_kde_output_device_v2
@@ -235,6 +255,22 @@ enum kde_output_device_v2_capability {
235255
* @ingroup iface_kde_output_device_v2
236256
*/
237257
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS_SINCE_VERSION 9
258+
/**
259+
* @ingroup iface_kde_output_device_v2
260+
*/
261+
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_BUILT_IN_COLOR_SINCE_VERSION 12
262+
/**
263+
* @ingroup iface_kde_output_device_v2
264+
*/
265+
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_DDC_CI_SINCE_VERSION 14
266+
/**
267+
* @ingroup iface_kde_output_device_v2
268+
*/
269+
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_MAX_BITS_PER_COLOR_SINCE_VERSION 15
270+
/**
271+
* @ingroup iface_kde_output_device_v2
272+
*/
273+
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_EDR_SINCE_VERSION 16
238274
#endif /* KDE_OUTPUT_DEVICE_V2_CAPABILITY_ENUM */
239275

240276
#ifndef KDE_OUTPUT_DEVICE_V2_VRR_POLICY_ENUM
@@ -316,6 +352,18 @@ enum kde_output_device_v2_color_power_tradeoff {
316352
};
317353
#endif /* KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM */
318354

355+
#ifndef KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ENUM
356+
#define KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ENUM
357+
/**
358+
* @ingroup iface_kde_output_device_v2
359+
* when the compositor may make use of EDR
360+
*/
361+
enum kde_output_device_v2_edr_policy {
362+
KDE_OUTPUT_DEVICE_V2_EDR_POLICY_NEVER = 0,
363+
KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ALWAYS = 1,
364+
};
365+
#endif /* KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ENUM */
366+
319367
/**
320368
* @ingroup iface_kde_output_device_v2
321369
* @struct kde_output_device_v2_listener
@@ -658,6 +706,74 @@ struct kde_output_device_v2_listener {
658706
void (*dimming)(void *data,
659707
struct kde_output_device_v2 *kde_output_device_v2,
660708
uint32_t multiplier);
709+
/**
710+
* source output for mirroring
711+
*
712+
*
713+
* @param source uuid of the source output
714+
* @since 13
715+
*/
716+
void (*replication_source)(void *data,
717+
struct kde_output_device_v2 *kde_output_device_v2,
718+
const char *source);
719+
/**
720+
* if DDC/CI should be used to control brightness etc.
721+
*
722+
* If the ddc_ci capability is present, this determines if
723+
* settings such as brightness, contrast or others should be set
724+
* using DDC/CI.
725+
* @param allowed 1 if allowed, 0 if disabled
726+
* @since 14
727+
*/
728+
void (*ddc_ci_allowed)(void *data,
729+
struct kde_output_device_v2 *kde_output_device_v2,
730+
uint32_t allowed);
731+
/**
732+
* override max bpc
733+
*
734+
* This limits the amount of bits per color that are sent to the
735+
* display.
736+
* @param max_bpc 0 for the default / automatic
737+
* @since 15
738+
*/
739+
void (*max_bits_per_color)(void *data,
740+
struct kde_output_device_v2 *kde_output_device_v2,
741+
uint32_t max_bpc);
742+
/**
743+
* range of max bits per color value
744+
*
745+
*
746+
* @param min_value the minimum supported by the driver
747+
* @param max_value the maximum supported by the driver
748+
* @since 15
749+
*/
750+
void (*max_bits_per_color_range)(void *data,
751+
struct kde_output_device_v2 *kde_output_device_v2,
752+
uint32_t min_value,
753+
uint32_t max_value);
754+
/**
755+
* if and to what value automatic max bpc is limited
756+
*
757+
*
758+
* @param max_bpc_limit which value automatic bpc gets limited to. 0 if not limited
759+
* @since 15
760+
*/
761+
void (*automatic_max_bits_per_color_limit)(void *data,
762+
struct kde_output_device_v2 *kde_output_device_v2,
763+
uint32_t max_bpc_limit);
764+
/**
765+
* when the compositor may apply EDR
766+
*
767+
* When EDR is enabled, the compositor may increase the backlight
768+
* beyond the user-specified setting, in order to present HDR
769+
* content on displays without native HDR support. This will
770+
* usually result in better visuals, but also increases battery
771+
* usage.
772+
* @since 16
773+
*/
774+
void (*edr_policy)(void *data,
775+
struct kde_output_device_v2 *kde_output_device_v2,
776+
uint32_t policy);
661777
};
662778

663779
/**
@@ -779,6 +895,30 @@ kde_output_device_v2_add_listener(struct kde_output_device_v2 *kde_output_device
779895
* @ingroup iface_kde_output_device_v2
780896
*/
781897
#define KDE_OUTPUT_DEVICE_V2_DIMMING_SINCE_VERSION 11
898+
/**
899+
* @ingroup iface_kde_output_device_v2
900+
*/
901+
#define KDE_OUTPUT_DEVICE_V2_REPLICATION_SOURCE_SINCE_VERSION 13
902+
/**
903+
* @ingroup iface_kde_output_device_v2
904+
*/
905+
#define KDE_OUTPUT_DEVICE_V2_DDC_CI_ALLOWED_SINCE_VERSION 14
906+
/**
907+
* @ingroup iface_kde_output_device_v2
908+
*/
909+
#define KDE_OUTPUT_DEVICE_V2_MAX_BITS_PER_COLOR_SINCE_VERSION 15
910+
/**
911+
* @ingroup iface_kde_output_device_v2
912+
*/
913+
#define KDE_OUTPUT_DEVICE_V2_MAX_BITS_PER_COLOR_RANGE_SINCE_VERSION 15
914+
/**
915+
* @ingroup iface_kde_output_device_v2
916+
*/
917+
#define KDE_OUTPUT_DEVICE_V2_AUTOMATIC_MAX_BITS_PER_COLOR_LIMIT_SINCE_VERSION 15
918+
/**
919+
* @ingroup iface_kde_output_device_v2
920+
*/
921+
#define KDE_OUTPUT_DEVICE_V2_EDR_POLICY_SINCE_VERSION 16
782922

783923

784924
/** @ingroup iface_kde_output_device_v2 */

src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,18 @@ static const struct wl_message kde_output_device_v2_events[] = {
6060
{ "brightness", "8u", kde_output_device_v2_types + 0 },
6161
{ "color_power_tradeoff", "10u", kde_output_device_v2_types + 0 },
6262
{ "dimming", "11u", kde_output_device_v2_types + 0 },
63+
{ "replication_source", "13s", kde_output_device_v2_types + 0 },
64+
{ "ddc_ci_allowed", "14u", kde_output_device_v2_types + 0 },
65+
{ "max_bits_per_color", "15u", kde_output_device_v2_types + 0 },
66+
{ "max_bits_per_color_range", "15uu", kde_output_device_v2_types + 0 },
67+
{ "automatic_max_bits_per_color_limit", "15u", kde_output_device_v2_types + 0 },
68+
{ "edr_policy", "16u", kde_output_device_v2_types + 0 },
6369
};
6470

6571
WL_EXPORT const struct wl_interface kde_output_device_v2_interface = {
66-
"kde_output_device_v2", 11,
72+
"kde_output_device_v2", 16,
6773
0, NULL,
68-
27, kde_output_device_v2_events,
74+
33, kde_output_device_v2_events,
6975
};
7076

7177
static const struct wl_message kde_output_device_mode_v2_events[] = {

src/detection/displayserver/linux/wayland/kde-output.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ static void waylandKdeHdrListener(void *data, FF_MAYBE_UNUSED struct kde_output_
137137
display->hdrEnabled = !!hdr_enabled;
138138
}
139139

140+
static void waylandKdeMaxBitsPerColorListener(void *data, FF_MAYBE_UNUSED struct kde_output_device_v2 *kde_output_device_v2, uint32_t max_bpc)
141+
{
142+
WaylandDisplay* display = data;
143+
display->bitDepth = (uint8_t) max_bpc;
144+
}
145+
140146
static struct kde_output_device_v2_listener outputListener = {
141147
.geometry = waylandKdeGeometryListener,
142148
.current_mode = waylandKdeCurrentModeListener,
@@ -165,6 +171,12 @@ static struct kde_output_device_v2_listener outputListener = {
165171
.brightness = (void*) stubListener,
166172
.color_power_tradeoff = (void*) stubListener,
167173
.dimming = (void*) stubListener,
174+
.replication_source = (void*) stubListener,
175+
.ddc_ci_allowed = (void*) stubListener,
176+
.max_bits_per_color = (void*) waylandKdeMaxBitsPerColorListener,
177+
.max_bits_per_color_range = (void*) stubListener,
178+
.automatic_max_bits_per_color_limit = (void*) stubListener,
179+
.edr_policy = (void*) stubListener,
168180
};
169181

170182
const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
@@ -237,6 +249,7 @@ const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* re
237249
item->manufactureYear = display.myear;
238250
item->manufactureWeek = display.mweek;
239251
item->serial = display.serial;
252+
item->bitDepth = display.bitDepth;
240253
}
241254

242255
ffStrbufDestroy(&display.description);

src/detection/displayserver/linux/wayland/wayland.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ typedef struct WaylandData
3434
typedef struct WaylandDisplay
3535
{
3636
WaylandData* parent;
37+
void* internal;
3738
int32_t width;
3839
int32_t height;
3940
int32_t refreshRate;
@@ -55,7 +56,7 @@ typedef struct WaylandDisplay
5556
uint16_t myear;
5657
uint16_t mweek;
5758
uint32_t serial;
58-
void* internal;
59+
uint8_t bitDepth;
5960
} WaylandDisplay;
6061

6162
inline static void stubListener(void* data, ...)

0 commit comments

Comments
 (0)