Eric Anholt [Tue, 3 Jun 2008 16:27:37 +0000 (09:27 -0700)]
Import bufmgr code to libdrm. Not yet hooked up to the build.
Keith Packard [Mon, 2 Jun 2008 19:37:10 +0000 (12:37 -0700)]
[intel-gem] reloc_and_validate_object → object_bind_and_relocate
Just renaming this function and related parameters to match terminology used
elsewhere in the driver.
Keith Packard [Mon, 2 Jun 2008 17:59:15 +0000 (10:59 -0700)]
[intel-gem] Propagate set_domain errors.
set_domain can block waiting for rendering to complete. If that process is
interrupted by a signal, it can return -EINTR. Catch this error in all
callers and correctly deal with the result.
Eric Anholt [Fri, 30 May 2008 21:42:08 +0000 (14:42 -0700)]
Merge commit 'origin/master' into drm-gem
Conflicts:
linux-core/Makefile.kernel
shared-core/i915_drv.h
shared-core/nouveau_state.c
Eric Anholt [Fri, 30 May 2008 20:47:34 +0000 (13:47 -0700)]
[intel-gem] Only update obj->write_domain if we're actually changing it.
The problem was revealed where on 965, the display list vertex buffer would see:
create -> (CPU, CPU)
set_domain (CPU, CPU) -> (CPU, CPU)
set_comain (CPU, 0) -> (CPU, 0) (no clflush occurred)
execbuf (GPU, 0) -> (CPU+GPU, 0) (still no clflush)
instead of:
create -> (CPU, CPU)
set_domain (CPU, CPU) -> (CPU, CPU)
set_comain (CPU, 0) -> (CPU, CPU)
execbuf (GPU, 0) -> (CPU+GPU, 0) (clflushed)
Eric Anholt [Fri, 30 May 2008 17:04:22 +0000 (10:04 -0700)]
[intel-gem] Add an option to check GTT versus CPU coherency at execbuf time.
Dave Airlie [Fri, 30 May 2008 10:27:31 +0000 (20:27 +1000)]
r500: attempt to make AGP work by programming agp base in the MC correctly
Eric Anholt [Thu, 29 May 2008 19:53:13 +0000 (12:53 -0700)]
[intel-gem] Write the presumed_offset back out after updating it.
Otherwise, 965 constant state buffers get re-relocated every exec. Ouch.
Keith Packard [Tue, 27 May 2008 23:49:49 +0000 (16:49 -0700)]
[intel-gem] Clean up active/inactive/flushing list debugging.
Dave Airlie [Wed, 28 May 2008 01:12:57 +0000 (11:12 +1000)]
radeon: split microcode out into a separate header file.
Eric Anholt [Wed, 28 May 2008 00:50:39 +0000 (17:50 -0700)]
[intel-gem] Replace idlelock usage with real lock acquisition.
Dave Airlie [Wed, 28 May 2008 00:28:13 +0000 (10:28 +1000)]
i915: fix BSD bh, DRI2 not uses anywhere else
Dave Airlie [Wed, 28 May 2008 00:02:20 +0000 (10:02 +1000)]
radeon: bump release date/version for r500 3D support
Alex Deucher [Tue, 27 May 2008 22:33:33 +0000 (18:33 -0400)]
RADEON: add get_param for number of GB pipes
Owain Ainsworth [Tue, 27 May 2008 22:12:35 +0000 (15:12 -0700)]
[BSD] Move unlock in drm_vm.c from accidental platform #ifdeffing.
Also remove an unreachable unlock.
Owain Ainsworth [Tue, 27 May 2008 22:11:25 +0000 (15:11 -0700)]
[BSD] Fix lock leak in drm_update_draw malloc failure path.
Owain Ainsworth [Tue, 27 May 2008 22:07:04 +0000 (15:07 -0700)]
[BSD] Fix lock leaks in error paths in drm_bufs.c.
Owain Ainsworth [Tue, 27 May 2008 21:59:38 +0000 (14:59 -0700)]
[BSD] Remove superfluous recursive locking in drm_add_magic.
Jie Luo [Tue, 27 May 2008 21:55:01 +0000 (14:55 -0700)]
[i915] Fix typo in (unused) START_ADDR definition.
Robert Noland [Fri, 23 May 2008 18:36:05 +0000 (14:36 -0400)]
[FreeBSD] Add vblank-rework support and get drivers building.
The i915 driver now works again.
Eric Anholt [Tue, 27 May 2008 21:12:51 +0000 (14:12 -0700)]
[FreeBSD] Convert from drm_device_t to struct drm_device for consistency.
Keith Packard [Tue, 27 May 2008 00:41:46 +0000 (17:41 -0700)]
[intel-gem] Must hold DRM lock while setting object domain
Object domain transfer can involve adding flush ops to the request queue,
and so the DRM lock must be held to avoid having the X server smash pointers
badly.
Keith Packard [Mon, 26 May 2008 10:25:16 +0000 (03:25 -0700)]
[i915] leave interrupts masked off when not in use.
The interrupt enable register cannot be used to temporarily disable
interrupts, instead use the interrupt mask register.
Note that this change means that a pile of buffers will be left stuck on the
chip as the final interrupts will not be recognized to come and drain things.
Keith Packard [Mon, 26 May 2008 03:45:20 +0000 (20:45 -0700)]
[intel-gem] Add DRM_I915_GEM_BUSY ioctl to check for idle buffers.
This new ioctl returns whether re-using the buffer would force a wait.
Keith Packard [Mon, 26 May 2008 03:44:19 +0000 (20:44 -0700)]
[intel-gem] Compute npages instead of nbytes in flush_pwrite
i915_gem_flush_pwrite optimizes short writes to the buffer by clflushing
only the modified pages, but it was miscomputing the number of pages.
Keith Packard [Mon, 26 May 2008 03:41:42 +0000 (20:41 -0700)]
[intel-gem] replace call to jiffies_to-msec with simple inline
Keith Packard [Fri, 23 May 2008 06:08:38 +0000 (23:08 -0700)]
[intel-gem] Encourage multiple caches to hold read data
When reading from multiple domains, allow each cache to continue
to hold data until writes occur somewhere. This is done by
first leaving the read_domains alone at bind time (presumably the CPU read
cache contains valid data still) and then in set_domain, if no write_domain
is specified, the new read domains are simply merged into the existing read
domains.
A huge comment was added above set_domain to explain how things are
expected to work.
Keith Packard [Thu, 22 May 2008 18:34:56 +0000 (11:34 -0700)]
[gem] Use CPU domain for new or pageable objects
Newly allocated objects need to be in the CPU domain as they've just been
cleared by the CPU. Also, unmapping objects from the GTT needs to put them
into the CPU domain, both to flush rendering as well as to ensure that any
paging action gets flushed before we remap to the GTT.
Keith Packard [Thu, 22 May 2008 17:59:59 +0000 (10:59 -0700)]
[intel-gem] Force ring retire by emiting flush before user-interrupt.
Commands in the ring are parsed and started when the head pointer passes by
them, but they are not necessarily finished until a MI_FLUSH happens. This
patch inserts a flush after the execbuffer (the only place a flush wasn't
already happening).
Keith Packard [Thu, 22 May 2008 17:48:32 +0000 (10:48 -0700)]
[intel] Add debug code to verify the cached ring tail pointer.
Recording the tail pointer in a local variable improves performance, but if
someone messes up and fails to reload at the right time, the driver will
write commands to the wrong part of the ring and scramble execution badly.
This change (available by setting I915_RING_VALIDATE to 1) checks to make
sure the cached tail pointer matches the hardware tail pointer at each ring
buffer addition, calling BUG_ON when that's not true.
Keith Packard [Wed, 21 May 2008 07:32:02 +0000 (00:32 -0700)]
[intel-gem] invalidate ring locals for pin/unpin/set_domain/free functions
Ring locals must be reloaded from hardware in case the X server ran.
Eric Anholt [Wed, 14 May 2008 22:13:14 +0000 (15:13 -0700)]
[gem] Release GEM buffers from work task scheduled from IRQ.
There are now 3 lists. Active is buffers currently in the ringbuffer.
Flushing is not in the ringbuffer, but needs a flush before unbinding.
Inactive is as before. This prevents object_free → unbind →
wait_rendering → object_reference and a kernel oops about weird refcounting.
This also avoids an synchronous extra flush and wait when freeing a buffer
which had a write_domain set (such as a temporary rendered to and then from
using the 2d engine). It will sit around on the flushing list until the
appropriate flush gets emitted, or we need the GTT space for another
operation.
Dave Airlie [Thu, 22 May 2008 23:39:54 +0000 (09:39 +1000)]
r500: add two more register ranges for mesa driver to setup
Dave Airlie [Thu, 15 May 2008 01:13:03 +0000 (11:13 +1000)]
drm: fix nouveau warning
Eric Anholt [Tue, 20 May 2008 23:27:05 +0000 (16:27 -0700)]
[gem] Replace ring throttling hack with actual time measurement.
Eric Anholt [Wed, 21 May 2008 22:15:58 +0000 (15:15 -0700)]
[gem] Fix bad test for list_for_each completion.
Since it's a circular list, the entry won't be NULL at termination.
Eric Anholt [Wed, 21 May 2008 22:03:47 +0000 (15:03 -0700)]
[gem] Hold a reference on the object in i915_gem_wait_space.
Otherwise, in the middle of the function called using it the last ref
might disappear.
Keith Packard [Wed, 21 May 2008 07:32:02 +0000 (00:32 -0700)]
[intel-gem] invalidate ring locals for pin/unpin/set_domain/free functions
Ring locals must be reloaded from hardware in case the X server ran.
Dave Airlie [Wed, 21 May 2008 10:14:45 +0000 (20:14 +1000)]
rs690/r500: vblank support.
The new display controller has the vblank interrupts in a different place.
Add support for vbl interrupts for these chips
Eric Anholt [Tue, 20 May 2008 21:03:27 +0000 (14:03 -0700)]
[gem] Use a separate sequence number field from classic/ttm
This lets us get some qualities we desire, such as using the full 32-bit
range (except zero), avoiding DRM_WAIT_ON, and a 1:1 mapping of active
sequence numbers to request structs, which will be used soon for throttling
and interrupt-driven list cleanup.
Eric Anholt [Tue, 20 May 2008 17:52:24 +0000 (10:52 -0700)]
[gem] Rename sequence numbers from "cookie" to "seqno"
Eric Anholt [Tue, 20 May 2008 17:48:36 +0000 (10:48 -0700)]
[gem] Clean up active/inactive list handling using helper functions.
Additionally, a boolean active field is added to indicate which list an
object is on, rather than smashing last_rendering_cookie to 0 to show
inactive. This will help with flush-reduction later on, and makes the code
clearer.
Dave Airlie [Sat, 17 May 2008 00:22:12 +0000 (10:22 +1000)]
r500: add more register ranges for Mesa driver
Eric Anholt [Thu, 15 May 2008 18:21:11 +0000 (11:21 -0700)]
[gem] Hold dev->struct_mutex to protect structure data.
Eric Anholt [Thu, 15 May 2008 16:37:49 +0000 (09:37 -0700)]
[gem] Rename the GTT LRU lists to active (executing) and inactive (idle).
Eric Anholt [Thu, 15 May 2008 16:32:34 +0000 (09:32 -0700)]
[gem] typo fix in comment.
Dave Airlie [Wed, 14 May 2008 12:48:12 +0000 (22:48 +1000)]
ati_pcigart: oops wrong way around not that it actually mattered
Dave Airlie [Wed, 14 May 2008 12:44:22 +0000 (22:44 +1000)]
ati_pcigart: stop working in the evenings you mess up too often
Dave Airlie [Wed, 14 May 2008 12:43:28 +0000 (22:43 +1000)]
Revert "ati_pcigart: fixup properly this version might even work"
This reverts commit
bc0836e12a9790f1cc83f8bc29bc05043c4bc840.
tree has some kref hacks in it - oops
Dave Airlie [Wed, 14 May 2008 12:42:21 +0000 (22:42 +1000)]
ati_pcigart: fixup properly this version might even work
Dave Airlie [Wed, 14 May 2008 12:35:32 +0000 (22:35 +1000)]
ati_pcigart: fill out 40-bit gart table support properly
Thanks to Alex for supplying this info.
Alex Deucher [Wed, 14 May 2008 01:02:17 +0000 (21:02 -0400)]
RS4xx: separate out RS400 and RS480 IGP chips
RS400 (intel based IGP) and RS480 (AMD based IGP) have
different MC and GART setups. Currently we only support
RS480.
Eric Anholt [Mon, 12 May 2008 22:42:20 +0000 (15:42 -0700)]
[GEM] Update testcases for new API.
Eric Anholt [Mon, 12 May 2008 19:55:36 +0000 (12:55 -0700)]
[GEM] Typo (and thinking) fixes in drm-gem.txt and doxygen.
Keith Packard [Mon, 12 May 2008 20:04:18 +0000 (13:04 -0700)]
[intel] Minor kludge -- wait for the ring to be nearly empty before queuing
No need to fill the ring that much; wait for it to become nearly empty
before adding the execbuffer request. A better fix will involve scheduling
ring insertion in the irq handler.
Keith Packard [Mon, 12 May 2008 20:03:16 +0000 (13:03 -0700)]
[intel] When polling for ring space, sleep for a lot longer (10ms)
If the ring is full, the engine will surely be running for more than 10ms.
Keith Packard [Mon, 12 May 2008 20:01:57 +0000 (13:01 -0700)]
[gem] Set write domain to CPU when doing pwrite.
Leave the flush call in place, which can fix domains up if necessary.
Keith Packard [Mon, 12 May 2008 20:00:55 +0000 (13:00 -0700)]
[gem] Clarify use of explicit domain control. Remove Gen3 from I-cache usage.
Alex Deucher [Mon, 12 May 2008 18:49:43 +0000 (14:49 -0400)]
RADEON: fix copy/pasto in last commit
Alex Deucher [Mon, 12 May 2008 13:44:20 +0000 (09:44 -0400)]
R3/4/5: init pipe setup in drm
Similar (broken) code in mesa needs to be removed
Alex Deucher [Mon, 12 May 2008 13:35:06 +0000 (09:35 -0400)]
RADEON: cleanup radeon_do_engine_reset()
Alex Deucher [Mon, 12 May 2008 13:30:47 +0000 (09:30 -0400)]
R300+: fixup pixcache flush
Alex Deucher [Mon, 12 May 2008 13:24:13 +0000 (09:24 -0400)]
RS4xx: fix MCIND index mask
Alex Deucher [Mon, 12 May 2008 13:21:45 +0000 (09:21 -0400)]
RADEON: write AGP_BASE_2 on chips that support it
Alex Deucher [Mon, 12 May 2008 13:18:28 +0000 (09:18 -0400)]
R300+: fixup PURGE/FLUSH macros
Alex Deucher [Mon, 12 May 2008 13:13:44 +0000 (09:13 -0400)]
Radeon IGP: merge RS4xx/RS6xx gart setup
Alex Deucher [Mon, 12 May 2008 13:00:40 +0000 (09:00 -0400)]
Radeon IGP: wrap MCIND access
first step in merging rs4xx/rs6xx gart setup
Alex Deucher [Mon, 12 May 2008 12:56:11 +0000 (08:56 -0400)]
Radeon IGP: clean up registers and magic numbers
Keith Packard [Sun, 11 May 2008 07:10:16 +0000 (00:10 -0700)]
[GEM] Make pread/pwrite manage memory domains. No luck with movnti though.
pread and pwrite must update the memory domains to ensure consistency with
the GPU. At some point, it should be possible to avoid clflush through this
path, but that isn't working for me.
Keith Packard [Sun, 11 May 2008 05:04:39 +0000 (22:04 -0700)]
[intel-GEM] exec list can contain pinned, lru cannot.
The exec list contains all objects, in order of use. The lru list contains
only unpinned objects ready to be evicted. This required two changes -- the
first was to not migrate pinned objects from exec to lru, the second was to
search for the first unpinned object in the exec list when doing eviction.
Keith Packard [Sun, 11 May 2008 04:05:25 +0000 (21:05 -0700)]
Merge commit 'anholt/drm-gem' into drm-gem
Keith Packard [Sun, 11 May 2008 04:04:42 +0000 (21:04 -0700)]
[GEM] Add drm-gem.txt
Add some API and implementation documentation for GEM.
Keith Packard [Sun, 11 May 2008 04:04:18 +0000 (21:04 -0700)]
[intel-GEM] Clean up GEM ioctl naming.
Rename 'validate_entry' to 'exec_object', then clean up some field names in
structures (renaming buffer_offset to just offset, for example).
Eric Anholt [Sat, 10 May 2008 01:23:51 +0000 (18:23 -0700)]
GEM: Fix arguments to drm_memrange_init so we don't exceed our allocation.
It takes (offset, size), not (offset, end).
Eric Anholt [Fri, 9 May 2008 21:34:20 +0000 (14:34 -0700)]
GEM: Separate the LRU into execution list and LRU list.
Now, the LRU list has objects that are completely done rendering and ready
to kick out, while the execution list has things with active rendering,
which have associated cookies and reference counts on them.
Eric Anholt [Fri, 9 May 2008 22:07:49 +0000 (15:07 -0700)]
GEM: Clear obj_priv->agp_mem when we free it.
Still managing to get something wrong with this, oopsing down in agp.
Eric Anholt [Fri, 9 May 2008 22:02:50 +0000 (15:02 -0700)]
GEM: Avoid leaking refs on target objects on presumed offset success.
Keith Packard [Fri, 9 May 2008 19:18:09 +0000 (12:18 -0700)]
[gem] API cleanup. allocate->create unreference->close name->flink
Make the API names a bit more consistent.
Keith Packard [Thu, 8 May 2008 18:45:53 +0000 (11:45 -0700)]
[i915] clean up whinging from checkpatch.pl
Keith Packard [Thu, 8 May 2008 18:13:29 +0000 (11:13 -0700)]
Clean up whinging from checkpatch.pl in drm_gem.c
Whitespace changes, a few too-long-lines and some extra braces.
Eric Anholt [Thu, 8 May 2008 19:46:02 +0000 (12:46 -0700)]
GEM: Fix oops on NULL dereference when we try clflushing when we don't need to.
Keith Packard [Thu, 8 May 2008 17:44:02 +0000 (10:44 -0700)]
[intel-gem] Move domains to relocation records. add set_domain ioctl.
Domain information is about buffer relationships, not buffer contents. That
means a relocation contains the domain information as it knows how the
source buffer references the target buffer.
This also adds the set_domain ioctl so that user space can move buffers to
the cpu domain.
Eric Anholt [Wed, 7 May 2008 23:00:58 +0000 (16:00 -0700)]
GEM: fix testcases for new ioctl args.
Arjan van de Ven [Wed, 7 May 2008 22:54:32 +0000 (15:54 -0700)]
Apply a few stylistic cleanups to match kernel code.
Eric Anholt [Wed, 7 May 2008 21:10:04 +0000 (14:10 -0700)]
GEM: Wait for existing rendering to complete before writing relocation data.
This should already have been generally safe since we don't change contents
and put in new relocations between execbufs, so if we were writing in a new
relocation then we'd already waited rendering to complete when we moved
the target of the relocation. However, doing the right thing will be required
if we do buffer reuse.
Eric Anholt [Wed, 7 May 2008 19:46:06 +0000 (12:46 -0700)]
GEM: Extend cache domain stuff for 965.
One of our MI_FLUSH bits is reserved on 965, being always implied, and there's
a vertex cache that was forgotten.
Dave Airlie [Wed, 7 May 2008 05:10:23 +0000 (15:10 +1000)]
drm: nopage compat fixup for drm_vm
The kernel has removed nopage so move the old nopage codepaths into a compat vm file and switch to using the fault paths.
nopfn is on its way out in the future also, so we should switch to using fault
for that path as well soon
Keith Packard [Wed, 7 May 2008 04:59:06 +0000 (21:59 -0700)]
[intel-GEM] ref count objects in gtt-lru.
If objects on the lru aren't ref counted, they'll get pulled from the gtt as
soon as they are freed. This change does cause objects to get stuck in the
gtt until they're forced out by new requests. The lru should get cleaned
when the irq occurs.
Keith Packard [Wed, 7 May 2008 03:00:23 +0000 (20:00 -0700)]
[intel-GEM] Add memory domain support.
Memory domains allow the kernel to track which caches to flush and how to
move objects before buffer execution.
Keith Packard [Tue, 6 May 2008 21:43:56 +0000 (14:43 -0700)]
Merge commit 'anholt/drm-gem' into drm-gem
Keith Packard [Tue, 6 May 2008 21:43:49 +0000 (14:43 -0700)]
Start coding up memory domains
Eric Anholt [Tue, 6 May 2008 20:28:26 +0000 (13:28 -0700)]
GEM: Use irq-based fencing rather than syncing and evicting every exec.
Eric Anholt [Tue, 6 May 2008 18:25:53 +0000 (11:25 -0700)]
GEM: Skip relocation if presumed offset matches.
Eric Anholt [Tue, 6 May 2008 18:18:47 +0000 (11:18 -0700)]
GEM: Save the last ioremapped page for relocations in case we need it again.
Keith Packard [Tue, 6 May 2008 05:10:02 +0000 (22:10 -0700)]
Dump last batch buffer when hardware lockup is detected.
Keith Packard [Tue, 6 May 2008 05:09:34 +0000 (22:09 -0700)]
Monitor ACTHD register while polling for idle ring.
When batch buffers are executing, the ring may be stuck for a long time.
Monitor the ACTHD pointer which will show if the execution engine is
actually hung.
Keith Packard [Tue, 6 May 2008 00:17:19 +0000 (17:17 -0700)]
Unlock pages right after getting them.
pages come back from find_or_create_page locked, but must not stay locked
for long. Unlock them immediately instead of waiting until we're done with
them to avoid deadlock when applications try to touch them.
Keith Packard [Mon, 5 May 2008 21:40:20 +0000 (14:40 -0700)]
Merge commit 'anholt/drm-gem' into drm-gem
Conflicts:
linux-core/i915_gem.c
Eric Anholt [Mon, 5 May 2008 21:38:04 +0000 (14:38 -0700)]
GEM: Replace drm_memrange_for_each with just evicting what we brought in.
I was wrong about how the data structure worked, and didn't care to fix it
to support debugging code.
Keith Packard [Mon, 5 May 2008 21:32:01 +0000 (14:32 -0700)]
Remove some debug messages.