]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/i915: Signal drm events for atomic
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 13 Jun 2016 14:13:45 +0000 (16:13 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 16 Jun 2016 12:28:34 +0000 (14:28 +0200)
This is part of what atomic must implement. And it's also required
to be able to use the helper nonblocking support.

v2: Always send out the drm event, remove the planes_changed check.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465827229-1704-1-git-send-email-daniel.vetter@ffwll.ch
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_sprite.c

index 095f83e22392bae4c2c368dfb9d608e0f5a632fb..6f85e63b387d08649204617b9013bb0dabdbd34f 100644 (file)
@@ -13799,13 +13799,21 @@ static int intel_atomic_commit(struct drm_device *dev,
                bool modeset = needs_modeset(crtc->state);
                struct intel_crtc_state *pipe_config =
                        to_intel_crtc_state(crtc->state);
-               bool update_pipe = !modeset && pipe_config->update_pipe;
 
                if (modeset && crtc->state->active) {
                        update_scanline_offset(to_intel_crtc(crtc));
                        dev_priv->display.crtc_enable(crtc);
                }
 
+               /* Complete events for now disable pipes here. */
+               if (modeset && !crtc->state->active && crtc->state->event) {
+                       spin_lock_irq(&dev->event_lock);
+                       drm_crtc_send_vblank_event(crtc, crtc->state->event);
+                       spin_unlock_irq(&dev->event_lock);
+
+                       crtc->state->event = NULL;
+               }
+
                if (!modeset)
                        intel_pre_plane_update(to_intel_crtc_state(old_crtc_state));
 
@@ -13813,8 +13821,7 @@ static int intel_atomic_commit(struct drm_device *dev,
                    drm_atomic_get_existing_plane_state(state, crtc->primary))
                        intel_fbc_enable(intel_crtc);
 
-               if (crtc->state->active &&
-                   (crtc->state->planes_changed || update_pipe))
+               if (crtc->state->active)
                        drm_atomic_helper_commit_planes_on_crtc(old_crtc_state);
 
                if (pipe_config->base.active && needs_vblank_wait(pipe_config))
index 324ccb06397d4da3c9bfd893aaf75e3731f05bd2..fc654173c491220f05330cfa827dfe24f844fcb1 100644 (file)
@@ -166,6 +166,20 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct intel_flip_work *work
 
        trace_i915_pipe_update_end(crtc, end_vbl_count, scanline_end);
 
+       /* We're still in the vblank-evade critical section, this can't race.
+        * Would be slightly nice to just grab the vblank count and arm the
+        * event outside of the critical section - the spinlock might spin for a
+        * while ... */
+       if (crtc->base.state->event) {
+               WARN_ON(drm_crtc_vblank_get(&crtc->base) != 0);
+
+               spin_lock(&crtc->base.dev->event_lock);
+               drm_crtc_arm_vblank_event(&crtc->base, crtc->base.state->event);
+               spin_unlock(&crtc->base.dev->event_lock);
+
+               crtc->base.state->event = NULL;
+       }
+
        local_irq_enable();
 
        if (crtc->debug.start_vbl_count &&