Commit graph

613 commits

Author SHA1 Message Date
Linus Torvalds 84210aeb4a Merge branch 'drm-radeon-kms' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-radeon-kms' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (35 commits)
  drm/radeon: set fb aperture sizes for framebuffer handoff.
  drm/ttm: fix highuser vs dma32 confusion.
  drm/radeon: Fix size used for benchmarking BO copies.
  drm/radeon: Add radeon.test parameter for running BO GPU copy tests.
  drm/radeon/kms: allow interruptible waits for objects.
  drm/ttm: powerpc: Fix Highmem cache flushing.
  x86: Export kmap_atomic_prot() needed for TTM.
  drm/ttm: Fix ttm in-kernel copying of pages with non-standard caching attributes.
  drm/ttm: Fix an oops and sync object leak.
  drm/radeon/kms: vram sizing on certain r100 chips needs workaround.
  drm/radeon: Pay more attention to object placement requested by userspace.
  drm/radeon: Fall back to evicting BOs with memcpy if necessary.
  drm/radeon: Don't unreserve twice on failure to validate.
  drm/radeon/kms: fix bandwidth computation on avivo hardware
  drm/radeon/kms: add initial colortiling support.
  drm/radeon/kms: fix hotspot handling on pre-avivo chips
  drm/radeon/kms: enable frac fb divs on rs600/rs690/rs740
  drm/radeon/kms: add PLL flag to prefer frequencies <= the target freq
  drm/radeon/kms: block RN50 from using 3D engine.
  drm/radeon/kms: fix VRAM sizing like DDX does it.
  ...
2009-07-29 12:31:59 -07: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
Dave Airlie b42db2b12d drm/ttm: fix highuser vs dma32 confusion.
DMA32 and highmem are sort of exclusive.

Noticed by AndrewR on #radeon.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 16:56:52 +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
Thomas Hellstrom f121ecfebb drm/ttm: powerpc: Fix Highmem cache flushing.
Temporarily maps highmem pages while flushing to get a valid virtual
address to flush.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:56:32 +10:00
Thomas Hellstrom 542c6f6df5 drm/ttm: Fix ttm in-kernel copying of pages with non-standard caching attributes.
For x86 this affected highmem pages only, since they were always kmapped
cache-coherent, and this is fixed using kmap_atomic_prot().

For other architectures that may not modify the linear kernel map we
resort to vmap() for now, since kmap_atomic_prot() generally uses the
linear kernel map for lowmem pages. This of course comes with a
performance impact and should be optimized when possible.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:56:13 +10:00
Thomas Hellstrom 4677f15c60 drm/ttm: Fix an oops and sync object leak.
The code was potentially dereferencig a NULL sync object pointer.
At the same time a sync object reference was potentially leaked.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29 15:56:04 +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
Thomas Hellstrom ae3e8122cb ttm: Fix caching mode selection.
A bug caused a new caching state to be selected on each buffer object
validation regardless of the current caching state.
Moreover, a caching state could be selected that wasn't supported by
the memory type.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15 17:13:10 +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
Julia Lawall ecca068323 drm: Move a dereference below a NULL test
If the NULL test is necessary, then the dereference should be moved below
the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-07-15 16:56:48 +10:00
Roel Kluin 916635bfca drm/ttm: fix misplaced parentheses
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-07-15 16:00:37 +10:00
Simon Farnsworth 42dd861994 drm/via: Fix vblank IRQ on VIA hardware.
via_enable_vblank wasn't setting the VBlank enable bit - instead, it
was masking out the rest of the register.

At the same time, fix via_disable_vblank to clear the VBlank enable
bit.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-07-15 16:00:07 +10:00
Jiri Slaby 845792d940 drm: drm_gem, check kzalloc retval
Check kzalloc retval against NULL in drm_gem_object_alloc and bail out
appropriately.

While at it merge the fail paths and jump to them by gotos at the end
of the function.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-07-15 15:56:12 +10:00
Jiri Slaby d25e3a6faa drm: drm_debugfs, check kmalloc retval
Check kmalloc return value in drm_debugfs_create_files and bail out
appropriately if the pointer is NULL.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-07-15 15:55:37 +10:00
Zhenyu Wang 5019914ca3 drm/i915: Fix for LVDS VBT change on IGDNG
IGDNG mobile chip's LVDS data block removes panel fitting
register definition. So this fixes offset for LVDS timing
block parsing. Thanks for Michael Fu to catch this.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-10 14:11:06 -07:00
Eric Anholt d05ca30199 drm/i915: Zap the GTT mapping when transitioning from untiled to tiled.
As of 52dc7d32b8, we could leave an old
linear GTT mapping in place, so that apps trying to GTT-mapped write in
tiled data wouldn't get the fence added, and garbage would get displayed.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-10 14:10:58 -07:00
Chris Wilson 901782b21e drm/i915: Refactor calls to unmap_mapping_range
As we call unmap_mapping_range() twice in identical fashion, refactor
and attempt to explain why we need to call unmap_mapping_range().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-10 14:10:53 -07:00
Zhao Yakui fccdaba431 drm/i915: Avoid saving/restore the modesetting registers twice in KMS mode
In KMS mode we now use the normal mode-setting paths to set the modes
back to the current configuration, so we don't need to also run the more
limited non-KMS implementation of modesetting for resume.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-10 12:40:36 -07:00
Zhao Yakui af4fcb574e drm: Disable the unused connectors explicitly when resuming with KMS.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by:  Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by:  Dave Airlie <airlied@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-10 12:39:51 -07:00
Zhao Yakui 354ff96772 drm/i915: Restore the KMS modeset for every activated CRTC
Restore the modeset for every activated CRTC in course of resume.
This is realized by calling the function of drm_helper_resume_force_mode.
Note: it is meaningful only for the KMS mode.

https://bugs.freedesktop.org/show_bug.cgi?id=21719
https://bugs.freedesktop.org/show_bug.cgi?id=21708
https://bugs.freedesktop.org/show_bug.cgi?id=22285
https://bugs.freedesktop.org/show_bug.cgi?id=22263

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-10 12:36:11 -07:00
Eric Anholt 883e860daf drm/i915: Fix harmless warning from patch merged after i2c rework.
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-10 12:30:18 -07:00
Eric Anholt 2a34f5e6b6 drm/i915: Disable GEM when a broken video BIOS takes up the whole aperture.
This is seen on some G41 systems, where the BIOS will consume all but
a few KB of the aperture.  This should be bad for all operating systems, as
it means that the OS can't dynamically manage memory between graphics and
the rest of the system, and OSes that did static memory management
statically add memory in addition to the BIOS allocation anyway.  So, instead
of working around it, just fail out verbosely.

fd.o bug #21574

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2009-07-10 12:29:33 -07:00
Zhao Yakui e99da35f06 drm/i915: Check the LID device to decide whether the LVDS should be initialized
On some boxes the mobile chipset is used and there is no LVDS device. In such
case we had better not initialize the LVDS output device so that one pipe can
be used for other output device. For example: E-TOP.

But unfortunately the LVDS device is still initialized on the boxes based on
mobile chipset in KMS mode. It brings that this pipe occupied by LVDS can't be
used for other output device.

After checking the acpidump we find that there is no LID device on such boxes.
In such case we can use the LID device to decide whether the LVDS device should
be initialized.

If there is no LID device, we can think that there is no LVDS device. It is
unnecessary to initialize the LVDS output device.
If there exists the LID device, it will continue the current flowchart.

Maybe on some boxes there is no LVDS device but the LID device is found. In
such case it should be added to the quirk list.

http://bugs.freedesktop.org/show_bug.cgi?id=21496
http://bugs.freedesktop.org/show_bug.cgi?id=21856
http://bugs.freedesktop.org/show_bug.cgi?id=21127

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[anholt: squashed in style fixups]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-09 15:56:34 -07:00
Ben Gamari a17458fc9d drm/i915: Move lock to more reasonable location
Make this consistent with the unlock statement. Also fix a
minor typo in debugfs formatting

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-07 11:52:52 -07:00
Ben Gamari a01c75b338 drm/i915: Add gtt_offset to gem object list debugfs output
This is quite useful for verifying that objects are actually mapped when
they need to be.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-07-07 11:52:48 -07:00