[PATCH 08/13] drm: tweak getconnector locking
Daniel Vetter
daniel at ffwll.ch
Wed Dec 17 06:14:50 PST 2014
On Tue, Dec 16, 2014 at 06:05:36PM -0500, Rob Clark wrote:
> We need to hold connection_mutex as we read the properties. Easiest
> thing is just widen the scope where connection_mutex is held.
>
> Signed-off-by: Rob Clark <robdclark at gmail.com>
I'm not yet sure on the story we want to have for getprop locking (and
whether it's even relevant). But this gets us forward at least.
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/drm_crtc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 96965ec..62f5dc8 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2043,6 +2043,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
> DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id);
>
> mutex_lock(&dev->mode_config.mutex);
> + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
>
> connector = drm_connector_find(dev, out_resp->connector_id);
> if (!connector) {
> @@ -2076,14 +2077,11 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
> out_resp->mm_height = connector->display_info.height_mm;
> out_resp->subpixel = connector->display_info.subpixel_order;
> out_resp->connection = connector->status;
> - drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
> -
> encoder = drm_connector_get_encoder(connector);
> if (encoder)
> out_resp->encoder_id = encoder->base.id;
> else
> out_resp->encoder_id = 0;
> - drm_modeset_unlock(&dev->mode_config.connection_mutex);
>
> /*
> * This ioctl is called twice, once to determine how much space is
> @@ -2149,6 +2147,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
> out_resp->count_encoders = encoders_count;
>
> out:
> + drm_modeset_unlock(&dev->mode_config.connection_mutex);
> mutex_unlock(&dev->mode_config.mutex);
>
> return ret;
> --
> 2.1.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the dri-devel
mailing list