drm: gc now dead mode_group code
Two nice things here: - drm_dev_register will truly register everything in the right order if the driver doesn't have a ->load callback. Before this we had to init the primary mode_group after the device nodes where already registered. - Less things to keep track of when reworking the connector locking, yay! Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
Родитель
9c7060f7e3
Коммит
3fdefa399e
|
@ -1679,70 +1679,6 @@ int drm_mode_create_suggested_offset_properties(struct drm_device *dev)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(drm_mode_create_suggested_offset_properties);
|
EXPORT_SYMBOL(drm_mode_create_suggested_offset_properties);
|
||||||
|
|
||||||
static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
|
|
||||||
{
|
|
||||||
uint32_t total_objects = 0;
|
|
||||||
|
|
||||||
total_objects += dev->mode_config.num_crtc;
|
|
||||||
total_objects += dev->mode_config.num_connector;
|
|
||||||
total_objects += dev->mode_config.num_encoder;
|
|
||||||
|
|
||||||
group->id_list = kcalloc(total_objects, sizeof(uint32_t), GFP_KERNEL);
|
|
||||||
if (!group->id_list)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
group->num_crtcs = 0;
|
|
||||||
group->num_connectors = 0;
|
|
||||||
group->num_encoders = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void drm_mode_group_destroy(struct drm_mode_group *group)
|
|
||||||
{
|
|
||||||
kfree(group->id_list);
|
|
||||||
group->id_list = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE: Driver's shouldn't ever call drm_mode_group_init_legacy_group - it is
|
|
||||||
* the drm core's responsibility to set up mode control groups.
|
|
||||||
*/
|
|
||||||
int drm_mode_group_init_legacy_group(struct drm_device *dev,
|
|
||||||
struct drm_mode_group *group)
|
|
||||||
{
|
|
||||||
struct drm_crtc *crtc;
|
|
||||||
struct drm_encoder *encoder;
|
|
||||||
struct drm_connector *connector;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = drm_mode_group_init(dev, group);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
drm_for_each_crtc(crtc, dev)
|
|
||||||
group->id_list[group->num_crtcs++] = crtc->base.id;
|
|
||||||
|
|
||||||
drm_for_each_encoder(encoder, dev)
|
|
||||||
group->id_list[group->num_crtcs + group->num_encoders++] =
|
|
||||||
encoder->base.id;
|
|
||||||
|
|
||||||
drm_for_each_connector(connector, dev)
|
|
||||||
group->id_list[group->num_crtcs + group->num_encoders +
|
|
||||||
group->num_connectors++] = connector->base.id;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(drm_mode_group_init_legacy_group);
|
|
||||||
|
|
||||||
void drm_reinit_primary_mode_group(struct drm_device *dev)
|
|
||||||
{
|
|
||||||
drm_modeset_lock_all(dev);
|
|
||||||
drm_mode_group_destroy(&dev->primary->mode_group);
|
|
||||||
drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group);
|
|
||||||
drm_modeset_unlock_all(dev);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(drm_reinit_primary_mode_group);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_mode_getresources - get graphics configuration
|
* drm_mode_getresources - get graphics configuration
|
||||||
* @dev: drm device for the ioctl
|
* @dev: drm device for the ioctl
|
||||||
|
|
|
@ -285,7 +285,6 @@ static void drm_minor_free(struct drm_device *dev, unsigned int type)
|
||||||
if (!minor)
|
if (!minor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drm_mode_group_destroy(&minor->mode_group);
|
|
||||||
put_device(minor->kdev);
|
put_device(minor->kdev);
|
||||||
|
|
||||||
spin_lock_irqsave(&drm_minor_lock, flags);
|
spin_lock_irqsave(&drm_minor_lock, flags);
|
||||||
|
@ -705,20 +704,9 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
|
||||||
goto err_minors;
|
goto err_minors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup grouping for legacy outputs */
|
|
||||||
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
|
|
||||||
ret = drm_mode_group_init_legacy_group(dev,
|
|
||||||
&dev->primary->mode_group);
|
|
||||||
if (ret)
|
|
||||||
goto err_unload;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
err_unload:
|
|
||||||
if (dev->driver->unload)
|
|
||||||
dev->driver->unload(dev);
|
|
||||||
err_minors:
|
err_minors:
|
||||||
drm_minor_unregister(dev, DRM_MINOR_LEGACY);
|
drm_minor_unregister(dev, DRM_MINOR_LEGACY);
|
||||||
drm_minor_unregister(dev, DRM_MINOR_RENDER);
|
drm_minor_unregister(dev, DRM_MINOR_RENDER);
|
||||||
|
|
|
@ -441,7 +441,6 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
|
||||||
drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
|
drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
|
||||||
|
|
||||||
drm_mode_connector_set_path_property(connector, pathprop);
|
drm_mode_connector_set_path_property(connector, pathprop);
|
||||||
drm_reinit_primary_mode_group(dev);
|
|
||||||
drm_modeset_lock_all(dev);
|
drm_modeset_lock_all(dev);
|
||||||
intel_connector_add_to_fbdev(intel_connector);
|
intel_connector_add_to_fbdev(intel_connector);
|
||||||
drm_modeset_unlock_all(dev);
|
drm_modeset_unlock_all(dev);
|
||||||
|
@ -466,8 +465,6 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
|
||||||
drm_connector_cleanup(connector);
|
drm_connector_cleanup(connector);
|
||||||
drm_modeset_unlock_all(dev);
|
drm_modeset_unlock_all(dev);
|
||||||
|
|
||||||
drm_reinit_primary_mode_group(dev);
|
|
||||||
|
|
||||||
kfree(intel_connector);
|
kfree(intel_connector);
|
||||||
DRM_DEBUG_KMS("\n");
|
DRM_DEBUG_KMS("\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,6 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topol
|
||||||
|
|
||||||
drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0);
|
drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0);
|
||||||
drm_mode_connector_set_path_property(connector, pathprop);
|
drm_mode_connector_set_path_property(connector, pathprop);
|
||||||
drm_reinit_primary_mode_group(dev);
|
|
||||||
|
|
||||||
drm_modeset_lock_all(dev);
|
drm_modeset_lock_all(dev);
|
||||||
radeon_fb_add_connector(rdev, connector);
|
radeon_fb_add_connector(rdev, connector);
|
||||||
|
@ -309,8 +308,6 @@ static void radeon_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
|
||||||
|
|
||||||
drm_connector_cleanup(connector);
|
drm_connector_cleanup(connector);
|
||||||
drm_modeset_unlock_all(dev);
|
drm_modeset_unlock_all(dev);
|
||||||
drm_reinit_primary_mode_group(dev);
|
|
||||||
|
|
||||||
|
|
||||||
kfree(connector);
|
kfree(connector);
|
||||||
DRM_DEBUG_KMS("\n");
|
DRM_DEBUG_KMS("\n");
|
||||||
|
|
|
@ -675,7 +675,6 @@ struct drm_minor {
|
||||||
|
|
||||||
/* currently active master for this node. Protected by master_mutex */
|
/* currently active master for this node. Protected by master_mutex */
|
||||||
struct drm_master *master;
|
struct drm_master *master;
|
||||||
struct drm_mode_group mode_group;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1017,29 +1017,6 @@ struct drm_mode_config_funcs {
|
||||||
void (*atomic_state_free)(struct drm_atomic_state *state);
|
void (*atomic_state_free)(struct drm_atomic_state *state);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* struct drm_mode_group - group of mode setting resources for potential sub-grouping
|
|
||||||
* @num_crtcs: CRTC count
|
|
||||||
* @num_encoders: encoder count
|
|
||||||
* @num_connectors: connector count
|
|
||||||
* @num_bridges: bridge count
|
|
||||||
* @id_list: list of KMS object IDs in this group
|
|
||||||
*
|
|
||||||
* Currently this simply tracks the global mode setting state. But in the
|
|
||||||
* future it could allow groups of objects to be set aside into independent
|
|
||||||
* control groups for use by different user level processes (e.g. two X servers
|
|
||||||
* running simultaneously on different heads, each with their own mode
|
|
||||||
* configuration and freedom of mode setting).
|
|
||||||
*/
|
|
||||||
struct drm_mode_group {
|
|
||||||
uint32_t num_crtcs;
|
|
||||||
uint32_t num_encoders;
|
|
||||||
uint32_t num_connectors;
|
|
||||||
|
|
||||||
/* list of object IDs for this group */
|
|
||||||
uint32_t *id_list;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct drm_mode_config - Mode configuration control structure
|
* struct drm_mode_config - Mode configuration control structure
|
||||||
* @mutex: mutex protecting KMS related lists and structures
|
* @mutex: mutex protecting KMS related lists and structures
|
||||||
|
@ -1324,9 +1301,6 @@ extern const char *drm_get_tv_select_name(int val);
|
||||||
extern void drm_fb_release(struct drm_file *file_priv);
|
extern void drm_fb_release(struct drm_file *file_priv);
|
||||||
extern void drm_property_destroy_user_blobs(struct drm_device *dev,
|
extern void drm_property_destroy_user_blobs(struct drm_device *dev,
|
||||||
struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
|
|
||||||
extern void drm_mode_group_destroy(struct drm_mode_group *group);
|
|
||||||
extern void drm_reinit_primary_mode_group(struct drm_device *dev);
|
|
||||||
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
|
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
|
||||||
extern struct edid *drm_get_edid(struct drm_connector *connector,
|
extern struct edid *drm_get_edid(struct drm_connector *connector,
|
||||||
struct i2c_adapter *adapter);
|
struct i2c_adapter *adapter);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче