mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
output: Move winsys_id into instance private and rename to id
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
a42eed0231
commit
e063947a16
@ -99,7 +99,7 @@ meta_logical_monitor_new (MetaMonitorManager *monitor_manager,
|
||||
main_output = meta_monitor_get_main_output (first_monitor);
|
||||
|
||||
logical_monitor->number = monitor_number;
|
||||
logical_monitor->winsys_id = main_output->winsys_id;
|
||||
logical_monitor->winsys_id = meta_output_get_id (main_output);
|
||||
logical_monitor->scale = logical_monitor_config->scale;
|
||||
logical_monitor->transform = logical_monitor_config->transform;
|
||||
logical_monitor->in_fullscreen = -1;
|
||||
@ -144,7 +144,7 @@ meta_logical_monitor_new_derived (MetaMonitorManager *monitor_manager,
|
||||
|
||||
main_output = meta_monitor_get_main_output (monitor);
|
||||
logical_monitor->number = monitor_number;
|
||||
logical_monitor->winsys_id = main_output->winsys_id;
|
||||
logical_monitor->winsys_id = meta_output_get_id (main_output);
|
||||
logical_monitor->scale = scale;
|
||||
logical_monitor->transform = transform;
|
||||
logical_monitor->in_fullscreen = -1;
|
||||
|
@ -205,7 +205,10 @@ append_monitor (MetaMonitorManager *manager,
|
||||
crtc->all_transforms = ALL_TRANSFORMS;
|
||||
*crtcs = g_list_append (*crtcs, crtc);
|
||||
|
||||
number = g_list_length (*outputs) + 1;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
"id", number,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
|
||||
@ -214,9 +217,6 @@ append_monitor (MetaMonitorManager *manager,
|
||||
.scale = scale
|
||||
};
|
||||
|
||||
number = g_list_length (*outputs) + 1;
|
||||
|
||||
output->winsys_id = number;
|
||||
output->name = g_strdup_printf ("LVDS%d", number);
|
||||
output->vendor = g_strdup ("MetaProducts Inc.");
|
||||
output->product = g_strdup ("MetaMonitor");
|
||||
@ -321,10 +321,10 @@ append_tiled_monitor (MetaMonitorManager *manager,
|
||||
preferred_mode = g_list_last (*modes)->data;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
"id", number,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
|
||||
output->winsys_id = number;
|
||||
output->name = g_strdup_printf ("LVDS%d", number);
|
||||
output->vendor = g_strdup ("MetaProducts Inc.");
|
||||
output->product = g_strdup ("MetaMonitor");
|
||||
|
@ -1149,7 +1149,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
crtc_index = crtc ? g_list_index (combined_crtcs, crtc) : -1;
|
||||
g_variant_builder_add (&output_builder, "(uxiausauaua{sv})",
|
||||
i, /* ID */
|
||||
(gint64)output->winsys_id,
|
||||
meta_output_get_id (output),
|
||||
crtc_index,
|
||||
&crtcs,
|
||||
output->name,
|
||||
|
@ -653,7 +653,7 @@ meta_monitor_normal_new (MetaGpu *gpu,
|
||||
monitor_priv->gpu = gpu;
|
||||
|
||||
monitor_priv->outputs = g_list_append (NULL, g_object_ref (output));
|
||||
monitor_priv->winsys_id = output->winsys_id;
|
||||
monitor_priv->winsys_id = meta_output_get_id (output);
|
||||
meta_monitor_generate_spec (monitor);
|
||||
|
||||
meta_monitor_normal_generate_modes (monitor_normal);
|
||||
@ -1292,7 +1292,7 @@ meta_monitor_tiled_new (MetaGpu *gpu,
|
||||
monitor_priv->gpu = gpu;
|
||||
|
||||
monitor_tiled->tile_group_id = output->tile_info.group_id;
|
||||
monitor_priv->winsys_id = output->winsys_id;
|
||||
monitor_priv->winsys_id = meta_output_get_id (output);
|
||||
|
||||
monitor_tiled->origin_output = output;
|
||||
add_tiled_monitor_outputs (gpu, monitor_tiled);
|
||||
|
@ -25,6 +25,7 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_ID,
|
||||
PROP_GPU,
|
||||
|
||||
N_PROPS
|
||||
@ -34,6 +35,8 @@ static GParamSpec *obj_props[N_PROPS];
|
||||
|
||||
typedef struct _MetaOutputPrivate
|
||||
{
|
||||
uint64_t id;
|
||||
|
||||
MetaGpu *gpu;
|
||||
|
||||
/* The CRTC driving this output, NULL if the output is not enabled */
|
||||
@ -42,6 +45,14 @@ typedef struct _MetaOutputPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaOutput, meta_output, G_TYPE_OBJECT)
|
||||
|
||||
uint64_t
|
||||
meta_output_get_id (MetaOutput *output)
|
||||
{
|
||||
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||
|
||||
return priv->id;
|
||||
}
|
||||
|
||||
MetaGpu *
|
||||
meta_output_get_gpu (MetaOutput *output)
|
||||
{
|
||||
@ -117,6 +128,9 @@ meta_output_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
priv->id = g_value_get_uint64 (value);
|
||||
break;
|
||||
case PROP_GPU:
|
||||
priv->gpu = g_value_get_object (value);
|
||||
break;
|
||||
@ -136,6 +150,9 @@ meta_output_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_value_set_uint64 (value, priv->id);
|
||||
break;
|
||||
case PROP_GPU:
|
||||
g_value_set_object (value, priv->gpu);
|
||||
break;
|
||||
@ -189,6 +206,14 @@ meta_output_class_init (MetaOutputClass *klass)
|
||||
object_class->dispose = meta_output_dispose;
|
||||
object_class->finalize = meta_output_finalize;
|
||||
|
||||
obj_props[PROP_ID] =
|
||||
g_param_spec_uint64 ("id",
|
||||
"id",
|
||||
"CRTC id",
|
||||
0, UINT64_MAX, 0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_GPU] =
|
||||
g_param_spec_object ("gpu",
|
||||
"gpu",
|
||||
|
@ -64,8 +64,6 @@ struct _MetaOutput
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
/* The low-level ID of this output, used to apply back configuration */
|
||||
uint64_t winsys_id;
|
||||
char *name;
|
||||
char *vendor;
|
||||
char *product;
|
||||
@ -117,6 +115,9 @@ struct _MetaOutput
|
||||
#define META_TYPE_OUTPUT (meta_output_get_type ())
|
||||
META_EXPORT_TEST G_DECLARE_FINAL_TYPE (MetaOutput, meta_output, META, OUTPUT, GObject)
|
||||
|
||||
META_EXPORT_TEST
|
||||
uint64_t meta_output_get_id (MetaOutput *output);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaGpu * meta_output_get_gpu (MetaOutput *output);
|
||||
|
||||
|
@ -294,15 +294,19 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
MetaGpu *gpu = META_GPU (gpu_kms);
|
||||
uint32_t connector_id;
|
||||
uint32_t gpu_id;
|
||||
MetaOutput *output;
|
||||
MetaOutputKms *output_kms;
|
||||
const MetaKmsConnectorState *connector_state;
|
||||
uint32_t connector_id;
|
||||
GArray *crtcs;
|
||||
GList *l;
|
||||
uint32_t gpu_id;
|
||||
|
||||
gpu_id = meta_gpu_kms_get_id (gpu_kms);
|
||||
connector_id = meta_kms_connector_get_id (kms_connector);
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
"id", ((uint64_t) gpu_id << 32) | connector_id,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
|
||||
@ -312,10 +316,6 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
|
||||
output->name = g_strdup (meta_kms_connector_get_name (kms_connector));
|
||||
|
||||
gpu_id = meta_gpu_kms_get_id (gpu_kms);
|
||||
connector_id = meta_kms_connector_get_id (kms_connector);
|
||||
output->winsys_id = ((uint64_t) gpu_id << 32) | connector_id;
|
||||
|
||||
output_kms->kms_connector = kms_connector;
|
||||
|
||||
connector_state = meta_kms_connector_get_current_state (kms_connector);
|
||||
|
@ -220,7 +220,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
{
|
||||
MetaOutput *possible_clone = k->data;
|
||||
|
||||
if (clone == (XID) possible_clone->winsys_id)
|
||||
if (clone == (XID) meta_output_get_id (possible_clone))
|
||||
{
|
||||
output->possible_clones[j] = possible_clone;
|
||||
break;
|
||||
|
@ -491,7 +491,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
output->is_dirty = TRUE;
|
||||
meta_output_assign_crtc (output, crtc);
|
||||
|
||||
output_ids[j] = output->winsys_id;
|
||||
output_ids[j] = meta_output_get_id (output);
|
||||
}
|
||||
|
||||
rotation = meta_monitor_transform_to_xrandr (crtc_info->transform);
|
||||
@ -793,7 +793,7 @@ meta_monitor_manager_xrandr_tiled_monitor_added (MetaMonitorManager *manager,
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
|
||||
xrandr_monitor_info->outputs[i] = output->winsys_id;
|
||||
xrandr_monitor_info->outputs[i] = meta_output_get_id (output);
|
||||
}
|
||||
|
||||
XRRSetMonitor (manager_xrandr->xdisplay,
|
||||
|
@ -70,7 +70,7 @@ output_set_presentation_xrandr (MetaOutput *output,
|
||||
atom = XInternAtom (xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False);
|
||||
|
||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||
(XID) output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom, XCB_ATOM_CARDINAL, 32,
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
1, &value);
|
||||
@ -90,7 +90,7 @@ output_set_underscanning_xrandr (MetaOutput *output,
|
||||
valueatom = XInternAtom (xdisplay, value, False);
|
||||
|
||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||
(XID) output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
prop, XCB_ATOM_ATOM, 32,
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
1, &valueatom);
|
||||
@ -111,7 +111,7 @@ output_set_underscanning_xrandr (MetaOutput *output,
|
||||
border_value = crtc_config->mode->width * 0.05;
|
||||
|
||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||
(XID) output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
prop, XCB_ATOM_INTEGER, 32,
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
1, &border_value);
|
||||
@ -120,7 +120,7 @@ output_set_underscanning_xrandr (MetaOutput *output,
|
||||
border_value = crtc_config->mode->height * 0.05;
|
||||
|
||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||
(XID) output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
prop, XCB_ATOM_INTEGER, 32,
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
1, &border_value);
|
||||
@ -135,7 +135,7 @@ meta_output_xrandr_apply_mode (MetaOutput *output)
|
||||
if (output->is_primary)
|
||||
{
|
||||
XRRSetOutputPrimary (xdisplay, DefaultRootWindow (xdisplay),
|
||||
(XID) output->winsys_id);
|
||||
(XID) meta_output_get_id (output));
|
||||
}
|
||||
|
||||
output_set_presentation_xrandr (output, output->is_presentation);
|
||||
@ -166,7 +166,7 @@ meta_output_xrandr_change_backlight (MetaOutput *output,
|
||||
atom = XInternAtom (xdisplay, "Backlight", False);
|
||||
|
||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom, XCB_ATOM_INTEGER, 32,
|
||||
XCB_PROP_MODE_REPLACE,
|
||||
1, &hw_value);
|
||||
@ -189,7 +189,7 @@ output_get_integer_property (MetaOutput *output,
|
||||
|
||||
atom = XInternAtom (xdisplay, propname, False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_INTEGER,
|
||||
&actual_type, &actual_format,
|
||||
@ -217,7 +217,7 @@ output_get_property_exists (MetaOutput *output,
|
||||
|
||||
atom = XInternAtom (xdisplay, propname, False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, AnyPropertyType,
|
||||
&actual_type, &actual_format,
|
||||
@ -241,7 +241,7 @@ output_get_boolean_property (MetaOutput *output,
|
||||
|
||||
atom = XInternAtom (xdisplay, propname, False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_CARDINAL,
|
||||
&actual_type, &actual_format,
|
||||
@ -271,7 +271,7 @@ output_get_underscanning_xrandr (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "underscan", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
@ -298,7 +298,7 @@ output_get_supports_underscanning_xrandr (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "underscan", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
@ -308,7 +308,7 @@ output_get_supports_underscanning_xrandr (MetaOutput *output)
|
||||
return FALSE;
|
||||
|
||||
property_info = XRRQueryOutputProperty (xdisplay,
|
||||
(XID) output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom);
|
||||
values = (Atom *) property_info->values;
|
||||
|
||||
@ -341,7 +341,7 @@ output_get_backlight_xrandr (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "Backlight", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_INTEGER,
|
||||
&actual_type, &actual_format,
|
||||
@ -363,14 +363,16 @@ output_get_backlight_limits_xrandr (MetaOutput *output)
|
||||
Display *xdisplay = xdisplay_from_output (output);
|
||||
Atom atom;
|
||||
xcb_connection_t *xcb_conn;
|
||||
xcb_randr_output_t output_id;
|
||||
xcb_randr_query_output_property_cookie_t cookie;
|
||||
g_autofree xcb_randr_query_output_property_reply_t *reply = NULL;
|
||||
|
||||
atom = XInternAtom (xdisplay, "Backlight", False);
|
||||
|
||||
xcb_conn = XGetXCBConnection (xdisplay);
|
||||
output_id = meta_output_get_id (output);
|
||||
cookie = xcb_randr_query_output_property (xcb_conn,
|
||||
(xcb_randr_output_t) output->winsys_id,
|
||||
output_id,
|
||||
(xcb_atom_t) atom);
|
||||
reply = xcb_randr_query_output_property_reply (xcb_conn,
|
||||
cookie,
|
||||
@ -434,12 +436,18 @@ meta_output_xrandr_read_edid (MetaOutput *output)
|
||||
gsize len;
|
||||
|
||||
edid_atom = XInternAtom (xdisplay, "EDID", FALSE);
|
||||
result = get_edid_property (xdisplay, output->winsys_id, edid_atom, &len);
|
||||
result = get_edid_property (xdisplay,
|
||||
meta_output_get_id (output),
|
||||
edid_atom,
|
||||
&len);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
edid_atom = XInternAtom (xdisplay, "EDID_DATA", FALSE);
|
||||
result = get_edid_property (xdisplay, output->winsys_id, edid_atom, &len);
|
||||
result = get_edid_property (xdisplay,
|
||||
meta_output_get_id (output),
|
||||
edid_atom,
|
||||
&len);
|
||||
}
|
||||
|
||||
if (result)
|
||||
@ -527,7 +535,7 @@ output_get_connector_type_from_prop (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "ConnectorType", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
@ -623,7 +631,9 @@ output_get_panel_orientation_transform (MetaOutput *output)
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
atom = XInternAtom (xdisplay, "panel orientation", False);
|
||||
XRRGetOutputProperty (xdisplay, (XID)output->winsys_id, atom,
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID) meta_output_get_id (output),
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
&nitems, &bytes_after, &buffer);
|
||||
@ -665,7 +675,7 @@ output_get_tile_info (MetaOutput *output)
|
||||
|
||||
tile_atom = XInternAtom (xdisplay, "TILE", FALSE);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
output->winsys_id,
|
||||
(XID) meta_output_get_id (output),
|
||||
tile_atom, 0, 100, False,
|
||||
False, AnyPropertyType,
|
||||
&actual_type, &actual_format,
|
||||
@ -771,9 +781,9 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||
unsigned int i;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
"id", output_id,
|
||||
"gpu", gpu_xrandr,
|
||||
NULL);
|
||||
output->winsys_id = output_id;
|
||||
output->name = g_strdup (xrandr_output->name);
|
||||
|
||||
edid = meta_output_xrandr_read_edid (output);
|
||||
@ -817,7 +827,7 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||
output->possible_clones[i] = GINT_TO_POINTER (xrandr_output->clones[i]);
|
||||
}
|
||||
|
||||
output->is_primary = ((XID) output->winsys_id == primary_output);
|
||||
output->is_primary = (XID) meta_output_get_id (output) == primary_output;
|
||||
output->is_presentation = output_get_presentation_xrandr (output);
|
||||
output->is_underscanning = output_get_underscanning_xrandr (output);
|
||||
output->supports_underscanning =
|
||||
|
@ -152,9 +152,9 @@ meta_test_headless_monitor_connect (void)
|
||||
possible_crtcs[0] = g_list_first (test_setup->crtcs)->data;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
"id", 1,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
output->winsys_id = 1;
|
||||
output->name = g_strdup ("DP-1");
|
||||
output->vendor = g_strdup ("MetaProduct's Inc.");
|
||||
output->product = g_strdup ("MetaMonitor");
|
||||
|
@ -93,7 +93,7 @@ read_file (const char *file_path)
|
||||
|
||||
static MetaOutput *
|
||||
output_from_winsys_id (MetaBackend *backend,
|
||||
uint64_t winsys_id)
|
||||
uint64_t output_id)
|
||||
{
|
||||
MetaGpu *gpu = meta_backend_test_get_gpu (META_BACKEND_TEST (backend));
|
||||
GList *l;
|
||||
@ -102,7 +102,7 @@ output_from_winsys_id (MetaBackend *backend,
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
|
||||
if (output->winsys_id == winsys_id)
|
||||
if (meta_output_get_id (output) == output_id)
|
||||
return output;
|
||||
}
|
||||
|
||||
@ -650,12 +650,12 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
||||
serial = "0x123456";
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
"id", i,
|
||||
"gpu", test_get_gpu (),
|
||||
NULL);
|
||||
|
||||
if (crtc)
|
||||
meta_output_assign_crtc (output, crtc);
|
||||
output->winsys_id = i;
|
||||
output->name = (is_laptop_panel ? g_strdup_printf ("eDP-%d",
|
||||
++n_laptop_panels)
|
||||
: g_strdup_printf ("DP-%d",
|
||||
|
Loading…
Reference in New Issue
Block a user