Created
August 10, 2025 09:58
-
-
Save kode54/e403449dfd133506684cedb3d359776a to your computer and use it in GitHub Desktop.
A collection of wlroots 0.20 patches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/types/wlr_color_management_v1.c b/types/wlr_color_management_v1.c | |
index 3af0b51e..c4addf1b 100644 | |
--- a/types/wlr_color_management_v1.c | |
+++ b/types/wlr_color_management_v1.c | |
@@ -868,9 +868,12 @@ static void manager_handle_create_parametric_creator(struct wl_client *client, | |
static void manager_handle_create_windows_scrgb(struct wl_client *client, | |
struct wl_resource *manager_resource, uint32_t id) { | |
- wl_resource_post_error(manager_resource, | |
- WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, | |
- "get_windows_scrgb is not supported"); | |
+ struct wlr_color_manager_v1 *manager = manager_from_resource(manager_resource); | |
+ struct wlr_image_description_v1_data data = { | |
+ .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, | |
+ .primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, | |
+ }; | |
+ image_desc_create_ready(manager, manager_resource, id, &data, true); | |
} | |
static const struct wp_color_manager_v1_interface manager_impl = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/types/wlr_color_management_v1.c b/types/wlr_color_management_v1.c | |
index 3af0b51e..9e91759f 100644 | |
--- a/types/wlr_color_management_v1.c | |
+++ b/types/wlr_color_management_v1.c | |
@@ -823,6 +824,16 @@ static void manager_handle_get_surface_feedback(struct wl_client *client, | |
.primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, | |
}; | |
+ struct wlr_color_management_output_v1 *cm_output; | |
+ wl_list_for_each(cm_output, &manager->outputs, link) { | |
+ const struct wlr_output_image_description *image_desc = cm_output->output->image_description; | |
+ if(image_desc) { | |
+ surface_feedback->data.tf_named = transfer_function_from_wlr(image_desc->transfer_function); | |
+ surface_feedback->data.primaries_named = named_primaries_from_wlr(image_desc->primaries); | |
+ break; | |
+ } | |
+ } | |
+ | |
surface_feedback->surface_destroy.notify = surface_feedback_handle_surface_destroy; | |
wl_signal_add(&surface->events.destroy, &surface_feedback->surface_destroy); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/render/vulkan/shaders/texture.frag b/render/vulkan/shaders/texture.frag | |
index 2a7e2c51..7d423395 100644 | |
--- a/render/vulkan/shaders/texture.frag | |
+++ b/render/vulkan/shaders/texture.frag | |
@@ -19,18 +19,11 @@ layout (constant_id = 0) const int TEXTURE_TRANSFORM = 0; | |
#define TEXTURE_TRANSFORM_SRGB 1 | |
#define TEXTURE_TRANSFORM_ST2084_PQ 2 | |
-float srgb_channel_to_linear(float x) { | |
- return mix(x / 12.92, | |
- pow((x + 0.055) / 1.055, 2.4), | |
- x > 0.04045); | |
-} | |
- | |
vec3 srgb_color_to_linear(vec3 color) { | |
- return vec3( | |
- srgb_channel_to_linear(color.r), | |
- srgb_channel_to_linear(color.g), | |
- srgb_channel_to_linear(color.b) | |
- ); | |
+ bvec3 isLow = lessThanEqual(color, vec3(0.04045)); | |
+ vec3 loPart = color / 12.92; | |
+ vec3 hiPart = pow((color + 0.055) / 1.055, vec3(12.0 / 5.0)); | |
+ return mix(hiPart, loPart, isLow); | |
} | |
vec3 pq_color_to_linear(vec3 color) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment