Commit Graph

50 Commits (a1345338feb7af25c0a9fe02ec16c2b9cce83a9e)

Author SHA1 Message Date
Márton Németh 9ab620d661 drm: cleanup DRM_DEBUG() parameters
As DRM_DEBUG macro already prints out the __FUNCTION__ string (see
drivers/char/drm/drmP.h), it is not worth doing this again. At some
other places the ending "\n" was added.

airlied:- I cleaned up a few that this patch missed also
2008-01-03 16:56:04 +10:00
Jesper Juhl 6180dbda20 While reading some code I stumbled across the use of 'err' in
drivers/char/drm/mga_dma.c::mga_do_cleanup_dma() and I think there's a small
problem.

The variable is only used inside #if __OS_HAS_AGP which is fine, but all
that
ever happens is an assignment to the variable - it is never actually used
for
anything.  The variable is nicely initialized to zero which is also what the
return statement at the end of function returns (always at the moment).

It looks to me like that function should be returning 'err' instead of
always
just returning 0.  Here's a patch to do that.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2007-12-17 09:45:03 +10:00
Dave Airlie 5dc5c36e62 drm: major whitespace/coding style realignment with kernel 2007-11-22 16:10:36 +10:00
Dave Airlie 7f6bf84c23 drm: remove lots of spurious whitespace.
Kernel "cleanfile" script run.
2007-11-05 12:42:22 +10:00
Eric Anholt 5b38e13416 Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.
The data is now in kernel space, copied in/out as appropriate according to the
This results in DRM_COPY_{TO,FROM}_USER going away, and error paths to deal
with those failures.  This also means that XFree86 4.2.0 support for i810 DRM
is lost.
2007-07-20 18:16:42 -07:00
Eric Anholt c1119b1b09 Replace filp in ioctl arguments with drm_file *file_priv.
As a fallout, replace filp storage with file_priv storage for "unique
identifier of a client" all over the DRM.  There is a 1:1 mapping, so this
should be a noop.  This could be a minor performance improvement, as everything
on Linux dereferenced filp to get file_priv anyway, while only the mmap ioctls
went the other direction.
2007-07-20 13:39:45 -07:00
Eric Anholt e39286eb5e Remove DRM_ERR OS macro.
This was used to make all ioctl handlers return -errno on linux and errno on
*BSD.  Instead, just return -errno in shared code, and flip sign on return from
shared code to *BSD code.
2007-07-20 12:53:52 -07:00
Dave Airlie 24311d5d82 drm: remove drm_buf_t 2007-07-16 13:42:11 +10:00
Dave Airlie 21ee6fbfb8 drm: remove drmP.h internal typedefs 2007-07-16 12:32:51 +10:00
Dave Airlie b95ac8b7b3 drm: detypedef drm.h and fixup all problems 2007-07-16 11:22:15 +10:00
Dave Airlie 7b48f0022a drm: cleanup use of Linux list handling macros
This makes the drms use of the list handling macros a lot cleaner
and more along the lines of how they should be used.
2007-05-26 04:26:24 +10:00
Dave Airlie 9f9c19065c remove DRM_GETSAREA and replace with drm_getsarea function 2007-04-28 15:07:43 +10:00
Eric Anholt c6344e8df5 Assert an MIT copyright on sis_drm.h, since one was lacking and I created
that particular file. Its contents have changed a good bit since the
    original sis code, and the original sis code didn't care much about
    attribution since it routinely disclaims Precision Insight/VA Linux
    from responsibility. Also, adjust formatting around license headers
    (have a comment open immediately before the "Copyright" line, not as a
    runon of any previous comments) for automatic processing into FreeBSD,
    where /*- is used to signal the beginning of license headers for
    automatic compilation of license lists.
2005-11-28 23:10:41 +00:00
Eric Anholt 71f9b7357c Fix FreeBSD DRM for latest MGA changes to agp support, which cleans things
up a good bit, I think. Also, remove the agp_uninit() function which
    has lain around as a noop for years now. The FreeBSD DRM is now all
    compiling, with the exception of via. One known sleeping-with-lock-held
    issue remains.
2005-11-08 05:29:26 +00:00
Ian Romanick 39615ec06e Converts the remaining drm_agp_foo functions to be a drm_agp_foo and
drm_agp_foo_ioctl pair. Modifies the MGA DRM to use the drm_agp_foo
    functions instead of the drm_foo_agp functions. The drm_foo_agp
    functions are no longer exported by drm.ko.
Ensures that dma->seg_count and dma->page_count are properly set in
    drm_addbufs_{agp,sg,fb}. drm_addbufs_pci was already correct.
Ensures that mga_do_agp_dma_bootstrap correctly sets agp_buffer_token.
At this point PCI DMA is still broken.
Xorg bug: #4797 Reviewed by: Dave Airlie, Eric Anholt Signed-off-by: Ian
    Romanick <idr@us.ibm.com>
2005-11-03 00:38:25 +00:00
Dave Airlie 763d726c43 dma access also needs some work 2005-10-20 02:35:08 +00:00
Dave Airlie 727e88c4f4 the old init path needs to set WAGP_ENABLE by default 2005-10-20 01:54:38 +00:00
Ian Romanick 4b3ee6c50e Doig a full clean up from mga_do_dma_bootstrap when
mga_do_agp_dma_bootstrap fails causes problems if
    mga_do_pci_dma_bootstrap succeeds. This commit makes it possible to do
    a "minimal" clean up instead. I'm still trying to figure out what is
    causing the failures in mga_do_agp_dma_bootstrap...
Signed-off-by: Ian Romanick <idr@us.ibm.com>
2005-10-14 05:01:19 +00:00
Ian Romanick 1505e316af Fixed a cut-and-paste bug that could cause an oops in mga_do_cleanup_dma
when mga_do_init_dma fails. Still trying to determine why
    mga_do_init_dma is failing.
Signed-off-by: Ian Romanick <idr@us.ibm.com>
2005-10-14 01:25:38 +00:00
Eric Anholt 22ec8ebb17 - Don't try to allocate mappings of less than a PAGE_SIZE in MGA DMA code.
- Comment out the "is this mapping/bufs in allocated AGP" bits in BSD
    because they break mga (which uses AGP allocation that doesn't track
    entries). It's not a security issue when we still have the related
    ioctls marked root-only.
- Apply some power-of-two alignment restrictions to hopefully avoid some
    panicing in bad cases of drm_pci_alloc() on FreeBSD.
- Add verbosity to some error handling that I found useful while debugging.
2005-08-26 23:27:19 +00:00
Dave Airlie 7af0186f4c add Egberts 32/64 bit patch (its in kernel already...) 2005-08-16 12:51:57 +00:00
Eric Anholt c789ea1521 Rename the driver hooks in the DRM to something a little more
understandable: preinit -> load postinit -> (removed) presetup ->
    firstopen postsetup -> (removed) open_helper -> open prerelease ->
    preclose free_filp_priv -> postclose pretakedown -> lastclose
    postcleanup -> unload release -> reclaim_buffers_locked version ->
    (removed)
postinit and version were replaced with generic code in the Linux DRM
    (drivers now set their version numbers and description in the driver
    structure, like on BSD). postsetup wasn't used at all. Fixes the savage
    hooks for initializing and tearing down mappings at the right times.
    Testing involved at least starting X, running glxgears, killing
    glxgears, exiting X, and repeating.
Tested on: FreeBSD (g200, g400, r200, r128) Linux (r200, savage4)
2005-08-05 03:50:23 +00:00
Eric Anholt 3ffd0c188b Whitespace fixups. 2005-08-04 07:46:11 +00:00
Eric Anholt b0da5df90a Fix the MGA driver on BSD by passing in the proper chipset flags to the
driver's preinit routine, and by using DRM_COPY_TO_USER_IOCTL when
    copying out to an ioctl's data pointer. Pulled from the latest version
    of my drm-hook-rename.diff and only compile-tested after that.
2005-08-04 07:42:01 +00:00
Eric Anholt 5d96c74ff1 - Remove drm_initmap and replace its usage with drm_addmap. This reduces
code duplication, and it also hands you the map pointer so you don't
    need to re-find it.
- Remove the permanent maps flag. Instead, for register and framebuffer
    maps, we always check whether there's already a map of that type and
    offset around. Move the Radeon map initialization into presetup (first
    open) so it happens again after every takedown.
- Remove the split cleanup of maps between driver takedown (last close) and
    cleanup (module unload). Instead, always tear down maps on takedown,
    and drivers can recreate them on first open.
- Make MGA always use addmap, instead of allocating consistent memory in
    the PCI case and then faking up a map for it, which accomplished nearly
    the same thing, in a different order. Note that the maps are exposed to
    the user again: we may want to expose a flag to avoid this, but it's
    not a security concern, and saves us a lot of code.
- Remove rmmaps in the MGA driver. Since the function is only called during
    takedown anyway, we can let them die a natural death.
- Make removal of maps happen in one function, which is called by both
    drm_takedown and drm_rmmap_ioctl.
Reviewed by: idr (previous revision) Tested on: mga (old/new/pci dma),
    radeon, savage
2005-06-28 20:58:34 +00:00
Dave Airlie 71df0eed34 fix up drm_alloc_agp to take a dev arg and not pass crappy agpgart around 2005-06-17 09:09:17 +00:00
Ian Romanick 72cfc797b5 Adds support for PCI cards to MGA DRM
This patch adds serveral new ioctls and a new query to get_param query to
    support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this
    change, the client-side driver no longer needs to map the primary DMA
    region or the MMIO region. Previously, end-of-frame waiting was done by
    busy waiting in the client-side driver until one of the MMIO registers
    (the current DMA pointer) matched a pointer to the end of primary DMA
    space. By using interrupts, the busy waiting and the extra mappings are
    removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
    X-server, moves a *LOT* of code from the X-server into the kernel. This
    allows the kernel to do whatever needs to be done to setup DMA buffers.
    The entire process and the locations of the buffers are hidden from
    user-mode.
Additionally, a get_param query was added to differentiate between G4x0
    cards and G550 cards. A gap was left in the numbering sequence so that,
    if needed, G450 cards could be distinguished from G400 cards. According
    to Ville Syrjälä, the G4x0 cards and the G550 cards handle
    anisotropic filtering differently. This seems the most compatible way
    to let the client-side driver know which card it's own. Doing this very
    small change now eliminates the need to bump the DRM minor version
    twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
A number of ioctl handlers in linux-core were also modified so that they
    could be called in-kernel. In these cases, the in-kernel callable
    version kept the existing name (e.g., drm_agp_acquire) and the ioctl
    handler added _ioctl to the name (e.g., drm_agp_acquire_ioctl).
This patch also replaces the drm_agp_do_release function with
    drm_agp_release. drm_agp_release (drm_core_agp_release in the previous
    patch) is very similar to drm_agp_do_release, and I saw no reason to
    have both.
This commit *breaks the build* on BSD. Eric said that he would make the
    required updates to the BSD side soon.
Xorg bug: 3259 Reviewed by: Eric Anholt
2005-06-14 22:34:11 +00:00
Ian Romanick dfc650bd80 Completely re-initialize DMA settings
There were two problems. First, the 'warp' and 'primary' pointers weren't
    cleared, so mga_do_cleanup_dma, which gets called multiple times, would
    try to ioremapfree them multiple times. This resulted in the new error
    messages to syslog. The second problem was the, since the dev_private
    structure isn't reallocated and cleaned out in mga_do_init_dma, when
    the server is reloaded idle-waits would wait for impossible values.
I have given this patch some more riggorous testing. This includes:
- Load module, start server, run GL app, stop server, unload module.
- Load module, start server, run GL app, stop server, unload module, reload
    module, restart server, run GL app.
- Load module, start server, run GL app, stop server, restart server, run
    GL app, stop server, unload module.
In all three cases, everything worked as expected. Please let me know if
    there are any further regressions with this patch.
Xorg bug: 3408 Reported by: Chris Rankin
2005-06-09 21:18:56 +00:00
Ian Romanick 8e7c130ef7 Move the deallocation of dev_private. Since dev_private is allocated when
the driver is loaded and is always expected to be around, it should
    only be deallocated when the driver is unloaded.
Xorg bug: #3408 Reported by: Chris Rankin
2005-06-03 22:45:21 +00:00
Ian Romanick a686be5bc8 Change the MGA initialization and cleanup a bit. The dev_private structure
is now allocated (and partially filled in) by the new
    mga_driver_preinit function.
This allows the driver to detect the type of card (i.e., G200 class vs.
    G400 class) on its own. The chipset value passed to mga_dma_init is now
    ignored. This same technique is used by the radeon DRM.
As a result of this, mga_driver_pretakedown was converted to
    mga_driver_postcleanup. This routine gets called in some other places
    than might be expected, and it sets the dev_private pointer to NULL.
    That little gem took over an hour to track down. :(
2005-05-21 02:27:51 +00:00
Dave Airlie 0d6b7fcb79 cleanup patch from Adrian Bunk <bunk@stusta.de> 2005-02-01 11:08:31 +00:00
Jon Smirl 9f9a8f1382 Lindent of core build. Drivers checked for no binary diffs. A few files
weren't Lindent's because their comments didn't convert very well. A
    bunch of other minor clean up with no code implact included.
2004-09-30 21:12:10 +00:00
Jon Smirl fa6b1d129e First check in for DRM that splits core from personality modules 2004-09-27 19:51:38 +00:00
Dave Airlie 5654880eee remove HAVE_COUNTERS 2004-09-20 11:29:16 +00:00
Dave Airlie d4dbf45781 Merged drmfntbl-0-0-2 2004-08-24 11:15:53 +00:00
Dave Airlie 7fe4f60768 set pointers to NULL after freeing, remove some extra debugging 2004-08-23 10:05:01 +00:00
Dave Airlie 5c9ed83094 Merged drmfntbl-0-0-1 2004-08-17 13:10:05 +00:00
Dave Airlie 02df04d71d sync up with current 2.6 kernel bk tree - mostly __user annotations 2004-07-25 08:47:38 +00:00
Eric Anholt 9fb6986e83 Don't ioremap the framebuffer area. The ioremapped area wasn't used by
anything, and took up valuable KVA. While I'm in the area, clean up BSD
    MTRR stuff some more.
Suggested by: jonsmirl
2003-12-16 08:57:08 +00:00
Eric Anholt 66c9e3053f - Tie the DRM to a specific device: setunique no longer succeeds when given
a busid that doesn't correspond to the device the DRM is attached to.
    This is a breaking of backwards-compatibility only for the
    multiple-DRI-head case with X Servers that don't use interface 1.1.
- Move irq_busid to drm_irq.h and make it only return the IRQ for the
    current device. Retains compatibility with previous X Servers, cleans
    up unnecessary code. This means no irq_busid on !__HAVE_IRQ, but can be
    changed if necessary.
- Bump interface version to 1.2. This version when set signifies that the
    control ioctl should ignore the irq number passed in and enable the
    interrupt handler for the attached device. Otherwise it errors out when
    the passed-in irq is not equal to the device's.
- Store the highest version the interface has been set to in the device.
- Fix a recursion on DRM_LOCK in irq_uninstall on FreeBSD. This leaves
    irq_uninstall being done without the lock in some cases, but it was
    racey anyways.
2003-11-05 08:13:52 +00:00
Eric Anholt 2950f9e682 - Move IRQ functions from drm_dma.h to new drm_irq.h and disentangle them
from __HAVE_DMA. This will be useful for adding vblank sync support to
    sis and tdfx. Rename dma_service to irq_handler, which is more
    accurately what it is.
- Fix the #if _HAVE_DMA_IRQ in radeon, r128, mga, i810, i830, gamma to have
    the right number of underscores. This may have been a problem in the
    case that the server died without doing its DRM_IOCTL_CONTROL to
    uninit.
2003-10-17 05:13:48 +00:00
Michel Daenzer e5d3c7f260 Support AGP bridges where the AGP aperture can't be accessed directly by
the CPU (David Mosberger, Benjamin Herrenschmidt, myself, Paul
    Mackerras, Jeff Wiedemeier)
2003-05-16 23:41:27 +00:00
Leif Delgass f2a0c5438d Ensure driver has been initialized (dev_private != NULL) before installing
irq handler in DRM(irq_install). Modify all drivers to ensure irq
    handler is removed before cleanup and cleanup is called at takedown.
    Remove unused buffer private struct fields in i810, i830. Check for
    lock on init/cleanup in all drivers except i810/i830. The current DDX
    for i810 and i830 doesn't hold the lock on kernel init (FIXME?).
2003-04-26 22:28:56 +00:00
Leif Delgass 46e06192a8 Check for NULL map before calling DRM(ioremapfree) on cleanup. Prevents an
oops if a map wasn't found (e.g. XFree86 Bugzilla #108)
2003-04-21 16:07:17 +00:00
Keith Whitwell 1728bc637d merged drm-filp-0-1-branch 2003-03-28 14:27:37 +00:00
Jens Owen 344c7f6b41 updated e-mail addresses for Keith, Alan and Jens 2002-10-29 20:29:05 +00:00
Eric Anholt 516392beff s/udelay/DRM_UDELAY/ 2002-10-27 05:25:50 +00:00
Keith Whitwell 3d69766ea6 Jonny Strom's mga_dma.c patch 2002-10-10 08:25:40 +00:00
Keith Whitwell 4fcde1efc1 standardize use of __FUNCTION__ (Linus) 2002-08-29 07:34:49 +00:00
Alan Hourihane 74ef13fd00 merged bsd-3-0-0-branch 2002-07-05 08:31:11 +00:00