mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 12:52:14 +00:00
monitor-config-manager: Allow backends to assign extra data
When we're configuring monitors, allow backends to add backend specific assignments during resource assignment (mapping connectors and CRTCs etc). This will later allow the native backend's KMS monitor resources to assign a primary plane and optionally a cursor plane during configuration. This will then dictate what plane will be used for primary plane updates, as well as cursor updates, until reconfigured again. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
This commit is contained in:
parent
2bb75a3c97
commit
429e65b993
@ -112,11 +112,17 @@ meta_crtc_get_all_transforms (MetaCrtc *crtc)
|
||||
|
||||
void
|
||||
meta_crtc_set_config (MetaCrtc *crtc,
|
||||
MetaCrtcConfig *config)
|
||||
MetaCrtcConfig *config,
|
||||
gpointer backend_private)
|
||||
{
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
MetaCrtcClass *klass = META_CRTC_GET_CLASS (crtc);
|
||||
|
||||
meta_crtc_unset_config (crtc);
|
||||
|
||||
if (klass->set_config)
|
||||
klass->set_config (crtc, config, backend_private);
|
||||
|
||||
priv->config = config;
|
||||
}
|
||||
|
||||
@ -136,6 +142,20 @@ meta_crtc_get_config (MetaCrtc *crtc)
|
||||
return priv->config;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_crtc_assign_extra (MetaCrtc *crtc,
|
||||
MetaCrtcAssignment *crtc_assignment,
|
||||
GPtrArray *crtc_assignments,
|
||||
GError **error)
|
||||
{
|
||||
MetaCrtcClass *klass = META_CRTC_GET_CLASS (crtc);
|
||||
|
||||
if (klass->assign_extra)
|
||||
return klass->assign_extra (crtc, crtc_assignment, crtc_assignments, error);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
size_t
|
||||
meta_crtc_get_gamma_lut_size (MetaCrtc *crtc)
|
||||
{
|
||||
|
@ -46,6 +46,15 @@ struct _MetaCrtcClass
|
||||
|
||||
void (* set_gamma_lut) (MetaCrtc *crtc,
|
||||
const MetaGammaLut *lut);
|
||||
|
||||
gboolean (* assign_extra) (MetaCrtc *crtc,
|
||||
MetaCrtcAssignment *crtc_assignment,
|
||||
GPtrArray *crtc_assignments,
|
||||
GError **error);
|
||||
|
||||
void (* set_config) (MetaCrtc *crtc,
|
||||
const MetaCrtcConfig *config,
|
||||
gpointer backend_private);
|
||||
};
|
||||
|
||||
META_EXPORT_TEST
|
||||
@ -71,7 +80,8 @@ MetaMonitorTransform meta_crtc_get_all_transforms (MetaCrtc *crtc);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_crtc_set_config (MetaCrtc *crtc,
|
||||
MetaCrtcConfig *config);
|
||||
MetaCrtcConfig *config,
|
||||
gpointer backend_private);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_crtc_unset_config (MetaCrtc *crtc);
|
||||
@ -79,6 +89,11 @@ void meta_crtc_unset_config (MetaCrtc *crtc);
|
||||
META_EXPORT_TEST
|
||||
const MetaCrtcConfig * meta_crtc_get_config (MetaCrtc *crtc);
|
||||
|
||||
gboolean meta_crtc_assign_extra (MetaCrtc *crtc,
|
||||
MetaCrtcAssignment *crtc_assignment,
|
||||
GPtrArray *crtc_assignments,
|
||||
GError **error);
|
||||
|
||||
size_t meta_crtc_get_gamma_lut_size (MetaCrtc *crtc);
|
||||
|
||||
MetaGammaLut * meta_crtc_get_gamma_lut (MetaCrtc *crtc);
|
||||
|
@ -261,6 +261,12 @@ assign_monitor_crtc (MetaMonitor *monitor,
|
||||
};
|
||||
g_ptr_array_add (crtc_assignment->outputs, output);
|
||||
|
||||
if (!meta_crtc_assign_extra (crtc,
|
||||
crtc_assignment,
|
||||
data->crtc_assignments,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* Only one output can be marked as primary (due to Xrandr limitation),
|
||||
* so only mark the main output of the first monitor in the logical monitor
|
||||
@ -1748,6 +1754,8 @@ meta_monitors_config_class_init (MetaMonitorsConfigClass *klass)
|
||||
static void
|
||||
meta_crtc_assignment_free (MetaCrtcAssignment *assignment)
|
||||
{
|
||||
g_clear_pointer (&assignment->backend_private,
|
||||
assignment->backend_private_destroy);
|
||||
g_ptr_array_free (assignment->outputs, TRUE);
|
||||
g_free (assignment);
|
||||
}
|
||||
|
@ -522,7 +522,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||
crtc_assignment->mode,
|
||||
crtc_assignment->transform);
|
||||
meta_crtc_set_config (crtc, crtc_config);
|
||||
meta_crtc_set_config (crtc, crtc_config,
|
||||
crtc_assignment->backend_private);
|
||||
|
||||
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||
{
|
||||
|
@ -87,6 +87,9 @@ struct _MetaCrtcAssignment
|
||||
graphene_rect_t layout;
|
||||
MetaMonitorTransform transform;
|
||||
GPtrArray *outputs;
|
||||
|
||||
gpointer backend_private;
|
||||
GDestroyNotify backend_private_destroy;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -220,7 +220,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||
crtc_assignment->mode,
|
||||
crtc_assignment->transform);
|
||||
meta_crtc_set_config (crtc, crtc_config);
|
||||
meta_crtc_set_config (crtc, crtc_config,
|
||||
crtc_assignment->backend_private);
|
||||
|
||||
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ meta_crtc_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
||||
crtc_xrandr->rect.height),
|
||||
crtc_xrandr->current_mode,
|
||||
crtc_xrandr->transform);
|
||||
meta_crtc_set_config (META_CRTC (crtc_xrandr), crtc_config);
|
||||
meta_crtc_set_config (META_CRTC (crtc_xrandr), crtc_config, NULL);
|
||||
}
|
||||
|
||||
return crtc_xrandr;
|
||||
|
@ -560,7 +560,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||
crtc_mode,
|
||||
crtc_assignment->transform);
|
||||
meta_crtc_set_config (crtc, crtc_config);
|
||||
meta_crtc_set_config (crtc, crtc_config,
|
||||
crtc_assignment->backend_private);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
crtc_config = meta_crtc_config_new (&crtc_assignment->layout,
|
||||
crtc_assignment->mode,
|
||||
crtc_assignment->transform);
|
||||
meta_crtc_set_config (crtc, crtc_config);
|
||||
meta_crtc_set_config (crtc, crtc_config,
|
||||
crtc_assignment->backend_private);
|
||||
|
||||
for (j = 0; j < crtc_assignment->outputs->len; j++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user