History log of /drivers/gpu/drm/radeon/radeon_kms.c
Revision Date Author Comments
c1b2f69f816fc5442563a68c4365dbded6450af8 20-Mar-2012 Michel Dänzer <michel.daenzer@amd.com> drm/radeon: Update radeon_info_ioctl for SI. (v2)

v2: agd5f: add new MAX_PIPES param

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
609c1e15a44c25f722fb93e18668da30179a172f 20-Mar-2012 Tom Stellard <tstellar@gmail.com> drm/radeon/kms: add info query for max pipes

The maximum number of pipes is needed by the user space compute
driver to calculate the number of wavefronts per thread group.

Signed-off-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
466e69b8b03b8c1987367912782bc12988ad8794 19-Dec-2011 Dave Airlie <airlied@redhat.com> drm: move pci bus master enable into driver.

The current enabling of bus mastering in the drm midlayer allows a large
race condition under kexec. When a kexec'ed kernel re-enables bus mastering
for the GPU, previously setup dma blocks may cause writes to random pieces
of memory. On radeon the writeback mechanism can cause these sorts of issues.

This patch doesn't fix the problem, but it moves the bus master enable under
the individual drivers control so they can move enabling it until later in
their load cycle and close the race.

Fix for radeon kms driver will be in a follow-up patch.

Signed-off-by: Dave Airlie <airlied@redhat.com>
721604a15b934f0a8d1909acb8017f029128be2f 06-Jan-2012 Jerome Glisse <jglisse@redhat.com> drm/radeon: GPU virtual memory support v22

Virtual address space are per drm client (opener of /dev/drm).
Client are in charge of virtual address space, they need to
map bo into it by calling DRM_RADEON_GEM_VA ioctl.

First 16M of virtual address space is reserved by the kernel.

Once using 2 level page table we should be able to have a small
vram memory footprint for each pt (there would be one pt for all
gart, one for all vram and then one first level for each virtual
address space).

Plan include using the sub allocator for a common vm page table
area and using memcpy to copy vm page table in & out. Or use
a gart object and copy things in & out using dma.

v2: agd5f fixes:
- Add vram base offset for vram pages. The GPU physical address of a
vram page is FB_OFFSET + page offset. FB_OFFSET is 0 on discrete
cards and the physical bus address of the stolen memory on
integrated chips.
- VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR covers all vmid's >= 1

v3: agd5f:
- integrate with the semaphore/multi-ring stuff

v4:
- rebase on top ttm dma & multi-ring stuff
- userspace is now in charge of the address space
- no more specific cs vm ioctl, instead cs ioctl has a new
chunk

v5:
- properly handle mem == NULL case from move_notify callback
- fix the vm cleanup path

v6:
- fix update of page table to only happen on valid mem placement

v7:
- add tlb flush for each vm context
- add flags to define mapping property (readable, writeable, snooped)
- make ring id implicit from ib->fence->ring, up to each asic callback
to then do ring specific scheduling if vm ib scheduling function

v8:
- add query for ib limit and kernel reserved virtual space
- rename vm->size to max_pfn (maximum number of page)
- update gem_va ioctl to also allow unmap operation
- bump kernel version to allow userspace to query for vm support

v9:
- rebuild page table only when bind and incrementaly depending
on bo referenced by cs and that have been moved
- allow virtual address space to grow
- use sa allocator for vram page table
- return invalid when querying vm limit on non cayman GPU
- dump vm fault register on lockup

v10: agd5f:
- Move the vm schedule_ib callback to a standalone function, remove
the callback and use the existing ib_execute callback for VM IBs.

v11:
- rebase on top of lastest Linus

v12: agd5f:
- remove spurious backslash
- set IB vm_id to 0 in radeon_ib_get()

v13: agd5f:
- fix handling of RADEON_CHUNK_ID_FLAGS

v14:
- fix va destruction
- fix suspend resume
- forbid bo to have several different va in same vm

v15:
- rebase

v16:
- cleanup left over of vm init/fini

v17: agd5f:
- cs checker

v18: agd5f:
- reworks the CS ioctl to better support multiple rings and
VM. Rather than adding a new chunk id for VM, just re-use the
IB chunk id and add a new flags for VM mode. Also define additional
dwords for the flags chunk id to define the what ring we want to use
(gfx, compute, uvd, etc.) and the priority.

v19:
- fix cs fini in weird case of no ib
- semi working flush fix for ni
- rebase on top of sa allocator changes

v20: agd5f:
- further CS ioctl cleanups from Christian's comments

v21: agd5f:
- integrate CS checker improvements

v22: agd5f:
- final cleanups for release, only allow VM CS on cayman

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
83f30d0e0343ad010afbc3523007b68e8b439694 27-Oct-2011 Dave Airlie <airlied@redhat.com> Revert "drm/radeon/kms: add a new gem_wait ioctl with read/write flags"

This reverts commit d3ed74027f1dd197b7e08247a40d3bf9be1852b0.

Further upstream discussion between Thomas and Marek decided this needed
more work and driver specifics. So revert before it goes upstream.

Signed-off-by: Dave Airlie <airlied@redhat.com>
d3ed74027f1dd197b7e08247a40d3bf9be1852b0 07-Aug-2011 Marek Olšák <maraeo@gmail.com> drm/radeon/kms: add a new gem_wait ioctl with read/write flags

The new DRM_RADEON_GEM_WAIT ioctl combines GEM_WAIT_IDLE and GEM_BUSY (there
is a NO_WAIT flag to get the latter) with USAGE_READ and USAGE_WRITE flags
to take advantage of the new ttm_bo_wait changes.

Also bump the DRM version.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
e55b9422e186d208f162f056ee28b6eb6b9b81a9 15-Jul-2011 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms: add info query for backend map

The 3D driver need to get the pipe to backend
map to certain things. Add a query to get the
info.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
58b6542b50ded4243c26c251c0507e5f658642f6 27-Jun-2011 Jon Mason <jdmason@kudzu.us> DRM: remove drm_pci_device_is_pcie

drm_pci_device_is_pcie duplicates the funcationality of pci_is_pcie.
Convert callers of the former to the latter. This has the side benefit
of removing an unnecessary search in the PCI configuration space due to
using a saved PCIe capability offset.

[airlied: update for new callsite]

Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8aeb96f80232e9a701b5c4715504f4c9173978bd 04-May-2011 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms: fix gart setup on fusion parts (v2)

Out of the entire GART/VM subsystem, the hw designers changed
the location of 3 regs.

v2: airlied: add parameter for userspace to work from.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
6565945b60922211c299968ba66a66617af32c9f 26-Apr-2011 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms: add info query for tile pipes

needed by mesa for htile setup.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
fecf1d072f96114266ed3aae8c4fb93f9c179b00 03-Mar-2011 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms: add gpu_init function for cayman

This may some work to get accel going.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
486af1896f3a4a388410215c5a2014b9d09a79f5 01-Mar-2011 Dave Airlie <airlied@redhat.com> drm/radeon: add new getparam for number of backends.

This allows userspace to work out how many DBs there are
for conditional rendering to work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8410ea3b95d105a5be5db501656f44bbb91197c1 14-Dec-2010 Dave Airlie <airlied@gmail.com> 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>
dca0d6129f3ec77bcf42ce85bcd64c87e5cf0c04 27-Jan-2011 Marek Olšák <maraeo@gmail.com> drm/radeon/kms: release CMASK access in preclose_kms

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
58bbf018a70c562437eeae121a5d021ba7fe56a5 24-Jan-2011 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms: add new radeon_info ioctl query for clock crystal freq

Needed for timer queries in the 3D driver.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
9eba4a93ce520a627e876b0d1851d4f78a701c2b 05-Jan-2011 Marek Olšák <maraeo@gmail.com> drm/radeon/kms: manage r300 CMASK RAM access and allow CMASK clear

The CMASK RAM is for colorbuffer compression (used in conjunction
with MSAA). Only one user (filp) can access it.

The CMASK RAM access is managed in the same way as Hyper-Z, but there is
a separate ioctl, because an app that uses MSAA does not necessarily
have to use zbuffering.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5bcf719b7db0f9366cedaf102b081f99b1c325ae 07-Dec-2010 Dave Airlie <airlied@redhat.com> 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>
f5a8020903932624cf020dc72455a10a3e005087 23-Oct-2010 Mario Kleiner <mario.kleiner@tuebingen.mpg.de> drm/kms/radeon: Add support for precise vblank timestamping.

This patch adds new functions for use by the drm core:

.get_vblank_timestamp() provides a precise timestamp
for the end of the most recent (or current) vblank
interval of a given crtc, as needed for the DRI2
implementation of the OML_sync_control extension.

It is a thin wrapper around the drm function
drm_calc_vbltimestamp_from_scanoutpos() which does
almost all the work and is shared across drivers.

.get_scanout_position() provides the current horizontal
and vertical video scanout position and "in vblank"
status of a given crtc, as needed by the drm for use by
drm_calc_vbltimestamp_from_scanoutpos().

The function is also used by the dynamic gpu reclocking
code to determine when it is safe to reclock inside vblank.

For that purpose radeon_pm_in_vbl() is modified to
accomodate a small change in the function prototype of
the radeon_get_crtc_scanoutpos() which is hooked up to
.get_scanout_position().

This code has been tested on AVIVO hardware, a RV530
(ATI Mobility Radeon X1600) in a Intel Core-2 Duo MacBookPro
and some R600 variant (FireGL V7600) in a single cpu
AMD Athlon 64 PC.

Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5222454cf941b09205d502242dd1e44fd62aa551 21-Sep-2010 Dave Airlie <airlied@redhat.com> drm/radeon: don't allow device to be opened if powered down

If the switcheroo has switched the device off, don't let X open it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
b824b364d9ee001fc8c6bb71cc49f19bf740dd99 12-Aug-2010 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms: add back missing break in info ioctl

This seems to have gotten lost in the hyper-z merge.

Noticed by legume on IRC.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
1b2f1489633888d4a06028315dc19d65768a1c05 14-Aug-2010 Dave Airlie <airlied@redhat.com> drm: block userspace under allocating buffer and having drivers overwrite it (v2)

With the current screwed but its ABI, ioctls for the drm, Linus pointed out that we could allow userspace to specify the allocation size, but we pass it to the driver which then uses it blindly to store a struct. Now if userspace specifies the allocation size as smaller than the driver needs, the driver can possibly overwrite memory.

This patch restructures the driver ioctls so we store the structure size we are expecting, and make sure we allocate at least that size. The copy from/to userspace are still restricted to the size the user specifies, this allows ioctl structs to grow on both sides of the equation.

Up until now we didn't really use the DRM_IOCTL defines in the kernel, so this cleans them up and adds them for nouveau.

v2:
fix nouveau pushbuf arg (thanks to Ben for pointing it out)

Reported-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
43861f713c17223cd0fa87dcb57308b7cde7c10a 07-Aug-2010 Marek Olšák <maraeo@gmail.com> drm/radeon: add a way to revoke hyper-z access

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
d8ab35575098b2d6dc10b2535aeb40545933ae56 02-Aug-2010 Dr. David Alan Gilbert <linux@treblig.org> drm/radeon/kms: add missing copy from user

This hasn't mattered up until the ioctl started using the value, and it fell
apart.

fixes fd.o 29340, Ubuntu LP 606081

[airlied: cleaned up whitespace and don't need an error before pushing]

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
dc77de12dde95c8da39e4c417eb70c7d445cf84b 04-Aug-2010 Dave Airlie <airlied@redhat.com> drm/radeon: tone down overchatty acpi debug messages.

On non laptop systems we'll see these the whole time, so make them
less important.

Signed-off-by: Dave Airlie <airlied@redhat.com>
ab9e1f5966591dc3e811418e96ba04f284c52458 13-Jul-2010 Dave Airlie <airlied@redhat.com> drm/radeon: add basic zmask/hiz support (v4)

This interface allows userspace to request hyperz support, it probably
needs more locking, and really reporting that you can have hyperz is racy
since someone else might get it before you do.

v2: modify so we pass 0 valued packets to let DDX/r300c keep working.
also fixed incorrect 0x4f1c reference.

v3: fixup zb_bw_cntl so older drivers keep working

v4: add locking, fixup SC_HYPERZ_EN - patch stream to disable hiz

Signed-off-by: Dave Airlie <airlied@redhat.com>
d9fdaafbe912a34ef06ed569c6606fe2811f325b 02-Aug-2010 Dave Airlie <airlied@redhat.com> drm/radeon/kms: move a bunch of modesetting debug to correct debug usage.

This migrates a bunch of DRM_DEBUG->DRM_DEBUG_KMS so we can get more modesetting related info without all the other ioctl handling easily.

Also the PM code moves to DRM_DEBUG_DRIVER mostly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
e7aeeba6a8fb86ac52bcffa0b72942f784f2b37f 04-Jun-2010 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms/r6xx+: add query for tile config (v2)

Userspace needs this information to access tiled
buffers via the CPU.

v2: rebased on evergreen accel changes

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
d7a2952f1adec32018a78ec0c2f504dd72f38e25 06-Jul-2010 Alberto Milone <alberto.milone@canonical.com> drm/radeon: Add support for the ATIF ACPI method to the radeon driver

By calling the ATIF method in the radeon driver we can make sure
that hotkeys such as the video switch key emit ACPI events when
pressed.

agd5f: fix warning

Signed-off-by: Alberto Milone <alberto.milone@canonical.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
0baf2d8fe43fdd81faa30e65ff71785c99c78520 21-Jul-2010 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms: fix RADEON_INFO_CRTC_FROM_ID info ioctl

Return the crtc_id, not the counter value. They are not
necessarily the same.

Cc: Jerome Glisse <glisse@freedesktop.org>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
148a03bc0b0e3ef153d0cade7bc88e9b14edfb7a 04-Jun-2010 Alex Deucher <alexdeucher@gmail.com> drm/radeon/kms/evergreen: set accel_enabled

This is needed to enable accel in the ddx. However,
due to a bug in older versions of the ddx, it relies
on accel being disabled in order to load properly on
evergreen chips. To maintain compatility, we add a new
get accel param and call that from the ddx. The old one
always returns false for evergreen cards.

[this fixes a regression with older userspaces on newer kernels].

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
bc35afdb182d4c48c889fe27ba7a5d7ea0c8194d 12-May-2010 Jerome Glisse <jglisse@redhat.com> drm/radeon/kms: add query for crtc hw id from crtc id to get info V2

Userspace need to know the hw crtc id (0, 1, 2, ...) from the drm
crtc id. Bump the minor version so userspace can enable conditionaly
features depend on this.

V2 use num_crtc and avoid DRM_ERROR

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9c950a43dd4d1e22a4b893c991871bac26930f97 23-Apr-2010 Dave Airlie <airlied@redhat.com> drm/radeon/kms: don't print error for legal crtcs.

With evergreen this is bounded by num_crtc not by 0,1.

Signed-off-by: Dave Airlie <airlied@redhat.com>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
6a9ee8af344e3bd7dbd61e67037096cdf7f83289 01-Feb-2010 Dave Airlie <airlied@linux.ie> 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>
a0c07a69bc5d060362e4861d6c4f7c67dab57f1e 03-Feb-2010 Dave Airlie <airlied@redhat.com> drm/radeon/kms: switch all KMS driver ioctls to unlocked.

Internal locking should be sufficent for all these cases.

Signed-off-by: Dave Airlie <airlied@redhat.com>
cf0fe4566dcc0c5bd9b7da8c9a53e712593db118 09-Dec-2009 Jerome Glisse <jglisse@redhat.com> drm/radeon/kms: cleanup structure and module if initialization fails

This would allow us to properly unload others module like TTM if
initialization fails after we initiliazed TTM structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
e3590096f7563c6e75b77336ab8775f9a168b0f6 23-Sep-2009 Dave Airlie <airlied@redhat.com> drm/radeon/kms: remove unneeded master create/destroy functions.

We shouldn't need these at all in radeon kms mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
733289c2656c556d5cf36eafa1c8ec77222c359f 16-Sep-2009 Jerome Glisse <jglisse@redhat.com> drm/radeon/kms: don't fail if we fail to init GPU acceleration

Userspace can query if acceleration is working or not true get
info ioctl and could fallback to software if for some reason
kernel failed to initialize KMS. This should allow to give a
working KMS setup in all case (even with non functionning accel).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6cf8a3f58806f12b975a89cfd7edf01566ff80a0 10-Sep-2009 Jerome Glisse <jglisse@redhat.com> drm/radeon/kms: move modeset init outside of GPU init

We are splitting GPU & modeset init so that it's easier
to abord only remaining GPU init when somethings fails.
We want to always provide enough funcionalities to get
fbcon and a shadowfb X working. Only acceptable error
during initialization are memory allocation failure or
io mapping failure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
f779b3e513478218cbaaaa0a506d7801cab6fd14 20-Aug-2009 Alex Deucher <alexdeucher@gmail.com> drm/radeon: add GET_PARAM/INFO support for Z pipes

Needed for occlusion queries on rv530 chips.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
e3b2415e281a97ade36d88404094a90cfea838c0 21-Aug-2009 Dave Airlie <airlied@redhat.com> drm/radeon/kms: implement the bo busy ioctl properly.

The previous patch assumes the ioctl already existed, when
it actually didn't.

It also didn't return the correct error code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7ed220d738cf16adff6bc3b31ad25b8848a2fa9c 13-Aug-2009 Michel Dänzer <daenzer@vmware.com> drm/radeon/kms: Fix up vertical blank interrupt support.

Fixes 3D apps timing out in the WAIT_VBLANK ioctl.

AVIVO bits compile-tested only.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
c9b7fb54f0a51e587fa09be3a85666b43d36a850 29-Jul-2009 Xiaotian Feng <dfeng@redhat.com> drm/radeon/kms: fix memory leak in radeon_driver_load_kms

This patch fixes following kmemleak report:
unreferenced object 0xffff88022cb53000 (size 4096):
comm "work_for_cpu", pid 97, jiffies 4294672345
backtrace:
[<ffffffff810eb222>] create_object+0x19f/0x2a0
[<ffffffff810eb422>] kmemleak_alloc+0x26/0x4c
[<ffffffff810e363f>] __kmalloc+0x187/0x1b0
[<ffffffffa005f3db>] kzalloc.clone.0+0x13/0x15 [radeon]
[<ffffffffa005f403>] radeon_driver_load_kms+0x26/0xe1 [radeon]
[<ffffffffa0017432>] drm_get_dev+0x37f/0x480 [drm]
[<ffffffffa007f424>] radeon_pci_probe+0x15/0x269 [radeon]
[<ffffffff811f8779>] local_pci_probe+0x17/0x1b
[<ffffffff8105ffbb>] do_work_for_cpu+0x18/0x2a
[<ffffffff81063c38>] kthread+0x8a/0x92
[<ffffffff81012cba>] child_rip+0xa/0x20
[<ffffffffffffffff>] 0xffffffffffffffff

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
e024e11070a0a0dc7163ce1ec2da354a638bdbed 24-Jun-2009 Dave Airlie <airlied@redhat.com> drm/radeon/kms: add initial colortiling support.

This adds new set/get tiling interfaces where the pitch
and macro/micro tiling enables can be set. Along with
a flag to decide if this object should have a surface when mapped.

The only thing we need to allocate with a mapped surface should be
the frontbuffer. Note rotate scanout shouldn't require one, and
back/depth shouldn't either, though mesa needs some fixes.

It fixes the TTM interfaces along Thomas's suggestions, and I've tested
the surface stealing code with two X servers and not seen any lockdep issues.

I've stopped tiling the fbcon frontbuffer, as I don't see there being
any advantage other than testing, I've left the testing commands in there,
just flip the fb_tiled to true in radeon_fb.c

Open: Can we integrate endian swapping in with this?

Future features:
texture tiling - need to relocate texture registers TXOFFSET* with tiling info.

This also merges Michel's cleanup surfaces regs at init time patch
even though it makes sense on its own, this patch really relies on it.

Some PowerMac firmwares set up a tiling surface at the beginning of VRAM
which messes us up otherwise.
that patch is:
Signed-off-by: Michel Dänzer <daenzer@vmware.com>

Signed-off-by: Dave Airlie <airlied@redhat.com>
9a298b2acd771d8a5c0004d8f8e4156c65b11f6b 24-Mar-2009 Eric Anholt <eric@anholt.net> drm: Remove memory debugging infrastructure.

It hasn't been used in ages, and having the user tell your how much
memory is being freed at free time is a recipe for disaster even if it
was ever used.

Signed-off-by: Eric Anholt <eric@anholt.net>
3b47883d93e941cb2b2df9ab46b2bdb66116c992 17-Jun-2009 Dave Airlie <airlied@linux.ie> drm/radeon/kms: remove the _DRM_DRIVER from the KMS paths.

This causes an issue since we fixed the drm mappings to do the right thing,
so its just a copy and pasto.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
771fe6b912fca54f03e8a72eb63058b582775362 05-Jun-2009 Jerome Glisse <jglisse@redhat.com> drm/radeon: introduce kernel modesetting for radeon hardware

Add kernel modesetting support to radeon driver, use the ttm memory
manager to manage memory and DRM/GEM to provide userspace API.
In order to avoid backward compatibility issue and to allow clean
design and code the radeon kernel modesetting use different code path
than old radeon/drm driver.

When kernel modesetting is enabled the IOCTL of radeon/drm
driver are considered as invalid and an error message is printed
in the log and they return failure.

KMS enabled userspace will use new API to talk with the radeon/drm
driver. The new API provide functions to create/destroy/share/mmap
buffer object which are then managed by the kernel memory manager
(here TTM). In order to submit command to the GPU the userspace
provide a buffer holding the command stream, along this buffer
userspace have to provide a list of buffer object used by the
command stream. The kernel radeon driver will then place buffer
in GPU accessible memory and will update command stream to reflect
the position of the different buffers.

The kernel will also perform security check on command stream
provided by the user, we want to catch and forbid any illegal use
of the GPU such as DMA into random system memory or into memory
not owned by the process supplying the command stream. This part
of the code is still incomplete and this why we propose that patch
as a staging driver addition, future security might forbid current
experimental userspace to run.

This code support the following hardware : R1XX,R2XX,R3XX,R4XX,R5XX
(radeon up to X1950). Works is underway to provide support for R6XX,
R7XX and newer hardware (radeon from HD2XXX to HD4XXX).

Authors:
Jerome Glisse <jglisse@redhat.com>
Dave Airlie <airlied@redhat.com>
Alex Deucher <alexdeucher@gmail.com>

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>