monitor: Allow vendor/product/serial to return NULL
Same applies to MetaOutput. The reason for this is to make it possible to more reliably know when there was EDID telling us about these details. This will be used for colord integration. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
This commit is contained in:
parent
f939a7ca29
commit
ccb6a7e84f
@ -306,32 +306,42 @@ match_edid (MetaMapperInputInfo *input,
|
||||
MetaMonitor *monitor,
|
||||
MetaOutputMatchType *match_type)
|
||||
{
|
||||
const gchar *dev_name;
|
||||
const char *dev_name;
|
||||
const char *vendor;
|
||||
const char *serial;
|
||||
|
||||
dev_name = clutter_input_device_get_device_name (input->device);
|
||||
|
||||
if (strcasestr (dev_name, meta_monitor_get_vendor (monitor)) == NULL)
|
||||
vendor = meta_monitor_get_vendor (monitor);
|
||||
if (!vendor || strcasestr (dev_name, vendor) == NULL)
|
||||
return FALSE;
|
||||
|
||||
*match_type = META_MATCH_EDID_VENDOR;
|
||||
|
||||
if (strcasestr (dev_name, meta_monitor_get_product (monitor)) != NULL)
|
||||
serial = meta_monitor_get_serial (monitor);
|
||||
if (!serial || strcasestr (dev_name, serial) != NULL)
|
||||
{
|
||||
*match_type = META_MATCH_EDID_FULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
g_auto (GStrv) split = NULL;
|
||||
const char *product;
|
||||
|
||||
split = g_strsplit (meta_monitor_get_product (monitor), " ", -1);
|
||||
|
||||
for (i = 0; split[i]; i++)
|
||||
product = meta_monitor_get_product (monitor);
|
||||
if (product)
|
||||
{
|
||||
if (strcasestr (dev_name, split[i]) != NULL)
|
||||
g_auto (GStrv) split = NULL;
|
||||
int i;
|
||||
|
||||
split = g_strsplit (product, " ", -1);
|
||||
|
||||
for (i = 0; split[i]; i++)
|
||||
{
|
||||
*match_type = META_MATCH_EDID_PARTIAL;
|
||||
break;
|
||||
if (strcasestr (dev_name, split[i]) != NULL)
|
||||
{
|
||||
*match_type = META_MATCH_EDID_PARTIAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1688,6 +1688,9 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
gboolean is_underscanning;
|
||||
gboolean supports_underscanning;
|
||||
gboolean supports_color_transform;
|
||||
const char *vendor;
|
||||
const char *product;
|
||||
const char *serial;
|
||||
|
||||
g_variant_builder_init (&crtcs, G_VARIANT_TYPE ("au"));
|
||||
for (j = 0; j < output_info->n_possible_crtcs; j++)
|
||||
@ -1729,14 +1732,17 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
connector_type_name = get_connector_type_name (output_info->connector_type);
|
||||
supports_underscanning = output_info->supports_underscanning;
|
||||
supports_color_transform = output_info->supports_color_transform;
|
||||
vendor = output_info->vendor;
|
||||
product = output_info->product;;
|
||||
serial = output_info->serial;
|
||||
|
||||
g_variant_builder_init (&properties, G_VARIANT_TYPE ("a{sv}"));
|
||||
g_variant_builder_add (&properties, "{sv}", "vendor",
|
||||
g_variant_new_string (output_info->vendor));
|
||||
g_variant_new_string (vendor ? vendor : "unknown"));
|
||||
g_variant_builder_add (&properties, "{sv}", "product",
|
||||
g_variant_new_string (output_info->product));
|
||||
g_variant_new_string (product ? product : "unknown"));
|
||||
g_variant_builder_add (&properties, "{sv}", "serial",
|
||||
g_variant_new_string (output_info->serial));
|
||||
g_variant_new_string (serial ? serial : "unknown"));
|
||||
g_variant_builder_add (&properties, "{sv}", "width-mm",
|
||||
g_variant_new_int32 (output_info->width_mm));
|
||||
g_variant_builder_add (&properties, "{sv}", "height-mm",
|
||||
|
@ -194,13 +194,20 @@ meta_monitor_generate_spec (MetaMonitor *monitor)
|
||||
const MetaOutputInfo *output_info =
|
||||
meta_monitor_get_main_output_info (monitor);
|
||||
MetaMonitorSpec *monitor_spec;
|
||||
const char *vendor;
|
||||
const char *product;
|
||||
const char *serial;
|
||||
|
||||
vendor = output_info->vendor;
|
||||
product = output_info->product;
|
||||
serial = output_info->serial;
|
||||
|
||||
monitor_spec = g_new0 (MetaMonitorSpec, 1);
|
||||
*monitor_spec = (MetaMonitorSpec) {
|
||||
.connector = g_strdup (output_info->name),
|
||||
.vendor = g_strdup (output_info->vendor),
|
||||
.product = g_strdup (output_info->product),
|
||||
.serial = g_strdup (output_info->serial),
|
||||
.vendor = g_strdup (vendor ? vendor : "unknown"),
|
||||
.product = g_strdup (product ? product : "unknown"),
|
||||
.serial = g_strdup (serial ? serial : "unknown"),
|
||||
};
|
||||
|
||||
priv->spec = monitor_spec;
|
||||
@ -260,8 +267,7 @@ meta_monitor_make_display_name (MetaMonitor *monitor,
|
||||
}
|
||||
|
||||
vendor = meta_monitor_get_vendor (monitor);
|
||||
|
||||
if (g_strcmp0 (vendor, "unknown") != 0)
|
||||
if (vendor)
|
||||
{
|
||||
vendor_name = meta_monitor_manager_get_vendor_name (monitor_manager,
|
||||
vendor);
|
||||
|
@ -313,8 +313,7 @@ meta_output_info_parse_edid (MetaOutputInfo *output_info,
|
||||
size_t len;
|
||||
gconstpointer data;
|
||||
|
||||
if (!edid)
|
||||
goto out;
|
||||
g_return_if_fail (edid);
|
||||
|
||||
data = g_bytes_get_data (edid, &len);
|
||||
parsed_edid = meta_edid_info_new_parse (data);
|
||||
@ -346,14 +345,6 @@ meta_output_info_parse_edid (MetaOutputInfo *output_info,
|
||||
|
||||
g_free (parsed_edid);
|
||||
}
|
||||
|
||||
out:
|
||||
if (!output_info->vendor)
|
||||
output_info->vendor = g_strdup ("unknown");
|
||||
if (!output_info->product)
|
||||
output_info->product = g_strdup ("unknown");
|
||||
if (!output_info->serial)
|
||||
output_info->serial = g_strdup ("unknown");
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -483,7 +483,8 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
|
||||
output_info->max_bpc_max = max_bpc_range->max_value;
|
||||
}
|
||||
|
||||
meta_output_info_parse_edid (output_info, connector_state->edid_data);
|
||||
if (connector_state->edid_data)
|
||||
meta_output_info_parse_edid (output_info, connector_state->edid_data);
|
||||
|
||||
output_info->tile_info = connector_state->tile_info;
|
||||
|
||||
|
@ -970,8 +970,11 @@ meta_output_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
||||
output_info->name = g_strdup (xrandr_output->name);
|
||||
|
||||
edid = read_xrandr_edid (xdisplay, output_id);
|
||||
meta_output_info_parse_edid (output_info, edid);
|
||||
g_bytes_unref (edid);
|
||||
if (edid)
|
||||
{
|
||||
meta_output_info_parse_edid (output_info, edid);
|
||||
g_bytes_unref (edid);
|
||||
}
|
||||
|
||||
output_info->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;
|
||||
output_info->hotplug_mode_update = output_get_hotplug_mode_update (xdisplay,
|
||||
|
@ -415,12 +415,18 @@ meta_pad_action_mapper_cycle_tablet_output (MetaPadActionMapper *mapper,
|
||||
if (logical_monitor)
|
||||
{
|
||||
MetaMonitor *monitor;
|
||||
const char *vendor;
|
||||
const char *product;
|
||||
const char *serial;
|
||||
|
||||
/* Pick an arbitrary monitor in the logical monitor to represent it. */
|
||||
monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
||||
edid[0] = meta_monitor_get_vendor (monitor);
|
||||
edid[1] = meta_monitor_get_product (monitor);
|
||||
edid[2] = meta_monitor_get_serial (monitor);
|
||||
vendor = meta_monitor_get_vendor (monitor);
|
||||
product = meta_monitor_get_product (monitor);
|
||||
serial = meta_monitor_get_serial (monitor);
|
||||
edid[0] = vendor ? vendor : "";
|
||||
edid[1] = product ? product : "";
|
||||
edid[2] = serial ? serial : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -238,8 +238,8 @@ send_output_events (struct wl_resource *resource,
|
||||
width_mm,
|
||||
height_mm,
|
||||
subpixel_order,
|
||||
vendor,
|
||||
product,
|
||||
vendor ? vendor : "unknown",
|
||||
product ? product : "unknown",
|
||||
wl_transform);
|
||||
need_done = TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user