Commit Graph

126 Commits (b42c6344b091db680fd1ec7a0483e8b6796f802b)

Author SHA1 Message Date
Dave Airlie a54775c875 drm/radeon/kms: add LTE/GTE discard + rv515 two sided stencil register.
This adds some rv350+ register for LTE/GTE discard,
and enables the rv515 two sided stencil register.
It also disables the DEPTHXY_OFFSET register which
can be used to workaround the CS checker.
Moves rs690 to proper place in rs600 and uses correct
table on rs600.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 15:26:19 +10:00
Michel Dänzer 9f844e5118 drm/radeon/kms: Fix radeon_gem_busy_ioctl harder.
It was mixing up TTM placement values and flags.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-23 11:36:13 +10:00
Alex Deucher f779b3e513 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>
2009-08-21 19:10:30 +10:00
Dave Airlie 17782d9950 drm/radeon/kms: add r100/r200 OQ support.
This adds the relocation necessary for OQ support on the r100/r200
chipsets.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-21 10:07:54 +10:00
Dave Airlie e3b2415e28 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>
2009-08-21 09:51:30 +10:00
Dave Airlie 6a719e0533 drm/kms/radeon: cleanup combios TV table like DDX.
The fallback case wasn't getting executed properly if there
was no TV table, which my T42 M7 hasn't got.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 14:11:32 +10:00
Dave Airlie bf8e828b00 drm/radeon/kms: memset the allocated framebuffer before using it.
This gets rid of some ugliness, we shuold probably find a way
for the GPU to zero this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 14:11:32 +10:00
Dave Airlie 80e6914db1 drm/radeon/kms: although LVDS might be possible on crtc 1 don't do it.
LVDS always requests RMX_FULL, we need to fix it so that doesn't happen
before we can enable LVDS on crtc 1.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-19 14:11:26 +10:00
Dave Airlie cefb87efc9 drm/radeon/kms: implement bo busy check + current domain
This implements the busy ioctl along with a current domain check.
returns 0 or -EBUSY
puts the current domain no matter what the answer.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-17 12:28:56 +10:00
Dave Airlie de1b28989e drm/radeon/kms: cut down indirects in register accesses.
We really don't want to be doing all these indirects, updating
the GPU gart table is something we do often so the less overhead the
better.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-16 08:36:34 +10:00
Michel Dänzer 7ed220d738 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>
2009-08-16 08:36:19 +10:00
Dave Airlie 3f8befec95 drm/radeon/kms: add rv530 R300_SU_REG_DEST + reloc for ZPASS_ADDR
These are needed for Occulsion Query support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-16 08:33:17 +10:00
Jerome Glisse 616b843468 drm/radeon/kms: Add specific rs690 authorized register table
rs690 is r3xx 3D engine with AVIVO modesetting so we need to allow
AVIVO register for vline synchronization. This add a specific table
to rs690 to handle that. Thanks to Marc (marvin24) for debugging
this and kudos to Andre (taiu1) for spotting the origin of the bugs.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-15 12:09:51 +10:00
Dave Airlie 17332925d7 drm/radeon/kms: setup MC/VRAM the same way for suspend/resume
we should align the GTT after VRAM no matter what, as we can
come back from resume and put in a different place and bad things happen.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-07 20:33:11 +10:00
Jerome Glisse 985fe845ae drm/radeon/kms: Fix caching mode selection for GTT object
GTT object can either be cached,uncached or wc just let core ttm
pick the best mode according to how the bo driver and GTT memory
type was initialized.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-06 15:14:39 +10:00
Alex Deucher 6502fbfaf8 drm/radeon: Add support for RS880 chips
These are new AMD IGP chips

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-05 12:07:09 +10:00
Roel Kluin fa99239cb7 drm/radeon: Read buffer overflow
Check whether index is within bounds before grabbing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-04 13:41:05 +10:00
Xiaotian Feng c9b7fb54f0 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>
2009-08-04 13:41:05 +10:00
Dave Airlie de05065ff5 drm/radeon/kms: fix nomodeset.
The ordering was wrong to get the nomodeset parameter to work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-04 13:41:05 +10:00
Dave Airlie 0924d94225 drm/radeon/kms: fix rv515 VRAM initialisation.
This got missed in the VRAM init re-workings.

Signed-of-by: Dave Airlie <airlied@redhat.com>
2009-08-04 13:41:04 +10:00
Dave Airlie ed8f0d9e70 drm/radeon: set fb aperture sizes for framebuffer handoff.
This will allow efi/vesa to handoff to radeon.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 17:07:38 +10:00
Michel Dänzer ea3c13bd8c drm/radeon: Fix size used for benchmarking BO copies.
The incorrect size caused benchmark results to be inflated by a factor of 4.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 16:08:56 +10:00
Michel Dänzer ecc0b32645 drm/radeon: Add radeon.test parameter for running BO GPU copy tests.
If enabled, during initialization BO GTT->VRAM and VRAM->GTT GPU copies are
tested across the whole GTT aperture.

This has helped uncover the benchmark copy size bug and verify the maximum
aperture size supported by the AGP bridge in my PowerBook.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 16:08:39 +10:00
Dave Airlie 3b170c3b2e drm/radeon/kms: allow interruptible waits for objects.
Blocking here isn't something the X server mouse appreciates,
avoid the block and let userspace retry the waits.

libdrm_radeon userspace library is also expecting EBUSY not ERESTART

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:59:49 +10:00
Dave Airlie 7a50f01a4a drm/radeon/kms: vram sizing on certain r100 chips needs workaround.
If an rn50/r100/m6/m7 GPU has < 64MB RAM, i.e. 8/16/32, the
aperture used to calculate the MC_FB_LOCATION needs to be worked
out from the CONFIG_APER_SIZE register, and not the actual vram size.

TTM VRAM size was also being initialised wrong, use actual vram size
to initialise it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:53:25 +10:00
Michel Dänzer 664f865902 drm/radeon: Pay more attention to object placement requested by userspace.
Previously we were basically always setting the GTT and VRAM flags regardless of
what userspace requested.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:45:41 +10:00
Michel Dänzer 1ab2e10599 drm/radeon: Fall back to evicting BOs with memcpy if necessary.
Otherwise if there's no GTT space we would fail the eviction, leading to
cascaded failure.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:45:39 +10:00
Michel Dänzer e46074effd drm/radeon: Don't unreserve twice on failure to validate.
This is done later in radeon_object_list_unvalidate(). Doing it twice triggers
a BUG in TTM, rendering X on KMS unusable until reboot.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:45:37 +10:00
Jerome Glisse c93bb85b5c drm/radeon/kms: fix bandwidth computation on avivo hardware
Fix bandwidth computation and crtc priority in memory controller
so that crtc memory request are fullfill in time to avoid display
artifact.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:45:09 +10:00
Dave Airlie e024e11070 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>
2009-07-29 15:42:18 +10:00
Alex Deucher c836e86280 drm/radeon/kms: fix hotspot handling on pre-avivo chips
Need to adjust CUR_OFFSET for yorigin

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:24 +10:00
Alex Deucher eb1300bcd7 drm/radeon/kms: enable frac fb divs on rs600/rs690/rs740
Allows us to hit dot clocks much closer, especially on
chips with non-27 Mhz reference clocks like most IGP chips.
This fixes most flickering and blanking problems with
non-exact dot clocks on these chips.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:23 +10:00
Alex Deucher d0e275a90a drm/radeon/kms: add PLL flag to prefer frequencies <= the target freq
This is needed when using fractional feedback dividers on some IGP
chips.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:22 +10:00
Dave Airlie b995e4330d drm/radeon/kms: block RN50 from using 3D engine.
RN50/ES1000 is a cut-down rv100 chip used in the server market.
The 3D engine on these is either not there or unverified so refuse
any attempt to configure registers on it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:21 +10:00
Dave Airlie 2a0f8918fc drm/radeon/kms: fix VRAM sizing like DDX does it.
Doing this like the DDX seems like the most sure fire way to avoid
having to reinvent it slowly and painfully. At the moment we keep
getting things wrong with aper vs vram, so we know the DDX does it right.

booted on PCI r100, PCIE rv370, IGP rs400.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:19 +10:00
Dave Airlie ad49f50186 drm/ttm/radeon: add dma32 support.
This add support for using dma32 memory on gpus that really need it.

Currently IGPs are left without DMA32 but we might need to change
that unless we can fix rs690.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:18 +10:00
Michel Dänzer 61b576dbbe drm/radeon: Endianness fixes for radeondrmfb.
For now handle it via r/g/b offsets and disallow 16 bpp modes on big endian
machines.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:17 +10:00
Dave Airlie 77bd36f014 drm/radeon/kms: don't swap PCIEGART PTEs in VRAM.
On powerpc, since we aren't using any hw swappers, this will
get flipped around by default in hw.

tested on a G5 + rv515.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:16 +10:00
Dave Airlie 5176fdc4c5 drm/radeon/kms: drop zero length CS indirect buffers.
If userspace sends a zero length IB, it really shouldn't have bothered
so EINVAL it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:15 +10:00
Dave Airlie e7168cab5b drm/radeon/kms: fix vram vs aper size check.
Fix this to be correct like the DDX code, looks like a typo
on transfer to the kernel.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:14 +10:00
Alex Deucher 2007d633d6 drm/radeon/kms: get lvds info for DIG LVTMA and UNIPHY encoders
Noticed by Rafał Miłecki on dri-devel.  On r6xx/r7xx hardware, laptop
panels can be driven by KLDSCP_LVTMA or UNIPHY.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:13 +10:00
Alex Deucher 848577ee27 drm/radeon/kms: fix quirk for MSI laptop
The line mux for the connector in the bios tables
is used for enumerating drm connectors.  Since
this laptop has a quirk where the same line much is
listed for both VGA and LVDS, the connectors get
combined.  Setting the line mux on LVDS to an unused
value prevents both encoders from being combined into
the same connector.  This should fix bko bug 13720.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:11 +10:00
Dave Airlie 531369e626 drm/radeon: fix support for vline relocations.
Userspace sends us a special relocation type to sync video/exa
to vlines to avoid tearing, this deals with the relocation
in the kernel, it picks the correct crtc and avoids issues
where crtcs are disabled.

This version also parses the wait until to make sure it isn't
trying to do anything evil.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:08 +10:00
Dave Airlie 3e43d82125 drm/radeon/kms: respect TOM on rs100->rs480 IGP variants.
Normally we are free to place VRAM where we want in the GPUs
memory address space, however on IGP chips the VRAM is actual RAM,
and no special translation or aperture is used inside the GPU MC.

So when you move the VRAM aperture away from the TOM register,
you actually move it into main memory and can trash things quite badly.

This commit makes the code respect the TOM location for MC_FB_LOCATION.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:07 +10:00
Dave Airlie 4162338a1d drm/radeon/kms: set crtc and cursor offsets correctly on legacy chips.
The crtc and cursor offsets on the legacy chips are offset from
DISPLAY_BASE_ADDR. The code worked if display base addr was at 0,
but otherwise falls to pieces.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:06 +10:00
Dave Airlie 6cdf65855c drm/radeon/kms: remove IB flushing trick.
If there is a problem then this is hiding it, we shouldn't
ever need to flush the IB. Either the buffers are:

WB - caching just works.
WC - no need to do explicit flush, the MB + readback will do it

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:04 +10:00
Dave Airlie 4c9bc75cbc drm/radeon/kms: mmio base/size should be resource_size_t.
Unsigned long is incorrect for 64-bit resources on 32-bit hw.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:03 +10:00
Dave Airlie ed10f95d60 drm/radeon/kms: fix some GART table entry bugs.
1. rv370 can accept 40-bit addresses - also at 24-bit shift not 4 bits
2. rs480 table can be in 40-bit space. - 4 bit shift for top 8 bits
3. rs480 table entries can be in 40-bit space.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:02 +10:00
Jerome Glisse 176f613e60 drm/radeon: fix driver initialization order so radeon kms can be builtin
TTM need to be initialized before radeon if KMS is enabled otherwise
the kernel will crash hard.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-06-24 16:11:06 +10:00
Michel Dänzer b1e3a6d1c4 drm/radeon: Clear surface registers at initialization time.
Some PowerMac firmwares set up a tiling surface at the beginning of VRAM
which messes us up otherwise.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-06-24 16:10:56 +10:00