1. 14 2月, 2015 13 次提交
    • D
      drm/i915: Set up fb format modifier for initial plane config · 18c5247e
      Daniel Vetter 提交于
      No functional changes yet since intel_framebuffer_init would have
      fixed this up for us. But this is prep work to be able to handle new
      tiling layouts in the initial plane config code.
      
      Follow-up patches will start to make use of this and switch over to fb
      modifiers where needed.
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      18c5247e
    • D
      drm/i915: Add fb format modifier support · 2a80eada
      Daniel Vetter 提交于
      Currently we don't support anything but X tiled. And for an easier
      transition it makes a lot of sense to just keep requiring that X tiled
      is properly fenced.
      
      Which means we need to do absolutely nothing in old code to support fb
      modifiers, yay!
      
      v2: Fix the Y tiling check, noticed by Tvrtko.
      
      v3: Catch Y-tiled fb for legacy addfb again (Tvrtko) and explain why
      we want X tiling to match in the comment.
      
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      2a80eada
    • P
      drm/i915: change dev_priv->fbc.plane to dev_priv->fbc.crtc · e35fef21
      Paulo Zanoni 提交于
      Since the mapping from CRTCs to planes is fixed, looking at the CRTC
      is essentially the same as looking at the plane. Also, the next
      patches wil start using the frontbuffer_bits macros, and they take the
      pipe as the parameter instead of the plane, and this could differ on
      gens 2 and 3.
      
      Another nice thing is that we don't risk accidentally initializing
      things to PLANE_A if we don't set the value before it is used for the
      first time. But this shouldn't be a problem with the current code.
      
      V2: Rebase.
      
      Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> (v1)
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e35fef21
    • D
      drm/i915: Make sure the primary plane is enabled before reading out the fb state · 42a7b088
      Damien Lespiau 提交于
      We don't want to end up in a state where we track that the pipe has its
      primary plane enabled when primary plane registers are programmed with
      values that look possible but the plane actually disabled.
      
      Refuse to read out the fb state when the primary plane isn't enabled.
      Suggested-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Suggested-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      42a7b088
    • D
      drm/i915: Fix atomic state when reusing the firmware fb · fb9981aa
      Damien Lespiau 提交于
      Right now, we get a warning when taking over the firmware fb:
      
        [drm:drm_atomic_plane_check] FB set but no CRTC
      
      with the following backtrace:
      
        [<ffffffffa010339d>] drm_atomic_check_only+0x35d/0x510 [drm]
        [<ffffffffa0103567>] drm_atomic_commit+0x17/0x60 [drm]
        [<ffffffffa00a6ccd>] drm_atomic_helper_plane_set_property+0x8d/0xd0 [drm_kms_helper]
        [<ffffffffa00f1fed>] drm_mode_plane_set_obj_prop+0x2d/0x90 [drm]
        [<ffffffffa00a8a1b>] restore_fbdev_mode+0x6b/0xf0 [drm_kms_helper]
        [<ffffffffa00aa969>] drm_fb_helper_restore_fbdev_mode_unlocked+0x29/0x80 [drm_kms_helper]
        [<ffffffffa00aa9e2>] drm_fb_helper_set_par+0x22/0x50 [drm_kms_helper]
        [<ffffffffa050a71a>] intel_fbdev_set_par+0x1a/0x60 [i915]
        [<ffffffff813ad444>] fbcon_init+0x4f4/0x580
      
      That's because we update the plane state with the fb from the firmware, but we
      never associate the plane to that CRTC.
      
      We don't quite have the full DRM take over from HW state just yet, so
      fake enough of the plane atomic state to pass the checks.
      
      v2: Fix the state on which we set the CRTC in the case we're sharing the
          initial fb with another pipe. (Matt)
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      fb9981aa
    • D
      drm/i915: Store the initial framebuffer in initial_plane_config · 2d14030b
      Damien Lespiau 提交于
      At the moment we use crtc->base.primary->fb to hold the initial
      framebuffer allocation, disregarding if it's valid or not.
      
      This lead to believe we were actually updating the fb at this point, but
      it's not true and we haven't even called drm_framebuffer_init() on this
      fb.
      
      Instead, let's store the state in struct intel_initial_plane_config
      until we know we can reuse that framebuffer.
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2d14030b
    • D
      drm/i915: Don't try to reference the fb in get_initial_plane_config() · f55548b5
      Damien Lespiau 提交于
      Tvrtko noticed a new warning on boot:
      
        WARNING: CPU: 1 PID: 353 at include/linux/kref.h:47 drm_framebuffer_reference+0x6c/0x80 [drm]()
        Call Trace:
        [<ffffffff8161f10c>] dump_stack+0x4f/0x7b
        [<ffffffff81052caa>] warn_slowpath_common+0xaa/0xd0
        [<ffffffff81052d8a>] warn_slowpath_null+0x1a/0x20
        [<ffffffffa00d035c>] drm_framebuffer_reference+0x6c/0x80 [drm]
        [<ffffffffa01c0df7>] update_state_fb.isra.54+0x47/0x50 [i915]
        [<ffffffffa01ccd5c>] skylake_get_initial_plane_config+0x93c/0x950 [i915]
        [<ffffffffa01e8721>] intel_modeset_init+0x1551/0x17c0 [i915]
        [<ffffffffa02476e0>] i915_driver_load+0xed0/0x11e0 [i915]
        [<ffffffff81627aa1>] ? _raw_spin_unlock_irqrestore+0x51/0x70
        [<ffffffffa00ca8b7>] drm_dev_register+0x77/0x110 [drm]
        [<ffffffffa00cda3b>] drm_get_pci_dev+0x11b/0x1f0 [drm]
        [<ffffffff81098e3d>] ? trace_hardirqs_on+0xd/0x10
        [<ffffffff81627aa1>] ? _raw_spin_unlock_irqrestore+0x51/0x70
        [<ffffffffa0145276>] i915_pci_probe+0x56/0x60 [i915]
        [<ffffffff813ad59c>] pci_device_probe+0x7c/0x100
        [<ffffffff81466aad>] driver_probe_device+0x16d/0x380
      
      We cannot take a reference at this point, not before
      intel_framebuffer_init() and the underlying drm_framebuffer_init().
      
      Introduced in:
      
        commit 706dc7b549175e47f23e913b7f1e52874a7d0f56
        Author: Matt Roper <matthew.d.roper@intel.com>
        Date:   Tue Feb 3 13:10:04 2015 -0800
      
            drm/i915: Ensure plane->state->fb stays in sync with plane->fb
      
      v2: Don't move update_state_fb(). It was moved around because I
          originally put update_state_fb() in intel_alloc_plane_obj() before
          finding a better place. (Matt)
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Reported-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f55548b5
    • D
      drm/i915: Use an intermediate variable to avoid repeating ourselves · 6bf129df
      Damien Lespiau 提交于
      The code look slightly better this way and will ease the next commit,
      changing where we take the fb pointer from.
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6bf129df
    • D
      drm/i915: Put update_state_fb() next to the fb update · 5ba76c41
      Damien Lespiau 提交于
      update_state_fb() at the end of intel_find_plane_obj() is misleading as
      it leads us to believe the update is done for all code path.
      
      A successful call to intel_alloc_plane_obj() will return and
      update_state_fb() is then only needed when we share a fb from another
      CRTC. Put the update() function there then.
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5ba76c41
    • M
      drm/i915: Ensure plane->state->fb stays in sync with plane->fb · afd65eb4
      Matt Roper 提交于
      plane->state->fb and plane->fb should always reference the same FB so
      that atomic and legacy codepaths have the same view of display state.
      In commit
      
              commit db068420560511de80ac59222644f2bdf278c3d5
              Author: Matt Roper <matthew.d.roper@intel.com>
              Date:   Fri Jan 30 16:22:36 2015 -0800
      
                  drm/i915: Keep plane->state updated on pageflip
      
      we already fixed one case where these two pointers could get out of
      sync.  However it turns out there are a few other places (mainly dealing
      with initial FB setup at boot) that directly set plane->fb and neglect
      to update plane->state->fb.  If we never do a successful update through
      the atomic pipeline, the RmFB cleanup code will look at the
      plane->state->fb pointer, which has never actually been set to a
      legitimate value, and try to clean it up, leading to BUG's.
      
      Add a quick helper function to synchronize plane->state->fb with
      plane->fb (and update reference counts accordingly) and call it
      everywhere the driver tries to manually set plane->fb outside of the
      atomic pipeline.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88909Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      afd65eb4
    • T
      drm/i915: Track old framebuffer instead of object · ab8d6675
      Tvrtko Ursulin 提交于
      Daniel Vetter spotted a bug while reviewing some of my refactoring in this
      are of the code. I'll quote:
      
      """
      > @@ -9764,6 +9768,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
      >  	work->event = event;
      >  	work->crtc = crtc;
      >  	work->old_fb_obj = intel_fb_obj(old_fb);
      > +	work->old_tiling_mode = to_intel_framebuffer(old_fb)->tiling_mode;
      
      Hm, that's actually an interesting bugfix - currently userspace could be
      sneaky and destroy the old fb immediately after the flip completes and the
      change the tiling of the underlying object before the unpin work had a
      chance to run (needs some fudgin with rt prios to starve workers to make
      this work though).
      
      Imo the right fix is to hold a reference onto the fb and not the
      underlying gem object. With that tiling is guaranteed not to change.
      """
      
      This patch tries to implement the above proposed change.
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ab8d6675
    • M
      drm/i915: Switch planes from transitional helpers to full atomic helpers · 3f678c96
      Matt Roper 提交于
      There are two sets of helper functions provided by the DRM core that can
      implement the .update_plane() and .disable_plane() hooks in terms of a
      driver's atomic entrypoints.  The transitional helpers (which we have
      been using so far) create a plane state and then use the plane's atomic
      entrypoints to perform the atomic begin/check/prepare/commit/finish
      sequence on that single plane only.  The full atomic helpers create a
      top-level atomic state (which is capable of holding multiple object
      states for planes, crtc's, and/or connectors) and then passes the
      top-level atomic state through the full "atomic modeset" pipeline.
      
      Switching from the transitional to full helpers here shouldn't result in
      any functional change, but will enable us to exercise/test more of the
      internal atomic pipeline with the legacy API's used by existing
      applications.
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3f678c96
    • M
      drm/i915: Keep plane->state updated on pageflip · 1ed1f968
      Matt Roper 提交于
      Until all drivers have transitioned to atomic, the framebuffer
      associated with a plane is tracked in both plane->fb (for legacy) and
      plane->state->fb (for all the new atomic codeflow).  All of our modeset
      and plane updates use drm_plane->update_plane(), so in theory plane->fb
      and plane->state->fb should always stay in sync and point at the same
      thing for i915.  However we forgot about the pageflip ioctl case, which
      currently only updates plane->fb and leaves plane->state->fb at a stale
      value.
      
      Surprisingly, this doesn't cause any real problems at the moment since
      internally we use the plane->fb pointer in most of the places that
      matter, and on the next .update_plane() call, we use plane->fb to figure
      out which framebuffer to cleanup.  However when we switch to the full
      atomic helpers for update_plane()/disable_plane(), those helpers use
      plane->state->fb to figure out which framebuffer to cleanup, so not
      having updated the plane->state->fb pointer causes things to blow up
      following a pageflip ioctl.
      
      The fix here is to just make sure we update plane->state->fb at the same
      time we update plane->fb in the pageflip ioctl.
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1ed1f968
  2. 31 1月, 2015 1 次提交
  3. 27 1月, 2015 26 次提交