mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
kms/crtc: Make MetaKmsCrtcGamma reusable
Expose it outside the private realms of MetaKms* so that e.g. MetaMonitorManagerKms can use it too. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
parent
88e6400052
commit
7d8dd6cc75
@ -44,6 +44,15 @@ typedef struct _MetaKmsCrtcState
|
||||
} gamma;
|
||||
} MetaKmsCrtcState;
|
||||
|
||||
typedef struct _MetaKmsCrtcGamma
|
||||
{
|
||||
MetaKmsCrtc *crtc;
|
||||
int size;
|
||||
uint16_t *red;
|
||||
uint16_t *green;
|
||||
uint16_t *blue;
|
||||
} MetaKmsCrtcGamma;
|
||||
|
||||
#define META_TYPE_KMS_CRTC (meta_kms_crtc_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaKmsCrtc, meta_kms_crtc,
|
||||
META, KMS_CRTC,
|
||||
@ -59,4 +68,12 @@ int meta_kms_crtc_get_idx (MetaKmsCrtc *crtc);
|
||||
|
||||
gboolean meta_kms_crtc_is_active (MetaKmsCrtc *crtc);
|
||||
|
||||
void meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma);
|
||||
|
||||
MetaKmsCrtcGamma * meta_kms_crtc_gamma_new (MetaKmsCrtc *crtc,
|
||||
int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue);
|
||||
|
||||
#endif /* META_KMS_CRTC_H */
|
||||
|
@ -77,15 +77,6 @@ typedef struct _MetaKmsConnectorUpdate
|
||||
} dpms;
|
||||
} MetaKmsConnectorUpdate;
|
||||
|
||||
typedef struct _MetaKmsCrtcGamma
|
||||
{
|
||||
MetaKmsCrtc *crtc;
|
||||
int size;
|
||||
uint16_t *red;
|
||||
uint16_t *green;
|
||||
uint16_t *blue;
|
||||
} MetaKmsCrtcGamma;
|
||||
|
||||
typedef struct _MetaKmsPageFlipListener
|
||||
{
|
||||
MetaKmsCrtc *crtc;
|
||||
|
@ -333,7 +333,7 @@ meta_kms_update_set_dpms_state (MetaKmsUpdate *update,
|
||||
connector_update->dpms.state = state;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma)
|
||||
{
|
||||
g_free (gamma->red);
|
||||
@ -342,6 +342,27 @@ meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma)
|
||||
g_free (gamma);
|
||||
}
|
||||
|
||||
MetaKmsCrtcGamma *
|
||||
meta_kms_crtc_gamma_new (MetaKmsCrtc *crtc,
|
||||
int size,
|
||||
const uint16_t *red,
|
||||
const uint16_t *green,
|
||||
const uint16_t *blue)
|
||||
{
|
||||
MetaKmsCrtcGamma *gamma;
|
||||
|
||||
gamma = g_new0 (MetaKmsCrtcGamma, 1);
|
||||
*gamma = (MetaKmsCrtcGamma) {
|
||||
.crtc = crtc,
|
||||
.size = size,
|
||||
.red = g_memdup (red, size * sizeof (*red)),
|
||||
.green = g_memdup (green, size * sizeof (*green)),
|
||||
.blue = g_memdup (blue, size * sizeof (*blue)),
|
||||
};
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
|
||||
MetaKmsCrtc *crtc,
|
||||
@ -355,14 +376,7 @@ meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
|
||||
g_assert (!meta_kms_update_is_locked (update));
|
||||
g_assert (meta_kms_crtc_get_device (crtc) == update->device);
|
||||
|
||||
gamma = g_new0 (MetaKmsCrtcGamma, 1);
|
||||
*gamma = (MetaKmsCrtcGamma) {
|
||||
.crtc = crtc,
|
||||
.size = size,
|
||||
.red = g_memdup (red, size * sizeof *red),
|
||||
.green = g_memdup (green, size * sizeof *green),
|
||||
.blue = g_memdup (blue, size * sizeof *blue),
|
||||
};
|
||||
gamma = meta_kms_crtc_gamma_new (crtc, size, red, green, blue);
|
||||
|
||||
update->crtc_gammas = g_list_prepend (update->crtc_gammas, gamma);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user