summaryrefslogtreecommitdiff
path: root/bsd-core
AgeCommit message (Collapse)Author
2005-02-08Close a race which could allow for privilege escalation by users with DRIEric Anholt
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 Anholt
2005-02-07Remove some annoying trailing whitespace.Eric Anholt
2005-02-05- Implement drm_initmap, and extend it with the resource number to helpEric Anholt
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 Anholt
list.
2004-12-15Use SYSCTL_ADD_OID macro instead of calling function directly.Eric Anholt
Submitted by: reffie@FreeBSD.org
2004-11-07Refine the locking of the DRM. Most significant is covering the driverEric Anholt
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 Anholt
2004-11-07Now that the memory debug code is gone, and all 3 BSDs have M_ZERO, stopEric Anholt
using drm_alloc/drm_free in the core and instead use plain malloc/free.
2004-11-06Add the drm Makefile and update .cvsignores.Eric Anholt
2004-11-06Convert more drivers for bsd-core, moving the ioctl definitions to sharedEric Anholt
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 Anholt
2004-11-06Get r128 basically working: Hook up the driver's dma ioctl, use the properEric Anholt
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 Anholt
2004-11-06Connect up r128_ioctls in driver config.Eric Anholt
2004-11-06Hook the debug output up to a sysctl, so you can choose to enable atEric Anholt
runtime.
2004-11-06Add file missed in last commit: Commit first pieces of port to OpenBSD,Eric Anholt
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 Anholt
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-06Remove the vestiges of the memory-debug code.Eric Anholt
2004-11-06Commit WIP of BSD conversion to core model. Compiles for r128, radeon, butEric Anholt
doesn't run yet. Moves the ioctl definitions for these two drivers back to the shared code -- they aren't OS-specific.
2004-08-24This patch adds three new ioctl's to the VIA Unichrome/Pro DRM driver:Erdi Chen
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-17Merged drmfntbl-0-0-1Dave Airlie
2004-08-14Remove unused pcigart/sg header stuff from i915 driver.Eric Anholt
2004-08-14Add a "dev" argument to DRIVER_CTX_[CD]TOR. This will be used in anEric Anholt
upcoming commit for the SiS driver.
2004-08-14Hopefully proper fix for corrupted driver name in memcontrol list.Eric Anholt
Reported by: Jung-uk Kim <jkim@niksun.com>
2004-08-13Enable MTRR usage on AMD64, and use DELAY() instead of rolling our ownEric Anholt
udelay code. Submitted by: Jung-uk Kim <jkim@niksun.com>
2004-08-03bring over fix from i865-agp branch, it now probes the driver, X hangsDave Airlie
box..
2004-07-29add read/write 16Dave Airlie
2004-07-29change to agp not pci ... still not workingDave Airlie
2004-07-29initial port of i915 to BSD, not finished doesn't work.. no idea why...Dave Airlie
2004-07-06Fix module loading on alpha by not referencing MTRR symbols onEric Anholt
!__REALLY_HAVE_MTRR.
2004-07-06MFC as of 20040705: dev_t -> struct cdev * change.Eric Anholt
2004-05-11Merge from FreeBSD-current. Mostly 64-bit cleanliness fixes, but a fewEric Anholt
driver interface changes from -current.
2004-05-09Add mach64 DRM module for BSD (untested, but compiles).Eric Anholt
2004-05-09Add .cvsignore files.Eric Anholt
2004-05-09Warning fixes.Eric Anholt
2004-05-09- Link in shared files as necessary and clean them up.Eric Anholt
- Generate drm_pciids.h automatically.
2004-05-09Catch up with sis's DRM tag change.Eric Anholt
2004-05-09drm_hw_lock_t is now defined in drm.h, remove from here.Eric Anholt
2004-05-09Commit sysfs and drm PCI changes for 2.6 kernelDave Airlie
2004-04-21centralise pci ids into one place and use scripts to generate files forDave Airlie
kernel
2004-01-06Fix some misuse of NULL where 0 is intended.Eric Anholt
Obtained from: FreeBSD CVS
2003-12-16Don't ioremap the framebuffer area. The ioremapped area wasn't used byEric Anholt
anything, and took up valuable KVA. While I'm in the area, clean up BSD MTRR stuff some more. Suggested by: jonsmirl
2003-11-12Fix a locking nit, and add asserts in some things that should be calledEric Anholt
with locks held.
2003-11-06Return EBUSY when attempting to addmap a DRM_SHM area with a lock in it ifEric Anholt
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-06Remove unused variable.Eric Anholt
2003-11-05- Tie the DRM to a specific device: setunique no longer succeeds when givenEric Anholt
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-05Args for the BSD DRM_PUT_USER_UNCHECKED were swapped.Eric Anholt
2003-11-05Remove buf_alloc which is unused since the locking commit.Eric Anholt
2003-11-04Memory layout transition:Michel Daenzer
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.