crtc: Make the caller allocate the config struct
This will make it more convenient to offload some part of the configuring the backend by passing the config forward. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
This commit is contained in:
parent
c87fc36804
commit
2bb75a3c97
@ -111,21 +111,12 @@ meta_crtc_get_all_transforms (MetaCrtc *crtc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_crtc_set_config (MetaCrtc *crtc,
|
meta_crtc_set_config (MetaCrtc *crtc,
|
||||||
graphene_rect_t *layout,
|
MetaCrtcConfig *config)
|
||||||
MetaCrtcMode *mode,
|
|
||||||
MetaMonitorTransform transform)
|
|
||||||
{
|
{
|
||||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||||
MetaCrtcConfig *config;
|
|
||||||
|
|
||||||
meta_crtc_unset_config (crtc);
|
meta_crtc_unset_config (crtc);
|
||||||
|
|
||||||
config = g_new0 (MetaCrtcConfig, 1);
|
|
||||||
config->layout = *layout;
|
|
||||||
config->mode = mode;
|
|
||||||
config->transform = transform;
|
|
||||||
|
|
||||||
priv->config = config;
|
priv->config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,3 +393,18 @@ meta_crtc_class_init (MetaCrtcClass *klass)
|
|||||||
G_PARAM_STATIC_STRINGS);
|
G_PARAM_STATIC_STRINGS);
|
||||||
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaCrtcConfig *
|
||||||
|
meta_crtc_config_new (graphene_rect_t *layout,
|
||||||
|
MetaCrtcMode *mode,
|
||||||
|
MetaMonitorTransform transform)
|
||||||
|
{
|
||||||
|
MetaCrtcConfig *config;
|
||||||
|
|
||||||
|
config = g_new0 (MetaCrtcConfig, 1);
|
||||||
|
config->layout = *layout;
|
||||||
|
config->mode = mode;
|
||||||
|
config->transform = transform;
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
@ -70,10 +70,8 @@ void meta_crtc_unassign_output (MetaCrtc *crtc,
|
|||||||
MetaMonitorTransform meta_crtc_get_all_transforms (MetaCrtc *crtc);
|
MetaMonitorTransform meta_crtc_get_all_transforms (MetaCrtc *crtc);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
void meta_crtc_set_config (MetaCrtc *crtc,
|
void meta_crtc_set_config (MetaCrtc *crtc,
|
||||||
graphene_rect_t *layout,
|
MetaCrtcConfig *config);
|
||||||
MetaCrtcMode *mode,
|
|
||||||
MetaMonitorTransform transform);
|
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
void meta_crtc_unset_config (MetaCrtc *crtc);
|
void meta_crtc_unset_config (MetaCrtc *crtc);
|
||||||
@ -109,4 +107,9 @@ META_EXPORT_TEST
|
|||||||
gboolean meta_gamma_lut_equal (const MetaGammaLut *gamma,
|
gboolean meta_gamma_lut_equal (const MetaGammaLut *gamma,
|
||||||
const MetaGammaLut *other_gamma);
|
const MetaGammaLut *other_gamma);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
MetaCrtcConfig * meta_crtc_config_new (graphene_rect_t *layout,
|
||||||
|
MetaCrtcMode *mode,
|
||||||
|
MetaMonitorTransform transform);
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaGammaLut, meta_gamma_lut_free)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaGammaLut, meta_gamma_lut_free)
|
||||||
|
@ -516,12 +516,13 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
MetaCrtcConfig *crtc_config;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||||
&crtc_assignment->layout,
|
crtc_assignment->mode,
|
||||||
crtc_assignment->mode,
|
crtc_assignment->transform);
|
||||||
crtc_assignment->transform);
|
meta_crtc_set_config (crtc, crtc_config);
|
||||||
|
|
||||||
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||||
{
|
{
|
||||||
|
@ -214,12 +214,13 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
MetaCrtcConfig *crtc_config;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||||
&crtc_assignment->layout,
|
crtc_assignment->mode,
|
||||||
crtc_assignment->mode,
|
crtc_assignment->transform);
|
||||||
crtc_assignment->transform);
|
meta_crtc_set_config (crtc, crtc_config);
|
||||||
|
|
||||||
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||||
{
|
{
|
||||||
|
@ -284,13 +284,16 @@ meta_crtc_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
|||||||
|
|
||||||
if (crtc_xrandr->current_mode)
|
if (crtc_xrandr->current_mode)
|
||||||
{
|
{
|
||||||
meta_crtc_set_config (META_CRTC (crtc_xrandr),
|
MetaCrtcConfig *crtc_config;
|
||||||
&GRAPHENE_RECT_INIT (crtc_xrandr->rect.x,
|
|
||||||
crtc_xrandr->rect.y,
|
crtc_config =
|
||||||
crtc_xrandr->rect.width,
|
meta_crtc_config_new (&GRAPHENE_RECT_INIT (crtc_xrandr->rect.x,
|
||||||
crtc_xrandr->rect.height),
|
crtc_xrandr->rect.y,
|
||||||
crtc_xrandr->current_mode,
|
crtc_xrandr->rect.width,
|
||||||
crtc_xrandr->transform);
|
crtc_xrandr->rect.height),
|
||||||
|
crtc_xrandr->current_mode,
|
||||||
|
crtc_xrandr->transform);
|
||||||
|
meta_crtc_set_config (META_CRTC (crtc_xrandr), crtc_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
return crtc_xrandr;
|
return crtc_xrandr;
|
||||||
|
@ -502,6 +502,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
int x, y;
|
int x, y;
|
||||||
xcb_randr_rotation_t rotation;
|
xcb_randr_rotation_t rotation;
|
||||||
xcb_randr_mode_t mode;
|
xcb_randr_mode_t mode;
|
||||||
|
MetaCrtcConfig *crtc_config;
|
||||||
|
|
||||||
crtc_mode = crtc_assignment->mode;
|
crtc_mode = crtc_assignment->mode;
|
||||||
|
|
||||||
@ -556,10 +557,10 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||||
&crtc_assignment->layout,
|
crtc_mode,
|
||||||
crtc_mode,
|
crtc_assignment->transform);
|
||||||
crtc_assignment->transform);
|
meta_crtc_set_config (crtc, crtc_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,12 +178,13 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
MetaCrtcConfig *crtc_config;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
meta_crtc_set_config (crtc,
|
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||||
&crtc_assignment->layout,
|
crtc_assignment->mode,
|
||||||
crtc_assignment->mode,
|
crtc_assignment->transform);
|
||||||
crtc_assignment->transform);
|
meta_crtc_set_config (crtc, crtc_config);
|
||||||
|
|
||||||
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user