Commit Graph

163 Commits (d7756397d695e5573647258f8412e9ecfb2645d4)

Author SHA1 Message Date
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 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
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 6aae7bd5b0 Convert NOMAN to the new preferred spelling NO_MAN to quiet warnings. 2005-04-26 15:27:58 +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
Eric Anholt be9e67a927 Fix a panic on startup with non-initmapping drivers by assigning the
drm_ioremap return value to the map handle again.
Submitted by: Tor Egge, tegge at freebsd dot org
2005-04-24 19:09:09 +00:00
Eric Anholt 10ddbc8c8c Use /*- to begin license blocks in BSD code to reduce diffs against FreeBSD
CVS.
2005-04-16 03:02:52 +00:00
Eric Anholt 926298e822 Fix build on FreeBSD-current, thanks to jhb@. 2005-04-13 04:20:08 +00:00
Eric Anholt baeb76076e Merge r1.26 from FreeBSD: Now that mem(4) is a kernel module, we need to
depend on it.
2005-02-19 20:00:55 +00:00
Eric Anholt 3e8792e705 Use fuword32 for DRM_GET_USER_UNCHECKED when available. May help on 64-bit
platforms.
Submitted by: Jung-uk Kim, jkim at niksun dot com
2005-02-14 03:28:01 +00:00
Eric Anholt ed082798f4 Use the proper API to get PCI vendor/device number for a dev.
PR: ports/76879 Submitted by: Alex, lesha at intercaf dot ru.
2005-02-14 03:26:52 +00:00
Eric Anholt 0d2eb2b90c Fix bad copy'n'pastage of copyrights -- don't disclaim anything for VA
Linux or PI in my copyrights when I should be doing it for myself.
2005-02-13 01:18:25 +00:00
Eric Anholt ba18d68ff5 Add the first bits necessary for a port of savage to FreeBSD. More to
follow later.
2005-02-13 01:08:29 +00:00
Eric Anholt 81459d6e50 Close a race which could allow for privilege escalation by users with DRI
privileges on Radeon hardware. Essentially, a malicious program could
    submit a packet containing an offset (possibly in main memory) to be
    rendered from/to, while a separate thread switched that offset in
    userspace rapidly between a valid value and an invalid one.
    radeon_check_and_fixup_offset() would pull the offset in from user
    space, check it, and spit it back out to user space to be copied in
    later by the emit code. It would sometimes catch the bad value, but
    sometimes the malicious program could modify it after the check and get
    an invalid offset rendered from/to.
Fix this by allocating a temporary buffer and copying the data in at once.
    While here, make the cliprects stuff not do the VERIFYAREA_READ and
    COPY_FROM_USER_UNCHECKED gymnastics, avoiding a lock order reversal on
    FreeBSD. Performance impact is negligible -- no difference on r200 to
    ~1% improvement on rv200 in quake3 tests (P4 1Ghz, demofour at
    1024x768, n=4 or 5).
2005-02-08 04:17:14 +00:00
Eric Anholt 5a332a0f61 Restore a debugging message to DRM_DEBUG instead of DRM_ERROR. 2005-02-07 03:10:03 +00:00
Eric Anholt 2239c55a30 Remove some annoying trailing whitespace. 2005-02-07 01:14:42 +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
Eric Anholt 7d0cb01cbf Add detection of whether the device is AGP by walking the capabilities
list.
2005-01-17 20:24:52 +00:00
Eric Anholt 3e65f52bda Use SYSCTL_ADD_OID macro instead of calling function directly.
Submitted by: reffie@FreeBSD.org
2004-12-15 03:34:09 +00:00
Eric Anholt a1d9e5abaf Refine the locking of the DRM. Most significant is covering the driver
ioctls with dev_lock, which is a major step toward being able to remove
    Giant. Covers some new pieces (dev->unique*) in the core, and avoids
    one call down into system internals with the drm lock held, which is
    usually bad (FreeBSD LOR #23, #27).
2004-11-07 04:11:15 +00:00
Eric Anholt 67f6c5e36a Don't link in files which no longer exist. 2004-11-07 00:30:15 +00:00
Eric Anholt fa3fdbd99c Now that the memory debug code is gone, and all 3 BSDs have M_ZERO, stop
using drm_alloc/drm_free in the core and instead use plain malloc/free.
2004-11-07 00:25:49 +00:00
Eric Anholt d37457b599 Add the drm Makefile and update .cvsignores. 2004-11-06 23:05:46 +00:00
Eric Anholt cb5aaa8987 Convert more drivers for bsd-core, moving the ioctl definitions to shared
code. Remove the "drv" from sisdrv, as it's unnecessary. Use the
    drm_pci functions in i915 instead of per-os implementations of the
    same. Avoid whitespace within fields in drm_pciids.txt (one of the r300
    definitions), since it breaks the bsd pciids script. Tested on sis,
    mga, r128. i915 needs more work.
2004-11-06 23:02:07 +00:00
Eric Anholt 7ddbd38dde Remove some core stuff that ended up being unnecessary. 2004-11-06 21:44:54 +00:00
Eric Anholt 7bdccfd0bb Get r128 basically working: Hook up the driver's dma ioctl, use the proper
offset into the driver ioctl array, and don't make the ctx bitmap
    conditional.
2004-11-06 21:18:49 +00:00
Eric Anholt ae7a171313 Move the lock/unlock ioctls to a more logical place, in drm_lock.c. 2004-11-06 20:27:19 +00:00
Eric Anholt cca29ac9be Connect up r128_ioctls in driver config. 2004-11-06 20:21:55 +00:00
Eric Anholt b2f275b46e Hook the debug output up to a sysctl, so you can choose to enable at
runtime.
2004-11-06 11:50:08 +00:00
Eric Anholt 7adee84064 Add file missed in last commit: Commit first pieces of port to OpenBSD,
done by Martin Lexa (martin at martinlexa dot cz). Now that we've got
    porting for all three major BSDs (and the fourth being very similar to
    FreeBSD), move the mostly-duplication drm_os_* files into drmP.h.
    Remove some cruft from linux heritage and from pieces of the DRM that
    have since been removed.
Note that things are still not quite working for even FreeBSD, but these
    are first steps at cleanup, and just a WIP checkpoint.
2004-11-06 11:19:38 +00:00
Eric Anholt d7510ea413 Commit first pieces of port to OpenBSD, done by Martin Lexa (martin at
martinlexa dot cz). Now that we've got porting for all three major BSDs
    (and the fourth being very similar to FreeBSD), move the
    mostly-duplication drm_os_* files into drmP.h. Remove some cruft from
    linux heritage and from pieces of the DRM that have since been removed.
Note that things are still not quite working for even FreeBSD, but these
    are first steps at cleanup, and just a WIP checkpoint.
2004-11-06 11:16:26 +00:00
Eric Anholt cf259f10aa Remove the vestiges of the memory-debug code. 2004-11-06 02:00:04 +00:00
Eric Anholt c9202c8965 Commit WIP of BSD conversion to core model. Compiles for r128, radeon, but
doesn't run yet. Moves the ioctl definitions for these two drivers back
    to the shared code -- they aren't OS-specific.
2004-11-06 01:41:47 +00:00
Erdi Chen 25e319c1ef This patch adds three new ioctl's to the VIA Unichrome/Pro DRM driver:
DRM_IOCTL_VIA_DMA_INIT DRM_IOCTL_VIA_CMDBUFFER DRM_IOCTL_VIA_FLUSH
The first ioctl sets up an area in AGP memory that will be used as the ring
    buffer. The second ioctl copies a command buffer from user space memory
    to the ring buffer. The third ioctl waits for engine idle until it
    returns.
The motivation for this patch is to avoid the wait for engine idle call
    before each buffer flush in the current DRI driver. With this patch,
    the DRI driver can continue to flush its buffer as long as there is
    free space in the ring buffer.
This patch adds an additional copy operation on the command buffer. This
    buffer copying is necessary to support multiple DRI clients rendering
    simultaneously. Otherwise, more CPU time will be spent in the busy loop
    waiting for engine idle between DRI context switch. Even in the single
    client case, the tradeoff is reasonable in comparision to the kernel
    call to check for free buffer space for the client to render directly
    to the ring buffer.
2004-08-24 01:44:37 +00:00
Dave Airlie 5c9ed83094 Merged drmfntbl-0-0-1 2004-08-17 13:10:05 +00:00
Eric Anholt 740ddb9c5d Remove unused pcigart/sg header stuff from i915 driver. 2004-08-14 00:56:34 +00:00
Eric Anholt dd83f39f03 Add a "dev" argument to DRIVER_CTX_[CD]TOR. This will be used in an
upcoming commit for the SiS driver.
2004-08-14 00:46:15 +00:00
Eric Anholt 2376ec4ef8 Hopefully proper fix for corrupted driver name in memcontrol list.
Reported by: Jung-uk Kim <jkim@niksun.com>
2004-08-14 00:03:32 +00:00
Eric Anholt d78db7c930 Enable MTRR usage on AMD64, and use DELAY() instead of rolling our own
udelay code.
Submitted by: Jung-uk Kim <jkim@niksun.com>
2004-08-13 23:17:17 +00:00
Dave Airlie 6c9715eaf5 bring over fix from i865-agp branch, it now probes the driver, X hangs
box..
2004-08-03 11:26:38 +00:00
Dave Airlie 1cec18a5cd add read/write 16 2004-07-29 13:00:48 +00:00
Dave Airlie b1cf4ca7e5 change to agp not pci ... still not working 2004-07-29 12:49:54 +00:00
Dave Airlie 0b02bf9d45 initial port of i915 to BSD, not finished doesn't work.. no idea why... 2004-07-29 11:09:22 +00:00
Eric Anholt eaccc05b26 Fix module loading on alpha by not referencing MTRR symbols on
!__REALLY_HAVE_MTRR.
2004-07-06 00:25:19 +00:00
Eric Anholt 694291fbd3 MFC as of 20040705: dev_t -> struct cdev * change. 2004-07-06 00:23:42 +00:00
Eric Anholt 853adb8be3 Merge from FreeBSD-current. Mostly 64-bit cleanliness fixes, but a few
driver interface changes from -current.
2004-05-11 04:43:43 +00:00
Eric Anholt c47b611b08 Add mach64 DRM module for BSD (untested, but compiles). 2004-05-09 22:36:19 +00:00
Eric Anholt dfdf8e14d3 Add .cvsignore files. 2004-05-09 22:29:55 +00:00
Eric Anholt 51ed2f5937 Warning fixes. 2004-05-09 22:16:11 +00:00
Eric Anholt d477cc007c - Link in shared files as necessary and clean them up.
- Generate drm_pciids.h automatically.
2004-05-09 22:14:07 +00:00