Commit Graph

186 Commits (d55629a13d0f287e186e93a4828ef86b36678eba)

Author SHA1 Message Date
Keith Packard 57b9a54eb6 Allow relocation to be skipped when buffers don't move.
One of the costs of superioctl has been the need to perform relocations
inside the kernel. The cost of mapping the buffers to the CPU and writing
data is fairly high, especially if those buffers have been mapped and read
by the GPU.

If we assume that buffers don't move around very often, we can have the
client compute the relocations itself using the previous GPU address. When
that object doesn't move, the kernel can skip computing and writing the
updated data.

Here's a patch which adds a new field to struct drm_bo_info_req called
'presumed_offset', and a new DRM_BO_HINT_PRESUMED_OFFSET that is set when
this field has been filled in by the client.

There are two separate optimizations performed when the presumed_offset is
correct:

 1. i915_exec_reloc checks to see if all previous buffer offsets were guessed
    correctly. If so, there's no need for it to look at *any* of the
    relocations for a buffer. When this happens, it skips the whole
    relocation process, simply returning success.

 2. i915_apply_reloc checks to see if the target buffer offset was guessed
    correctly. If so, it skips mapping the relocatee, computing the
    relocation and writing the value. If no relocations are needed, the
    relocatee should never be mapped to the CPU, and so the kernel shouldn't
    need to wait for any fences to pass.
2007-12-11 20:23:00 -08:00
Dave Airlie 8d2da20233 Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Conflicts:

	linux-core/drm_drv.c
	shared-core/drm.h
	shared-core/i915_dma.c
2007-12-11 16:58:00 +10:00
Kristian Høgsberg e38749ebe5 Remove references to the sarea_priv perf_boxes field.
This field isn't touched or read by any other code in the stack so it's
time to retire these last few references.
2007-12-05 14:43:22 -05:00
Robert Noland b2f8368b57 Clarify order of operations 2007-12-01 14:44:30 -05:00
Robert Noland 453a295c82 DRM_DEBUG already prints the function name. 2007-12-01 14:44:29 -05:00
Robert Noland d6295cc9ff drm: Add _DRM_DRIVER map flag.
This flag indicates that the driver is responsible for the map.
2007-12-01 02:40:13 -05:00
Jiri Slaby 309b2c4c05 Beside the emitted warning, the added cast (u64 -> unsigned) strips out
part of address on 64 bit. Cast to unsigned long instead.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2007-11-29 09:55:38 +10:00
Dave Airlie dc338921f9 drm: more cleanups 2007-11-29 09:38:21 +10:00
Dave Airlie e9fa8fe734 i965: oops force mi batchbuffer start 2007-11-28 22:46:06 +10:00
Dave Airlie a20587e395 Merge branch 'origin' into modesetting-101
Conflicts:

	linux-core/drmP.h
	shared-core/i915_dma.c
	shared-core/i915_drm.h
	shared-core/radeon_drv.h
2007-11-22 17:17:06 +11:00
Dave Airlie 5dc5c36e62 drm: major whitespace/coding style realignment with kernel 2007-11-22 16:10:36 +10:00
Eric Anholt 3fc3fc082a Fix capitalization of __linux__ define. 2007-11-19 08:41:23 -08:00
Robert Noland a74181ddb2 Bug #13233: Fix build on FreeBSD. 2007-11-18 22:42:40 -08:00
Dave Airlie 2eee33ace5 intel: add flushing for i8xx chipsets.
Add a nut vs hammer style chipset flush for the i8xx chipsets - reenable TTM
code paths
2007-11-15 13:29:55 +11:00
Dave Airlie d983ed90cb i915: cleanup pageflip derefs sarea even if no sarea exists 2007-11-09 11:30:50 +10:00
Dave Airlie 47497abc1e i915: oops disable TTM is backwards 2007-11-07 23:10:24 +10:00
Thomas Hellstrom c07dd80269 Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Conflicts:

	linux-core/Makefile.kernel
	shared-core/i915_dma.c
	shared-core/i915_drv.h
	shared-core/i915_irq.c
2007-11-06 10:01:52 +01:00
Dave Airlie 9280076b67 i915: disable TTM on 8xx chips for now until flushing is solved 2007-11-06 18:13:46 +11:00
Thomas Hellstrom 5ce43a346c Merge branch 'master' into modesetting-101
Conflicts:

	linux-core/drm_bufs.c
	shared-core/i915_dma.c
	shared-core/i915_drv.h
	shared-core/i915_irq.c
2007-11-05 13:46:06 +01:00
Dave Airlie 7f6bf84c23 drm: remove lots of spurious whitespace.
Kernel "cleanfile" script run.
2007-11-05 12:42:22 +10:00
Jesse Barnes 629c8b0dbf Merge branch 'master' into modesetting-101
Conflicts:

	linux-core/Makefile.kernel
	linux-core/drm_stub.c
	linux-core/i915_drv.c
	shared-core/i915_dma.c
	shared-core/i915_drv.h

Fixup suspend/resume conflicts (basically use what's in DRM master for now).
Also fix up a few other conflicts that snuck in (i915_dma changes etc.).
2007-11-01 15:27:55 -07:00
Dave Airlie 17f0882d50 drm: add chipset flushing via agp support 2007-10-31 11:33:34 +11:00
Dave Airlie 2489062a33 i915: add backwards compat chipset flushing code 2007-10-31 11:27:44 +11:00
Jesse Barnes 1e2a2babab i915: suspend/resume support
Add suspend/resume support to the i915 driver.  Moves some of the
initialization into the driver load routine, and fixes up places where we
assumed no dev_private existed in some of the cleanup paths.  This allows
us to suspend/resume properly even if X isn't running.
2007-10-26 16:10:02 -07:00
Thomas Hellstrom 9adf8c0256 Merge branch 'master' into modesetting-101
Conflicts:

	linux-core/Makefile.kernel
	linux-core/drm_bo.c
	linux-core/drm_objects.h
2007-10-25 11:00:45 +02:00
Thomas Hellstrom 07706c9b79 Merge branch 'master' into drm-ttm-finalize 2007-10-25 09:24:45 +02:00
Dave Airlie a70fe82baf i915: relocate buffers before validation add memory barrier between two 2007-10-25 16:53:18 +10:00
Dave Airlie c5f158abbe i915: remove relocatee kernel mapping sooner stops mutex taking during sleep 2007-10-25 16:52:33 +10:00
Eric Anholt 83199c257e Fix missing \n on some DRM_ERROR in i915_dma.c 2007-10-24 16:27:51 -07:00
Dave Airlie fd7c24753c i915: use a drm memory barrier define 2007-10-24 11:13:15 +11:00
Alan Hourihane d5f2b4b411 Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101 2007-10-23 15:34:12 +01:00
Dave Airlie a294aa724a i915: require mfence before submitting batchbuffer 2007-10-23 17:54:07 +10:00
Thomas Hellstrom 919c886b2b A cmdbuf mutex to implement validate-submit-fence atomicity in the absence
of a hardware lock.
2007-10-22 18:59:37 +02:00
Dave Airlie 22883ff26b i915: split reloc execution into separate function 2007-10-22 11:54:41 +11:00
Thomas Hellstrom 9ddff6d15f Adapt i915 super-ioctl for lock-free operation. 2007-10-21 12:26:26 +02:00
Thomas Hellstrom 48b5eaf303 Simple replacement for hardware lock in some cases.
Fix i915 since last commit.
2007-10-20 16:49:43 +02:00
Alan Hourihane be2d68914d Fix a crash on X startup 2007-10-17 09:35:44 +01:00
Dave Airlie ec1162b212 i915: lock struct mutex about buffer object lookups 2007-10-17 15:36:14 +10:00
Alan Hourihane 90bfc8e611 Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Conflicts:

	linux-core/drm_bo.c
	linux-core/drm_objects.h
	shared-core/i915_dma.c
	shared-core/i915_drv.h
2007-10-16 15:28:33 +01:00
Dave Airlie 74001c34e5 i915: add superioctl support to i915
This adds the initial i915 superioctl interface. The interface should be
sufficent even if the implementation may needs fixes/optimisations internally
in the drm wrt caching etc.
2007-10-12 10:54:38 +10:00
Jesse Barnes 0bb2395a8b Revert drm_i915_flip_t braindamage
I should not have renamed this field.
I should not have renamed this field.
I should not have renamed this field.

On the plus side, it was at least binary compatible.
2007-09-28 10:10:08 -07:00
Jesse Barnes 5cc3083179 Merge branch 'master' into modesetting-101 - TTM & typedef removal
Conflicts:

	linux-core/drmP.h
	linux-core/drm_bo.c
	linux-core/drm_drv.c
	linux-core/drm_objects.h
	shared-core/drm.h
	shared-core/i915_dma.c
	shared-core/i915_drv.h
	shared-core/i915_irq.c

Mostly removing typedefs that snuck into the modesetting code and
updating to the latest TTM APIs.  As of today, the i915 driver builds,
but there are likely to be problems, so debugging and bugfixes will
come next.
2007-09-24 14:41:46 -07:00
Jesse Barnes 3cb8acd5ab Disambiguate planes & pipes for swap operations
This mod makes the SAREA track plane to pipe mappings and corrects the name of
the plane info variables (they were mislabeled as pipe info since until now all
code assumed a direct mapping between planes and pipes).

It also updates the flip ioctl argument to take a set of planes rather than
pipes, since planes are flipped while pipes generate vblank events.
2007-09-11 03:48:46 -07:00
Dave Airlie da27986870 i915: i965 non-secure batchbuffer bit has moved. 2007-08-11 08:57:53 +10:00
Eric Anholt 5b38e13416 Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.
The data is now in kernel space, copied in/out as appropriate according to the
This results in DRM_COPY_{TO,FROM}_USER going away, and error paths to deal
with those failures.  This also means that XFree86 4.2.0 support for i810 DRM
is lost.
2007-07-20 18:16:42 -07:00
Eric Anholt c1119b1b09 Replace filp in ioctl arguments with drm_file *file_priv.
As a fallout, replace filp storage with file_priv storage for "unique
identifier of a client" all over the DRM.  There is a 1:1 mapping, so this
should be a noop.  This could be a minor performance improvement, as everything
on Linux dereferenced filp to get file_priv anyway, while only the mmap ioctls
went the other direction.
2007-07-20 13:39:45 -07:00
Eric Anholt e39286eb5e Remove DRM_ERR OS macro.
This was used to make all ioctl handlers return -errno on linux and errno on
*BSD.  Instead, just return -errno in shared code, and flip sign on return from
shared code to *BSD code.
2007-07-20 12:53:52 -07:00
Eric Anholt 05204b9c8d Merge branch 'origin' 2007-07-19 06:31:26 -07:00
Dave Airlie a64b5d8d37 fix some missing whitespace/tab 2007-07-18 15:49:45 +10:00
Eric Anholt 3f04fe7890 Fix FreeBSD build. 2007-07-16 01:53:06 -07:00
Dave Airlie 21ee6fbfb8 drm: remove drmP.h internal typedefs 2007-07-16 12:32:51 +10:00
Dave Airlie b95ac8b7b3 drm: detypedef drm.h and fixup all problems 2007-07-16 11:22:15 +10:00
Alan Hourihane 70fd9351ed Move out the code from i915_dma_cleanup to unload to match
existing code.

This needs verifying.
2007-06-29 21:04:17 +01:00
Alan Hourihane adff58223f Bring back code from merge that was accidentally removed. 2007-06-29 20:58:16 +01:00
Alan Hourihane 14c49df06b merge fixes 2007-06-29 20:14:09 +01:00
Alan Hourihane 8a78dead29 Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Conflicts:

	linux-core/drm_drv.c
	linux-core/drm_fops.c
	linux-core/drm_objects.h
	linux-core/drm_stub.c
	shared-core/i915_dma.c
2007-06-29 20:09:44 +01:00
Michel Dänzer 3d5d41fa98 i915: Fix handling of breadcrumb counter wraparounds. 2007-06-15 17:13:11 +02:00
Wang Zhenyu 109e2a10f2 Add support for the G33, Q33, and Q35 chipsets.
These require that the status page be referenced by a pointer in GTT, rather
than phsyical memory.  So, we have the X Server allocate that memory and tell
us the address, instead.
2007-06-05 11:15:29 -07:00
Wang Zhenyu 3917f85c73 i915: Add support for 965GME/GLE chip. 2007-05-31 11:09:07 +01:00
Jung-uk Kim b0c8d885ce Update a bunch of FreeBSD port code.
Tested on r200/r300.  i915 updates still remain to be done.
2007-05-29 15:02:44 -07:00
Alan Hourihane 315cf14af8 Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Conflicts:

	shared-core/i915_dma.c
2007-05-18 13:48:56 +01:00
Jesse Barnes a18b4befb9 Fix FB pitch value (we had it wrong and were working around it in a few
places).
Add new FB hooks to the drm driver structure and make i915 use them for an
Intel specific FB driver.  This will allow acceleration and better handling
of the command stream.
2007-05-17 09:00:06 -07:00
Keith Packard e4d163d81a Allow vblank interrupts to remain disabled across VT switch.
i915_driver_irq_postinstall was forcing vblank interrupts to pipe A when
called with vblank interrupts disabled. This caused vblank interrupts to be
accidentally re-enabled when VT switching the X server. Instead, start the
driver with vblank interrupts enabled on pipe A to support older X servers,
but then leave control over the state to the X server if it is able to do so.
2007-05-10 13:15:32 -07:00
Dave Airlie 9f9c19065c remove DRM_GETSAREA and replace with drm_getsarea function 2007-04-28 15:07:43 +10:00
Dave Airlie 79aa1d5474 another large overhaul of interactions with userspace...
We need to keep a list of user created fbs to nuke on master exit.
We also need to use the bo properly.
2007-04-17 18:16:38 +10:00
David Airlie cc471a361f i915/drm: clean up a lot of the i915/drm startup/teardown sequences
When the kernel driver is loaded it sets up a lot of stuff..
it tears down the same stuff on unload.

This add a new map type called DRM_DRIVER which means the driver will clean the mapping up
and fix up the map cleaner
2007-04-13 14:51:16 +10:00
Alan Hourihane 9420ab4b41 Merge remote branch 'origin/modesetting-101' into modesetting-101 2007-04-12 15:10:08 +01:00
Dave Airlie 3dd5dc5728 only init at driver load 2007-04-11 14:34:43 +10:00
Jesse Barnes 44a8761302 Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm into origin/modesetting-101
Conflicts:

	linux-core/drm_crtc.c - trivial merge
	linux-core/drm_crtc.h - trivial merge
	linux-core/intel_display.c - crtc_config -> mode_config
	shared-core/i915_dma.c - accommodate new init code in i915_init.c
2007-04-10 10:45:55 -07:00
Jesse Barnes b59285d738 Move i915 init code to new file, i915_init.c, and create a new high level
init routine that runs at driver load time.
2007-04-10 10:31:10 -07:00
David Airlie 40bd6dcd86 set the base address of the CRTC correctly 2007-04-10 15:20:50 +10:00
David Airlie 65f465ed5a fixup numerous issues with adding framebuffer support
This still isn't perfect but it fixes a few oopses and cleans up
some of the tabs and bugs in the original fb limit code
2007-04-10 14:49:49 +10:00
Jakob Bornecrantz b50bda002b add addfb/rmfb ioctls
Originally from Jakob, cleaned up by airlied.
2007-04-10 18:44:47 +10:00
Dave Airlie 46257c51c1 i915: use breadcrumb macro everywhere 2007-04-06 20:21:44 +10:00
Dave Airlie 52f9028c84 Initial import of modesetting for intel driver in DRM 2007-04-05 11:21:06 +10:00
Eric Anholt ddb1715e06 Merge branch 'crestline-qa', adding support for the 965GM chipset. 2007-03-30 13:11:39 -07:00
Dave Airlie 81b811da37 drm/i915: set the bo up at firstopen time not after DMA init
This is required to use TTM to allocate the ring buffer.
2007-03-27 18:01:31 +10:00
Nian Wu ab75d50d6c Merge git://proxy01.pd.intel.com:9419/git/mesa/drm into crestline 2007-03-12 09:03:40 +08:00
Nian Wu df2fc3ec62 Merge git://proxy01.pd.intel.com:9419/git/mesa/drm into crestline 2007-02-25 17:06:13 -08:00
Thomas Hellstrom 7766378d97 Initial support for fence object classes.
(Fence objects belonging to different command submission mechanisms).
2007-02-15 12:11:38 +01:00
Wang Zhenyu 80095ffe01 i915: Add 965GM pci id update 2007-02-13 16:20:45 +08:00
Michel Dänzer d734992e6a i915: Only wait for pending flips before asynchronous flips again. 2007-03-10 00:10:49 +01:00
Michel Dänzer 0741064df4 i915: Do not wait for pending flips on both pipes at the same time.
The MI_WAIT_FOR_EVENT instruction does not support waiting for several events
at once, so this should fix the lockups with page flipping when both pipes are
enabled.
2007-03-09 16:39:13 +01:00
Michel Dänzer a33859184a i915: Eliminate dev_priv->current_page.
Always use dev_priv->sarea_priv->pf_current_page directly. This allows clients
to modify it as well while they hold the HW lock, e.g. in order to sync pages
between pipes.
2007-02-28 17:48:56 +01:00
Michel Dänzer 074e10b384 i915: Only clean up page flipping when the last client goes away, not any one. 2007-02-28 15:57:08 +01:00
Michel Dänzer 1cdc1b6fba i915: Don't emit waits for pending flips before emitting synchronous flips.
The assumption is that synchronous flips are not isolated usually, and waiting
for all of them could result in stalling the pipeline for long periods of time.

Also use i915_emit_mi_flush() instead of an old-fashioned way to achieve the
same effect.
2007-02-28 15:23:19 +01:00
Michel Dänzer 1a0d890a42 i915: Add support for scheduled buffer swaps to be done as flips.
Unfortunately, emitting asynchronous flips during vertical blank results in
tearing. So we have to wait for the previous vertical blank and emit a
synchronous flip.
2007-02-22 17:21:18 +01:00
Michel Dänzer 6f89584e13 i915: Improved page flipping support, including triple buffering.
Pages are tracked independently on each pipe.

Bump the minor version for 3D clients to know page flipping is usable, and
bump driver date.
2007-02-19 15:08:40 +01:00
Michel Dänzer 34aa3393d0 i915: Page flipping enhancements.
Leave it to the client to wait for the flip to complete when necessary,
but wait for a previous flip to complete before emitting another one. This
should help avoid unnecessary stalling of the ring due to pending flips.

Call i915_do_cleanup_pageflip() unconditionally in preclose.
2007-02-19 15:08:40 +01:00
Michel Dänzer 078e430726 i915: Unify breadcrumb emission. 2007-02-19 15:08:40 +01:00
Eric Anholt 898aca1a66 Warning fix: correct type of i915_mmio argument. 2007-02-07 21:26:02 -08:00
Haihao Xiang 9d3deddc4a Delay for a usec while spinning waiting for ring buffer space.
This means the loop will wait up to ~10ms for ring buffer space to become
available, rather than just however long it takes to check the space 10000
times.  This matches other drivers' behavior when waiting for ring buffer/fifo
space.
2007-01-12 11:24:50 -08:00
Zou Nan hai f7180349fd i915: ARB_Occlusion_query(MMIO ioctl) support.
This adds a new ioctl for passing counter information from the chip back to
applications, these counters include the data needed to perform OC.
2007-01-06 16:22:08 -08:00
Dave Airlie 7458909bea fixup i915 return values from kernel 2006-12-19 21:48:18 +11:00
Thomas Hellstrom e22b04f807 Merging drm-ttm-0-2-branch
Conflicts:

	linux-core/drmP.h
	linux-core/drm_drv.c
	linux-core/drm_irq.c
	linux-core/drm_stub.c
	shared-core/drm.h
	shared-core/i915_drv.h
	shared-core/i915_irq.c
2006-10-18 17:33:19 +02:00
Thomas Hellstrom 5881ce1b91 Extend generality for more memory types.
Fix up init and destruction code.
2006-10-17 11:05:37 +02:00
Michel Dänzer da75d59cd6 i915: Add ioctl for scheduling buffer swaps at vertical blanks.
This uses the core facility to schedule a driver callback that will be called
ASAP after the given vertical blank interrupt with the HW lock held.
(cherry picked from 257771fa29 commit)
2006-09-29 12:55:08 +02:00
Michel Dänzer 257771fa29 i915: Add ioctl for scheduling buffer swaps at vertical blanks.
This uses the core facility to schedule a driver callback that will be called
ASAP after the given vertical blank interrupt with the HW lock held.
2006-09-28 15:41:36 +02:00
Eric Anholt 55057660f0 Put the PCI device/vendor id in the drm_device_t.
This helps us unbreak FreeBSD DRM from the 965 changes.
2006-09-06 23:25:14 -07:00
Thomas Hellstrom 44f6d08988 Validation and fencing. 2006-08-31 21:42:29 +02:00