From b2736938427ed309c10eaf45f840b96214b01c93 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 9 Jan 2025 09:06:16 +0800 Subject: [PATCH 01/19] Packaging: update debian stuff [ci skip] --- debian/changelog | 6 ++++++ debian/files | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3b280a673..5931bab71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +fastfetch (2.34.0) jammy; urgency=medium + + * Update to 2.34.0 + + -- Carter Li Thu, 09 Jan 2025 09:03:17 +0800 + fastfetch (2.33.0) jammy; urgency=medium * Update to 2.33.0 diff --git a/debian/files b/debian/files index 185e49319..27dbba601 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -fastfetch_2.33.0_source.buildinfo universe/utils optional +fastfetch_2.34.0_source.buildinfo universe/utils optional From c5c2589f4d16d9378b23d981dc4b7577cc5fb724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 10 Jan 2025 08:48:29 +0800 Subject: [PATCH 02/19] GPU: set GPU vendor string when using OpenGL backend --- src/detection/gpu/gpu.c | 4 ++-- src/modules/gpu/gpu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/detection/gpu/gpu.c b/src/detection/gpu/gpu.c index 86e16716d..1822cb447 100644 --- a/src/detection/gpu/gpu.c +++ b/src/detection/gpu/gpu.c @@ -51,9 +51,9 @@ const char* detectByOpenGL(FFlist* gpus) { FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus); gpu->type = FF_GPU_TYPE_UNKNOWN; - ffStrbufInit(&gpu->vendor); + ffStrbufInitMove(&gpu->vendor, &result.vendor); ffStrbufInitMove(&gpu->name, &result.renderer); - ffStrbufInitMove(&gpu->driver, &result.vendor); + ffStrbufInit(&gpu->driver); ffStrbufInitF(&gpu->platformApi, "OpenGL %s", result.version.chars); gpu->index = FF_GPU_INDEX_UNSET; gpu->temperature = FF_GPU_TEMP_UNSET; diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index 887a8a899..10d1b46d2 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -26,7 +26,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu FF_STRBUF_AUTO_DESTROY output = ffStrbufCreate(); - if(gpu->vendor.length > 0 && !ffStrbufStartsWith(&gpu->name, &gpu->vendor)) + if(gpu->vendor.length > 0 && !ffStrbufStartsWithIgnCase(&gpu->name, &gpu->vendor)) { ffStrbufAppend(&output, &gpu->vendor); ffStrbufAppendC(&output, ' '); From 8c227ae4b843c9d6a18aaafd8807daa7913e2532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 10 Jan 2025 09:41:14 +0800 Subject: [PATCH 03/19] TerminalFont (macOS): fix Ghostty termfont detection `~/Library/Application Support/com.mitchellh.ghostty/config` is generated as an empty file if the settings dialog is opened Fix #1495 --- src/detection/terminalfont/terminalfont.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/detection/terminalfont/terminalfont.c b/src/detection/terminalfont/terminalfont.c index 005c3f32b..156cfb3c7 100644 --- a/src/detection/terminalfont/terminalfont.c +++ b/src/detection/terminalfont/terminalfont.c @@ -58,18 +58,14 @@ static void detectGhostty(FFTerminalFontResult* terminalFont) {"font-size =", &fontSize}, }; - if ( - #if __APPLE__ - !ffParsePropFileConfigValues("com.mitchellh.ghostty/config", 2, fontQueryToml) && - #endif - !ffParsePropFileConfigValues("ghostty/config", 2, fontQueryToml) - ) { - ffStrbufAppendS(&terminalFont->error, "Couldn't find file `ghostty/config`"); - return; - } + #if __APPLE__ + ffParsePropFileConfigValues("com.mitchellh.ghostty/config", 2, fontQueryToml); + #endif + + ffParsePropFileConfigValues("ghostty/config", 2, fontQueryToml); if(fontName.length == 0) - ffStrbufAppendS(&fontName, "JetBrains Mono"); + ffStrbufAppendS(&fontName, "JetBrainsMono Nerd Font"); if(fontSize.length == 0) ffStrbufAppendS(&fontSize, "13"); From 1bc41dfa544dbe9d01a69fd8129eb51fecd62bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 10 Jan 2025 14:01:12 +0800 Subject: [PATCH 04/19] chore: remove unnecessary NULL checks Fix #1494 --- src/detection/diskio/diskio_bsd.c | 3 +-- src/detection/gtk_qt/qt.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/detection/diskio/diskio_bsd.c b/src/detection/diskio/diskio_bsd.c index afb271a10..f8fc1d8c7 100644 --- a/src/detection/diskio/diskio_bsd.c +++ b/src/detection/diskio/diskio_bsd.c @@ -99,8 +99,7 @@ const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) device->writeCount = current->num_writes; } - if (stats.dinfo->mem_ptr) - free(stats.dinfo->mem_ptr); + free(stats.dinfo->mem_ptr); free(stats.dinfo); return NULL; diff --git a/src/detection/gtk_qt/qt.c b/src/detection/gtk_qt/qt.c index cefdf86dc..ad2c0ab2d 100644 --- a/src/detection/gtk_qt/qt.c +++ b/src/detection/gtk_qt/qt.c @@ -74,8 +74,7 @@ static bool detectPlasmaFromFile(const char* filename, FFQtResult* result) } } - if(line != NULL) - free(line); + free(line); fclose(kdeglobals); From 17e3853f38ac9937ae5565aab1419a06b8eb088a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 4 Jan 2025 18:42:04 +0800 Subject: [PATCH 05/19] CPU (FreeBSD): bind process to the first 2 cores --- src/detection/cpu/cpu_bsd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/detection/cpu/cpu_bsd.c b/src/detection/cpu/cpu_bsd.c index 7a5b72144..0ba110d0d 100644 --- a/src/detection/cpu/cpu_bsd.c +++ b/src/detection/cpu/cpu_bsd.c @@ -1,6 +1,9 @@ #include "cpu.h" #include "common/sysctl.h" +#include +#include + static const char* detectCpuTemp(double* current) { int temp = ffSysctlGetInt("dev.cpu.0.temperature", -999999); @@ -60,9 +63,18 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) } } +#if __x86_64__ || __i386__ + // Bind current process to the first two cores, which is *usually* a performance core + cpuset_t currentCPU; + CPU_ZERO(¤tCPU); + CPU_SET(1, ¤tCPU); + CPU_SET(2, ¤tCPU); + cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(cpuset_t), ¤tCPU); ffCPUDetectSpeedByCpuid(cpu); +#endif - cpu->frequencyBase = (uint32_t) ffSysctlGetInt("hw.clockrate", 0); + uint32_t clockrate = (uint32_t) ffSysctlGetInt("hw.clockrate", 0); + if (clockrate > cpu->frequencyBase) cpu->frequencyBase = clockrate; cpu->temperature = FF_CPU_TEMP_UNSET; if (options->temp) From 10c8c1b4bf9a8e23352bc3d4774fc6b77ac36f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 10 Jan 2025 22:17:36 +0800 Subject: [PATCH 06/19] Media (Linux): use file name as media name if song title is not available --- src/detection/media/media_linux.c | 34 ++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/detection/media/media_linux.c b/src/detection/media/media_linux.c index 479fa431d..d9fbe8ad1 100644 --- a/src/detection/media/media_linux.c +++ b/src/detection/media/media_linux.c @@ -8,7 +8,6 @@ #ifdef FF_HAVE_DBUS #include "common/dbus.h" -#include "common/library.h" #define FF_DBUS_ITER_CONTINUE(dbus, iterator) \ { \ @@ -116,10 +115,35 @@ static bool getBusProperties(FFDBusData* data, const char* busName, FFMediaResul if(result->song.length == 0) { - ffStrbufClear(&result->artist); - ffStrbufClear(&result->album); - ffStrbufClear(&result->url); - return false; + if(result->url.length) + { + const char* fileName = memrchr(result->url.chars, '/', result->url.length); + assert(fileName); + ++fileName; + ffStrbufEnsureFixedLengthFree(&result->song, result->url.length - (uint32_t) (fileName - result->url.chars)); + for(; *fileName && *fileName != '?'; ++fileName) + { + if (*fileName != '%') + { + ffStrbufAppendC(&result->song, *fileName); + } + else + { + char str[] = { fileName[1], fileName[2], 0 }; + if (str[0] == 0 || str[1] == 0) + break; + ffStrbufAppendC(&result->song, (char) strtoul(str, NULL, 16)); + fileName += 2; + } + } + } + else + { + ffStrbufClear(&result->artist); + ffStrbufClear(&result->album); + ffStrbufClear(&result->url); + return false; + } } //Set short bus name From 4e3673a2bb40a7635aa9d721ecf1a7400a592f26 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sat, 11 Jan 2025 13:10:07 +0800 Subject: [PATCH 07/19] DisplayServer (Linux): check HDR support with `xx_color_manager_v4_interface` (WIP) --- CMakeLists.txt | 2 + .../linux/wayland/color-manager.c | 114 + .../displayserver/linux/wayland/wayland.c | 5 + .../displayserver/linux/wayland/wayland.h | 1 + .../xx-color-management-v4-client-protocol.h | 2447 +++++++++++++++++ .../wayland/xx-color-management-v4-protocol.c | 199 ++ 6 files changed, 2768 insertions(+) create mode 100644 src/detection/displayserver/linux/wayland/color-manager.c create mode 100644 src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h create mode 100644 src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c diff --git a/CMakeLists.txt b/CMakeLists.txt index d524a7ada..3159adc66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -491,10 +491,12 @@ if(LINUX) src/detection/displayserver/linux/wayland/global-output.c src/detection/displayserver/linux/wayland/zwlr-output.c src/detection/displayserver/linux/wayland/kde-output.c + src/detection/displayserver/linux/wayland/color-manager.c src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c src/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.c src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c + src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c src/detection/displayserver/linux/wmde.c src/detection/displayserver/linux/xcb.c src/detection/displayserver/linux/xlib.c diff --git a/src/detection/displayserver/linux/wayland/color-manager.c b/src/detection/displayserver/linux/wayland/color-manager.c new file mode 100644 index 000000000..32e202a49 --- /dev/null +++ b/src/detection/displayserver/linux/wayland/color-manager.c @@ -0,0 +1,114 @@ +#include "wayland.h" +#include "xx-color-management-v4-client-protocol.h" + +static void waylandSupportedPrimariesNamed(void* data, FF_MAYBE_UNUSED struct xx_color_manager_v4* manager, uint32_t primaries) +{ + WaylandData* wldata = data; + switch (primaries) + { + case XX_COLOR_MANAGER_V4_PRIMARIES_SRGB: + printf("Supported named primaries: SRGB\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M: + printf("Supported named primaries: PAL-M\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_PAL: + printf("Supported named primaries: PAL\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_NTSC: + printf("Supported named primaries: NTSC\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_GENERIC_FILM: + printf("Supported named primaries: Generic Film\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_BT2020: + printf("Supported named primaries: BT2020\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_CIE1931_XYZ: + printf("Supported named primaries: CIE1931 XYZ\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_DCI_P3: + printf("Supported named primaries: DCI-P3\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_DISPLAY_P3: + printf("Supported named primaries: Display P3\n"); + break; + case XX_COLOR_MANAGER_V4_PRIMARIES_ADOBE_RGB: + printf("Supported named primaries: Adobe RGB\n"); + break; + default: + printf("Supported named primaries: Unknown\n"); + break; + } +} + +static void waylandSupportedTfNamed(void* data, FF_MAYBE_UNUSED struct xx_color_manager_v4* manager, uint32_t tf) +{ + WaylandData* wldata = data; + switch (tf) + { + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709: + printf("Supported named transfer function: BT709\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22: + printf("Supported named transfer function: Gamma 2.2\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28: + printf("Supported named transfer function: Gamma 2.8\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST240: + printf("Supported named transfer function: ST240\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR: + printf("Supported named transfer function: Linear\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_100: + printf("Supported named transfer function: Log 100\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_316: + printf("Supported named transfer function: Log 316\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_XVYCC: + printf("Supported named transfer function: XVYCC\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT1361: + printf("Supported named transfer function: BT1361\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB: + printf("Supported named transfer function: SRGB\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_EXT_SRGB: + printf("Supported named transfer function: Extended SRGB\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ: + printf("Supported named transfer function: ST2084 PQ\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST428: + printf("Supported named transfer function: ST428\n"); + break; + case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_HLG: + printf("Supported named transfer function: HLG\n"); + break; + default: + printf("Supported named transfer function: Unknown\n"); + break; + } +} + +void ffWaylandHandleColorManager(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) +{ + struct wl_proxy* output = wldata->ffwl_proxy_marshal_constructor_versioned((struct wl_proxy*) registry, WL_REGISTRY_BIND, &xx_color_manager_v4_interface, version, name, xx_color_manager_v4_interface.name, version, NULL); + if(output == NULL) + return; + + struct xx_color_manager_v4_listener managerListener = { + .supported_feature = (void*) stubListener, + .supported_intent = (void*) stubListener, + .supported_primaries_named = waylandSupportedPrimariesNamed, + .supported_tf_named = waylandSupportedTfNamed, + }; + + wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &managerListener, wldata); + wldata->ffwl_display_roundtrip(wldata->display); + wldata->ffwl_proxy_destroy(output); +} diff --git a/src/detection/displayserver/linux/wayland/wayland.c b/src/detection/displayserver/linux/wayland/wayland.c index d19e3733c..dfdb41bd5 100644 --- a/src/detection/displayserver/linux/wayland/wayland.c +++ b/src/detection/displayserver/linux/wayland/wayland.c @@ -17,6 +17,7 @@ #include "kde-output-device-v2-client-protocol.h" #include "kde-output-order-v1-client-protocol.h" #include "xdg-output-unstable-v1-client-protocol.h" +#include "xx-color-management-v4-client-protocol.h" #if __FreeBSD__ #include @@ -96,6 +97,10 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u { ffWaylandHandleKdeOutputOrder(wldata, registry, name, version); } + // else if(ffStrEquals(interface, xx_color_manager_v4_interface.name)) + // { + // ffWaylandHandleColorManager(wldata, registry, name, version); + // } else if((wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_GLOBAL || wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_NONE) && ffStrEquals(interface, zxdg_output_manager_v1_interface.name)) { ffWaylandHandleZxdgOutput(wldata, registry, name, version); diff --git a/src/detection/displayserver/linux/wayland/wayland.h b/src/detection/displayserver/linux/wayland/wayland.h index ab11d0538..224f53a52 100644 --- a/src/detection/displayserver/linux/wayland/wayland.h +++ b/src/detection/displayserver/linux/wayland/wayland.h @@ -84,5 +84,6 @@ void ffWaylandHandleZwlrOutput(WaylandData* wldata, struct wl_registry* registry void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); void ffWaylandHandleKdeOutputOrder(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); void ffWaylandHandleZxdgOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); +void ffWaylandHandleColorManager(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); #endif diff --git a/src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h b/src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h new file mode 100644 index 000000000..e3cf9c2c6 --- /dev/null +++ b/src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h @@ -0,0 +1,2447 @@ +/* Generated by wayland-scanner 1.23.1 */ + +#ifndef COLOR_MANAGEMENT_V1_CLIENT_PROTOCOL_H +#define COLOR_MANAGEMENT_V1_CLIENT_PROTOCOL_H + +#include +#include +#include "wayland-client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @page page_color_management_v1 The color_management_v1 protocol + * color management protocol + * + * @section page_desc_color_management_v1 Description + * + * The aim of the color management extension is to allow clients to know + * the color properties of outputs, and to tell the compositor about the color + * properties of their content on surfaces. Doing this enables a compositor + * to perform automatic color management of content for different outputs + * according to how content is intended to look like. + * + * The color properties are represented as an image description object which + * is immutable after it has been created. A wl_output always has an + * associated image description that clients can observe. A wl_surface + * always has an associated preferred image description as a hint chosen by + * the compositor that clients can also observe. Clients can set an image + * description on a wl_surface to denote the color characteristics of the + * surface contents. + * + * An image description includes SDR and HDR colorimetry and encoding, HDR + * metadata, and viewing environment parameters. An image description does + * not include the properties set through color-representation extension. + * It is expected that the color-representation extension is used in + * conjunction with the color management extension when necessary, + * particularly with the YUV family of pixel formats. + * + * Recommendation ITU-T H.273 + * "Coding-independent code points for video signal type identification" + * shall be referred to as simply H.273 here. + * + * The color-and-hdr repository + * (https://gitlab.freedesktop.org/pq/color-and-hdr) contains + * background information on the protocol design and legacy color management. + * It also contains a glossary, learning resources for digital color, tools, + * samples and more. + * + * The terminology used in this protocol is based on common color science and + * color encoding terminology where possible. The glossary in the color-and-hdr + * repository shall be the authority on the definition of terms in this + * protocol. + * + * @section page_ifaces_color_management_v1 Interfaces + * - @subpage page_iface_xx_color_manager_v4 - color manager singleton + * - @subpage page_iface_xx_color_management_output_v4 - output color properties + * - @subpage page_iface_xx_color_management_surface_v4 - color management extension to a surface + * - @subpage page_iface_xx_color_management_feedback_surface_v4 - color management extension to a surface + * - @subpage page_iface_xx_image_description_creator_icc_v4 - holder of image description ICC information + * - @subpage page_iface_xx_image_description_creator_params_v4 - holder of image description parameters + * - @subpage page_iface_xx_image_description_v4 - Colorimetric image description + * - @subpage page_iface_xx_image_description_info_v4 - Colorimetric image description information + * @section page_copyright_color_management_v1 Copyright + *
+ *
+ * Copyright 2019 Sebastian Wick
+ * Copyright 2019 Erwin Burema
+ * Copyright 2020 AMD
+ * Copyright 2020-2024 Collabora, Ltd.
+ * Copyright 2024 Xaver Hugl
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * 
+ */ +struct wl_output; +struct wl_surface; +struct xx_color_management_feedback_surface_v4; +struct xx_color_management_output_v4; +struct xx_color_management_surface_v4; +struct xx_color_manager_v4; +struct xx_image_description_creator_icc_v4; +struct xx_image_description_creator_params_v4; +struct xx_image_description_info_v4; +struct xx_image_description_v4; + +#ifndef XX_COLOR_MANAGER_V4_INTERFACE +#define XX_COLOR_MANAGER_V4_INTERFACE +/** + * @page page_iface_xx_color_manager_v4 xx_color_manager_v4 + * @section page_iface_xx_color_manager_v4_desc Description + * + * A global interface used for getting color management extensions for + * wl_surface and wl_output objects, and for creating client defined image + * description objects. The extension interfaces allow + * getting the image description of outputs and setting the image + * description of surfaces. + * @section page_iface_xx_color_manager_v4_api API + * See @ref iface_xx_color_manager_v4. + */ +/** + * @defgroup iface_xx_color_manager_v4 The xx_color_manager_v4 interface + * + * A global interface used for getting color management extensions for + * wl_surface and wl_output objects, and for creating client defined image + * description objects. The extension interfaces allow + * getting the image description of outputs and setting the image + * description of surfaces. + */ +extern const struct wl_interface xx_color_manager_v4_interface; +#endif +#ifndef XX_COLOR_MANAGEMENT_OUTPUT_V4_INTERFACE +#define XX_COLOR_MANAGEMENT_OUTPUT_V4_INTERFACE +/** + * @page page_iface_xx_color_management_output_v4 xx_color_management_output_v4 + * @section page_iface_xx_color_management_output_v4_desc Description + * + * A xx_color_management_output_v4 describes the color properties of an + * output. + * + * The xx_color_management_output_v4 is associated with the wl_output global + * underlying the wl_output object. Therefore the client destroying the + * wl_output object has no impact, but the compositor removing the output + * global makes the xx_color_management_output_v4 object inert. + * @section page_iface_xx_color_management_output_v4_api API + * See @ref iface_xx_color_management_output_v4. + */ +/** + * @defgroup iface_xx_color_management_output_v4 The xx_color_management_output_v4 interface + * + * A xx_color_management_output_v4 describes the color properties of an + * output. + * + * The xx_color_management_output_v4 is associated with the wl_output global + * underlying the wl_output object. Therefore the client destroying the + * wl_output object has no impact, but the compositor removing the output + * global makes the xx_color_management_output_v4 object inert. + */ +extern const struct wl_interface xx_color_management_output_v4_interface; +#endif +#ifndef XX_COLOR_MANAGEMENT_SURFACE_V4_INTERFACE +#define XX_COLOR_MANAGEMENT_SURFACE_V4_INTERFACE +/** + * @page page_iface_xx_color_management_surface_v4 xx_color_management_surface_v4 + * @section page_iface_xx_color_management_surface_v4_desc Description + * + * A xx_color_management_surface_v4 allows the client to set the color + * space and HDR properties of a surface. + * + * If the wl_surface associated with the xx_color_management_surface_v4 is + * destroyed, the xx_color_management_surface_v4 object becomes inert. + * @section page_iface_xx_color_management_surface_v4_api API + * See @ref iface_xx_color_management_surface_v4. + */ +/** + * @defgroup iface_xx_color_management_surface_v4 The xx_color_management_surface_v4 interface + * + * A xx_color_management_surface_v4 allows the client to set the color + * space and HDR properties of a surface. + * + * If the wl_surface associated with the xx_color_management_surface_v4 is + * destroyed, the xx_color_management_surface_v4 object becomes inert. + */ +extern const struct wl_interface xx_color_management_surface_v4_interface; +#endif +#ifndef XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_INTERFACE +#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_INTERFACE +/** + * @page page_iface_xx_color_management_feedback_surface_v4 xx_color_management_feedback_surface_v4 + * @section page_iface_xx_color_management_feedback_surface_v4_desc Description + * + * A xx_color_management_feedback_surface_v4 allows the client to get the + * preferred color description of a surface. + * + * If the wl_surface associated with this object is destroyed, the + * xx_color_management_feedback_surface_v4 object becomes inert. + * @section page_iface_xx_color_management_feedback_surface_v4_api API + * See @ref iface_xx_color_management_feedback_surface_v4. + */ +/** + * @defgroup iface_xx_color_management_feedback_surface_v4 The xx_color_management_feedback_surface_v4 interface + * + * A xx_color_management_feedback_surface_v4 allows the client to get the + * preferred color description of a surface. + * + * If the wl_surface associated with this object is destroyed, the + * xx_color_management_feedback_surface_v4 object becomes inert. + */ +extern const struct wl_interface xx_color_management_feedback_surface_v4_interface; +#endif +#ifndef XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_INTERFACE +#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_INTERFACE +/** + * @page page_iface_xx_image_description_creator_icc_v4 xx_image_description_creator_icc_v4 + * @section page_iface_xx_image_description_creator_icc_v4_desc Description + * + * This type of object is used for collecting all the information required + * to create a xx_image_description_v4 object from an ICC file. A complete + * set of required parameters consists of these properties: + * - ICC file + * + * Each required property must be set exactly once if the client is to create + * an image description. The set requests verify that a property was not + * already set. The create request verifies that all required properties are + * set. There may be several alternative requests for setting each property, + * and in that case the client must choose one of them. + * + * Once all properties have been set, the create request must be used to + * create the image description object, destroying the creator in the + * process. + * @section page_iface_xx_image_description_creator_icc_v4_api API + * See @ref iface_xx_image_description_creator_icc_v4. + */ +/** + * @defgroup iface_xx_image_description_creator_icc_v4 The xx_image_description_creator_icc_v4 interface + * + * This type of object is used for collecting all the information required + * to create a xx_image_description_v4 object from an ICC file. A complete + * set of required parameters consists of these properties: + * - ICC file + * + * Each required property must be set exactly once if the client is to create + * an image description. The set requests verify that a property was not + * already set. The create request verifies that all required properties are + * set. There may be several alternative requests for setting each property, + * and in that case the client must choose one of them. + * + * Once all properties have been set, the create request must be used to + * create the image description object, destroying the creator in the + * process. + */ +extern const struct wl_interface xx_image_description_creator_icc_v4_interface; +#endif +#ifndef XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_INTERFACE +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_INTERFACE +/** + * @page page_iface_xx_image_description_creator_params_v4 xx_image_description_creator_params_v4 + * @section page_iface_xx_image_description_creator_params_v4_desc Description + * + * This type of object is used for collecting all the parameters required + * to create a xx_image_description_v4 object. A complete set of required + * parameters consists of these properties: + * - transfer characteristic function (tf) + * - chromaticities of primaries and white point (primary color volume) + * + * The following properties are optional and have a well-defined default + * if not explicitly set: + * - primary color volume luminance range + * - reference white luminance level + * - mastering display primaries and white point (target color volume) + * - mastering luminance range + * - maximum content light level + * - maximum frame-average light level + * + * Each required property must be set exactly once if the client is to create + * an image description. The set requests verify that a property was not + * already set. The create request verifies that all required properties are + * set. There may be several alternative requests for setting each property, + * and in that case the client must choose one of them. + * + * Once all properties have been set, the create request must be used to + * create the image description object, destroying the creator in the + * process. + * @section page_iface_xx_image_description_creator_params_v4_api API + * See @ref iface_xx_image_description_creator_params_v4. + */ +/** + * @defgroup iface_xx_image_description_creator_params_v4 The xx_image_description_creator_params_v4 interface + * + * This type of object is used for collecting all the parameters required + * to create a xx_image_description_v4 object. A complete set of required + * parameters consists of these properties: + * - transfer characteristic function (tf) + * - chromaticities of primaries and white point (primary color volume) + * + * The following properties are optional and have a well-defined default + * if not explicitly set: + * - primary color volume luminance range + * - reference white luminance level + * - mastering display primaries and white point (target color volume) + * - mastering luminance range + * - maximum content light level + * - maximum frame-average light level + * + * Each required property must be set exactly once if the client is to create + * an image description. The set requests verify that a property was not + * already set. The create request verifies that all required properties are + * set. There may be several alternative requests for setting each property, + * and in that case the client must choose one of them. + * + * Once all properties have been set, the create request must be used to + * create the image description object, destroying the creator in the + * process. + */ +extern const struct wl_interface xx_image_description_creator_params_v4_interface; +#endif +#ifndef XX_IMAGE_DESCRIPTION_V4_INTERFACE +#define XX_IMAGE_DESCRIPTION_V4_INTERFACE +/** + * @page page_iface_xx_image_description_v4 xx_image_description_v4 + * @section page_iface_xx_image_description_v4_desc Description + * + * An image description carries information about the color encoding used on + * a surface when attached to a wl_surface via + * xx_color_management_surface_v4.set_image_description. A compositor can use + * this information to decode pixel values into colorimetrically meaningful + * quantities. + * + * Note, that the xx_image_description_v4 object is not ready to be used + * immediately after creation. The object eventually delivers either the + * 'ready' or the 'failed' event, specified in all requests creating it. The + * object is deemed "ready" after receiving the 'ready' event. + * + * An object which is not ready is illegal to use, it can only be destroyed. + * Any other request in this interface shall result in the 'not_ready' + * protocol error. Attempts to use an object which is not ready through other + * interfaces shall raise protocol errors defined there. + * + * Once created and regardless of how it was created, a + * xx_image_description_v4 object always refers to one fixed image + * description. It cannot change after creation. + * @section page_iface_xx_image_description_v4_api API + * See @ref iface_xx_image_description_v4. + */ +/** + * @defgroup iface_xx_image_description_v4 The xx_image_description_v4 interface + * + * An image description carries information about the color encoding used on + * a surface when attached to a wl_surface via + * xx_color_management_surface_v4.set_image_description. A compositor can use + * this information to decode pixel values into colorimetrically meaningful + * quantities. + * + * Note, that the xx_image_description_v4 object is not ready to be used + * immediately after creation. The object eventually delivers either the + * 'ready' or the 'failed' event, specified in all requests creating it. The + * object is deemed "ready" after receiving the 'ready' event. + * + * An object which is not ready is illegal to use, it can only be destroyed. + * Any other request in this interface shall result in the 'not_ready' + * protocol error. Attempts to use an object which is not ready through other + * interfaces shall raise protocol errors defined there. + * + * Once created and regardless of how it was created, a + * xx_image_description_v4 object always refers to one fixed image + * description. It cannot change after creation. + */ +extern const struct wl_interface xx_image_description_v4_interface; +#endif +#ifndef XX_IMAGE_DESCRIPTION_INFO_V4_INTERFACE +#define XX_IMAGE_DESCRIPTION_INFO_V4_INTERFACE +/** + * @page page_iface_xx_image_description_info_v4 xx_image_description_info_v4 + * @section page_iface_xx_image_description_info_v4_desc Description + * + * Sends all matching events describing an image description object exactly + * once and finally sends the 'done' event. + * + * Once a xx_image_description_info_v4 object has delivered a 'done' event it + * is automatically destroyed. + * + * Every xx_image_description_info_v4 created from the same + * xx_image_description_v4 shall always return the exact same data. + * @section page_iface_xx_image_description_info_v4_api API + * See @ref iface_xx_image_description_info_v4. + */ +/** + * @defgroup iface_xx_image_description_info_v4 The xx_image_description_info_v4 interface + * + * Sends all matching events describing an image description object exactly + * once and finally sends the 'done' event. + * + * Once a xx_image_description_info_v4 object has delivered a 'done' event it + * is automatically destroyed. + * + * Every xx_image_description_info_v4 created from the same + * xx_image_description_v4 shall always return the exact same data. + */ +extern const struct wl_interface xx_image_description_info_v4_interface; +#endif + +#ifndef XX_COLOR_MANAGER_V4_ERROR_ENUM +#define XX_COLOR_MANAGER_V4_ERROR_ENUM +enum xx_color_manager_v4_error { + /** + * request not supported + */ + XX_COLOR_MANAGER_V4_ERROR_UNSUPPORTED_FEATURE = 0, + /** + * color management surface exists already + */ + XX_COLOR_MANAGER_V4_ERROR_SURFACE_EXISTS = 1, +}; +#endif /* XX_COLOR_MANAGER_V4_ERROR_ENUM */ + +#ifndef XX_COLOR_MANAGER_V4_RENDER_INTENT_ENUM +#define XX_COLOR_MANAGER_V4_RENDER_INTENT_ENUM +/** + * @ingroup iface_xx_color_manager_v4 + * rendering intents + * + * See the ICC.1:2022 specification from the International Color Consortium + * for more details about rendering intents. + * + * The principles of ICC defined rendering intents apply with all types of + * image descriptions, not only those with ICC file profiles. + * + * Compositors must support the perceptual rendering intent. Other + * rendering intents are optional. + */ +enum xx_color_manager_v4_render_intent { + /** + * perceptual + */ + XX_COLOR_MANAGER_V4_RENDER_INTENT_PERCEPTUAL = 0, + /** + * media-relative colorimetric + */ + XX_COLOR_MANAGER_V4_RENDER_INTENT_RELATIVE = 1, + /** + * saturation + */ + XX_COLOR_MANAGER_V4_RENDER_INTENT_SATURATION = 2, + /** + * ICC-absolute colorimetric + */ + XX_COLOR_MANAGER_V4_RENDER_INTENT_ABSOLUTE = 3, + /** + * media-relative colorimetric + black point compensation + */ + XX_COLOR_MANAGER_V4_RENDER_INTENT_RELATIVE_BPC = 4, +}; +#endif /* XX_COLOR_MANAGER_V4_RENDER_INTENT_ENUM */ + +#ifndef XX_COLOR_MANAGER_V4_FEATURE_ENUM +#define XX_COLOR_MANAGER_V4_FEATURE_ENUM +/** + * @ingroup iface_xx_color_manager_v4 + * compositor supported features + */ +enum xx_color_manager_v4_feature { + /** + * new_icc_creator request + */ + XX_COLOR_MANAGER_V4_FEATURE_ICC_V2_V4 = 0, + /** + * new_parametric_creator request + */ + XX_COLOR_MANAGER_V4_FEATURE_PARAMETRIC = 1, + /** + * parametric set_primaries request + */ + XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES = 2, + /** + * parametric set_tf_power request + */ + XX_COLOR_MANAGER_V4_FEATURE_SET_TF_POWER = 3, + /** + * parametric set_luminances request + */ + XX_COLOR_MANAGER_V4_FEATURE_SET_LUMINANCES = 4, + /** + * parametric set_mastering_display_primaries request + * + * The compositor supports set_mastering_display_primaries + * request with a target color volume fully contained inside the + * primary color volume. + */ + XX_COLOR_MANAGER_V4_FEATURE_SET_MASTERING_DISPLAY_PRIMARIES = 5, + /** + * parametric target exceeds primary color volume + * + * The compositor additionally supports target color volumes that + * extend outside of the primary color volume. + * + * This can only be advertised if feature + * set_mastering_display_primaries is supported as well. + */ + XX_COLOR_MANAGER_V4_FEATURE_EXTENDED_TARGET_VOLUME = 6, +}; +#endif /* XX_COLOR_MANAGER_V4_FEATURE_ENUM */ + +#ifndef XX_COLOR_MANAGER_V4_PRIMARIES_ENUM +#define XX_COLOR_MANAGER_V4_PRIMARIES_ENUM +/** + * @ingroup iface_xx_color_manager_v4 + * named color primaries + * + * Named color primaries used to encode well-known sets of primaries. H.273 + * is the authority, when it comes to the exact values of primaries and + * authoritative specifications, where an equivalent code point exists. + * + * Descriptions do list the specifications for convenience. + */ +enum xx_color_manager_v4_primaries { + /** + * Color primaries for the sRGB color space as defined by the BT.709 standard + * + * Color primaries as defined by - Rec. ITU-R BT.709-6 - Rec. + * ITU-R BT.1361-0 conventional colour gamut system and extended + * colour gamut system (historical) - IEC 61966-2-1 sRGB or sYCC - + * IEC 61966-2-4 - Society of Motion Picture and Television + * Engineers (SMPTE) RP 177 (1993) Annex B Equivalent to H.273 + * ColourPrimaries code point 1. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_SRGB = 0, + /** + * Color primaries for PAL-M as defined by the BT.470 standard + * + * Color primaries as defined by - Rec. ITU-R BT.470-6 System M + * (historical) - United States National Television System + * Committee 1953 Recommendation for transmission standards for + * color television - United States Federal Communications + * Commission (2003) Title 47 Code of Federal Regulations 73.682 + * (a)(20) Equivalent to H.273 ColourPrimaries code point 4. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M = 1, + /** + * Color primaries for PAL as defined by the BT.601 standard + * + * Color primaries as defined by - Rec. ITU-R BT.470-6 System B, + * G (historical) - Rec. ITU-R BT.601-7 625 - Rec. ITU-R BT.1358-0 + * 625 (historical) - Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM + * Equivalent to H.273 ColourPrimaries code point 5. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_PAL = 2, + /** + * Color primaries for NTSC as defined by the BT.601 standard + * + * Color primaries as defined by - Rec. ITU-R BT.601-7 525 - Rec. + * ITU-R BT.1358-1 525 or 625 (historical) - Rec. ITU-R BT.1700-0 + * NTSC - SMPTE 170M (2004) - SMPTE 240M (1999) (historical) + * Equivalent to H.273 ColourPrimaries code point 6 and 7. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_NTSC = 3, + /** + * Generic film with colour filters using Illuminant C + * + * Color primaries as defined by H.273 for generic film. + * Equivalent to H.273 ColourPrimaries code point 8. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_GENERIC_FILM = 4, + /** + * Color primaries as defined by the BT.2020 and BT.2100 standard + * + * Color primaries as defined by - Rec. ITU-R BT.2020-2 - Rec. + * ITU-R BT.2100-0 Equivalent to H.273 ColourPrimaries code point + * 9. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_BT2020 = 5, + /** + * Color primaries of the full CIE 1931 XYZ color space + * + * Color primaries as defined as the maximum of the CIE 1931 XYZ + * color space by - SMPTE ST 428-1 - (CIE 1931 XYZ as in ISO + * 11664-1) Equivalent to H.273 ColourPrimaries code point 10. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_CIE1931_XYZ = 6, + /** + * Color primaries of the DCI P3 color space as defined by the SMPTE RP 431 standard + * + * Color primaries as defined by Digital Cinema System and + * published in SMPTE RP 431-2 (2011). Equivalent to H.273 + * ColourPrimaries code point 11. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_DCI_P3 = 7, + /** + * Color primaries of Display P3 variant of the DCI-P3 color space as defined by the SMPTE EG 432 standard + * + * Color primaries as defined by Digital Cinema System and + * published in SMPTE EG 432-1 (2010). Equivalent to H.273 + * ColourPrimaries code point 12. + */ + XX_COLOR_MANAGER_V4_PRIMARIES_DISPLAY_P3 = 8, + /** + * Color primaries of the Adobe RGB color space as defined by the ISO 12640 standard + * + * Color primaries as defined by Adobe as "Adobe RGB" and later + * published by ISO 12640-4 (2011). + */ + XX_COLOR_MANAGER_V4_PRIMARIES_ADOBE_RGB = 9, +}; +#endif /* XX_COLOR_MANAGER_V4_PRIMARIES_ENUM */ + +#ifndef XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ENUM +#define XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ENUM +/** + * @ingroup iface_xx_color_manager_v4 + * named transfer functions + * + * Named transfer functions used to encode well-known transfer + * characteristics. H.273 is the authority, when it comes to the exact + * formulas and authoritative specifications, where an equivalent code + * point exists. + * + * Descriptions do list the specifications for convenience. + */ +enum xx_color_manager_v4_transfer_function { + /** + * BT.709 transfer function + * + * Transfer characteristics as defined by - Rec. ITU-R BT.709-6 - + * Rec. ITU-R BT.1361-0 conventional colour gamut system + * (historical) Equivalent to H.273 TransferCharacteristics code + * point 1, 6, 14, 15. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709 = 0, + /** + * Assumed display gamma 2.2 transfer function + * + * Transfer characteristics as defined by - Rec. ITU-R BT.470-6 + * System M (historical) - United States National Television System + * Committee 1953 Recommendation for transmission standards for + * color television - United States Federal Communications + * Commission (2003) Title 47 Code of Federal Regulations 73.682 + * (a) (20) - Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM Equivalent + * to H.273 TransferCharacteristics code point 4. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22 = 1, + /** + * Assumed display gamma 2.8 transfer function + * + * Transfer characteristics as defined by - Rec. ITU-R BT.470-6 + * System B, G (historical) Equivalent to H.273 + * TransferCharacteristics code point 5. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28 = 2, + /** + * SMPTE ST 240 transfer function + * + * Transfer characteristics as defined by - SMPTE ST 240 (1999) + * Equivalent to H.273 TransferCharacteristics code point 7. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST240 = 3, + /** + * linear transfer function + * + * Linear transfer characteristics. Equivalent to H.273 + * TransferCharacteristics code point 8. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR = 4, + /** + * logarithmic 100:1 transfer function + * + * Logarithmic transfer characteristic (100:1 range). Equivalent + * to H.273 TransferCharacteristics code point 9. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_100 = 5, + /** + * logarithmic (100*Sqrt(10) : 1) transfer function + * + * Logarithmic transfer characteristic (100 * Sqrt(10) : 1 + * range). Equivalent to H.273 TransferCharacteristics code point + * 10. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_316 = 6, + /** + * IEC 61966-2-4 transfer function + * + * Transfer characteristics as defined by - IEC 61966-2-4 + * Equivalent to H.273 TransferCharacteristics code point 11. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_XVYCC = 7, + /** + * BT.1361 extended transfer function + * + * Transfer characteristics as defined by - Rec. ITU-R BT.1361-0 + * extended colour gamut system (historical) Equivalent to H.273 + * TransferCharacteristics code point 12. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT1361 = 8, + /** + * sRGB piece-wise transfer function + * + * Transfer characteristics as defined by - IEC 61966-2-1 sRGB + * Equivalent to H.273 TransferCharacteristics code point 13 with + * MatrixCoefficients set to 0. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB = 9, + /** + * Extended sRGB piece-wise transfer function + * + * Transfer characteristics as defined by - IEC 61966-2-1 sYCC + * Equivalent to H.273 TransferCharacteristics code point 13 with + * MatrixCoefficients set to anything but 0. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_EXT_SRGB = 10, + /** + * perceptual quantizer transfer function + * + * Transfer characteristics as defined by - SMPTE ST 2084 (2014) + * for 10-, 12-, 14- and 16-bit systems - Rec. ITU-R BT.2100-2 + * perceptual quantization (PQ) system Equivalent to H.273 + * TransferCharacteristics code point 16. + * + * This TF implies these default luminances - primary color volume + * minimum: 0.005 cd/m² - primary color volume maximum: 10000 + * cd/m² - reference white: 203 cd/m² + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ = 11, + /** + * SMPTE ST 428 transfer function + * + * Transfer characteristics as defined by - SMPTE ST 428-1 (2019) + * Equivalent to H.273 TransferCharacteristics code point 17. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST428 = 12, + /** + * hybrid log-gamma transfer function + * + * Transfer characteristics as defined by - ARIB STD-B67 (2015) - + * Rec. ITU-R BT.2100-2 hybrid log-gamma (HLG) system Equivalent to + * H.273 TransferCharacteristics code point 18. + * + * This TF implies these default luminances - primary color volume + * minimum: 0.005 cd/m² - primary color volume maximum: 1000 + * cd/m² - reference white: 203 cd/m² Note: HLG is a scene + * referred signal. All absolute luminance values used here for HLG + * assume a 1000 cd/m² display. + */ + XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_HLG = 13, +}; +#endif /* XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ENUM */ + +/** + * @ingroup iface_xx_color_manager_v4 + * @struct xx_color_manager_v4_listener + */ +struct xx_color_manager_v4_listener { + /** + * supported rendering intent + * + * When this object is created, it shall immediately send this + * event once for each rendering intent the compositor supports. + * @param render_intent rendering intent + */ + void (*supported_intent)(void *data, + struct xx_color_manager_v4 *xx_color_manager_v4, + uint32_t render_intent); + /** + * supported features + * + * When this object is created, it shall immediately send this + * event once for each compositor supported feature listed in the + * enumeration. + * @param feature supported feature + */ + void (*supported_feature)(void *data, + struct xx_color_manager_v4 *xx_color_manager_v4, + uint32_t feature); + /** + * supported named transfer characteristic + * + * When this object is created, it shall immediately send this + * event once for each named transfer function the compositor + * supports with the parametric image description creator. + * @param tf Named transfer function + */ + void (*supported_tf_named)(void *data, + struct xx_color_manager_v4 *xx_color_manager_v4, + uint32_t tf); + /** + * supported named primaries + * + * When this object is created, it shall immediately send this + * event once for each named set of primaries the compositor + * supports with the parametric image description creator. + * @param primaries Named color primaries + */ + void (*supported_primaries_named)(void *data, + struct xx_color_manager_v4 *xx_color_manager_v4, + uint32_t primaries); +}; + +/** + * @ingroup iface_xx_color_manager_v4 + */ +static inline int +xx_color_manager_v4_add_listener(struct xx_color_manager_v4 *xx_color_manager_v4, + const struct xx_color_manager_v4_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xx_color_manager_v4, + (void (**)(void)) listener, data); +} + +#define XX_COLOR_MANAGER_V4_DESTROY 0 +#define XX_COLOR_MANAGER_V4_GET_OUTPUT 1 +#define XX_COLOR_MANAGER_V4_GET_SURFACE 2 +#define XX_COLOR_MANAGER_V4_GET_FEEDBACK_SURFACE 3 +#define XX_COLOR_MANAGER_V4_NEW_ICC_CREATOR 4 +#define XX_COLOR_MANAGER_V4_NEW_PARAMETRIC_CREATOR 5 + +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_SUPPORTED_INTENT_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_SUPPORTED_FEATURE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_SUPPORTED_TF_NAMED_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_SUPPORTED_PRIMARIES_NAMED_SINCE_VERSION 1 + +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_GET_OUTPUT_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_GET_SURFACE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_GET_FEEDBACK_SURFACE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_NEW_ICC_CREATOR_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_manager_v4 + */ +#define XX_COLOR_MANAGER_V4_NEW_PARAMETRIC_CREATOR_SINCE_VERSION 1 + +/** @ingroup iface_xx_color_manager_v4 */ +static inline void +xx_color_manager_v4_set_user_data(struct xx_color_manager_v4 *xx_color_manager_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_color_manager_v4, user_data); +} + +/** @ingroup iface_xx_color_manager_v4 */ +static inline void * +xx_color_manager_v4_get_user_data(struct xx_color_manager_v4 *xx_color_manager_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_color_manager_v4); +} + +static inline uint32_t +xx_color_manager_v4_get_version(struct xx_color_manager_v4 *xx_color_manager_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4); +} + +/** + * @ingroup iface_xx_color_manager_v4 + * + * Destroy the xx_color_manager_v4 object. This does not affect any other + * objects in any way. + */ +static inline void +xx_color_manager_v4_destroy(struct xx_color_manager_v4 *xx_color_manager_v4) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, + XX_COLOR_MANAGER_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), WL_MARSHAL_FLAG_DESTROY); +} + +/** + * @ingroup iface_xx_color_manager_v4 + * + * This creates a new xx_color_management_output_v4 object for the + * given wl_output. + * + * See the xx_color_management_output_v4 interface for more details. + */ +static inline struct xx_color_management_output_v4 * +xx_color_manager_v4_get_output(struct xx_color_manager_v4 *xx_color_manager_v4, struct wl_output *output) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, + XX_COLOR_MANAGER_V4_GET_OUTPUT, &xx_color_management_output_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL, output); + + return (struct xx_color_management_output_v4 *) id; +} + +/** + * @ingroup iface_xx_color_manager_v4 + * + * If a xx_color_management_surface_v4 object already exists for the given + * wl_surface, the protocol error surface_exists is raised. + * + * This creates a new color xx_color_management_surface_v4 object for the + * given wl_surface. + * + * See the xx_color_management_surface_v4 interface for more details. + */ +static inline struct xx_color_management_surface_v4 * +xx_color_manager_v4_get_surface(struct xx_color_manager_v4 *xx_color_manager_v4, struct wl_surface *surface) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, + XX_COLOR_MANAGER_V4_GET_SURFACE, &xx_color_management_surface_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL, surface); + + return (struct xx_color_management_surface_v4 *) id; +} + +/** + * @ingroup iface_xx_color_manager_v4 + * + * This creates a new color xx_color_management_feedback_surface_v4 object + * for the given wl_surface. + * + * See the xx_color_management_feedback_surface_v4 interface for more + * details. + */ +static inline struct xx_color_management_feedback_surface_v4 * +xx_color_manager_v4_get_feedback_surface(struct xx_color_manager_v4 *xx_color_manager_v4, struct wl_surface *surface) +{ + struct wl_proxy *id; + + id = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, + XX_COLOR_MANAGER_V4_GET_FEEDBACK_SURFACE, &xx_color_management_feedback_surface_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL, surface); + + return (struct xx_color_management_feedback_surface_v4 *) id; +} + +/** + * @ingroup iface_xx_color_manager_v4 + * + * Makes a new ICC-based image description creator object with all + * properties initially unset. The client can then use the object's + * interface to define all the required properties for an image description + * and finally create a xx_image_description_v4 object. + * + * This request can be used when the compositor advertises + * xx_color_manager_v4.feature.icc_v2_v4. + * Otherwise this request raises the protocol error unsupported_feature. + */ +static inline struct xx_image_description_creator_icc_v4 * +xx_color_manager_v4_new_icc_creator(struct xx_color_manager_v4 *xx_color_manager_v4) +{ + struct wl_proxy *obj; + + obj = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, + XX_COLOR_MANAGER_V4_NEW_ICC_CREATOR, &xx_image_description_creator_icc_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL); + + return (struct xx_image_description_creator_icc_v4 *) obj; +} + +/** + * @ingroup iface_xx_color_manager_v4 + * + * Makes a new parametric image description creator object with all + * properties initially unset. The client can then use the object's + * interface to define all the required properties for an image description + * and finally create a xx_image_description_v4 object. + * + * This request can be used when the compositor advertises + * xx_color_manager_v4.feature.parametric. + * Otherwise this request raises the protocol error unsupported_feature. + */ +static inline struct xx_image_description_creator_params_v4 * +xx_color_manager_v4_new_parametric_creator(struct xx_color_manager_v4 *xx_color_manager_v4) +{ + struct wl_proxy *obj; + + obj = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, + XX_COLOR_MANAGER_V4_NEW_PARAMETRIC_CREATOR, &xx_image_description_creator_params_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL); + + return (struct xx_image_description_creator_params_v4 *) obj; +} + +/** + * @ingroup iface_xx_color_management_output_v4 + * @struct xx_color_management_output_v4_listener + */ +struct xx_color_management_output_v4_listener { + /** + * image description changed + * + * This event is sent whenever the image description of the + * output changed, followed by one wl_output.done event common to + * output events across all extensions. + * + * If the client wants to use the updated image description, it + * needs to do get_image_description again, because image + * description objects are immutable. + */ + void (*image_description_changed)(void *data, + struct xx_color_management_output_v4 *xx_color_management_output_v4); +}; + +/** + * @ingroup iface_xx_color_management_output_v4 + */ +static inline int +xx_color_management_output_v4_add_listener(struct xx_color_management_output_v4 *xx_color_management_output_v4, + const struct xx_color_management_output_v4_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xx_color_management_output_v4, + (void (**)(void)) listener, data); +} + +#define XX_COLOR_MANAGEMENT_OUTPUT_V4_DESTROY 0 +#define XX_COLOR_MANAGEMENT_OUTPUT_V4_GET_IMAGE_DESCRIPTION 1 + +/** + * @ingroup iface_xx_color_management_output_v4 + */ +#define XX_COLOR_MANAGEMENT_OUTPUT_V4_IMAGE_DESCRIPTION_CHANGED_SINCE_VERSION 1 + +/** + * @ingroup iface_xx_color_management_output_v4 + */ +#define XX_COLOR_MANAGEMENT_OUTPUT_V4_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_management_output_v4 + */ +#define XX_COLOR_MANAGEMENT_OUTPUT_V4_GET_IMAGE_DESCRIPTION_SINCE_VERSION 1 + +/** @ingroup iface_xx_color_management_output_v4 */ +static inline void +xx_color_management_output_v4_set_user_data(struct xx_color_management_output_v4 *xx_color_management_output_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_color_management_output_v4, user_data); +} + +/** @ingroup iface_xx_color_management_output_v4 */ +static inline void * +xx_color_management_output_v4_get_user_data(struct xx_color_management_output_v4 *xx_color_management_output_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_color_management_output_v4); +} + +static inline uint32_t +xx_color_management_output_v4_get_version(struct xx_color_management_output_v4 *xx_color_management_output_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_color_management_output_v4); +} + +/** + * @ingroup iface_xx_color_management_output_v4 + * + * Destroy the color xx_color_management_output_v4 object. This does not + * affect any remaining protocol objects. + */ +static inline void +xx_color_management_output_v4_destroy(struct xx_color_management_output_v4 *xx_color_management_output_v4) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_output_v4, + XX_COLOR_MANAGEMENT_OUTPUT_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_output_v4), WL_MARSHAL_FLAG_DESTROY); +} + +/** + * @ingroup iface_xx_color_management_output_v4 + * + * This creates a new xx_image_description_v4 object for the current image + * description of the output. There always is exactly one image description + * active for an output so the client should destroy the image description + * created by earlier invocations of this request. This request is usually + * sent as a reaction to the image_description_changed event or when + * creating a xx_color_management_output_v4 object. + * + * The image description of an output represents the color encoding the + * output expects. There might be performance and power advantages, as well + * as improved color reproduction, if a content update matches the image + * description of the output it is being shown on. If a content update is + * shown on any other output than the one it matches the image description + * of, then the color reproduction on those outputs might be considerably + * worse. + * + * The created xx_image_description_v4 object preserves the image + * description of the output from the time the object was created. + * + * The resulting image description object allows get_information request. + * + * If this protocol object is inert, the resulting image description object + * shall immediately deliver the xx_image_description_v4.failed event with + * the no_output cause. + * + * If the interface version is inadequate for the output's image + * description, meaning that the client does not support all the events + * needed to deliver the crucial information, the resulting image + * description object shall immediately deliver the + * xx_image_description_v4.failed event with the low_version cause. + * + * Otherwise the object shall immediately deliver the ready event. + */ +static inline struct xx_image_description_v4 * +xx_color_management_output_v4_get_image_description(struct xx_color_management_output_v4 *xx_color_management_output_v4) +{ + struct wl_proxy *image_description; + + image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_output_v4, + XX_COLOR_MANAGEMENT_OUTPUT_V4_GET_IMAGE_DESCRIPTION, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_management_output_v4), 0, NULL); + + return (struct xx_image_description_v4 *) image_description; +} + +#ifndef XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_ENUM +#define XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_ENUM +/** + * @ingroup iface_xx_color_management_surface_v4 + * protocol errors + */ +enum xx_color_management_surface_v4_error { + /** + * unsupported rendering intent + */ + XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_RENDER_INTENT = 0, + /** + * invalid image description + */ + XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_IMAGE_DESCRIPTION = 1, +}; +#endif /* XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_ENUM */ + +#define XX_COLOR_MANAGEMENT_SURFACE_V4_DESTROY 0 +#define XX_COLOR_MANAGEMENT_SURFACE_V4_SET_IMAGE_DESCRIPTION 1 +#define XX_COLOR_MANAGEMENT_SURFACE_V4_UNSET_IMAGE_DESCRIPTION 2 + + +/** + * @ingroup iface_xx_color_management_surface_v4 + */ +#define XX_COLOR_MANAGEMENT_SURFACE_V4_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_management_surface_v4 + */ +#define XX_COLOR_MANAGEMENT_SURFACE_V4_SET_IMAGE_DESCRIPTION_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_management_surface_v4 + */ +#define XX_COLOR_MANAGEMENT_SURFACE_V4_UNSET_IMAGE_DESCRIPTION_SINCE_VERSION 1 + +/** @ingroup iface_xx_color_management_surface_v4 */ +static inline void +xx_color_management_surface_v4_set_user_data(struct xx_color_management_surface_v4 *xx_color_management_surface_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_color_management_surface_v4, user_data); +} + +/** @ingroup iface_xx_color_management_surface_v4 */ +static inline void * +xx_color_management_surface_v4_get_user_data(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_color_management_surface_v4); +} + +static inline uint32_t +xx_color_management_surface_v4_get_version(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4); +} + +/** + * @ingroup iface_xx_color_management_surface_v4 + * + * Destroy the xx_color_management_surface_v4 object and do the same as + * unset_image_description. + */ +static inline void +xx_color_management_surface_v4_destroy(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_surface_v4, + XX_COLOR_MANAGEMENT_SURFACE_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4), WL_MARSHAL_FLAG_DESTROY); +} + +/** + * @ingroup iface_xx_color_management_surface_v4 + * + * Set the image description of the underlying surface. The image + * description and rendering intent are double-buffered state, see + * wl_surface.commit. + * + * It is the client's responsibility to understand the image description + * it sets on a surface, and to provide content that matches that image + * description. Compositors might convert images to match their own or any + * other image descriptions. + * + * Image description whose creation gracefully failed (received + * xx_image_description_v4.failed) are forbidden in this request, and in + * such case the protocol error image_description is raised. + * + * All image descriptions whose creation succeeded (received + * xx_image_description_v4.ready) are allowed and must always be accepted + * by the compositor. + * + * A rendering intent provides the client's preference on how content + * colors should be mapped to each output. The render_intent value must + * be one advertised by the compositor with + * xx_color_manager_v4.render_intent event, otherwise the protocol error + * render_intent is raised. + * + * By default, a surface does not have an associated image description + * nor a rendering intent. The handling of color on such surfaces is + * compositor implementation defined. Compositors should handle such + * surfaces as sRGB but may handle them differently if they have specific + * requirements. + */ +static inline void +xx_color_management_surface_v4_set_image_description(struct xx_color_management_surface_v4 *xx_color_management_surface_v4, struct xx_image_description_v4 *image_description, uint32_t render_intent) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_surface_v4, + XX_COLOR_MANAGEMENT_SURFACE_V4_SET_IMAGE_DESCRIPTION, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4), 0, image_description, render_intent); +} + +/** + * @ingroup iface_xx_color_management_surface_v4 + * + * This request removes any image description from the surface. See + * set_image_description for how a compositor handles a surface without + * an image description. This is double-buffered state, see + * wl_surface.commit. + */ +static inline void +xx_color_management_surface_v4_unset_image_description(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_surface_v4, + XX_COLOR_MANAGEMENT_SURFACE_V4_UNSET_IMAGE_DESCRIPTION, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4), 0); +} + +#ifndef XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_ENUM +#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_ENUM +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + * protocol errors + */ +enum xx_color_management_feedback_surface_v4_error { + /** + * forbidden request on inert object + */ + XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_INERT = 0, +}; +#endif /* XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_ENUM */ + +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + * @struct xx_color_management_feedback_surface_v4_listener + */ +struct xx_color_management_feedback_surface_v4_listener { + /** + * the preferred image description changed + * + * The preferred image description is the one which likely has + * the most performance and/or quality benefits for the compositor + * if used by the client for its wl_surface contents. This event is + * sent whenever the compositor changes the wl_surface's preferred + * image description. + * + * This event is merely a notification. When the client wants to + * know what the preferred image description is, it shall use the + * get_preferred request. + * + * The preferred image description is not automatically used for + * anything. It is only a hint, and clients may set any valid image + * description with set_image_description but there might be + * performance and color accuracy improvements by providing the + * wl_surface contents in the preferred image description. + * Therefore clients that can, should render according to the + * preferred image description + */ + void (*preferred_changed)(void *data, + struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4); +}; + +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + */ +static inline int +xx_color_management_feedback_surface_v4_add_listener(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4, + const struct xx_color_management_feedback_surface_v4_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xx_color_management_feedback_surface_v4, + (void (**)(void)) listener, data); +} + +#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_DESTROY 0 +#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_GET_PREFERRED 1 + +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + */ +#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_PREFERRED_CHANGED_SINCE_VERSION 1 + +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + */ +#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + */ +#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_GET_PREFERRED_SINCE_VERSION 1 + +/** @ingroup iface_xx_color_management_feedback_surface_v4 */ +static inline void +xx_color_management_feedback_surface_v4_set_user_data(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_color_management_feedback_surface_v4, user_data); +} + +/** @ingroup iface_xx_color_management_feedback_surface_v4 */ +static inline void * +xx_color_management_feedback_surface_v4_get_user_data(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_color_management_feedback_surface_v4); +} + +static inline uint32_t +xx_color_management_feedback_surface_v4_get_version(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_color_management_feedback_surface_v4); +} + +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + * + * Destroy the xx_color_management_feedback_surface_v4 object. + */ +static inline void +xx_color_management_feedback_surface_v4_destroy(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_feedback_surface_v4, + XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_feedback_surface_v4), WL_MARSHAL_FLAG_DESTROY); +} + +/** + * @ingroup iface_xx_color_management_feedback_surface_v4 + * + * If this protocol object is inert, the protocol error inert is raised. + * + * The preferred image description represents the compositor's preferred + * color encoding for this wl_surface at the current time. There might be + * performance and power advantages, as well as improved color + * reproduction, if the image description of a content update matches the + * preferred image description. + * + * This creates a new xx_image_description_v4 object for the currently + * preferred image description for the wl_surface. The client should + * stop using and destroy the image descriptions created by earlier + * invocations of this request for the associated wl_surface. + * This request is usually sent as a reaction to the preferred_changed + * event or when creating a xx_color_management_feedback_surface_v4 object + * if the client is capable of adapting to image descriptions. + * + * The created xx_image_description_v4 object preserves the preferred image + * description of the wl_surface from the time the object was created. + * + * The resulting image description object allows get_information request. + * + * If the interface version is inadequate for the preferred image + * description, meaning that the client does not support all the + * events needed to deliver the crucial information, the resulting image + * description object shall immediately deliver the + * xx_image_description_v4.failed event with the low_version cause, + * otherwise the object shall immediately deliver the ready event. + */ +static inline struct xx_image_description_v4 * +xx_color_management_feedback_surface_v4_get_preferred(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) +{ + struct wl_proxy *image_description; + + image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_feedback_surface_v4, + XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_GET_PREFERRED, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_management_feedback_surface_v4), 0, NULL); + + return (struct xx_image_description_v4 *) image_description; +} + +#ifndef XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ENUM +#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ENUM +/** + * @ingroup iface_xx_image_description_creator_icc_v4 + * protocol errors + */ +enum xx_image_description_creator_icc_v4_error { + /** + * incomplete parameter set + */ + XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_INCOMPLETE_SET = 0, + /** + * property already set + */ + XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ALREADY_SET = 1, + /** + * fd not seekable and readable + */ + XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_BAD_FD = 2, + /** + * no or too much data + */ + XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_BAD_SIZE = 3, + /** + * offset + length exceeds file size + */ + XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_OUT_OF_FILE = 4, +}; +#endif /* XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ENUM */ + +#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_CREATE 0 +#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_SET_ICC_FILE 1 + + +/** + * @ingroup iface_xx_image_description_creator_icc_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_CREATE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_icc_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_SET_ICC_FILE_SINCE_VERSION 1 + +/** @ingroup iface_xx_image_description_creator_icc_v4 */ +static inline void +xx_image_description_creator_icc_v4_set_user_data(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_creator_icc_v4, user_data); +} + +/** @ingroup iface_xx_image_description_creator_icc_v4 */ +static inline void * +xx_image_description_creator_icc_v4_get_user_data(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_creator_icc_v4); +} + +static inline uint32_t +xx_image_description_creator_icc_v4_get_version(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_icc_v4); +} + +/** @ingroup iface_xx_image_description_creator_icc_v4 */ +static inline void +xx_image_description_creator_icc_v4_destroy(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) +{ + wl_proxy_destroy((struct wl_proxy *) xx_image_description_creator_icc_v4); +} + +/** + * @ingroup iface_xx_image_description_creator_icc_v4 + * + * Create an image description object based on the ICC information + * previously set on this object. A compositor must parse the ICC data in + * some undefined but finite amount of time. + * + * The completeness of the parameter set is verified. If the set is not + * complete, the protocol error incomplete_set is raised. For the + * definition of a complete set, see the description of this interface. + * + * If the particular combination of the information is not supported + * by the compositor, the resulting image description object shall + * immediately deliver the xx_image_description_v4.failed event with the + * 'unsupported' cause. If a valid image description was created from the + * information, the xx_image_description_v4.ready event will eventually + * be sent instead. + * + * This request destroys the xx_image_description_creator_icc_v4 object. + * + * The resulting image description object does not allow get_information + * request. + */ +static inline struct xx_image_description_v4 * +xx_image_description_creator_icc_v4_create(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) +{ + struct wl_proxy *image_description; + + image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_icc_v4, + XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_CREATE, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_icc_v4), WL_MARSHAL_FLAG_DESTROY, NULL); + + return (struct xx_image_description_v4 *) image_description; +} + +/** + * @ingroup iface_xx_image_description_creator_icc_v4 + * + * Sets the ICC profile file to be used as the basis of the image + * description. + * + * The data shall be found through the given fd at the given offset, having + * the given length. The fd must seekable and readable. Violating these + * requirements raises the bad_fd protocol error. + * + * If reading the data fails due to an error independent of the client, the + * compositor shall send the xx_image_description_v4.failed event on the + * created xx_image_description_v4 with the 'operating_system' cause. + * + * The maximum size of the ICC profile is 4 MB. If length is greater than + * that or zero, the protocol error bad_size is raised. If offset + length + * exceeds the file size, the protocol error out_of_file is raised. + * + * A compositor may read the file at any time starting from this request + * and only until whichever happens first: + * - If create request was issued, the xx_image_description_v4 object + * delivers either failed or ready event; or + * - if create request was not issued, this + * xx_image_description_creator_icc_v4 object is destroyed. + * + * A compositor shall not modify the contents of the file, and the fd may + * be sealed for writes and size changes. The client must ensure to its + * best ability that the data does not change while the compositor is + * reading it. + * + * The data must represent a valid ICC profile. The ICC profile version + * must be 2 or 4, it must be a 3 channel profile and the class must be + * Display or ColorSpace. Violating these requirements will not result in a + * protocol error but will eventually send the + * xx_image_description_v4.failed event on the created + * xx_image_description_v4 with the 'unsupported' cause. + * + * See the International Color Consortium specification ICC.1:2022 for more + * details about ICC profiles. + * + * If ICC file has already been set on this object, the protocol error + * already_set is raised. + */ +static inline void +xx_image_description_creator_icc_v4_set_icc_file(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4, int32_t icc_profile, uint32_t offset, uint32_t length) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_icc_v4, + XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_SET_ICC_FILE, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_icc_v4), 0, icc_profile, offset, length); +} + +#ifndef XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ENUM +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ENUM +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * protocol errors + */ +enum xx_image_description_creator_params_v4_error { + /** + * incomplete parameter set + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INCOMPLETE_SET = 0, + /** + * invalid combination of parameters + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INCONSISTENT_SET = 1, + /** + * property already set + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET = 2, + /** + * request not supported + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_UNSUPPORTED_FEATURE = 3, + /** + * invalid transfer characteristic + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_TF = 4, + /** + * invalid primaries or white point + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_PRIMARIES = 5, + /** + * invalid luminance value or range + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_LUMINANCE = 6, + /** + * invalid mastering information + */ + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_MASTERING = 7, +}; +#endif /* XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ENUM */ + +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_CREATE 0 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_NAMED 1 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_POWER 2 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_NAMED 3 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES 4 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_LUMINANCES 5 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_DISPLAY_PRIMARIES 6 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_LUMINANCE 7 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_CLL 8 +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_FALL 9 + + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_CREATE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_NAMED_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_POWER_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_NAMED_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_LUMINANCES_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_DISPLAY_PRIMARIES_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_LUMINANCE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_CLL_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_creator_params_v4 + */ +#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_FALL_SINCE_VERSION 1 + +/** @ingroup iface_xx_image_description_creator_params_v4 */ +static inline void +xx_image_description_creator_params_v4_set_user_data(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_creator_params_v4, user_data); +} + +/** @ingroup iface_xx_image_description_creator_params_v4 */ +static inline void * +xx_image_description_creator_params_v4_get_user_data(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_creator_params_v4); +} + +static inline uint32_t +xx_image_description_creator_params_v4_get_version(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4); +} + +/** @ingroup iface_xx_image_description_creator_params_v4 */ +static inline void +xx_image_description_creator_params_v4_destroy(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) +{ + wl_proxy_destroy((struct wl_proxy *) xx_image_description_creator_params_v4); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Create an image description object based on the parameters previously + * set on this object. + * + * The completeness of the parameter set is verified. If the set is not + * complete, the protocol error incomplete_set is raised. For the + * definition of a complete set, see the description of this interface. + * + * Also, the combination of the parameter set is verified. If the set is + * not consistent, the protocol error inconsistent_set is raised. + * + * If the particular combination of the parameter set is not supported + * by the compositor, the resulting image description object shall + * immediately deliver the xx_image_description_v4.failed event with the + * 'unsupported' cause. If a valid image description was created from the + * parameter set, the xx_image_description_v4.ready event will eventually + * be sent instead. + * + * This request destroys the xx_image_description_creator_params_v4 + * object. + * + * The resulting image description object does not allow get_information + * request. + */ +static inline struct xx_image_description_v4 * +xx_image_description_creator_params_v4_create(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) +{ + struct wl_proxy *image_description; + + image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_CREATE, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), WL_MARSHAL_FLAG_DESTROY, NULL); + + return (struct xx_image_description_v4 *) image_description; +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the transfer characteristic using explicitly enumerated named + * functions. + * + * When the resulting image description is attached to an image, the + * content should be encoded and decoded according to the industry standard + * practices for the transfer characteristic. + * + * Only names advertised with xx_color_manager_v4 event supported_tf_named + * are allowed. Other values shall raise the protocol error invalid_tf. + * + * If transfer characteristic has already been set on this object, the + * protocol error already_set is raised. + */ +static inline void +xx_image_description_creator_params_v4_set_tf_named(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t tf) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_NAMED, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, tf); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the color component transfer characteristic to a power curve with + * the given exponent. This curve represents the conversion from electrical + * to optical pixel or color values. + * + * When the resulting image description is attached to an image, the + * content should be encoded with the inverse of the power curve. + * + * The curve exponent shall be multiplied by 10000 to get the argument eexp + * value to carry the precision of 4 decimals. + * + * The curve exponent must be at least 1.0 and at most 10.0. Otherwise the + * protocol error invalid_tf is raised. + * + * If transfer characteristic has already been set on this object, the + * protocol error already_set is raised. + * + * This request can be used when the compositor advertises + * xx_color_manager_v4.feature.set_tf_power. Otherwise this request raises + * the protocol error unsupported_feature. + */ +static inline void +xx_image_description_creator_params_v4_set_tf_power(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t eexp) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_POWER, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, eexp); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the color primaries and white point using explicitly named sets. + * This describes the primary color volume which is the basis for color + * value encoding. + * + * Only names advertised with xx_color_manager_v4 event + * supported_primaries_named are allowed. Other values shall raise the + * protocol error invalid_primaries. + * + * If primaries have already been set on this object, the protocol error + * already_set is raised. + */ +static inline void +xx_image_description_creator_params_v4_set_primaries_named(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t primaries) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_NAMED, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, primaries); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the color primaries and white point using CIE 1931 xy chromaticity + * coordinates. This describes the primary color volume which is the basis + * for color value encoding. + * + * Each coordinate value is multiplied by 10000 to get the argument value + * to carry precision of 4 decimals. + * + * If primaries have already been set on this object, the protocol error + * already_set is raised. + * + * This request can be used if the compositor advertises + * xx_color_manager_v4.feature.set_primaries. Otherwise this request raises + * the protocol error unsupported_feature. + */ +static inline void +xx_image_description_creator_params_v4_set_primaries(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the primary color volume luminance range and the reference white + * luminance level. + * + * The default luminances are + * - primary color volume minimum: 0.2 cd/m² + * - primary color volume maximum: 80 cd/m² + * - reference white: 80 cd/m² + * + * Setting a named transfer characteristic can imply other default + * luminances. + * + * The default luminances get overwritten when this request is used. + * + * 'min_lum' and 'max_lum' specify the minimum and maximum luminances of + * the primary color volume as reproduced by the targeted display. + * + * 'reference_lum' specifies the luminance of the reference white as + * reproduced by the targeted display, and reflects the targeted viewing + * environment. + * + * Compositors should make sure that all content is anchored, meaning that + * an input signal level of 'reference_lum' on one image description and + * another input signal level of 'reference_lum' on another image + * description should produce the same output level, even though the + * 'reference_lum' on both image representations can be different. + * + * If 'max_lum' is less than the 'reference_lum', or 'reference_lum' is + * less than or equal to 'min_lum', the protocol error invalid_luminance is + * raised. + * + * The minimum luminance is multiplied by 10000 to get the argument + * 'min_lum' value and carries precision of 4 decimals. The maximum + * luminance and reference white luminance values are unscaled. + * + * If the primary color volume luminance range and the reference white + * luminance level have already been set on this object, the protocol error + * already_set is raised. + * + * This request can be used if the compositor advertises + * xx_color_manager_v4.feature.set_luminances. Otherwise this request + * raises the protocol error unsupported_feature. + */ +static inline void +xx_image_description_creator_params_v4_set_luminances(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_LUMINANCES, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, min_lum, max_lum, reference_lum); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Provides the color primaries and white point of the mastering display + * using CIE 1931 xy chromaticity coordinates. This is compatible with the + * SMPTE ST 2086 definition of HDR static metadata. + * + * The mastering display primaries define the target color volume. + * + * If mastering display primaries are not explicitly set, the target color + * volume is assumed to be equal to the primary color volume. + * + * The target color volume is defined by all tristimulus values between 0.0 + * and 1.0 (inclusive) of the color space defined by the given mastering + * display primaries and white point. The colorimetry is identical between + * the container color space and the mastering display color space, + * including that no chromatic adaptation is applied even if the white + * points differ. + * + * The target color volume can exceed the primary color volume to allow for + * a greater color volume with an existing color space definition (for + * example scRGB). It can be smaller than the primary color volume to + * minimize gamut and tone mapping distances for big color spaces (HDR + * metadata). + * + * To make use of the entire target color volume a suitable pixel format + * has to be chosen (e.g. floating point to exceed the primary color + * volume, or abusing limited quantization range as with xvYCC). + * + * Each coordinate value is multiplied by 10000 to get the argument value + * to carry precision of 4 decimals. + * + * If mastering display primaries have already been set on this object, the + * protocol error already_set is raised. + * + * This request can be used if the compositor advertises + * xx_color_manager_v4.feature.set_mastering_display_primaries. Otherwise + * this request raises the protocol error unsupported_feature. The + * advertisement implies support only for target color volumes fully + * contained within the primary color volume. + * + * If a compositor additionally supports target color volume exceeding the + * primary color volume, it must advertise + * xx_color_manager_v4.feature.extended_target_volume. If a client uses + * target color volume exceeding the primary color volume and the + * compositor does not support it, the result is implementation defined. + * Compositors are recommended to detect this case and fail the image + * description gracefully, but it may as well result in color artifacts. + */ +static inline void +xx_image_description_creator_params_v4_set_mastering_display_primaries(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_DISPLAY_PRIMARIES, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the luminance range that was used during the content mastering + * process as the minimum and maximum absolute luminance L. This is + * compatible with the SMPTE ST 2086 definition of HDR static metadata. + * + * The mastering luminance range is undefined by default. + * + * If max L is less than or equal to min L, the protocol error + * invalid_luminance is raised. + * + * Min L value is multiplied by 10000 to get the argument min_lum value + * and carry precision of 4 decimals. Max L value is unscaled for max_lum. + */ +static inline void +xx_image_description_creator_params_v4_set_mastering_luminance(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t min_lum, uint32_t max_lum) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_LUMINANCE, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, min_lum, max_lum); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the maximum content light level (max_cll) as defined by CTA-861-H. + * + * This can only be set when set_tf_cicp is used to set the transfer + * characteristic to Rec. ITU-R BT.2100-2 perceptual quantization system. + * Otherwise, 'create' request shall raise inconsistent_set protocol + * error. + * + * max_cll is undefined by default. + */ +static inline void +xx_image_description_creator_params_v4_set_max_cll(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t max_cll) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_CLL, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, max_cll); +} + +/** + * @ingroup iface_xx_image_description_creator_params_v4 + * + * Sets the maximum frame-average light level (max_fall) as defined by + * CTA-861-H. + * + * This can only be set when set_tf_cicp is used to set the transfer + * characteristic to Rec. ITU-R BT.2100-2 perceptual quantization system. + * Otherwise, 'create' request shall raise inconsistent_set protocol error. + * + * max_fall is undefined by default. + */ +static inline void +xx_image_description_creator_params_v4_set_max_fall(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t max_fall) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, + XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_FALL, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, max_fall); +} + +#ifndef XX_IMAGE_DESCRIPTION_V4_ERROR_ENUM +#define XX_IMAGE_DESCRIPTION_V4_ERROR_ENUM +/** + * @ingroup iface_xx_image_description_v4 + * protocol errors + */ +enum xx_image_description_v4_error { + /** + * attempted to use an object which is not ready + */ + XX_IMAGE_DESCRIPTION_V4_ERROR_NOT_READY = 0, + /** + * get_information not allowed + */ + XX_IMAGE_DESCRIPTION_V4_ERROR_NO_INFORMATION = 1, +}; +#endif /* XX_IMAGE_DESCRIPTION_V4_ERROR_ENUM */ + +#ifndef XX_IMAGE_DESCRIPTION_V4_CAUSE_ENUM +#define XX_IMAGE_DESCRIPTION_V4_CAUSE_ENUM +/** + * @ingroup iface_xx_image_description_v4 + * generic reason for failure + */ +enum xx_image_description_v4_cause { + /** + * interface version too low + */ + XX_IMAGE_DESCRIPTION_V4_CAUSE_LOW_VERSION = 0, + /** + * unsupported image description data + */ + XX_IMAGE_DESCRIPTION_V4_CAUSE_UNSUPPORTED = 1, + /** + * error independent of the client + */ + XX_IMAGE_DESCRIPTION_V4_CAUSE_OPERATING_SYSTEM = 2, + /** + * the relevant output no longer exists + */ + XX_IMAGE_DESCRIPTION_V4_CAUSE_NO_OUTPUT = 3, +}; +#endif /* XX_IMAGE_DESCRIPTION_V4_CAUSE_ENUM */ + +/** + * @ingroup iface_xx_image_description_v4 + * @struct xx_image_description_v4_listener + */ +struct xx_image_description_v4_listener { + /** + * graceful error on creating the image description + * + * If creating a xx_image_description_v4 object fails for a + * reason that is not defined as a protocol error, this event is + * sent. + * + * The requests that create image description objects define + * whether and when this can occur. Only such creation requests can + * trigger this event. This event cannot be triggered after the + * image description was successfully formed. + * + * Once this event has been sent, the xx_image_description_v4 + * object will never become ready and it can only be destroyed. + * @param cause generic reason + * @param msg ad hoc human-readable explanation + */ + void (*failed)(void *data, + struct xx_image_description_v4 *xx_image_description_v4, + uint32_t cause, + const char *msg); + /** + * indication that the object is ready to be used + * + * Once this event has been sent, the xx_image_description_v4 + * object is deemed "ready". Ready objects can be used to send + * requests and can be used through other interfaces. + * + * Every ready xx_image_description_v4 protocol object refers to an + * underlying image description record in the compositor. Multiple + * protocol objects may end up referring to the same record. + * Clients may identify these "copies" by comparing their id + * numbers: if the numbers from two protocol objects are identical, + * the protocol objects refer to the same image description record. + * Two different image description records cannot have the same id + * number simultaneously. The id number does not change during the + * lifetime of the image description record. + * + * The id number is valid only as long as the protocol object is + * alive. If all protocol objects referring to the same image + * description record are destroyed, the id number may be recycled + * for a different image description record. + * + * Image description id number is not a protocol object id. Zero is + * reserved as an invalid id number. It shall not be possible for a + * client to refer to an image description by its id number in + * protocol. The id numbers might not be portable between Wayland + * connections. + * + * This identity allows clients to de-duplicate image description + * records and avoid get_information request if they already have + * the image description information. + * @param identity image description id number + */ + void (*ready)(void *data, + struct xx_image_description_v4 *xx_image_description_v4, + uint32_t identity); +}; + +/** + * @ingroup iface_xx_image_description_v4 + */ +static inline int +xx_image_description_v4_add_listener(struct xx_image_description_v4 *xx_image_description_v4, + const struct xx_image_description_v4_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xx_image_description_v4, + (void (**)(void)) listener, data); +} + +#define XX_IMAGE_DESCRIPTION_V4_DESTROY 0 +#define XX_IMAGE_DESCRIPTION_V4_GET_INFORMATION 1 + +/** + * @ingroup iface_xx_image_description_v4 + */ +#define XX_IMAGE_DESCRIPTION_V4_FAILED_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_v4 + */ +#define XX_IMAGE_DESCRIPTION_V4_READY_SINCE_VERSION 1 + +/** + * @ingroup iface_xx_image_description_v4 + */ +#define XX_IMAGE_DESCRIPTION_V4_DESTROY_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_v4 + */ +#define XX_IMAGE_DESCRIPTION_V4_GET_INFORMATION_SINCE_VERSION 1 + +/** @ingroup iface_xx_image_description_v4 */ +static inline void +xx_image_description_v4_set_user_data(struct xx_image_description_v4 *xx_image_description_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_v4, user_data); +} + +/** @ingroup iface_xx_image_description_v4 */ +static inline void * +xx_image_description_v4_get_user_data(struct xx_image_description_v4 *xx_image_description_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_v4); +} + +static inline uint32_t +xx_image_description_v4_get_version(struct xx_image_description_v4 *xx_image_description_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_image_description_v4); +} + +/** + * @ingroup iface_xx_image_description_v4 + * + * Destroy this object. It is safe to destroy an object which is not ready. + * + * Destroying a xx_image_description_v4 object has no side-effects, not + * even if a xx_color_management_surface_v4.set_image_description has not + * yet been followed by a wl_surface.commit. + */ +static inline void +xx_image_description_v4_destroy(struct xx_image_description_v4 *xx_image_description_v4) +{ + wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_v4, + XX_IMAGE_DESCRIPTION_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_v4), WL_MARSHAL_FLAG_DESTROY); +} + +/** + * @ingroup iface_xx_image_description_v4 + * + * Creates a xx_image_description_info_v4 object which delivers the + * information that makes up the image description. + * + * Not all image description protocol objects allow get_information + * request. Whether it is allowed or not is defined by the request that + * created the object. If get_information is not allowed, the protocol + * error no_information is raised. + */ +static inline struct xx_image_description_info_v4 * +xx_image_description_v4_get_information(struct xx_image_description_v4 *xx_image_description_v4) +{ + struct wl_proxy *information; + + information = wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_v4, + XX_IMAGE_DESCRIPTION_V4_GET_INFORMATION, &xx_image_description_info_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_image_description_v4), 0, NULL); + + return (struct xx_image_description_info_v4 *) information; +} + +/** + * @ingroup iface_xx_image_description_info_v4 + * @struct xx_image_description_info_v4_listener + */ +struct xx_image_description_info_v4_listener { + /** + * end of information + * + * Signals the end of information events and destroys the object. + */ + void (*done)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4); + /** + * ICC profile matching the image description + * + * The icc argument provides a file descriptor to the client + * which may be memory-mapped to provide the ICC profile matching + * the image description. The fd is read-only, and if mapped then + * it must be mapped with MAP_PRIVATE by the client. + * + * The ICC profile version and other details are determined by the + * compositor. There is no provision for a client to ask for a + * specific kind of a profile. + * @param icc ICC profile file descriptor + * @param icc_size ICC profile size, in bytes + */ + void (*icc_file)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + int32_t icc, + uint32_t icc_size); + /** + * primaries as chromaticity coordinates + * + * Delivers the primary color volume primaries and white point + * using CIE 1931 xy chromaticity coordinates. + * + * Each coordinate value is multiplied by 10000 to get the argument + * value to carry precision of 4 decimals. + * @param r_x Red x * 10000 + * @param r_y Red y * 10000 + * @param g_x Green x * 10000 + * @param g_y Green y * 10000 + * @param b_x Blue x * 10000 + * @param b_y Blue y * 10000 + * @param w_x White x * 10000 + * @param w_y White y * 10000 + */ + void (*primaries)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + int32_t r_x, + int32_t r_y, + int32_t g_x, + int32_t g_y, + int32_t b_x, + int32_t b_y, + int32_t w_x, + int32_t w_y); + /** + * named primaries + * + * Delivers the primary color volume primaries and white point + * using an explicitly enumerated named set. + * @param primaries named primaries + */ + void (*primaries_named)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + uint32_t primaries); + /** + * transfer characteristic as a power curve + * + * The color component transfer characteristic of this image + * description is a pure power curve. This event provides the + * exponent of the power function. This curve represents the + * conversion from electrical to optical pixel or color values. + * + * The curve exponent has been multiplied by 10000 to get the + * argument eexp value to carry the precision of 4 decimals. + * @param eexp the exponent * 10000 + */ + void (*tf_power)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + uint32_t eexp); + /** + * named transfer characteristic + * + * Delivers the transfer characteristic using an explicitly + * enumerated named function. + * @param tf named transfer function + */ + void (*tf_named)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + uint32_t tf); + /** + * primary color volume luminance range and reference white + * + * Delivers the primary color volume luminance range and the + * reference white luminance level. + * + * The minimum luminance is multiplied by 10000 to get the argument + * 'min_lum' value and carries precision of 4 decimals. The maximum + * luminance and reference white luminance values are unscaled. + * @param min_lum minimum luminance (cd/m²) * 10000 + * @param max_lum maximum luminance (cd/m²) + * @param reference_lum reference white luminance (cd/m²) + */ + void (*luminances)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + uint32_t min_lum, + uint32_t max_lum, + uint32_t reference_lum); + /** + * target primaries as chromaticity coordinates + * + * Provides the color primaries and white point of the target + * color volume using CIE 1931 xy chromaticity coordinates. This is + * compatible with the SMPTE ST 2086 definition of HDR static + * metadata for mastering displays. + * + * While primary color volume is about how color is encoded, the + * target color volume is the actually displayable color volume. If + * target color volume is equal to the primary color volume, then + * this event is not sent. + * + * Each coordinate value is multiplied by 10000 to get the argument + * value to carry precision of 4 decimals. + * @param r_x Red x * 10000 + * @param r_y Red y * 10000 + * @param g_x Green x * 10000 + * @param g_y Green y * 10000 + * @param b_x Blue x * 10000 + * @param b_y Blue y * 10000 + * @param w_x White x * 10000 + * @param w_y White y * 10000 + */ + void (*target_primaries)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + int32_t r_x, + int32_t r_y, + int32_t g_x, + int32_t g_y, + int32_t b_x, + int32_t b_y, + int32_t w_x, + int32_t w_y); + /** + * target luminance range + * + * Provides the luminance range that the image description is + * targeting as the minimum and maximum absolute luminance L. This + * is compatible with the SMPTE ST 2086 definition of HDR static + * metadata. + * + * This luminance range is only theoretical and may not correspond + * to the luminance of light emitted on an actual display. + * + * Min L value is multiplied by 10000 to get the argument min_lum + * value and carry precision of 4 decimals. Max L value is unscaled + * for max_lum. + * @param min_lum min L (cd/m²) * 10000 + * @param max_lum max L (cd/m²) + */ + void (*target_luminance)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + uint32_t min_lum, + uint32_t max_lum); + /** + * target maximum content light level + * + * Provides the targeted max_cll of the image description. + * max_cll is defined by CTA-861-H. + * + * This luminance is only theoretical and may not correspond to the + * luminance of light emitted on an actual display. + * @param max_cll Maximum content light-level (cd/m²) + */ + void (*target_max_cll)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + uint32_t max_cll); + /** + * target maximum frame-average light level + * + * Provides the targeted max_fall of the image description. + * max_fall is defined by CTA-861-H. + * + * This luminance is only theoretical and may not correspond to the + * luminance of light emitted on an actual display. + * @param max_fall Maximum frame-average light level (cd/m²) + */ + void (*target_max_fall)(void *data, + struct xx_image_description_info_v4 *xx_image_description_info_v4, + uint32_t max_fall); +}; + +/** + * @ingroup iface_xx_image_description_info_v4 + */ +static inline int +xx_image_description_info_v4_add_listener(struct xx_image_description_info_v4 *xx_image_description_info_v4, + const struct xx_image_description_info_v4_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) xx_image_description_info_v4, + (void (**)(void)) listener, data); +} + +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_DONE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_ICC_FILE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_PRIMARIES_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_PRIMARIES_NAMED_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_TF_POWER_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_TF_NAMED_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_LUMINANCES_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_PRIMARIES_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_LUMINANCE_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_MAX_CLL_SINCE_VERSION 1 +/** + * @ingroup iface_xx_image_description_info_v4 + */ +#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_MAX_FALL_SINCE_VERSION 1 + + +/** @ingroup iface_xx_image_description_info_v4 */ +static inline void +xx_image_description_info_v4_set_user_data(struct xx_image_description_info_v4 *xx_image_description_info_v4, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_info_v4, user_data); +} + +/** @ingroup iface_xx_image_description_info_v4 */ +static inline void * +xx_image_description_info_v4_get_user_data(struct xx_image_description_info_v4 *xx_image_description_info_v4) +{ + return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_info_v4); +} + +static inline uint32_t +xx_image_description_info_v4_get_version(struct xx_image_description_info_v4 *xx_image_description_info_v4) +{ + return wl_proxy_get_version((struct wl_proxy *) xx_image_description_info_v4); +} + +/** @ingroup iface_xx_image_description_info_v4 */ +static inline void +xx_image_description_info_v4_destroy(struct xx_image_description_info_v4 *xx_image_description_info_v4) +{ + wl_proxy_destroy((struct wl_proxy *) xx_image_description_info_v4); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c b/src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c new file mode 100644 index 000000000..ff768a342 --- /dev/null +++ b/src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c @@ -0,0 +1,199 @@ +/* Generated by wayland-scanner 1.23.1 */ + +/* + * Copyright 2019 Sebastian Wick + * Copyright 2019 Erwin Burema + * Copyright 2020 AMD + * Copyright 2020-2024 Collabora, Ltd. + * Copyright 2024 Xaver Hugl + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +extern const struct wl_interface wl_output_interface; +extern const struct wl_interface wl_surface_interface; +extern const struct wl_interface xx_color_management_feedback_surface_v4_interface; +extern const struct wl_interface xx_color_management_output_v4_interface; +extern const struct wl_interface xx_color_management_surface_v4_interface; +extern const struct wl_interface xx_image_description_creator_icc_v4_interface; +extern const struct wl_interface xx_image_description_creator_params_v4_interface; +extern const struct wl_interface xx_image_description_info_v4_interface; +extern const struct wl_interface xx_image_description_v4_interface; + +static const struct wl_interface *color_management_v1_types[] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + &xx_color_management_output_v4_interface, + NULL, // &wl_output_interface, + &xx_color_management_surface_v4_interface, + NULL, // &wl_surface_interface, + &xx_color_management_feedback_surface_v4_interface, + NULL, //&wl_surface_interface, + &xx_image_description_creator_icc_v4_interface, + &xx_image_description_creator_params_v4_interface, + &xx_image_description_v4_interface, + &xx_image_description_v4_interface, + NULL, + &xx_image_description_v4_interface, + &xx_image_description_v4_interface, + &xx_image_description_v4_interface, + &xx_image_description_info_v4_interface, +}; + +static const struct wl_message xx_color_manager_v4_requests[] = { + { "destroy", "", color_management_v1_types + 0 }, + { "get_output", "no", color_management_v1_types + 8 }, + { "get_surface", "no", color_management_v1_types + 10 }, + { "get_feedback_surface", "no", color_management_v1_types + 12 }, + { "new_icc_creator", "n", color_management_v1_types + 14 }, + { "new_parametric_creator", "n", color_management_v1_types + 15 }, +}; + +static const struct wl_message xx_color_manager_v4_events[] = { + { "supported_intent", "u", color_management_v1_types + 0 }, + { "supported_feature", "u", color_management_v1_types + 0 }, + { "supported_tf_named", "u", color_management_v1_types + 0 }, + { "supported_primaries_named", "u", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_color_manager_v4_interface = { + "xx_color_manager_v4", 1, + 6, xx_color_manager_v4_requests, + 4, xx_color_manager_v4_events, +}; + +static const struct wl_message xx_color_management_output_v4_requests[] = { + { "destroy", "", color_management_v1_types + 0 }, + { "get_image_description", "n", color_management_v1_types + 16 }, +}; + +static const struct wl_message xx_color_management_output_v4_events[] = { + { "image_description_changed", "", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_color_management_output_v4_interface = { + "xx_color_management_output_v4", 1, + 2, xx_color_management_output_v4_requests, + 1, xx_color_management_output_v4_events, +}; + +static const struct wl_message xx_color_management_surface_v4_requests[] = { + { "destroy", "", color_management_v1_types + 0 }, + { "set_image_description", "ou", color_management_v1_types + 17 }, + { "unset_image_description", "", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_color_management_surface_v4_interface = { + "xx_color_management_surface_v4", 1, + 3, xx_color_management_surface_v4_requests, + 0, NULL, +}; + +static const struct wl_message xx_color_management_feedback_surface_v4_requests[] = { + { "destroy", "", color_management_v1_types + 0 }, + { "get_preferred", "n", color_management_v1_types + 19 }, +}; + +static const struct wl_message xx_color_management_feedback_surface_v4_events[] = { + { "preferred_changed", "", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_color_management_feedback_surface_v4_interface = { + "xx_color_management_feedback_surface_v4", 1, + 2, xx_color_management_feedback_surface_v4_requests, + 1, xx_color_management_feedback_surface_v4_events, +}; + +static const struct wl_message xx_image_description_creator_icc_v4_requests[] = { + { "create", "n", color_management_v1_types + 20 }, + { "set_icc_file", "huu", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_image_description_creator_icc_v4_interface = { + "xx_image_description_creator_icc_v4", 1, + 2, xx_image_description_creator_icc_v4_requests, + 0, NULL, +}; + +static const struct wl_message xx_image_description_creator_params_v4_requests[] = { + { "create", "n", color_management_v1_types + 21 }, + { "set_tf_named", "u", color_management_v1_types + 0 }, + { "set_tf_power", "u", color_management_v1_types + 0 }, + { "set_primaries_named", "u", color_management_v1_types + 0 }, + { "set_primaries", "iiiiiiii", color_management_v1_types + 0 }, + { "set_luminances", "uuu", color_management_v1_types + 0 }, + { "set_mastering_display_primaries", "iiiiiiii", color_management_v1_types + 0 }, + { "set_mastering_luminance", "uu", color_management_v1_types + 0 }, + { "set_max_cll", "u", color_management_v1_types + 0 }, + { "set_max_fall", "u", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_image_description_creator_params_v4_interface = { + "xx_image_description_creator_params_v4", 1, + 10, xx_image_description_creator_params_v4_requests, + 0, NULL, +}; + +static const struct wl_message xx_image_description_v4_requests[] = { + { "destroy", "", color_management_v1_types + 0 }, + { "get_information", "n", color_management_v1_types + 22 }, +}; + +static const struct wl_message xx_image_description_v4_events[] = { + { "failed", "us", color_management_v1_types + 0 }, + { "ready", "u", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_image_description_v4_interface = { + "xx_image_description_v4", 1, + 2, xx_image_description_v4_requests, + 2, xx_image_description_v4_events, +}; + +static const struct wl_message xx_image_description_info_v4_events[] = { + { "done", "", color_management_v1_types + 0 }, + { "icc_file", "hu", color_management_v1_types + 0 }, + { "primaries", "iiiiiiii", color_management_v1_types + 0 }, + { "primaries_named", "u", color_management_v1_types + 0 }, + { "tf_power", "u", color_management_v1_types + 0 }, + { "tf_named", "u", color_management_v1_types + 0 }, + { "luminances", "uuu", color_management_v1_types + 0 }, + { "target_primaries", "iiiiiiii", color_management_v1_types + 0 }, + { "target_luminance", "uu", color_management_v1_types + 0 }, + { "target_max_cll", "u", color_management_v1_types + 0 }, + { "target_max_fall", "u", color_management_v1_types + 0 }, +}; + +WL_EXPORT const struct wl_interface xx_image_description_info_v4_interface = { + "xx_image_description_info_v4", 1, + 0, NULL, + 11, xx_image_description_info_v4_events, +}; From 878e516880f00cddf4186931c7dc06007f222a44 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sun, 12 Jan 2025 11:23:42 +0800 Subject: [PATCH 08/19] DisplayServer (Linux): upgrade wayland protocol `kde-output-device-v2` Ref: #1504 --- .../kde-output-device-v2-client-protocol.h | 179 ++++++++++++------ .../wayland/kde-output-device-v2-protocol.c | 9 +- .../displayserver/linux/wayland/kde-output.c | 2 + 3 files changed, 134 insertions(+), 56 deletions(-) diff --git a/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h b/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h index 6e585d281..34f5c66ac 100644 --- a/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h +++ b/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h @@ -1,11 +1,11 @@ -/* Generated by wayland-scanner 1.22.0 */ +/* Generated by wayland-scanner 1.23.1 */ #ifndef KDE_OUTPUT_DEVICE_V2_CLIENT_PROTOCOL_H #define KDE_OUTPUT_DEVICE_V2_CLIENT_PROTOCOL_H #include #include -#include +#include "wayland-client.h" #ifdef __cplusplus extern "C" { @@ -53,6 +53,11 @@ struct kde_output_device_v2; * This object is published as global during start up for every available * display devices, or when one later becomes available, for example by * being hotplugged via a physical connector. + * + * Warning! The protocol described in this file is a desktop environment + * implementation detail. Regular clients must not use this protocol. + * Backward incompatible changes may be added without bumping the major + * version of the extension. * @section page_iface_kde_output_device_v2_api API * See @ref iface_kde_output_device_v2. */ @@ -75,6 +80,11 @@ struct kde_output_device_v2; * This object is published as global during start up for every available * display devices, or when one later becomes available, for example by * being hotplugged via a physical connector. + * + * Warning! The protocol described in this file is a desktop environment + * implementation detail. Regular clients must not use this protocol. + * Backward incompatible changes may be added without bumping the major + * version of the extension. */ extern const struct wl_interface kde_output_device_v2_interface; #endif @@ -199,6 +209,11 @@ enum kde_output_device_v2_capability { * @since 5 */ KDE_OUTPUT_DEVICE_V2_CAPABILITY_ICC_PROFILE = 0x40, + /** + * if this outputdevice supports the brightness setting + * @since 9 + */ + KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS = 0x80, }; /** * @ingroup iface_kde_output_device_v2 @@ -216,6 +231,10 @@ enum kde_output_device_v2_capability { * @ingroup iface_kde_output_device_v2 */ #define KDE_OUTPUT_DEVICE_V2_CAPABILITY_ICC_PROFILE_SINCE_VERSION 5 +/** + * @ingroup iface_kde_output_device_v2 + */ +#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS_SINCE_VERSION 9 #endif /* KDE_OUTPUT_DEVICE_V2_CAPABILITY_ENUM */ #ifndef KDE_OUTPUT_DEVICE_V2_VRR_POLICY_ENUM @@ -274,6 +293,29 @@ enum kde_output_device_v2_color_profile_source { }; #endif /* KDE_OUTPUT_DEVICE_V2_COLOR_PROFILE_SOURCE_ENUM */ +#ifndef KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM +#define KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM +/** + * @ingroup iface_kde_output_device_v2 + * tradeoff between power and accuracy + * + * The compositor can do a lot of things that trade between + * performance, power and color accuracy. This setting describes + * a high level preference from the user about in which direction + * that tradeoff should be made. + */ +enum kde_output_device_v2_color_power_tradeoff { + /** + * prefer efficiency and performance + */ + KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_EFFICIENCY = 0, + /** + * prefer accuracy + */ + KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ACCURACY = 1, +}; +#endif /* KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM */ + /** * @ingroup iface_kde_output_device_v2 * @struct kde_output_device_v2_listener @@ -514,7 +556,7 @@ struct kde_output_device_v2_listener { /** * describes when auto rotate is used * - * + * * @since 4 */ void (*auto_rotate_policy)(void *data, @@ -523,7 +565,7 @@ struct kde_output_device_v2_listener { /** * describes when auto rotate is used * - * + * * @since 5 */ void (*icc_profile_path)(void *data, @@ -532,7 +574,7 @@ struct kde_output_device_v2_listener { /** * metadata about the screen's brightness limits * - * + * * @param max_peak_brightness in nits * @param max_frame_average_brightness in nits * @param min_brightness in 0.0001 nits @@ -546,7 +588,7 @@ struct kde_output_device_v2_listener { /** * overrides for the screen's brightness limits * - * + * * @param max_peak_brightness -1 for no override, positive values are the brightness in nits * @param max_average_brightness -1 for no override, positive values are the brightness in nits * @param min_brightness -1 for no override, positive values are the brightness in 0.0001 nits @@ -572,7 +614,7 @@ struct kde_output_device_v2_listener { /** * describes which source the compositor uses for the color profile on an output * - * + * * @since 7 */ void (*color_profile_source)(void *data, @@ -593,6 +635,29 @@ struct kde_output_device_v2_listener { void (*brightness)(void *data, struct kde_output_device_v2 *kde_output_device_v2, uint32_t brightness); + /** + * the preferred color/power tradeoff + * + * + * @since 10 + */ + void (*color_power_tradeoff)(void *data, + struct kde_output_device_v2 *kde_output_device_v2, + uint32_t preference); + /** + * dimming multiplier + * + * This is the dimming multiplier of the output. This is similar + * to the brightness setting, except it's meant to be a temporary + * setting only, not persistent and may be implemented differently + * depending on the display. 0 is the minimum dimming factor (not + * completely dark) and 10000 means the output is not dimmed. + * @param multiplier multiplier in 0-10000 + * @since 11 + */ + void (*dimming)(void *data, + struct kde_output_device_v2 *kde_output_device_v2, + uint32_t multiplier); }; /** @@ -706,34 +771,42 @@ kde_output_device_v2_add_listener(struct kde_output_device_v2 *kde_output_device * @ingroup iface_kde_output_device_v2 */ #define KDE_OUTPUT_DEVICE_V2_BRIGHTNESS_SINCE_VERSION 8 +/** + * @ingroup iface_kde_output_device_v2 + */ +#define KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_SINCE_VERSION 10 +/** + * @ingroup iface_kde_output_device_v2 + */ +#define KDE_OUTPUT_DEVICE_V2_DIMMING_SINCE_VERSION 11 -// /** @ingroup iface_kde_output_device_v2 */ -// static inline void -// kde_output_device_v2_set_user_data(struct kde_output_device_v2 *kde_output_device_v2, void *user_data) -// { -// wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_v2, user_data); -// } +/** @ingroup iface_kde_output_device_v2 */ +static inline void +kde_output_device_v2_set_user_data(struct kde_output_device_v2 *kde_output_device_v2, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_v2, user_data); +} -// /** @ingroup iface_kde_output_device_v2 */ -// static inline void * -// kde_output_device_v2_get_user_data(struct kde_output_device_v2 *kde_output_device_v2) -// { -// return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_v2); -// } +/** @ingroup iface_kde_output_device_v2 */ +static inline void * +kde_output_device_v2_get_user_data(struct kde_output_device_v2 *kde_output_device_v2) +{ + return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_v2); +} -// static inline uint32_t -// kde_output_device_v2_get_version(struct kde_output_device_v2 *kde_output_device_v2) -// { -// return wl_proxy_get_version((struct wl_proxy *) kde_output_device_v2); -// } +static inline uint32_t +kde_output_device_v2_get_version(struct kde_output_device_v2 *kde_output_device_v2) +{ + return wl_proxy_get_version((struct wl_proxy *) kde_output_device_v2); +} -// /** @ingroup iface_kde_output_device_v2 */ -// static inline void -// kde_output_device_v2_destroy(struct kde_output_device_v2 *kde_output_device_v2) -// { -// wl_proxy_destroy((struct wl_proxy *) kde_output_device_v2); -// } +/** @ingroup iface_kde_output_device_v2 */ +static inline void +kde_output_device_v2_destroy(struct kde_output_device_v2 *kde_output_device_v2) +{ + wl_proxy_destroy((struct wl_proxy *) kde_output_device_v2); +} /** * @ingroup iface_kde_output_device_mode_v2 @@ -811,32 +884,32 @@ kde_output_device_mode_v2_add_listener(struct kde_output_device_mode_v2 *kde_out #define KDE_OUTPUT_DEVICE_MODE_V2_REMOVED_SINCE_VERSION 1 -// /** @ingroup iface_kde_output_device_mode_v2 */ -// static inline void -// kde_output_device_mode_v2_set_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2, void *user_data) -// { -// wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_mode_v2, user_data); -// } +/** @ingroup iface_kde_output_device_mode_v2 */ +static inline void +kde_output_device_mode_v2_set_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_mode_v2, user_data); +} -// /** @ingroup iface_kde_output_device_mode_v2 */ -// static inline void * -// kde_output_device_mode_v2_get_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2) -// { -// return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_mode_v2); -// } +/** @ingroup iface_kde_output_device_mode_v2 */ +static inline void * +kde_output_device_mode_v2_get_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2) +{ + return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_mode_v2); +} -// static inline uint32_t -// kde_output_device_mode_v2_get_version(struct kde_output_device_mode_v2 *kde_output_device_mode_v2) -// { -// return wl_proxy_get_version((struct wl_proxy *) kde_output_device_mode_v2); -// } +static inline uint32_t +kde_output_device_mode_v2_get_version(struct kde_output_device_mode_v2 *kde_output_device_mode_v2) +{ + return wl_proxy_get_version((struct wl_proxy *) kde_output_device_mode_v2); +} -// /** @ingroup iface_kde_output_device_mode_v2 */ -// static inline void -// kde_output_device_mode_v2_destroy(struct kde_output_device_mode_v2 *kde_output_device_mode_v2) -// { -// wl_proxy_destroy((struct wl_proxy *) kde_output_device_mode_v2); -// } +/** @ingroup iface_kde_output_device_mode_v2 */ +static inline void +kde_output_device_mode_v2_destroy(struct kde_output_device_mode_v2 *kde_output_device_mode_v2) +{ + wl_proxy_destroy((struct wl_proxy *) kde_output_device_mode_v2); +} #ifdef __cplusplus } diff --git a/src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c b/src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c index 885962e5b..aaf23a473 100644 --- a/src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c +++ b/src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c @@ -1,6 +1,6 @@ #ifdef FF_HAVE_WAYLAND -/* Generated by wayland-scanner 1.22.0 */ +/* Generated by wayland-scanner 1.23.1 */ /* * SPDX-FileCopyrightText: 2008-2011 Kristian Høgsberg @@ -12,6 +12,7 @@ * SPDX-License-Identifier: MIT-CMU */ +#include #include #include #include @@ -57,12 +58,14 @@ static const struct wl_message kde_output_device_v2_events[] = { { "sdr_gamut_wideness", "6u", kde_output_device_v2_types + 0 }, { "color_profile_source", "7u", kde_output_device_v2_types + 0 }, { "brightness", "8u", kde_output_device_v2_types + 0 }, + { "color_power_tradeoff", "10u", kde_output_device_v2_types + 0 }, + { "dimming", "11u", kde_output_device_v2_types + 0 }, }; WL_EXPORT const struct wl_interface kde_output_device_v2_interface = { - "kde_output_device_v2", 8, + "kde_output_device_v2", 11, 0, NULL, - 25, kde_output_device_v2_events, + 27, kde_output_device_v2_events, }; static const struct wl_message kde_output_device_mode_v2_events[] = { diff --git a/src/detection/displayserver/linux/wayland/kde-output.c b/src/detection/displayserver/linux/wayland/kde-output.c index a47548ea4..4f7d8ece1 100644 --- a/src/detection/displayserver/linux/wayland/kde-output.c +++ b/src/detection/displayserver/linux/wayland/kde-output.c @@ -163,6 +163,8 @@ static struct kde_output_device_v2_listener outputListener = { .sdr_gamut_wideness = (void*) stubListener, .color_profile_source = (void*) stubListener, .brightness = (void*) stubListener, + .color_power_tradeoff = (void*) stubListener, + .dimming = (void*) stubListener, }; void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) From b340d4e149800c0f1b7246d17f433019b7e734c6 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sun, 12 Jan 2025 11:53:35 +0800 Subject: [PATCH 09/19] CI: fix build --- CMakeLists.txt | 2 - src/detection/cpu/cpu_bsd.c | 7 +- .../linux/wayland/color-manager.c | 114 - .../kde-output-device-v2-client-protocol.h | 14 +- .../displayserver/linux/wayland/wayland.c | 5 - .../displayserver/linux/wayland/wayland.h | 1 - .../xx-color-management-v4-client-protocol.h | 2447 ----------------- .../wayland/xx-color-management-v4-protocol.c | 199 -- 8 files changed, 12 insertions(+), 2777 deletions(-) delete mode 100644 src/detection/displayserver/linux/wayland/color-manager.c delete mode 100644 src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h delete mode 100644 src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 3159adc66..d524a7ada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -491,12 +491,10 @@ if(LINUX) src/detection/displayserver/linux/wayland/global-output.c src/detection/displayserver/linux/wayland/zwlr-output.c src/detection/displayserver/linux/wayland/kde-output.c - src/detection/displayserver/linux/wayland/color-manager.c src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c src/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.c src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c - src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c src/detection/displayserver/linux/wmde.c src/detection/displayserver/linux/xcb.c src/detection/displayserver/linux/xlib.c diff --git a/src/detection/cpu/cpu_bsd.c b/src/detection/cpu/cpu_bsd.c index 0ba110d0d..a2ce3e5a8 100644 --- a/src/detection/cpu/cpu_bsd.c +++ b/src/detection/cpu/cpu_bsd.c @@ -2,7 +2,10 @@ #include "common/sysctl.h" #include -#include +#if __has_include() + #include + #define FF_HAVE_CPUSET 1 +#endif static const char* detectCpuTemp(double* current) { @@ -63,7 +66,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) } } -#if __x86_64__ || __i386__ +#if FF_HAVE_CPUSET && (__x86_64__ || __i386__) // Bind current process to the first two cores, which is *usually* a performance core cpuset_t currentCPU; CPU_ZERO(¤tCPU); diff --git a/src/detection/displayserver/linux/wayland/color-manager.c b/src/detection/displayserver/linux/wayland/color-manager.c deleted file mode 100644 index 32e202a49..000000000 --- a/src/detection/displayserver/linux/wayland/color-manager.c +++ /dev/null @@ -1,114 +0,0 @@ -#include "wayland.h" -#include "xx-color-management-v4-client-protocol.h" - -static void waylandSupportedPrimariesNamed(void* data, FF_MAYBE_UNUSED struct xx_color_manager_v4* manager, uint32_t primaries) -{ - WaylandData* wldata = data; - switch (primaries) - { - case XX_COLOR_MANAGER_V4_PRIMARIES_SRGB: - printf("Supported named primaries: SRGB\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M: - printf("Supported named primaries: PAL-M\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_PAL: - printf("Supported named primaries: PAL\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_NTSC: - printf("Supported named primaries: NTSC\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_GENERIC_FILM: - printf("Supported named primaries: Generic Film\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_BT2020: - printf("Supported named primaries: BT2020\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_CIE1931_XYZ: - printf("Supported named primaries: CIE1931 XYZ\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_DCI_P3: - printf("Supported named primaries: DCI-P3\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_DISPLAY_P3: - printf("Supported named primaries: Display P3\n"); - break; - case XX_COLOR_MANAGER_V4_PRIMARIES_ADOBE_RGB: - printf("Supported named primaries: Adobe RGB\n"); - break; - default: - printf("Supported named primaries: Unknown\n"); - break; - } -} - -static void waylandSupportedTfNamed(void* data, FF_MAYBE_UNUSED struct xx_color_manager_v4* manager, uint32_t tf) -{ - WaylandData* wldata = data; - switch (tf) - { - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709: - printf("Supported named transfer function: BT709\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22: - printf("Supported named transfer function: Gamma 2.2\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28: - printf("Supported named transfer function: Gamma 2.8\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST240: - printf("Supported named transfer function: ST240\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR: - printf("Supported named transfer function: Linear\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_100: - printf("Supported named transfer function: Log 100\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_316: - printf("Supported named transfer function: Log 316\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_XVYCC: - printf("Supported named transfer function: XVYCC\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT1361: - printf("Supported named transfer function: BT1361\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB: - printf("Supported named transfer function: SRGB\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_EXT_SRGB: - printf("Supported named transfer function: Extended SRGB\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ: - printf("Supported named transfer function: ST2084 PQ\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST428: - printf("Supported named transfer function: ST428\n"); - break; - case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_HLG: - printf("Supported named transfer function: HLG\n"); - break; - default: - printf("Supported named transfer function: Unknown\n"); - break; - } -} - -void ffWaylandHandleColorManager(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) -{ - struct wl_proxy* output = wldata->ffwl_proxy_marshal_constructor_versioned((struct wl_proxy*) registry, WL_REGISTRY_BIND, &xx_color_manager_v4_interface, version, name, xx_color_manager_v4_interface.name, version, NULL); - if(output == NULL) - return; - - struct xx_color_manager_v4_listener managerListener = { - .supported_feature = (void*) stubListener, - .supported_intent = (void*) stubListener, - .supported_primaries_named = waylandSupportedPrimariesNamed, - .supported_tf_named = waylandSupportedTfNamed, - }; - - wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &managerListener, wldata); - wldata->ffwl_display_roundtrip(wldata->display); - wldata->ffwl_proxy_destroy(output); -} diff --git a/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h b/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h index 34f5c66ac..b220a2e98 100644 --- a/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h +++ b/src/detection/displayserver/linux/wayland/kde-output-device-v2-client-protocol.h @@ -5,7 +5,7 @@ #include #include -#include "wayland-client.h" +#include #ifdef __cplusplus extern "C" { @@ -556,7 +556,7 @@ struct kde_output_device_v2_listener { /** * describes when auto rotate is used * - * + * * @since 4 */ void (*auto_rotate_policy)(void *data, @@ -565,7 +565,7 @@ struct kde_output_device_v2_listener { /** * describes when auto rotate is used * - * + * * @since 5 */ void (*icc_profile_path)(void *data, @@ -574,7 +574,7 @@ struct kde_output_device_v2_listener { /** * metadata about the screen's brightness limits * - * + * * @param max_peak_brightness in nits * @param max_frame_average_brightness in nits * @param min_brightness in 0.0001 nits @@ -588,7 +588,7 @@ struct kde_output_device_v2_listener { /** * overrides for the screen's brightness limits * - * + * * @param max_peak_brightness -1 for no override, positive values are the brightness in nits * @param max_average_brightness -1 for no override, positive values are the brightness in nits * @param min_brightness -1 for no override, positive values are the brightness in 0.0001 nits @@ -614,7 +614,7 @@ struct kde_output_device_v2_listener { /** * describes which source the compositor uses for the color profile on an output * - * + * * @since 7 */ void (*color_profile_source)(void *data, @@ -638,7 +638,7 @@ struct kde_output_device_v2_listener { /** * the preferred color/power tradeoff * - * + * * @since 10 */ void (*color_power_tradeoff)(void *data, diff --git a/src/detection/displayserver/linux/wayland/wayland.c b/src/detection/displayserver/linux/wayland/wayland.c index dfdb41bd5..d19e3733c 100644 --- a/src/detection/displayserver/linux/wayland/wayland.c +++ b/src/detection/displayserver/linux/wayland/wayland.c @@ -17,7 +17,6 @@ #include "kde-output-device-v2-client-protocol.h" #include "kde-output-order-v1-client-protocol.h" #include "xdg-output-unstable-v1-client-protocol.h" -#include "xx-color-management-v4-client-protocol.h" #if __FreeBSD__ #include @@ -97,10 +96,6 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u { ffWaylandHandleKdeOutputOrder(wldata, registry, name, version); } - // else if(ffStrEquals(interface, xx_color_manager_v4_interface.name)) - // { - // ffWaylandHandleColorManager(wldata, registry, name, version); - // } else if((wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_GLOBAL || wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_NONE) && ffStrEquals(interface, zxdg_output_manager_v1_interface.name)) { ffWaylandHandleZxdgOutput(wldata, registry, name, version); diff --git a/src/detection/displayserver/linux/wayland/wayland.h b/src/detection/displayserver/linux/wayland/wayland.h index 224f53a52..ab11d0538 100644 --- a/src/detection/displayserver/linux/wayland/wayland.h +++ b/src/detection/displayserver/linux/wayland/wayland.h @@ -84,6 +84,5 @@ void ffWaylandHandleZwlrOutput(WaylandData* wldata, struct wl_registry* registry void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); void ffWaylandHandleKdeOutputOrder(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); void ffWaylandHandleZxdgOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); -void ffWaylandHandleColorManager(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version); #endif diff --git a/src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h b/src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h deleted file mode 100644 index e3cf9c2c6..000000000 --- a/src/detection/displayserver/linux/wayland/xx-color-management-v4-client-protocol.h +++ /dev/null @@ -1,2447 +0,0 @@ -/* Generated by wayland-scanner 1.23.1 */ - -#ifndef COLOR_MANAGEMENT_V1_CLIENT_PROTOCOL_H -#define COLOR_MANAGEMENT_V1_CLIENT_PROTOCOL_H - -#include -#include -#include "wayland-client.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @page page_color_management_v1 The color_management_v1 protocol - * color management protocol - * - * @section page_desc_color_management_v1 Description - * - * The aim of the color management extension is to allow clients to know - * the color properties of outputs, and to tell the compositor about the color - * properties of their content on surfaces. Doing this enables a compositor - * to perform automatic color management of content for different outputs - * according to how content is intended to look like. - * - * The color properties are represented as an image description object which - * is immutable after it has been created. A wl_output always has an - * associated image description that clients can observe. A wl_surface - * always has an associated preferred image description as a hint chosen by - * the compositor that clients can also observe. Clients can set an image - * description on a wl_surface to denote the color characteristics of the - * surface contents. - * - * An image description includes SDR and HDR colorimetry and encoding, HDR - * metadata, and viewing environment parameters. An image description does - * not include the properties set through color-representation extension. - * It is expected that the color-representation extension is used in - * conjunction with the color management extension when necessary, - * particularly with the YUV family of pixel formats. - * - * Recommendation ITU-T H.273 - * "Coding-independent code points for video signal type identification" - * shall be referred to as simply H.273 here. - * - * The color-and-hdr repository - * (https://gitlab.freedesktop.org/pq/color-and-hdr) contains - * background information on the protocol design and legacy color management. - * It also contains a glossary, learning resources for digital color, tools, - * samples and more. - * - * The terminology used in this protocol is based on common color science and - * color encoding terminology where possible. The glossary in the color-and-hdr - * repository shall be the authority on the definition of terms in this - * protocol. - * - * @section page_ifaces_color_management_v1 Interfaces - * - @subpage page_iface_xx_color_manager_v4 - color manager singleton - * - @subpage page_iface_xx_color_management_output_v4 - output color properties - * - @subpage page_iface_xx_color_management_surface_v4 - color management extension to a surface - * - @subpage page_iface_xx_color_management_feedback_surface_v4 - color management extension to a surface - * - @subpage page_iface_xx_image_description_creator_icc_v4 - holder of image description ICC information - * - @subpage page_iface_xx_image_description_creator_params_v4 - holder of image description parameters - * - @subpage page_iface_xx_image_description_v4 - Colorimetric image description - * - @subpage page_iface_xx_image_description_info_v4 - Colorimetric image description information - * @section page_copyright_color_management_v1 Copyright - *
- *
- * Copyright 2019 Sebastian Wick
- * Copyright 2019 Erwin Burema
- * Copyright 2020 AMD
- * Copyright 2020-2024 Collabora, Ltd.
- * Copyright 2024 Xaver Hugl
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- * 
- */ -struct wl_output; -struct wl_surface; -struct xx_color_management_feedback_surface_v4; -struct xx_color_management_output_v4; -struct xx_color_management_surface_v4; -struct xx_color_manager_v4; -struct xx_image_description_creator_icc_v4; -struct xx_image_description_creator_params_v4; -struct xx_image_description_info_v4; -struct xx_image_description_v4; - -#ifndef XX_COLOR_MANAGER_V4_INTERFACE -#define XX_COLOR_MANAGER_V4_INTERFACE -/** - * @page page_iface_xx_color_manager_v4 xx_color_manager_v4 - * @section page_iface_xx_color_manager_v4_desc Description - * - * A global interface used for getting color management extensions for - * wl_surface and wl_output objects, and for creating client defined image - * description objects. The extension interfaces allow - * getting the image description of outputs and setting the image - * description of surfaces. - * @section page_iface_xx_color_manager_v4_api API - * See @ref iface_xx_color_manager_v4. - */ -/** - * @defgroup iface_xx_color_manager_v4 The xx_color_manager_v4 interface - * - * A global interface used for getting color management extensions for - * wl_surface and wl_output objects, and for creating client defined image - * description objects. The extension interfaces allow - * getting the image description of outputs and setting the image - * description of surfaces. - */ -extern const struct wl_interface xx_color_manager_v4_interface; -#endif -#ifndef XX_COLOR_MANAGEMENT_OUTPUT_V4_INTERFACE -#define XX_COLOR_MANAGEMENT_OUTPUT_V4_INTERFACE -/** - * @page page_iface_xx_color_management_output_v4 xx_color_management_output_v4 - * @section page_iface_xx_color_management_output_v4_desc Description - * - * A xx_color_management_output_v4 describes the color properties of an - * output. - * - * The xx_color_management_output_v4 is associated with the wl_output global - * underlying the wl_output object. Therefore the client destroying the - * wl_output object has no impact, but the compositor removing the output - * global makes the xx_color_management_output_v4 object inert. - * @section page_iface_xx_color_management_output_v4_api API - * See @ref iface_xx_color_management_output_v4. - */ -/** - * @defgroup iface_xx_color_management_output_v4 The xx_color_management_output_v4 interface - * - * A xx_color_management_output_v4 describes the color properties of an - * output. - * - * The xx_color_management_output_v4 is associated with the wl_output global - * underlying the wl_output object. Therefore the client destroying the - * wl_output object has no impact, but the compositor removing the output - * global makes the xx_color_management_output_v4 object inert. - */ -extern const struct wl_interface xx_color_management_output_v4_interface; -#endif -#ifndef XX_COLOR_MANAGEMENT_SURFACE_V4_INTERFACE -#define XX_COLOR_MANAGEMENT_SURFACE_V4_INTERFACE -/** - * @page page_iface_xx_color_management_surface_v4 xx_color_management_surface_v4 - * @section page_iface_xx_color_management_surface_v4_desc Description - * - * A xx_color_management_surface_v4 allows the client to set the color - * space and HDR properties of a surface. - * - * If the wl_surface associated with the xx_color_management_surface_v4 is - * destroyed, the xx_color_management_surface_v4 object becomes inert. - * @section page_iface_xx_color_management_surface_v4_api API - * See @ref iface_xx_color_management_surface_v4. - */ -/** - * @defgroup iface_xx_color_management_surface_v4 The xx_color_management_surface_v4 interface - * - * A xx_color_management_surface_v4 allows the client to set the color - * space and HDR properties of a surface. - * - * If the wl_surface associated with the xx_color_management_surface_v4 is - * destroyed, the xx_color_management_surface_v4 object becomes inert. - */ -extern const struct wl_interface xx_color_management_surface_v4_interface; -#endif -#ifndef XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_INTERFACE -#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_INTERFACE -/** - * @page page_iface_xx_color_management_feedback_surface_v4 xx_color_management_feedback_surface_v4 - * @section page_iface_xx_color_management_feedback_surface_v4_desc Description - * - * A xx_color_management_feedback_surface_v4 allows the client to get the - * preferred color description of a surface. - * - * If the wl_surface associated with this object is destroyed, the - * xx_color_management_feedback_surface_v4 object becomes inert. - * @section page_iface_xx_color_management_feedback_surface_v4_api API - * See @ref iface_xx_color_management_feedback_surface_v4. - */ -/** - * @defgroup iface_xx_color_management_feedback_surface_v4 The xx_color_management_feedback_surface_v4 interface - * - * A xx_color_management_feedback_surface_v4 allows the client to get the - * preferred color description of a surface. - * - * If the wl_surface associated with this object is destroyed, the - * xx_color_management_feedback_surface_v4 object becomes inert. - */ -extern const struct wl_interface xx_color_management_feedback_surface_v4_interface; -#endif -#ifndef XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_INTERFACE -#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_INTERFACE -/** - * @page page_iface_xx_image_description_creator_icc_v4 xx_image_description_creator_icc_v4 - * @section page_iface_xx_image_description_creator_icc_v4_desc Description - * - * This type of object is used for collecting all the information required - * to create a xx_image_description_v4 object from an ICC file. A complete - * set of required parameters consists of these properties: - * - ICC file - * - * Each required property must be set exactly once if the client is to create - * an image description. The set requests verify that a property was not - * already set. The create request verifies that all required properties are - * set. There may be several alternative requests for setting each property, - * and in that case the client must choose one of them. - * - * Once all properties have been set, the create request must be used to - * create the image description object, destroying the creator in the - * process. - * @section page_iface_xx_image_description_creator_icc_v4_api API - * See @ref iface_xx_image_description_creator_icc_v4. - */ -/** - * @defgroup iface_xx_image_description_creator_icc_v4 The xx_image_description_creator_icc_v4 interface - * - * This type of object is used for collecting all the information required - * to create a xx_image_description_v4 object from an ICC file. A complete - * set of required parameters consists of these properties: - * - ICC file - * - * Each required property must be set exactly once if the client is to create - * an image description. The set requests verify that a property was not - * already set. The create request verifies that all required properties are - * set. There may be several alternative requests for setting each property, - * and in that case the client must choose one of them. - * - * Once all properties have been set, the create request must be used to - * create the image description object, destroying the creator in the - * process. - */ -extern const struct wl_interface xx_image_description_creator_icc_v4_interface; -#endif -#ifndef XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_INTERFACE -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_INTERFACE -/** - * @page page_iface_xx_image_description_creator_params_v4 xx_image_description_creator_params_v4 - * @section page_iface_xx_image_description_creator_params_v4_desc Description - * - * This type of object is used for collecting all the parameters required - * to create a xx_image_description_v4 object. A complete set of required - * parameters consists of these properties: - * - transfer characteristic function (tf) - * - chromaticities of primaries and white point (primary color volume) - * - * The following properties are optional and have a well-defined default - * if not explicitly set: - * - primary color volume luminance range - * - reference white luminance level - * - mastering display primaries and white point (target color volume) - * - mastering luminance range - * - maximum content light level - * - maximum frame-average light level - * - * Each required property must be set exactly once if the client is to create - * an image description. The set requests verify that a property was not - * already set. The create request verifies that all required properties are - * set. There may be several alternative requests for setting each property, - * and in that case the client must choose one of them. - * - * Once all properties have been set, the create request must be used to - * create the image description object, destroying the creator in the - * process. - * @section page_iface_xx_image_description_creator_params_v4_api API - * See @ref iface_xx_image_description_creator_params_v4. - */ -/** - * @defgroup iface_xx_image_description_creator_params_v4 The xx_image_description_creator_params_v4 interface - * - * This type of object is used for collecting all the parameters required - * to create a xx_image_description_v4 object. A complete set of required - * parameters consists of these properties: - * - transfer characteristic function (tf) - * - chromaticities of primaries and white point (primary color volume) - * - * The following properties are optional and have a well-defined default - * if not explicitly set: - * - primary color volume luminance range - * - reference white luminance level - * - mastering display primaries and white point (target color volume) - * - mastering luminance range - * - maximum content light level - * - maximum frame-average light level - * - * Each required property must be set exactly once if the client is to create - * an image description. The set requests verify that a property was not - * already set. The create request verifies that all required properties are - * set. There may be several alternative requests for setting each property, - * and in that case the client must choose one of them. - * - * Once all properties have been set, the create request must be used to - * create the image description object, destroying the creator in the - * process. - */ -extern const struct wl_interface xx_image_description_creator_params_v4_interface; -#endif -#ifndef XX_IMAGE_DESCRIPTION_V4_INTERFACE -#define XX_IMAGE_DESCRIPTION_V4_INTERFACE -/** - * @page page_iface_xx_image_description_v4 xx_image_description_v4 - * @section page_iface_xx_image_description_v4_desc Description - * - * An image description carries information about the color encoding used on - * a surface when attached to a wl_surface via - * xx_color_management_surface_v4.set_image_description. A compositor can use - * this information to decode pixel values into colorimetrically meaningful - * quantities. - * - * Note, that the xx_image_description_v4 object is not ready to be used - * immediately after creation. The object eventually delivers either the - * 'ready' or the 'failed' event, specified in all requests creating it. The - * object is deemed "ready" after receiving the 'ready' event. - * - * An object which is not ready is illegal to use, it can only be destroyed. - * Any other request in this interface shall result in the 'not_ready' - * protocol error. Attempts to use an object which is not ready through other - * interfaces shall raise protocol errors defined there. - * - * Once created and regardless of how it was created, a - * xx_image_description_v4 object always refers to one fixed image - * description. It cannot change after creation. - * @section page_iface_xx_image_description_v4_api API - * See @ref iface_xx_image_description_v4. - */ -/** - * @defgroup iface_xx_image_description_v4 The xx_image_description_v4 interface - * - * An image description carries information about the color encoding used on - * a surface when attached to a wl_surface via - * xx_color_management_surface_v4.set_image_description. A compositor can use - * this information to decode pixel values into colorimetrically meaningful - * quantities. - * - * Note, that the xx_image_description_v4 object is not ready to be used - * immediately after creation. The object eventually delivers either the - * 'ready' or the 'failed' event, specified in all requests creating it. The - * object is deemed "ready" after receiving the 'ready' event. - * - * An object which is not ready is illegal to use, it can only be destroyed. - * Any other request in this interface shall result in the 'not_ready' - * protocol error. Attempts to use an object which is not ready through other - * interfaces shall raise protocol errors defined there. - * - * Once created and regardless of how it was created, a - * xx_image_description_v4 object always refers to one fixed image - * description. It cannot change after creation. - */ -extern const struct wl_interface xx_image_description_v4_interface; -#endif -#ifndef XX_IMAGE_DESCRIPTION_INFO_V4_INTERFACE -#define XX_IMAGE_DESCRIPTION_INFO_V4_INTERFACE -/** - * @page page_iface_xx_image_description_info_v4 xx_image_description_info_v4 - * @section page_iface_xx_image_description_info_v4_desc Description - * - * Sends all matching events describing an image description object exactly - * once and finally sends the 'done' event. - * - * Once a xx_image_description_info_v4 object has delivered a 'done' event it - * is automatically destroyed. - * - * Every xx_image_description_info_v4 created from the same - * xx_image_description_v4 shall always return the exact same data. - * @section page_iface_xx_image_description_info_v4_api API - * See @ref iface_xx_image_description_info_v4. - */ -/** - * @defgroup iface_xx_image_description_info_v4 The xx_image_description_info_v4 interface - * - * Sends all matching events describing an image description object exactly - * once and finally sends the 'done' event. - * - * Once a xx_image_description_info_v4 object has delivered a 'done' event it - * is automatically destroyed. - * - * Every xx_image_description_info_v4 created from the same - * xx_image_description_v4 shall always return the exact same data. - */ -extern const struct wl_interface xx_image_description_info_v4_interface; -#endif - -#ifndef XX_COLOR_MANAGER_V4_ERROR_ENUM -#define XX_COLOR_MANAGER_V4_ERROR_ENUM -enum xx_color_manager_v4_error { - /** - * request not supported - */ - XX_COLOR_MANAGER_V4_ERROR_UNSUPPORTED_FEATURE = 0, - /** - * color management surface exists already - */ - XX_COLOR_MANAGER_V4_ERROR_SURFACE_EXISTS = 1, -}; -#endif /* XX_COLOR_MANAGER_V4_ERROR_ENUM */ - -#ifndef XX_COLOR_MANAGER_V4_RENDER_INTENT_ENUM -#define XX_COLOR_MANAGER_V4_RENDER_INTENT_ENUM -/** - * @ingroup iface_xx_color_manager_v4 - * rendering intents - * - * See the ICC.1:2022 specification from the International Color Consortium - * for more details about rendering intents. - * - * The principles of ICC defined rendering intents apply with all types of - * image descriptions, not only those with ICC file profiles. - * - * Compositors must support the perceptual rendering intent. Other - * rendering intents are optional. - */ -enum xx_color_manager_v4_render_intent { - /** - * perceptual - */ - XX_COLOR_MANAGER_V4_RENDER_INTENT_PERCEPTUAL = 0, - /** - * media-relative colorimetric - */ - XX_COLOR_MANAGER_V4_RENDER_INTENT_RELATIVE = 1, - /** - * saturation - */ - XX_COLOR_MANAGER_V4_RENDER_INTENT_SATURATION = 2, - /** - * ICC-absolute colorimetric - */ - XX_COLOR_MANAGER_V4_RENDER_INTENT_ABSOLUTE = 3, - /** - * media-relative colorimetric + black point compensation - */ - XX_COLOR_MANAGER_V4_RENDER_INTENT_RELATIVE_BPC = 4, -}; -#endif /* XX_COLOR_MANAGER_V4_RENDER_INTENT_ENUM */ - -#ifndef XX_COLOR_MANAGER_V4_FEATURE_ENUM -#define XX_COLOR_MANAGER_V4_FEATURE_ENUM -/** - * @ingroup iface_xx_color_manager_v4 - * compositor supported features - */ -enum xx_color_manager_v4_feature { - /** - * new_icc_creator request - */ - XX_COLOR_MANAGER_V4_FEATURE_ICC_V2_V4 = 0, - /** - * new_parametric_creator request - */ - XX_COLOR_MANAGER_V4_FEATURE_PARAMETRIC = 1, - /** - * parametric set_primaries request - */ - XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES = 2, - /** - * parametric set_tf_power request - */ - XX_COLOR_MANAGER_V4_FEATURE_SET_TF_POWER = 3, - /** - * parametric set_luminances request - */ - XX_COLOR_MANAGER_V4_FEATURE_SET_LUMINANCES = 4, - /** - * parametric set_mastering_display_primaries request - * - * The compositor supports set_mastering_display_primaries - * request with a target color volume fully contained inside the - * primary color volume. - */ - XX_COLOR_MANAGER_V4_FEATURE_SET_MASTERING_DISPLAY_PRIMARIES = 5, - /** - * parametric target exceeds primary color volume - * - * The compositor additionally supports target color volumes that - * extend outside of the primary color volume. - * - * This can only be advertised if feature - * set_mastering_display_primaries is supported as well. - */ - XX_COLOR_MANAGER_V4_FEATURE_EXTENDED_TARGET_VOLUME = 6, -}; -#endif /* XX_COLOR_MANAGER_V4_FEATURE_ENUM */ - -#ifndef XX_COLOR_MANAGER_V4_PRIMARIES_ENUM -#define XX_COLOR_MANAGER_V4_PRIMARIES_ENUM -/** - * @ingroup iface_xx_color_manager_v4 - * named color primaries - * - * Named color primaries used to encode well-known sets of primaries. H.273 - * is the authority, when it comes to the exact values of primaries and - * authoritative specifications, where an equivalent code point exists. - * - * Descriptions do list the specifications for convenience. - */ -enum xx_color_manager_v4_primaries { - /** - * Color primaries for the sRGB color space as defined by the BT.709 standard - * - * Color primaries as defined by - Rec. ITU-R BT.709-6 - Rec. - * ITU-R BT.1361-0 conventional colour gamut system and extended - * colour gamut system (historical) - IEC 61966-2-1 sRGB or sYCC - - * IEC 61966-2-4 - Society of Motion Picture and Television - * Engineers (SMPTE) RP 177 (1993) Annex B Equivalent to H.273 - * ColourPrimaries code point 1. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_SRGB = 0, - /** - * Color primaries for PAL-M as defined by the BT.470 standard - * - * Color primaries as defined by - Rec. ITU-R BT.470-6 System M - * (historical) - United States National Television System - * Committee 1953 Recommendation for transmission standards for - * color television - United States Federal Communications - * Commission (2003) Title 47 Code of Federal Regulations 73.682 - * (a)(20) Equivalent to H.273 ColourPrimaries code point 4. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M = 1, - /** - * Color primaries for PAL as defined by the BT.601 standard - * - * Color primaries as defined by - Rec. ITU-R BT.470-6 System B, - * G (historical) - Rec. ITU-R BT.601-7 625 - Rec. ITU-R BT.1358-0 - * 625 (historical) - Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM - * Equivalent to H.273 ColourPrimaries code point 5. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_PAL = 2, - /** - * Color primaries for NTSC as defined by the BT.601 standard - * - * Color primaries as defined by - Rec. ITU-R BT.601-7 525 - Rec. - * ITU-R BT.1358-1 525 or 625 (historical) - Rec. ITU-R BT.1700-0 - * NTSC - SMPTE 170M (2004) - SMPTE 240M (1999) (historical) - * Equivalent to H.273 ColourPrimaries code point 6 and 7. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_NTSC = 3, - /** - * Generic film with colour filters using Illuminant C - * - * Color primaries as defined by H.273 for generic film. - * Equivalent to H.273 ColourPrimaries code point 8. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_GENERIC_FILM = 4, - /** - * Color primaries as defined by the BT.2020 and BT.2100 standard - * - * Color primaries as defined by - Rec. ITU-R BT.2020-2 - Rec. - * ITU-R BT.2100-0 Equivalent to H.273 ColourPrimaries code point - * 9. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_BT2020 = 5, - /** - * Color primaries of the full CIE 1931 XYZ color space - * - * Color primaries as defined as the maximum of the CIE 1931 XYZ - * color space by - SMPTE ST 428-1 - (CIE 1931 XYZ as in ISO - * 11664-1) Equivalent to H.273 ColourPrimaries code point 10. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_CIE1931_XYZ = 6, - /** - * Color primaries of the DCI P3 color space as defined by the SMPTE RP 431 standard - * - * Color primaries as defined by Digital Cinema System and - * published in SMPTE RP 431-2 (2011). Equivalent to H.273 - * ColourPrimaries code point 11. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_DCI_P3 = 7, - /** - * Color primaries of Display P3 variant of the DCI-P3 color space as defined by the SMPTE EG 432 standard - * - * Color primaries as defined by Digital Cinema System and - * published in SMPTE EG 432-1 (2010). Equivalent to H.273 - * ColourPrimaries code point 12. - */ - XX_COLOR_MANAGER_V4_PRIMARIES_DISPLAY_P3 = 8, - /** - * Color primaries of the Adobe RGB color space as defined by the ISO 12640 standard - * - * Color primaries as defined by Adobe as "Adobe RGB" and later - * published by ISO 12640-4 (2011). - */ - XX_COLOR_MANAGER_V4_PRIMARIES_ADOBE_RGB = 9, -}; -#endif /* XX_COLOR_MANAGER_V4_PRIMARIES_ENUM */ - -#ifndef XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ENUM -#define XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ENUM -/** - * @ingroup iface_xx_color_manager_v4 - * named transfer functions - * - * Named transfer functions used to encode well-known transfer - * characteristics. H.273 is the authority, when it comes to the exact - * formulas and authoritative specifications, where an equivalent code - * point exists. - * - * Descriptions do list the specifications for convenience. - */ -enum xx_color_manager_v4_transfer_function { - /** - * BT.709 transfer function - * - * Transfer characteristics as defined by - Rec. ITU-R BT.709-6 - - * Rec. ITU-R BT.1361-0 conventional colour gamut system - * (historical) Equivalent to H.273 TransferCharacteristics code - * point 1, 6, 14, 15. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709 = 0, - /** - * Assumed display gamma 2.2 transfer function - * - * Transfer characteristics as defined by - Rec. ITU-R BT.470-6 - * System M (historical) - United States National Television System - * Committee 1953 Recommendation for transmission standards for - * color television - United States Federal Communications - * Commission (2003) Title 47 Code of Federal Regulations 73.682 - * (a) (20) - Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM Equivalent - * to H.273 TransferCharacteristics code point 4. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22 = 1, - /** - * Assumed display gamma 2.8 transfer function - * - * Transfer characteristics as defined by - Rec. ITU-R BT.470-6 - * System B, G (historical) Equivalent to H.273 - * TransferCharacteristics code point 5. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28 = 2, - /** - * SMPTE ST 240 transfer function - * - * Transfer characteristics as defined by - SMPTE ST 240 (1999) - * Equivalent to H.273 TransferCharacteristics code point 7. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST240 = 3, - /** - * linear transfer function - * - * Linear transfer characteristics. Equivalent to H.273 - * TransferCharacteristics code point 8. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR = 4, - /** - * logarithmic 100:1 transfer function - * - * Logarithmic transfer characteristic (100:1 range). Equivalent - * to H.273 TransferCharacteristics code point 9. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_100 = 5, - /** - * logarithmic (100*Sqrt(10) : 1) transfer function - * - * Logarithmic transfer characteristic (100 * Sqrt(10) : 1 - * range). Equivalent to H.273 TransferCharacteristics code point - * 10. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_316 = 6, - /** - * IEC 61966-2-4 transfer function - * - * Transfer characteristics as defined by - IEC 61966-2-4 - * Equivalent to H.273 TransferCharacteristics code point 11. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_XVYCC = 7, - /** - * BT.1361 extended transfer function - * - * Transfer characteristics as defined by - Rec. ITU-R BT.1361-0 - * extended colour gamut system (historical) Equivalent to H.273 - * TransferCharacteristics code point 12. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT1361 = 8, - /** - * sRGB piece-wise transfer function - * - * Transfer characteristics as defined by - IEC 61966-2-1 sRGB - * Equivalent to H.273 TransferCharacteristics code point 13 with - * MatrixCoefficients set to 0. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB = 9, - /** - * Extended sRGB piece-wise transfer function - * - * Transfer characteristics as defined by - IEC 61966-2-1 sYCC - * Equivalent to H.273 TransferCharacteristics code point 13 with - * MatrixCoefficients set to anything but 0. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_EXT_SRGB = 10, - /** - * perceptual quantizer transfer function - * - * Transfer characteristics as defined by - SMPTE ST 2084 (2014) - * for 10-, 12-, 14- and 16-bit systems - Rec. ITU-R BT.2100-2 - * perceptual quantization (PQ) system Equivalent to H.273 - * TransferCharacteristics code point 16. - * - * This TF implies these default luminances - primary color volume - * minimum: 0.005 cd/m² - primary color volume maximum: 10000 - * cd/m² - reference white: 203 cd/m² - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ = 11, - /** - * SMPTE ST 428 transfer function - * - * Transfer characteristics as defined by - SMPTE ST 428-1 (2019) - * Equivalent to H.273 TransferCharacteristics code point 17. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST428 = 12, - /** - * hybrid log-gamma transfer function - * - * Transfer characteristics as defined by - ARIB STD-B67 (2015) - - * Rec. ITU-R BT.2100-2 hybrid log-gamma (HLG) system Equivalent to - * H.273 TransferCharacteristics code point 18. - * - * This TF implies these default luminances - primary color volume - * minimum: 0.005 cd/m² - primary color volume maximum: 1000 - * cd/m² - reference white: 203 cd/m² Note: HLG is a scene - * referred signal. All absolute luminance values used here for HLG - * assume a 1000 cd/m² display. - */ - XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_HLG = 13, -}; -#endif /* XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ENUM */ - -/** - * @ingroup iface_xx_color_manager_v4 - * @struct xx_color_manager_v4_listener - */ -struct xx_color_manager_v4_listener { - /** - * supported rendering intent - * - * When this object is created, it shall immediately send this - * event once for each rendering intent the compositor supports. - * @param render_intent rendering intent - */ - void (*supported_intent)(void *data, - struct xx_color_manager_v4 *xx_color_manager_v4, - uint32_t render_intent); - /** - * supported features - * - * When this object is created, it shall immediately send this - * event once for each compositor supported feature listed in the - * enumeration. - * @param feature supported feature - */ - void (*supported_feature)(void *data, - struct xx_color_manager_v4 *xx_color_manager_v4, - uint32_t feature); - /** - * supported named transfer characteristic - * - * When this object is created, it shall immediately send this - * event once for each named transfer function the compositor - * supports with the parametric image description creator. - * @param tf Named transfer function - */ - void (*supported_tf_named)(void *data, - struct xx_color_manager_v4 *xx_color_manager_v4, - uint32_t tf); - /** - * supported named primaries - * - * When this object is created, it shall immediately send this - * event once for each named set of primaries the compositor - * supports with the parametric image description creator. - * @param primaries Named color primaries - */ - void (*supported_primaries_named)(void *data, - struct xx_color_manager_v4 *xx_color_manager_v4, - uint32_t primaries); -}; - -/** - * @ingroup iface_xx_color_manager_v4 - */ -static inline int -xx_color_manager_v4_add_listener(struct xx_color_manager_v4 *xx_color_manager_v4, - const struct xx_color_manager_v4_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xx_color_manager_v4, - (void (**)(void)) listener, data); -} - -#define XX_COLOR_MANAGER_V4_DESTROY 0 -#define XX_COLOR_MANAGER_V4_GET_OUTPUT 1 -#define XX_COLOR_MANAGER_V4_GET_SURFACE 2 -#define XX_COLOR_MANAGER_V4_GET_FEEDBACK_SURFACE 3 -#define XX_COLOR_MANAGER_V4_NEW_ICC_CREATOR 4 -#define XX_COLOR_MANAGER_V4_NEW_PARAMETRIC_CREATOR 5 - -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_SUPPORTED_INTENT_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_SUPPORTED_FEATURE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_SUPPORTED_TF_NAMED_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_SUPPORTED_PRIMARIES_NAMED_SINCE_VERSION 1 - -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_GET_OUTPUT_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_GET_SURFACE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_GET_FEEDBACK_SURFACE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_NEW_ICC_CREATOR_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_manager_v4 - */ -#define XX_COLOR_MANAGER_V4_NEW_PARAMETRIC_CREATOR_SINCE_VERSION 1 - -/** @ingroup iface_xx_color_manager_v4 */ -static inline void -xx_color_manager_v4_set_user_data(struct xx_color_manager_v4 *xx_color_manager_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_color_manager_v4, user_data); -} - -/** @ingroup iface_xx_color_manager_v4 */ -static inline void * -xx_color_manager_v4_get_user_data(struct xx_color_manager_v4 *xx_color_manager_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_color_manager_v4); -} - -static inline uint32_t -xx_color_manager_v4_get_version(struct xx_color_manager_v4 *xx_color_manager_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4); -} - -/** - * @ingroup iface_xx_color_manager_v4 - * - * Destroy the xx_color_manager_v4 object. This does not affect any other - * objects in any way. - */ -static inline void -xx_color_manager_v4_destroy(struct xx_color_manager_v4 *xx_color_manager_v4) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, - XX_COLOR_MANAGER_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), WL_MARSHAL_FLAG_DESTROY); -} - -/** - * @ingroup iface_xx_color_manager_v4 - * - * This creates a new xx_color_management_output_v4 object for the - * given wl_output. - * - * See the xx_color_management_output_v4 interface for more details. - */ -static inline struct xx_color_management_output_v4 * -xx_color_manager_v4_get_output(struct xx_color_manager_v4 *xx_color_manager_v4, struct wl_output *output) -{ - struct wl_proxy *id; - - id = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, - XX_COLOR_MANAGER_V4_GET_OUTPUT, &xx_color_management_output_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL, output); - - return (struct xx_color_management_output_v4 *) id; -} - -/** - * @ingroup iface_xx_color_manager_v4 - * - * If a xx_color_management_surface_v4 object already exists for the given - * wl_surface, the protocol error surface_exists is raised. - * - * This creates a new color xx_color_management_surface_v4 object for the - * given wl_surface. - * - * See the xx_color_management_surface_v4 interface for more details. - */ -static inline struct xx_color_management_surface_v4 * -xx_color_manager_v4_get_surface(struct xx_color_manager_v4 *xx_color_manager_v4, struct wl_surface *surface) -{ - struct wl_proxy *id; - - id = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, - XX_COLOR_MANAGER_V4_GET_SURFACE, &xx_color_management_surface_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL, surface); - - return (struct xx_color_management_surface_v4 *) id; -} - -/** - * @ingroup iface_xx_color_manager_v4 - * - * This creates a new color xx_color_management_feedback_surface_v4 object - * for the given wl_surface. - * - * See the xx_color_management_feedback_surface_v4 interface for more - * details. - */ -static inline struct xx_color_management_feedback_surface_v4 * -xx_color_manager_v4_get_feedback_surface(struct xx_color_manager_v4 *xx_color_manager_v4, struct wl_surface *surface) -{ - struct wl_proxy *id; - - id = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, - XX_COLOR_MANAGER_V4_GET_FEEDBACK_SURFACE, &xx_color_management_feedback_surface_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL, surface); - - return (struct xx_color_management_feedback_surface_v4 *) id; -} - -/** - * @ingroup iface_xx_color_manager_v4 - * - * Makes a new ICC-based image description creator object with all - * properties initially unset. The client can then use the object's - * interface to define all the required properties for an image description - * and finally create a xx_image_description_v4 object. - * - * This request can be used when the compositor advertises - * xx_color_manager_v4.feature.icc_v2_v4. - * Otherwise this request raises the protocol error unsupported_feature. - */ -static inline struct xx_image_description_creator_icc_v4 * -xx_color_manager_v4_new_icc_creator(struct xx_color_manager_v4 *xx_color_manager_v4) -{ - struct wl_proxy *obj; - - obj = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, - XX_COLOR_MANAGER_V4_NEW_ICC_CREATOR, &xx_image_description_creator_icc_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL); - - return (struct xx_image_description_creator_icc_v4 *) obj; -} - -/** - * @ingroup iface_xx_color_manager_v4 - * - * Makes a new parametric image description creator object with all - * properties initially unset. The client can then use the object's - * interface to define all the required properties for an image description - * and finally create a xx_image_description_v4 object. - * - * This request can be used when the compositor advertises - * xx_color_manager_v4.feature.parametric. - * Otherwise this request raises the protocol error unsupported_feature. - */ -static inline struct xx_image_description_creator_params_v4 * -xx_color_manager_v4_new_parametric_creator(struct xx_color_manager_v4 *xx_color_manager_v4) -{ - struct wl_proxy *obj; - - obj = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_manager_v4, - XX_COLOR_MANAGER_V4_NEW_PARAMETRIC_CREATOR, &xx_image_description_creator_params_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_manager_v4), 0, NULL); - - return (struct xx_image_description_creator_params_v4 *) obj; -} - -/** - * @ingroup iface_xx_color_management_output_v4 - * @struct xx_color_management_output_v4_listener - */ -struct xx_color_management_output_v4_listener { - /** - * image description changed - * - * This event is sent whenever the image description of the - * output changed, followed by one wl_output.done event common to - * output events across all extensions. - * - * If the client wants to use the updated image description, it - * needs to do get_image_description again, because image - * description objects are immutable. - */ - void (*image_description_changed)(void *data, - struct xx_color_management_output_v4 *xx_color_management_output_v4); -}; - -/** - * @ingroup iface_xx_color_management_output_v4 - */ -static inline int -xx_color_management_output_v4_add_listener(struct xx_color_management_output_v4 *xx_color_management_output_v4, - const struct xx_color_management_output_v4_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xx_color_management_output_v4, - (void (**)(void)) listener, data); -} - -#define XX_COLOR_MANAGEMENT_OUTPUT_V4_DESTROY 0 -#define XX_COLOR_MANAGEMENT_OUTPUT_V4_GET_IMAGE_DESCRIPTION 1 - -/** - * @ingroup iface_xx_color_management_output_v4 - */ -#define XX_COLOR_MANAGEMENT_OUTPUT_V4_IMAGE_DESCRIPTION_CHANGED_SINCE_VERSION 1 - -/** - * @ingroup iface_xx_color_management_output_v4 - */ -#define XX_COLOR_MANAGEMENT_OUTPUT_V4_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_management_output_v4 - */ -#define XX_COLOR_MANAGEMENT_OUTPUT_V4_GET_IMAGE_DESCRIPTION_SINCE_VERSION 1 - -/** @ingroup iface_xx_color_management_output_v4 */ -static inline void -xx_color_management_output_v4_set_user_data(struct xx_color_management_output_v4 *xx_color_management_output_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_color_management_output_v4, user_data); -} - -/** @ingroup iface_xx_color_management_output_v4 */ -static inline void * -xx_color_management_output_v4_get_user_data(struct xx_color_management_output_v4 *xx_color_management_output_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_color_management_output_v4); -} - -static inline uint32_t -xx_color_management_output_v4_get_version(struct xx_color_management_output_v4 *xx_color_management_output_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_color_management_output_v4); -} - -/** - * @ingroup iface_xx_color_management_output_v4 - * - * Destroy the color xx_color_management_output_v4 object. This does not - * affect any remaining protocol objects. - */ -static inline void -xx_color_management_output_v4_destroy(struct xx_color_management_output_v4 *xx_color_management_output_v4) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_output_v4, - XX_COLOR_MANAGEMENT_OUTPUT_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_output_v4), WL_MARSHAL_FLAG_DESTROY); -} - -/** - * @ingroup iface_xx_color_management_output_v4 - * - * This creates a new xx_image_description_v4 object for the current image - * description of the output. There always is exactly one image description - * active for an output so the client should destroy the image description - * created by earlier invocations of this request. This request is usually - * sent as a reaction to the image_description_changed event or when - * creating a xx_color_management_output_v4 object. - * - * The image description of an output represents the color encoding the - * output expects. There might be performance and power advantages, as well - * as improved color reproduction, if a content update matches the image - * description of the output it is being shown on. If a content update is - * shown on any other output than the one it matches the image description - * of, then the color reproduction on those outputs might be considerably - * worse. - * - * The created xx_image_description_v4 object preserves the image - * description of the output from the time the object was created. - * - * The resulting image description object allows get_information request. - * - * If this protocol object is inert, the resulting image description object - * shall immediately deliver the xx_image_description_v4.failed event with - * the no_output cause. - * - * If the interface version is inadequate for the output's image - * description, meaning that the client does not support all the events - * needed to deliver the crucial information, the resulting image - * description object shall immediately deliver the - * xx_image_description_v4.failed event with the low_version cause. - * - * Otherwise the object shall immediately deliver the ready event. - */ -static inline struct xx_image_description_v4 * -xx_color_management_output_v4_get_image_description(struct xx_color_management_output_v4 *xx_color_management_output_v4) -{ - struct wl_proxy *image_description; - - image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_output_v4, - XX_COLOR_MANAGEMENT_OUTPUT_V4_GET_IMAGE_DESCRIPTION, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_management_output_v4), 0, NULL); - - return (struct xx_image_description_v4 *) image_description; -} - -#ifndef XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_ENUM -#define XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_ENUM -/** - * @ingroup iface_xx_color_management_surface_v4 - * protocol errors - */ -enum xx_color_management_surface_v4_error { - /** - * unsupported rendering intent - */ - XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_RENDER_INTENT = 0, - /** - * invalid image description - */ - XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_IMAGE_DESCRIPTION = 1, -}; -#endif /* XX_COLOR_MANAGEMENT_SURFACE_V4_ERROR_ENUM */ - -#define XX_COLOR_MANAGEMENT_SURFACE_V4_DESTROY 0 -#define XX_COLOR_MANAGEMENT_SURFACE_V4_SET_IMAGE_DESCRIPTION 1 -#define XX_COLOR_MANAGEMENT_SURFACE_V4_UNSET_IMAGE_DESCRIPTION 2 - - -/** - * @ingroup iface_xx_color_management_surface_v4 - */ -#define XX_COLOR_MANAGEMENT_SURFACE_V4_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_management_surface_v4 - */ -#define XX_COLOR_MANAGEMENT_SURFACE_V4_SET_IMAGE_DESCRIPTION_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_management_surface_v4 - */ -#define XX_COLOR_MANAGEMENT_SURFACE_V4_UNSET_IMAGE_DESCRIPTION_SINCE_VERSION 1 - -/** @ingroup iface_xx_color_management_surface_v4 */ -static inline void -xx_color_management_surface_v4_set_user_data(struct xx_color_management_surface_v4 *xx_color_management_surface_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_color_management_surface_v4, user_data); -} - -/** @ingroup iface_xx_color_management_surface_v4 */ -static inline void * -xx_color_management_surface_v4_get_user_data(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_color_management_surface_v4); -} - -static inline uint32_t -xx_color_management_surface_v4_get_version(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4); -} - -/** - * @ingroup iface_xx_color_management_surface_v4 - * - * Destroy the xx_color_management_surface_v4 object and do the same as - * unset_image_description. - */ -static inline void -xx_color_management_surface_v4_destroy(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_surface_v4, - XX_COLOR_MANAGEMENT_SURFACE_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4), WL_MARSHAL_FLAG_DESTROY); -} - -/** - * @ingroup iface_xx_color_management_surface_v4 - * - * Set the image description of the underlying surface. The image - * description and rendering intent are double-buffered state, see - * wl_surface.commit. - * - * It is the client's responsibility to understand the image description - * it sets on a surface, and to provide content that matches that image - * description. Compositors might convert images to match their own or any - * other image descriptions. - * - * Image description whose creation gracefully failed (received - * xx_image_description_v4.failed) are forbidden in this request, and in - * such case the protocol error image_description is raised. - * - * All image descriptions whose creation succeeded (received - * xx_image_description_v4.ready) are allowed and must always be accepted - * by the compositor. - * - * A rendering intent provides the client's preference on how content - * colors should be mapped to each output. The render_intent value must - * be one advertised by the compositor with - * xx_color_manager_v4.render_intent event, otherwise the protocol error - * render_intent is raised. - * - * By default, a surface does not have an associated image description - * nor a rendering intent. The handling of color on such surfaces is - * compositor implementation defined. Compositors should handle such - * surfaces as sRGB but may handle them differently if they have specific - * requirements. - */ -static inline void -xx_color_management_surface_v4_set_image_description(struct xx_color_management_surface_v4 *xx_color_management_surface_v4, struct xx_image_description_v4 *image_description, uint32_t render_intent) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_surface_v4, - XX_COLOR_MANAGEMENT_SURFACE_V4_SET_IMAGE_DESCRIPTION, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4), 0, image_description, render_intent); -} - -/** - * @ingroup iface_xx_color_management_surface_v4 - * - * This request removes any image description from the surface. See - * set_image_description for how a compositor handles a surface without - * an image description. This is double-buffered state, see - * wl_surface.commit. - */ -static inline void -xx_color_management_surface_v4_unset_image_description(struct xx_color_management_surface_v4 *xx_color_management_surface_v4) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_surface_v4, - XX_COLOR_MANAGEMENT_SURFACE_V4_UNSET_IMAGE_DESCRIPTION, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_surface_v4), 0); -} - -#ifndef XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_ENUM -#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_ENUM -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - * protocol errors - */ -enum xx_color_management_feedback_surface_v4_error { - /** - * forbidden request on inert object - */ - XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_INERT = 0, -}; -#endif /* XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_ERROR_ENUM */ - -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - * @struct xx_color_management_feedback_surface_v4_listener - */ -struct xx_color_management_feedback_surface_v4_listener { - /** - * the preferred image description changed - * - * The preferred image description is the one which likely has - * the most performance and/or quality benefits for the compositor - * if used by the client for its wl_surface contents. This event is - * sent whenever the compositor changes the wl_surface's preferred - * image description. - * - * This event is merely a notification. When the client wants to - * know what the preferred image description is, it shall use the - * get_preferred request. - * - * The preferred image description is not automatically used for - * anything. It is only a hint, and clients may set any valid image - * description with set_image_description but there might be - * performance and color accuracy improvements by providing the - * wl_surface contents in the preferred image description. - * Therefore clients that can, should render according to the - * preferred image description - */ - void (*preferred_changed)(void *data, - struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4); -}; - -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - */ -static inline int -xx_color_management_feedback_surface_v4_add_listener(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4, - const struct xx_color_management_feedback_surface_v4_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xx_color_management_feedback_surface_v4, - (void (**)(void)) listener, data); -} - -#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_DESTROY 0 -#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_GET_PREFERRED 1 - -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - */ -#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_PREFERRED_CHANGED_SINCE_VERSION 1 - -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - */ -#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - */ -#define XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_GET_PREFERRED_SINCE_VERSION 1 - -/** @ingroup iface_xx_color_management_feedback_surface_v4 */ -static inline void -xx_color_management_feedback_surface_v4_set_user_data(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_color_management_feedback_surface_v4, user_data); -} - -/** @ingroup iface_xx_color_management_feedback_surface_v4 */ -static inline void * -xx_color_management_feedback_surface_v4_get_user_data(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_color_management_feedback_surface_v4); -} - -static inline uint32_t -xx_color_management_feedback_surface_v4_get_version(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_color_management_feedback_surface_v4); -} - -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - * - * Destroy the xx_color_management_feedback_surface_v4 object. - */ -static inline void -xx_color_management_feedback_surface_v4_destroy(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_feedback_surface_v4, - XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_color_management_feedback_surface_v4), WL_MARSHAL_FLAG_DESTROY); -} - -/** - * @ingroup iface_xx_color_management_feedback_surface_v4 - * - * If this protocol object is inert, the protocol error inert is raised. - * - * The preferred image description represents the compositor's preferred - * color encoding for this wl_surface at the current time. There might be - * performance and power advantages, as well as improved color - * reproduction, if the image description of a content update matches the - * preferred image description. - * - * This creates a new xx_image_description_v4 object for the currently - * preferred image description for the wl_surface. The client should - * stop using and destroy the image descriptions created by earlier - * invocations of this request for the associated wl_surface. - * This request is usually sent as a reaction to the preferred_changed - * event or when creating a xx_color_management_feedback_surface_v4 object - * if the client is capable of adapting to image descriptions. - * - * The created xx_image_description_v4 object preserves the preferred image - * description of the wl_surface from the time the object was created. - * - * The resulting image description object allows get_information request. - * - * If the interface version is inadequate for the preferred image - * description, meaning that the client does not support all the - * events needed to deliver the crucial information, the resulting image - * description object shall immediately deliver the - * xx_image_description_v4.failed event with the low_version cause, - * otherwise the object shall immediately deliver the ready event. - */ -static inline struct xx_image_description_v4 * -xx_color_management_feedback_surface_v4_get_preferred(struct xx_color_management_feedback_surface_v4 *xx_color_management_feedback_surface_v4) -{ - struct wl_proxy *image_description; - - image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_color_management_feedback_surface_v4, - XX_COLOR_MANAGEMENT_FEEDBACK_SURFACE_V4_GET_PREFERRED, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_color_management_feedback_surface_v4), 0, NULL); - - return (struct xx_image_description_v4 *) image_description; -} - -#ifndef XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ENUM -#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ENUM -/** - * @ingroup iface_xx_image_description_creator_icc_v4 - * protocol errors - */ -enum xx_image_description_creator_icc_v4_error { - /** - * incomplete parameter set - */ - XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_INCOMPLETE_SET = 0, - /** - * property already set - */ - XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ALREADY_SET = 1, - /** - * fd not seekable and readable - */ - XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_BAD_FD = 2, - /** - * no or too much data - */ - XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_BAD_SIZE = 3, - /** - * offset + length exceeds file size - */ - XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_OUT_OF_FILE = 4, -}; -#endif /* XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_ERROR_ENUM */ - -#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_CREATE 0 -#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_SET_ICC_FILE 1 - - -/** - * @ingroup iface_xx_image_description_creator_icc_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_CREATE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_icc_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_SET_ICC_FILE_SINCE_VERSION 1 - -/** @ingroup iface_xx_image_description_creator_icc_v4 */ -static inline void -xx_image_description_creator_icc_v4_set_user_data(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_creator_icc_v4, user_data); -} - -/** @ingroup iface_xx_image_description_creator_icc_v4 */ -static inline void * -xx_image_description_creator_icc_v4_get_user_data(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_creator_icc_v4); -} - -static inline uint32_t -xx_image_description_creator_icc_v4_get_version(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_icc_v4); -} - -/** @ingroup iface_xx_image_description_creator_icc_v4 */ -static inline void -xx_image_description_creator_icc_v4_destroy(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) -{ - wl_proxy_destroy((struct wl_proxy *) xx_image_description_creator_icc_v4); -} - -/** - * @ingroup iface_xx_image_description_creator_icc_v4 - * - * Create an image description object based on the ICC information - * previously set on this object. A compositor must parse the ICC data in - * some undefined but finite amount of time. - * - * The completeness of the parameter set is verified. If the set is not - * complete, the protocol error incomplete_set is raised. For the - * definition of a complete set, see the description of this interface. - * - * If the particular combination of the information is not supported - * by the compositor, the resulting image description object shall - * immediately deliver the xx_image_description_v4.failed event with the - * 'unsupported' cause. If a valid image description was created from the - * information, the xx_image_description_v4.ready event will eventually - * be sent instead. - * - * This request destroys the xx_image_description_creator_icc_v4 object. - * - * The resulting image description object does not allow get_information - * request. - */ -static inline struct xx_image_description_v4 * -xx_image_description_creator_icc_v4_create(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4) -{ - struct wl_proxy *image_description; - - image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_icc_v4, - XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_CREATE, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_icc_v4), WL_MARSHAL_FLAG_DESTROY, NULL); - - return (struct xx_image_description_v4 *) image_description; -} - -/** - * @ingroup iface_xx_image_description_creator_icc_v4 - * - * Sets the ICC profile file to be used as the basis of the image - * description. - * - * The data shall be found through the given fd at the given offset, having - * the given length. The fd must seekable and readable. Violating these - * requirements raises the bad_fd protocol error. - * - * If reading the data fails due to an error independent of the client, the - * compositor shall send the xx_image_description_v4.failed event on the - * created xx_image_description_v4 with the 'operating_system' cause. - * - * The maximum size of the ICC profile is 4 MB. If length is greater than - * that or zero, the protocol error bad_size is raised. If offset + length - * exceeds the file size, the protocol error out_of_file is raised. - * - * A compositor may read the file at any time starting from this request - * and only until whichever happens first: - * - If create request was issued, the xx_image_description_v4 object - * delivers either failed or ready event; or - * - if create request was not issued, this - * xx_image_description_creator_icc_v4 object is destroyed. - * - * A compositor shall not modify the contents of the file, and the fd may - * be sealed for writes and size changes. The client must ensure to its - * best ability that the data does not change while the compositor is - * reading it. - * - * The data must represent a valid ICC profile. The ICC profile version - * must be 2 or 4, it must be a 3 channel profile and the class must be - * Display or ColorSpace. Violating these requirements will not result in a - * protocol error but will eventually send the - * xx_image_description_v4.failed event on the created - * xx_image_description_v4 with the 'unsupported' cause. - * - * See the International Color Consortium specification ICC.1:2022 for more - * details about ICC profiles. - * - * If ICC file has already been set on this object, the protocol error - * already_set is raised. - */ -static inline void -xx_image_description_creator_icc_v4_set_icc_file(struct xx_image_description_creator_icc_v4 *xx_image_description_creator_icc_v4, int32_t icc_profile, uint32_t offset, uint32_t length) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_icc_v4, - XX_IMAGE_DESCRIPTION_CREATOR_ICC_V4_SET_ICC_FILE, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_icc_v4), 0, icc_profile, offset, length); -} - -#ifndef XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ENUM -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ENUM -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * protocol errors - */ -enum xx_image_description_creator_params_v4_error { - /** - * incomplete parameter set - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INCOMPLETE_SET = 0, - /** - * invalid combination of parameters - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INCONSISTENT_SET = 1, - /** - * property already set - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET = 2, - /** - * request not supported - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_UNSUPPORTED_FEATURE = 3, - /** - * invalid transfer characteristic - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_TF = 4, - /** - * invalid primaries or white point - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_PRIMARIES = 5, - /** - * invalid luminance value or range - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_LUMINANCE = 6, - /** - * invalid mastering information - */ - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_INVALID_MASTERING = 7, -}; -#endif /* XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ENUM */ - -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_CREATE 0 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_NAMED 1 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_POWER 2 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_NAMED 3 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES 4 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_LUMINANCES 5 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_DISPLAY_PRIMARIES 6 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_LUMINANCE 7 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_CLL 8 -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_FALL 9 - - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_CREATE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_NAMED_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_POWER_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_NAMED_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_LUMINANCES_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_DISPLAY_PRIMARIES_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_LUMINANCE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_CLL_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_creator_params_v4 - */ -#define XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_FALL_SINCE_VERSION 1 - -/** @ingroup iface_xx_image_description_creator_params_v4 */ -static inline void -xx_image_description_creator_params_v4_set_user_data(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_creator_params_v4, user_data); -} - -/** @ingroup iface_xx_image_description_creator_params_v4 */ -static inline void * -xx_image_description_creator_params_v4_get_user_data(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_creator_params_v4); -} - -static inline uint32_t -xx_image_description_creator_params_v4_get_version(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4); -} - -/** @ingroup iface_xx_image_description_creator_params_v4 */ -static inline void -xx_image_description_creator_params_v4_destroy(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) -{ - wl_proxy_destroy((struct wl_proxy *) xx_image_description_creator_params_v4); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Create an image description object based on the parameters previously - * set on this object. - * - * The completeness of the parameter set is verified. If the set is not - * complete, the protocol error incomplete_set is raised. For the - * definition of a complete set, see the description of this interface. - * - * Also, the combination of the parameter set is verified. If the set is - * not consistent, the protocol error inconsistent_set is raised. - * - * If the particular combination of the parameter set is not supported - * by the compositor, the resulting image description object shall - * immediately deliver the xx_image_description_v4.failed event with the - * 'unsupported' cause. If a valid image description was created from the - * parameter set, the xx_image_description_v4.ready event will eventually - * be sent instead. - * - * This request destroys the xx_image_description_creator_params_v4 - * object. - * - * The resulting image description object does not allow get_information - * request. - */ -static inline struct xx_image_description_v4 * -xx_image_description_creator_params_v4_create(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4) -{ - struct wl_proxy *image_description; - - image_description = wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_CREATE, &xx_image_description_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), WL_MARSHAL_FLAG_DESTROY, NULL); - - return (struct xx_image_description_v4 *) image_description; -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the transfer characteristic using explicitly enumerated named - * functions. - * - * When the resulting image description is attached to an image, the - * content should be encoded and decoded according to the industry standard - * practices for the transfer characteristic. - * - * Only names advertised with xx_color_manager_v4 event supported_tf_named - * are allowed. Other values shall raise the protocol error invalid_tf. - * - * If transfer characteristic has already been set on this object, the - * protocol error already_set is raised. - */ -static inline void -xx_image_description_creator_params_v4_set_tf_named(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t tf) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_NAMED, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, tf); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the color component transfer characteristic to a power curve with - * the given exponent. This curve represents the conversion from electrical - * to optical pixel or color values. - * - * When the resulting image description is attached to an image, the - * content should be encoded with the inverse of the power curve. - * - * The curve exponent shall be multiplied by 10000 to get the argument eexp - * value to carry the precision of 4 decimals. - * - * The curve exponent must be at least 1.0 and at most 10.0. Otherwise the - * protocol error invalid_tf is raised. - * - * If transfer characteristic has already been set on this object, the - * protocol error already_set is raised. - * - * This request can be used when the compositor advertises - * xx_color_manager_v4.feature.set_tf_power. Otherwise this request raises - * the protocol error unsupported_feature. - */ -static inline void -xx_image_description_creator_params_v4_set_tf_power(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t eexp) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_TF_POWER, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, eexp); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the color primaries and white point using explicitly named sets. - * This describes the primary color volume which is the basis for color - * value encoding. - * - * Only names advertised with xx_color_manager_v4 event - * supported_primaries_named are allowed. Other values shall raise the - * protocol error invalid_primaries. - * - * If primaries have already been set on this object, the protocol error - * already_set is raised. - */ -static inline void -xx_image_description_creator_params_v4_set_primaries_named(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t primaries) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES_NAMED, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, primaries); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the color primaries and white point using CIE 1931 xy chromaticity - * coordinates. This describes the primary color volume which is the basis - * for color value encoding. - * - * Each coordinate value is multiplied by 10000 to get the argument value - * to carry precision of 4 decimals. - * - * If primaries have already been set on this object, the protocol error - * already_set is raised. - * - * This request can be used if the compositor advertises - * xx_color_manager_v4.feature.set_primaries. Otherwise this request raises - * the protocol error unsupported_feature. - */ -static inline void -xx_image_description_creator_params_v4_set_primaries(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_PRIMARIES, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the primary color volume luminance range and the reference white - * luminance level. - * - * The default luminances are - * - primary color volume minimum: 0.2 cd/m² - * - primary color volume maximum: 80 cd/m² - * - reference white: 80 cd/m² - * - * Setting a named transfer characteristic can imply other default - * luminances. - * - * The default luminances get overwritten when this request is used. - * - * 'min_lum' and 'max_lum' specify the minimum and maximum luminances of - * the primary color volume as reproduced by the targeted display. - * - * 'reference_lum' specifies the luminance of the reference white as - * reproduced by the targeted display, and reflects the targeted viewing - * environment. - * - * Compositors should make sure that all content is anchored, meaning that - * an input signal level of 'reference_lum' on one image description and - * another input signal level of 'reference_lum' on another image - * description should produce the same output level, even though the - * 'reference_lum' on both image representations can be different. - * - * If 'max_lum' is less than the 'reference_lum', or 'reference_lum' is - * less than or equal to 'min_lum', the protocol error invalid_luminance is - * raised. - * - * The minimum luminance is multiplied by 10000 to get the argument - * 'min_lum' value and carries precision of 4 decimals. The maximum - * luminance and reference white luminance values are unscaled. - * - * If the primary color volume luminance range and the reference white - * luminance level have already been set on this object, the protocol error - * already_set is raised. - * - * This request can be used if the compositor advertises - * xx_color_manager_v4.feature.set_luminances. Otherwise this request - * raises the protocol error unsupported_feature. - */ -static inline void -xx_image_description_creator_params_v4_set_luminances(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_LUMINANCES, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, min_lum, max_lum, reference_lum); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Provides the color primaries and white point of the mastering display - * using CIE 1931 xy chromaticity coordinates. This is compatible with the - * SMPTE ST 2086 definition of HDR static metadata. - * - * The mastering display primaries define the target color volume. - * - * If mastering display primaries are not explicitly set, the target color - * volume is assumed to be equal to the primary color volume. - * - * The target color volume is defined by all tristimulus values between 0.0 - * and 1.0 (inclusive) of the color space defined by the given mastering - * display primaries and white point. The colorimetry is identical between - * the container color space and the mastering display color space, - * including that no chromatic adaptation is applied even if the white - * points differ. - * - * The target color volume can exceed the primary color volume to allow for - * a greater color volume with an existing color space definition (for - * example scRGB). It can be smaller than the primary color volume to - * minimize gamut and tone mapping distances for big color spaces (HDR - * metadata). - * - * To make use of the entire target color volume a suitable pixel format - * has to be chosen (e.g. floating point to exceed the primary color - * volume, or abusing limited quantization range as with xvYCC). - * - * Each coordinate value is multiplied by 10000 to get the argument value - * to carry precision of 4 decimals. - * - * If mastering display primaries have already been set on this object, the - * protocol error already_set is raised. - * - * This request can be used if the compositor advertises - * xx_color_manager_v4.feature.set_mastering_display_primaries. Otherwise - * this request raises the protocol error unsupported_feature. The - * advertisement implies support only for target color volumes fully - * contained within the primary color volume. - * - * If a compositor additionally supports target color volume exceeding the - * primary color volume, it must advertise - * xx_color_manager_v4.feature.extended_target_volume. If a client uses - * target color volume exceeding the primary color volume and the - * compositor does not support it, the result is implementation defined. - * Compositors are recommended to detect this case and fail the image - * description gracefully, but it may as well result in color artifacts. - */ -static inline void -xx_image_description_creator_params_v4_set_mastering_display_primaries(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_DISPLAY_PRIMARIES, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the luminance range that was used during the content mastering - * process as the minimum and maximum absolute luminance L. This is - * compatible with the SMPTE ST 2086 definition of HDR static metadata. - * - * The mastering luminance range is undefined by default. - * - * If max L is less than or equal to min L, the protocol error - * invalid_luminance is raised. - * - * Min L value is multiplied by 10000 to get the argument min_lum value - * and carry precision of 4 decimals. Max L value is unscaled for max_lum. - */ -static inline void -xx_image_description_creator_params_v4_set_mastering_luminance(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t min_lum, uint32_t max_lum) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MASTERING_LUMINANCE, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, min_lum, max_lum); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the maximum content light level (max_cll) as defined by CTA-861-H. - * - * This can only be set when set_tf_cicp is used to set the transfer - * characteristic to Rec. ITU-R BT.2100-2 perceptual quantization system. - * Otherwise, 'create' request shall raise inconsistent_set protocol - * error. - * - * max_cll is undefined by default. - */ -static inline void -xx_image_description_creator_params_v4_set_max_cll(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t max_cll) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_CLL, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, max_cll); -} - -/** - * @ingroup iface_xx_image_description_creator_params_v4 - * - * Sets the maximum frame-average light level (max_fall) as defined by - * CTA-861-H. - * - * This can only be set when set_tf_cicp is used to set the transfer - * characteristic to Rec. ITU-R BT.2100-2 perceptual quantization system. - * Otherwise, 'create' request shall raise inconsistent_set protocol error. - * - * max_fall is undefined by default. - */ -static inline void -xx_image_description_creator_params_v4_set_max_fall(struct xx_image_description_creator_params_v4 *xx_image_description_creator_params_v4, uint32_t max_fall) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_creator_params_v4, - XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_SET_MAX_FALL, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_creator_params_v4), 0, max_fall); -} - -#ifndef XX_IMAGE_DESCRIPTION_V4_ERROR_ENUM -#define XX_IMAGE_DESCRIPTION_V4_ERROR_ENUM -/** - * @ingroup iface_xx_image_description_v4 - * protocol errors - */ -enum xx_image_description_v4_error { - /** - * attempted to use an object which is not ready - */ - XX_IMAGE_DESCRIPTION_V4_ERROR_NOT_READY = 0, - /** - * get_information not allowed - */ - XX_IMAGE_DESCRIPTION_V4_ERROR_NO_INFORMATION = 1, -}; -#endif /* XX_IMAGE_DESCRIPTION_V4_ERROR_ENUM */ - -#ifndef XX_IMAGE_DESCRIPTION_V4_CAUSE_ENUM -#define XX_IMAGE_DESCRIPTION_V4_CAUSE_ENUM -/** - * @ingroup iface_xx_image_description_v4 - * generic reason for failure - */ -enum xx_image_description_v4_cause { - /** - * interface version too low - */ - XX_IMAGE_DESCRIPTION_V4_CAUSE_LOW_VERSION = 0, - /** - * unsupported image description data - */ - XX_IMAGE_DESCRIPTION_V4_CAUSE_UNSUPPORTED = 1, - /** - * error independent of the client - */ - XX_IMAGE_DESCRIPTION_V4_CAUSE_OPERATING_SYSTEM = 2, - /** - * the relevant output no longer exists - */ - XX_IMAGE_DESCRIPTION_V4_CAUSE_NO_OUTPUT = 3, -}; -#endif /* XX_IMAGE_DESCRIPTION_V4_CAUSE_ENUM */ - -/** - * @ingroup iface_xx_image_description_v4 - * @struct xx_image_description_v4_listener - */ -struct xx_image_description_v4_listener { - /** - * graceful error on creating the image description - * - * If creating a xx_image_description_v4 object fails for a - * reason that is not defined as a protocol error, this event is - * sent. - * - * The requests that create image description objects define - * whether and when this can occur. Only such creation requests can - * trigger this event. This event cannot be triggered after the - * image description was successfully formed. - * - * Once this event has been sent, the xx_image_description_v4 - * object will never become ready and it can only be destroyed. - * @param cause generic reason - * @param msg ad hoc human-readable explanation - */ - void (*failed)(void *data, - struct xx_image_description_v4 *xx_image_description_v4, - uint32_t cause, - const char *msg); - /** - * indication that the object is ready to be used - * - * Once this event has been sent, the xx_image_description_v4 - * object is deemed "ready". Ready objects can be used to send - * requests and can be used through other interfaces. - * - * Every ready xx_image_description_v4 protocol object refers to an - * underlying image description record in the compositor. Multiple - * protocol objects may end up referring to the same record. - * Clients may identify these "copies" by comparing their id - * numbers: if the numbers from two protocol objects are identical, - * the protocol objects refer to the same image description record. - * Two different image description records cannot have the same id - * number simultaneously. The id number does not change during the - * lifetime of the image description record. - * - * The id number is valid only as long as the protocol object is - * alive. If all protocol objects referring to the same image - * description record are destroyed, the id number may be recycled - * for a different image description record. - * - * Image description id number is not a protocol object id. Zero is - * reserved as an invalid id number. It shall not be possible for a - * client to refer to an image description by its id number in - * protocol. The id numbers might not be portable between Wayland - * connections. - * - * This identity allows clients to de-duplicate image description - * records and avoid get_information request if they already have - * the image description information. - * @param identity image description id number - */ - void (*ready)(void *data, - struct xx_image_description_v4 *xx_image_description_v4, - uint32_t identity); -}; - -/** - * @ingroup iface_xx_image_description_v4 - */ -static inline int -xx_image_description_v4_add_listener(struct xx_image_description_v4 *xx_image_description_v4, - const struct xx_image_description_v4_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xx_image_description_v4, - (void (**)(void)) listener, data); -} - -#define XX_IMAGE_DESCRIPTION_V4_DESTROY 0 -#define XX_IMAGE_DESCRIPTION_V4_GET_INFORMATION 1 - -/** - * @ingroup iface_xx_image_description_v4 - */ -#define XX_IMAGE_DESCRIPTION_V4_FAILED_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_v4 - */ -#define XX_IMAGE_DESCRIPTION_V4_READY_SINCE_VERSION 1 - -/** - * @ingroup iface_xx_image_description_v4 - */ -#define XX_IMAGE_DESCRIPTION_V4_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_v4 - */ -#define XX_IMAGE_DESCRIPTION_V4_GET_INFORMATION_SINCE_VERSION 1 - -/** @ingroup iface_xx_image_description_v4 */ -static inline void -xx_image_description_v4_set_user_data(struct xx_image_description_v4 *xx_image_description_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_v4, user_data); -} - -/** @ingroup iface_xx_image_description_v4 */ -static inline void * -xx_image_description_v4_get_user_data(struct xx_image_description_v4 *xx_image_description_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_v4); -} - -static inline uint32_t -xx_image_description_v4_get_version(struct xx_image_description_v4 *xx_image_description_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_image_description_v4); -} - -/** - * @ingroup iface_xx_image_description_v4 - * - * Destroy this object. It is safe to destroy an object which is not ready. - * - * Destroying a xx_image_description_v4 object has no side-effects, not - * even if a xx_color_management_surface_v4.set_image_description has not - * yet been followed by a wl_surface.commit. - */ -static inline void -xx_image_description_v4_destroy(struct xx_image_description_v4 *xx_image_description_v4) -{ - wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_v4, - XX_IMAGE_DESCRIPTION_V4_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xx_image_description_v4), WL_MARSHAL_FLAG_DESTROY); -} - -/** - * @ingroup iface_xx_image_description_v4 - * - * Creates a xx_image_description_info_v4 object which delivers the - * information that makes up the image description. - * - * Not all image description protocol objects allow get_information - * request. Whether it is allowed or not is defined by the request that - * created the object. If get_information is not allowed, the protocol - * error no_information is raised. - */ -static inline struct xx_image_description_info_v4 * -xx_image_description_v4_get_information(struct xx_image_description_v4 *xx_image_description_v4) -{ - struct wl_proxy *information; - - information = wl_proxy_marshal_flags((struct wl_proxy *) xx_image_description_v4, - XX_IMAGE_DESCRIPTION_V4_GET_INFORMATION, &xx_image_description_info_v4_interface, wl_proxy_get_version((struct wl_proxy *) xx_image_description_v4), 0, NULL); - - return (struct xx_image_description_info_v4 *) information; -} - -/** - * @ingroup iface_xx_image_description_info_v4 - * @struct xx_image_description_info_v4_listener - */ -struct xx_image_description_info_v4_listener { - /** - * end of information - * - * Signals the end of information events and destroys the object. - */ - void (*done)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4); - /** - * ICC profile matching the image description - * - * The icc argument provides a file descriptor to the client - * which may be memory-mapped to provide the ICC profile matching - * the image description. The fd is read-only, and if mapped then - * it must be mapped with MAP_PRIVATE by the client. - * - * The ICC profile version and other details are determined by the - * compositor. There is no provision for a client to ask for a - * specific kind of a profile. - * @param icc ICC profile file descriptor - * @param icc_size ICC profile size, in bytes - */ - void (*icc_file)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - int32_t icc, - uint32_t icc_size); - /** - * primaries as chromaticity coordinates - * - * Delivers the primary color volume primaries and white point - * using CIE 1931 xy chromaticity coordinates. - * - * Each coordinate value is multiplied by 10000 to get the argument - * value to carry precision of 4 decimals. - * @param r_x Red x * 10000 - * @param r_y Red y * 10000 - * @param g_x Green x * 10000 - * @param g_y Green y * 10000 - * @param b_x Blue x * 10000 - * @param b_y Blue y * 10000 - * @param w_x White x * 10000 - * @param w_y White y * 10000 - */ - void (*primaries)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - int32_t r_x, - int32_t r_y, - int32_t g_x, - int32_t g_y, - int32_t b_x, - int32_t b_y, - int32_t w_x, - int32_t w_y); - /** - * named primaries - * - * Delivers the primary color volume primaries and white point - * using an explicitly enumerated named set. - * @param primaries named primaries - */ - void (*primaries_named)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - uint32_t primaries); - /** - * transfer characteristic as a power curve - * - * The color component transfer characteristic of this image - * description is a pure power curve. This event provides the - * exponent of the power function. This curve represents the - * conversion from electrical to optical pixel or color values. - * - * The curve exponent has been multiplied by 10000 to get the - * argument eexp value to carry the precision of 4 decimals. - * @param eexp the exponent * 10000 - */ - void (*tf_power)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - uint32_t eexp); - /** - * named transfer characteristic - * - * Delivers the transfer characteristic using an explicitly - * enumerated named function. - * @param tf named transfer function - */ - void (*tf_named)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - uint32_t tf); - /** - * primary color volume luminance range and reference white - * - * Delivers the primary color volume luminance range and the - * reference white luminance level. - * - * The minimum luminance is multiplied by 10000 to get the argument - * 'min_lum' value and carries precision of 4 decimals. The maximum - * luminance and reference white luminance values are unscaled. - * @param min_lum minimum luminance (cd/m²) * 10000 - * @param max_lum maximum luminance (cd/m²) - * @param reference_lum reference white luminance (cd/m²) - */ - void (*luminances)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - uint32_t min_lum, - uint32_t max_lum, - uint32_t reference_lum); - /** - * target primaries as chromaticity coordinates - * - * Provides the color primaries and white point of the target - * color volume using CIE 1931 xy chromaticity coordinates. This is - * compatible with the SMPTE ST 2086 definition of HDR static - * metadata for mastering displays. - * - * While primary color volume is about how color is encoded, the - * target color volume is the actually displayable color volume. If - * target color volume is equal to the primary color volume, then - * this event is not sent. - * - * Each coordinate value is multiplied by 10000 to get the argument - * value to carry precision of 4 decimals. - * @param r_x Red x * 10000 - * @param r_y Red y * 10000 - * @param g_x Green x * 10000 - * @param g_y Green y * 10000 - * @param b_x Blue x * 10000 - * @param b_y Blue y * 10000 - * @param w_x White x * 10000 - * @param w_y White y * 10000 - */ - void (*target_primaries)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - int32_t r_x, - int32_t r_y, - int32_t g_x, - int32_t g_y, - int32_t b_x, - int32_t b_y, - int32_t w_x, - int32_t w_y); - /** - * target luminance range - * - * Provides the luminance range that the image description is - * targeting as the minimum and maximum absolute luminance L. This - * is compatible with the SMPTE ST 2086 definition of HDR static - * metadata. - * - * This luminance range is only theoretical and may not correspond - * to the luminance of light emitted on an actual display. - * - * Min L value is multiplied by 10000 to get the argument min_lum - * value and carry precision of 4 decimals. Max L value is unscaled - * for max_lum. - * @param min_lum min L (cd/m²) * 10000 - * @param max_lum max L (cd/m²) - */ - void (*target_luminance)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - uint32_t min_lum, - uint32_t max_lum); - /** - * target maximum content light level - * - * Provides the targeted max_cll of the image description. - * max_cll is defined by CTA-861-H. - * - * This luminance is only theoretical and may not correspond to the - * luminance of light emitted on an actual display. - * @param max_cll Maximum content light-level (cd/m²) - */ - void (*target_max_cll)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - uint32_t max_cll); - /** - * target maximum frame-average light level - * - * Provides the targeted max_fall of the image description. - * max_fall is defined by CTA-861-H. - * - * This luminance is only theoretical and may not correspond to the - * luminance of light emitted on an actual display. - * @param max_fall Maximum frame-average light level (cd/m²) - */ - void (*target_max_fall)(void *data, - struct xx_image_description_info_v4 *xx_image_description_info_v4, - uint32_t max_fall); -}; - -/** - * @ingroup iface_xx_image_description_info_v4 - */ -static inline int -xx_image_description_info_v4_add_listener(struct xx_image_description_info_v4 *xx_image_description_info_v4, - const struct xx_image_description_info_v4_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) xx_image_description_info_v4, - (void (**)(void)) listener, data); -} - -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_DONE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_ICC_FILE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_PRIMARIES_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_PRIMARIES_NAMED_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_TF_POWER_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_TF_NAMED_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_LUMINANCES_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_PRIMARIES_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_LUMINANCE_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_MAX_CLL_SINCE_VERSION 1 -/** - * @ingroup iface_xx_image_description_info_v4 - */ -#define XX_IMAGE_DESCRIPTION_INFO_V4_TARGET_MAX_FALL_SINCE_VERSION 1 - - -/** @ingroup iface_xx_image_description_info_v4 */ -static inline void -xx_image_description_info_v4_set_user_data(struct xx_image_description_info_v4 *xx_image_description_info_v4, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) xx_image_description_info_v4, user_data); -} - -/** @ingroup iface_xx_image_description_info_v4 */ -static inline void * -xx_image_description_info_v4_get_user_data(struct xx_image_description_info_v4 *xx_image_description_info_v4) -{ - return wl_proxy_get_user_data((struct wl_proxy *) xx_image_description_info_v4); -} - -static inline uint32_t -xx_image_description_info_v4_get_version(struct xx_image_description_info_v4 *xx_image_description_info_v4) -{ - return wl_proxy_get_version((struct wl_proxy *) xx_image_description_info_v4); -} - -/** @ingroup iface_xx_image_description_info_v4 */ -static inline void -xx_image_description_info_v4_destroy(struct xx_image_description_info_v4 *xx_image_description_info_v4) -{ - wl_proxy_destroy((struct wl_proxy *) xx_image_description_info_v4); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c b/src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c deleted file mode 100644 index ff768a342..000000000 --- a/src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c +++ /dev/null @@ -1,199 +0,0 @@ -/* Generated by wayland-scanner 1.23.1 */ - -/* - * Copyright 2019 Sebastian Wick - * Copyright 2019 Erwin Burema - * Copyright 2020 AMD - * Copyright 2020-2024 Collabora, Ltd. - * Copyright 2024 Xaver Hugl - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include -#include -#include -#include - -extern const struct wl_interface wl_output_interface; -extern const struct wl_interface wl_surface_interface; -extern const struct wl_interface xx_color_management_feedback_surface_v4_interface; -extern const struct wl_interface xx_color_management_output_v4_interface; -extern const struct wl_interface xx_color_management_surface_v4_interface; -extern const struct wl_interface xx_image_description_creator_icc_v4_interface; -extern const struct wl_interface xx_image_description_creator_params_v4_interface; -extern const struct wl_interface xx_image_description_info_v4_interface; -extern const struct wl_interface xx_image_description_v4_interface; - -static const struct wl_interface *color_management_v1_types[] = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - &xx_color_management_output_v4_interface, - NULL, // &wl_output_interface, - &xx_color_management_surface_v4_interface, - NULL, // &wl_surface_interface, - &xx_color_management_feedback_surface_v4_interface, - NULL, //&wl_surface_interface, - &xx_image_description_creator_icc_v4_interface, - &xx_image_description_creator_params_v4_interface, - &xx_image_description_v4_interface, - &xx_image_description_v4_interface, - NULL, - &xx_image_description_v4_interface, - &xx_image_description_v4_interface, - &xx_image_description_v4_interface, - &xx_image_description_info_v4_interface, -}; - -static const struct wl_message xx_color_manager_v4_requests[] = { - { "destroy", "", color_management_v1_types + 0 }, - { "get_output", "no", color_management_v1_types + 8 }, - { "get_surface", "no", color_management_v1_types + 10 }, - { "get_feedback_surface", "no", color_management_v1_types + 12 }, - { "new_icc_creator", "n", color_management_v1_types + 14 }, - { "new_parametric_creator", "n", color_management_v1_types + 15 }, -}; - -static const struct wl_message xx_color_manager_v4_events[] = { - { "supported_intent", "u", color_management_v1_types + 0 }, - { "supported_feature", "u", color_management_v1_types + 0 }, - { "supported_tf_named", "u", color_management_v1_types + 0 }, - { "supported_primaries_named", "u", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_color_manager_v4_interface = { - "xx_color_manager_v4", 1, - 6, xx_color_manager_v4_requests, - 4, xx_color_manager_v4_events, -}; - -static const struct wl_message xx_color_management_output_v4_requests[] = { - { "destroy", "", color_management_v1_types + 0 }, - { "get_image_description", "n", color_management_v1_types + 16 }, -}; - -static const struct wl_message xx_color_management_output_v4_events[] = { - { "image_description_changed", "", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_color_management_output_v4_interface = { - "xx_color_management_output_v4", 1, - 2, xx_color_management_output_v4_requests, - 1, xx_color_management_output_v4_events, -}; - -static const struct wl_message xx_color_management_surface_v4_requests[] = { - { "destroy", "", color_management_v1_types + 0 }, - { "set_image_description", "ou", color_management_v1_types + 17 }, - { "unset_image_description", "", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_color_management_surface_v4_interface = { - "xx_color_management_surface_v4", 1, - 3, xx_color_management_surface_v4_requests, - 0, NULL, -}; - -static const struct wl_message xx_color_management_feedback_surface_v4_requests[] = { - { "destroy", "", color_management_v1_types + 0 }, - { "get_preferred", "n", color_management_v1_types + 19 }, -}; - -static const struct wl_message xx_color_management_feedback_surface_v4_events[] = { - { "preferred_changed", "", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_color_management_feedback_surface_v4_interface = { - "xx_color_management_feedback_surface_v4", 1, - 2, xx_color_management_feedback_surface_v4_requests, - 1, xx_color_management_feedback_surface_v4_events, -}; - -static const struct wl_message xx_image_description_creator_icc_v4_requests[] = { - { "create", "n", color_management_v1_types + 20 }, - { "set_icc_file", "huu", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_image_description_creator_icc_v4_interface = { - "xx_image_description_creator_icc_v4", 1, - 2, xx_image_description_creator_icc_v4_requests, - 0, NULL, -}; - -static const struct wl_message xx_image_description_creator_params_v4_requests[] = { - { "create", "n", color_management_v1_types + 21 }, - { "set_tf_named", "u", color_management_v1_types + 0 }, - { "set_tf_power", "u", color_management_v1_types + 0 }, - { "set_primaries_named", "u", color_management_v1_types + 0 }, - { "set_primaries", "iiiiiiii", color_management_v1_types + 0 }, - { "set_luminances", "uuu", color_management_v1_types + 0 }, - { "set_mastering_display_primaries", "iiiiiiii", color_management_v1_types + 0 }, - { "set_mastering_luminance", "uu", color_management_v1_types + 0 }, - { "set_max_cll", "u", color_management_v1_types + 0 }, - { "set_max_fall", "u", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_image_description_creator_params_v4_interface = { - "xx_image_description_creator_params_v4", 1, - 10, xx_image_description_creator_params_v4_requests, - 0, NULL, -}; - -static const struct wl_message xx_image_description_v4_requests[] = { - { "destroy", "", color_management_v1_types + 0 }, - { "get_information", "n", color_management_v1_types + 22 }, -}; - -static const struct wl_message xx_image_description_v4_events[] = { - { "failed", "us", color_management_v1_types + 0 }, - { "ready", "u", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_image_description_v4_interface = { - "xx_image_description_v4", 1, - 2, xx_image_description_v4_requests, - 2, xx_image_description_v4_events, -}; - -static const struct wl_message xx_image_description_info_v4_events[] = { - { "done", "", color_management_v1_types + 0 }, - { "icc_file", "hu", color_management_v1_types + 0 }, - { "primaries", "iiiiiiii", color_management_v1_types + 0 }, - { "primaries_named", "u", color_management_v1_types + 0 }, - { "tf_power", "u", color_management_v1_types + 0 }, - { "tf_named", "u", color_management_v1_types + 0 }, - { "luminances", "uuu", color_management_v1_types + 0 }, - { "target_primaries", "iiiiiiii", color_management_v1_types + 0 }, - { "target_luminance", "uu", color_management_v1_types + 0 }, - { "target_max_cll", "u", color_management_v1_types + 0 }, - { "target_max_fall", "u", color_management_v1_types + 0 }, -}; - -WL_EXPORT const struct wl_interface xx_image_description_info_v4_interface = { - "xx_image_description_info_v4", 1, - 0, NULL, - 11, xx_image_description_info_v4_events, -}; From 0b4a6055c6a380abf242c355c16a3d04d06e10c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 13 Jan 2025 10:41:11 +0800 Subject: [PATCH 10/19] Logo (Builtin): add netbsd_small --- src/logo/ascii/netbsd_small.txt | 8 ++++++++ src/logo/builtin.c | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/logo/ascii/netbsd_small.txt diff --git a/src/logo/ascii/netbsd_small.txt b/src/logo/ascii/netbsd_small.txt new file mode 100644 index 000000000..b37056c0b --- /dev/null +++ b/src/logo/ascii/netbsd_small.txt @@ -0,0 +1,8 @@ +$2 \\$1`-______,----__ +$2 \\ $1 __,---`_ +$2 \\ $1 `.____ +$2 \\$1-______,----`- +$2 \\ +$2 \\ +$2 \\ +$2 \\ \ No newline at end of file diff --git a/src/logo/builtin.c b/src/logo/builtin.c index a940abb34..711735d0e 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -3075,10 +3075,22 @@ static const FFlogo N[] = { }, // NetBSD { - .names = {"netbsd"}, + .names = {"NetBSD"}, .lines = FASTFETCH_DATATEXT_LOGO_NETBSD, .colors = { - FF_COLOR_FG_MAGENTA, + FF_COLOR_FG_RED, + FF_COLOR_FG_WHITE, + }, + .colorKeys = FF_COLOR_FG_RED, + .colorTitle = FF_COLOR_FG_WHITE, + }, + // NetBSD Small + { + .names = {"NetBSD_small"}, + .lines = FASTFETCH_DATATEXT_LOGO_NETBSD_SMALL, + .type = FF_LOGO_LINE_TYPE_SMALL_BIT, + .colors = { + FF_COLOR_FG_RED, FF_COLOR_FG_WHITE, }, .colorKeys = FF_COLOR_FG_MAGENTA, From 41e22ea8667bb7f27b0b0da83240ab13b7d85d90 Mon Sep 17 00:00:00 2001 From: carterli Date: Mon, 13 Jan 2025 18:29:18 +0800 Subject: [PATCH 11/19] Memory (OpenBSD): update formula to be consistant with other systems --- src/detection/memory/memory_obsd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/detection/memory/memory_obsd.c b/src/detection/memory/memory_obsd.c index 3dda7656a..e58bf0d37 100644 --- a/src/detection/memory/memory_obsd.c +++ b/src/detection/memory/memory_obsd.c @@ -2,10 +2,7 @@ #include "common/sysctl.h" #include - -#if __NetBSD__ - #include -#endif +#include const char* ffDetectMemory(FFMemoryResult* ram) { @@ -15,7 +12,7 @@ const char* ffDetectMemory(FFMemoryResult* ram) return "sysctl(CTL_VM, VM_UVMEXP) failed"; ram->bytesTotal = (uint64_t) buf.npages * instance.state.platform.sysinfo.pageSize; - ram->bytesUsed = ram->bytesTotal - (uint64_t) buf.free * instance.state.platform.sysinfo.pageSize; + ram->bytesUsed = ((uint64_t) buf.active + (uint64_t) buf.inactive + (uint64_t) buf.wired) * instance.state.platform.sysinfo.pageSize; return NULL; } From fc969b01c72ce8d0f9e0f6754bb7ff962d48f781 Mon Sep 17 00:00:00 2001 From: carterli Date: Mon, 13 Jan 2025 18:33:05 +0800 Subject: [PATCH 12/19] Memory (NetBSD): change formula to be consistant with other systems --- CMakeLists.txt | 2 +- src/detection/memory/memory_bsd.c | 8 +------- src/detection/memory/memory_nbsd.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 src/detection/memory/memory_nbsd.c diff --git a/CMakeLists.txt b/CMakeLists.txt index d524a7ada..d46d79153 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -752,7 +752,7 @@ elseif(NetBSD) src/detection/localip/localip_linux.c src/detection/gamepad/gamepad_nosupport.c src/detection/media/media_linux.c - src/detection/memory/memory_obsd.c + src/detection/memory/memory_nbsd.c src/detection/mouse/mouse_nosupport.c src/detection/netio/netio_bsd.c src/detection/opengl/opengl_linux.c diff --git a/src/detection/memory/memory_bsd.c b/src/detection/memory/memory_bsd.c index 587ca7f1f..0db20527a 100644 --- a/src/detection/memory/memory_bsd.c +++ b/src/detection/memory/memory_bsd.c @@ -4,13 +4,7 @@ const char* ffDetectMemory(FFMemoryResult* ram) { size_t length = sizeof(ram->bytesTotal); - if (sysctl((int[]){ CTL_HW, -#if __NetBSD__ - HW_PHYSMEM64 -#else - HW_PHYSMEM -#endif - }, 2, &ram->bytesTotal, &length, NULL, 0)) + if (sysctl((int[]){ CTL_HW, HW_PHYSMEM }, 2, &ram->bytesTotal, &length, NULL, 0)) return "Failed to read hw.physmem"; // vm.stats.vm.* are int values diff --git a/src/detection/memory/memory_nbsd.c b/src/detection/memory/memory_nbsd.c new file mode 100644 index 000000000..651058686 --- /dev/null +++ b/src/detection/memory/memory_nbsd.c @@ -0,0 +1,18 @@ +#include "memory.h" +#include "common/sysctl.h" + +#include +#include + +const char* ffDetectMemory(FFMemoryResult* ram) +{ + struct uvmexp_sysctl buf; + size_t length = sizeof(buf); + if (sysctl((int[]){ CTL_VM, VM_UVMEXP2 }, 2, &buf, &length, NULL, 0) < 0) + return "sysctl(CTL_VM, VM_UVMEXP2) failed"; + + ram->bytesTotal = (uint64_t) buf.npages * instance.state.platform.sysinfo.pageSize; + ram->bytesUsed = ((uint64_t) buf.active + (uint64_t) buf.inactive + (uint64_t) buf.wired) * instance.state.platform.sysinfo.pageSize; + + return NULL; +} From 3ed5a250a46a319159609794b386de6b019e3294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 13 Jan 2025 13:39:07 +0800 Subject: [PATCH 13/19] Logo (Builtin): add HeliumOS --- src/logo/ascii/heliumos.txt | 20 ++++++++++++++++++++ src/logo/builtin.c | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/logo/ascii/heliumos.txt diff --git a/src/logo/ascii/heliumos.txt b/src/logo/ascii/heliumos.txt new file mode 100644 index 000000000..30430cd4e --- /dev/null +++ b/src/logo/ascii/heliumos.txt @@ -0,0 +1,20 @@ + ,,╥╥╥╦╦╦╥╥,, + ,╓╦Ñ╨^`_,,,,,,. `"╨╩Nw + ,╥Ñ^`,╥╦╫╫╫╫╫╫╫╫╫╫╫╫ÑN≥,`╙Ñ╦_ + ,j╩_,╦Ñ╙╙╩╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╨╨╩N,`╨N, + j╩_╓╫╫Ñ ]N ]╫╫╫╫╫╫╫╫╫╫╫╫_]N ]╫Ñw_╩N + ,╫^ ]╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫N_╙╫ + _╫`,╫╫╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫╫╫ `╫ + ÑH ╫╫╫╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫╫╫╫_]Ñ +j╫ ]╫╫╫╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫╫╫╫H ╫H +j╫ ╟╫╫╫╫╫╫Ñ ╫╫,,,,,,,,,,,,,,,╫╫ ]╫╫╫╫╫╫╫ ╠N +j╫ ]╫╫╫╫╫╫Ñ ╫╫```````````````╫╫ ]╫╫╫╫╫╫╫ 1╡ + ╫_j╫╫╫╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫╫╫╫N ╫H + ╟H_╫╫╫╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫╫╫╫ jÑ + _╫╕ ╫╫╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫╫╫ ,╫ + ╫╥ ╩╫╫╫Ñ ╫╫ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╫╫ ]╫╫╫Ñ ╓Ñ + _╚N_`╫╫Ñ ╩╩ ]╫╫╫╫╫╫╫╫╫╫╫╫ ╩╩ 1╫Ñ`,jÑ_ + `╩N,`╨N╦╦Ñ╫╫╫╫╫╫╫╫╫╫╫╫╫N╦╥]╩`,╦╩` + _╙Ñ╦,`"╩Ñ╫╫╫╫╫╫╫╫╫╫╫Ñ╩^`,╥Ñ^_ + _"╨N╦w,_ `````_ ,╓╦N╩^ + __`"^╙╙╨╙╙^^`__ \ No newline at end of file diff --git a/src/logo/builtin.c b/src/logo/builtin.c index 711735d0e..2cd9d9e82 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -2047,6 +2047,16 @@ static const FFlogo H[] = { FF_COLOR_FG_256 "123", }, }, + // HeliumOS + { + .names = {"HeliumOS"}, + .lines = FASTFETCH_DATATEXT_LOGO_HELIUMOS, + .colors = { + FF_COLOR_FG_256 "81", + }, + .colorKeys = FF_COLOR_FG_256 "81", + .colorTitle = FF_COLOR_FG_DEFAULT, + }, // Huawei Cloud EulerOS { .names = {"Huawei Cloud EulerOS", "hce"}, From 9f9e3dd93148b41ef13e42f0dee5f235d47988c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 13 Jan 2025 13:42:20 +0800 Subject: [PATCH 14/19] Logo (Builtin): add Oreon --- src/logo/ascii/oreon.txt | 22 ++++++++++++++++++++++ src/logo/builtin.c | 9 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/logo/ascii/oreon.txt diff --git a/src/logo/ascii/oreon.txt b/src/logo/ascii/oreon.txt new file mode 100644 index 000000000..73fce33ec --- /dev/null +++ b/src/logo/ascii/oreon.txt @@ -0,0 +1,22 @@ + @@@@@@@@@@ + @@@@@@@@@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@@ @@@@@@@@@@@ + @@@@@@@@ @@@@@@@@@ + @@@@@@@@ @@@@@@@@ + @@@@@@@ @@@@@@@ + @@@@@@@@ @@@@@@@ + @@@@@@@@ @@@@@@ + @@@@@@@@@ @@@@@@ +@@@@@@@@@@ @@@@@@ +@@@@@@@@@@ @@@@@@ + @@@@@@@@@ @@@@@@ + @@@@@@@@ @@@@@@ + @@@@@@@@ @@@@@@@ + @@@@@@@ @@@@@@@ + @@@@@@@@ @@@@@@@@ + @@@@@@@@ @@@@@@@@ + @@@@@@@@@@ @@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@ + @@@@@@@@@@ \ No newline at end of file diff --git a/src/logo/builtin.c b/src/logo/builtin.c index 2cd9d9e82..4e7de88b3 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -3411,6 +3411,15 @@ static const FFlogo O[] = { .colorKeys = FF_COLOR_FG_WHITE, .colorTitle = FF_COLOR_FG_MAGENTA, }, + // Oreon + { + .names = {"Oreon"}, + .lines = FASTFETCH_DATATEXT_LOGO_OREON, + .colors = { + FF_COLOR_FG_DEFAULT, + FF_COLOR_FG_DEFAULT, + }, + }, // OS_Elbrus { .names = {"OS Elbrus"}, From 406062638208b58cd07941b0d291f6cb0a6bfb99 Mon Sep 17 00:00:00 2001 From: CELESTIFYX Team <96723939+XlebyllleK@users.noreply.github.com> Date: Mon, 13 Jan 2025 07:48:02 +0200 Subject: [PATCH 15/19] fix(logo): Rename *_LOGO_SMARTOS to *_LOGO_SNIGDHAOS (#1502) --- src/logo/builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logo/builtin.c b/src/logo/builtin.c index 4e7de88b3..e5a42ac05 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -4276,7 +4276,7 @@ static const FFlogo S[] = { // SnigdhaOS { .names = {"SnigdhaOS", "Snigdha"}, - .lines = FASTFETCH_DATATEXT_LOGO_SMARTOS, + .lines = FASTFETCH_DATATEXT_LOGO_SNIGDHAOS, .colors = { FF_COLOR_FG_CYAN, FF_COLOR_FG_WHITE, From ace336dfa9d69ec39f05a512dca3f99e1e7237e4 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Mon, 13 Jan 2025 14:55:53 +0800 Subject: [PATCH 16/19] Release: v2.34.1 --- CHANGELOG.md | 22 ++++++++++++++++++++++ CMakeLists.txt | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 543649764..0527f691a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +# 2.34.1 + +An early release to fix KDE Plasma 6.3 compatibility. Hopefully it can be accepted by package managers before KDE 6.3 is officially released. + +To package managers: if you find fastfetch bugs, it's highly appreciated if you can report them to the upstream, so that all users can benefit from the fix, instead of maintaining out-of-tree patches. Thanks! + +Features: +* Report vendor name when detecting GPUs by OpenGL + * Note: the vendor name is actually the creator of the OpenGL driver (such as `Mesa`) and may not be the same as the GPU vendor. + +Bugfixes: +* Fix Ghostty termfont detection (#1495, TerminalFont, macOS) +* Fix compatibility with KDE Plasma 6.3 (#1504, Display, Linux) +* Make memory usage detection logic consistant with other systems (Memory, OpenBSD / NetBSD) +* Report media file name if media title is not available (Media) +* Fix max frequency detection for CPUs with both performance and efficiency cores (CPU, FreeBSD) + +Logo: +* Add HeliumOS +* Add Oreon +* Update SnigdhaOS + # 2.34.0 Changes: diff --git a/CMakeLists.txt b/CMakeLists.txt index d46d79153..be052dfaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 2.34.0 + VERSION 2.34.1 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" From 373b4353bba03310f7bcbf25f3863ae257499c0b Mon Sep 17 00:00:00 2001 From: Carter Li Date: Mon, 13 Jan 2025 15:06:18 +0800 Subject: [PATCH 17/19] CPU (BSD): improve base freq detection --- src/detection/cpu/cpu_bsd.c | 3 ++- src/detection/cpu/cpu_nbsd.c | 3 +-- src/detection/cpu/cpu_obsd.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/detection/cpu/cpu_bsd.c b/src/detection/cpu/cpu_bsd.c index a2ce3e5a8..bf1f29394 100644 --- a/src/detection/cpu/cpu_bsd.c +++ b/src/detection/cpu/cpu_bsd.c @@ -73,9 +73,10 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) CPU_SET(1, ¤tCPU); CPU_SET(2, ¤tCPU); cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(cpuset_t), ¤tCPU); - ffCPUDetectSpeedByCpuid(cpu); #endif + ffCPUDetectSpeedByCpuid(cpu); + uint32_t clockrate = (uint32_t) ffSysctlGetInt("hw.clockrate", 0); if (clockrate > cpu->frequencyBase) cpu->frequencyBase = clockrate; cpu->temperature = FF_CPU_TEMP_UNSET; diff --git a/src/detection/cpu/cpu_nbsd.c b/src/detection/cpu/cpu_nbsd.c index 12e6bb4cd..4d9530b5a 100644 --- a/src/detection/cpu/cpu_nbsd.c +++ b/src/detection/cpu/cpu_nbsd.c @@ -58,8 +58,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) ffCPUDetectSpeedByCpuid(cpu); uint32_t freq = (uint32_t) ffSysctlGetInt("machdep.cpu.frequency.target", 0); - if (freq > cpu->frequencyBase) - cpu->frequencyBase = freq; + if (freq > cpu->frequencyBase) cpu->frequencyBase = freq; cpu->temperature = FF_CPU_TEMP_UNSET; diff --git a/src/detection/cpu/cpu_obsd.c b/src/detection/cpu/cpu_obsd.c index 298f064d6..33b754ddf 100644 --- a/src/detection/cpu/cpu_obsd.c +++ b/src/detection/cpu/cpu_obsd.c @@ -15,7 +15,9 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) ffCPUDetectSpeedByCpuid(cpu); - cpu->frequencyBase = (uint32_t) ffSysctlGetInt(CTL_HW, HW_CPUSPEED, 0); + uint32_t cpuspeed = (uint32_t) ffSysctlGetInt(CTL_HW, HW_CPUSPEED, 0); + if (cpuspeed > cpu->frequencyBase) cpu->frequencyBase = cpuspeed; + cpu->temperature = FF_CPU_TEMP_UNSET; if (options->temp) { From 8982b860f9ebdd8130ed7c6acee0bc62a72c94bc Mon Sep 17 00:00:00 2001 From: Carter Li Date: Mon, 13 Jan 2025 15:15:28 +0800 Subject: [PATCH 18/19] Chore: fix spelling --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0527f691a..07048761b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ Features: Bugfixes: * Fix Ghostty termfont detection (#1495, TerminalFont, macOS) * Fix compatibility with KDE Plasma 6.3 (#1504, Display, Linux) -* Make memory usage detection logic consistant with other systems (Memory, OpenBSD / NetBSD) +* Make memory usage detection logic consistent with other systems (Memory, OpenBSD / NetBSD) * Report media file name if media title is not available (Media) * Fix max frequency detection for CPUs with both performance and efficiency cores (CPU, FreeBSD) From dbcd5b922ac3138070684f75ab4b69763c99b0be Mon Sep 17 00:00:00 2001 From: Carter Li Date: Mon, 13 Jan 2025 15:39:16 +0800 Subject: [PATCH 19/19] Sound: fix a memleak --- src/detection/sound/sound_linux.c | 2 +- src/modules/sound/sound.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/detection/sound/sound_linux.c b/src/detection/sound/sound_linux.c index bd309aca0..8fc371d12 100644 --- a/src/detection/sound/sound_linux.c +++ b/src/detection/sound/sound_linux.c @@ -13,7 +13,7 @@ static void paSinkInfoCallback(pa_context *c, const pa_sink_info *i, int eol, vo FFSoundDevice* device = ffListAdd(userdata); ffStrbufInitS(&device->identifier, i->name); - ffStrbufInitS(&device->platformApi, "PulseAudio"); + ffStrbufInitStatic(&device->platformApi, "PulseAudio"); ffStrbufTrimRightSpace(&device->identifier); ffStrbufInitS(&device->name, i->description); ffStrbufTrimRightSpace(&device->name); diff --git a/src/modules/sound/sound.c b/src/modules/sound/sound.c index e91b378f4..93edf3e46 100644 --- a/src/modules/sound/sound.c +++ b/src/modules/sound/sound.c @@ -105,6 +105,7 @@ void ffPrintSound(FFSoundOptions* options) { ffStrbufDestroy(&device->identifier); ffStrbufDestroy(&device->name); + ffStrbufDestroy(&device->platformApi); } } @@ -226,6 +227,7 @@ void ffGenerateSoundJsonResult(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_m { ffStrbufDestroy(&device->identifier); ffStrbufDestroy(&device->name); + ffStrbufDestroy(&device->platformApi); } }