Commit Graph

1297 Commits (8ef838e5ff7b3c005d7fbc725e17bcccd0e1e1eb)

Author SHA1 Message Date
Thomas Hellstrom 8ef838e5ff Add a compat kmap_atomic_prot_pfn to do quick kernel map / unmaps of
PCI- or high memory.
This is substantially more efficient than drm_bo_kmap,
since the mapping only lives on a single processor.
Unmapping is done use kunmap_atomic(). Flushes only a single tlb() entry.

Add a support utility int drm_bo_pfn_prot() that returns the
pfn and desired page protection for a given bo offset.

This is all intended for relocations in bound TTMS or vram.
Mapping-accessing-unmapping must be atomic, either using preempt_xx() macros
or a spinlock.
2008-02-28 14:06:46 +01:00
Jesse Barnes 20d0e53916 i915: put ARX back into index mode before doing restore
Fixes resume from hibernate in some configurations.
2008-02-22 13:57:38 -08:00
Kristian Høgsberg 32c67922b7 Don't free irq resources until after we've unregistered the handler. 2008-02-21 15:31:48 -05:00
Michel Dänzer 374b41e5bc linux: Clean up vblank related resources from drm_irq_uninstall().
This fixes at least two problems:

* The vblank_disable_fn timer callback could get called after the DRM was
  de-initialized, e.g. on X server shutdown.
* Leak of vblank related resources when disabling and re-enabling the IRQ, e.g.
  on an X server reset.
2008-02-21 11:49:38 +01:00
Dave Airlie 6c41e5381f drm: add support for passing state into the suspend hooks.
fix i915 driver to use state for hibernate save avoidance.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2008-02-20 10:02:20 +10:00
Keith Packard 5d8c754bc2 [915]: more registers for S3 (DSPCLK_GATE_D, CACHE_MODE_0, MI_ARB_STATE)
Failing to preserve the MI_ARB_STATE register was causing FIFO underruns on
the VGA output on my HP 2510p after resume.
2008-02-16 20:14:49 -08:00
Jesse Barnes d63b57749f Restore pipeconf regs unconditionally
On many chipsets, the checks for DPLL enable or VGA mode will prevent the
pipeconf regs from being restored, which could result in a blank display or X
failing to come back after resume.  So restore them unconditionally along with
actually restoring pipe B's palette correctly.
2008-02-07 17:33:28 -08:00
Jesse Barnes 8b6c96dedd i915: save/restore interrupt state
On resume, if the interrupt state isn't restored correctly, we may end
up with a flood of unexpected or ill-timed interrupts, which could cause
the kernel to disable the interrupt or vblank events to happen at the
wrong time.  So save/restore them properly.
2008-02-07 10:48:08 -08:00
Jesse Barnes 79d6928520 Fix vblank enable/disable callbacks
There were two problems with the existing callback code:  the vblank
enable callback happened multiple times per disable, making drivers more
complex than they had to be, and there was a race between the final
decrement of the vblank usage counter and the next enable call, which
could have resulted in a put->schedule disable->get->enable->disable
sequence, which would be bad.

So add a new vblank_enabled array to track vblank enable on per-pipe
basis, and add a lock to protect it along with the refcount +
enable/disable calls to fix the race.
2008-02-07 10:40:06 -08:00
Thomas Hellstrom 76748efae2 i915: Re-report breadcrumbs on poll to the fence manager,
since a breadcrumb may actually turn up before a corresponding fence object
has been placed on the fence ring.
2008-02-05 10:36:49 +01:00
Thomas Hellstrom c77b0937f2 Add an fence_class_manager::last_queued_sequence member, since a
sequence number may actually turn up before the corresponding fence
object has been queued on the ring.

Fence drivers can use this member to determine whether a
sequence number must be re-reported.
2008-01-31 14:11:12 +01:00
Thomas Hellstrom f1edb7ad91 Simplify the fencing code and differentiate between flushes and
waiting types.
Add a "command_stream_barrier" method to the bo driver.
2008-01-30 22:06:02 +01:00
Jesse Barnes 01f6afcfea Fix hibernate save/restore of VGA attribute regs
In hibernate, we may end up calling the VGA save regs function twice, so we
need to make sure it's idempotent.  That means leaving ARX in index mode after
the first save operation.  Fixes hibernate on 965.
2008-01-28 21:05:22 -08:00
Jesse Barnes bfdddd218e Fixup modeset ioctl number & typedef usage
Should be 0x08 rather than 0xa0, and shouldn't use typedefs.
2008-01-24 21:13:33 -08:00
Dave Airlie c57f43e3a2 i915/flush: get the ret the right way around 2008-01-23 16:45:09 +10:00
Jesse Barnes 0cd4cbc9a6 Merge branch 'master' into vblank-rework, including mach64 support
Conflicts:

	linux-core/drmP.h
	linux-core/drm_drv.c
	shared-core/i915_drv.h
	shared-core/i915_irq.c
	shared-core/mga_irq.c
	shared-core/radeon_irq.c
	shared-core/via_irq.c

Mostly trivial conflicts.

mach64 support from Mathieu Bérard.
2008-01-22 09:42:37 -08:00
Kyle McMartin c6f175cbea i915: fix invalid opcode exception on cpus without clflush
i915_flush_ttm was unconditionally executing a clflush instruction
to (obviously) flush the cache. Instead, check if the cpu supports
clflush, and if not, fall back to calling wbinvd to flush the entire
cache.

Signed-off-by: Kyle McMartin <kmcmartin@redhat.com>
2008-01-17 16:55:44 -08:00
Zhenyu Wang ac6b3780c8 i915: Add chipset id for Intel Integrated Graphics Device
This adds new chipset id in drm.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
2008-01-15 13:06:09 -05:00
Thomas Hellstrom 099e89edf0 Define i915_compat.c upper_32_bits for kernels < 2.6.21 2008-01-15 09:47:04 +01:00
Zou Nan hai 806c1929dc this is to fix a deadloop in drm hang system issue.
(1 << bits) is an undefined value when bits == 32.
 gcc may generate 1 with this expression
 which will lead to an infinite retry loop in
 drm_ht_just_insert_please.
 Because of the different implement of hash_long,
 this  issue is more frequenly see on 64 bit system
2008-01-15 09:19:02 +08:00
Dave Airlie 62df4f0a48 fixup i915 compat resource allocation 2008-01-14 19:38:41 +10:00
Ben Skeggs fa5e18679f nv50: use dummy page in gart tables
Just to be safe, we don't really know exactly how the tables work yet, so
we can't be certain there's a way to say "page not present".
2008-01-07 17:09:00 +11:00
Pekka Paalanen f5e5e5c0ea drm: One forgotten rename of 'mask' to 'proposed_flags'.
Due to commit d1187641d6.
2008-01-05 00:42:38 +02:00
Márton Németh 9ab620d661 drm: cleanup DRM_DEBUG() parameters
As DRM_DEBUG macro already prints out the __FUNCTION__ string (see
drivers/char/drm/drmP.h), it is not worth doing this again. At some
other places the ending "\n" was added.

airlied:- I cleaned up a few that this patch missed also
2008-01-03 16:56:04 +10:00
Xiang, Haihao b9417f4141 i915: return fence argument from i915_execbuffer ioctl32 routine 2007-12-26 17:13:58 +08:00
Xiang, Haihao 5d8d64ad38 i915: i915_execbuffer ioctl32 routine, fix #13732 2007-12-25 16:57:14 +08:00
Keith Packard da3601e43a Change drm_bo_type_dc to drm_bo_type_device and comment usage of this value.
I couldn't figure out what drm_bo_type_dc was for; Dave Airlie finally clued
me in that it was the 'normal' buffer objects with kernel allocated pages
that could be mmapped from the drm device file.

I thought that 'drm_bo_type_device' was a more descriptive name.

I also added a bunch of comments describing the use of the type enum values and
the functions that use them.
2007-12-21 12:16:29 -08:00
Keith Packard d1187641d6 Rename inappropriately named 'mask' fields to 'proposed_flags' instead.
Flags pending validation were stored in a misleadingly named field, 'mask'.
As 'mask' is already used to indicate pieces of a flags field which are
changing, it seems better to use a name reflecting the actual purpose of
this field. I chose 'proposed_flags' as they may not actually end up in
'flags', and in an case will be modified when they are moved over.

This affects the API, but not ABI of the user-mode interface.
2007-12-21 12:16:29 -08:00
Keith Packard 37fb2ac407 Use dummy_read_page for unpopulated kernel-allocated ttm pages.
Previously, dummy_read_page was used only for read-only user allocations; it
filled in pages that were not present in the user address map (presumably,
these were allocated but never written to pages).

This patch allows them to be used for read-only ttms allocated from the
kernel, so that applications can over-allocate buffers without forcing every
page to be allocated.
2007-12-21 12:16:29 -08:00
Keith Packard 881ee70ab7 Move dummy_read_page from drm_ttm_set_user to drm_ttm_create.
I'm hoping to use the dummy_read_page for kernel allocated buffers to avoid
allocating extra pages for read-only buffers (like vertex and batch buffers).
This also eliminates the 'write' parameter to drm_ttm_set_user and just
has DRM_TTM_PAGE_WRITE passed into drm_ttm_create.
2007-12-21 12:16:29 -08:00
Keith Packard 6d44f48002 Clean up and document drm_ttm.c APIs. drm_bind_ttm -> drm_ttm_bind.
Aside from changing drm_bind_ttm to drm_ttm_bind, this patch
adds only documentation and fixes the functions inside drm_ttm.c
to all be prefixed with drm_ttm_.
2007-12-21 12:16:29 -08:00
Keith Packard 0b031dbd63 Document drm_ttm_set_user.
Add a comment explaining the parameters for this function
2007-12-15 12:10:42 -08:00
Keith Packard 9d17373ffb Document drm_buffer_object_validate function.
Just add documentation for this function, no code changes.
2007-12-15 12:10:42 -08:00
Keith Packard 7461519fed Document fence_class mess in drm_bo_setstatus_ioctl
drmBOSetStatus does not bother to set the fence_class parameter.
Fortunately, drm_bo_setstatus_ioctl doesn't end up using it as it
calls drm_bo_handle_validate with use_old_fence_class = 1.
2007-12-15 12:10:42 -08:00
Keith Packard 5f23519b14 Document drm_bo_handle_validate. Match drm_bo_do_validate parameter order.
Document parameters and usage for drm_bo_handle_validate. Change parameter
order to match drm_bo_do_validate (fence_class has been moved to after
flags, hint and mask values). Existing users of this function have been
changed, but out-of-tree users must be modified separately.
2007-12-15 12:10:42 -08:00
Keith Packard b5181d2506 Document drm_bo_do_validate. Remove spurious 'do_wait' parameter.
Add comments about the parameters to drm_bo_do_validate, along
with comments for the DRM_BO_HINT options. Remove the 'do_wait'
parameter as it is duplicated by DRM_BO_HINT_DONT_BLOCK.
2007-12-15 12:10:42 -08:00
Keith Packard b0bc5f1ae5 Make ttm create/destroy APIs consistent. Pass page_flags in create.
Creating a ttm was done with drm_ttm_init while destruction was done with
drm_destroy_ttm. Renaming these to drm_ttm_create and drm_ttm_destroy makes
their use clearer. Passing page_flags to the create function will allow that
to know whether user or kernel pages are needed, with the goal of allowing
kernel ttms to be saved for later reuse.
2007-12-15 12:10:41 -08:00
Alan Hourihane 35a8b61317 catch an out of memory condition 2007-12-13 10:40:36 +00:00
Dave Airlie cfa21b22b4 drm: move agp include outside CONFIG_AGP as it isn't dependant on agp in kernel 2007-12-10 10:13:52 +10:00
Dave Airlie f1a99ddc14 take down stuff after asking driver to unload 2007-12-06 16:03:28 +10:00
Dave Airlie 2f6e533421 patch from -mm kernel to use upper_32_bits 2007-12-05 04:56:54 +10: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
Dave Airlie 32c9a109b1 drm: enable udev node creation 2007-11-29 09:47:24 +10:00
Dave Airlie 4602b6687e drm: oops not a cleanup.. 2007-11-29 09:46:02 +10:00
Dave Airlie dc338921f9 drm: more cleanups 2007-11-29 09:38:21 +10:00
Dave Airlie 5dc5c36e62 drm: major whitespace/coding style realignment with kernel 2007-11-22 16:10:36 +10:00
Dave Airlie 7bf05708b6 drm: cleanup drm_regman.c coding style 2007-11-22 13:29:17 +10:00
Jerome Glisse 09e51db77b drm: don't reset to 0 irq_enabled when client open file descriptor 2007-11-21 18:58:29 +01:00
Jerome Glisse 648b5b582a drm: fix dead lock in drm_buffer_object_transfer 2007-11-19 14:37:21 +01:00
Jeremy Kolb f2c8d39a0f nouveau: rename 2007-11-15 22:11:35 -05:00