Commit Graph

71 Commits (18f2fcf5aa299fe3b7b56af37e7eefe78c921f61)

Author SHA1 Message Date
Eric Anholt 709b82e1a5 intel: Clear ioctl parameter outvalues and pads that confuse valgrind.
The minor CPU cost here is probably outweighed by bothering us with noise in
the tool.
2009-02-15 18:35:03 -08:00
Eric Anholt cbdd6272c0 intel: don't count fences on 965 and later, as they don't use them. 2009-01-27 17:24:49 -08:00
Eric Anholt 9209c9a653 intel: Fix under-counting of fences registers required in check_aperture. 2009-01-27 17:24:41 -08:00
Jesse Barnes 2fa5f28eee intel: libdrm support for fence management in execbuf
This patch tries to use the available fence count to figure out whether a
given batch can succeed or not (just like the aperture check).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-01-27 17:23:42 -08:00
Eric Anholt 02445eab64 intel: Retry pin ioctl on -EINTR. 2009-01-14 16:12:08 -08:00
Owain G. Ainsworth 65b90fb377 Don't use DRM_BO_FLAG_NO_MOVE in bufmgr fake. It's a ttm flag.
It's also unused, so worthless.
2009-01-13 17:18:43 -08:00
Keith Packard 18f091d136 intel: Cache tiling/swizzle state in user mode. Reset tiling on reuse.
Remember tiling mode values provided by appplications, and
record tiling mode when creating a buffer from another application. This
eliminates any need to ask the kernel for tiling values and also makes
reused buffers get the right tiling.

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-12-17 10:29:15 -08:00
Keith Packard 40334c6410 intel: Debug output %u vs uint64_t warning fix
Signed-off-by: Keith Packard <keithp@keithp.com>
2008-12-17 10:28:25 -08:00
Keith Packard bd14b2cf75 intel: return error status from drm_intel_gem_bo_map
Applications may actually care if the mapping operation failed, so when
it happens, return an error indication. errno is probably trashed by
fprintf though.

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-12-17 10:28:25 -08:00
Keith Packard b13f4e1a32 intel: Dump out memory usage information when the kernel fails to pin
The execbuffer ioctl returns ENOMEM when it fails to pin all of the buffers
in the GTT. This is usually caused by the DRM client attempting to use too
much memory in a single request. Dumping out the requested and available
memory values should help point out failures in the DRM code to catch over
commitments of this form.

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-12-17 10:28:25 -08:00
Jesse Barnes 731cd5526e libdrm: add mode setting files
Add mode setting files to libdrm, including xf86drmMode.* and the new
drm_mode.h header.  Also add a couple of tests to sanity check the
kernel interfaces and update code to support them.
2008-12-17 10:11:37 -08:00
Eric Anholt c86d431fe6 intel: don't skip set_domain on mapping of shared buffers. 2008-12-14 16:50:02 -08:00
Eric Anholt cebbd2edb5 intel: don't let named buffers into the BO cache.
We wouldn't want some remaining 3D rendering to scribble on our batchbuffer.
2008-12-14 16:50:02 -08:00
Eric Anholt 782316801b intel: Remove the mapped flag, which is adequately covered by bo_gem->virtual. 2008-12-14 16:50:02 -08:00
Jesse Barnes 9583c099b4 Revert "Merge branch 'modesetting-gem'"
This reverts commit 6656db1055.

We really just want the libdrm and ioctl bits, not all the driver
stuff.
2008-12-10 15:50:22 -08:00
Jesse Barnes 12e68f8059 Merge branch 'master' into modesetting-gem 2008-12-03 11:54:07 -08:00
Eric Anholt 6fb1ad767d intel: Add a function for setting (GTT,GTT) domain, for use by UXA.
This function can also serve the role that the bo_wait_rendering did, when
write_enable is unset.
2008-12-02 12:19:34 -08:00
Jesse Barnes 60c1e3a09e libdrm_intel: fix merge error
don't take the lock twice
2008-11-19 10:56:48 -08:00
Jesse Barnes 965b4d662a Merge branch 'master' into modesetting-gem
Conflicts:

	libdrm/Makefile.am
	libdrm/intel/intel_bufmgr.h
	libdrm/intel/intel_bufmgr_fake.c
	libdrm/intel/intel_bufmgr_gem.c
	shared-core/drm.h
	shared-core/i915_dma.c
	shared-core/i915_irq.c
	shared-core/radeon_cp.c
	shared-core/radeon_drv.h
2008-11-13 15:30:06 -08:00
Jesse Barnes 7e27b3ba88 libdrm_intel: fix warnings on 64 bit
Cast a couple of %llx args to unsigned long long.
2008-11-13 13:58:32 -08:00
Jesse Barnes 276c07d885 libdrm: add support for i915 GTT mapping ioctl
Add a drm_intel_gem_bo_map_gtt() function for mapping a buffer object
through the aperture rather than directly to its CPU cacheable memory.
2008-11-13 13:52:04 -08:00
Eric Anholt 930c0e7cf4 intel: Restart on interrupt of bo_wait_rendering instead of complaining. 2008-11-07 12:59:43 -08:00
Eric Anholt 4b9826408f intel: Rename dri_ and intel_ symbols to drm_intel_.
I wanted to avoid doing this, as it's a bunch of churn, but there was a
conflict between the dri_ symbols in libdrm and the symbols that were in
Mesa in 7.2, which broke Mesa 7.2 AIGLX when the 2D driver had loaded new
libdrm symbols.  The new naming was recommended by cworth for giving the
code a unique prefix identifying where the code lives.

Additionally, take the opportunity to fix up two API mistakes: emit_reloc's
arguments were in a nonsensical order, and set_tiling lacked the stride
argument that the kernel will want to use soon.  API compatibility with
released code is maintained using #defines.
2008-10-30 11:29:40 -07:00
Eric Anholt 0e86731232 intel: Add dri_bufmgr_check_aperture support for bufmgr_gem.
This relies on a new kernel ioctl to get the available aperture size.

In order to provide reasonable performance from dri_bufmgr_check_aperture, we
now require that once a buffer has been used as the target of a relocation,
it gets no further relocations added to it.  This cuts the cost of
check_aperture from 10% to 1% in the 3D driver with no code changes, but
slightly complicates our plans for the 2D driver.
2008-10-28 14:27:49 -07:00
Xiang, Haihao b7d54b1dba intel: Also total child_size of the target_bos. Partial fix #17964. 2008-10-24 16:41:54 +08:00
Keith Packard a59ea02ff8 intel: ioctl is not defined to return -errno
Don't count on ioctl returning -errno; use errno directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2008-10-16 23:54:19 -07:00
Dave Airlie 4c8aeb6fc7 link libdrm_intel properly
libdrm_intel needs symbols from libdrm, so link against it.
(cherry picked from commit d9c2f65dd8)

Conflicts:

	libdrm/Makefile.am
2008-10-17 06:40:38 +10:00
Eric Anholt 6df7b0719f intel: Protect bufmgr objects with a pthread mutex.
We want to be able to use the bufmgr from multiple threads for GL, and thus
we need to protect the internal structures.

The pthread-stubs package is used so that programs not linked against
pthreads get weak symbols to stubs and don't eat most of the cost.
2008-10-17 06:38:57 +10:00
Xiang, Haihao 769197c8f1 intel: avoid deadlock in intel_bufmgr_fake. 2008-10-16 10:37:30 +08:00
Eric Anholt 458e2d5bc5 intel: Fix compile warning. 2008-10-14 13:33:38 -07:00
Eric Anholt 993383873c intel: Add interface for getting tiling mode of a bo. 2008-10-14 13:23:04 -07:00
Julien Cristau d9c2f65dd8 link libdrm_intel properly
libdrm_intel needs symbols from libdrm, so link against it.
2008-10-13 16:39:33 -07:00
Eric Anholt 3e03d781f7 intel: Avoid pthread mutex recursion in bufmgr_fake.
Bug #18035. Fixes deadlock in glean texCube testcase.
2008-10-13 13:41:10 -07:00
Keith Packard 94c88c151c Manage fences in user-mode bufmgr_fake to clean buffers
When using bufmgr_fake without DRM, the X server idles the ring whenever it
wants to wait for something to complete (brutal, but effective). In this
case, bufmgr_fake must treat the pending fence as having passed. However, it
wasn't recording the fences as it emitted them, nor cleaning buffers as they
passed.

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-10-09 18:25:58 -07:00
Eric Anholt 3169d9639b intel: Protect bufmgr objects with a pthread mutex.
We want to be able to use the bufmgr from multiple threads for GL, and thus
we need to protect the internal structures.

The pthread-stubs package is used so that programs not linked against
pthreads get weak symbols to stubs and don't eat most of the cost.
2008-10-09 12:57:09 -07:00
Xiang, Haihao 604759d4a7 intel: fix for write_domain and static BOs.
http://bugs.freedesktop.org/show_bug.cgi?id=17705
2008-10-09 11:59:29 +08:00
Jesse Barnes af2323b4b3 intel bufmgr: reinstate buffer handle tracking
We need a way of getting at the underlying handle for use with mode
setting.  We can either export it in the dri_bo object or provide a new
callback to get it.
2008-09-30 16:35:53 -07:00
Dave Airlie 972f657265 Merge remote branch 'origin/master' into modesetting-gem
Conflicts:

	libdrm/Makefile.am
	libdrm/dri_bufmgr.h
	linux-core/drm_irq.c
	linux-core/drm_sysfs.c
	linux-core/drm_ttm.c
	shared-core/i915_dma.c
	shared-core/i915_irq.c
	shared-core/nouveau_drv.h
	shared-core/radeon_cp.c
2008-09-30 14:13:49 +10:00
Xiang, Haihao 073cb5ee1d intel: Copy data from card memory back to backing store when mapping.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=17705
2008-09-27 11:01:24 +08:00
Eric Anholt 2db8e0c8ef intel: Allow up to 15 seconds chewing on one buffer before acknowledging -EBUSY.
The gltestperf demo in some cases took over seven seconds to make it through
one batchbuffer on a GM965.

Bug #17004.
2008-09-23 17:10:04 -07:00
Eric Anholt 0dccf017ab intel: Replace wraparound test logic in bufmgr_fake. Again.
I'd swapped the operands, so if we weren't in lockstep with the hardware we
said the sequence was always passed.  Additionally, a race was available that
we might have failed at recovering from.  Instead, I've replaced the logic
with new stuff that should be more robust and not rely on all the parties in
userland following the same IRQ_EMIT() == 1 protocol.  Also, in a radical
departure from past efforts, include a long comment describing the failure
modes and how we're working around them.

Thanks to haihao for catching the original issue.
2008-09-23 17:10:04 -07:00
Eric Anholt 1b3abe62b5 intel: Do strerror on errno, not on the -1 return value from ioctl. 2008-09-23 17:10:04 -07:00
Xiang, Haihao 3949f3c9ea intel: Fix driver-supplied argument to exec function (fd.o bug #17653). 2008-09-22 10:16:19 +08:00
Eric Anholt 368b392e6d intel: don't forget to include config.h in bufmgr code.
Thanks to airlied for catching this.
2008-09-10 14:07:19 -07:00
Eric Anholt f9d98beefc intel: move drm calls to exec buffers to libdrm_intel.
This avoids duplicating the effort in 3 places.  Also, added emit/wait fence
callbacks back in bufmgr_fake since we need it for non-drm 2d.  Sigh.
2008-09-10 14:07:18 -07:00
Eric Anholt 869d8bebed intel: Move IRQ emit/wait from callbacks into the bufmgr.
In the process, work around the glaring bugs of the kernel irq wait function.
2008-09-10 14:07:18 -07:00
Eric Anholt 738e36acbc Move intel libdrm stuff to libdrm_intel.so
dri_bufmgr.h is replaced by intel_bufmgr.h, and several functions are renamed,
though the structures and many functions remain dri_bufmgr_* and dri_bo_*
2008-09-10 14:07:18 -07:00
Kristian Høgsberg 0239594fc3 [intel_bufmgr_gem] Remember global name when creating buffer from name. 2008-08-26 14:28:25 -04:00
Dave Airlie 2d4420c666 Merge branch 'radeon-gem-cs' into modesetting-gem
Conflicts:

	libdrm/xf86drm.c
	linux-core/Makefile.kernel
	linux-core/drmP.h
	linux-core/drm_compat.h
	linux-core/drm_drv.c
	linux-core/drm_stub.c
	linux-core/drm_vm.c
	shared-core/i915_dma.c
	shared-core/r300_cmdbuf.c
	shared-core/radeon_drv.h
2008-08-14 09:36:34 +10:00
Jesse Barnes 2f03ba4aad Merge branch 'master' into modesetting-gem
Conflicts:

	libdrm/Makefile.am
	libdrm/xf86drm.h
	shared-core/i915_dma.c
	shared-core/i915_irq.c
2008-08-13 10:08:02 -07:00