Commit Graph

1144 Commits (8d4c731aa1e0936d8187ad77b5c779a79e22566d)

Author SHA1 Message Date
Eric Anholt fb7b802dda Fix some misuse of NULL where 0 is intended.
Obtained from: FreeBSD CVS
2004-01-06 04:54:25 +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 5285b02987 Add a collection of Radeon and R128 PCI IDs, including the IGP chipsets.
Submitted by: Donnie Berkholz <spyderous@gentoo.org> (mostly)
2003-12-16 07:39:43 +00:00
Keith Whitwell 64006ef86b Add i865 pci id 2003-12-08 16:33:08 +00:00
Eric Anholt 6e56c39371 Fix a locking nit, and add asserts in some things that should be called
with locks held.
2003-11-12 20:30:51 +00:00
Eric Anholt 1f7598245a Return EBUSY when attempting to addmap a DRM_SHM area with a lock in it if
dev->lock.hw_lock is already set. This fixes the case of two X Servers
    running on the same head on different VTs with interface 1.1, by making
    the 2nd head fail to inizialize like before.
2003-11-06 04:48:06 +00:00
Eric Anholt 2c1172a317 Remove unused variable. 2003-11-06 04:35:08 +00:00
Alan Hourihane a41a479f74 Changes to DRM(irq_install)...... wrap dev->dma usage with __HAVE_DMA in
irq handler, fixes kernel ooops. comment out some setting of flags that
    are done in DRM(setup) (not sure why both of the above is done in the
    irq handler)
2003-11-05 20:47:28 +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 19ee64add2 Use int64_t instead of s64 -- fixes FreeBSD compile, works on linux. 2003-11-05 02:42:56 +00:00
Eric Anholt 8feb046d8c Args for the BSD DRM_PUT_USER_UNCHECKED were swapped. 2003-11-05 02:41:50 +00:00
Eric Anholt e8f5b01a40 __linux__ is spelled with a lowercase 'l' 2003-11-05 02:08:31 +00:00
Eric Anholt 5864101ab4 Repo-copy linux/drm/kernel/drm.h to shared/drm/kernel/drm.h and use it on
both Linux and *BSD.
2003-11-05 01:43:47 +00:00
Eric Anholt e5cad7fced Remove buf_alloc which is unused since the locking commit. 2003-11-05 00:49:35 +00:00
Michel Daenzer 27f9c5f016 build fix 2003-11-04 00:59:52 +00:00
Michel Daenzer 2655ccddf4 Memory layout transition:
the 2D driver initializes MC_FB_LOCATION and related registers sanely
the DRM deduces the layout from these registers
clients use the new SETPARAM ioctl to tell the DRM where they think the
    framebuffer is located in the card's address space
the DRM uses all this information to check client state and fix it up if
    necessary
This is a prerequisite for things like direct rendering with IGP chips and
    video capturing.
2003-11-04 00:46:05 +00:00
Eric Anholt 84dfe702e2 Add i852/i855 PCI ID. Also fix whitespace in the other ID definitions. 2003-11-03 05:11:04 +00:00
Eric Anholt 3f7279cb8e Add a DRM_PUT_USER_UNCHECKED, which will be used by an upcoming radeon
change.
2003-10-27 22:05:38 +00:00
Eric Anholt 2423fedcc8 Don't try to use dev->dma_lock unless dma is initialized (dev->dma != NULL)
in bufs_info sysctl handler. dev->dma and dev->dma_lock existence are
    protected by DRM_LOCK(). Fixes panic on sysctl hw.dri when the device
    is uninitialied (when you aren't in X).
2003-10-24 21:49:28 +00:00
Jon Smirl e4a2a9c040 Switch pci enumeration call to work on both 2.4 and 2.6 pci_for_each_dev is
not supported on 2.6
2003-10-24 17:40:54 +00:00
Eric Anholt 451a1d3f69 Move the REALLY_HAVE_AGP endif above the mtrr functions. Broke tdfx module. 2003-10-24 00:59:31 +00:00
Eric Anholt b79d1b341f Move to "old-style" probing as documented in linux/Documentation/pci.txt.
This should resolve the probe problems with radeon framebuffer due to
    pci_driver attachment being exclusive.
2003-10-23 05:56:13 +00:00
Eric Anholt 69d038eb49 Missed the sis.h header in Makefile.linux in the move to shared/. 2003-10-23 05:52:19 +00:00
Eric Anholt 92429f6ebe The SiS300 pci id also covers the 305, so make the name reflect that. 2003-10-23 05:51:35 +00:00
Eric Anholt 06cb132e86 - Introduce a new ioctl, DRM_IOCTL_SET_VERSION. This ioctl allows the
server or client to notify the DRM that it expects a certain version of
    the device dependent or device independent interface. If the major
    doesn't match or minor is too large, EINVAL is returned. A major of -1
    means that the requestor doesn't care about that portion of the
    interface. The ioctl returns the actual versions in the same struct.
- Introduce DRM DI interface version 1.1. If the server requests version
    1.1, then the DRM sets the unique itself according to the busid of the
    device it probed, which may then be accessed as normal using getunique.
- Request version 1.1 in libdrm's drmOpenByBusID, allowing the X Server to
    request based on a BusID. Introduce a wrapper for DRM_IOCTL_SET_VERSION
    and bump libdrm minor version.
- Pass the busid in DRIScreenInit if libdrm can handle both a busid and
    name. This allows drmOpenByBusID to be used to find the DRM instead of
    just the driver name, which allows us in the future to tie a DRM more
    strongly to the device it probed to. Introduce a function
    DRICreatePCIBusID which creates a busid in the form pci:oooo:bb:dd.f
    similar to linux's pci_name() function. This matches the format used by
    the DRM in version 1.1. libdrm knows how to match both this format and
    the old PCI🅱️d:f format.
- Use the new DRICreatePCIBusID function in the *_dri.c to request the new,
    more exact busid format.
2003-10-23 02:23:31 +00:00
Eric Anholt 86e6325e5a - Add DRM_GET_PRIV_WITH_RETURN macro. This can be used in shared code to
get the drm_file_t * based on the filp passed in ioctl handlers.
- Use this macro on BSD for simplification and improve its error reporting.
    Make failure to find the drm_file_t * print as an error, not debug.
    This failure may be part of the problem with KDE.
- Make debug and error print macros include the pid on BSD.
2003-10-22 22:08:53 +00:00
Eric Anholt 4e6ddcbb69 Fix warning about static DRM(bufs_info) defined but not used in the
!__HAVE_DMA case.
2003-10-22 21:50:09 +00:00
Eric Anholt ea7b4fdc22 Fix the possibility of sleeping with locks held in sysctls by copying the
data into temporary variables with the lock held then outputting to
    sysctls with the lock released. Rearranged a little extra code to aid
    this. Note that drm_memory_debug.h hasn't had this fix applied, but I
    consider that code to be just about dead anyway.
2003-10-20 05:09:21 +00:00
Eric Anholt 6b0424fdcd Clean up BSD MTRR handling. The NetBSD code is untested, but it's my best
shot.
2003-10-20 00:55:56 +00:00
Eric Anholt 0cf1887139 - SMPng lock the DRM. This is only partial -- there are a few code paths
used by root (the X Server) which are not locked. However, it should
    deal with lost-IRQ issues on -current which I think people have been
    experiencing but I am unable to reproduce (though I understand why they
    would occur, because of a bug of mine). Note that most of the locking
    (DRM_LOCK()/UNLOCK()) is all covered by Giant still, so it doesn't
    matter yet.
- Remove locking on FreeBSD-stable and NetBSD. These are covered by the
    fact that there is no reentrancy of the kernel except by interrupts,
    which are locked using spldrm()/splx() instead.
2003-10-19 23:35:58 +00:00
Eric Anholt 59fbe01fea Clean up extra zeroing of dev->dma, and use calloc to take advantage of
M_ZERO.
2003-10-19 22:29:08 +00:00
Eric Anholt 63ce8af555 Fix probing on 2.5+ kernels, which require that drivers have .id_table set.
We use PCI_ANY_ID to ask that our probe is called for every available
    device.
Submitted by: jonsmirl
2003-10-19 20:06:03 +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
Eric Anholt ff58476011 - Converted Linux drivers to initialize DRM instances based on PCI IDs, not
just a single instance. Moved the PCI ID lists from <card>_drv.c in BSD
    to <card>.h. The PCI ID lists include a driver private field, which may
    be used by drivers for chip family or other information. Based on work
    by jonsmirl.
- Make tdfx_drv.c and tdfx.h match other drivers.
- Fixed up linking of sis shared files.
Tested with Radeon and SiS on Linux and FreeBSD, including a Linux setup
    with
2 SiS cards in a machine, but only one head being used (with DRI)
2003-10-17 03:14:39 +00:00
Michel Daenzer 355b204de0 Introduce COMMIT_RING() as in radeon DRM, stop using error prone writeback
for ring read pointer (Paul Mackerras)
Get rid of some superfluous stuff, minor fixes
2003-10-16 14:18:52 +00:00
Eric Anholt a64dab1323 Try that again. It's a long. 2003-10-16 03:20:03 +00:00
Eric Anholt a9e1a57d6d Debug printf format fix. 2003-10-16 03:19:06 +00:00
Eric Anholt 9fbfb7ca6a Some code cleanups done while working on locking. Reduces always-true
tests, excessive indenation, convoluted handling of errors, or code
    duplication.
2003-10-03 08:08:10 +00:00
Eric Anholt 929536172c Stylistic preparation for SMPng locking work: DRM_LOCK/DRM_UNLOCK have side
effects, so make them look like functions (add parenthesis).
2003-10-03 07:02:51 +00:00
Eric Anholt e187d665e4 Add an MIT-style copyright, assigned to myself, to these files. I think
I've touched enough of the code here, and there was no previous
    copyright. Do some drive-by style fixes while I'm here.
2003-10-02 20:52:44 +00:00
Eric Anholt 89dd7be3dd Axe more old gamma DMA infrastructure. 2003-10-02 07:02:34 +00:00
Eric Anholt a6b84f73e1 Mostly whitespace cleanups and style(9) fixes focused on "if(" -> "if ("
Change some nearby memset()s to bzero()s or to calloc allocations to
    take advantage of M_ZERO). Reverse some error tests to reduce high
    levels of indentation. Move the sg_cleanup() call out of the maplist
    loop in DRM(takedown)-- I can't see any need for it to be inside.
2003-10-02 04:48:54 +00:00
Eric Anholt 4dee75ff58 Wrap sys/endian.h usage with __FreeBSD_version >= 480000.
Obtained from: i865-agp-0-1-branch
2003-10-02 04:12:34 +00:00
Eric Anholt 4a55e75e97 Allow the DRM to attach to a "drmsub" device. This will be provided by the
i810 AGP module, working around the limitation of one driver per
    device.
Obtained from: i865-0-1-branch
2003-10-02 04:07:03 +00:00
Eric Anholt 8fe6a0d6c9 MTRR issue with SMP and -stable seems to be resolved. Re-enable MTRRs on
4.x
2003-10-02 03:51:49 +00:00
Jose Fonseca e5546d2f26 file via_drm.h was initially added on branch cle266-0-0-1-branch. 2003-09-30 22:43:23 +00:00
Jose Fonseca 87c04835df file via.h was initially added on branch cle266-0-0-1-branch. 2003-09-30 22:43:23 +00:00
Jose Fonseca 64828b7fe3 file via_drv.c was initially added on branch cle266-0-0-1-branch. 2003-09-30 22:43:23 +00:00
Jose Fonseca 215a05721b file via_drv.h was initially added on branch cle266-0-0-1-branch. 2003-09-30 22:43:23 +00:00
Jose Fonseca 37ff4d7dde file via_ds.c was initially added on branch cle266-0-0-1-branch. 2003-09-30 22:43:23 +00:00