kms: Rename MetaKmsUpdateChanges to MetaKmsResourceChanges

The name had a bit conceptual conflicts with MetaKmsUpdate, as it shared
its namespace but had no relation to it. Fix this by renaming it
MetaKmsResourceChanges (and the corresponding META_KMS_UPDATE_CHANGE_*
to META_KMS_RESOURCE_CHANGE_*). The term "resource" is used since that's
already used in the signal, and the fact that the changes partly comes
from changes in the DRM resource as retrieved by drmModeGetResources.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2340>
This commit is contained in:
Jonas Ådahl 2022-03-17 10:22:05 +01:00 committed by Marge Bot
parent 633635d608
commit 1b0aa0b3ad
13 changed files with 101 additions and 101 deletions

View File

@ -101,7 +101,7 @@ uint64_t meta_kms_connector_get_prop_drm_value (MetaKmsConnector *connector,
MetaKmsConnectorProp prop,
uint64_t value);
MetaKmsUpdateChanges meta_kms_connector_update_state (MetaKmsConnector *connector,
MetaKmsResourceChanges meta_kms_connector_update_state (MetaKmsConnector *connector,
drmModeRes *drm_resources);
void meta_kms_connector_disable (MetaKmsConnector *connector);

View File

@ -568,80 +568,80 @@ kms_modes_equal (GList *modes,
return TRUE;
}
static MetaKmsUpdateChanges
static MetaKmsResourceChanges
meta_kms_connector_state_changes (MetaKmsConnectorState *state,
MetaKmsConnectorState *new_state)
{
if (state->current_crtc_id != new_state->current_crtc_id)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->common_possible_crtcs != new_state->common_possible_crtcs)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->common_possible_clones != new_state->common_possible_clones)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->encoder_device_idxs != new_state->encoder_device_idxs)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->width_mm != new_state->width_mm)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->height_mm != new_state->height_mm)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->has_scaling != new_state->has_scaling)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->non_desktop != new_state->non_desktop)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->subpixel_order != new_state->subpixel_order)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->suggested_x != new_state->suggested_x)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->suggested_y != new_state->suggested_y)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->hotplug_mode_update != new_state->hotplug_mode_update)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->panel_orientation_transform !=
new_state->panel_orientation_transform)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (!meta_tile_info_equal (&state->tile_info, &new_state->tile_info))
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if ((state->edid_data && !new_state->edid_data) || !state->edid_data ||
!g_bytes_equal (state->edid_data, new_state->edid_data))
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (!kms_modes_equal (state->modes, new_state->modes))
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->privacy_screen_state != new_state->privacy_screen_state)
return META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN;
return META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN;
return META_KMS_UPDATE_CHANGE_NONE;
return META_KMS_RESOURCE_CHANGE_NONE;
}
static void
meta_kms_connector_update_state_changes (MetaKmsConnector *connector,
MetaKmsUpdateChanges changes,
MetaKmsResourceChanges changes,
MetaKmsConnectorState *new_state)
{
MetaKmsConnectorState *current_state = connector->current_state;
g_return_if_fail (changes != META_KMS_UPDATE_CHANGE_FULL);
g_return_if_fail (changes != META_KMS_RESOURCE_CHANGE_FULL);
if (changes & META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN)
if (changes & META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN)
current_state->privacy_screen_state = new_state->privacy_screen_state;
}
static MetaKmsUpdateChanges
static MetaKmsResourceChanges
meta_kms_connector_read_state (MetaKmsConnector *connector,
MetaKmsImplDevice *impl_device,
drmModeConnector *drm_connector,
@ -649,11 +649,11 @@ meta_kms_connector_read_state (MetaKmsConnector *connector,
{
g_autoptr (MetaKmsConnectorState) state = NULL;
g_autoptr (MetaKmsConnectorState) current_state = NULL;
MetaKmsUpdateChanges connector_changes;
MetaKmsUpdateChanges changes;
MetaKmsResourceChanges connector_changes;
MetaKmsResourceChanges changes;
current_state = g_steal_pointer (&connector->current_state);
changes = META_KMS_UPDATE_CHANGE_NONE;
changes = META_KMS_RESOURCE_CHANGE_NONE;
meta_kms_impl_device_update_prop_table (impl_device,
drm_connector->props,
@ -665,7 +665,7 @@ meta_kms_connector_read_state (MetaKmsConnector *connector,
if (!drm_connector)
{
if (current_state)
changes = META_KMS_UPDATE_CHANGE_FULL;
changes = META_KMS_RESOURCE_CHANGE_FULL;
goto out;
}
@ -674,7 +674,7 @@ meta_kms_connector_read_state (MetaKmsConnector *connector,
if (drm_connector->connection != connector->connection)
{
connector->connection = drm_connector->connection;
changes |= META_KMS_UPDATE_CHANGE_FULL;
changes |= META_KMS_RESOURCE_CHANGE_FULL;
}
goto out;
@ -698,17 +698,17 @@ meta_kms_connector_read_state (MetaKmsConnector *connector,
if (drm_connector->connection != connector->connection)
{
connector->connection = drm_connector->connection;
changes |= META_KMS_UPDATE_CHANGE_FULL;
changes |= META_KMS_RESOURCE_CHANGE_FULL;
}
if (!current_state)
connector_changes = META_KMS_UPDATE_CHANGE_FULL;
connector_changes = META_KMS_RESOURCE_CHANGE_FULL;
else
connector_changes = meta_kms_connector_state_changes (current_state, state);
changes |= connector_changes;
if (!(changes & META_KMS_UPDATE_CHANGE_FULL))
if (!(changes & META_KMS_RESOURCE_CHANGE_FULL))
{
meta_kms_connector_update_state_changes (connector,
connector_changes,
@ -726,13 +726,13 @@ out:
return changes;
}
MetaKmsUpdateChanges
MetaKmsResourceChanges
meta_kms_connector_update_state (MetaKmsConnector *connector,
drmModeRes *drm_resources)
{
MetaKmsImplDevice *impl_device;
drmModeConnector *drm_connector;
MetaKmsUpdateChanges changes;
MetaKmsResourceChanges changes;
impl_device = meta_kms_device_get_impl_device (connector->device);
drm_connector = drmModeGetConnector (meta_kms_impl_device_get_fd (impl_device),

View File

@ -38,7 +38,7 @@ MetaKmsCrtc * meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
int idx,
GError **error);
MetaKmsUpdateChanges meta_kms_crtc_update_state (MetaKmsCrtc *crtc);
MetaKmsResourceChanges meta_kms_crtc_update_state (MetaKmsCrtc *crtc);
void meta_kms_crtc_disable (MetaKmsCrtc *crtc);

View File

@ -131,38 +131,38 @@ read_gamma_state (MetaKmsCrtc *crtc,
crtc_state->gamma.blue);
}
static MetaKmsUpdateChanges
static MetaKmsResourceChanges
meta_kms_crtc_state_changes (MetaKmsCrtcState *state,
MetaKmsCrtcState *other_state)
{
if (state->is_active != other_state->is_active)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (!meta_rectangle_equal (&state->rect, &other_state->rect))
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->is_drm_mode_valid != other_state->is_drm_mode_valid)
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (!meta_drm_mode_equal (&state->drm_mode, &other_state->drm_mode))
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
if (state->gamma.size != other_state->gamma.size)
return META_KMS_UPDATE_CHANGE_GAMMA;
return META_KMS_RESOURCE_CHANGE_GAMMA;
if (memcmp (state->gamma.blue, other_state->gamma.blue,
state->gamma.size * sizeof (uint16_t)) != 0)
return META_KMS_UPDATE_CHANGE_GAMMA;
return META_KMS_RESOURCE_CHANGE_GAMMA;
if (memcmp (state->gamma.green, other_state->gamma.green,
state->gamma.size * sizeof (uint16_t)) != 0)
return META_KMS_UPDATE_CHANGE_GAMMA;
return META_KMS_RESOURCE_CHANGE_GAMMA;
if (memcmp (state->gamma.red, other_state->gamma.red,
state->gamma.size * sizeof (uint16_t)) != 0)
return META_KMS_UPDATE_CHANGE_GAMMA;
return META_KMS_RESOURCE_CHANGE_GAMMA;
return META_KMS_UPDATE_CHANGE_NONE;
return META_KMS_RESOURCE_CHANGE_NONE;
}
static void
@ -174,14 +174,14 @@ clear_gamma_state (MetaKmsCrtcState *crtc_state)
g_clear_pointer (&crtc_state->gamma.blue, g_free);
}
static MetaKmsUpdateChanges
static MetaKmsResourceChanges
meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
MetaKmsImplDevice *impl_device,
drmModeCrtc *drm_crtc,
drmModeObjectProperties *drm_props)
{
MetaKmsCrtcState crtc_state = {0};
MetaKmsUpdateChanges changes = META_KMS_UPDATE_CHANGE_NONE;
MetaKmsResourceChanges changes = META_KMS_RESOURCE_CHANGE_NONE;
MetaKmsProp *active_prop;
meta_kms_impl_device_update_prop_table (impl_device,
@ -213,7 +213,7 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
if (!crtc_state.is_active)
{
if (crtc->current_state.is_active)
changes |= META_KMS_UPDATE_CHANGE_FULL;
changes |= META_KMS_RESOURCE_CHANGE_FULL;
}
else
{
@ -229,18 +229,18 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
crtc->current_state.is_drm_mode_valid
? crtc->current_state.drm_mode.name
: "(nil)",
changes == META_KMS_UPDATE_CHANGE_NONE
changes == META_KMS_RESOURCE_CHANGE_NONE
? "no"
: "yes");
return changes;
}
MetaKmsUpdateChanges
MetaKmsResourceChanges
meta_kms_crtc_update_state (MetaKmsCrtc *crtc)
{
MetaKmsImplDevice *impl_device;
MetaKmsUpdateChanges changes;
MetaKmsResourceChanges changes;
int fd;
drmModeCrtc *drm_crtc;
drmModeObjectProperties *drm_props;
@ -256,7 +256,7 @@ meta_kms_crtc_update_state (MetaKmsCrtc *crtc)
crtc->current_state.is_active = FALSE;
crtc->current_state.rect = (MetaRectangle) { };
crtc->current_state.is_drm_mode_valid = FALSE;
changes = META_KMS_UPDATE_CHANGE_FULL;
changes = META_KMS_RESOURCE_CHANGE_FULL;
goto out;
}

View File

@ -25,7 +25,7 @@
MetaKmsImplDevice * meta_kms_device_get_impl_device (MetaKmsDevice *device);
MetaKmsUpdateChanges meta_kms_device_update_states_in_impl (MetaKmsDevice *device,
MetaKmsResourceChanges meta_kms_device_update_states_in_impl (MetaKmsDevice *device,
uint32_t crtc_id,
uint32_t connector_id);

View File

@ -253,13 +253,13 @@ meta_kms_device_disable (MetaKmsDevice *device)
NULL);
}
MetaKmsUpdateChanges
MetaKmsResourceChanges
meta_kms_device_update_states_in_impl (MetaKmsDevice *device,
uint32_t crtc_id,
uint32_t connector_id)
{
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
MetaKmsUpdateChanges changes;
MetaKmsResourceChanges changes;
meta_assert_in_kms_impl (device->kms);
meta_assert_is_waiting_for_kms_impl_task (device->kms);
@ -267,7 +267,7 @@ meta_kms_device_update_states_in_impl (MetaKmsDevice *device,
changes = meta_kms_impl_device_update_states (impl_device, crtc_id,
connector_id);
if (changes == META_KMS_UPDATE_CHANGE_NONE)
if (changes == META_KMS_RESOURCE_CHANGE_NONE)
return changes;
g_list_free (device->crtcs);

View File

@ -395,7 +395,7 @@ find_existing_connector (MetaKmsImplDevice *impl_device,
return NULL;
}
static MetaKmsUpdateChanges
static MetaKmsResourceChanges
update_connectors (MetaKmsImplDevice *impl_device,
drmModeRes *drm_resources)
{
@ -436,12 +436,12 @@ update_connectors (MetaKmsImplDevice *impl_device,
if (!added_connector &&
g_list_length (connectors) == g_list_length (priv->connectors))
return META_KMS_UPDATE_CHANGE_NONE;
return META_KMS_RESOURCE_CHANGE_NONE;
g_list_free_full (priv->connectors, g_object_unref);
priv->connectors = g_list_reverse (g_steal_pointer (&connectors));
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
}
static MetaKmsPlaneType
@ -844,7 +844,7 @@ clear_latched_fd_hold (MetaKmsImplDevice *impl_device)
}
}
MetaKmsUpdateChanges
MetaKmsResourceChanges
meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
uint32_t crtc_id,
uint32_t connector_id)
@ -854,7 +854,7 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
g_autoptr (GError) error = NULL;
int fd;
drmModeRes *drm_resources;
MetaKmsUpdateChanges changes;
MetaKmsResourceChanges changes;
GList *l;
meta_assert_in_kms_impl (meta_kms_impl_get_kms (priv->impl));
@ -911,7 +911,7 @@ err:
g_clear_list (&priv->crtcs, g_object_unref);
g_clear_list (&priv->connectors, g_object_unref);
return META_KMS_UPDATE_CHANGE_FULL;
return META_KMS_RESOURCE_CHANGE_FULL;
}
static void

View File

@ -148,7 +148,7 @@ void meta_kms_impl_device_hold_fd (MetaKmsImplDevice *impl_device);
void meta_kms_impl_device_unhold_fd (MetaKmsImplDevice *impl_device);
MetaKmsUpdateChanges meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
MetaKmsResourceChanges meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
uint32_t crtc_id,
uint32_t connector_id);

View File

@ -393,13 +393,13 @@ update_rotations (MetaKmsPlane *plane)
}
}
static MetaKmsUpdateChanges
static MetaKmsResourceChanges
meta_kms_plane_read_state (MetaKmsPlane *plane,
MetaKmsImplDevice *impl_device,
drmModePlane *drm_plane,
drmModeObjectProperties *drm_plane_props)
{
MetaKmsUpdateChanges changes = META_KMS_UPDATE_CHANGE_NONE;
MetaKmsResourceChanges changes = META_KMS_RESOURCE_CHANGE_NONE;
meta_kms_impl_device_update_prop_table (impl_device,
drm_plane_props->props,

View File

@ -54,7 +54,7 @@ GSource * meta_kms_register_fd_in_impl (MetaKms *kms,
gpointer user_data);
META_EXPORT_TEST
MetaKmsUpdateChanges meta_kms_update_states_sync (MetaKms *kms,
MetaKmsResourceChanges meta_kms_update_states_sync (MetaKms *kms,
GUdevDevice *udev_device);
gboolean meta_kms_in_impl_task (MetaKms *kms);

View File

@ -64,14 +64,14 @@ typedef enum _MetaKmsDeviceFlag
META_KMS_DEVICE_FLAG_NO_MODE_SETTING = 1 << 4,
} MetaKmsDeviceFlag;
typedef enum _MetaKmsUpdateChanges
typedef enum _MetaKmsResourceChanges
{
META_KMS_UPDATE_CHANGE_NONE = 0,
META_KMS_UPDATE_CHANGE_GAMMA = 1 << 0,
META_KMS_UPDATE_CHANGE_NO_DEVICES = 1 << 1,
META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN = 1 << 2,
META_KMS_UPDATE_CHANGE_FULL = -1,
} MetaKmsUpdateChanges;
META_KMS_RESOURCE_CHANGE_NONE = 0,
META_KMS_RESOURCE_CHANGE_GAMMA = 1 << 0,
META_KMS_RESOURCE_CHANGE_NO_DEVICES = 1 << 1,
META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN = 1 << 2,
META_KMS_RESOURCE_CHANGE_FULL = -1,
} MetaKmsResourceChanges;
typedef enum _MetaKmsUpdateFlag
{

View File

@ -567,11 +567,11 @@ typedef struct _UpdateStatesData
uint32_t connector_id;
} UpdateStatesData;
static MetaKmsUpdateChanges
static MetaKmsResourceChanges
meta_kms_update_states_in_impl (MetaKms *kms,
UpdateStatesData *update_data)
{
MetaKmsUpdateChanges changes = META_KMS_UPDATE_CHANGE_NONE;
MetaKmsResourceChanges changes = META_KMS_RESOURCE_CHANGE_NONE;
GList *l;
COGL_TRACE_BEGIN_SCOPED (MetaKmsUpdateStates,
@ -580,7 +580,7 @@ meta_kms_update_states_in_impl (MetaKms *kms,
meta_assert_in_kms_impl (kms);
if (!kms->devices)
return META_KMS_UPDATE_CHANGE_NO_DEVICES;
return META_KMS_RESOURCE_CHANGE_NO_DEVICES;
for (l = kms->devices; l; l = l->next)
{
@ -620,7 +620,7 @@ update_states_in_impl (MetaKmsImpl *impl,
return GUINT_TO_POINTER (meta_kms_update_states_in_impl (kms, data));
}
MetaKmsUpdateChanges
MetaKmsResourceChanges
meta_kms_update_states_sync (MetaKms *kms,
GUdevDevice *udev_device)
{
@ -646,18 +646,18 @@ meta_kms_update_states_sync (MetaKms *kms,
static void
handle_hotplug_event (MetaKms *kms,
GUdevDevice *udev_device,
MetaKmsUpdateChanges changes)
MetaKmsResourceChanges changes)
{
changes |= meta_kms_update_states_sync (kms, udev_device);
if (changes != META_KMS_UPDATE_CHANGE_NONE)
if (changes != META_KMS_RESOURCE_CHANGE_NONE)
g_signal_emit (kms, signals[RESOURCES_CHANGED], 0, changes);
}
void
meta_kms_resume (MetaKms *kms)
{
handle_hotplug_event (kms, NULL, META_KMS_UPDATE_CHANGE_FULL);
handle_hotplug_event (kms, NULL, META_KMS_RESOURCE_CHANGE_FULL);
}
static void
@ -665,7 +665,7 @@ on_udev_hotplug (MetaUdev *udev,
GUdevDevice *udev_device,
MetaKms *kms)
{
handle_hotplug_event (kms, udev_device, META_KMS_UPDATE_CHANGE_NONE);
handle_hotplug_event (kms, udev_device, META_KMS_RESOURCE_CHANGE_NONE);
}
static void
@ -673,7 +673,7 @@ on_udev_device_removed (MetaUdev *udev,
GUdevDevice *device,
MetaKms *kms)
{
handle_hotplug_event (kms, NULL, META_KMS_UPDATE_CHANGE_NONE);
handle_hotplug_event (kms, NULL, META_KMS_RESOURCE_CHANGE_NONE);
}
MetaBackend *
@ -797,5 +797,5 @@ meta_kms_class_init (MetaKmsClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
META_TYPE_KMS_UPDATE_CHANGES);
META_TYPE_KMS_RESOURCE_CHANGES);
}

View File

@ -523,20 +523,20 @@ handle_hotplug_event (MetaMonitorManager *manager)
static void
on_kms_resources_changed (MetaKms *kms,
MetaKmsUpdateChanges changes,
MetaKmsResourceChanges changes,
MetaMonitorManager *manager)
{
gboolean needs_emit_privacy_screen_change = FALSE;
g_assert (changes != META_KMS_UPDATE_CHANGE_NONE);
g_assert (changes != META_KMS_RESOURCE_CHANGE_NONE);
if (changes == META_KMS_UPDATE_CHANGE_GAMMA)
if (changes == META_KMS_RESOURCE_CHANGE_GAMMA)
{
meta_dbus_display_config_emit_monitors_changed (manager->display_config);
return;
}
if (changes & META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN)
if (changes & META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN)
{
if (manager->privacy_screen_change_state ==
META_PRIVACY_SCREEN_CHANGE_STATE_NONE)
@ -550,7 +550,7 @@ on_kms_resources_changed (MetaKms *kms,
needs_emit_privacy_screen_change = TRUE;
if (changes == META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN)
if (changes == META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN)
goto out;
}
@ -752,7 +752,7 @@ on_kms_privacy_screen_update_result (const MetaKmsFeedback *kms_feedback,
}
on_kms_resources_changed (kms,
META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN,
META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN,
manager);
}