]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Move vblank evasion to commit (v4)
authorMatt Roper <matthew.d.roper@intel.com>
Tue, 23 Dec 2014 18:41:50 +0000 (10:41 -0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 12 Jan 2015 22:58:47 +0000 (23:58 +0100)
Move the vblank evasion up from the low-level, hw-specific
update_plane() handlers to the general plane commit operation.
Everything inside commit should now be non-sleeping, so this brings us
closer to how vblank evasion will behave once we move over to atomic.

v2:
 - Restore lost intel_crtc->active check on vblank evasion

v3:
 - Replace assert_pipe_enabled() in intel_disable_primary_hw_plane()
   with an intel_crtc->active test; it turns out assert_pipe_enabled()
   grabs some mutexes and can sleep, which we can't do with interrupts
   disabled.

v4:
 - Equivalent to v2; v3 change is now squashed into an earlier patch
   of the series.  (Ander).

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_sprite.c

index 260b91c4cbbfd0175dc351c1105f5d569cb78c5e..b7c59d56c3a6bbdbf075a47db99f7d385f8d55c3 100644 (file)
@@ -11864,6 +11864,12 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc)
                intel_update_watermarks(crtc);
 
        intel_runtime_pm_get(dev_priv);
+
+       /* Perform vblank evasion around commit operation */
+       if (intel_crtc->active)
+               intel_crtc->atomic.evade =
+                       intel_pipe_update_start(intel_crtc,
+                                               &intel_crtc->atomic.start_vbl_count);
 }
 
 static void intel_finish_crtc_commit(struct drm_crtc *crtc)
@@ -11873,6 +11879,10 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc)
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        struct drm_plane *p;
 
+       if (intel_crtc->atomic.evade)
+               intel_pipe_update_end(intel_crtc,
+                                     intel_crtc->atomic.start_vbl_count);
+
        intel_runtime_pm_put(dev_priv);
 
        if (intel_crtc->atomic.wait_vblank)
index d70bcc4bfcb706ec92e8d926ea0ef1c1f7cb7f74..8051468a3f7ea0fcbdb8901c70ef98b508907eee 100644 (file)
@@ -428,6 +428,10 @@ struct skl_pipe_wm {
  * and thus can't be run with interrupts disabled.
  */
 struct intel_crtc_atomic_commit {
+       /* vblank evasion */
+       bool evade;
+       unsigned start_vbl_count;
+
        /* Sleepable operations to perform before commit */
        bool wait_for_flips;
        bool disable_fbc;
index 3e6e95fe46ae30b3fce8ca584d3d5cd2d931db71..1dfdccbb9ab246a0fb1d1a38246111f4876b506d 100644 (file)
@@ -412,8 +412,6 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
        u32 sprctl;
        unsigned long sprsurf_offset, linear_offset;
        int pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
-       u32 start_vbl_count;
-       bool atomic_update;
 
        sprctl = I915_READ(SPCNTR(pipe, plane));
 
@@ -502,8 +500,6 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
                linear_offset += src_h * fb->pitches[0] + src_w * pixel_size;
        }
 
-       atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count);
-
        intel_update_primary_plane(intel_crtc);
 
        if (IS_CHERRYVIEW(dev) && pipe == PIPE_B)
@@ -525,9 +521,6 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
                   sprsurf_offset);
 
        intel_flush_primary_plane(dev_priv, intel_crtc->plane);
-
-       if (atomic_update)
-               intel_pipe_update_end(intel_crtc, start_vbl_count);
 }
 
 static void
@@ -539,10 +532,6 @@ vlv_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        int pipe = intel_plane->pipe;
        int plane = intel_plane->plane;
-       u32 start_vbl_count;
-       bool atomic_update;
-
-       atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count);
 
        intel_update_primary_plane(intel_crtc);
 
@@ -553,9 +542,6 @@ vlv_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
 
        intel_flush_primary_plane(dev_priv, intel_crtc->plane);
 
-       if (atomic_update)
-               intel_pipe_update_end(intel_crtc, start_vbl_count);
-
        intel_update_sprite_watermarks(dplane, crtc, 0, 0, 0, false, false);
 }
 
@@ -626,8 +612,6 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
        u32 sprctl, sprscale = 0;
        unsigned long sprsurf_offset, linear_offset;
        int pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
-       u32 start_vbl_count;
-       bool atomic_update;
 
        sprctl = I915_READ(SPRCTL(pipe));
 
@@ -711,8 +695,6 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                }
        }
 
-       atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count);
-
        intel_update_primary_plane(intel_crtc);
 
        I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]);
@@ -735,9 +717,6 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                   i915_gem_obj_ggtt_offset(obj) + sprsurf_offset);
 
        intel_flush_primary_plane(dev_priv, intel_crtc->plane);
-
-       if (atomic_update)
-               intel_pipe_update_end(intel_crtc, start_vbl_count);
 }
 
 static void
@@ -748,10 +727,6 @@ ivb_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc)
        struct intel_plane *intel_plane = to_intel_plane(plane);
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        int pipe = intel_plane->pipe;
-       u32 start_vbl_count;
-       bool atomic_update;
-
-       atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count);
 
        intel_update_primary_plane(intel_crtc);
 
@@ -764,9 +739,6 @@ ivb_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc)
 
        intel_flush_primary_plane(dev_priv, intel_crtc->plane);
 
-       if (atomic_update)
-               intel_pipe_update_end(intel_crtc, start_vbl_count);
-
        /*
         * Avoid underruns when disabling the sprite.
         * FIXME remove once watermark updates are done properly.
@@ -845,8 +817,6 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
        unsigned long dvssurf_offset, linear_offset;
        u32 dvscntr, dvsscale;
        int pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
-       u32 start_vbl_count;
-       bool atomic_update;
 
        dvscntr = I915_READ(DVSCNTR(pipe));
 
@@ -921,8 +891,6 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                linear_offset += src_h * fb->pitches[0] + src_w * pixel_size;
        }
 
-       atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count);
-
        intel_update_primary_plane(intel_crtc);
 
        I915_WRITE(DVSSTRIDE(pipe), fb->pitches[0]);
@@ -940,9 +908,6 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                   i915_gem_obj_ggtt_offset(obj) + dvssurf_offset);
 
        intel_flush_primary_plane(dev_priv, intel_crtc->plane);
-
-       if (atomic_update)
-               intel_pipe_update_end(intel_crtc, start_vbl_count);
 }
 
 static void
@@ -953,10 +918,6 @@ ilk_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc)
        struct intel_plane *intel_plane = to_intel_plane(plane);
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        int pipe = intel_plane->pipe;
-       u32 start_vbl_count;
-       bool atomic_update;
-
-       atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count);
 
        intel_update_primary_plane(intel_crtc);
 
@@ -968,9 +929,6 @@ ilk_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc)
 
        intel_flush_primary_plane(dev_priv, intel_crtc->plane);
 
-       if (atomic_update)
-               intel_pipe_update_end(intel_crtc, start_vbl_count);
-
        /*
         * Avoid underruns when disabling the sprite.
         * FIXME remove once watermark updates are done properly.