1. 06 11月, 2013 3 次提交
  2. 09 10月, 2013 5 次提交
  3. 20 9月, 2013 1 次提交
  4. 30 8月, 2013 1 次提交
    • D
      drm: implement experimental render nodes · 1793126f
      David Herrmann 提交于
      Render nodes provide an API for userspace to use non-privileged GPU
      commands without any running DRM-Master. It is useful for offscreen
      rendering, GPGPU clients, and normal render clients which do not perform
      modesetting.
      
      Compared to legacy clients, render clients no longer need any
      authentication to perform client ioctls. Instead, user-space controls
      render/client access to GPUs via filesystem access-modes on the
      render-node. Once a render-node was opened, a client has full access to
      the client/render operations on the GPU. However, no modesetting or ioctls
      that affect global state are allowed on render nodes.
      
      To prevent privilege-escalation, drivers must explicitly state that they
      support render nodes. They must mark their render-only ioctls as
      DRM_RENDER_ALLOW so render clients can use them. Furthermore, they must
      support clients without any attached master.
      
      If filesystem access-modes are not enough for fine-grained access control
      to render nodes (very unlikely, considering the versaitlity of FS-ACLs),
      you may still fall-back to fd-passing from server to client (which allows
      arbitrary access-control). However, note that revoking access is
      currently impossible and unlikely to get implemented.
      
      Note: Render clients no longer have any associated DRM-Master as they are
      supposed to be independent of any server state. DRM core highly depends on
      file_priv->master to be non-NULL for modesetting/ctx/etc. commands.
      Therefore, drivers must be very careful to not require DRM-Master if they
      support DRIVER_RENDER.
      
      So far render-nodes are protected by "drm_rnodes". As long as this
      module-parameter is not set to 1, a driver will not create render nodes.
      This allows us to experiment with the API a bit before we stabilize it.
      
      v2: drop insecure GEM_FLINK to force use of dmabuf
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1793126f
  5. 19 8月, 2013 3 次提交
    • D
      drm: remove procfs code, take 2 · cb6458f9
      Daniel Vetter 提交于
      So almost two years ago I've tried to nuke the procfs code already
      once before:
      
      http://lists.freedesktop.org/archives/dri-devel/2011-October/015707.html
      
      The conclusion was that userspace drivers (specifically libdrm device
      node detection) stopped relying on procfs in 2001. But after some
      digging it turned out that the drmstat tool in libdrm is still using
      those files (but only when certain options are set). So we've decided
      to keep profcs.
      
      But I when I've started to dig around again what exactly this tool
      does I've noticed that it tries to read the "mem", "vm", and "vma"
      files from procfs. Now as far my git history digging shows "mem" never
      did anything useful (at least in the version that first showed up in
      upstream history in 2004) and the file was remove in
      
      commit 955b12de
      Author: Ben Gamari <bgamari@gmail.com>
      Date:   Tue Feb 17 20:08:49 2009 -0500
      
          drm: Convert proc files to seq_file and introduce debugfs
      
      Which means that for over 4 years drmstat has been broken, and no one
      cared. In my opinion that's proof enough that no one is actually using
      drmstat, and so that we can savely nuke the procfs support from drm.
      
      While at it fix up the error case cleanup for debugfs in drm_get_minor.
      
      v2: Fix dates, libdrm stopped relying on procfs for drm node detection
      in 2001.
      
      v3: fixup compilation warning for !CONFIG_DEBUG_FS, reported by
      Fengguang Wu.
      
      Cc: kbuild test robot <fengguang.wu@intel.com>
      Cc: Dave Airlie <airlied@linux.ie>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      cb6458f9
    • K
      drm: fix minor number range calculation · 24f40032
      Kristian Høgsberg 提交于
      Currently, both ranges overlap. Fix the limits so both ranges are mutually
      exclusive. Also use the occasion to convert whitespaces to tabs.
      Signed-off-by: NKristian Høgsberg <krh@bitplanet.net>
      (fixed up tabs and adjust commit-msg accordingly)
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      24f40032
    • D
      drm: mark context support as a legacy subsystem · 7c510133
      Daniel Vetter 提交于
      So after a lot of digging around in git histories it looks like this
      has only ever be used by dri1 render clients. Hence we can fully
      disable the entire thing for modesetting drivers and so greatly reduce
      the attack surface for potential exploits (or at least tools like
      trinity ...).
      
      Also add the drm_legacy prefix for functions which are called from
      common code. To further reduce the impact on common code also extract
      all the ctx release handling into a function (instead of only
      releasing individual handles) and make ctxbitmap_cleanup return void -
      it can never fail.
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      7c510133
  6. 07 8月, 2013 1 次提交
  7. 27 6月, 2013 1 次提交
  8. 31 5月, 2013 1 次提交
    • A
      drm, agpgart: Use pgprot_writecombine for AGP maps and make the MTRR optional · f435046d
      Andy Lutomirski 提交于
      I'm not sure I understand the intent of the previous behavior.  mmap
      on /dev/agpgart and DRM_AGP maps had no cache flags set, so they
      would be fully cacheable.  But the DRM code (most of the time) would
      add a write-combining MTRR that would change the effective memory
      type to WC.
      
      The new behavior just requests WC explicitly for all AGP maps.
      
      If there is any code out there that expects cacheable access to the
      AGP aperture (because the drm driver doesn't request an MTRR or
      because it's using /dev/agpgart directly), then it will now end up
      with a UC or WC mapping, depending on the architecture and PAT
      availability.  But cacheable access to the aperture seems like it's
      asking for trouble, because, AIUI, the aperture is an alias of RAM.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      f435046d
  9. 02 5月, 2013 1 次提交
  10. 28 2月, 2013 1 次提交
  11. 20 11月, 2012 3 次提交
    • I
      drm: add support for monotonic vblank timestamps · c61eef72
      Imre Deak 提交于
      Jumps in the vblank and page flip event timestamps cause trouble for
      clients, so we should avoid them. The timestamp we get currently with
      gettimeofday can jump, so use instead monotonic timestamps.
      
      For backward compatibility use a module flag to revert back to using
      gettimeofday timestamps. Add also a DRM_CAP_TIMESTAMP_MONOTONIC flag
      that is simply a read only version of the module flag, so that clients
      can query this without depending on sysfs.
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      c61eef72
    • S
      drm/drm_stub: Remove unnecessary null check before kfree. · 66141d3d
      Sachin Kamat 提交于
      kfree on a null argument is a no-op.
      Silences the following smatch warning:
      drivers/gpu/drm/drm_stub.c:496 drm_put_dev() info:
      redundant null check on dev->devname calling kfree()
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      66141d3d
    • D
      drm: fix returning -EINVAL on setmaster if another master is active · 08bec5b4
      David Herrmann 提交于
      We link every DRM "file_priv" to a "drm_master" structure. Currently, the
      drmSetMaster() call returns 0 when there is _any_ active master associated
      with the "drm_master" structure of the calling "file_priv". This means,
      that after drmSetMaster() we are not guaranteed to be DRM-Master and might
      not be able to perform mode-setting.
      
      A way to reproduce this is by starting weston with the DRM backend from
      within an X-console (eg., xterm). Because the xserver's "drm_master" is
      currently active, weston is assigned to the same master but is inactive
      because its VT is inactive and the xserver is still active. But when
      "fake-activating" weston, it calls drmSetMaster(). With current behavior
      this returns "0/success" and weston thinks that it is DRM-Master, even
      though it is not (as the xserver is still DRM-Master).
      Expected behavior would be drmSetMaster() to return -EINVAL, because the
      xserver is still DRM-Master. This patch changes exactly that.
      
      The only way this bogus behavior would be useful is for clients to check
      whether their associated "drm_master" is currently the active DRM-Master.
      But this logic fails if no DRM-Master is currently active at all. Because
      then the client itself would become DRM-Master (if it is root) and this
      makes this whole thing useles.
      
      Also note that the second "if-condition":
        file_priv->minor->master != file_priv->master
      is always true and can be skipped.
      Signed-off-by: NDavid Herrmann <dh.herrmann@googlemail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      08bec5b4
  12. 03 10月, 2012 1 次提交
  13. 22 5月, 2012 1 次提交
  14. 24 4月, 2012 1 次提交
  15. 20 3月, 2012 1 次提交
  16. 15 3月, 2012 1 次提交
    • D
      drm: add core support for unplugging a device (v2) · 2c07a21d
      Dave Airlie 提交于
      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: NDave Airlie <airlied@redhat.com>
      2c07a21d
  17. 28 4月, 2011 1 次提交
    • J
      drm: Create and use drm_err · 5ad3d883
      Joe Perches 提交于
      Reduce drm text size ~1% by using drm_err and
      printf extension %pV to emit error messages.
      
      Remove unused macro DRM_MEM_ERROR.
      
      $ size drivers/gpu/drm/built-in.o*
         text	   data	    bss	    dec	    hex	filename
       361159	   9663	    256	 371078	  5a986	drivers/gpu/drm/built-in.o.new
       365416	   9663	    256	 375335	  5ba27	drivers/gpu/drm/built-in.o.old
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      5ad3d883
  18. 07 2月, 2011 2 次提交
  19. 22 11月, 2010 1 次提交
    • 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
  20. 30 8月, 2010 2 次提交
  21. 02 8月, 2010 1 次提交
    • C
      drm: Free devname along with master->unique · 6e35023f
      Chris Wilson 提交于
      The device name is tightly coupled and created at the same time as the
      master->unique address, so we need to free it with the master. Currently
      we overwrite it each time we create a new master:
      
      unreferenced object 0xe32c54b0 (size 32):
        comm "Xorg", pid 1455, jiffies 4294721798 (age 3196.879s)
        hex dump (first 32 bytes):
          69 39 31 35 40 70 63 69 3a 30 30 30 30 3a 30 30  i915@pci:0000:00
          3a 30 32 2e 30 00 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  :02.0.kkkkkkkkk.
        backtrace:
          [<c04e5657>] create_object+0x124/0x1f1
          [<c07cf0f0>] kmemleak_alloc+0x4c/0x90
          [<c04db84c>] __kmalloc+0x155/0x175
          [<f8316665>] drm_setversion+0x11d/0x1b1 [drm]
          [<f83148d4>] drm_ioctl+0x29a/0x356 [drm]
          [<c04f27c4>] vfs_ioctl+0x33/0x91
          [<c04f31cf>] do_vfs_ioctl+0x46b/0x496
          [<c04f3240>] sys_ioctl+0x46/0x66
          [<c040325f>] sysenter_do_call+0x12/0x38
          [<ffffffff>] 0xffffffff
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      6e35023f
  22. 01 6月, 2010 1 次提交
  23. 20 4月, 2010 1 次提交
  24. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  25. 07 12月, 2009 1 次提交
  26. 04 12月, 2009 1 次提交
  27. 18 11月, 2009 1 次提交
  28. 26 10月, 2009 1 次提交