Commit graph

56 commits

Author SHA1 Message Date
Ben Skeggs 03bc9675d3 drm/nouveau: allow modeset module option to select 'headless mode'
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:16 +10:00
Ben Skeggs 6c320fef58 drm/nouveau: pass flag to engine fini() method on suspend
It may not be necessary to fail in certain cases (such as failing to idle)
on module unload, whereas on suspend it's important to ensure a consistent
state can be restored on resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:43:22 +10:00
Ben Skeggs 180cc30637 drm/nouveau: convert bo.mem.start usage to bo.offset
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:44 +10:00
Ben Skeggs 639212d011 drm/nouveau/gem: implement stub hooks for GEM object open/close
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:02 +10:00
Ben Skeggs 3f0a68d8f8 drm/nouveau: allocate structure to store per-client data
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:15 +10:00
Ben Skeggs 0411de8548 drm/nvc0/gr: import and use our own fuc by default
The ability to use NVIDIA's fuc has been retained *temporarily* in order
to better debug any issues that may be lingering in our initial attempt
at writing this ucode.  Once I'm fairly confident we're okay, it'll be
removed.

There's a number of things not implemented by this fuc currently, but
most of it is sets of state that our context setup would not have used
anyway.  No doubt we'll find out what they're for at some point, and
implement it if required.

This has been tested on 0xc0/0xc4 thus far, and from what I could tell
it worked as well as NVIDIA's.  It's also been tested on 0xc1, but even
with NVIDIA's fuc that chipset doesn't work correctly with nouveau yet.

0xc3/0xc8/0xce should in theory be supported too, but I don't have the
hardware to check that.

There's no doubt numerous bugs to squash yet, please report any!

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:38 +10:00
Ben Skeggs aba99a8400 drm/nouveau: default to noaccel on 0xc1/0xc8/0xce for now
Until we know these should work properly, would much rather default to
noaccel than risk giving people corruption/hangs out of the box..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:28 +10:00
Ben Skeggs a82dd49f14 drm/nouveau: remove remnants of nouveau_pgraph_engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:45 +10:00
Ben Skeggs 92abe74992 drm/nouveau: fix suspend failure path to reinitialise all engines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:42 +10:00
Ben Skeggs 2703c21a82 drm/nv50/gr: move to exec engine interfaces
This needs a massive cleanup, but to catch bugs from the interface changes
vs the engine code cleanup, this will be done later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:06 +10:00
Ben Skeggs 6dfdd7a61e drm/nouveau: working towards a common way to represent engines
There's lots of more-or-less independant engines present on NVIDIA GPUs
these days, and we generally want to perform the same operations on them.
Implementing new ones requires hooking into lots of different places,
the aim of this work is to make this simpler and cleaner.

NV84:NV98 PCRYPT moved over as a test.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:01 +10:00
Dave Airlie 8410ea3b95 drm: rework PCI/platform driver interface.
This abstracts the pci/platform interface out a step further,
we can go further but this is far enough for now to allow USB
to be plugged in.

The drivers now just call the init code directly for their
device type.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-07 13:09:36 +10:00
Torben Hohn ac751efa6a console: rename acquire/release_console_sem() to console_lock/unlock()
The -rt patches change the console_semaphore to console_mutex.  As a
result, a quite large chunk of the patches changes all
acquire/release_console_sem() to acquire/release_console_mutex()

This commit makes things use more neutral function names which dont make
implications about the underlying lock.

The only real change is the return value of console_trylock which is
inverted from try_acquire_console_sem()

This patch also paves the way to switching console_sem from a semaphore to
a mutex.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: make console_trylock return 1 on success, per Geert]
Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Thomas Gleixner <tglx@tglx.de>
Cc: Greg KH <gregkh@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-26 10:50:06 +10:00
Dave Airlie 5bcf719b7d drm/switcheroo: track state of switch in drivers.
We need to track the state of the switch in drivers, so that after s/r
we don't resume the card we've explicitly switched off before. Also
don't allow a userspace open to occur if we've switched the gpu off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-01-05 13:45:30 +10:00
Ben Skeggs 4c13614298 drm/nv50: implement global channel address space on new VM code
As of this commit, it's guaranteed that if an object is in VRAM that its
GPU virtual address will be constant.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:13 +10:00
Francisco Jerez 6dccd311dd drm/nouveau: Synchronize with the user channel before GPU object destruction.
There have been reports of PFIFO cache errors during context take down
(fdo bug 31637). They are caused by some GPU objects being taken out
while the channel is still potentially processing commands. Make sure
that all the previous rendering has landed before releasing a GPU
object.

Reported-by: Grzesiek Sójka <pld@pfu.pl>
Reported-by: Patrice Mandin <patmandin@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 03:00:23 +01:00
Ben Skeggs dc1e5c0dbf drm/nouveau: simplify gpuobj suspend/resume
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:11:47 +10:00
Francisco Jerez 042206c0cd drm/nouveau: Implement the vblank DRM hooks.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:11:11 +10:00
Marcin Slusarz 382d62e524 drm/nouveau: fix annoying nouveau_fence type issue
nouveau_fence_* functions are not type safe, which could lead to bugs.
Additionally every use of nouveau_fence_unref had to cast struct
nouveau_fence to void **.
Fix it by renaming old functions and creating static inline functions with
new prototypes. We still need old functions, because we pass function
pointers to ttm.
As we are wrapping functions, drop unused "void *arg" parameter where possible.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:11:07 +10:00
Ben Skeggs 35fa2f2ad1 drm/nouveau: add support for MSI
Only supported on NV50+ so far, and disabled by default currently.  The
module parameter "msi=1" will enable it.

There's a kernel bug which will cause this to fail if the module (or the
NVIDIA binary driver) has ever been loaded before loading nouveau with
MSI enabled.  As such, this is only safe to enable if you have nouveau
load on boot, and don't wish to ever reload it.

The workaround is to "echo 0 > /sys/bus/pci/devices/<device>/enable"
until the enable count reads 0.  Then you should be able to load nouveau
with MSI enabled.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:11:03 +10:00
Ben Skeggs bd2e597de8 drm/nv84: add support for the PCRYPT engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:06:58 +10:00
Ben Skeggs cff5c13324 drm/nouveau: add more fine-grained locking to channel list + structures
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:05:18 +10:00
Linus Torvalds c48c43e422 Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (476 commits)
  vmwgfx: Implement a proper GMR eviction mechanism
  drm/radeon/kms: fix r6xx/7xx 1D tiling CS checker v2
  drm/radeon/kms: properly compute group_size on 6xx/7xx
  drm/radeon/kms: fix 2D tile height alignment in the r600 CS checker
  drm/radeon/kms/evergreen: set the clear state to the blit state
  drm/radeon/kms: don't poll dac load detect.
  gpu: Add Intel GMA500(Poulsbo) Stub Driver
  drm/radeon/kms: MC vram map needs to be >= pci aperture size
  drm/radeon/kms: implement display watermark support for evergreen
  drm/radeon/kms/evergreen: add some additional safe regs v2
  drm/radeon/r600: fix tiling issues in CS checker.
  drm/i915: Move gpu_write_list to per-ring
  drm/i915: Invalidate the to-ring, flush the old-ring when updating domains
  drm/i915/ringbuffer: Write the value passed in to the tail register
  agp/intel: Restore valid PTE bit for Sandybridge after bdd3072
  drm/i915: Fix flushing regression from 9af90d19f
  drm/i915/sdvo: Remove unused encoding member
  i915: enable AVI infoframe for intel_hdmi.c [v4]
  drm/i915: Fix current fb blocking for page flip
  drm/i915: IS_IRONLAKE is synonymous with gen == 5
  ...

Fix up conflicts in
 - drivers/gpu/drm/i915/{i915_gem.c, i915/intel_overlay.c}: due to the
   new simplified stack-based kmap_atomic() interface
 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c: added .llseek entry due to BKL
   removal cleanups.
2010-10-26 18:57:59 -07:00
Marcin Kościelnicki 0cba1b7644 drm/nouveau: Add a module option to force card POST.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-10-05 09:58:52 +10:00
Ben Skeggs 64f1c11a47 drm/nouveau: restore perflvl on resume, and restore boot perflvl on unload
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:35 +10:00
Ben Skeggs 6f876986be drm/nouveau: allow static performance level setting
Guarded by a module parameter for the moment, read the code for the
magic value which enables it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:20 +10:00
Francisco Jerez de5899bdac drm/nouveau: Add module parameter to override the default AGP rate.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:16 +10:00
Arnd Bergmann dc880abef7 drm: use noop_llseek
The drm device drivers currently allow seeking on the
character device but never care about the actual
file position.

When we change the default llseek operation to be
no_llseek, calling llseek on a drm device would
return an error condition, which is an API change.

Explicitly setting noop_llseek lets us keep the
current API.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
2010-09-16 10:33:07 +02:00
Daniel Vetter cbc60ca04b drm: kill get_reg_ofs callback
Every driver used the default implementation. Fold that one into
the only callsite and drop the callback.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-30 09:44:56 +10:00
Daniel Vetter 793a97e4cc drm: kill drm_map_ofs callbacks
All drivers happily copy&pasted the default implementation without
checking whether this callback is used at all. It's not. Sigh.

Kill it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-30 09:38:50 +10:00
Francisco Jerez c88c2e0631 drm/nouveau: Move display init to a new nouveau_engine.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:36 +10:00
Francisco Jerez e04d8e829d drm/nouveau: Reset AGP before running the init scripts.
BIOS scripts usually make an attempt to reset the AGP controller,
however on some nv4x cards doing it properly involves switching FW off
and on: if we do that without updating the AGP bridge settings
accordingly (e.g. with the corresponding calls to agp_enable()) we
will be locking ourselves out of the card MMIO space. Do it from
nouveau_mem_reset_agp() before the init scripts are executed.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:25 +10:00
Francisco Jerez 03cd06ca90 drm/nouveau: No need to lock/unlock the VGA CRTC regs all the time.
Locking only makes sense in the VBIOS parsing code as it's executed
before CRTC init.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:42 +10:00
Ben Skeggs ec91db269e drm/nouveau: remove ability to use external firmware
This was always really a developer option, and if it's really necessary we
can hack this in ourselves.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:43 +10:00
Francisco Jerez 6e86e04194 drm/nouveau: Fix a couple of sparse warnings.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:23 +10:00
Ben Skeggs cd0b072f95 drm/nouveau: remove left-over !DRIVER_MODESET paths
It's far preferable to have the driver do nothing at all for "nomodeset".

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:12:58 +10:00
Ben Skeggs 2dfe36b1b6 drm/nouveau: place notifiers in system memory by default
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 09:41:00 +10:00
Dave Airlie db8cc27b80 Merge branch 'drm-platform' into drm-testing
* drm-platform:
  drm: Make sure the DRM offset matches the CPU
  drm: Add __arm defines to DRM
  drm: Add support for platform devices to register as DRM devices
  drm: Remove drm_resource wrappers
2010-07-07 18:37:35 +10:00
Jordan Crouse dcdb167402 drm: Add support for platform devices to register as DRM devices
Allow platform devices without PCI resources to be DRM devices.

[airlied: fixup warnings with dev pointers]

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-06-01 10:07:39 +10:00
Maarten Maathuis b334f2b3b6 drm/nouveau: allow cursor image and position to survive suspend
- This isn't triggered yet on a normal kernel, because it still does a VT
switch, but it seemed like a good idea to fix this now.

Tested-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-05-28 16:06:17 +10:00
Dave Airlie 386516744b drm/fb: fix fbdev object model + cleanup properly.
The fbdev layer in the kms code should act like a consumer of the kms services and avoid having relying on information being store in the kms core structures in order for it to work.

This patch

a) removes the info pointer/psuedo palette from the core drm_framebuffer structure and moves it to the fbdev helper layer, it also removes the core drm keeping a list of kernel kms fbdevs.
b) migrated all the fb helper functions out of the crtc helper file into the fb helper file.
c) pushed the fb probing/hotplug control into the driver
d) makes the surface sizes into a structure for ease of passing
This changes the intel/radeon/nouveau drivers to use the new helper.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-04-07 10:21:03 +10:00
Dave Airlie d5e5deddf6 Merge remote branch 'nouveau/for-airlied' into drm-linus
* nouveau/for-airlied:
  drm/nouveau: add module option to disable TV detection
  drm/nouveau: Never evict VRAM buffers to system.
  drm/nv50: fix connector table parsing for some cards
  drm/nv50: add a memory barrier to pushbuf submission
  drm/nouveau: print a message very early during suspend
  drm/nv04-nv40: Fix up the programmed horizontal sync pulse delay.
  drm/nouveau: Gigabyte NX85T connector table lies, it has DVI-I not HDMI
  drm/nouveau: add option to allow override of dcb connector table types
  drm/nv50: Improve PGRAPH interrupt handling.
  drm/nv50: Make ctxprog wait until interrupt handler is done.
  drm/nouveau: Fix fbcon corruption with font width not divisible by 8
  drm/nv50: Remove redundant/incorrect ctxvals initialisation.
2010-03-15 11:07:33 +10:00
Ben Skeggs f405350966 drm/nouveau: add module option to disable TV detection
Intended to be used as a workaround in cases where we falsely detect
that a TV is connected when it's not.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-15 09:47:00 +10:00
Maarten Maathuis 81441570c9 drm/nouveau: print a message very early during suspend
- In case of suspend lockups it's nice to know it happened in nouveau.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:07:27 +10:00
Ben Skeggs da647d5bf3 drm/nouveau: add option to allow override of dcb connector table types
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:07:07 +10:00
Dave Airlie 1c62233508 Merge branch 'gpu-switcher' of /ssd/git//linux-2.6 into drm-next-stage
* 'gpu-switcher' of /ssd/git//linux-2.6:
  vga_switcheroo: initial implementation (v15)
  fb: for framebuffer handover don't exit the loop early.

Conflicts:
	drivers/gpu/drm/i915/i915_dma.c
	drivers/gpu/drm/radeon/Makefile
	drivers/gpu/drm/radeon/radeon.h
2010-03-01 16:22:38 +10:00
Dave Airlie 6a9ee8af34 vga_switcheroo: initial implementation (v15)
Many new laptops now come with 2 gpus, one to be used for low power
modes and one for gaming/on-ac applications. These GPUs are typically
wired to the laptop panel and VGA ports via a multiplexer unit which
is controlled via ACPI methods.

4 combinations of systems typically exist - with 2 ACPI methods.
Intel/ATI - Lenovo W500/T500 - use ATPX ACPI method
ATI/ATI - some ASUS - use ATPX ACPI Method
Intel/Nvidia - - use _DSM ACPI method
Nvidia/Nvidia -  - use _DSM ACPI method.

TODO:
This patch adds support for the ATPX method and initial bits
for the _DSM methods that need to written by someone with
access to the hardware.
Add a proper non-debugfs interface - need to get some proper
testing first.

v2: add power up/down support for both devices
on W500 puts i915/radeon into D3 and cuts power to radeon.

v3: redo probing methods, no DMI list, drm devices call to
register with switcheroo, it tries to find an ATPX method on
any device and once there is two devices + ATPX it inits the
switcher.

v4: ATPX msg handling using buffers - should work on more machines

v5: rearchitect after more mjg59 discussion - move ATPX handling to
    radeon driver.

v6: add file headers + initial nouveau bits (to be filled out).

v7: merge delayed switcher code.

v8: avoid suspend/resume of gpu that is off

v9: rearchitect - mjg59 is always right. - move all ATPX code to
radeon, should allow simpler DSM also proper ATRM handling

v10: add ATRM support for radeon BIOS, add mutex to lock vgasr_priv

v11: fix bug in resuming Intel for 2nd time.

v12: start fixing up nvidia code blindly.

v13: blindly guess at finishing nvidia code

v14: remove radeon audio hacks - fix up intel resume more like upstream

v15: clean up printks + remove unnecessary igd/dis pointers

mount debugfs

/sys/kernel/debug/vgaswitcheroo/switch - should exist if ATPX detected
 + 2 cards.

DIS - immediate change to discrete
IGD - immediate change to IGD
DDIS - delayed change to discrete
DIGD - delayed change to IGD
ON - turn on not in use
OFF - turn off not in use

Tested on W500 (Intel/ATI) and T500 (Intel/ATI)

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-03-01 16:20:37 +10:00
Marcin Kościelnicki 81e2d42200 drm/nouveau: Fix noaccel/nofbaccel option descriptions.
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:40 +10:00
Marcin Kościelnicki a32ed69d7b drm/nouveau: Add module options to disable acceleration.
noaccel=1 disables all acceleration and doesn't even attempt
initialising PGRAPH+PFIFO, nofbaccel=1 only makes fbcon unaccelerated.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-09 12:47:59 +10:00
Ben Skeggs f927b8907c drm/nouveau: fix non-vram notifier blocks
Due to a thinko, these were previously forced to VRAM even if we allocated
them in GART.

This commit fixes that bug, but keeps the previous behaviour of using VRAM
by default until it's been tested properly across more chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-09 12:47:52 +10:00