summaryrefslogtreecommitdiff
path: root/bsd-core
AgeCommit message (Collapse)AuthorFilesLines
2005-09-30Add support to turn writeback off via radeon module optionDave Airlie1-0/+2
2005-09-12Fix the spelling of DRM_AUTH so that the bsd core stuff builds again. NextEric Anholt1-3/+3
up is pcigart.
2005-09-03convert ioctl flags to use flags instead of separate intsDave Airlie2-63/+64
2005-08-26- Don't try to allocate mappings of less than a PAGE_SIZE in MGA DMA code.Eric Anholt2-26/+54
- 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-26Previously, drm_get_resource_start() and drm_get_resource_len() wouldEric Anholt3-27/+42
allocate the resource RF_ACTIVE, pull out the appropriate value, and return it. However, allocating large framebuffers RF_ACTIVE would run the system out of KVA, and this also left open the possibility of the resource getting moved after getting the offset. Instead, when either of these are called, allocate the resource if it isn't allocated already (non-RF_ACTIVE) and store it in the DRM device, to be cleaned up on lastclose.
2005-08-26Fix a lack of parenthesis in macro usage that showed up with INVARIANTSEric Anholt1-1/+1
turned on, i.e. in a kernel build.
2005-08-26[1] Fix BSD DRM for the nonroot changes. [2] Don't attempt to acquire theEric Anholt6-17/+81
DMA lock in a non-DMA driver, as it will be uninitialized. Submitted by: [1] jkim (minor changes by me)
2005-08-17add agp buffer tokenDave Airlie1-0/+1
2005-08-15Port the VIA DRM to FreeBSD. Original patch by Jake, with some cleanup byEric Anholt4-4/+156
me to match other drivers and avoid ifdeffing. The linux via_drv.c will be moved from shared-core to linux-core soon by repocopy. Submitted by: Jake Burkholder <jake@FreeBSD.org> Tested by: unichrome
2005-08-12Fix build after linux-side checkin of master/root-only split. Still onlyEric Anholt2-59/+64
cares about root on the BSD side, but should be secure.
2005-08-05Rename the driver hooks in the DRM to something a little moreEric Anholt19-295/+286
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-04Fix the MGA driver on BSD by passing in the proper chipset flags to theEric Anholt2-42/+51
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-07-27Correct a couple of descriptions of files in comments (were justEric Anholt1-1/+1
copy'n'pasted). Submitted by: jkim
2005-07-27Link in the savage files from shared-core.Eric Anholt1-0/+4
Submitted by: jkim
2005-07-20Add latest r300 support from r300.sf.net CVS. Patch submitted by volodya,Eric Anholt5-9/+39
with BSD fix from jkim and the r300_reg.h license from Nicolai Haehnle. Big thanks to everyone involved!
2005-06-29Get the BSD DRM compiling again after MGA and mapping changes. Note thatEric Anholt6-190/+251
i915 has been disabled for the moment, rather than working around linux-specific code in the shared dir.
2005-06-14Adds support for PCI cards to MGA DRMIan Romanick3-15/+10
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-09Completely re-initialize DMA settingsIan Romanick1-0/+1
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-06Add a few more bits of Tonnerre's NetBSD port (Still need to deal with theEric Anholt9-11/+48
device attachment).
2005-05-27Modify drm_driver::device_is_agp to return a tri-state value to indicateIan Romanick3-5/+11
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-21Change the MGA initialization and cleanup a bit. The dev_private structureIan Romanick1-1/+2
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-16Added device_is_agp callback to drm_driver. This function is called by theIan Romanick3-0/+50
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-04-26Convert NOMAN to the new preferred spelling NO_MAN to quiet warnings.Eric Anholt9-9/+9
2005-04-26Convert BSD code to mostly use bus_dma, the dma abstraction for dealingEric Anholt6-103/+151
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-24Fix a panic on startup with non-initmapping drivers by assigning theEric Anholt1-1/+1
drm_ioremap return value to the map handle again. Submitted by: Tor Egge, tegge at freebsd dot org
2005-04-16Use /*- to begin license blocks in BSD code to reduce diffs against FreeBSDEric Anholt28-30/+54
CVS.
2005-04-13Fix build on FreeBSD-current, thanks to jhb@.Eric Anholt1-0/+5
2005-02-19Merge r1.26 from FreeBSD: Now that mem(4) is a kernel module, we need toEric Anholt1-0/+3
depend on it.
2005-02-14Use fuword32 for DRM_GET_USER_UNCHECKED when available. May help on 64-bitEric Anholt1-1/+6
platforms. Submitted by: Jung-uk Kim, jkim at niksun dot com
2005-02-14Use the proper API to get PCI vendor/device number for a dev.Eric Anholt1-9/+3
PR: ports/76879 Submitted by: Alex, lesha at intercaf dot ru.
2005-02-13Fix bad copy'n'pastage of copyrights -- don't disclaim anything for VAEric Anholt3-12/+9
Linux or PI in my copyrights when I should be doing it for myself.
2005-02-13Add the first bits necessary for a port of savage to FreeBSD. More toEric Anholt3-0/+135
follow later.
2005-02-08Close a race which could allow for privilege escalation by users with DRIEric Anholt1-2/+0
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-07Restore a debugging message to DRM_DEBUG instead of DRM_ERROR.Eric Anholt1-1/+1
2005-02-07Remove some annoying trailing whitespace.Eric Anholt1-4/+4
2005-02-05- Implement drm_initmap, and extend it with the resource number to helpEric Anholt10-159/+276
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-01-17Add detection of whether the device is AGP by walking the capabilitiesEric Anholt1-1/+37
list.
2004-12-15Use SYSCTL_ADD_OID macro instead of calling function directly.Eric Anholt1-1/+1
Submitted by: reffie@FreeBSD.org
2004-11-07Refine the locking of the DRM. Most significant is covering the driverEric Anholt8-93/+130
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-07Don't link in files which no longer exist.Eric Anholt1-7/+0
2004-11-07Now that the memory debug code is gone, and all 3 BSDs have M_ZERO, stopEric Anholt12-186/+123
using drm_alloc/drm_free in the core and instead use plain malloc/free.
2004-11-06Add the drm Makefile and update .cvsignores.Eric Anholt4-0/+58
2004-11-06Convert more drivers for bsd-core, moving the ioctl definitions to sharedEric Anholt8-97/+352
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-06Remove some core stuff that ended up being unnecessary.Eric Anholt3-11/+0
2004-11-06Get r128 basically working: Hook up the driver's dma ioctl, use the properEric Anholt5-12/+41
offset into the driver ioctl array, and don't make the ctx bitmap conditional.
2004-11-06Move the lock/unlock ioctls to a more logical place, in drm_lock.c.Eric Anholt2-81/+79
2004-11-06Connect up r128_ioctls in driver config.Eric Anholt1-0/+3
2004-11-06Hook the debug output up to a sysctl, so you can choose to enable atEric Anholt3-10/+7
runtime.
2004-11-06Add file missed in last commit: Commit first pieces of port to OpenBSD,Eric Anholt1-0/+141
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-06Commit first pieces of port to OpenBSD, done by Martin Lexa (martin atEric Anholt10-932/+420
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.