Commit Graph

172 Commits (26462b9aa47179e724e78f0b3b1c86fd07f61d8d)

Author SHA1 Message Date
Eric Anholt a10d8178e3 Initial port of savage to FreeBSD for the AGP and !ShadowStatus case. Adds
drm_mtrr_{add,del} for handling the MTRR setup. Still has a LOR issue
    with DRM_VERIFYAREA_READ/DRM_COPY_FROM_USER_UNCHECKED in savage_bci.c
    -- this won't work with the fine-grained locking in use, and just doing
    a single copyin to a temporary will probably work fine. Also note that
    the module leaks approximately 4 kb on unload.
2005-11-08 20:25:00 +00:00
Eric Anholt 1a256df480 Catch FreeBSD up to the pcie gart changes. Required minor modification to
radeon_cp.c to use a drm_local_map_t-type mapping (drm_core_ioremap
    rather than drm_ioremap), which contains private device mapping
    information on BSD. I also changed the ati_pcigart interface to use
    "void *" for pointers to kva rather than "unsigned long". While PCIGART
    support appears to be broken on FreeBSD currently, I think this is not
    new, and BusType PCI remains working on my r100 in Linux.
2005-11-08 02:38:01 +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 bcbf5ff797 we don't use this stuff anymore .. remove 1k buffer from driver .. 2005-10-23 04:07:50 +00:00
Dave Airlie 908ad0ed96 remove version not used anymore 2005-10-06 23:08:58 +00:00
Dave Airlie 3a0230ef9c use linux kernel macros don't make our own 2005-09-25 03:09:51 +00:00
Dave Airlie 5565a00916 Add GART in FB support for ati pcigart, and PCIE support for r300 2005-09-11 08:51:23 +00:00
Dave Airlie 0d346a07a8 convert ioctl flags to use flags instead of separate ints 2005-09-03 03:27:14 +00:00
Alan Hourihane 01e4364a8f remove i915_pm code as it causes too many issues with current software
suspend, and the DDX driver re-inits the board successfully anyway.
2005-08-22 09:50:12 +00:00
Dave Airlie 7af0186f4c add Egberts 32/64 bit patch (its in kernel already...) 2005-08-16 12:51:57 +00:00
Thomas Hellstrom cdf49e5732 Reverting the previous via security-fix commit, since the assumption of
contexts registered with the callers filp was wrong.
2005-08-12 14:19:33 +00:00
Thomas Hellstrom d5e8ab13ff Security fix on via: Checking that the specified context belongs to the
caller on fb / agp memory alloc and free. Otherwise malicious clients
    can register allocations on other clients or free memory used by other
    clients which will lead to severe memory manager inconsistensies.
2005-08-10 19:46:46 +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
Jon Smirl ea2c7a895d Split the control of master vs root priv. Everything is still marked as
needing root.
2005-08-04 13:15:27 +00:00
Eric Anholt ab59dd285c Add latest r300 support from r300.sf.net CVS. Patch submitted by volodya,
with BSD fix from jkim and the r300_reg.h license from Nicolai Haehnle.
    Big thanks to everyone involved!
2005-07-20 21:17:47 +00:00
Jon Smirl 04fea06002 Simplify the sysfs code 2005-07-03 18:07:03 +00:00
Jon Smirl d41af11ee3 Add sysfs attribute dri_library_name on Linux. code in share-core/via_drv.c
is ok to be shared, it will be passive on BSD.
2005-07-03 17:16:12 +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 6397722f19 add compat code from Paul Mackerras 2005-06-28 13:02:20 +00:00
Alan Hourihane b6b270a260 Given that BenH says using the sysdev approach for DRM is bogus, I'll yank
the code for it, rather than introducing something that isn't going to
    work 100% of the time.
2005-06-28 08:03:33 +00:00
Jon Smirl afdabdabf5 removed dev->sysdev_registered 2005-06-26 13:31:15 +00:00
Jon Smirl 4152605ea1 Get the power management hooks into the right place so that everything gets
freed correctly.
2005-06-22 05:49:56 +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
Dave Airlie 805a07714f misc cleanup patch from Adrian Bunk 2005-06-04 06:18:11 +00:00
Eric Anholt 9cad6fb4e0 Bugzilla #3217: Create a new __drm_pci_free which is used internally in
linux-core to free pci memory without freeing the structure. Linux-core
    internals often create pci dma handle structures on the stack due to
    the lack of a drm_local_map_t to store them in properly. Fix the
    original drm_pci_free to actually free the dma handle structure instead
    of leaking it.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
2005-05-28 20:36:22 +00:00
Alan Hourihane 45f1db8db9 Re-implement the power management.
There's two choices when fb is or isn't loaded as we treat ourselves as a
    PCI driver in the latter case.
If we are a PCI driver, then register the suspend/resume functions
    directly. If not, then we register as a sysdev and pick up the
    suspend/resume actions and pump them down into a generic *power
    function.
It'll be nice when this little mess is sorted out with regard to being a
    real PCI driver ;-/
2005-05-28 00:00:08 +00:00
Ian Romanick 4a84416c45 Modify drm_driver::device_is_agp to return a tri-state value to indicate
that a device absolutely is, absolutely is not, or may or may not be
    AGP. Modify the i915 DRM to use this to force all i9x5 devices to be
    "AGP" (even the PCI-e devices).
Reported by: Lukas Hejtmanek
2005-05-27 23:42:11 +00:00
Ian Romanick e051cd19c0 Added device_is_agp callback to drm_driver. This function is called by the
platform-specific drm_device_is_agp function. Added implementation of
    this function the the Linux-specific portion of the MGA driver to
    detect PCI G450 cards. Added code to the Linux-specific portion of the
    generic DRM layer to not initialize AGP infrastructure if the card is
    not AGP (this matches what already existed in BSD).
Bumped the driver date and the driver patch-level for MGA.
This mostly fixes bugzilla #3248. The BSD side still needs an
    implementation of mga_driver_device_is_agp.
2005-05-16 17:37:10 +00:00
Eric Anholt ec111d70fe Convert BSD code to mostly use bus_dma, the dma abstraction for dealing
with IOMMUs and such. There is one usage of the forbidden vtophys()
    left in drm_scatter.c which will be fixed up soon. This required a KPI
    change for drm_pci_alloc/free() to return/use a drm_dma_handle_t that
    keeps track of os-specific bits, rather than just passing around the
    vaddr/busaddr/size.
Submitted by: Tonnerre Lombard (partially) Tested on: FreeBSD: Rage128
    AGP/PCI Linux: Savage4 AGP/PCI
2005-04-26 05:19:11 +00:00
Dave Airlie 956a701544 fix up AGP multi-head support for kernel 2.6.12 2005-03-25 09:48:34 +00:00
Dave Airlie 300e0866d6 fix agp detection on linux 2005-02-07 10:44:28 +00:00
Eric Anholt 080a547d4d - Implement drm_initmap, and extend it with the resource number to help
FreeBSD. Add drm_get_resource_{start|len} so linux-specific stuff
    doesn't need to be in shared code.
- Fix mach64 build by using __DECONST to work around passing a const
    pointer to useracc, which is unfortunately not marked const.
- Get rid of a lot of maplist code by not having dev->maplist be a pointer,
    and by sticking the link entries directly in drm_local_map_t rather
    than having a separate structure for the linked list.
- Factor out map uninit and removal into its own routine, rather than
    duplicating in both drm_takedown() and drm_rmmap().
- Hook up more driver functions, and correct FreeBSD-specific bits of
    radeon_cp.c, making radeon work.
- Baby steps towards using bus_space as we should.
2005-02-05 08:00:14 +00:00
Dave Airlie 354dd17d25 The patch makes drmAddBufs/drmMapBufs can handle buffers in video memory
The attached patch adds a new buffer type DRM_FB_BUFFER. It works like AGP
    memory but uses video memory.
From: austinyuan@viatech.com.cn (fd.o bug 1668) Signed-off-by: Dave Airlie
    <airlied@linux.ie>
2005-01-16 05:40:12 +00:00
Felix Kuehling 5128542814 Allow drivers to override reclaim_buffers in an OS-independent way by
passing drm_device_t* as first parameter, like in the BSD version.
2004-10-31 15:16:44 +00:00
Jon Smirl b37efdadca Round 2 of getting rid of inter_module_get() 2004-10-23 18:12:34 +00:00
Jon Smirl 91aa32742c Move drm_cpu_valid out of drm_init. drm_init is empty now. 2004-10-15 20:36:15 +00:00
Jon Smirl fa50e2b513 Switch linux-core over to 2.6 parameter model to enable debug use
drm_debug=1
2004-10-15 02:59:35 +00:00
Jon Smirl 5e8838fd11 Add a poll function that alternates between zero and normal poll return to
bring DRM into conformance with normal poll().
2004-10-13 16:40:53 +00:00
Jon Smirl ad70dc676e Breakout heads into their own data structures. 2004-10-12 03:59:17 +00:00
Jon Smirl ad549c5ae6 Rename fn_tbl to driver. Core driver now uses pci_driver name which
reflects the personality name.
2004-10-10 22:54:55 +00:00
Dave Airlie e09229d6c8 remove unused dma remnants that were gamma only - these could cause an oops
on via
2004-10-09 10:58:19 +00:00
Jon Smirl 61d36f6179 Revert back to drm_order() instead of using kernel get_order(). The
functions are not identical.
2004-10-06 16:27:55 +00:00
Jon Smirl e17abf5d5d Make the debug memory functions compile for the core model. 2004-09-30 23:47:45 +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 1c0a437fa2 Move things around to reduce public symbols and even out files. Switch to
get_order from drm_order.
2004-09-30 19:26:35 +00:00
Jon Smirl 3aef3841d0 Make fops per driver instead of global, remove default flush, poll, read
functions
2004-09-30 18:13:33 +00:00
Jon Smirl 0bff0d9eb6 Getting the AGP module is a global resource. Make sure a dual PCI/AGP
driver doesn't release it on unload since an AGP driver may also be
    loaded.
2004-09-28 22:25:06 +00:00
Jon Smirl fa6b1d129e First check in for DRM that splits core from personality modules 2004-09-27 19:51:38 +00:00
Jon Smirl 36a257cfe9 Remove 2.6 code that allow DRM major device number to be shared. We can add
it back later if needed. Checked DRM on both 2.4 and
2.6 to ensure that it builds and runs.
2004-09-23 17:22:27 +00:00