1. 02 Oct, 2012 1 commit
  2. 19 Jul, 2012 5 commits
  3. 23 May, 2012 1 commit
  4. 22 May, 2012 2 commits
  5. 11 May, 2012 1 commit
    • Rob Clark's avatar
      drm: pass dev to drm_vm_{open,close}_locked() · b06d66be
      Rob Clark authored
      
      
      Previously these functions would assume that vma->vm_file was the
      drm_file.  Although if in some cases if the drm driver needs to use
      something else for the backing file (such as the tmpfs filp) then this
      assumption is no longer true.  But vma->vm_private_data is still the
      GEM object.
      
      With this change, now the drm_device comes from the GEM object rather
      than the drm_file so the driver is more free to play with vma->vm_file.
      
      The scenario where this comes up is for mmap'ing of cached dmabuf's
      for non-coherent systems, where the driver needs to use fault handling
      and PTE shootdown to simulate coherency.  We can't use the vma->vm_file
      of the dmabuf, which is using anon_inode's address_space.  The most
      straightforward thing to do is to use the GEM object's obj->filp for
      vma->vm_file in all cases, for which we need this patch.
      Signed-off-by: default avatarRob Clark <rob@ti.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      b06d66be
  6. 30 Mar, 2012 1 commit
    • Dave Airlie's avatar
      drm: base prime/dma-buf support (v5) · 3248877e
      Dave Airlie authored
      
      
      This adds the basic drm dma-buf interface layer, called PRIME. This
      commit doesn't add any driver support, it is simply and agreed upon starting
      point so we can work towards merging driver support for the next merge window.
      
      Current drivers with work done are nouveau, i915, udl, exynos and omap.
      
      The main APIs exposed to userspace allow translating a 32-bit object handle
      to a file descriptor, and a file descriptor to a 32-bit object handle.
      
      The flags value is currently limited to O_CLOEXEC.
      
      Acknowledgements:
      Daniel Vetter: lots of review
      Rob Clark: cleaned up lots of the internals and did lifetime review.
      
      v2: rename some functions after Chris preferred a green shed
      fix IS_ERR_OR_NULL -> IS_ERR
      v3: Fix Ville pointed out using buffer + kmalloc
      v4: add locking as per ickle review
      v5: allow re-exporting the original dma-buf (Daniel)
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarRob Clark <rob.clark@linaro.org>
      Reviewed-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
      Reviewed-by: default avatarInki Dae <inki.dae@samsung.com>
      Acked-by: default avatarBen Widawsky <benjamin.widawsky@intel.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      3248877e
  7. 27 Mar, 2012 1 commit
  8. 15 Mar, 2012 1 commit
    • Dave Airlie's avatar
      drm: add core support for unplugging a device (v2) · 2c07a21d
      Dave Airlie authored
      
      
      Two parts to this, one is simple unplug from sysfs for the device node.
      
      The second adds an unplugged state, if we have device opens, we
      just set the unplugged state and return, if we have no device
      opens we drop the drm device.
      
      If after a lastclose we discover we are unplugged we then
      drop the drm device.
      
      v2: use an atomic for unplugged and wrap it for users,
      add checks on open + mmap + ioctl entry points.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      2c07a21d
  9. 29 Feb, 2012 1 commit
  10. 25 Jan, 2012 1 commit
  11. 06 Jan, 2012 1 commit
  12. 02 Dec, 2011 1 commit
  13. 11 Nov, 2011 2 commits
    • Arjan van de Ven's avatar
      drm: Make the per-driver file_operations struct const · e08e96de
      Arjan van de Ven authored
      
      
      From fdf1fdebaa00f81de18c227f32f8074c8b352d50 Mon Sep 17 00:00:00 2001
      From: Arjan van de Ven <arjan@linux.intel.com>
      Date: Sun, 30 Oct 2011 19:06:07 -0700
      Subject: [PATCH] drm: Make the per-driver file_operations struct const
      
      The DRM layer keeps a copy of struct file_operations inside its
      big driver struct... which prevents it from being consistent and static.
      For consistency (and the general security objective of having such things
      static), it's desirable to get this fixed.
      
      This patch splits out the file_operations field to its own struct,
      which is then "static const", and just stick a pointer to this into
      the driver struct, making it more consistent with how the rest of the
      kernel does this.
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      e08e96de
    • Marcin Slusarz's avatar
      drm: serialize access to list of debugfs files · b3e067c0
      Marcin Slusarz authored
      
      
      Nouveau, when configured with debugfs, creates debugfs files for every
      channel, so structure holding list of files needs to be protected from
      simultaneous changes by multiple threads.
      
      Without this patch it's possible to hit kernel oops in
      drm_debugfs_remove_files just by running a couple of xterms with
      looped glxinfo.
      Signed-off-by: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      b3e067c0
  14. 31 Oct, 2011 2 commits
    • Joe Perches's avatar
      treewide: use __printf not __attribute__((format(printf,...))) · b9075fa9
      Joe Perches authored
      
      
      Standardize the style for compiler based printf format verification.
      Standardized the location of __printf too.
      
      Done via script and a little typing.
      
      $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
        grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
        xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'
      
      [akpm@linux-foundation.org: revert arch bits]
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b9075fa9
    • Paul Gortmaker's avatar
      include: replace linux/module.h with "struct module" wherever possible · de477254
      Paul Gortmaker authored
      
      
      The <linux/module.h> pretty much brings in the kitchen sink along
      with it, so it should be avoided wherever reasonably possible in
      terms of being included from other commonly used <linux/something.h>
      files, as it results in a measureable increase on compile times.
      
      The worst culprit was probably device.h since it is used everywhere.
      This file also had an implicit dependency/usage of mutex.h which was
      masked by module.h, and is also fixed here at the same time.
      
      There are over a dozen other headers that simply declare the
      struct instead of pulling in the whole file, so follow their lead
      and simply make it a few more.
      
      Most of the implicit dependencies on module.h being present by
      these headers pulling it in have been now weeded out, so we can
      finally make this change with hopefully minimal breakage.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      de477254
  15. 30 Aug, 2011 1 commit
  16. 25 Jul, 2011 1 commit
    • Alan Cox's avatar
      drm/gem: add support for private objects · 62cb7011
      Alan Cox authored
      
      
      These small changes should allow GEM to be used with non shmem objects as
      well as shmem objects. In the GMA500 case it allows the base framebuffer to
      appear as a GEM object and thus acquire a handle and work with KMS.
      
      For i915 it ought to be trivial to get back the wasted memory but putting the
      system fb back into stolen RAM and in general I can imagine it allowing the
      use of GEM and thus KMS with all the older cards that have their framebuffer
      firmly placed in video RAM.
      Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
      Tested-by: default avatarRob Clark <rob@ti.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      62cb7011
  17. 13 Jul, 2011 1 commit
  18. 20 Jun, 2011 1 commit
  19. 27 Apr, 2011 3 commits
  20. 31 Mar, 2011 1 commit
  21. 03 Mar, 2011 1 commit
  22. 27 Feb, 2011 1 commit
  23. 06 Feb, 2011 3 commits
    • Dave Airlie's avatar
      drm: add usb framework · a250b9fd
      Dave Airlie authored
      
      
      This adds an initial framework to plug USB graphics devices
      into the drm/kms subsystem.
      
      I've started writing a displaylink driver using this interface.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      a250b9fd
    • Dave Airlie's avatar
      drm: rework PCI/platform driver interface. · 8410ea3b
      Dave Airlie authored
      
      
      This abstracts the pci/platform interface out a step further,
      we can go further but this is far enough for now to allow USB
      to be plugged in.
      
      The drivers now just call the init code directly for their
      device type.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      8410ea3b
    • Dave Airlie's avatar
      drm: dumb scanout create/mmap for intel/radeon (v3) · ff72145b
      Dave Airlie authored
      
      
      This is just an idea that might or might not be a good idea,
      it basically adds two ioctls to create a dumb and map a dumb buffer
      suitable for scanout. The handle can be passed to the KMS ioctls to create
      a framebuffer.
      
      It looks to me like it would be useful in the following cases:
      a) in development drivers - we can always provide a shadowfb fallback.
      b) libkms users - we can clean up libkms a lot and avoid linking
      to libdrm_*.
      c) plymouth via libkms is a lot easier.
      
      Userspace bits would be just calls + mmaps. We could probably
      mark these handles somehow as not being suitable for acceleartion
      so as top stop people who are dumber than dumb.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      ff72145b
  24. 31 Jan, 2011 1 commit
    • Chris Wilson's avatar
      drm/i915: Suppress spurious vblank interrupts · 78c6e170
      Chris Wilson authored
      
      
      Hugh Dickins found that characters in xterm were going missing and oft
      delayed. Being the curious type, he managed to associate this with the
      new high-precision vblank patches; disabling these he found, restored
      the orderliness of his characters.
      
      The oddness begins when one realised that Hugh was not using vblanks at
      all on his system (fvwm and some xterms). Instead, all he had to go on
      were warning of a pipe underrun, curiously enough at around 60Hz. He
      poked and found that in addition to the underrun warning, the hardware
      was flagging the start of a new frame, a vblank, which in turn was
      kicking off the pending vblank processing code.
      
      There is little we can do for the underruns on Hugh's machine, a
      Crestline [965GM], which must have its FIFO watermarks set to 8.
      However, we do not need to process the vblank if we know that they are
      disabled...
      Reported-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      78c6e170
  25. 04 Jan, 2011 1 commit
  26. 23 Nov, 2010 1 commit
  27. 21 Nov, 2010 1 commit
    • Mario Kleiner's avatar
      drm/vblank: Add support for precise vblank timestamping. · 27641c3f
      Mario Kleiner authored
      
      
      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: default avatarMario Kleiner <mario.kleiner@tuebingen.mpg.de>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      27641c3f
  28. 01 Nov, 2010 1 commit
  29. 01 Oct, 2010 1 commit