Commit Graph

1381 Commits (74cf1f91be7f4139601624af0343e3d411190dec)

Author SHA1 Message Date
Thomas Hellstrom cf2d1bba55 Remove the clean_unfenced function.
Change the restriction that non-creators can't change the buffer flags to
non-creators can't change EVICT and NO_MOVE flags.
2007-10-19 16:24:36 +02:00
Thomas Hellstrom bb29ba7fa7 Only allow creator to change shared buffer mask. 2007-10-17 10:59:48 +02:00
Thomas Hellstrom 086c058a41 Remove the op ioctl, and replace it with a setuser ioctl.
Remove need for lock for now.
May create races when we clean memory areas or on takedown.
Needs to be fixed.
Really do a validate on buffer creation in order to avoid problems with
fixed memory buffers.
2007-10-17 10:59:48 +02:00
Thomas Hellstrom 0d1926d36e Revert "Replace NO_MOVE/NO_EVICT flags to buffer objects with an ioctl to set pinning."
This reverts cf2d569dac commit.
2007-10-17 10:59:48 +02:00
Thomas Hellstrom cd276d9cab Revert "Copy the important parts of object_validate into object_create()."
This reverts f9c27aa50b commit.
2007-10-17 10:59:48 +02:00
Thomas Hellstrom 12b989a710 Revert "Remove the pinned buffer from the LRU when pinning."
This reverts 3a0bc518e3 commit.
2007-10-17 10:59:48 +02:00
Michel Dänzer db1709f2f3 Revert part of earlier commit that caused an unresolved symbol for i915. 2007-10-16 15:10:22 +02:00
Kristian Høgsberg a69c85fec8 Drop destroy ioctls for fences and buffer objects.
We now always create a drm_ref_object for user objects and this is then the only
things that holds a reference to the user object.  This way unreference on will
destroy the user object when the last drm_ref_object goes way.
2007-10-16 22:03:05 +11:00
Kristian Høgsberg dccefba71a Take bo type argument out of the ioctl interface.
The buffer object type is still tracked internally, but it is no longer
part of the user space visible ioctl interface.  If the bo create ioctl
specifies a non-NULL buffer address we assume drm_bo_type_user,
otherwise drm_bo_type_dc.  Kernel side allocations call
drm_buffer_object_create() directly and can still specify drm_bo_type_kernel.
Not 100% this makes sense either, but with this patch, the buffer type
is no longer exported and we can clean up the internals later on.
2007-10-16 22:03:05 +11:00
[utf-8] Kristian Høgsberg 440fc5113e Eliminate support for fake buffers. 2007-10-16 21:59:38 +11:00
Arthur Huillet 9d779e2c88 nouveau: mandatory "oops I forgot half of the files" commit 2007-10-12 22:40:08 +02:00
Dave Airlie 604f02ff61 i915: check mask instead of flags for buffer fence types 2007-10-12 09:46:11 +10:00
Ian Romanick fc7d4d19d3 Eliminate trailing whitespace from last commit. 2007-10-10 15:27:07 -07:00
Ian Romanick 83da774b19 Fix command list submission on big-endian. 2007-10-10 15:25:47 -07:00
Thomas Hellstrom d4680333dc Only add native-type on EXE signals. Otherwise flush flags may
get out of sync.
2007-10-10 09:31:51 +02:00
Dave Airlie 19b7cc3444 Merge branch 'pre-superioctl-branch' 2007-10-05 12:11:43 +10:00
Maarten Maathuis b510517d59 nouveau: Switch over to using PMC_BOOT_0 for card detection. 2007-10-04 09:31:46 +02:00
Maarten Maathuis 5ca12104f8 linux-drm: Obey device class requirements when detecting devices. 2007-10-04 09:24:48 +02:00
Dave Airlie 495bbbaadc drm: fix page count calculation
Also no need to do pre-populate work on single page
2007-10-04 16:13:22 +10:00
Ian Romanick 0379919e99 Use 'ifdef __BIG_ENDIAN' instead of 'if __BIG_ENDIAN' 2007-10-03 14:12:16 -07:00
Ian Romanick 7f99fd5d7a First round of byte-ordering fixes for PowerPC.
This isn't 100% as command submission via PCI-e GART buffers doesn't work.
I've hacked around that for the time being.  This is essentially the code
that was used at the POWER.org event to show Bimini.
2007-10-03 14:08:29 -07:00
Dave Airlie b0473699ed ttm: returning into dummy causes a buffer object leak
as nobody ever derefs dummy, however not returning does the deref
correctly.
2007-10-02 15:48:28 +10:00
Pekka Paalanen aa135ba8e8 nouveau: rename nv30_graph.c to nv20_graph.c 2007-09-30 22:16:01 +03:00
Pekka Paalanen 205403aea8 nouveau: nv30 graph function renames, removed nv20_graph.c
All nv30 functions in nv30_graph.c that can be used on nv20 are renamed
as accordingly. nv20 specific parts from nv20_graph.c are moved into
nv30_graph.c.
2007-09-30 22:16:01 +03:00
Michel Dänzer 215eab6ccf Don't build without any optimization on Linux.
Building without optimization causes the drm module not to link correctly on
ppc.
2007-09-29 18:07:55 +02:00
Keith Packard 24cdd2f8c4 Allow parallel module compile 2007-09-26 14:25:13 -07:00
Alan Hourihane b44925b2a5 Add brackets 2007-09-26 16:18:19 +01:00
Alan Hourihane 6671ad1917 don't copy back if an error was returned. 2007-09-26 15:38:54 +01: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
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 bea727b838 Make nouveau compile on older kernels. 2007-09-22 13:57:21 +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 24e33627c5 Merge branch 'bo-set-pin'
This branch replaces the NO_MOVE/NO_EVICT flags to buffer validation with a
separate privileged ioctl to pin buffers like NO_EVICT meant before.  The
functionality that was supposed to be covered by NO_MOVE may be reintroduced
later, possibly in a different way, after the superioctl branch is merged.
2007-09-21 17:12:19 -07:00
Dave Airlie bc5423f168 drm_sysfs: update sysfs code from kernel 2007-09-20 14:01:29 +10:00
Eric Anholt 3d3a96ad4e Merge branch 'origin' into bo-set-pin 2007-09-19 15:55:58 -07:00
Ian Romanick a3881ad2fe Add ioc32 compat layer for XGI DRM. 2007-09-18 11:03:49 -07:00
Ian Romanick e7d4a26913 Fix ioc32 compat layer
Previously any ioctls that weren't explicitly listed in the compat ioctl
table would fail with ENOTTY.  If the incoming ioctl number is outside the
range of the table, assume that it Just Works, and pass it off to drm_ioctl.
This make the fence related ioctls work on 64-bit PowerPC.
2007-09-18 11:03:08 -07:00
Brian 41345b95a2 Added bool typedef added in kernel 2.6.19
This allows the xgi code to compile with older kernels.
2007-09-12 12:05:15 -06:00
Brian c453135789 Added idr_replace() function which was apparently added in Linux 2.6.18
Someone should probably double-check my work here since this is the
first time I've touched drm_compat.[ch]
2007-09-12 11:49:51 -06:00
Ian Romanick c597bd57ee Bump version to 1.0.0. 2007-09-06 15:20:52 -07:00
Ian Romanick fee49e2071 Merge branch 'master' of ssh+git://git.freedesktop.org/git/mesa/drm into xgi-0-0-2 2007-08-31 10:54:55 -07:00
Ian Romanick bb3da88601 Acutally emit the IRQ (duh) when setting the fence post. 2007-08-31 10:48:13 -07:00
Ian Romanick 9c5b9d458b Use ati_pcigart for PCI-e GART table handling. 2007-08-29 14:41:49 -07:00
Ian Romanick c46ffd6b29 Fix late night dumb-dumb mistake. 2007-08-29 00:23:30 -07:00
Ian Romanick 2bcd5b5e33 Use DRM_SPINLOCK / DRM_UNSPINLOCK macros. 2007-08-29 00:04:18 -07:00
Dave Airlie 589707b765 drm: remove XFREE86_VERSION macros 2007-08-28 15:17:36 +10:00
Ian Romanick 3383e8bd6b Remove unnecessary include. 2007-08-17 10:53:18 -07:00
Ian Romanick 0d3c741df1 Forgot to add this file on the last commit. 2007-08-16 13:43:04 -07:00
Eric Anholt 0055fd5c35 Merge branch 'master' into bo-set-pin 2007-08-16 09:23:09 -07:00
Ian Romanick d8a800b63d Implement fence support. 2007-08-15 21:05:26 -07:00
Eric Anholt b668d6d905 Fix dev->agp->base initialization on BSD, and fix addmap range check on Linux.
With the previous linux commit, an AGP aperture at the end of the address space
would have wrapped to 0 and the test would have failed.
2007-08-15 14:29:31 -07:00
Ben Skeggs c3faa589b0 nouveau: Allow GART notifiers when using sgdma code. 2007-08-15 13:36:54 +10:00
Ian Romanick f563a50d14 Eliminate unused / useless ioctls. 2007-08-14 13:44:51 -07:00
Ian Romanick 7b12174aac Clean up remaining C++ style comments. 2007-08-14 13:24:02 -07:00
Ian Romanick d3c8e98dd9 Move dwWriteReg to xgi_cmdlist.c, the only file where it is used. 2007-08-14 13:20:37 -07:00
Ian Romanick be76f0eea9 Remove unused interrupt related functions. 2007-08-14 13:19:48 -07:00
Ian Romanick 891714d8d7 Clean up xgi_(en|dis)able_(mmio|ge) and move to xgi_misc.c. 2007-08-14 13:18:44 -07:00
Eric Anholt 3ee211f4f7 Bug #11895: Only add the AGP base to map offset if the caller didn't.
The i830 and newer intel 2D code adds the AGP base to map offsets already,
because it wasn't doing the AGP enable which used to set dev->agp->base.

Credit goes to Zhenyu for finding the issue.
2007-08-13 16:32:32 -07:00
Ian Romanick 15f841bd52 Strobe magic 0xB03F register to flush PCI-e GART table.
The original XGI kernel driver strobed 0xB03F each time a page was
allocated to back a GART page.  When the driver was converted to use
the DRM SG interface, this code was lost.  Returning it fixes a long
standing issue where the X-server would work fine the first time, but
acceleration commands would be ignored on the second X-server
invocation.
2007-08-13 16:21:20 -07:00
Ian Romanick 20a0e5e429 After calling drm_sman_cleanup, mark both heaps as uninitialized.
Since the heaps weren't marked as uninitialized, SG memory was never
re-allocated.  This prevented the X-server from being able to restart
without re-loading the kernel module.
2007-08-09 18:57:15 -07:00
Ian Romanick 06e09842df Use DRM_MEMORYBARRIER() macro instead of mb(). 2007-08-09 18:28:16 -07:00
Ian Romanick 371f0a4d41 Mask off correct bits in M2REG_AUTO_LINK_STATUS for interrupt handling. 2007-08-09 18:15:42 -07:00
Ian Romanick 6dd97099ea Minor clean up of IRQ code. Much, much more to come. 2007-08-09 16:20:44 -07:00
Ian Romanick dbd4d0597f Use sman memory manager instead of internal version. 2007-08-09 16:01:14 -07:00
Ian Romanick aea6b4dea9 Unify alloc and free ioctls.
The DRM_XGI_PCIE_ALLOC and DRM_XGI_FB_ALLOC ioctls (and the matching
free ioctls) are unified to DRM_XGI_ALLOC.  The desired memory region
is selected by xgi_mem_alloc::location.  The region is magically
encoded in xgi_mem_alloc::index, which is used to release the memory.

Bump to version 0.11.0.  This update requires a new DDX.
2007-08-09 15:30:36 -07:00
Ian Romanick 25cb876f85 Associate master file pointer with command list buffer.
Pass the master's file pointer, as supplied to xgi_bootstrap, to
xgi_cmdlist_initialize.  Associate that pointer with the memory
allocated for the command list buffer.  By doing this the memory will
be automatically cleaned up when the master closes the device.  This
allows the removal of some clean up code.
2007-08-09 15:23:13 -07:00
Ian Romanick f7ba02b745 Unify infrastructure for freeing on-card / GART memory. 2007-08-06 17:27:15 -07:00
Ian Romanick 6718198897 Release client memory in reclaim_buffers_idlelocked instead of preclose. 2007-08-06 16:56:20 -07:00
Ian Romanick f3072becda Refactor xgi_(fb|pcie)_free_all into xgi_free_all. 2007-08-06 16:35:07 -07:00
Ian Romanick 90907c5915 Replace per-heap semaphores with drm_device::struct_mutex. 2007-08-06 16:17:23 -07:00
Ian Romanick f96bff9e21 Unify infrastructure for allocating (not yet freeing) on-card / GART memory. 2007-08-06 16:09:05 -07:00
Ian Romanick 5362cc723e Eliminate unnecessary function xgi_pcie_free_locked. 2007-08-06 15:52:06 -07:00
Eric Anholt d749cc9ae8 Initialize the AGP structure's base address at init rather than enable.
Not all drivers call enable (intel), but they would still like to use this
member in driver code.
2007-08-06 15:45:37 -07:00
Ian Romanick a6fb93a150 Finish removing allocation "owner" infrastructure. 2007-08-06 15:43:51 -07:00
Ian Romanick 78e9c1a93d Eliminate special-case handling of framebuffer (fake) allocation. 2007-08-06 15:37:56 -07:00
Ian Romanick 997a9a738e Eliminate allocation "owner" usage. 2007-08-06 15:31:34 -07:00
Ben Skeggs 8d5a8ebc31 nouveau: ouch, add nouveau_dma.[ch] files.. 2007-08-06 22:32:36 +10:00
Ben Skeggs 92084c6e05 Export some useful ttm functions to drivers. 2007-08-06 22:11:18 +10:00
Ben Skeggs cf04641bc6 nouveau: Give DRM its own gpu channel
If your card doesn't have working context switching, it is now broken.
2007-08-06 22:05:31 +10:00
Ben Skeggs 97770db720 nouveau: Various internal and external API changes
1. DRM_NOUVEAU_GPUOBJ_FREE
	Used to free GPU objects.  The obvious usage case is for Gr objects,
	but notifiers can also be destroyed in the same way.

	GPU objects gain a destructor method and private data fields with
	this change, so other specialised cases (like notifiers) can be
	implemented on top of gpuobjs.

2. DRM_NOUVEAU_CHANNEL_FREE

3. DRM_NOUVEAU_CARD_INIT
	Ideally we'd do init during module load, but this isn't currently
	possible.  Doing init during firstopen() is bad as X has a love of
	opening/closing the DRM many times during startup.  Once the
	modesetting-101 branch is merged this can go away.

	IRQs are enabled in nouveau_card_init() now, rather than having the
	X server call drmCtlInstHandler().  We'll need this for when we give
	the kernel module its own channel.

4. DRM_NOUVEAU_GETPARAM
	Add CHIPSET_ID value, which will return the chipset id derived
	from NV_PMC_BOOT_0.

4. Use list_* in a few places, rather than home-brewed stuff.
2007-08-06 21:45:18 +10:00
Ben Skeggs beaa0c9a28 nouveau: Pass channel struct around instead of channel id. 2007-08-06 03:40:43 +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
Dave Airlie 7602e4f8a6 drm: add unlocked ioctl code path - not used yet 2007-08-02 19:13:58 +10:00
Ian Romanick f83000c8b3 Refactor register dumping code. 2007-07-31 17:27:00 -07:00
Dave Airlie c395d27a72 drm/fence: shut up lockdep 2007-08-01 10:12:36 +10:00
Dave Airlie 283eaa2559 drm: fix fencing refcount error
This extra increase was causing fence leaks on my system, due to create/user add already increasing it twice no need for a 3rd go.
2007-07-31 09:25:51 +10:00
Ian Romanick 08919d8a70 Move additional GE initialization into the kernel.
This code comes directly from the X server.
2007-07-30 12:01:52 -07:00
Ian Romanick 2fc697a7d2 Fix GE shut-down sequence.
When the GE is shut down, an empty command packet without a begin-link
must be sent.  After this command is sent, wait for the hardware to go
idle.  Finally, turn off the GE and disable MMIO.
2007-07-30 10:20:15 -07:00
Ian Romanick 01628a430d Use DRM_READ/DRM_WRITE macros instead of directly accessing MMIO space. 2007-07-30 10:02:46 -07:00
Ian Romanick 2ac80e79e4 Use OUT3C5B macro instead of assuming little-endian byte order. 2007-07-30 09:59:19 -07:00
Ian Romanick cd51f13138 Convert to new ioctl interface between core DRM and device-specific module. 2007-07-27 15:45:59 -07:00
Ian Romanick c37ed9eca5 Eliminate use of DRM_ERR. 2007-07-26 17:01:16 -07:00
Ian Romanick b89cc03465 Eliminate unnecessary (and now wrong) call gto drm_sg_free. 2007-07-26 16:58:59 -07:00
Ian Romanick c561cb4650 Merge branch 'master' of ssh+git://git.freedesktop.org/git/mesa/drm into xgi-0-0-2
Conflicts:

	linux-core/drmP.h
	linux-core/drm_scatter.c
2007-07-26 16:58:28 -07:00
Eric Anholt 3c8ebd94e4 debug print ioctl return value as -integer rather than fffffwhatever. 2007-07-26 11:26:12 -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
Ian Romanick 2bafeb673f Fix typo on previous commit. Sigh... 2007-07-24 16:17:30 -07:00
Ian Romanick 75a68635a8 Pass correct offset to xgi_find_pcie_virt.
The wrong offset was being passed to xgi_find_pcie_virt.  This would
cause an oops in addFlush2D.
2007-07-24 15:53:50 -07:00
Ian Romanick 8e64d2ae86 Fix license formatting. 2007-07-24 13:36:02 -07:00
Ian Romanick 2ef2997ee3 Fix flags for serveral ioctls. 2007-07-24 13:29:29 -07:00
Ian Romanick 887cb31ee9 Fix bug preventing X server from restarting.
The core DRM lastclose routine automatically destroys all mappings and
releases SG memory.  XP10 DRM and DDX assumed this data stayed around
until module unload.  xgi_bootstrap was reworked to recreate all these
mappings.  In addition, the drm_addmap for the GART backing store was
moved into the kernel.  This causes a change to the ioctl protocol and
a version bump.
2007-07-24 13:27:44 -07:00
Ian Romanick 46214fc397 Minor log message clean up. 2007-07-23 18:50:52 -07:00
Ian Romanick 388a2c54ee Minor log message clean up. 2007-07-23 18:50:07 -07:00
Eric Anholt 03e932e32b linux: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx.
Fixes the getclient test and dritest -c.
2007-07-23 15:11:12 -07:00
Ian Romanick 2097d743f2 Eliminate XGI_CHECK_PCI_CONFIG.
Based on review comments from airlied, XGI_CHECK_PCI_CONFIG is
removed.  He believes (and I tend to agree) that this is a largely
unnecessary workaround for a bug elsewhere.
2007-07-23 13:26:28 -07:00
Adrian Bunk 7e6d08f670 drm_rmmap_ioctl(): remove dead code
This patch removes some obviously dead code spotted by the Coverity
checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
2007-07-23 18:15:00 +10:00
Ian Romanick 94203840fe Bump version. 2007-07-21 23:00:01 -07:00
Ian Romanick 699207cf2f Remove some extraneous debug messages. 2007-07-21 21:37:45 -07:00
Ian Romanick 1a0775760c Rename and document fields of xgi_cmdring_info. 2007-07-21 21:35:06 -07:00
Ian Romanick 3265a61f89 Make s_cmdring a field in the xgi_info structure instead of a global. 2007-07-21 20:39:22 -07:00
Ian Romanick 5d6fdd9d79 Clean up xgi_cmd_info and associated code.
There were numerous unnecessary fields in xgi_cmd_info.  The remaining
fields had pretty crummy names.  Cut out the cruft, and rename the
rest.  As a result, the unused parameter "triggerCounter" to
triggerHWCommandList can be removed.
2007-07-21 20:34:56 -07:00
Pekka Paalanen 0844c46759 Fix misc ioctl issues, makes Nouveau run.
Debug print fix in drm_release().
Forgotten local variable init in drm_setversion().
Unnecessary put_user() in drm_addmap_ioctl().
ioctl->cmd check broken in drm_ioctl(); workaround.
2007-07-21 23:13:25 +03:00
Dave Airlie b43b0b2b32 fix missing brace placement for IOC_IN 2007-07-21 22:11:41 +10:00
Dave Airlie f68ad6d1ab fix drm no-compile due to BSD :-) 2007-07-21 21:50:25 +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 5dc9fd96d7 Fix linux spinlock macros after the last commit. 2007-07-20 12:55:51 -07:00
Ian Romanick ed82d5398a Clean up flush command generation in addFlush2D. 2007-07-20 11:31:01 -07:00
Ian Romanick 659209cb2d Clean up generation of begin commands in xgi_submit_cmdlist
Generate the begin command once in a temporary buffer.  Then,
depending on whether the command is to be written directly to the
hardware or to a secondary buffer, copy to command to the correct place.
2007-07-20 11:29:16 -07:00
Ian Romanick 6bd8483074 Change handling of begin types slightly.
Moved the getCurBatchBeginPort before its only caller.  Modified
function to return the command ID instead of the port offset.
Function also now assumes input begin type is value.

Added code to ioctl handler to validate begin type.
2007-07-20 10:57:40 -07:00
Ian Romanick 56665a42f4 Delete unused variable in xgi_driver_load. 2007-07-19 19:09:24 -07:00
Ian Romanick 970674f486 Fix error handing related to xgi_cmdlist_initialize.
xgi_cmdlist_initialize wasn't correctly checking for errors from
xgi_pcie_alloc.  Furthermore, xgi_bootstrap, the one caller of
xgi_cmdlist_initialize, wasn't check its return value.
2007-07-19 19:08:47 -07:00
Ian Romanick a33f548729 Debug message and comment clean up in xgi_submit_cmdlist. 2007-07-19 19:05:52 -07:00
Ian Romanick 15245b670e Rework xgi_(pcie|fb)_free_all to prevent deadlock. 2007-07-19 11:38:56 -07:00
Ian Romanick 2f53ce4af2 Move MMIO drm_addmap (and code that depends on it) to xgi_bootstrap.
For reasons that I don't understand, the drm_addmap call would succeed
in xgi_driver_load, but writes to the map later would oops.  Moving it
to xgi_bootstrap fixes this problem.
2007-07-19 11:05:13 -07:00
Ian Romanick 5ba94c2ab8 Initial pass at converting driver to DRM infrastructure. 2007-07-19 10:29:18 -07:00
Eric Anholt 05204b9c8d Merge branch 'origin' 2007-07-19 06:31:26 -07:00
Eric Anholt 33a50412c2 Add dry-coded DRM drawable private information storage for FreeBSD.
With this, all modules build again.
2007-07-18 14:22:49 -07:00
Thomas Hellstrom 1ff858fe3a Fix via dmablit when blit queue is full.
Fix by Simon Farnsworth, Bugzilla Bug #11542
http://bugs.freedesktop.org/show_bug.cgi?id=11542
2007-07-18 10:40:03 +02:00
Dave Airlie a64b5d8d37 fix some missing whitespace/tab 2007-07-18 15:49:45 +10:00
Dave Airlie 3a71e87742 drm: idr stuff is upstream for 2.6.23 2007-07-18 09:46:16 +10: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 bff698d0ed drm_context: fix braino 2007-07-18 09:27:21 +10:00
Ian Romanick 7f98815d00 Make drm_sg_free callable in-kernel. 2007-07-16 22:15:01 -07:00
Ian Romanick bcba7ba981 Log message clean up in WriteRegDWord. Remove unused inline functions. 2007-07-16 21:15:58 -07:00
Ian Romanick 5b08ab258f Clean ups (primarilly log messages) in xgi_test_rwinkernel. 2007-07-16 21:12:30 -07:00
Ian Romanick 658ff2daf3 Eliminate several useless ioctls and associated cruft.
The ioctlss XGI_ESC_DEVICE_INFO, XGI_ESC_MEM_COLLECT,
XGI_ESC_PCIE_CHECK, XGI_ESC_GET_SCREEN_INFO, XGI_ESC_PUT_SCREEN_INFO,
XGI_ESC_MMIO_INFO, and XGI_ESC_SAREA_INFO, are completely unnecessary.
The will be doubly useless when the driver is converted to the DRM
infrastructure.
2007-07-16 20:58:43 -07:00
Ian Romanick 4575d5b8f1 Massive log message clean up in xgi_submit_cmdlist. 2007-07-16 20:56:11 -07:00
Ben Skeggs ec67c2def9 nouveau: G8x PCIEGART
Actually a NV04-NV50 ttm backend for both PCI and PCIEGART, but PCIGART
support for G8X using the current mm has been hacked on top of it.
2007-07-17 13:51:14 +10:00
Dave Airlie 23631fca09 drm: fixup old kernel compat code 2007-07-16 13:52:21 +10:00
Dave Airlie 0accdc1f69 drm: fixup compat wrappers 2007-07-16 13:50:04 +10:00
Dave Airlie 535e3dec8c drm: remove internal sman typedef 2007-07-16 13:46:37 +10:00
Dave Airlie 191c062933 drm: remove drm_ref_t 2007-07-16 13:45:39 +10:00
Dave Airlie 24311d5d82 drm: remove drm_buf_t 2007-07-16 13:42:11 +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 b95ac8b7b3 drm: detypedef drm.h and fixup all problems 2007-07-16 11:22:15 +10:00
Dave Airlie 4be9554fcd drm: fix typedef in drm_os_linux.h 2007-07-16 11:13:07 +10:00
Dave Airlie 2134193af6 Merge branch 'drm-ttm-cleanup-branch' 2007-07-16 10:05:20 +10:00
Ian Romanick 5522136b7f Merge branch 'master' into xgi-0-0-2 2007-07-12 15:28:17 -07:00
Ben Skeggs 750371cb6e nouveau: separate region_offset into map_handle and offset. 2007-07-12 10:46:57 +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
Arthur Huillet 04e4922c0c Made drm_sg_alloc accessible from inside the DRM - drm_sg_alloc_ioctl is the ioctl wrapper 2007-07-11 02:34:00 +02:00
Ian Romanick 76ca1e858f Convert occurances of U32 to other types.
Most occurances of U32 were converted to u32.  These are cases where
the data represents something that will be written to the hardware.
Other cases were converted to 'unsigned int'.

U32 was the last type in xgi_types.h, so that file is removed.
2007-07-09 18:54:25 -07:00
Ian Romanick 5c481d0a42 Eliminiate fields in xgi_info that are duplicates of fields in pci_dev. 2007-07-09 16:43:48 -07:00
Ian Romanick 1f4e24b429 Move types shared with user mode to xgi_drm.h. 2007-07-09 16:33:14 -07:00
Ian Romanick 7268b65d5c Correct types that are shared with user mode. 2007-07-09 16:22:48 -07:00
Ian Romanick a3f56dc3d0 Adjust the types of the fields of xgi_aperture. 2007-07-09 16:07:27 -07:00
Ian Romanick 2f2d8b9688 Merge xgi_mem_req and xgi_mem_alloc into a single type.
These two structures were used as the request and reply for certain
ioctls.  Having a different type for an ioctl's input and output is
just wierd.  In addition, each structure contained fields (e.g., pid)
that had no business being there.

This change requires updates to user-space.
2007-07-09 15:59:09 -07:00
Ben Skeggs c806bba466 nouveau/nv50: Initial channel/object support
Should be OK on G84 for a single channel, multiple channels *almost* work.

Untested on G80.
2007-07-09 16:16:44 +10:00
Ian Romanick 86e75b7f7f Remove XGI_IOCTL_CPUID and associated cruft. 2007-07-05 17:49:13 -07:00
Ian Romanick 8b18276458 Major clean up of xgi_ge_irq_handler
Two large blocks of code were moved out of this function into separate
functions.  This brought some much needed sanity to the indentation.
Some dead varaibles were removed.
2007-07-05 17:45:44 -07:00
Ian Romanick 2695e8e209 Convert weird rtdsc usage to get_cycles.
I'm not convinced that get_cycles is the right approach here, but it's
better than the weird way that rtdsc was being used.
2007-07-05 17:18:12 -07:00
Kristian Høgsberg d57b7f02d2 Use idr_replace trick to eliminate struct drm_ctx_sarea_list. 2007-07-03 10:41:48 -04:00
Kristian Høgsberg 1814a829eb Don't take dev->struct_mutex twice in drm_setsareactx. 2007-07-03 10:31:46 -04:00
Michel Dänzer ea832a8e55 Simplification for previous commit.
Dave Airlie pointed out on IRC that idr_replace lets us know if the ID hasn't
been allocated, so we don't need a special pointer value for allocated IDs that
don't have valid information yet.
2007-07-03 12:15:15 +02:00
Michel Dänzer 8d96ba9805 Restore pre-idr semantics for drawable information.
There's a difference between a drawable ID not having valid drawable
information and not being allocated at all. Not making the distinction would
break i915 DRM swap scheduling with older X servers that don't push drawable
cliprect information to the DRM.
2007-07-03 11:41:44 +02:00
Kristian Høgsberg c9d752ff4f Fix must-check warnings and implement a few error paths. 2007-07-02 17:52:07 -04:00
Kristian Høgsberg b323ab52aa Drop drm_drawable_list and add drm_drawable_info directly to the idr. 2007-07-02 15:07:02 -04:00
Ian Romanick fc37781dd3 Convert a few more U32 variables to more appropriate, generic types. 2007-06-29 21:48:31 -07:00
Ian Romanick 49ccec1b08 Convert xgi_mem_location enum values to less generic names. 2007-06-29 21:38:48 -07:00
Ian Romanick 32584d94e6 Convert open coded list iterators to either list_for_each_entry or list_for_each_entry_safe 2007-06-29 21:35:27 -07:00
Ian Romanick 4403540776 Clean up xgi_pcie_heap_check
The whole purpose of xgi_pcie_heap_check is to log information about
entries on the used_list.  If XGI_DEBUG is not set, it doesn't print
anything.  Therefore we can #ifdef the whole function body.

Convert open-code list iteration to use list_for_each_entry.
2007-06-29 21:15:33 -07:00
Ian Romanick 4c4780bc8e Stop-gap fix in xgi_submit_cmdlist
Comment in the code explains it.  Basically, I put an if-statement
around a block of code to prevent a NULL pointer dereference that
should never happen in the first place.  Eventually, this will need to
come out.
2007-06-29 21:05:16 -07:00
Ian Romanick e206c4c59d Convert some PCI-e GART related variable to generic types.
A few of the PCI-e GART related fields in struct xgi_info were
hardcoded to u32.  None of them need to be.  Convert them to either
unsigned int or bool.
2007-06-29 21:00:50 -07:00
Ian Romanick 3773378658 Delete unused arrays s_emptyBegin and s_flush2D. 2007-06-29 20:49:21 -07:00
Ian Romanick 406ded3816 Replace U(8|16) with u(8|16). 2007-06-29 16:41:32 -07:00
Ian Romanick ec7730e5ba Eliminate unnecessary defines of TRUE and FALSE. 2007-06-29 16:37:39 -07:00
Ian Romanick 5da2a3c2d4 Replace BOOL with bool. 2007-06-29 16:37:01 -07:00
Ian Romanick ba3173fa39 Eliminate unused integer and float typedefs. 2007-06-29 16:35:36 -07:00
Ian Romanick 88328d4ef0 Eliminate structure typedefs
Documentation/CodingStyle says that 'typedef struct foo foo_t' is
evil.  I tend to agree.  Elminate all uses of such construct.
2007-06-29 15:27:38 -07:00
Ian Romanick 33b8476dfb Fix return type of xgi_find_pcie_block.
This function used to return 'void *', which was then cast to
'xgi_pcie_block_t *' at the only caller.  I changed the return type to
'struct xgi_pcie_block_s *' and removed the explicit cast.
2007-06-29 09:30:02 -07:00
Thomas Hellstrom a27af4c4a6 Avoid hitting BUG() for kernel-only fence objects. 2007-06-29 15:22:28 +02: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
Ian Romanick 475c1e67ba Remove unused type 'struct xgi_pcie_list_s' / xgi_pcie_list_t. 2007-06-28 23:40:36 -07:00
Ian Romanick 8fa24c53f5 Minor clean up of variable declarations in xgi_find_pcie_virt. 2007-06-28 22:32:11 -07:00
Ian Romanick 9c85fb866d Clean up debug log messages in xgi_find_pcie_block. 2007-06-28 22:26:39 -07:00
Ian Romanick 11ffe4632a Convert comment header of xgi_find_pcie_virt to kernel doc format. 2007-06-28 22:20:13 -07:00
Ben Skeggs ce0d528d3c nouveau/nv50: skeletal backend 2007-06-28 03:26:43 +10:00
Ben Skeggs 695599f18d nouveau: Nuke DMA_OBJECT_INIT ioctl (bumps interface to 0.0.7)
For various reasons, this ioctl was a bad idea.

At channel creation we now automatically create DMA objects covering
available VRAM and GART memory, where the client used to do this themselves.

However, there is still a need to be able to create DMA objects pointing at
specific areas of memory (ie. notifiers).  Each channel is now allocated a
small amount of memory from which a client can suballocate things (such as
notifiers), and have a DMA object created which covers the suballocated area.
The NOTIFIER_ALLOC ioctl exposes this functionality.
2007-06-28 03:26:43 +10:00
Ian Romanick 8cee7dca95 Clean up warnings about unused variables and functions. 2007-06-26 13:46:36 -07:00
Ian Romanick b9ef1467fe Clean up mixed declarations and code. 2007-06-26 13:39:01 -07:00
Ian Romanick 3547fbda63 Revert over-zealous change from previous commit. 2007-06-26 13:29:28 -07:00
Ian Romanick 3a776fa01e Add XGI driver to Makefiles. 2007-06-26 13:26:10 -07:00
Ian Romanick 47bf6239aa Clean up compile-time kernel feature detection. 2007-06-26 13:20:15 -07:00
Ian Romanick 7a053306a9 linux/config.h is deprecated or gone. 2007-06-26 13:16:04 -07:00
Ian Romanick ec9e494eb9 Gut support for pre-2.6 kernels. 2007-06-26 13:15:22 -07:00
Ian Romanick 434657a258 dos2unix and Lindent 2007-06-26 13:10:30 -07:00
Ian Romanick 7af9d67037 Initial XP10 code drop from XGI.
See attachment 10246 on https://bugs.freedesktop.org/show_bug.cgi?id=5921
2007-06-26 13:05:29 -07:00
Ben Skeggs 341bc78207 nouveau: NV1X/2X/3X PFIFO engtab functions
Earlier NV1X chips use the NV04 code, see previous commits about NV10 RAMFC
entry size.
2007-06-24 18:58:14 +10:00
Ben Skeggs 05d86d950a nouveau: NV04 PFIFO engtab functions 2007-06-24 18:57:09 +10:00
Ben Skeggs f2e64d5276 nouveau: NV4X PFIFO engtab functions 2007-06-24 18:56:01 +10:00
Jesse Barnes 7f2a1cf275 Merge branch 'vblank-rework' into vblank 2007-06-22 11:12:02 -07:00
Jesse Barnes 97dcd7fd25 more vblank rework
- use a timer for disabling vblank events to avoid enable/disable calls too
    often
  - make i915 work with pre-965 chips again (would like to structure this
    better, but this hack works on my test system)
2007-06-22 11:06:51 -07:00
Michel Dänzer d2d53024fb Fix vblank wait condition.
Sync-to-vblank actually works again for me with radeon.
2007-06-22 11:45:23 +02:00
Michel Dänzer 2738bca6f5 Use drm_calloc instead of assigning 0. 2007-06-22 11:44:38 +02:00
David Woodhouse 638ebbab54 fix radeon setparam on 32/64 systems, harder.
Commit 9b01bd5b284bbf519b726b39f1352023cb5e9e69 introduced a
    compat_ioctl handler for RADEON_SETPARAM, the sole purpose of which was
    to handle the fact that on i386, alignof(uint64_t)==4.

    Unfortunately, this handler was installed for _all_ 64-bit
    architectures, instead of only x86_64 and ia64.  And thus it breaks
    32-bit compatibility on every other arch, where 64-bit integers are
    aligned to 8 bytes in 32-bit mode just the same as in 64-bit mode.

    Arnd has a cunning plan to use 'compat_u64' with appropriate alignment
    attributes according to the 32-bit ABI, but for now let's just make the
    compat_radeon_cp_setparam routine entirely disappear on 64-bit machines
    whose 32-bit compat support isn't for i386.  It would be a no-op with
    compat_u64 anyway.

    Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-06-18 12:46:00 +10:00
Jesse Barnes b6610363e3 First cut at radeon support for the vblank rework. 2007-06-15 11:21:57 -07:00
Michel Dänzer 3d5d41fa98 i915: Fix handling of breadcrumb counter wraparounds. 2007-06-15 17:13:11 +02:00
Michel Dänzer 0f5334be2b Remove DRIVER_IRQ_VBL(2).
If the driver doesn't support vertical blank interrupts, it won't call
drm_vblank_init(), and dev->num_crtcs will be 0.

Also fix an off-by-one test against dev->num_crtcs.
2007-06-15 11:01:51 +02:00
Michel Dänzer fbee089aca Make vblank waitqueue per CRTC. 2007-06-15 10:50:22 +02:00
Thomas Hellstrom 84bea38353 Fix i915 sequence mask. 2007-06-15 10:35:52 +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
Michel Dänzer 82e2c3304d Wake up vblank waitqueue in drm_handle_vblank(). 2007-06-15 10:25:50 +02:00
Michel Dänzer 7f95a06c61 Return current sequence number to userspace after blocking wait for vblank. 2007-06-15 10:12:23 +02:00
Michel Dänzer 1000d88ddf Fix memory leaks in vblank error paths.
Also use drm_calloc instead of drm_alloc and memset, and use the size of the
struct instead of the size of the pointer for allocation...
2007-06-15 10:10:33 +02:00
Jesse Barnes b06268294a Comment new vblank routines and fixup several issues:
- use correct refcount variable in get/put routines
  - extract counter update from drm_vblank_get
  - make signal handling callback per-crtc
  - update interrupt handling logic, drivers should use drm_handle_vblank
  - move wakeup and counter update logic to new drm_handle_vblank routine
  - fixup usage of get/put in light of counter update extraction
  - fix longstanding bug in signal code, update pending counter only
    *after* we're sure we'll setup signal handling
2007-06-14 11:32:31 -07: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
Jesse Barnes ca47fa90b7 Update vblank code:
- move pre/post modeset ioctl to core
  - fixup i915 buffer swap
  - fix outstanding signal count code
  - create new core vblank init routine
  - test (works with glxgears)
  - simplify i915 interrupt handler
2007-06-12 13:35:41 -07:00
Jesse Barnes db689c7b95 Initial checkin of vblank rework. Code attempts to reduce the number
of vblank interrupt in order to save power.
2007-06-12 10:44:21 -07: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 280083d4a2 use krh's idr mods to remove lists from idr code 2007-06-10 15:40:21 +10:00
Dave Airlie 7426da7538 oops must fix this properly at some point 2007-06-07 18:45:00 +10:00
Dave Airlie e22f428f5f drm: fix radeon setparam alignment issues on 32/64-bit 2007-06-07 18:41:18 +10:00
Dave Airlie 5bd0ca125e remove include of linux ioctl32.h from drm drivers 2007-06-05 18:16:44 +10:00
root a4cddc6596 Revert "drm: add new drm_wait_on function to replace macro"
This reverts commit 6e860d08d0.

As I said not a good plan - this macro will have to stay for now,
trying to do the vbl code with the inline was a bit messy - may need specialised
drm wait on functions
2007-06-03 18:12:28 +10:00
Dave Airlie 4e9d215bdf radeon: add support for vblank on crtc2
This add support for CRTC2 vblank on radeon similiar to the i915 support
2007-06-03 16:28:21 +10:00
Dave Airlie 638c8087de drm: fixup initialisation of list heads and idr 2007-06-01 19:00:24 +10:00
Dave Airlie 056c2f249a drm: move context handling code to use linux idr 2007-05-27 08:44:38 +10:00
Dave Airlie f64674743a drm: convert drawable handling to use Linux idr
This cleans this code up a lot and uses the generic Linux idr which is
designed for this.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-05-27 07:26:52 +10:00
Michel Dänzer 8e083c522e drm: make sure the drawable code doesn't call malloc(0).
Signed-off-by: Michel Dänzer <michel@tungstengraphics.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-05-26 04:35:54 +10: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 375f3f2884 Revert "drm/ttm: cleanup most of fence ioctl split out"
This reverts commit 3dfc1400e9.

this shouldn't have gone on master yet
2007-05-26 03:47:48 +10:00
Dave Airlie ce58e53a01 whitespace fixups from kernel 2007-05-26 03:32:34 +10:00
Dave Airlie adee6f52e6 ati_pcigart: cut to 80 chars 2007-05-26 03:32:34 +10:00
Dave Airlie 3dfc1400e9 drm/ttm: cleanup most of fence ioctl split out 2007-05-26 03:32:34 +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