Commit Graph

269 Commits

Author SHA1 Message Date
Eric Anholt
69b9fffc84 Merge DRM CVS as of 2005-12-02, adding i915 DRM support thanks to Alexey Popov,
and a new r300 PCI ID.
2005-12-03 01:23:50 +00:00
Eric Anholt
c703850cb4 Make cleaner diffs by munging the $FreeBSD$s from the FreeBSD CVS sources back
into the new sources.
2005-12-03 00:43:57 +00:00
Eric Anholt
45160a070a Restore the enabling of debugging by default by the DRM_DEBUG kernel option.
It remains controlled by hw.dri.*.debug no matter what.

PR:		kern/85479
Submitted by:	Oliver Fromme <olli@secnetix.de>
2005-12-02 08:53:51 +00:00
Eric Anholt
9fb0767374 Update DRM to CVS snapshot as of 2005-11-28. Notable changes:
- S3 Savage driver ported.
- Added support for ATI_fragment_shader registers for r200.
- Improved r300 support, needed for latest r300 DRI driver.
- (possibly) r300 PCIE support, needs X.Org server from CVS.
- Added support for PCI Matrox cards.
- Software fallbacks fixed for Rage 128, which used to render badly or hang.
- Some issues reported by WITNESS are fixed.
- i915 module Makefile added, as the driver may now be working, but is untested.
- Added scripts for copying and preprocessing DRM CVS for inclusion in the
  kernel.  Thanks to Daniel Stone for getting me started on that.
2005-11-28 23:13:57 +00:00
Eric Anholt
786d03d56a Fix a buffer aging problem in new r300 code that could lead to hangs with some
apps.

Obtained from:	DRM CVS
2005-08-01 17:50:19 +00:00
Eric Anholt
af088425f7 Add the latest r300 code from r300.sf.net. This is based on the patch supplied
by Vladimir Dergachev for inclusion in DRM CVS, with minor modifications for
FreeBSD CVS and the appropriate license from Nicolai Haehnle on r300_reg.h.
Fixes hangs when using r300.sf.net userland, tested on a Radeon 9600 on amd64.
2005-07-20 21:10:57 +00:00
Eric Anholt
324f92b9af Disable the drm_initmap calls in radeon_cp.c, due to them resulting in improper
handling of pci resources, and mapping framebuffer leading to panics on X
startup.  The proper solution involves use of bus_alloc_resource without
RF_ACTIVE, but this code is being rewritten in DRM CVS currently, and disabling
for now doesn't remove any features, so take the easy route.

PR:		kern/80718
Approved by:	re (scottl)
2005-06-28 21:38:08 +00:00
Eric Anholt
f3eb3a3b13 Mark the permanent map for radeon registers read-only. Failure to set this flag
allowed writing to the registers by any user that can open the DRI device, and
therefore ability to initiate DMA.  This came in with the merge from DRI CVS on
2005-04-15.

Approved by:	re (scottl)
Obtained from:	DRM CVS
2005-06-24 22:21:28 +00:00
Eric Anholt
7c26ccfd22 Fix a panic on X startup for drivers that don't init maps themselves by storing
the return value of drm_ioremap in the right place again.

Submitted by:	tegge
2005-04-24 19:03:32 +00:00
Eric Anholt
b8aa843c63 Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
  nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
  course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
  testbox).  Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
  to the drmsub device.  Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work.  Covers the
  Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.

Thanks to:	scottl (much p4 handholding)
		Jung-uk Kim (helpful prodding)
PR:		[1] kern/76879, [2] kern/72548
Submitted by:	[1] Alex, lesha at intercaf dot ru
		[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
John Baldwin
98df9218da - Change the vm_mmap() function to accept an objtype_t parameter specifying
the type of object represented by the handle argument.
- Allow vm_mmap() to map device memory via cdev objects in addition to
  vnodes and anonymous memory.  Note that mmaping a cdev directly does not
  currently perform any MAC checks like mapping a vnode does.
- Unbreak the DRM getbufs ioctl by having it call vm_mmap() directly on the
  cdev the ioctl is acting on rather than trying to find a suitable vnode
  to map from.

Reviewed by:	alc, arch@
2005-04-01 20:00:11 +00:00
Sam Leffler
729a4dd7f9 move ptr deref's to after null checks
Noticed by:	Coverity Prevent analysis tool
2005-02-26 18:52:54 +00:00
Poul-Henning Kamp
d5469a8ba5 Neuter DRM(mapbufs) until somebody finds time to try to fix it.
It is _never_ OK to find a vnode from a struct cdev because you have
no way of telling if you get the right one.  You might be in jail or
chroot for instance.
2005-02-22 13:56:15 +00:00
Scott Long
9cd59edc6b Fix typo from previous commit. 2005-01-07 07:08:33 +00:00
Maxim Konovalov
feb21986e8 Unbreak the tinderbox, make this compile. 2005-01-06 12:29:10 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Suleiman Souhlal
4011d8a8c9 Use the SYSCTL_ADD_OID macro, instead of directly calling sysctl_add_oid().
Approved by:	anholt, grehan (mentor)
2004-12-15 06:22:33 +00:00
David E. O'Brien
f0b078381d Specifically use the 32-bit version of fuword/suword since that's what
we really want vs. the size changing 'long' (i386 vs. AMD64).
This fixes the problem with DRM with Radeon's on AMD64.

Submitted by:	Jung-uk Kim <jkim@niksun.com>
2004-12-02 09:38:34 +00:00
Ruslan Ermilov
7bad922a88 Fixed the module name (macros don't work here). 2004-08-29 07:49:53 +00:00
Maxime Henrion
1af8a68c46 Now that mem(4) is a kernel module, we need to add a dependency on
it in drm(4) for mem_range_attr_set().  This fixes loading a DRM
driver as a module.

Reviewed by:	anholt
2004-08-05 07:20:24 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Eric Anholt
3ba181deb2 Merge from DRI CVS as of 2004-05-26. Most of the meat is new PCI IDs and a new
packet for Radeon.
2004-06-11 03:26:59 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
David E. O'Brien
d92dc3946d Prefer uintptr_t to intptr_t. 2004-03-03 08:27:33 +00:00
David E. O'Brien
dd921920ee Use a long as the opaque type so that it matches the size of a pointer
on both 32-bit and 64-bit platforms.
2004-03-03 08:24:31 +00:00
David E. O'Brien
77b72a2216 Use a long as the opaque type so that it matches the size of a pointer
on both 32-bit and 64-bit platforms.
2004-03-03 06:20:36 +00:00
David E. O'Brien
37580b343a Add memory barrier routines for AMD64. 2004-03-03 06:19:03 +00:00
David E. O'Brien
5ec0232d34 Cast thru intptr_t on the way to void* for success on 64-bit platforms. 2004-03-03 06:18:29 +00:00
Robert Watson
033d9ae179 Limit the amount of memory userspace processes can cause the kernel to
allocate via DRI on r128 devices.

Obtained from:	Thomas Biege <thomas@suse.de>
Reviewed by:	scottl
2004-02-23 03:18:18 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
c9c7976f7f Device megapatch 1/6:
Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.
2004-02-21 19:42:58 +00:00
Poul-Henning Kamp
d1dc3136b2 This is not a D_TTY driver. 2004-02-14 19:56:35 +00:00
Eric Anholt
f25a19f66f Merge from DRI CVS. No longer maps the framebuffer into KVA on radeon, r128,
and mga.  MTRR code cleanups.  Includes new Radeon and Rage 128 PCI IDs.
2004-01-06 04:34:53 +00:00
Stefan Eßer
dc75b9e808 Fix a few more places where NULL was used instead of 0. 2003-12-23 14:38:42 +00:00
Eric Anholt
81dc97109d Update from DRI CVS. Includes locking fixes (including PR 59202), changes for
Radeon IGP support (still lacking PCI IDs), and DRM interface 1.2 updates which
include finally tying the DRM instances to specific devices rather than relying
on the X Server.
2003-11-12 20:56:30 +00:00
Eric Anholt
4c4c0f9144 Change the DRM_ERROR about authenticator not found back to DRM_DEBUG. It's
noisier than I expected, and I don't have the time to actually get it fixed.
2003-11-03 20:44:00 +00:00
Eric Anholt
4294fd5ce1 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:45:21 +00:00
Eric Anholt
1d0d7f3ee4 Update to latest from DRI CVS. Primary new feature is mostly-complete smpng
locking, and the apparently unnecessary locking for -stable has been removed.
This may fix issues with missed interrupts since April, which manifested
themselves as slowdowns or hangs in radeon, in particular. Many cleanups also
took place.  In the shared code, there are improvements to r128 driver
stability.
2003-10-24 01:48:17 +00:00
Eric Anholt
6608b729ea Merge from DRI CVS. Includes newly ported SiS 300/305/540/630/730 driver and
updates to allow system memory to be used for textures on PCI Radeons.

Sponsored by:	LinuxFund
2003-09-09 00:24:31 +00:00
Eric Anholt
48d82a815d Comment out a couple of __inline__s until we can get inlines to be actually
respected or at least shut the warning up.
2003-08-24 22:04:12 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
4fbd232c86 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 05:54:52 +00:00
Eric Anholt
7a0f4bee0d Update DRM from DRI CVS as of today. Notable changes include Radeon
suspend/resume support and Rage 128 pageflipping support (both of which require
XFree86 from CVS), along with miscellaneous cleanups.
2003-08-19 02:57:31 +00:00
Poul-Henning Kamp
5578b9263b Do not define memset() to bzero(). We have a memset().
Found by:       FlexeLint
2003-05-31 19:31:46 +00:00
Eric Anholt
d2c47a2151 Merge from DRI CVS: Disable MTRRs on FreeBSD-stable to work around hangs with
SMP machines. and use i386 asm for atomic_cmpset_int on -stable.  This is in
preparation for MFCing the DRM.
2003-04-26 06:59:38 +00:00
Eric Anholt
42da33c444 Update the DRM to the latest from DRI CVS. Includes some bugfixes and removal
of the infrastructure for the gamma driver which was removed a while back.
The DRM_LINUX option is removed because the handler is now provided by the
linux compat code itself.
2003-04-25 01:18:47 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
John Baldwin
31566c96f4 Use td->td_ucred instead of td->td_proc->p_ucred. 2003-03-20 21:17:40 +00:00
Eric Anholt
acbdeb0ca1 Update Radeon PCI IDs and naming from pciids.sf.net. 2003-03-11 01:38:17 +00:00
Eric Anholt
43e2d1e384 Update the DRM to latest from DRI CVS. This is approximately the version
included in XFree86 4.3, but includes some fixes.  Notable changes include
Radeon 8500-9100 support, PCI Radeon/Rage 128 support, transform & lighting
support for Radeons, and vblank syncing support for r128, radeon, and mga.
The gamma driver was removed due to lack of any users.
2003-03-09 02:08:30 +00:00
Poul-Henning Kamp
a8b182112d Don't initialize d_kqfilter to 0. 2003-03-03 12:48:14 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Eric Anholt
a94332b247 Remove an unused variable that snuck in the last commit.
Submitted by:	Christian Brueffer <chris@unixpages.org>
Approved by:	re (rwatson)
2002-12-04 23:39:05 +00:00
Eric Anholt
91f6016a96 Fix witness warning in DRM memory info sysctl by making a temporary copy of the
data under the lock and outputting it to the sysctl later.

Reviewed by:	scottl
Approved by:	re
2002-12-04 18:27:45 +00:00
Don Lewis
91e97a8266 In an SMP environment post-Giant it is no longer safe to blindly
dereference the struct sigio pointer without any locking.  Change
fgetown() to take a reference to the pointer instead of a copy of the
pointer and call SIGIO_LOCK() before copying the pointer and
dereferencing it.

Reviewed by:	rwatson
2002-10-03 02:13:00 +00:00
Eric Anholt
4775259180 Remove drm_linux.h, move the two useful defines into drm_drv.h. Use fd locking
on -current.  Actually copy in data from userspace to kernel in the
linux-compat ioctl path.  Make sure ioctl sizes are as expected in the handler
functions.

Reviewed by:	rwatson
2002-09-01 17:45:04 +00:00
Robert Watson
d49fa1ca6e In continuation of early fileop credential changes, modify fo_ioctl() to
accept an 'active_cred' argument reflecting the credential of the thread
initiating the ioctl operation.

- Change fo_ioctl() to accept active_cred; change consumers of the
  fo_ioctl() interface to generally pass active_cred from td->td_ucred.
- In fifofs, initialize filetmp.f_cred to ap->a_cred so that the
  invocations of soo_ioctl() are provided access to the calling f_cred.
  Pass ap->a_td->td_ucred as the active_cred, but note that this is
  required because we don't yet distinguish file_cred and active_cred
  in invoking VOP's.
- Update kqueue_ioctl() for its new argument.
- Update pipe_ioctl() for its new argument, pass active_cred rather
  than td_ucred to MAC for authorization.
- Update soo_ioctl() for its new argument.
- Update vn_ioctl() for its new argument, use active_cred rather than
  td->td_ucred to authorize VOP_IOCTL() and the associated VOP_GETATTR().

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-17 02:36:16 +00:00
Dag-Erling Smørgrav
20d3956e5d Remove <sys/select.h> to unbreak the build. I'm not sure if this affects
the functionality of the drm module, but hopefully it will tide us over
until Eric can take a look at it.
2002-06-16 21:50:42 +00:00
Eric Anholt
4956c7034c Warnings cleanup for gcc3. Also __FUNCTION__ -> __func__
Approved by:	des
2002-05-31 23:19:50 +00:00
Bruce Evans
833863ff77 Include <sys/lockmgr.h> for definitions of deprecated locking interfaces --
don't depend on namespace pollution in other headers.
2002-05-06 23:34:13 +00:00
Alfred Perlstein
e649887b1e Make funsetown() take a 'struct sigio **' so that the locking can
be done internally.

Ensure that no one can fsetown() to a dying process/pgrp.  We need
to check the process for P_WEXIT to see if it's exiting.  Process
groups are already safe because there is no such thing as a pgrp
zombie, therefore the proctree lock completely protects the pgrp
from having sigio structures associated with it after it runs
funsetownlst.

Add sigio lock to witness list under proctree and allproc, but over
proc and pgrp.

Seigo Tanimura helped with this.
2002-05-06 19:31:28 +00:00
Seigo Tanimura
5cbc7077cb The first argument of pgsigio() is now struct sigio **. 2002-05-03 07:45:26 +00:00
Eric Anholt
b1ade6ab46 More diff reduction: Shuffle around some header code as was done in
drmcommand-0-0-1-branch of DRI CVS, more return code cleanup, and remove some
gratuitous ifdefs.

Approved by:	des
2002-04-29 18:18:42 +00:00
Eric Anholt
c9d942be3a Diff reduction to my experimental code: clean up return code handling.
Approved by:	des
2002-04-29 00:25:10 +00:00
Eric Anholt
67a2a28fe4 Hook the DRM up to the build and add it to NOTES.
Approved by:	des
2002-04-28 04:58:40 +00:00
Eric Anholt
4fc9623548 Add the code for the DRM, based on the code from the drm-kmod port.
This is not hooked up yet, that will come later.

Approved by:	des
2002-04-27 20:47:57 +00:00