1. 23 11月, 2010 20 次提交
  2. 22 11月, 2010 2 次提交
    • M
      drm/vblank: Add support for precise vblank timestamping. · 27641c3f
      Mario Kleiner 提交于
      The DRI2 swap & sync implementation needs precise
      vblank counts and precise timestamps corresponding
      to those vblank counts. For conformance to the OpenML
      OML_sync_control extension specification the DRM
      timestamp associated with a vblank count should
      correspond to the start of video scanout of the first
      scanline of the video frame following the vblank
      interval for that vblank count.
      
      Therefore we need to carry around precise timestamps
      for vblanks. Currently the DRM and KMS drivers generate
      timestamps ad-hoc via do_gettimeofday() in some
      places. The resulting timestamps are sometimes not
      very precise due to interrupt handling delays, they
      don't conform to OML_sync_control and some are wrong,
      as they aren't taken synchronized to the vblank.
      
      This patch implements support inside the drm core
      for precise and robust timestamping. It consists
      of the following interrelated pieces.
      
      1. Vblank timestamp caching:
      
      A per-crtc ringbuffer stores the most recent vblank
      timestamps corresponding to vblank counts.
      
      The ringbuffer can be read out lock-free via the
      accessor function:
      
      struct timeval timestamp;
      vblankcount = drm_vblank_count_and_time(dev, crtcid, &timestamp).
      
      The function returns the current vblank count and
      the corresponding timestamp for start of video
      scanout following the vblank interval. It can be
      used anywhere between enclosing drm_vblank_get(dev, crtcid)
      and drm_vblank_put(dev,crtcid) statements. It is used
      inside the drmWaitVblank ioctl and in the vblank event
      queueing and handling. It should be used by kms drivers for
      timestamping of bufferswap completion.
      
      The timestamp ringbuffer is reinitialized each time
      vblank irq's get reenabled in drm_vblank_get()/
      drm_update_vblank_count(). It is invalidated when
      vblank irq's get disabled.
      
      The ringbuffer is updated inside drm_handle_vblank()
      at each vblank irq.
      
      2. Calculation of precise vblank timestamps:
      
      drm_get_last_vbltimestamp() is used to compute the
      timestamp for the end of the most recent vblank (if
      inside active scanout), or the expected end of the
      current vblank interval (if called inside a vblank
      interval). The function calls into a new optional kms
      driver entry point dev->driver->get_vblank_timestamp()
      which is supposed to provide the precise timestamp.
      If a kms driver doesn't implement the entry point or
      if the call fails, a simple do_gettimeofday() timestamp
      is returned as crude approximation of the true vblank time.
      
      A new drm module parameter drm.timestamp_precision_usec
      allows to disable high precision timestamps (if set to
      zero) or to specify the maximum acceptable error in
      the timestamps in microseconds.
      
      Kms drivers could implement their get_vblank_timestamp()
      function in a gpu specific way, as long as returned
      timestamps conform to OML_sync_control, e.g., by use
      of gpu specific hardware timestamps.
      
      Optionally, kms drivers can simply wrap and use the new
      utility function drm_calc_vbltimestamp_from_scanoutpos().
      This function calls a new optional kms driver function
      dev->driver->get_scanout_position() which returns the
      current horizontal and vertical video scanout position
      of the crtc. The scanout position together with the
      drm_display_timing of the current video mode is used
      to calculate elapsed time relative to start of active scanout
      for the current video frame. This elapsed time is subtracted
      from the current do_gettimeofday() time to get the timestamp
      corresponding to start of video scanout. Currently
      non-interlaced, non-doublescan video modes, with or
      without panel scaling are handled correctly. Interlaced/
      doublescan modes are tbd in a future patch.
      
      3. Filtering of redundant vblank irq's and removal of
      some race-conditions in the vblank irq enable/disable path:
      
      Some gpu's (e.g., Radeon R500/R600) send spurious vblank
      irq's outside the vblank if vblank irq's get reenabled.
      These get detected by use of the vblank timestamps and
      filtered out to avoid miscounting of vblanks.
      
      Some race-conditions between the vblank irq enable/disable
      functions, the vblank irq handler and the gpu itself (updating
      its hardware vblank counter in the "wrong" moment) are
      fixed inside vblank_disable_and_save() and
      drm_update_vblank_count() by use of the vblank timestamps and
      a new spinlock dev->vblank_time_lock.
      
      The time until vblank irq disable is now configurable via
      a new drm module parameter drm.vblankoffdelay to allow
      experimentation with timeouts that are much shorter than
      the current 5 seconds and should allow longer vblank off
      periods for better power savings.
      
      Followup patches will use these new functions to
      implement precise timestamping for the intel and radeon
      kms drivers.
      Signed-off-by: NMario Kleiner <mario.kleiner@tuebingen.mpg.de>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      27641c3f
    • L
      Linux 2.6.37-rc3 · 3561d43f
      Linus Torvalds 提交于
      3561d43f
  3. 20 11月, 2010 13 次提交
  4. 19 11月, 2010 5 次提交
    • D
      ext4: ext4_fill_super shouldn't return 0 on corruption · 5a9ae68a
      Darrick J. Wong 提交于
      At the start of ext4_fill_super, ret is set to -EINVAL, and any failure path
      out of that function returns ret.  However, the generic_check_addressable
      clause sets ret = 0 (if it passes), which means that a subsequent failure (e.g.
      a group checksum error) returns 0 even though the mount should fail.  This
      causes vfs_kern_mount in turn to think that the mount succeeded, leading to an
      oops.
      
      A simple fix is to avoid using ret for the generic_check_addressable check,
      which was last changed in commit 30ca22c7.
      Signed-off-by: NDarrick J. Wong <djwong@us.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      5a9ae68a
    • A
      drm/i915: Disable FBC on Ironlake to save 1W · 16c59ef3
      Alex Shi 提交于
      Frame buffer compression is broken on Ironlake due to buggy hardware.
      Currently it is disabled through chicken bits, but it still consumes
      over 1W more than if we simply never attempt to enable the FBC code
      paths.
      Signed-off-by: NAlex Shi <alex.shi@intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: stable@kernel.org
      16c59ef3
    • K
      drm/i915: Take advantage of auto-polling CRT hotplug detection on PCH hardware · e7dbb2f2
      Keith Packard 提交于
      Both IBX and CPT have an automatic hotplug detection mode which appears to work reliably enough
      that we can dispense with the manual force hotplug trigger stuff. This means that
      hotplug detection is as simple as reading the current hotplug register values.
      
      The first time the hotplug detection is activated, the code synchronously waits for a hotplug
      sequence in case the hardware hasn't bothered to do a detection cycle since being initialized.
      Signed-off-by: NKeith Packard <keithp@keithp.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      e7dbb2f2
    • C
      drm/i915/crt: Introduce struct intel_crt · c9a1c4cd
      Chris Wilson 提交于
      We will use this structure in future patches to store CRT specific
      information on the encoder.
      
      Split out and tweaked from a patch by Keith Packard.
      Signed-off-by: NKeith Packard <keithp@kithp.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      c9a1c4cd
    • C
      drm/i915: Do not hold mutex when faulting in user addresses · 51311d0a
      Chris Wilson 提交于
      Linus Torvalds found that it was rather trivial to trigger a system
      freeze:
      
        In fact, with lockdep, I don't even need to do the sysrq-d thing: it
        shows the bug as it happens. It's the X server taking the same lock
        recursively.
      
        Here's the problem:
      
          =============================================
          [ INFO: possible recursive locking detected ]
          2.6.37-rc2-00012-gbdbd01ac #7
          ---------------------------------------------
          Xorg/2816 is trying to acquire lock:
           (&dev->struct_mutex){+.+.+.}, at: [<ffffffff812c626c>] i915_gem_fault+0x50/0x17e
      
          but task is already holding lock:
           (&dev->struct_mutex){+.+.+.}, at: [<ffffffff812c403b>] i915_mutex_lock_interruptible+0x28/0x4a
      
          other info that might help us debug this:
          2 locks held by Xorg/2816:
           #0:  (&dev->struct_mutex){+.+.+.}, at: [<ffffffff812c403b>] i915_mutex_lock_interruptible+0x28/0x4a
           #1:  (&mm->mmap_sem){++++++}, at: [<ffffffff81022d4f>] page_fault+0x156/0x37b
      
      This recursion was introduced by rearranging the locking to avoid the
      double locking on the fast path (4f27b5d and fbd5a26d) and the
      introduction of the prefault to encourage the fast paths (b5e4f2b). In
      order to undo the problem, we rearrange the code to perform the access
      validation upfront, attempt to prefault and then fight for control of the
      mutex.  the best case scenario where the mutex is uncontended the
      prefaulting is not wasted.
      Reported-and-tested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      51311d0a