[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKMK7uGU5p9OR9ZruHePgQHG3UKVoE3cNo+e=00xS1+1j9=oKw@mail.gmail.com>
Date: Fri, 22 Apr 2016 15:27:03 +0200
From: Daniel Vetter <daniel@...ll.ch>
To: Benjamin Gaignard <benjamin.gaignard@...aro.org>
Cc: dri-devel <dri-devel@...ts.freedesktop.org>,
"linaro-mm-sig@...ts.linaro.org" <linaro-mm-sig@...ts.linaro.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Dave Airlie <airlied@...ux.ie>
Subject: Re: [PATCH v8 11/11] drm: sti: Add DRM driver itself
On Wed, Jul 30, 2014 at 7:42 PM, Benjamin Gaignard
<benjamin.gaignard@...aro.org> wrote:
> +static int sti_drm_crtc_page_flip(struct drm_crtc *crtc,
> + struct drm_framebuffer *fb,
> + struct drm_pending_vblank_event *event,
> + uint32_t page_flip_flags)
> +{
> + struct drm_device *drm_dev = crtc->dev;
> + struct drm_framebuffer *old_fb;
> + struct sti_mixer *mixer = to_sti_mixer(crtc);
> + unsigned long flags;
> + int ret;
> +
> + DRM_DEBUG_KMS("fb %d --> fb %d\n",
> + crtc->primary->fb->base.id, fb->base.id);
> +
> + mutex_lock(&drm_dev->struct_mutex);
struct_mutex locking here is pure cargo-cult. Please remove asap.
-Daniel
> +
> + old_fb = crtc->primary->fb;
> + crtc->primary->fb = fb;
> + ret = sti_drm_crtc_mode_set_base(crtc, crtc->x, crtc->y, old_fb);
> + if (ret) {
> + DRM_ERROR("failed\n");
> + crtc->primary->fb = old_fb;
> + goto out;
> + }
> +
> + if (event) {
> + event->pipe = mixer->id;
> +
> + ret = drm_vblank_get(drm_dev, event->pipe);
> + if (ret) {
> + DRM_ERROR("Cannot get vblank\n");
> + goto out;
> + }
> +
> + spin_lock_irqsave(&drm_dev->event_lock, flags);
> + if (mixer->pending_event) {
> + drm_vblank_put(drm_dev, event->pipe);
> + ret = -EBUSY;
> + } else {
> + mixer->pending_event = event;
> + }
> + spin_unlock_irqrestore(&drm_dev->event_lock, flags);
> + }
> +out:
> + mutex_unlock(&drm_dev->struct_mutex);
> + return ret;
> +}
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Powered by blists - more mailing lists