Commit Graph

240 Commits

Author SHA1 Message Date
Hans Petter Selasky
07da61a6cc Streamline use of cdevpriv and correct some corner cases.
1) It is not useful to call "devfs_clear_cdevpriv()" from
"d_close" callbacks, hence for example read, write, ioctl and
so on might be sleeping at the time of "d_close" being called
and then then freed private data can still be accessed.
Examples: dtrace, linux_compat, ksyms (all fixed by this patch)

2) In sys/dev/drm* there are some cases in which memory will
be freed twice, if open fails, first by code in the open
routine, secondly by the cdevpriv destructor. Move registration
of the cdevpriv to the end of the drm open routines.

3) devfs_clear_cdevpriv() is not called if the "d_open" callback
registered cdevpriv data and the "d_open" callback function
returned an error. Fix this.

Discussed with:	phk
MFC after:	2 weeks
2012-08-15 16:19:39 +00:00
Dimitry Andric
1acc420fe0 In sys/dev/drm/radeon_state.c, use the correct printf length modifiers
for ints.

MFC after:	1 week
2011-12-30 02:07:50 +00:00
Stefan Eßer
9ee4b7eb64 Fix format string Z --> z, since the former is a deprecated and (in FreeBSD)
unsupported form of the latter. This change has been reviewed and accepted
in the -hackers list.

Submitted by:	Alexander Best
Reviewed by:	David Schulz
2011-12-16 12:42:02 +00:00
Matthew D Fleming
103af58f59 Do not define bool/true/false if the symbols already exist.
MFC after:	2 weeks
Sponsored by:	Isilon Systems, LLC
2011-12-12 18:43:24 +00:00
Konstantin Belousov
9af3638096 Fix display of the drm sysctls.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2011-04-23 23:11:44 +00:00
John Baldwin
3b0a4aef96 Do a sweep of the tree replacing calls to pci_find_extcap() with calls to
pci_find_cap() instead.
2011-03-23 13:10:15 +00:00
Martin Wilke
843f5f45a2 - Remove no longer in use
PR:		kern/152354
Submitted by:	vehemens <vehemens@verizon.net>
Discussion with:kib
Approved by:	rwatson (mentor)
2011-02-22 05:10:13 +00:00
Rebecca Cran
6bccea7c2b Fix typos - remove duplicate "the".
PR:	bin/154928
Submitted by:	Eitan Adler <lists at eitanadler.com>
MFC after: 	3 days
2011-02-21 09:01:34 +00:00
Alan Cox
82de724fe1 Introduce and use a new VM interface for temporarily pinning pages. This
new interface replaces the combined use of vm_fault_quick() and
pmap_extract_and_hold() throughout the kernel.

In collaboration with:	kib@
2010-12-25 21:26:56 +00:00
Andriy Gapon
d009878bb9 fix atomic_set_xxx misuse in drm
It seems that atomic_set_xxx and atomic_store_xxx were confused.

Reviewed by:	jhb
MFC after:	3 weeks
2010-12-11 10:18:05 +00:00
Nathan Whitehorn
17a6d97402 Make drm(4) build, if not work reliably, on PowerPC. 2010-11-16 03:43:06 +00:00
Rebecca Cran
b1ce21c6ef Fix typos.
PR:	bin/148894
Submitted by:	olgeni
2010-11-09 10:59:09 +00:00
Oliver Fromme
d191ee22b1 Add support for ATI Radeon HD 4250.
PR:		kern/149041
Submitted by:	olli
Reviewed by:	rnoland
Approved by:	des (mentor)
MFC after:	1 week
2010-08-03 16:30:56 +00:00
Alan Cox
28a50a192f Push down the acquisition of the page queues lock into vm_page_unwire(). 2010-05-05 07:40:54 +00:00
Alan Cox
a7283d3213 Add page locking to the vm_page_cow* functions.
Push down the acquisition and release of the page queues lock into
vm_page_wire().

Reviewed by:	kib
2010-05-04 15:55:41 +00:00
Alan Cox
5fdd0a335f Acquire the page lock around vm_page_unwire(). For consistency, extend the
scope of the object lock in agp_i810.c.  (In this specific case, the scope
of the object lock shouldn't matter, but I don't want to create a bad
example that might be copied to a case where it did matter.)

Reviewed by:	kib
2010-05-03 16:55:50 +00:00
Kip Macy
2965a45315 On Alan's advice, rather than do a wholesale conversion on a single
architecture from page queue lock to a hashed array of page locks
(based on a patch by Jeff Roberson), I've implemented page lock
support in the MI code and have only moved vm_page's hold_count
out from under page queue mutex to page lock. This changes
pmap_extract_and_hold on all pmaps.

Supported by: Bitgravity Inc.

Discussed with: alc, jeffr, and kib
2010-04-30 00:46:43 +00:00
Robert Noland
e7699af0af fx->lock is used as an index, correct test case.
MFC after:	1 week
2010-04-28 10:33:41 +00:00
Robert Noland
1f4aef21da remove vm obect tracker that slipped in from prior work.
MFC after:	2 weeks
2010-04-24 18:13:12 +00:00
Robert Noland
05d841b38b Address some WITNESS panics that occur when using the via driver.
Some of these cases should be safe in a non-atomic fashion, however
since all of the driver ioctls are locked, a lot of work is required to
fix it correctly.  Just don't sleep now.

MFC after:	2 weeks
2010-04-23 14:48:30 +00:00
Robert Noland
a003741e38 Now that we properly set write-combining on the pages that back the GART,
disable snooping on radeons.

MFC after:	2 weeks
2010-04-22 18:47:30 +00:00
Robert Noland
2ee6488c02 re-write scatter gather memory allocation yet again...
This time, abandon the use of busdma and start interacting with the VM
system directly.  Make use of the new kmem_alloc_attr() which allows us
to easily allocate non-contiguous pages to back the GART table.  This
should help a lot when starting or restarting X after the system has
been running for a while and memory has become fragmented.

MFC after:	2 weeks
2010-04-22 18:44:23 +00:00
Robert Noland
9c03c0d88c Rework how drm maps are handled.
* On 32 bit platforms we steal the upper 4 bits of the map handle
   to store a unique map id.
 * On 64 bit platforms we steal the upper 24 bits.

Resolves issues where the offsets that are handed to mmap may overlap the VRAM on some cards.

Tested on: radeon, intel, mga, and via.

This will break nouveau.  I will spin new patches shortly.
2010-04-22 18:21:25 +00:00
Robert Noland
c5af82e517 Fix build after typo.
Reported by:	Sergey V. Dyatko <sergey.dyatko@gmail.com>
MFC after:	3 days
2010-03-13 18:14:51 +00:00
Robert Noland
b8da61ada5 Add support for Intel Pineview chips, aka IGD
Slightly modified version of the submitted patch.

PR:		143427
Submitted by:	Mamoru Sumida <msumida@mvc.biglobe.ne.jp>
MFC after:	3 days
2010-03-13 11:51:18 +00:00
Robert Noland
b1ba33ffbe Welcome drm support for VIA unichrome chips.
MFC after:	2 weeks
2010-01-31 14:30:39 +00:00
Robert Noland
139890fd20 Import simple drm memory manager.
This is required for the VIA driver and at least some parts are needed
for GEM.

MFC after:	2 weeks
2010-01-31 14:25:29 +00:00
Robert Noland
cfd7bacef2 Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.
This replaces d_mmap() with the d_mmap2() implementation and also
changes the type of offset to vm_ooffset_t.

Purge d_mmap2().

All driver modules will need to be rebuilt since D_VERSION is also
bumped.

Reviewed by:	jhb@
MFC after:	Not in this lifetime...
2009-12-29 21:51:28 +00:00
Robert Noland
d2217702c1 Fix botched git -> svn merge.
MFC after:	2 weeks
2009-10-30 18:30:13 +00:00
Robert Noland
11de9e8c79 Cleanup in r600_blit
- Don't bother to assign vb until we know we have enough space
 - Add variables for sx2, sy2, dx2, dy2 so that these aren't
   calculated over and over, also reduce chance of errors.
 - Use switch to assign color/format

MFC after:	3 days
2009-10-30 18:08:46 +00:00
Robert Noland
29e3ffd4f5 A bit of cleanup work on radeon_freelist_get()
* Fix the main loop to search all buffers before sleeping.
  * Remove dead code

MFC after:	3 days
2009-10-30 18:07:22 +00:00
Robert Noland
615fb6e9bc Some general cleanup of scatter/gather memory allocation
- We don't need to check malloc return values with M_WAITOK
 - remove variables that we don't really need
 - cleanup the error paths by just calling drm_sg_cleanup()
 - fix drm_sg_cleanup() to be safe to call at any time

MFC after:	2 weeks
2009-10-30 18:02:10 +00:00
Robert Noland
6d68455174 Use system specified memory barriers rather than rolling our own. 2009-10-30 16:59:58 +00:00
Robert Noland
883759335f Fix blitter support for RS880 chips
MFC after:	3 days
2009-10-30 16:55:31 +00:00
Christian Brueffer
41d7d5932e Check pointer for NULL before dereferencing it, not after.
PR:		138383
Submitted by:	Patroklos Argyroudis <argp@census-labs.com>
Reviewed by:	rnoland
MFC after:	1 week
2009-10-21 15:54:45 +00:00
Robert Noland
33cba7feac Add support for Intel G41 chipset
Submitted by:	Artyom Mirgorodsky <man@email.com.ua>
MFC after:	3 days
2009-10-11 01:54:00 +00:00
Robert Noland
0893652a8c Fix offset handling
MFC after:	1 week
2009-09-28 22:41:28 +00:00
Robert Noland
3a1f3f56cc radeon_family is an enum, so ordering can be important.
sync up with what amd is shipping.

MFC after:	1 week
2009-09-28 22:40:29 +00:00
Robert Noland
d950002723 Fix blit pitch for 4 byte transfers on r600.
MFC after:	1 week
2009-09-28 22:38:44 +00:00
Robert Noland
0b6c99683c R600 doesn't support IRQs yet, so don't try to use them.
MFC after:	1 week
2009-09-28 22:37:07 +00:00
Robert Noland
14928dda5c Add a couple of small fixes from the AMD folks.
- max tex height is 8192
	- increment src/dst by the full transfer amount

MFC after:	3 days
2009-09-13 11:10:38 +00:00
Robert Noland
199e206513 Add missing pci id for Radeon 4850 X2
MFC after:	3 days
2009-09-13 11:08:06 +00:00
Robert Noland
e1ec1f53b1 Add GET_PARAM support for Z pipes.
This is needed for occulsion queries on rv530 chips.

MFC after:	2 weeks
2009-08-23 15:02:58 +00:00
Robert Noland
f588a0bda5 Add kernel support for Radeon R6/7xx 3D.
You will still need Mesa from git and possibly an updated DDX driver,
but this is working fairly well now.

MFC after:	2 weeks
2009-08-23 14:55:57 +00:00
Robert Noland
fe173b46fd Add a read only sysctl tracking the hw.drm.msi tunable.
MFC after:	2 weeks
2009-08-23 14:33:12 +00:00
Robert Noland
2418baa339 Clean up the handling of device minors
Submitted by:	Ed
MFC after:	2 weeks
2009-08-23 14:31:20 +00:00
Robert Noland
f21c255c2a Clean up the locking in drm_alloc_resource()
MFC after:	2 weeks
2009-08-23 14:27:46 +00:00
John Baldwin
a56fe095f0 Temporarily revert the new-bus locking for 8.0 release. It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by:	re (kib), attilio
2009-08-20 19:17:53 +00:00
Robert Noland
2aadd82afe Add support for radeon RS880 IGP chips to drm.
Approved by:	re (kib)
MFC after:	0 days
2009-08-12 12:57:02 +00:00
Robert Noland
fb6891522e Add some additional radeon pci ids to drm.
Approved by:	re (kib)
MFC after:	0 days
2009-08-12 12:50:15 +00:00