Merge branch 'wip/otte/for-kwin' into 'main'
Fix various issues with Kwin git See merge request GNOME/gtk!7612
This commit is contained in:
@@ -350,7 +350,8 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_U8_SRGB,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
},
|
||||
.name = "srgb",
|
||||
.no_srgb = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
@@ -367,6 +368,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_U8,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
},
|
||||
.name = "srgb-linear",
|
||||
.no_srgb = NULL,
|
||||
@@ -382,7 +384,8 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_FLOAT16,
|
||||
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
},
|
||||
.name = "rec2100-pq",
|
||||
.no_srgb = NULL,
|
||||
@@ -399,6 +402,7 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_FLOAT16,
|
||||
.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR,
|
||||
},
|
||||
.name = "rec2100-linear",
|
||||
.no_srgb = NULL,
|
||||
@@ -693,7 +697,8 @@ gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
self->parent.ref_count = 1;
|
||||
|
||||
/* sRGB is special-cased by being a default colorstate */
|
||||
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_LINEAR;
|
||||
self->parent.rendering_color_state = GDK_COLOR_STATE_REC2100_PQ;
|
||||
self->parent.rendering_color_state_linear = GDK_COLOR_STATE_REC2100_LINEAR;
|
||||
|
||||
self->parent.depth = GDK_MEMORY_FLOAT16;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ struct _GdkColorState
|
||||
|
||||
GdkMemoryDepth depth;
|
||||
GdkColorState *rendering_color_state;
|
||||
GdkColorState *rendering_color_state_linear;
|
||||
};
|
||||
|
||||
/* Note: self may be the source or the target colorstate */
|
||||
@@ -84,9 +85,9 @@ gdk_color_state_get_rendering_color_state (GdkColorState *self)
|
||||
self = GDK_COLOR_STATE_REC2100_PQ;
|
||||
|
||||
if (!GDK_DEBUG_CHECK (LINEAR))
|
||||
return self;
|
||||
return self->rendering_color_state;
|
||||
|
||||
return self->rendering_color_state;
|
||||
return self->rendering_color_state_linear;
|
||||
}
|
||||
|
||||
static inline GdkMemoryDepth
|
||||
|
||||
@@ -167,6 +167,12 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||
|
||||
/* if the texture fully covers the background, ignore it */
|
||||
if (background &&
|
||||
gsk_rect_contains_rect (dest, background) &&
|
||||
gdk_memory_format_alpha (gdk_texture_get_format (texture)) == GDK_MEMORY_ALPHA_OPAQUE)
|
||||
background = NULL;
|
||||
|
||||
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
|
||||
texture,
|
||||
source,
|
||||
|
||||
@@ -491,9 +491,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
|
||||
has_background = self->bg_rect.width > 0 && self->bg_rect.height > 0;
|
||||
|
||||
if (has_background)
|
||||
ensure_bg_surface (self);
|
||||
|
||||
if (!scaled_rect_is_integral (dest, 1, &device_rect))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
@@ -669,6 +666,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
|
||||
if (has_background)
|
||||
{
|
||||
ensure_bg_surface (self);
|
||||
|
||||
if (background_changed)
|
||||
{
|
||||
wl_subsurface_set_position (self->bg_subsurface, self->bg_rect.x, self->bg_rect.y);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
typedef struct _ImageDescription ImageDescription;
|
||||
|
||||
static uint primaries_map[] = {
|
||||
static const uint primaries_map[] = {
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_SRGB] = 1,
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M] = 4,
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL] = 5,
|
||||
@@ -34,7 +34,48 @@ cicp_to_wl_primaries (uint cp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint transfer_map[] = {
|
||||
static const uint primaries_primaries[][8] = {
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_SRGB] = { 6400, 3300, 3000, 6000, 1500, 600, 3127, 3290 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M] = { 6700, 3300, 2100, 7100, 1400, 800, 3100, 3160 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_PAL] = { 6400, 3300, 2900, 6000, 1500, 600, 3127, 3290 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_NTSC] = { 6300, 3400, 3100, 5950, 1550, 700, 3127, 3290 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_GENERIC_FILM] = { 2430, 6920, 1450, 490, 6810, 3190, 3100, 3160 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_BT2020] = { 7080, 2920, 1700, 7970, 1310, 460, 3127, 3290 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_CIE1931_XYZ] = {10000, 0, 0,10000, 0, 0, 3333, 3333 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_DCI_P3] = { 6800, 3200, 2650, 6900, 1500, 600, 3140, 3510 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_DISPLAY_P3] = { 6800, 3200, 2650, 6900, 1500, 600, 3127, 3290 },
|
||||
[XX_COLOR_MANAGER_V4_PRIMARIES_ADOBE_RGB] = { 6400, 3300, 2100, 7100, 1500, 600, 3127, 3290 },
|
||||
};
|
||||
|
||||
static const uint *
|
||||
wl_primaries_to_primaries (enum xx_color_manager_v4_primaries primaries)
|
||||
{
|
||||
return primaries_primaries[primaries];
|
||||
}
|
||||
|
||||
static gboolean
|
||||
primaries_to_wl_primaries (const uint primaries[8],
|
||||
enum xx_color_manager_v4_primaries *out_primaries)
|
||||
{
|
||||
guint i, j;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (primaries_primaries); i++)
|
||||
{
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
if (primaries[j] != primaries_primaries[i][j])
|
||||
break;
|
||||
}
|
||||
if (j == 8)
|
||||
{
|
||||
*out_primaries = i;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const uint transfer_map[] = {
|
||||
[XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709] = 1,
|
||||
[XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22] = 4,
|
||||
[XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28] = 5,
|
||||
@@ -300,7 +341,8 @@ create_image_desc (GdkWaylandColor *color,
|
||||
primaries = cicp_to_wl_primaries (norm.color_primaries);
|
||||
tf = cicp_to_wl_transfer (norm.transfer_function);
|
||||
|
||||
if ((color->color_manager_supported.primaries & (1 << primaries)) == 0 ||
|
||||
if (((color->color_manager_supported.primaries & (1 << primaries)) == 0 &&
|
||||
(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES)) == 0) ||
|
||||
(color->color_manager_supported.transfers & (1 << tf)) == 0)
|
||||
{
|
||||
GDK_DEBUG (MISC, "Unsupported color state %s: Primaries or transfer function unsupported",
|
||||
@@ -316,7 +358,19 @@ create_image_desc (GdkWaylandColor *color,
|
||||
|
||||
creator = xx_color_manager_v4_new_parametric_creator (color->color_manager);
|
||||
|
||||
xx_image_description_creator_params_v4_set_primaries_named (creator, primaries);
|
||||
if (color->color_manager_supported.primaries & (1 << primaries))
|
||||
{
|
||||
xx_image_description_creator_params_v4_set_primaries_named (creator, primaries);
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint *p = wl_primaries_to_primaries (primaries);
|
||||
xx_image_description_creator_params_v4_set_primaries (creator,
|
||||
p[0], p[1],
|
||||
p[2], p[3],
|
||||
p[4], p[5],
|
||||
p[6], p[7]);
|
||||
}
|
||||
xx_image_description_creator_params_v4_set_tf_named (creator, tf);
|
||||
|
||||
desc = xx_image_description_creator_params_v4_create (creator);
|
||||
@@ -395,7 +449,8 @@ gdk_wayland_color_prepare (GdkWaylandColor *color)
|
||||
if (color->color_manager &&
|
||||
(!(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_PARAMETRIC)) ||
|
||||
!(color->color_manager_supported.transfers & (1 << XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB)) ||
|
||||
!(color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_SRGB))))
|
||||
!((color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_SRGB)) ||
|
||||
(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES)))))
|
||||
|
||||
{
|
||||
GDK_DEBUG (MISC, "Not using color management: Can't create srgb image description");
|
||||
@@ -409,7 +464,8 @@ gdk_wayland_color_prepare (GdkWaylandColor *color)
|
||||
if (color->color_manager_supported.transfers & (1 << XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR))
|
||||
create_image_desc (color, GDK_COLOR_STATE_SRGB_LINEAR, FALSE);
|
||||
|
||||
if (color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_BT2020))
|
||||
if ((color->color_manager_supported.primaries & (1 << XX_COLOR_MANAGER_V4_PRIMARIES_BT2020) ||
|
||||
(color->color_manager_supported.features & (1 << XX_COLOR_MANAGER_V4_FEATURE_SET_PRIMARIES))))
|
||||
{
|
||||
if (color->color_manager_supported.transfers & (1 << XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ))
|
||||
create_image_desc (color, GDK_COLOR_STATE_REC2100_PQ, FALSE);
|
||||
@@ -556,6 +612,9 @@ image_desc_info_primaries (void *data,
|
||||
desc->b_x = b_x; desc->r_y = b_y;
|
||||
desc->w_x = w_x; desc->r_y = w_y;
|
||||
desc->has_primaries = 1;
|
||||
if (primaries_to_wl_primaries ((uint[]) { r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y },
|
||||
&desc->primaries))
|
||||
desc->has_primaries_named = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -564,9 +623,16 @@ image_desc_info_primaries_named (void *data,
|
||||
uint32_t primaries)
|
||||
{
|
||||
ImageDescription *desc = data;
|
||||
const uint *p;
|
||||
|
||||
desc->primaries = primaries;
|
||||
desc->has_primaries_named = 1;
|
||||
desc->has_primaries = 1;
|
||||
p = wl_primaries_to_primaries (primaries);
|
||||
desc->r_x = p[0]; desc->r_y = p[1];
|
||||
desc->g_x = p[2]; desc->r_y = p[3];
|
||||
desc->b_x = p[4]; desc->r_y = p[5];
|
||||
desc->w_x = p[6]; desc->r_y = p[7];
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -44,6 +44,8 @@ gsk_gpu_color_states_create_cicp (GdkColorState *output_color_state,
|
||||
gboolean output_is_premultiplied,
|
||||
gboolean cicp_is_premultiplied)
|
||||
{
|
||||
g_assert (GDK_IS_DEFAULT_COLOR_STATE (output_color_state));
|
||||
|
||||
return (GDK_DEFAULT_COLOR_STATE_ID (output_color_state) << COLOR_SPACE_OUTPUT_SHIFT) |
|
||||
(output_is_premultiplied ? COLOR_SPACE_OUTPUT_PREMULTIPLIED : 0) |
|
||||
(GDK_DEFAULT_COLOR_STATE_ID (output_color_state) << COLOR_SPACE_ALT_SHIFT) |
|
||||
|
||||
Reference in New Issue
Block a user