1. 20 4月, 2010 1 次提交
  2. 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
  3. 15 3月, 2010 1 次提交
  4. 11 2月, 2010 1 次提交
  5. 07 1月, 2010 1 次提交
  6. 18 12月, 2009 1 次提交
    • A
      drm: convert drm_ioctl to unlocked_ioctl · ed8b6704
      Arnd Bergmann 提交于
      drm_ioctl is called with the Big Kernel Lock held,
      which shows up very high in statistics on vfs_ioctl.
      
      Moving the lock into the drm_ioctl function itself
      makes sure we blame the right subsystem and it gets
      us one step closer to eliminating the locked version
      of fops->ioctl.
      
      Since drm_ioctl does not require the lock itself,
      we only need to hold it while calling the specific
      handler. The 32 bit conversion handlers do not
      interact with any other code, so they don't need
      the BKL here either and can just call drm_ioctl.
      
      As a bonus, this cleans up all the other users
      of drm_ioctl which now no longer have to find
      the inode or call lock_kernel.
      
      [airlied: squashed the non-driver bits
      of the second patch in here, this provides
      the flag for drivers to use to select unlocked
      ioctls - but doesn't modify any drivers].
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: dri-devel@lists.sourceforge.net
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ed8b6704
  7. 04 12月, 2009 2 次提交
  8. 02 12月, 2009 1 次提交
    • L
      drm/i915: Fix sync to vblank when VGA output is turned off · 778c9026
      Li Peng 提交于
      In current vblank-wait implementation, if we turn off VGA output,
      drm_wait_vblank will still wait on the disabled pipe until timeout,
      because vblank on the pipe is assumed be enabled. This would cause
      slow system response on some system such as moblin.
      
      This patch resolve the issue by adding a drm helper function
      drm_vblank_off which explicitly clear vblank_enabled[crtc], wake up
      any waiting queue and save last vblank counter before turning off
      crtc. It also slightly change drm_vblank_get to ensure that we will
      will return immediately if trying to wait on a disabled pipe.
      Signed-off-by: NLi Peng <peng.li@intel.com>
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      [anholt: hand-applied for conflicts with overlay changes]
      Signed-off-by: NEric Anholt <eric@anholt.net>
      778c9026
  9. 25 11月, 2009 1 次提交
    • E
      drm/i915: Replace a calloc followed by copying data over it with malloc. · c8e0f93a
      Eric Anholt 提交于
      Execbufs involve quite a bit of payload, to the extent that cache misses
      show up in the profiles here, and a suspicion that some of those cachelines
      may get evicted and then reloaded in the subsequent copy.
      
      This is still abstracted like drm_calloc_large since we want to check for
      size overflow, and because we want to choose between kmalloc and vmalloc
      on the fly.  cairo's interface for malloc-with-calloc's-args was used as
      the model.
      Signed-off-by: NEric Anholt <eric@anholt.net>
      c8e0f93a
  10. 18 11月, 2009 3 次提交
  11. 26 10月, 2009 1 次提交
  12. 21 9月, 2009 1 次提交
    • D
      drm/vgaarb: add VGA arbitration support to the drm and kms. · 28d52043
      Dave Airlie 提交于
      VGA arb requires DRM support for non-kms drivers, to turn on/off
      irqs when disabling the mem/io regions.
      
      VGA arb requires KMS support for GPUs where we can turn off VGA
      decoding. Currently we know how to do this for intel and radeon
      kms drivers, which allows them to be removed from the arbiter.
      
      This patch comes from Fedora rawhide kernel.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      28d52043
  13. 27 8月, 2009 1 次提交
  14. 04 8月, 2009 3 次提交
  15. 19 6月, 2009 1 次提交
  16. 12 6月, 2009 2 次提交
  17. 11 6月, 2009 2 次提交
    • Y
      drm: add separate drm debugging levels · 4fefcb27
      yakui_zhao 提交于
      Now all the DRM debug info will be reported if the boot option of
      "drm.debug=1" is added. Sometimes it is inconvenient to get the debug
      info in KMS mode. We will get too much unrelated info.
      
      This will separate several DRM debug levels and the debug level can be used
      to print the different debug info. And the debug level is controlled by the
      module parameter of drm.debug
      
      In this patch it is divided into four debug levels;
             	drm_core, drm_driver, drm_kms, drm_mode.
      
      At the same time we can get the different debug info by changing the debug
      level. This can be done by adding the module parameter. Of course it can
      be changed through the /sys/module/drm/parameters/debug after the system is
      booted.
      
      Four debug macro definitions are provided.
      	DRM_DEBUG(fmt, args...)
      	DRM_DEBUG_DRIVER(prefix, fmt, args...)
      	DRM_DEBUG_KMS(prefix, fmt, args...)
      	DRM_DEBUG_MODE(prefix, fmt, args...)
      
      When the boot option of "drm.debug=4" is added, it will print the debug info
      using DRM_DEBUG_KMS macro definition.
      When the boot option of "drm.debug=6" is added, it will print the debug info
      using DRM_DEBUG_KMS/DRM_DEBUG_DRIVER.
      
      Sometimes we expect to print the value of an array.
      For example: SDVO command,
      In such case the following four DRM debug macro definitions are added:
      	DRM_LOG(fmt, args...)
      	DRM_LOG_DRIVER(fmt, args...)
      	DRM_LOG_KMS(fmt, args...)
      	DRM_LOG_MODE(fmt, args...)
      Signed-off-by: NZhao Yakui <yakui.zhao@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      4fefcb27
    • R
      drm: fix LOCK_TEST_WITH_RETURN macro · dcae3626
      Roel Kluin 提交于
      When this macro isn't called with 'file_priv' this will result in a build
      failure.
      Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      dcae3626
  18. 20 5月, 2009 1 次提交
    • J
      drm/i915: allocate large pointer arrays with vmalloc · 8e7d2b2c
      Jesse Barnes 提交于
      For awhile now, many of the GEM code paths have allocated page or
      object arrays with the slab allocator.  This is nice and fast, but
      won't work well if memory is fragmented, since the slab allocator works
      with physically contiguous memory (i.e. order > 2 allocations are
      likely to fail fairly early after booting and doing some work).
      
      This patch works around the issue by falling back to vmalloc for
      >PAGE_SIZE allocations.  This is ugly, but much less work than chaining
      a bunch of pages together by hand (suprisingly there's not a bunch of
      generic kernel helpers for this yet afaik).  vmalloc space is somewhat
      precious on 32 bit kernels, but our allocations shouldn't be big enough
      to cause problems, though they're routinely more than a page.
      
      Note that this patch doesn't address the unchecked
      alloc-based-on-ioctl-args in GEM; that needs to be fixed in a separate
      patch.
      
      Also, I've deliberately ignored the DRM's "area" junk.  I don't think
      anyone actually uses it anymore and I'm hoping it gets ripped out soon.
      
      [Updated: removed size arg to new free function.  We could unify the
      free functions as well once the DRM mem tracking is ripped out.]
      
      fd.o bug #20152 (part 1/3)
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      8e7d2b2c
  19. 29 3月, 2009 1 次提交
  20. 28 3月, 2009 1 次提交
  21. 13 3月, 2009 6 次提交
    • B
      drm: Convert proc files to seq_file and introduce debugfs · 955b12de
      Ben Gamari 提交于
      The old mechanism to formatting proc files is extremely ugly. The
      seq_file API was designed specifically for cases like this and greatly
      simplifies the process.
      
      Also, most of the files in /proc really don't belong there. This patch
      introduces the infrastructure for putting these into debugfs and exposes
      all of the proc files in debugfs as well.
      
      This contains the i915 hooks rewrite as well, to make bisectability better.
      Signed-off-by: NBen Gamari <bgamari@gmail.com>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      955b12de
    • K
      drm: Drop unused and broken dri_library_name sysfs attribute. · 8e100458
      Kristian Høgsberg 提交于
      The kernel shouldn't be in the business of telling user space which
      driver to load.  The kernel defers mapping PCI IDs to module names
      to user space and we should do the same for DRI drivers.
      
      And in fact, that's how it does work today.  Nothing uses the
      dri_library_name attribute, and the attribute is in fact broken.
      For intel devices, it falls back to the default behaviour of returning
      the kernel module name as the DRI driver name, which doesn't work for
      i965 devices.  Nobody has ever hit this problem or filed a bug about this.
      Signed-off-by: NKristian Høgsberg <krh@redhat.com>
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      8e100458
    • K
      drm: claim PCI device when running in modesetting mode. · 112b715e
      Kristian Høgsberg 提交于
      Under kernel modesetting, we manage the device at all times, regardless
      of VT switching and X servers, so the only decent thing to do is to
      claim the PCI device.  In that case, we call the suspend/resume hooks
      directly from the pci driver hooks instead of the current class device detour.
      Signed-off-by: NKristian Høgsberg <krh@redhat.com>
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      112b715e
    • B
      drm: Make drm_local_map use a resource_size_t offset · 41c2e75e
      Benjamin Herrenschmidt 提交于
      This changes drm_local_map to use a resource_size for its "offset"
      member instead of an unsigned long, thus allowing 32-bit machines
      with a >32-bit physical address space to be able to store there
      their register or framebuffer addresses when those are above 4G,
      such as when using a PCI video card on a recent AMCC 440 SoC.
      
      This patch isn't as "trivial" as it sounds: A few functions needed
      to have some unsigned long/int changed to resource_size_t and a few
      printk's had to be adjusted.
      
      But also, because userspace isn't capable of passing such offsets,
      I had to modify drm_find_matching_map() to ignore the offset passed
      in for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS.
      
      If we ever support multiple _DRM_FRAMEBUFFER or _DRM_REGISTERS maps
      for a given device, we might have to change that trick, but I don't
      think that happens on any current driver.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      41c2e75e
    • B
      drm: Split drm_map and drm_local_map · f77d390c
      Benjamin Herrenschmidt 提交于
      Once upon a time, the DRM made the distinction between the drm_map
      data structure exchanged with user space and the drm_local_map used
      in the kernel.
      
      For some reasons, while the BSD port still has that "feature", the
      linux part abused drm_map for kernel internal usage as the local
      map only existed as a typedef of the struct drm_map.
      
      This patch fixes it by declaring struct drm_local_map separately
      (though its content is currently identical to the userspace variant),
      and changing the kernel code to only use that, except when it's a
      user<->kernel interface (ie. ioctl).
      
      This allows subsequent changes to the in-kernel format
      
      I've also replaced the use of drm_local_map_t with struct drm_local_map
      in a couple of places. Mostly by accident but they are the same (the
      former is a typedef of the later) and I have some remote plans and
      half finished patch to completely kill the drm_local_map_t typedef
      so I left those bits in.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      f77d390c
    • B
      drm: Use resource_size_t for drm_get_resource_{start, len} · d883f7f1
      Benjamin Herrenschmidt 提交于
      The DRM uses its own wrappers to obtain resources from PCI devices,
      which currently convert the resource_size_t into an unsigned long.
      
      This is broken on 32-bit platforms with >32-bit physical address
      space.
      
      This fixes them, along with a few occurences of unsigned long used
      to store such a resource in drivers.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      d883f7f1
  22. 20 2月, 2009 1 次提交
  23. 28 1月, 2009 1 次提交
  24. 29 12月, 2008 5 次提交
    • E
      drm: Add a debug node for vblank state. · fede5c91
      Eric Anholt 提交于
      Signed-off-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      fede5c91
    • D
      DRM: add mode setting support · f453ba04
      Dave Airlie 提交于
      Add mode setting support to the DRM layer.
      
      This is a fairly big chunk of work that allows DRM drivers to provide
      full output control and configuration capabilities to userspace.  It was
      motivated by several factors:
        - the fb layer's APIs aren't suited for anything but simple
          configurations
        - coordination between the fb layer, DRM layer, and various userspace
          drivers is poor to non-existent (radeonfb excepted)
        - user level mode setting drivers makes displaying panic & oops
          messages more difficult
        - suspend/resume of graphics state is possible in many more
          configurations with kernel level support
      
      This commit just adds the core DRM part of the mode setting APIs.
      Driver specific commits using these new structure and APIs will follow.
      
      Co-authors: Jesse Barnes <jbarnes@virtuousgeek.org>, Jakob Bornecrantz <jakob@tungstengraphics.com>
      Contributors: Alan Hourihane <alanh@tungstengraphics.com>, Maarten Maathuis <madman2003@gmail.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      f453ba04
    • J
      drm: GEM mmap support · a2c0a97b
      Jesse Barnes 提交于
      Add core support for mapping of GEM objects.  Drivers should provide a
      vm_operations_struct if they want to support page faulting of objects.
      The code for handling GEM object offsets was taken from TTM, which was
      written by Thomas Hellström.
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      a2c0a97b
    • V
      drm: fix leak of uninitialized data to userspace · 1147c9cd
      Vegard Nossum 提交于
      ...so drm_getunique() is trying to copy some uninitialized data to
      userspace. The ECX register contains the number of words that are
      left to copy -- so there are 5 * 4 = 20 bytes left. The offset of the
      first uninitialized byte (counting from the start of the string) is
      also 20 (i.e. 0xf65d2294&((1 << 5)-1) == 20). So somebody tried to
      copy 40 bytes when the string was only 19 long.
      
      In drm_set_busid() we have this code:
      
              dev->unique_len = 40;
              dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER);
            ...
              len = snprintf(dev->unique, dev->unique_len, pci:%04x:%02x:%02x.%d",
      
      ...so it seems that dev->unique is never updated to reflect the
      actual length of the string. The remaining bytes (20 in this case)
      are random uninitialized bytes that are copied into userspace.
      
      This patch fixes the problem by setting dev->unique_len after the
      snprintf().
      
      airlied- I've had to fix this up to store the alloced size so
      we have it for drm_free later.
      Reported-by: NSitsofe Wheeler <sitsofe@yahoo.com>
      Signed-off-by: NVegard Nossum <vegardno@thuin.ifi.uio.no>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1147c9cd
    • D
      drm: move to kref per-master structures. · 7c1c2871
      Dave Airlie 提交于
      This is step one towards having multiple masters sharing a drm
      device in order to get fast-user-switching to work.
      
      It splits out the information associated with the drm master
      into a separate kref counted structure, and allocates this when
      a master opens the device node. It also allows the current master
      to abdicate (say while VT switched), and a new master to take over
      the hardware.
      
      It moves the Intel and radeon drivers to using the sarea from
      within the new master structures.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      7c1c2871