virtual-monitor: Never reuse mode IDs

We'll change mode's on-demand so using IDs identical to the virtual
monitor ID would mean IDs didn't change when changing mode, and that is
rather unintuitive. IDs don't mean much anyhow, just make them grow
within the realm of a 63 bit unsigned integer, as the 64th bit means its
a virtual mode ID. Making sure the ID is in the virtual mode namespace
is handled by meta_crtc_mode_virtual_new().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
This commit is contained in:
Jonas Ådahl 2021-12-01 23:25:06 +01:00 committed by Marge Bot
parent ee8de0dc83
commit a97b6560d7

View File

@ -33,6 +33,8 @@ struct _MetaVirtualMonitorNative
uint64_t id;
};
static uint64_t mode_id = 1;
G_DEFINE_TYPE (MetaVirtualMonitorNative, meta_virtual_monitor_native,
META_TYPE_VIRTUAL_MONITOR)
@ -52,7 +54,7 @@ meta_virtual_monitor_native_new (uint64_t id,
MetaOutputVirtual *output_virtual;
crtc_virtual = meta_crtc_virtual_new (id);
crtc_mode_virtual = meta_crtc_mode_virtual_new (id, &info->mode_info);
crtc_mode_virtual = meta_crtc_mode_virtual_new (mode_id++, &info->mode_info);
output_virtual = meta_output_virtual_new (id, info,
crtc_virtual,
crtc_mode_virtual);