mirror of
https://github.com/brl/mutter.git
synced 2025-01-27 20:08:56 +00:00
backends/native: Replace MetaKmsCrtcGamma with MetaGammaLut
They are the same type now so there is no reason to keep both of them around. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2861>
This commit is contained in:
parent
8ccbc21d23
commit
e9786452c6
@ -175,6 +175,52 @@ meta_gamma_lut_free (MetaGammaLut *lut)
|
||||
g_free (lut);
|
||||
}
|
||||
|
||||
MetaGammaLut *
|
||||
meta_gamma_lut_new (int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue)
|
||||
{
|
||||
MetaGammaLut *gamma;
|
||||
|
||||
gamma = g_new0 (MetaGammaLut, 1);
|
||||
*gamma = (MetaGammaLut) {
|
||||
.size = size,
|
||||
.red = g_memdup2 (red, size * sizeof (*red)),
|
||||
.green = g_memdup2 (green, size * sizeof (*green)),
|
||||
.blue = g_memdup2 (blue, size * sizeof (*blue)),
|
||||
};
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
MetaGammaLut *
|
||||
meta_gamma_lut_copy (const MetaGammaLut *gamma)
|
||||
{
|
||||
g_return_val_if_fail (gamma != NULL, NULL);
|
||||
|
||||
return meta_gamma_lut_new (gamma->size, gamma->red, gamma->green, gamma->blue);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_gamma_lut_equal (const MetaGammaLut *gamma,
|
||||
const MetaGammaLut *other_gamma)
|
||||
{
|
||||
if (gamma == other_gamma)
|
||||
return TRUE;
|
||||
|
||||
if (gamma == NULL || other_gamma == NULL)
|
||||
return FALSE;
|
||||
|
||||
return gamma->size == other_gamma->size &&
|
||||
memcmp (gamma->red, other_gamma->red,
|
||||
gamma->size * sizeof (uint16_t)) == 0 &&
|
||||
memcmp (gamma->green, other_gamma->green,
|
||||
gamma->size * sizeof (uint16_t)) == 0 &&
|
||||
memcmp (gamma->blue, other_gamma->blue,
|
||||
gamma->size * sizeof (uint16_t)) == 0;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_crtc_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
@ -91,8 +91,21 @@ MetaGammaLut * meta_crtc_get_gamma_lut (MetaCrtc *crtc);
|
||||
void meta_crtc_set_gamma_lut (MetaCrtc *crtc,
|
||||
const MetaGammaLut *lut);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_gamma_lut_free (MetaGammaLut *lut);
|
||||
|
||||
MetaGammaLut * meta_gamma_lut_new (int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaGammaLut * meta_gamma_lut_copy (const MetaGammaLut *gamma);
|
||||
|
||||
META_EXPORT_TEST
|
||||
gboolean meta_gamma_lut_equal (const MetaGammaLut *gamma,
|
||||
const MetaGammaLut *other_gamma);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaGammaLut, meta_gamma_lut_free)
|
||||
|
||||
#endif /* META_CRTC_H */
|
||||
|
@ -106,7 +106,7 @@ meta_crtc_kms_get_gamma_lut_size (MetaCrtc *crtc)
|
||||
return crtc_state->gamma.size;
|
||||
}
|
||||
|
||||
const MetaKmsCrtcGamma *
|
||||
const MetaGammaLut *
|
||||
meta_crtc_kms_peek_gamma_lut (MetaCrtcKms *crtc_kms)
|
||||
{
|
||||
MetaMonitorManagerNative *monitor_manager_native =
|
||||
@ -124,39 +124,21 @@ meta_crtc_kms_get_gamma_lut (MetaCrtc *crtc)
|
||||
MetaMonitorManagerNative *monitor_manager_native =
|
||||
monitor_manager_from_crtc (crtc);
|
||||
const MetaKmsCrtcState *crtc_state;
|
||||
MetaKmsCrtcGamma *crtc_gamma;
|
||||
MetaGammaLut *lut;
|
||||
MetaGammaLut *gamma;
|
||||
|
||||
crtc_gamma =
|
||||
gamma =
|
||||
meta_monitor_manager_native_get_cached_crtc_gamma (monitor_manager_native,
|
||||
crtc_kms);
|
||||
if (!crtc_gamma)
|
||||
if (!gamma)
|
||||
{
|
||||
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
|
||||
crtc_gamma = crtc_state->gamma.value;
|
||||
gamma = crtc_state->gamma.value;
|
||||
}
|
||||
|
||||
lut = g_new0 (MetaGammaLut, 1);
|
||||
if (!gamma)
|
||||
return meta_gamma_lut_new (0, NULL, NULL, NULL);
|
||||
|
||||
if (crtc_gamma)
|
||||
{
|
||||
lut->size = crtc_gamma->size;
|
||||
lut->red = g_memdup2 (crtc_gamma->red,
|
||||
lut->size * sizeof (uint16_t));
|
||||
lut->green = g_memdup2 (crtc_gamma->green,
|
||||
lut->size * sizeof (uint16_t));
|
||||
lut->blue = g_memdup2 (crtc_gamma->blue,
|
||||
lut->size * sizeof (uint16_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
lut->size = 0;
|
||||
lut->red = NULL;
|
||||
lut->green = NULL;
|
||||
lut->blue = NULL;
|
||||
}
|
||||
|
||||
return lut;
|
||||
return meta_gamma_lut_copy (gamma);
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -231,7 +213,7 @@ meta_crtc_kms_set_gamma_lut (MetaCrtc *crtc,
|
||||
ClutterActor *stage = meta_backend_get_stage (backend);
|
||||
const MetaKmsCrtcState *crtc_state;
|
||||
g_autofree char *gamma_ramp_string = NULL;
|
||||
MetaKmsCrtcGamma *crtc_gamma;
|
||||
MetaGammaLut *new_gamma;
|
||||
|
||||
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
|
||||
|
||||
@ -250,13 +232,13 @@ meta_crtc_kms_set_gamma_lut (MetaCrtc *crtc,
|
||||
"Setting CRTC (%" G_GUINT64_FORMAT ") gamma to %s",
|
||||
meta_crtc_get_id (crtc), gamma_ramp_string);
|
||||
|
||||
crtc_gamma = meta_kms_crtc_gamma_new (lut->size,
|
||||
lut->red,
|
||||
lut->green,
|
||||
lut->blue);
|
||||
new_gamma = meta_gamma_lut_copy (lut);
|
||||
if (!new_gamma)
|
||||
new_gamma = meta_gamma_lut_new (0, NULL, NULL, NULL);
|
||||
|
||||
meta_monitor_manager_native_update_cached_crtc_gamma (monitor_manager_native,
|
||||
crtc_kms,
|
||||
crtc_gamma);
|
||||
new_gamma);
|
||||
|
||||
g_signal_emit (crtc_kms, signals[GAMMA_LUT_CHANGED], 0);
|
||||
clutter_stage_schedule_update (CLUTTER_STAGE (stage));
|
||||
|
@ -74,7 +74,7 @@ meta_crtc_kms_supports_format (MetaCrtcKms *crtc_kms,
|
||||
|
||||
gboolean meta_crtc_kms_is_gamma_invalid (MetaCrtcKms *crtc_kms);
|
||||
|
||||
const MetaKmsCrtcGamma * meta_crtc_kms_peek_gamma_lut (MetaCrtcKms *crtc_kms);
|
||||
const MetaGammaLut * meta_crtc_kms_peek_gamma_lut (MetaCrtcKms *crtc_kms);
|
||||
|
||||
MetaCrtcKms * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc);
|
||||
|
||||
|
@ -111,8 +111,8 @@ read_gamma_state (MetaKmsCrtc *crtc,
|
||||
|
||||
crtc_state->gamma.size = drm_crtc->gamma_size;
|
||||
crtc_state->gamma.supported = drm_crtc->gamma_size != 0;
|
||||
crtc_state->gamma.value = meta_kms_crtc_gamma_new (drm_crtc->gamma_size,
|
||||
NULL, NULL, NULL);
|
||||
crtc_state->gamma.value = meta_gamma_lut_new (drm_crtc->gamma_size,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
crtc_state->gamma.value->red = g_new0 (uint16_t, drm_crtc->gamma_size);
|
||||
crtc_state->gamma.value->green = g_new0 (uint16_t, drm_crtc->gamma_size);
|
||||
@ -132,7 +132,7 @@ gamma_equal (MetaKmsCrtcState *state,
|
||||
{
|
||||
return state->gamma.size == other_state->gamma.size &&
|
||||
state->gamma.supported == other_state->gamma.supported &&
|
||||
meta_kms_crtc_gamma_equal (state->gamma.value, other_state->gamma.value);
|
||||
meta_gamma_lut_equal (state->gamma.value, other_state->gamma.value);
|
||||
}
|
||||
|
||||
static MetaKmsResourceChanges
|
||||
@ -204,7 +204,7 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
|
||||
}
|
||||
|
||||
g_clear_pointer (&crtc->current_state.gamma.value,
|
||||
meta_kms_crtc_gamma_free);
|
||||
meta_gamma_lut_free);
|
||||
crtc->current_state = crtc_state;
|
||||
|
||||
meta_topic (META_DEBUG_KMS,
|
||||
@ -308,16 +308,19 @@ meta_kms_crtc_predict_state_in_impl (MetaKmsCrtc *crtc,
|
||||
for (l = crtc_color_updates; l; l = l->next)
|
||||
{
|
||||
MetaKmsCrtcColorUpdate *color_update = l->data;
|
||||
MetaKmsCrtcGamma *gamma = color_update->gamma.state;
|
||||
MetaGammaLut *gamma = color_update->gamma.state;
|
||||
|
||||
if (color_update->crtc != crtc)
|
||||
continue;
|
||||
|
||||
g_clear_pointer (&crtc->current_state.gamma.value, meta_kms_crtc_gamma_free);
|
||||
crtc->current_state.gamma.value = meta_kms_crtc_gamma_new (gamma->size,
|
||||
gamma->red,
|
||||
gamma->green,
|
||||
gamma->blue);
|
||||
if (color_update->gamma.has_update)
|
||||
{
|
||||
if (gamma)
|
||||
gamma = meta_gamma_lut_copy (gamma);
|
||||
|
||||
g_clear_pointer (&crtc->current_state.gamma.value, meta_gamma_lut_free);
|
||||
crtc->current_state.gamma.value = gamma;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -389,7 +392,7 @@ meta_kms_crtc_finalize (GObject *object)
|
||||
{
|
||||
MetaKmsCrtc *crtc = META_KMS_CRTC (object);
|
||||
|
||||
g_clear_pointer (&crtc->current_state.gamma.value, meta_kms_crtc_gamma_free);
|
||||
g_clear_pointer (&crtc->current_state.gamma.value, meta_gamma_lut_free);
|
||||
|
||||
G_OBJECT_CLASS (meta_kms_crtc_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -25,17 +25,10 @@
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
#include "backends/native/meta-kms-types.h"
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "core/util-private.h"
|
||||
#include "meta/boxes.h"
|
||||
|
||||
typedef struct _MetaKmsCrtcGamma
|
||||
{
|
||||
int size;
|
||||
uint16_t *red;
|
||||
uint16_t *green;
|
||||
uint16_t *blue;
|
||||
} MetaKmsCrtcGamma;
|
||||
|
||||
typedef struct _MetaKmsCrtcState
|
||||
{
|
||||
gboolean is_active;
|
||||
@ -45,7 +38,7 @@ typedef struct _MetaKmsCrtcState
|
||||
drmModeModeInfo drm_mode;
|
||||
|
||||
struct {
|
||||
MetaKmsCrtcGamma *value;
|
||||
MetaGammaLut *value;
|
||||
int size;
|
||||
gboolean supported;
|
||||
} gamma;
|
||||
@ -71,14 +64,4 @@ int meta_kms_crtc_get_idx (MetaKmsCrtc *crtc);
|
||||
META_EXPORT_TEST
|
||||
gboolean meta_kms_crtc_is_active (MetaKmsCrtc *crtc);
|
||||
|
||||
void meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma);
|
||||
|
||||
MetaKmsCrtcGamma * meta_kms_crtc_gamma_new (int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue);
|
||||
|
||||
gboolean meta_kms_crtc_gamma_equal (MetaKmsCrtcGamma *gamma,
|
||||
MetaKmsCrtcGamma *other_gamma);
|
||||
|
||||
#endif /* META_KMS_CRTC_H */
|
||||
|
@ -626,7 +626,7 @@ process_crtc_color_updates (MetaKmsImplDevice *impl_device,
|
||||
|
||||
if (color_update->gamma.has_update)
|
||||
{
|
||||
MetaKmsCrtcGamma *gamma = color_update->gamma.state;
|
||||
MetaGammaLut *gamma = color_update->gamma.state;
|
||||
struct drm_color_lut drm_color_lut[gamma->size];
|
||||
int i;
|
||||
uint32_t color_lut_blob_id;
|
||||
@ -647,7 +647,7 @@ process_crtc_color_updates (MetaKmsImplDevice *impl_device,
|
||||
return FALSE;
|
||||
|
||||
meta_topic (META_DEBUG_KMS,
|
||||
"[atomic] Setting CRTC (%u, %s) gamma, size: %d",
|
||||
"[atomic] Setting CRTC (%u, %s) gamma, size: %zu",
|
||||
meta_kms_crtc_get_id (crtc),
|
||||
meta_kms_impl_device_get_path (impl_device),
|
||||
gamma->size);
|
||||
|
@ -513,12 +513,12 @@ process_crtc_color_updates (MetaKmsImplDevice *impl_device,
|
||||
|
||||
if (color_update->gamma.has_update)
|
||||
{
|
||||
MetaKmsCrtcGamma *gamma = color_update->gamma.state;
|
||||
MetaGammaLut *gamma = color_update->gamma.state;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
meta_topic (META_DEBUG_KMS,
|
||||
"[simple] Setting CRTC %u (%s) gamma, size: %d",
|
||||
"[simple] Setting CRTC %u (%s) gamma, size: %zu",
|
||||
meta_kms_crtc_get_id (crtc),
|
||||
meta_kms_impl_device_get_path (impl_device),
|
||||
gamma->size);
|
||||
|
@ -34,7 +34,7 @@ typedef struct _MetaKmsCrtcColorUpdate
|
||||
|
||||
struct {
|
||||
gboolean has_update;
|
||||
MetaKmsCrtcGamma *state;
|
||||
MetaGammaLut *state;
|
||||
} gamma;
|
||||
} MetaKmsCrtcColorUpdate;
|
||||
|
||||
|
@ -395,63 +395,21 @@ ensure_color_update (MetaKmsUpdate *update,
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma)
|
||||
{
|
||||
g_return_if_fail (gamma != NULL);
|
||||
|
||||
g_free (gamma->red);
|
||||
g_free (gamma->green);
|
||||
g_free (gamma->blue);
|
||||
g_free (gamma);
|
||||
}
|
||||
|
||||
MetaKmsCrtcGamma *
|
||||
meta_kms_crtc_gamma_new (int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue)
|
||||
{
|
||||
MetaKmsCrtcGamma *gamma;
|
||||
|
||||
gamma = g_new0 (MetaKmsCrtcGamma, 1);
|
||||
*gamma = (MetaKmsCrtcGamma) {
|
||||
.size = size,
|
||||
.red = g_memdup2 (red, size * sizeof (*red)),
|
||||
.green = g_memdup2 (green, size * sizeof (*green)),
|
||||
.blue = g_memdup2 (blue, size * sizeof (*blue)),
|
||||
};
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_kms_crtc_gamma_equal (MetaKmsCrtcGamma *gamma,
|
||||
MetaKmsCrtcGamma *other_gamma)
|
||||
{
|
||||
return gamma->size == other_gamma->size &&
|
||||
memcmp (gamma->red, other_gamma->red,
|
||||
gamma->size * sizeof (uint16_t)) == 0 &&
|
||||
memcmp (gamma->green, other_gamma->green,
|
||||
gamma->size * sizeof (uint16_t)) == 0 &&
|
||||
memcmp (gamma->blue, other_gamma->blue,
|
||||
gamma->size * sizeof (uint16_t)) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
|
||||
MetaKmsCrtc *crtc,
|
||||
int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue)
|
||||
meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
|
||||
MetaKmsCrtc *crtc,
|
||||
const MetaGammaLut *gamma)
|
||||
{
|
||||
MetaKmsCrtcColorUpdate *color_update;
|
||||
MetaGammaLut *gamma_update = NULL;
|
||||
|
||||
g_assert (!meta_kms_update_is_locked (update));
|
||||
g_assert (meta_kms_crtc_get_device (crtc) == update->device);
|
||||
|
||||
if (gamma)
|
||||
gamma_update = meta_gamma_lut_copy (gamma);
|
||||
|
||||
color_update = ensure_color_update (update, crtc);
|
||||
color_update->gamma.state = meta_kms_crtc_gamma_new (size, red, green, blue);
|
||||
color_update->gamma.state = gamma_update;
|
||||
color_update->gamma.has_update = TRUE;
|
||||
}
|
||||
|
||||
@ -459,7 +417,7 @@ static void
|
||||
meta_kms_crtc_color_updates_free (MetaKmsCrtcColorUpdate *color_update)
|
||||
{
|
||||
if (color_update->gamma.has_update)
|
||||
g_clear_pointer (&color_update->gamma.state, meta_kms_crtc_gamma_free);
|
||||
g_clear_pointer (&color_update->gamma.state, meta_gamma_lut_free);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -121,12 +121,9 @@ void meta_kms_update_mode_set (MetaKmsUpdate *update,
|
||||
GList *connectors,
|
||||
MetaKmsMode *mode);
|
||||
|
||||
void meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
|
||||
MetaKmsCrtc *crtc,
|
||||
int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue);
|
||||
void meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
|
||||
MetaKmsCrtc *crtc,
|
||||
const MetaGammaLut *gamma);
|
||||
|
||||
void meta_kms_plane_assignment_set_fb_damage (MetaKmsPlaneAssignment *plane_assignment,
|
||||
const int *rectangles,
|
||||
|
@ -345,7 +345,7 @@ meta_monitor_manager_native_apply_monitors_config (MetaMonitorManager *ma
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MetaKmsCrtcGamma *
|
||||
MetaGammaLut *
|
||||
meta_monitor_manager_native_get_cached_crtc_gamma (MetaMonitorManagerNative *manager_native,
|
||||
MetaCrtcKms *crtc_kms)
|
||||
{
|
||||
@ -359,13 +359,13 @@ meta_monitor_manager_native_get_cached_crtc_gamma (MetaMonitorManagerNative *man
|
||||
void
|
||||
meta_monitor_manager_native_update_cached_crtc_gamma (MetaMonitorManagerNative *manager_native,
|
||||
MetaCrtcKms *crtc_kms,
|
||||
MetaKmsCrtcGamma *crtc_gamma)
|
||||
MetaGammaLut *gamma)
|
||||
{
|
||||
MetaCrtc *crtc = META_CRTC (crtc_kms);
|
||||
|
||||
g_hash_table_replace (manager_native->crtc_gamma_cache,
|
||||
GUINT_TO_POINTER (meta_crtc_get_id (crtc)),
|
||||
crtc_gamma);
|
||||
gamma);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -694,7 +694,7 @@ meta_monitor_manager_native_initable_init (GInitable *initable,
|
||||
manager_native->crtc_gamma_cache =
|
||||
g_hash_table_new_full (NULL, NULL,
|
||||
NULL,
|
||||
(GDestroyNotify) meta_kms_crtc_gamma_free);
|
||||
(GDestroyNotify) meta_gamma_lut_free);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ void meta_monitor_manager_native_resume (MetaMonitorManagerNative *manager_nativ
|
||||
|
||||
uint64_t meta_power_save_to_dpms_state (MetaPowerSave power_save);
|
||||
|
||||
MetaKmsCrtcGamma * meta_monitor_manager_native_get_cached_crtc_gamma (MetaMonitorManagerNative *manager_native,
|
||||
MetaCrtcKms *crtc_kms);
|
||||
MetaGammaLut * meta_monitor_manager_native_get_cached_crtc_gamma (MetaMonitorManagerNative *manager_native,
|
||||
MetaCrtcKms *crtc_kms);
|
||||
|
||||
void meta_monitor_manager_native_update_cached_crtc_gamma (MetaMonitorManagerNative *manager_native,
|
||||
MetaCrtcKms *crtc_kms,
|
||||
MetaKmsCrtcGamma *gamma_lut);
|
||||
MetaGammaLut *gamma);
|
||||
|
||||
#endif /* META_MONITOR_MANAGER_NATIVE_H */
|
||||
|
@ -1398,7 +1398,7 @@ meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
|
||||
|
||||
if (onscreen_native->is_gamma_lut_invalid)
|
||||
{
|
||||
const MetaKmsCrtcGamma *gamma;
|
||||
const MetaGammaLut *gamma;
|
||||
|
||||
gamma = meta_crtc_kms_peek_gamma_lut (crtc_kms);
|
||||
if (gamma)
|
||||
@ -1408,10 +1408,7 @@ meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
|
||||
kms_update = meta_kms_ensure_pending_update (kms, kms_device);
|
||||
meta_kms_update_set_crtc_gamma (kms_update,
|
||||
kms_crtc,
|
||||
gamma->size,
|
||||
gamma->red,
|
||||
gamma->green,
|
||||
gamma->blue);
|
||||
gamma);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,19 +105,8 @@ assert_crtc_state_equals (const MetaKmsCrtcState *crtc_state1,
|
||||
crtc_state2->drm_mode.name);
|
||||
}
|
||||
|
||||
g_assert_cmpint (crtc_state1->gamma.value->size, ==, crtc_state1->gamma.value->size);
|
||||
g_assert_cmpmem (crtc_state1->gamma.value->red,
|
||||
crtc_state1->gamma.value->size * sizeof (uint16_t),
|
||||
crtc_state2->gamma.value->red,
|
||||
crtc_state2->gamma.value->size * sizeof (uint16_t));
|
||||
g_assert_cmpmem (crtc_state1->gamma.value->green,
|
||||
crtc_state1->gamma.value->size * sizeof (uint16_t),
|
||||
crtc_state2->gamma.value->green,
|
||||
crtc_state2->gamma.value->size * sizeof (uint16_t));
|
||||
g_assert_cmpmem (crtc_state1->gamma.value->blue,
|
||||
crtc_state1->gamma.value->size * sizeof (uint16_t),
|
||||
crtc_state2->gamma.value->blue,
|
||||
crtc_state2->gamma.value->size * sizeof (uint16_t));
|
||||
g_assert_true (meta_gamma_lut_equal (crtc_state1->gamma.value,
|
||||
crtc_state2->gamma.value));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -213,15 +202,10 @@ copy_crtc_state (const MetaKmsCrtcState *crtc_state)
|
||||
g_assert_nonnull (crtc_state);
|
||||
|
||||
new_state = *crtc_state;
|
||||
new_state.gamma.value->red =
|
||||
g_memdup2 (new_state.gamma.value->red,
|
||||
new_state.gamma.value->size * sizeof (uint16_t));
|
||||
new_state.gamma.value->green =
|
||||
g_memdup2 (new_state.gamma.value->green,
|
||||
new_state.gamma.value->size * sizeof (uint16_t));
|
||||
new_state.gamma.value->blue =
|
||||
g_memdup2 (new_state.gamma.value->blue,
|
||||
new_state.gamma.value->size * sizeof (uint16_t));
|
||||
if (crtc_state->gamma.value)
|
||||
new_state.gamma.value = meta_gamma_lut_copy (crtc_state->gamma.value);
|
||||
else
|
||||
new_state.gamma.value = NULL;
|
||||
|
||||
return new_state;
|
||||
}
|
||||
@ -249,11 +233,9 @@ copy_connector_state (const MetaKmsConnectorState *connector_state)
|
||||
}
|
||||
|
||||
static void
|
||||
release_crtc_state (const MetaKmsCrtcState *crtc_state)
|
||||
release_crtc_state (MetaKmsCrtcState *crtc_state)
|
||||
{
|
||||
g_free (crtc_state->gamma.value->red);
|
||||
g_free (crtc_state->gamma.value->green);
|
||||
g_free (crtc_state->gamma.value->blue);
|
||||
g_clear_pointer (&crtc_state->gamma.value, meta_gamma_lut_free);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user