Commit Graph

190 Commits (0fbee62ec14d08714dbc558dd20cc00b9a79c042)

Author SHA1 Message Date
Jesse Barnes 5433bbbfde Remove buffer object user list check in drm_bo_destroy_unlocked
In the case of driver allocated buffers, there won't necessarily be a user list
associated with the buffer, so don't bug out on an empty list.
2007-09-25 16:15:48 -07:00
Thomas Hellstrom c4b3a0f602 Merge branch 'master' into pre-superioctl-branch
Conflicts:

	linux-core/drm_bo.c
	linux-core/drm_fence.c
	linux-core/drm_objects.h
	shared-core/drm.h
2007-09-25 18:03:31 +02:00
Dave Airlie bb5516f4f4 drm/ttm: fixup fence class naming and interfaces
This is some code for nouveau that Ben Skeggs worked on, and also
fixes the naming (having class in a system header file == C++ keyword == bad plan)
2007-09-25 16:17:17 +10: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
Thomas Hellstrom 54df1b9ff3 Fix pinned buffer fence class. 2007-09-22 14:30:55 +02:00
Thomas Hellstrom 0774090d5b Fix drm_bo.c compiling. 2007-09-22 13:59:56 +02:00
Thomas Hellstrom da63f4ba0f Add fence error member.
Modify the TTM backend bind arguments.
Export a number of functions needed for driver-specific super-ioctls.
Add a function to map buffer objects from the kernel, regardless of where they're
currently placed.
A number of error fixes.
2007-09-22 13:57:13 +02:00
Eric Anholt 0055fd5c35 Merge branch 'master' into bo-set-pin 2007-08-16 09:23:09 -07:00
Ben Skeggs 92084c6e05 Export some useful ttm functions to drivers. 2007-08-06 22:11:18 +10:00
Eric Anholt 3a0bc518e3 Remove the pinned buffer from the LRU when pinning.
Also, be a little safer with setting the pinned flag within the struct lock.
I'm not 100% sure if this is required, but it seems like it might be.
2007-08-02 14:08:04 -07:00
Eric Anholt cf4f1a85af Add a couple of doxygen comments from reading the code. 2007-08-02 13:51:55 -07:00
Eric Anholt f9c27aa50b Copy the important parts of object_validate into object_create().
This should let us allocate buffers without holding the hardware lock.

While here, add DRM_DEBUG info for the drm_bo ioctls, so you can see something
more specific than just the cmd value per ioctl.
2007-07-26 11:18:27 -07:00
Eric Anholt cf2d569dac Replace NO_MOVE/NO_EVICT flags to buffer objects with an ioctl to set pinning.
This cleans up the create/validate interfaces for this very uncommon path, and
makes pinned object creation much easier to use for the X Server.
2007-07-26 10:15:11 -07:00
Dave Airlie 4175dd8181 drm/bo: set the req pointer for each buffer to validate 2007-07-26 15:26:36 +10:00
Dave Airlie e2d00715cc drm: fix size argument for copy to/from user 2007-07-26 13:26:04 +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
Dave Airlie 6ad1df2176 drm: remove drm_u64_t, replace with uint64_t everwhere
This might break something, stdint.h inclusion in drm.h maybe required
but I'm not sure yet what platforms have it what ones don't.
2007-07-18 09:42:06 +10:00
Dave Airlie 191c062933 drm: remove drm_ref_t 2007-07-16 13:45:39 +10:00
Dave Airlie be85ad0333 drm: detypedef ttm/bo/fence code 2007-07-16 13:37:02 +10:00
Dave Airlie 6dce9e0735 drm: remove hashtab/sman and object typedefs 2007-07-16 12:48:44 +10:00
Dave Airlie 21ee6fbfb8 drm: remove drmP.h internal typedefs 2007-07-16 12:32:51 +10:00
Dave Airlie 1a07256d60 drm: remove ttm userspace typedefs 2007-07-16 11:30:53 +10:00
Dave Airlie 2c9e05cf4c Merge branch 'master' into cleanup
Conflicts:

	libdrm/xf86drm.c
	linux-core/drm_bo.c
	linux-core/drm_fence.c
2007-07-11 11:23:41 +10: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
Thomas Hellstrom 00f1a66f22 Fence object reference / dereference cleanup.
Buffer object dereference cleanup.
Add a struct drm_device member to fence objects:
This can simplify code, particularly in drivers.
2007-06-29 12:58:45 +02:00
Thomas Hellstrom 3ee31a1f35 Indentation fixes. 2007-06-15 10:31:32 +02:00
Thomas Hellstrom d34b2c7b9e Fix refcounting / lock race.
Reported by Steve Wilkins / Michel Dnzer.
2007-06-15 10:26:51 +02:00
Thomas Hellstrom e1b8eabeee Locking fixes and instrumentation. 2007-06-15 10:26:51 +02:00
Thomas Hellstrom 62082ab3e6 Make sure we read fence->signaled while spinlocked. 2007-06-13 15:38:59 +02:00
Thomas Hellstrom 5156f1c897 Fix fence object deref race. 2007-06-13 15:19:30 +02:00
Thomas Hellstrom f984b1b8d1 Fix some obvious bugs. 2007-06-12 12:30:33 +02:00
Thomas Hellstrom b6b5df24b9 Try to make buffer object / fence object ioctl args 64-bit safe.
Introduce tile members for future tiled buffer support.
Allow user-space to explicitly define a fence-class.
Remove the implicit fence-class mechanism.
64-bit wide buffer object flag member.
2007-06-12 12:21:38 +02:00
Dave Airlie 58b2ed7832 Revert "drm/ttm: cleanup mm_ioctl ioctls to be separate ioctls."
This reverts commit 3fdef0dc20.

ditto not on master yet
2007-05-26 03:48:08 +10:00
Dave Airlie 3fdef0dc20 drm/ttm: cleanup mm_ioctl ioctls to be separate ioctls.
This is the first bunch of ioctls
2007-05-26 03:32:34 +10: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
Dave Airlie b2a875ba89 ttm: complete drm buffer object ioctl split
retain the op operation for validate/fence operations
2007-05-08 18:25:15 +10:00
Dave Airlie 25c51f539f drm/ttm: ioctl cleanup for buffer object - user side only
This just cleans up the xf86drm.c to what I want and drm.h,
I need to fix up the kernel internals to suit these changes now.

I've moved to using struct instead of typedefs for the bo and it doesn't look
that bad so I'll do the same thing for mm and fence..
2007-05-08 17:53:58 +10:00
Dave Airlie ee8954cb53 drm/ttm: cleanup mm_ioctl ioctls to be separate ioctls.
This is the first bunch of ioctls
2007-05-06 11:17:30 +10:00
Jesse Barnes 71d44cda52 drm/ttm: allow drm_buffer_object_create to be used in-kernel 2007-04-26 16:09:24 +10:00
Jesse Barnes 3c384a9ad5 Add new buffer object type for kernel allocations that don't initially have a user mapping.
(cherry picked from commit 2e21779992)
2007-04-26 16:04:09 +10:00
Dave Airlie e46e028bd2 Merge branch 'origin' into modesetting-101
Conflicts:

	linux-core/drm_bo.c

Merge in changes from master from Thomas fixiing TTM problems
2007-04-18 14:11:49 +10:00
Thomas Hellstrom 5a96d59ce9 Don't always free up memory space when we unpin buffers. 2007-04-17 14:15:37 +02:00
Thomas Hellstrom 5432cc4abf Fix buffer object reference problems.
(Reported by Dave Airlie).
2007-04-17 10:53:19 +02:00
Dave Airlie 1a5e647f63 I don't think this dec is necessary and my stuff all works without ..
with it everything falls over
2007-04-17 18:18:42 +10:00
Dave Airlie 56ef1ab8ac add some missing export symbols 2007-04-17 18:18:25 +10:00
Thomas Hellstrom e91ceff6c9 Add a code comment. 2007-04-17 08:46:45 +02:00
Thomas Hellstrom e6e4946c82 Require the hardware lock for buffer creation
(since that implies a validate).
Fix drm_bo_wait_unfenced error messages and codes.
Fix some return codes from libdrm.
2007-04-16 16:23:05 +02:00
David Airlie 27598bacfd export drm_bo_driver_finish symbol 2007-04-13 14:50:31 +10:00
Jesse Barnes 2e21779992 Add new buffer object type for kernel allocations that don't initially have a user mapping. 2007-04-11 12:51:52 -07:00
Jesse Barnes 78598fdaa8 Various changes for in-kernel modesetting:
- allow drm_buffer_object_create to be called w/o dev_mapping
  - fixup i915 init code to allocate memory, fb and set modes right
  - pass fb to drm_initial_config for setup
  - change some debug output to make it easier to spot
  - fixup lvds code to use DDC probing correctly
2007-04-11 07:07:54 -07:00
Thomas Hellstrom 7743af9449 Evicted no-move buffers can get lost if they end up in another
memory type than local.
2007-04-03 10:29:14 +02:00
Thomas Hellstrom d85e243259 Fix an oops when trying to clean a not yet initialized memory type. 2007-04-03 10:29:14 +02:00
Dave Airlie 3f70518f0b drm/bo: avoid oops if the memory manager for this type isn't initialised 2007-03-29 09:25:04 +10:00
Dave Airlie 2463b03cb4 whitespace cleanup pending a kernel merge 2007-03-19 08:23:43 +11:00
Thomas Hellstrom e0f53e59be Simple fence object sample driver for via, based on idling the GPU.
Buffer object driver for via.
Some changes to buffer object driver callbacks.
Improve fence flushing.
2007-02-16 20:22:24 +01: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
Thomas Hellstrom 9efdae317c More bugfixes.
Fixed memory, pinned buffers and unmappable memory now seems
fully functional.
2007-02-13 20:05:32 +01:00
Thomas Hellstrom 398913dc0e Lindent. 2007-02-12 20:34:50 +01:00
Thomas Hellstrom b0c5339ed6 More bugfixes. 2007-02-12 20:32:03 +01:00
Thomas Hellstrom f02f83ee08 Cleanup and fix support for pinned buffers. 2007-02-12 17:47:57 +01:00
Thomas Hellstrom 85ee2a8d04 Various bugfixes. 2007-02-10 12:06:36 +01:00
Thomas Hellstrom 57df398072 Reinstate some LRU handling. 2007-02-09 12:43:18 +01:00
Thomas Hellstrom d32b21e016 Remove some code that should have gone in
commit 6a49d9a8ab
2007-02-09 00:11:53 +01:00
Thomas Hellstrom 99acdaee48 Fix copyright statements. 2007-02-09 00:07:29 +01:00
Thomas Hellstrom 6a49d9a8ab Fix evict_mutex locking range.
Implement unmappable buffers. (fault moves them to mappable when needed).
Various bugfixes.
2007-02-09 00:02:02 +01:00
Thomas Hellstrom b2bcbf874b Add an accelerated buffer copy cleanup helper.
Export helper functions and make some important buffer-object functions non-static.
Add an i915 accelerated blit buffer move for pci memory buffers.
2007-02-08 21:28:33 +01:00
Thomas Hellstrom a0ed808d05 Don't create a ttm just to copy from. 2007-02-08 19:06:39 +01:00
Thomas Hellstrom e4b2da4406 A minor function interface change and some memcpy bugfixing.
Hooray!! it sort of works with a fixed AGP area as faked VRAM.
2007-02-08 16:21:38 +01:00
Thomas Hellstrom 1257907fa9 Simplify external ttm page allocation.
Implement a memcpy fallback for copying between buffers.
2007-02-08 13:29:08 +01:00
Thomas Hellstrom 09984ad77b Update memory compatibility tests.
Now only pinned buffers are broken.
2007-02-08 11:55:24 +01:00
Thomas Hellstrom c1fbd8a566 Checkpoint commit.
Flag handling and memory type selection cleanup.
glxgears won't start.
2007-02-07 17:25:13 +01:00
Thomas Hellstrom af24465b2e Fix a stray unlock_kernel() in drm_vm.c
Add a file for memory move helpers, drm_bo_move.c
Implement generic memory move.
Cached, no_move and unmapped memory temporarily broken.
2007-02-07 12:52:23 +01:00
Thomas Hellstrom 71b9e876f9 Simplify pci map vs no pci map choice. 2007-02-06 16:59:45 +01:00
Thomas Hellstrom 40ce53dfde Implement a drm_mem_reg_t substructure in the buffer object type. 2007-02-06 15:56:43 +01:00
Thomas Hellstrom 609e3b0375 Implement a policy for selecting memory types. 2007-02-06 14:20:33 +01:00
Thomas Hellstrom 63f2abd721 Make also later kernels work with buffer object vm
and clean up some function names.
2007-02-02 19:49:11 +01:00
Thomas Hellstrom c269d560e4 Make vm handle buffer objects instead of ttm objects.
Remove ttm objects.
Make vm aware of PCI memory type buffer objects.
(Only works for pre 2.6.16 kernels for now).
2007-02-02 14:47:44 +01:00
Thomas Hellstrom 3024f23c65 memory manager: Make device driver aware of different memory types.
Memory types are either fixed (on-card or pre-bound AGP) or not fixed
(dynamically bound) to an aperture. They also carry information about:

1) Whether they can be mapped cached.
2) Whether they are at all mappable.
3) Whether they need an ioremap to be accessible from kernel space.

In this way VRAM memory and, for example, pre-bound AGP appear
identical to the memory manager.

This also makes support for unmappable VRAM simple to implement.
2007-01-31 14:50:57 +01:00
Thomas Hellstrom 36d50687dd Fix an error-path oops. 2007-01-31 11:03:53 +01:00
Thomas Hellstrom d399fcf46f Add a buffer object transfer function.
Creates a placeholder for the old buffer contents
when it is transfered to / from static memory like VRAM.
2007-01-30 16:20:23 +01:00
Thomas Hellstrom 9bbdc0fb10 Clean up buffer object destruction somewhat. 2007-01-30 12:35:49 +01:00
Thomas Hellstrom 9a654e71bd Use pre-defined list_splice function. 2007-01-29 13:37:02 +01:00
Thomas Hellstrom 45418bb1b1 s/buf/bo/ for consistency. 2007-01-29 13:37:02 +01:00
Thomas Hellstrom 1e4c7d69f5 Some cleanup. A buffer object should only have one active memory type. 2007-01-29 13:37:02 +01:00
Dave Airlie 2dcbf6a599 make build against 2.6.20 hopefully 2007-01-01 11:30:38 +11:00
Thomas Hellstrom f6d5fecdd2 Last minute changes to support multi-page size buffer offset alignments.
This will come in very handy for tiled buffers on intel hardware.
Also add some padding to interface structures to allow future binary backwards
compatible changes.
2006-10-27 11:28:37 +02:00
Thomas Hellstrom e8ba62db72 Make sure delayed delete list is empty on lastclose.
Fix some refcounting errors.
Fix some error messages.
2006-10-19 16:58:00 +02:00
Thomas Hellstrom c34faf224b Remove max number of locked pages check and call, since
that is now handled by the memory accounting.
2006-10-17 20:03:26 +02:00
Thomas Hellstrom 89b9441798 Lindent. 2006-10-17 19:57:06 +02:00
Thomas Hellstrom d515936ea7 Add memory usage accounting to avoid DOS problems. 2006-10-17 19:40:57 +02:00
Thomas Hellstrom 5443dbe35f Implement mm_lock and mm_unlock functions.
The mm_lock function is used when leaving vt. It evicts _all_ buffers.
Buffers with the DRM_BO_NO_MOVE attribute set will be guaranteed to
get the same offset when / if they are rebound.
2006-10-17 16:00:25 +02:00
Thomas Hellstrom db5c671e86 Remove the memory manager parameter from the put_block function, as this
makes the client code a lot cleaner. Prepare buffer manager for lock and
unlock calls.
2006-10-17 11:28:48 +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
Thomas Hellstrom 540c64c378 Bugfixes. 2006-10-12 16:10:47 +02:00
Thomas Hellstrom 10150df02b Simplify the AGP backend interface somewhat.
Fix buffer bound caching policy changing, Allow
on-the-fly changing of caching policy on bound buffers if the hardware
supports it.

Allow drivers to use driver-specific AGP memory types for TTM AGP pages.
Will make AGP drivers much easier to migrate.
2006-10-12 12:09:16 +02:00
Thomas Hellstrom 3070389367 Compatibility code for 2.6.15-2.6.18. It is ugly but a little comfort is that
it will go away in the mainstream kernel.
Some bugfixes, mainly in error paths.
2006-10-11 22:21:01 +02:00
Thomas Hellstrom f2db76e2f2 Big update:
Adapt for new functions in the 2.6.19 kernel.
Remove the ability to have multiple regions in one TTM.
   This simplifies a lot of code.
Remove the ability to access TTMs from user space.
   We don't need it anymore without ttm regions.
Don't change caching policy for evicted buffers. Instead change it only
   when the buffer is accessed by the CPU (on the first page fault).
   This tremendously speeds up eviction rates.
Current code is safe for kernels <= 2.6.14.
Should also be OK with 2.6.19 and above.
2006-10-11 13:40:35 +02:00
Thomas Hellstrom 3802f9adbf Fix buffer manager takedown error.
Prepare for the possibility to evict all buffers from vram / agp.
This will be used by the X server when, for example, switching vts.
2006-09-29 11:15:59 +02:00
Thomas Hellstrom f2c03ecae6 Fix racy buffer object destruction. 2006-09-27 19:07:55 +02:00