forked from luck/tmp_suning_uos_patched
drm: Introduce blob_lock
Create a new global blob_lock mutex, which protects the blob property list from insertion and/or deletion. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
d2ed34362a
commit
8fb6e7a579
|
@ -4216,25 +4216,34 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
|
||||||
if (!blob)
|
if (!blob)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = drm_mode_object_get(dev, &blob->base, DRM_MODE_OBJECT_BLOB);
|
|
||||||
if (ret) {
|
|
||||||
kfree(blob);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
blob->length = length;
|
blob->length = length;
|
||||||
|
|
||||||
memcpy(blob->data, data, length);
|
memcpy(blob->data, data, length);
|
||||||
|
|
||||||
|
mutex_lock(&dev->mode_config.blob_lock);
|
||||||
|
|
||||||
|
ret = drm_mode_object_get(dev, &blob->base, DRM_MODE_OBJECT_BLOB);
|
||||||
|
if (ret) {
|
||||||
|
kfree(blob);
|
||||||
|
mutex_unlock(&dev->mode_config.blob_lock);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
list_add_tail(&blob->head, &dev->mode_config.property_blob_list);
|
list_add_tail(&blob->head, &dev->mode_config.property_blob_list);
|
||||||
|
|
||||||
|
mutex_unlock(&dev->mode_config.blob_lock);
|
||||||
|
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drm_property_destroy_blob(struct drm_device *dev,
|
static void drm_property_destroy_blob(struct drm_device *dev,
|
||||||
struct drm_property_blob *blob)
|
struct drm_property_blob *blob)
|
||||||
{
|
{
|
||||||
|
mutex_lock(&dev->mode_config.blob_lock);
|
||||||
drm_mode_object_put(dev, &blob->base);
|
drm_mode_object_put(dev, &blob->base);
|
||||||
list_del(&blob->head);
|
list_del(&blob->head);
|
||||||
|
mutex_unlock(&dev->mode_config.blob_lock);
|
||||||
|
|
||||||
kfree(blob);
|
kfree(blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4341,6 +4350,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
drm_modeset_lock_all(dev);
|
drm_modeset_lock_all(dev);
|
||||||
|
mutex_lock(&dev->mode_config.blob_lock);
|
||||||
blob = drm_property_blob_find(dev, out_resp->blob_id);
|
blob = drm_property_blob_find(dev, out_resp->blob_id);
|
||||||
if (!blob) {
|
if (!blob) {
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
|
@ -4357,6 +4367,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
|
||||||
out_resp->length = blob->length;
|
out_resp->length = blob->length;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
mutex_unlock(&dev->mode_config.blob_lock);
|
||||||
drm_modeset_unlock_all(dev);
|
drm_modeset_unlock_all(dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -5490,6 +5501,7 @@ void drm_mode_config_init(struct drm_device *dev)
|
||||||
drm_modeset_lock_init(&dev->mode_config.connection_mutex);
|
drm_modeset_lock_init(&dev->mode_config.connection_mutex);
|
||||||
mutex_init(&dev->mode_config.idr_mutex);
|
mutex_init(&dev->mode_config.idr_mutex);
|
||||||
mutex_init(&dev->mode_config.fb_lock);
|
mutex_init(&dev->mode_config.fb_lock);
|
||||||
|
mutex_init(&dev->mode_config.blob_lock);
|
||||||
INIT_LIST_HEAD(&dev->mode_config.fb_list);
|
INIT_LIST_HEAD(&dev->mode_config.fb_list);
|
||||||
INIT_LIST_HEAD(&dev->mode_config.crtc_list);
|
INIT_LIST_HEAD(&dev->mode_config.crtc_list);
|
||||||
INIT_LIST_HEAD(&dev->mode_config.connector_list);
|
INIT_LIST_HEAD(&dev->mode_config.connector_list);
|
||||||
|
|
|
@ -1048,6 +1048,7 @@ struct drm_mode_group {
|
||||||
* @poll_running: track polling status for this device
|
* @poll_running: track polling status for this device
|
||||||
* @output_poll_work: delayed work for polling in process context
|
* @output_poll_work: delayed work for polling in process context
|
||||||
* @property_blob_list: list of all the blob property objects
|
* @property_blob_list: list of all the blob property objects
|
||||||
|
* @blob_lock: mutex for blob property allocation and management
|
||||||
* @*_property: core property tracking
|
* @*_property: core property tracking
|
||||||
* @preferred_depth: preferred RBG pixel depth, used by fb helpers
|
* @preferred_depth: preferred RBG pixel depth, used by fb helpers
|
||||||
* @prefer_shadow: hint to userspace to prefer shadow-fb rendering
|
* @prefer_shadow: hint to userspace to prefer shadow-fb rendering
|
||||||
|
@ -1103,6 +1104,8 @@ struct drm_mode_config {
|
||||||
bool delayed_event;
|
bool delayed_event;
|
||||||
struct delayed_work output_poll_work;
|
struct delayed_work output_poll_work;
|
||||||
|
|
||||||
|
struct mutex blob_lock;
|
||||||
|
|
||||||
/* pointers to standard properties */
|
/* pointers to standard properties */
|
||||||
struct list_head property_blob_list;
|
struct list_head property_blob_list;
|
||||||
struct drm_property *edid_property;
|
struct drm_property *edid_property;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user