Commit Graph

1626 Commits (977d17bb1749517b353874ccdc9b85abc7a58c2a)

Author SHA1 Message Date
Alex Deucher 4143e919ea drm/radeon/kms: store sink type in atom dig connector
This will be used laster when the encoder and transmitters
are set up.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:42 +10:00
Alex Deucher 6a93cb250a drm/radeon/kms: i2c reorg
- keep the atom i2c id in the i2c rec
- fix gpio regs for GPIO and MDGPIO on pre-avivo chips
- track whether the i2c line is hw capable
- track whether the i2c line uses the multimedia i2c block

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:41 +10:00
Alex Deucher 1a66c95a64 drm/radeon/kms: DP fixes and cleanup from the ddx
- dpcp -> dpcd
- fix up dig encoder routing
- aux transaction table takes delay in 10 usec units

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:40 +10:00
Dave Airlie 746c1aa4d1 drm/radeon/kms: initial radeon displayport porting
This is enough to retrieve EDID and DPCP.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:31 +10:00
Chris Wilson 5618ca6abc drm/i915: Set the error code after failing to insert new offset into mm ht.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-07 15:44:30 -08:00
Chris Wilson fcffb94766 drm/i915: Report purgeable status in buffer lists.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-07 15:39:32 -08:00
Dave Airlie 447aeb907e drm/ttm: fix unreachable code.
None of the in-tree drivers use user objects yet so this wasn't hitting
us.

Stanse found unreachable code in ttm_bo_add_ttm:
http://decibel.fi.muni.cz/~xslaby/stanse/error.cgi?db=32&id=714#l238

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 09:25:45 +10:00
Dave Airlie ab2c067298 drm/intel: refactor DP i2c support and DP common header to drm helper
Both radeon and nouveau can re-use this code so move it up a level
so they can. However the hw interfaces for aux ch are different
enough that the code to translate from mode, address, bytes
to actual hw interfaces isn't generic, so move that code into the
Intel driver.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 09:24:23 +10:00
Alex Deucher 22dd50133a drm/radeon/kms: fix vram setup on rs600/rs690/rs740
Don't remap vram to 0 on IGP chips.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 08:58:33 +10:00
Adam Jackson f2b115e69d drm/i915: Fix product names and #defines
IGD* isn't a useful name.  Replace with the codenames, as sourced from
pci.ids.

Signed-off-by: Adam Jackson <ajax@redhat.com>
[anholt: Fixed up for merge with pineview/ironlake changes]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-07 14:55:56 -08:00
Alex Deucher 2a008d0ccd drm/radeon/kms: more r4xx lvds fixes
Grab pll ref div from regs at driver init.  r4xx seems very
picky about the dividers for the pll driving lvds.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 08:53:25 +10:00
Alex Deucher 92cde00cba drm/radeon/kms/legacy: set common regs to sane value
The DDX and radeonfb always set these regs to a sane value.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 08:51:12 +10:00
Alex Deucher 6b02af1c1f drm/radeon/kms/legacy: set overscan regs on modeset
These can end up with garbage otherwise.

fixes rh bug 537140

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 08:50:54 +10:00
Dave Airlie d904ef9b00 drm/radeon/kms: add support to atom parser for FB read/write
FB read/write really doesn't need to access the actual VRAM, we
can just use a scratch area. This is required for using atom displayport
calls later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 07:33:04 +10:00
Dave Airlie f846761853 Merge remote branch 'origin/drm-core-next' into test
Conflicts:
	drivers/gpu/drm/drm_fb_helper.c
2009-12-08 07:03:55 +10:00
Chris Wilson ffb4728095 drm/i915: Drop a some common DRM_ERROR()
These are handled by the error return being propagated to user-space and
do not any add any information to the original error, so are useless.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-07 12:18:28 -08:00
Jesse Barnes 85364905f9 drm/i915: warn if Pineview CxSR can't be enabled
If we don't detect a supported memory configuration, we can't enable
CxSR.  Warn the user in this case so they can file a bug.
2009-12-07 12:11:52 -08:00
Jesse Barnes 22fd0fab3b drm/i915: pageflip fixes
This patch brings the tree up to date with some fixes that were in a
more recent version of the page flipping patch you applied.  It fixes
pre-965 flip support, removes a leftover hack that forced alignment,
and initializes the pipe & plane CRTC mappings.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-07 12:06:00 -08:00
Jiri Kosina d014d04386 Merge branch 'for-next' into for-linus
Conflicts:

	kernel/irq/chip.c
2009-12-07 18:36:35 +01:00
Thomas Hellstrom 85bb0c377f drm: Export symbols needed for the vmwgfx driver.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07 15:22:08 +10:00
Thomas Hellstrom 4bfd75cb08 drm/ttm: Export symbols needed for the vmwgfx driver.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07 15:22:07 +10:00
Thomas Hellstrom c078aa2fc4 drm/ttm: Add TTM execbuf utilities.
Utilities to reserve, unreserve and fence a list of TTM
buffer objects in a deadlock-safe manner.

Used by the vmwgfx driver.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07 15:22:05 +10:00
Thomas Hellstrom 4aff1013f5 drm/ttm: Add ttm lock functionality.
This is intended to be used by ttm-aware drivers to
1) Block clients to inactive masters when
they try to validate buffers for GPU use.
2) Optionally block clients to the current master when
there is thrashing due to GPU memory shortage.

Used by the vmwgfx driver.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07 15:22:03 +10:00
Thomas Hellstrom 88071539a3 drm/ttm: Add user-space objects.
Add objects needed for user-space to maintain reference counts on ttm objects.
This is used by the vmwgfx driver which allows user-space to maintain
map-counts on dma buffers, lock-counts on the ttm lock and ref-counts on
gpu surfaces, gpu contexts and dma buffer.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07 15:22:01 +10:00
Dave Airlie 64bffd0375 drm/radeon/kms: fix RS600 MC setup.
Again we try to put VRAM at 0, and it didn't work on this chipset,
reports of corrupt RAM appeared on irc and bugzilla.

Fix the vram location according to what the BIOS setup, I'm not 100%
sure we don't need the same thing on rs690/rs780/rs880, we probably
should do it there just in case as its what the DDX does.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07 13:29:51 +10:00
Alex Deucher 4f15d24adb drm/radeon/kms: fix up gart setup on rs600
Set up rs600 gart like r600:
- set gart system aperture to vram
- inside gart system aperture is unmapped*
- outside gart system aperture is mapped*

*mapped refers to memory handled by page tables

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07 08:01:52 +10:00
Adam Buchbinder 6070d81eb5 tree-wide: fix misspelling of "definition" in comments
"Definition" is misspelled "defintion" in several comments; this
patch fixes them. No code changes.

Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-04 23:41:47 +01:00
André Goddard Rosa af901ca181 tree-wide: fix assorted typos all over the place
That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-04 15:39:55 +01:00
Dave Airlie aa1a750ecb drm/radeon/kms: quirk for Gigabyte RV515 card, DVI+VGA not 2xDVI.
Similiar to other quirks for RV515, this card has no second DVI port.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 11:56:28 +10:00
Alex Deucher 0088dbdb80 drm/radeon/kms: rs6xx/rs740: clamp vram to aperture size
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:32:35 +10:00
Alex Deucher 722f29434e drm/radeon/kms: fix vram setup on rs600
also fix up rs690 mem width.

should fix fdo bug 25408

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:32:26 +10:00
Alex Deucher 8de2152543 drm/radeon/kms: fix legacy crtc2 dpms
noticed by Matthijs Kooijman on fdo bug 22140

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:32:18 +10:00
Alex Deucher 500b758725 drm/radeon/kms: handle vblanks properly with dpms on
avivo chips

Copied from pre-avivo code.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:32:06 +10:00
Alex Deucher 4e3f9b78ff drm/radeon/kms: Add quirk for HIS X1300 board
Board is DVI+VGA, not DVI+DVI

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:31:53 +10:00
Alex Deucher 4c4f5413c3 drm/radeon/kms: don't use bios dividers for lvds on r4xx
R4xx cards don't have lvds pll dividers since they use atom.

should fix rh bug 541562

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:24:11 +10:00
Rafał Miłecki d684076627 drm/radeon/kms: fix ring info in debugfs on r600+
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:21:22 +10:00
Rafał Miłecki 93e7de7b37 drm/radeon/kms: fix typo in define: engine -> memory
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:20:45 +10:00
Rafał Miłecki c142c3e5e3 drm/radeon/kms/pm: fix typos
Unit typo noticed by taiu on IRC

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:20:08 +10:00
Dave Airlie 01d01ba947 drm/mm: fixup typo in debug functions.
Free and used were reversed.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 10:18:02 +10:00
Jakob Bornecrantz 884840aa3c drm: Add dirty ioctl and property
This commit adds a ioctl and property to allow userspace
to notify the kernel that a framebuffer has changed. Instead
of snooping the command stream this allows finer grained
tracking of which areas have changed.

The primary user for this functionality is virtual hardware
like the vmware svga device, but also Xen hardware likes to
be notify. There is also real hardware like DisplayLink and
DisplayPort that might take advantage of this ioctl.

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 09:25:47 +10:00
Dan Carpenter 46a79fa08a drm/ttm: fix small memory leak in ttm_memory.c
I moved the allocation until after the check for (si->totalhigh == 0).

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-By:  Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 09:03:33 +10:00
Thomas Hellstrom 862302ffe4 drm: Add support for drm master_[set|drop] callbacks.
The vmwgfx driver has a per master rw lock around TTM, to guarantee 
mutual exclusion when needed.

This is typically when all evictable buffers are evicted due to

1) vt switch
2) master switch
3) suspend / resume.

In the multi-master case, on master switch the new master takes the 
previously active master lock in write mode, and then evicts all 
buffers. Any clients to previous masters will then block on that lock 
when trying to validate a buffer. fbdev also acts as a virtual master
wrt this.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 08:55:46 +10:00
Adam Jackson 9340d8cfea drm/edid: Decode 3-byte CVT codes from EDID 1.4
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 08:53:47 +10:00
Adam Jackson 07a5e6324a drm/edid: Add DMT modes to the pool if the monitor is GTF-capable
See also: http://bugzilla.redhat.com/539785

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 08:53:32 +10:00
Adam Jackson 7ac96a9cb4 drm/modes: Add drm_mode_hsync()
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 08:53:22 +10:00
Adam Jackson 9cf00977da drm/edid: Unify detailed block parsing between base and extension blocks
Also fix an embarassing bug in standard timing subblock parsing that
would result in an infinite loop.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04 08:53:07 +10:00
Zhao Yakui 6e36595a21 drm/i915: Declare the new VBT parsing functions as static
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 23:27:20 -08:00
Zhao Yakui 652af9d74e drm/i915: Add the missing clonemask for display port on Ironlake
Add the missing clonemask for display port on Ironlake.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 23:26:36 -08:00
Zhao Yakui f24bc39fac drm/i915: fix the incorrect condition judgement in dp_is_present_in_vbt
We were always looking for the PORT_IDPB entry.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 23:25:17 -08:00
Jerome Glisse 4c78867912 drm/radeon/kms: Rework radeon object handling
The locking & protection of radeon object was somewhat messy.
This patch completely rework it to now use ttm reserve as a
protection for the radeon object structure member. It also
shrink down the various radeon object structure by removing
field which were redondant with the ttm information. Last it
converts few simple functions to inline which should with
performances.

airlied: rebase on top of r600 and other changes.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 14:00:18 +10:00
Dave Airlie 1614f8b17b drm/radeon/kms: add irq mitigation code for sw interrupt.
We really don't need to process every irq that comes in, we only
really want to do SW irq processing when we are actually waiting for
a fence to pass. I'm not 100% sure this is race free esp on non-MSI systems
so it needs some testing.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 14:00:13 +10:00
Alex Deucher d8f60cfc93 drm/radeon/kms: Add support for interrupts on r6xx/r7xx chips (v3)
This enables the use of interrupts on r6xx/r7xx hardware.
Interrupts are implemented via a ring buffer.  The GPU adds
interrupts vectors to the ring and the host reads them off
in the interrupt handler.  The interrupt controller requires
firmware like the CP.  This firmware must be installed and
accessble to the firmware loader for interrupts to function.

MSIs don't seem to work on my RS780.  They work fine on all
my discrete cards.  I'm not sure about other RS780s or
RS880s.  I've disabled MSIs on RS780 and RS880, but it would
probably be worth checking on some other systems.

v2 - fix some checkpatch.pl problems;
     re-read the disp int status reg if we restart the ih;

v3 - remove the irq handler if r600_irq_init() fails;
     remove spinlock in r600_ih_ring_fini();
     move ih rb overflow check to r600_get_ih_wptr();
     move irq ack to separate function;

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 14:00:06 +10:00
Dave Airlie 50dafba685 drm/radeon/kms: call correct atom table for digital output dpms.
found while working on displayport.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:20 +10:00
Jerome Glisse ee2215f0b2 drm/radeon/kms: Don't overwrite crtc_gen_cntl or crtc_gen_cntl2
Don't overwritte  crtc_gen_cntl or crtc_gen_cntl2 or we may loose the
cursor. This especialy happen when changing video mode. Fix bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=529146

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:19 +10:00
Alex Deucher ed160143c6 drm/radeon/kms: add tv standard property to tv connectors
Lets user select tv-standard.  The property was there,
just not hooked up.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:18 +10:00
Dave Airlie 72542d7705 drm/radeon/kms: ignore unposted GPUs with no BIOS.
If we find a GPU but we can't find its BIOS and it isn't posted,
then ignore it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:17 +10:00
Dave Airlie 4b30b87042 drm/radeon/kms: fix divide by 0 in clocks code
If the chip isn't initialised properly this can happen.
also fix return value in combios clocks function.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:16 +10:00
Alex Deucher 7dde8a1965 drm/radeon/kms/atom: pull misc mode info for lvds from bios tables
sync polarity, etc.  This will likely fix LVDS problems
on some laptops.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:15 +10:00
Jerome Glisse 30256a3f6b drm/radeon/kms: Disable agp only if we are dealing with an AGP GPU
On IGP if you pass option agpmode=-1 you would overwrite the set_page
function callback with improper function which endup in non functioning
hw. This patch will disable agp when giving agpmode=-1 parameter only
if we are dealing with an AGP GPU.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:14 +10:00
Pierre Ossman ec51efa9b2 drm/radeon/kms: Disable both CRTCs during mode switch
Reconfiguring one CRTC whilst another is running can cause a hang under
some circumstances. Unfortunately we haven't pinpointed exactly what those
circumstances are, so disable all CRTCs for every mode switch.

Signed-off-by: Pierre Ossman <pierre@ossman.eu>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:13 +10:00
Alex Deucher 32f48ffea9 drm/radeon/kms: fix LVDS setup on r4xx
R4xx mobility chips use atombios, which does not store
the LVDS_GEN_CNTL parameter setup like combios.  Rather,
it's configured in LVDSEncoderControl.  As such,
LVDS_GEN_CNTL is set wrong when on resume.  Call
LVDSEncoderControl to set it properly.

Should fix fdo bug 25336

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:13 +10:00
Dave Airlie 23956dfa82 drm/radeon/kms: add HDP flushing for all GPUs.
rendercheck under kms on r600s was failing due to HDP flushing not happening.

This adds HDP flushing to the object wait function for r100->r700 families.

rendercheck passes basic tests on r600 with this change.

Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:11 +10:00
Michel Dänzer 38e1492130 drm/radeon: Give userspace more accurate information about available memory.
This patch varies from the original and just removes memory for kernel
pinned objects.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:10 +10:00
Dave Airlie 47381156a8 drm/radeon/kms: pick 8bpp console when 32MB or less VRAM
making the pinned console smaller gives X a bit more room to play with.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:10 +10:00
Dave Airlie 1f3b6a45f0 drm/radeon/kms: add support for encoder cloning.
The RN50 really needs this since its a single crtc card,
however other gpus may benefit from it as well.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:09 +10:00
Jerome Glisse 2de3b4841f drm/radeon/kms: fix oops when set_base is call with no FB
Just do nothing if crct_set_base() is called with no FB.

The oops happens when the user switches between X & vt or in some case
when changing mode.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:37:08 +10:00
Alex Deucher fd874ad0a0 drm/radeon/kms: add quirk for MSI S270
doesn't have a tv-out port

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:45 +10:00
Alex Deucher 71407c46fe drm/radeon/kms: deal with connectors sourced to the same encoder
Some systems have multiple connectors connected to the same encoder;
e.g., DVI and HDMI connected to the same encoder with the same ddc
line. Since we expose connectors as xrandr outputs, randr treats them
separately which results in it trying to source the same encoder to
different crtcs. If we have an HDMI and DVI-D port on the same encoder,
pick the one to be considered connected based on the edid (HDMI if edid
indicates HDMI, DVI otherwise).

Should fix fdo bug 25150

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:44 +10:00
Alex Deucher 3e5f8ff3a9 drm/radeon/kms: add quirk for Acer laptop
DVI-I port is actually DVI-D

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:44 +10:00
Alex Deucher 80297e87bc drm/radeon/kms: rework scaler handling
Keep requested scaler type in radeon_encoder
and the actual scaler type used in radeon_crtc.
This prevents us from enabling the scaler when it's
not required (i.e., the requested mode is the native
mode).  Also, always set the adjusted mode equal
to the native mode for lvds.

Should fix:
https://bugzilla.redhat.com/show_bug.cgi?id=522271

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:43 +10:00
Alex Deucher fe6890c3e8 drm/radeon/kms: fix typo in legacy internal tmds mode fixup
Call to set active device was missing.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:42 +10:00
Dave Airlie 17e15b0c71 drm/radeon/kms: AGP systems need PCI bus mastering enabled
We might not hit this yet, but when if we do any sort of writeback
we really need to enable PCI bus mastering on these systems from
what I can see.

This enables PCI BM on all radeons that require it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:41 +10:00
Alex Deucher fcec570b27 drm/radeon/kms: add support for external tmds on legacy boards
This enables initialization of external tmds chips on pre-atom
and mac systems.  Macs are untested.  Also, some macs have single
link tmds chips while others have dual link tmds chips.  We need
to figure out which ones have which.

This gets external TMDS working on my RS485 and RV380.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:40 +10:00
Alex Deucher 9b9fe72488 drm/radeon/kms: clean up i2c
- Change reg/mask names to match what we use internally
and in the bios
- Clarify how i2c over gpio on radeon actually works

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:39 +10:00
Alex Deucher ab1e9ea08f drm/radeon/kms: dont't pass a radeon_connector to radeon_i2c_do_lock()
We need this for supporting things other than ddc on i2c.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-02 11:36:38 +10:00
Eric Anholt f0217c42c9 drm/i915: Fix DDC on some systems by clearing BIOS GMBUS setup.
This is a sync of a fix I made in the old UMS code.  If the BIOS uses
the GMBUS and doesn't clear that setup, then our bit-banging I2C can
fail, leading to monitors not being detected.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 11:56:30 -08:00
Zhao Yakui d09c23de9f drm/i915: Add 30ms delay to make SDVO TV detection reliable.
Without this, on some boots the TV wouldn't be detected.  Testing
showed 15ms to be insufficient.

https://bugs.freedesktop.org/show_bug.cgi?id=24290
https://bugs.freedesktop.org/show_bug.cgi?id=20785

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Yan Seiner <yan@seiner.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 10:33:12 -08:00
Li Peng 778c902640 drm/i915: Fix sync to vblank when VGA output is turned off
In current vblank-wait implementation, if we turn off VGA output,
drm_wait_vblank will still wait on the disabled pipe until timeout,
because vblank on the pipe is assumed be enabled. This would cause
slow system response on some system such as moblin.

This patch resolve the issue by adding a drm helper function
drm_vblank_off which explicitly clear vblank_enabled[crtc], wake up
any waiting queue and save last vblank counter before turning off
crtc. It also slightly change drm_vblank_get to ensure that we will
will return immediately if trying to wait on a disabled pipe.

Signed-off-by: Li Peng <peng.li@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[anholt: hand-applied for conflicts with overlay changes]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 10:27:40 -08:00
Adam Jackson 27dfaf4f58 drm/i915: disable the interrupt hotplug for integrated TV output
Otherwise, I'd get stuck in a loop where (afaict) output scan would
trigger a TV interrupt, which would trigger a scan, etc.  TV load
detection not being the fastest thing in the world, X would process
requests very slowly.

https://bugs.freedesktop.org/show_bug.cgi?id=24404

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 09:49:36 -08:00
Chris Wilson 28cf798f5a drm/i915: Don't update the render-clock for every bo.
Only update the render-clock on transition from busy to idle and vice
versa, or else we burn a significant percentage of the cpu just rewriting
the register -- not quite as power-friendly as intended ;-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 09:42:16 -08:00
Adam Jackson 38b3037ee4 drm/i915: Fix LVDS presence check
Assume that either the presence of an LVDS entry in the VBT or an ACPI
lid device indicates an LVDS device.  ACPI lid alone is not sufficient.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 09:28:58 -08:00
Eric Anholt 05dd8f973f drm/i915: Fix warning introduced with the page flipping ioctl.
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 09:25:23 -08:00
Jesse Barnes e9560f7cb2 drm/i915: add GETPARAM request for page flipping
Add a GETPARAM request for checking if page flipping is supported.
Useful for the 2D driver to enable the flipping path.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 09:19:07 -08:00
Jesse Barnes 7bd4d7be5c drm: use page flip event to signal flip completion
We don't actually know which frame number the flip will complete on, so
userspace needs a specific flip notification to tell it when the last flip
completed.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Kristian Høgsberg <krh@bitplanet.net>
2009-12-01 09:11:53 -08:00
Kristian Høgsberg 6b95a207c1 drm/i915: Add intel implementation of the pageflip ioctl
Acked-by: Jakob Bornecrantz <jakob@vmware.com>
Acked-by: Thomas Hellström <thomas@shipmail.org>
Review-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse "Orange Smoothie" Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 09:10:35 -08:00
Eric Anholt f40d6817a5 Merge remote branch 'airlied/drm-next' into drm-intel-next 2009-12-01 09:01:54 -08:00
Zhenyu Wang 103a196f42 drm/i915: PineView only has LVDS and CRT ports
PineView only has 2 ports for LVDS and CRT. Don't enable other
ports for it.

Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-12-01 09:00:04 -08:00
Zhao Yakui c35614380d drm/i915: Don't set up the TV port if it isn't in the BIOS table.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 16:54:42 -08:00
Zhao Yakui 7cf4f69d3f drm/i915: Don't set up the LVDS if it isn't in the BIOS device table.
We not only check the device type, but also check the addin_offset. If the
addin_offset is zero, it won't be initialized.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
[anholt: hand-applied due to conflicts]
2009-11-30 16:54:35 -08:00
Zhao Yakui ae266c98f5 drm/i915: Don't set up DP ports that aren't in the BIOS device table.
Use the child device array to decide whether the given DP output should be
initialized. If the given DP port can't be found in child device array,
it is not present and won't be initialized.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 16:42:56 -08:00
Zhao Yakui fc81665523 drm/i915: Don't set up HDMI ports that aren't in the BIOS device table.
Use the child device array to decide whether the given HDMI output should be
initialized. If the given HDMI port can't be found in child device array,
it is not present and won't be initialized.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 16:41:48 -08:00
Zhao Yakui 6363ee6f49 drm/i915: parse child device from VBT
On some laptops there is no HDMI/DP. But the xrandr still reports
several disconnected HDMI/display ports. In such case the user will be
confused.
 >DVI1 disconnected (normal left inverted right x axis y axis)
 >DP1 disconnected (normal left inverted right x axis y axis)
 >DVI2 disconnected (normal left inverted right x axis y axis)
 >DP2 disconnected (normal left inverted right x axis y axis)
 >DP3 disconnected (normal left inverted right x axis y axis)

This patch set is to use the child device parsed in VBT to decide whether
the HDMI/DP/LVDS/TV should be initialized.

Parse the child device from VBT.

The device class type is also added for LFP, TV, HDMI, DP output.

https://bugs.freedesktop.org/show_bug.cgi?id=22785

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 16:36:53 -08:00
Kristian Høgsberg c1b5dea097 drm/i915: Disable pwrctx before unpin and free
Otherwise the chip may scribble over free memory.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 16:27:23 -08:00
Kristian Høgsberg 69341a5e01 drm/i915: Hold struct_mutex while unreffing pwrctx object
This also extends the mutex to cover fbc disabling, which is safe.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 16:27:07 -08:00
Kristian Høgsberg 33db679b4e drm/i915: Unregister i915_wedged debugfs entry using the right key
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 16:24:23 -08:00
Shaohua Li 29874f44fb drm/i915: fix gpio register detection logic for BIOS without VBT
if no VBT is present, crt_ddc_bus will be left at 0, and cause us
to use that for the GPIO register offset. That's never a valid register
offset, so let the "undefined" value be 0 instead of -1.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
[anholt: clarified the commit message a bit]
2009-11-30 16:10:56 -08:00
Chris Wilson d271817bae drm/i915: Avoid NULL dereference with component_only tv_modes
In commit d2d9f2324, the guard for a valid video mode was removed. This
caused the regression:

  kernel crash during kms graphic boot on Intel GM4500 platform
  https://bugzilla.redhat.com/show_bug.cgi?id=540218

This patches changes the logic slightly not to rely on a coupled
variable, but to just check whether the video_modes is valid before
dereferencing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Zhenyu Wang <zhenyu.z.wang@intel.com>
[ickle: Actually reference the correct bug report]
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 15:16:32 -08:00
Linus Torvalds 9709652703 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel:
  drm/i915: Select CONFIG_SHMEM
  drm/i915: Fix CRT hotplug detect by checking really no channels attached
  agp/intel: new host bridge support
  drm/i915: Add more registers save/restore for Ironlake suspend
  drm/i915: Fix IRQ stall issue on Ironlake
  drm/i915: HDMI hardware workaround for Ironlake
  drm/i915: Fix and cleanup DPLL calculation for Ironlake
  drm/i915: Avoid potential sleep whilst holding spinlock
2009-11-30 13:57:19 -08:00
Daniel Vetter 9bedb9743f drm/i915: fixup interrupted overlay switch off calls
When switching to interruptible sleeps in the overlay code, I've
forgotten to recover from interruptions at one site.  This
resulted in the overlay still running when it should have been
switched off. This in turn caused a hang on resume because it
tried to disable the (not-running) overlay in preparation for the
resume modeset.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=24980
Tested-by: maximlevitsky@gmail.com

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 09:50:57 -08:00
Daniel Vetter 12ca45fea9 drm/i915: overlay: extract some duplicated code
I've suspected some bug there wrt to suspend, but that was not
the case. Clean up the code anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 09:44:23 -08:00
Shaohua Li 2644487781 drm/i915: remove Pineview EOS protection support
HW guys have an evaluation about the impact about EOS, and say the impact
is quite small, so they have removed EOS detection support. This patch
removes EOS feature.

revert commit 0430296558
directly reverting it gives a hunk error, so please use this one.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
[anholt: fixed up commit message for update that the feature's really gone]
2009-11-30 09:42:12 -08:00
Shaohua Li 311089d3d3 drm/i915: use msleep for intel_wait_for_vblank
20ms delay is quite big and the routine isn't called in atomic context.
better use msleep to let other tasks run. This can reduce cpu time used
by Xorg, so potentially boost boot.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-30 09:39:57 -08:00
Shaohua Li 1991bdfaf5 drm/i915: handle failure path correctly for lvds
In failure path, make sure encoder is cleaned up, otherwise there
is a kernel oops.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-25 13:45:55 -08:00
Zhenyu Wang 1b3c7a47f9 drm/i915: Fix LVDS stability issue on Ironlake
In disable sequence, all output ports on PCH have to be disabled
before PCH transcoder, but LVDS port was left always enabled. This
one fixes that by disable LVDS port properly during pipe disable
process, and resolved stability issue seen on Ironlake. Also move
panel fitting disable time just after pipe disable to align with
the spec.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-25 13:09:35 -08:00
Zhao Yakui 4215866059 drm/i915: Restore the DPLL calculation logic for 9xx platform
The DPLL calculation logic for 9xx platform is changed in:
commit 652c393a33
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Mon Aug 17 13:31:43 2009 -0700

    drm/i915: add dynamic clock frequency control

Maybe we will get the different M/N/P combination with that by using the
previous dpll calculation logic.

So restore the DPLL calculation logic for 9xx platform.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-25 13:03:12 -08:00
Zhao Yakui d1fcea6a52 drm/i915: Check whether the LVDS downclock is found in VBT
Enumerate the LVDS panel timing info entry list in VBT to check whether
the LVDS downclock is found. If found, the downclock is also used to switch
dynamically between low and high frequency for LVDS.

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-11-25 13:02:33 -08:00
Zhao Yakui 18f9ed12f8 drm/i915: Enable LVDS downclock feature through EDID.
If more than one mode with the same resolution defined in EDID has different
refresh rate, it is thought that the downclock is found for LVDS.
We will program the different FPx0/1 register so that we can select dynamically
between the low and high frequency.

On the g4x platform we will use the CxSR feature to switch the different
refresh rate if the LVDS downclock feature is supported.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-25 12:46:41 -08:00
Chris Wilson ca9ab10033 drm/i915: Select CONFIG_SHMEM
The driver requires shmfs as the backing filesystem to handle the buffer
objects, so ensure it is selected if the user chooses to build our
driver.

Fixes: Bug 14662 - Dell E5500 kernel panic with KMS
http://bugzilla.kernel.org/show_bug.cgi?id=14662

The revealing nature of the panic is the NULL function pointer
dereference in read_cache_page_async().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-and-tested-by: Mateusz Kaduk <mateusz.kaduk@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Cc: stable@kernel.org
2009-11-25 12:27:42 -08:00
Zhenyu Wang 8e9e0eea99 drm/i915: Fix CRT hotplug detect by checking really no channels attached
For CRT hotplug detect status, we have four test results as blue
channel only, green channel only, both blue and green channel, and
no channel attached. Origin code only marks both blue and green channel
case as connected, but ignore other possible connected states. This one
trys to detect CRT by checking no channel attached case instead.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-25 12:10:18 -08:00
Eric Anholt c8e0f93a38 drm/i915: Replace a calloc followed by copying data over it with malloc.
Execbufs involve quite a bit of payload, to the extent that cache misses
show up in the profiles here, and a suspicion that some of those cachelines
may get evicted and then reloaded in the subsequent copy.

This is still abstracted like drm_calloc_large since we want to check for
size overflow, and because we want to choose between kmalloc and vmalloc
on the fly.  cairo's interface for malloc-with-calloc's-args was used as
the model.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-25 06:36:21 -08:00
Lin Ming 2263576cfc ACPICA: Add post-order callback to acpi_walk_namespace
The existing interface only has a pre-order callback. This change
adds an additional parameter for a post-order callback which will
be more useful for bus scans. ACPICA BZ 779.

Also update the external calls to acpi_walk_namespace.

http://www.acpica.org/bugzilla/show_bug.cgi?id=779

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2009-11-24 21:31:10 -05:00
Clemens Ladisch 5349ef3127 drm/fb: fix FBIOGET/PUT_VSCREENINFO pixel clock handling
When the framebuffer driver does not publish detailed timing information
for the current video mode, the correct value for the pixclock field is
zero, not -1.

Since pixclock is actually unsigned, the value -1 would be interpreted
as 4294967295 picoseconds (i.e., about 4 milliseconds) by
register_framebuffer() and userspace programs.

This patch allows X.org's fbdev driver to work.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:04:49 +10:00
Jeremy Fitzhardinge 79cc304f3e drm: make sure page protections are updated after changing vm_flags
Some architectures compute ->vm_page_prot depending on ->vm_flags, so we
need to update the protections after adjusting the flags.

AFAIK this only affects running X under Xen; without this patch you get
lots of coloured blobs on the screen, or maybe a complete lockup.  Or
anything really.

But that still depends on lots of out-of-tree stuff, so I don't think
there are any consequences for anyone else.  But it is wrong in principle.

Reported-by: Jan Beulich <JBeulich@novell.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:02:30 +10:00
Jerome Glisse f82f5f3ac4 drm/radeon/kms: Report vga connector is connected according to ddc_probe
On broken EDID we were reporting vga connector to be disconnected
even if ddc probe did found a monitor. This patch report that the
connector is connected on such case. This allow drm to add a fail
safe mode (800x600 at the time of this patch) thus user can boot
and later add a mode which match its monitor capabilities.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:02:25 +10:00
Jerome Glisse a698cf34ea drm: mm always protect change to unused_nodes with unused_lock spinlock
unused_nodes modification needs to be protected by unused_lock spinlock.
Here is an example of an usage where there is no such protection without
this patch.

  Process 1: 1-drm_mm_pre_get(this function modify unused_nodes list)
             2-spin_lock(spinlock protecting mm struct)
             3-drm_mm_put_block(this function might modify unused_nodes
               list but doesn't protect modification with unused_lock)
             4-spin_unlock(spinlock protecting mm struct)
  Process2:  1-drm_mm_pre_get(this function modify unused_nodes list)
At this point Process1 & Process2 might both be doing modification to
unused_nodes list. This patch add unused_lock protection into
drm_mm_put_block to avoid such issue.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:02:18 +10:00
Jerome Glisse 0beb81ab45 drm/radeon/kms: Disable TV load detect on RS400,RC410,RS480
RS400,RC410,RS480 chipset seems to report a lot of false positive
with load detect on TV output. We haven't yet found a way to make
load detect reliable on those chipset, thus just disable it for TV
output. Would avoid user to experience phantom screen because X
believe there is a monitor connected to the TV output.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:02:12 +10:00
Dave Airlie 23115b0592 drm/radeon/kms: read back register before writing in IIO.
This fixes RH bugzilla #527874.

On resume the atom posting wasn't working, however vbe posting was
going fine, after 2 weeks over irc, and 8 hrs with the hardware,
I tracked it down to the memory device table and it access the MC
registers via IIO, it appears the rv515 atom iio table might not
be fully functional, so adding a readback before doing a write
either provides enough delay to make things resume correctly.

Thanks to Peng Huang at Red Hat for coming to Brisbane.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:02:07 +10:00
Dave Airlie ef63062716 drm/radeon/kms: fix handling of d1/d2 vga
An rv515 laptop I got wouldn't startup with a montior plugged in,
found the proper bug hopefully with us not turning off D2VGA
here when we should.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:02:01 +10:00
Jesse Barnes 7064fef563 drm: work around EDIDs with bad htotal/vtotal values
We did this on the userspace side, but we need a similar fix for the
kernel.

Fixes LP #460664.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:01:53 +10:00
Dave Airlie 0ebf17174b drm/radeon/kms: resume AGP by calling init.
AGP resume was broken since we moved to the new init path,
because we never re-enabled AGP on these systems at resume time.

This patch just calls the AGP resume call which just does the reinit
at resume time like the old path did.

Since AGP is pretty much gpu independant I did it outside
the gpu specific code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 13:01:47 +10:00
Adam Jackson 9632b41f00 drm/modes: Fall back to 1024x768 instead of 800x600
This matches the X server's fallback modes when using RANDR 1.2.

See also: http://bugzilla.redhat.com/538761

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 11:24:24 +10:00
Adam Jackson 862b89c069 drm/edid: Fix up partially corrupted headers
We'll still fail the block if it fails the EDID checksum though.

See also: http://bugzilla.redhat.com/534120

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 11:24:23 +10:00
Adam Jackson 47ee4ccf74 drm/edid: Retry EDID fetch up to four times
This matches the X server's retry logic.  Note that we'll only retry if
we get a DDC response but fail validation; legitimately disconnected
outputs will bomb out early.

See also: http://bugzilla.redhat.com/532957

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 11:24:22 +10:00
Adam Jackson f985dedb57 drm/modes: Limit fallback modes to 60Hz
See also: http://bugzilla.redhat.com/514600

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-24 11:24:21 +10:00
Clemens Ladisch 3bea21b64c drm/kms: allocate framebuffer cmap
Without an allocated colormap, FBIOGETCMAP fails.  This would make
programs restore an all-black colormap ("links -g") or fail to work
altogether ("mplayer -vo fbdev2").

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-19 13:02:53 +10:00
Clemens Ladisch cda6be1ce2 drm/fb: fix FBIOGET/PUT_VSCREENINFO pixel clock handling
When the framebuffer driver does not publish detailed timing information
for the current video mode, the correct value for the pixclock field is
zero, not -1.

Since pixclock is actually unsigned, the value -1 would be interpreted
as 4294967295 picoseconds (i.e., about 4 milliseconds) by
register_framebuffer() and userspace programs.

This patch allows X.org's fbdev driver to work.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-19 13:02:46 +10:00
James Simmons 731b5a15a3 drm/kms: properly handle fbdev blanking
I examined several fbdev drivers and foudn the blanking code in
drm_fb_helper to be wrong. This patch fixes the fbdev blanking to behave
like other fbdev drivers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-19 12:51:56 +10:00
Dave Airlie 46557bef3f Merge branch 'drm-core-next' of ../linux-2.6 into drm-next 2009-11-18 10:09:55 +10:00
Kristian Høgsberg d91d8a3f88 drm/kms: add page flipping ioctl
This adds a page flipping ioctl to the KMS API.  The ioctl takes an fb ID
and a ctrc ID and flips the crtc to the given fb at the next vblank.
The ioctl returns immediately but the flip doesn't happen until after
any rendering that's currently queued up against the new framebuffer
is done.  After submitting a page flip, any execbuffer involving the
old front buffer will block until the flip is completed.

Optionally, a vblank event can be generated when the swap eventually
happens.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-18 10:05:47 +10:00
Andres Salomon dad07ca717 drm: check return values in drm_version
In drm_version, actually check the results from function calls so that
we're not potentially passing garbage back to userspace.

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-18 10:02:50 +10:00
Andres Salomon 140a45fc32 drm: replace DRM_COPY macro w/ a function
Don't inline it; the compiler can figure it out.  Comments added that are
based upon my interpretation of the code.  Hopefully they're correct. :)

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-18 10:02:50 +10:00
Andres Salomon 156822f717 drm: kill more unused DRM macros
There are a few more macros in drmP.h that are unused; DRM_GET_PRIV_SAREA,
DRM_ARRAY_SIZE, and DRM_WAITCOUNT can go away completely.

Unfortunately, DRM_COPY is still used in one place, but we can at least
move it to where it's used.  It's an awful looking macro..

[akpm: fix overeagerness]
Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-18 10:02:49 +10:00
Jesse Barnes 4a9216453c drm: when queuing an event with NEXTONMISS, return queued sequence to userspace
If we queue a vblank event but miss it, we should return the actual
sequence number we queued to userspace, so its event handling function
will know which event to look for.

Acked-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-18 10:02:48 +10:00
Kristian Høgsberg c9a9c5e02a drm: Add async event synchronization for drmWaitVblank
This patch adds a new flag to the drmWaitVblank ioctl, which asks the drm
to return immediately and notify userspace when the specified vblank sequence
happens by sending an event back on the drm fd.

The event mechanism works with the other flags supported by the ioctls,
specifically, the vblank sequence can be specified relatively or absolutely,
and works for primary and seconday crtc.

The signal field of the vblank request is used to provide user data,
which will be sent back to user space in the vblank event.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-18 10:02:47 +10:00
Linus Torvalds cb20c28a9c Merge branch 'hostprogs-wmissing-prototypes' of git://git.kernel.org/pub/scm/linux/kernel/git/josh/linux-misc
* 'hostprogs-wmissing-prototypes' of git://git.kernel.org/pub/scm/linux/kernel/git/josh/linux-misc:
  Makefile: Add -Wmising-prototypes to HOSTCFLAGS
  oss: Mark loadhex static in hex2hex.c
  dtc: Mark various internal functions static
  dtc: Set "noinput" in the lexer to avoid an unused function
  drm: radeon: Mark several functions static in mkregtable
  arch/sparc/boot/*.c: Mark various internal functions static
  arch/powerpc/boot/addRamDisk.c: Mark several internal functions static
  arch/alpha/boot/tools/objstrip.c: Mark "usage" static
  Documentation/vm/page-types.c: Declare checked_open static
  genksyms: Mark is_reserved_word static
  kconfig: Mark various internal functions static
  kconfig: Make zconf.y work with current bison
2009-11-17 09:14:49 -08:00
Josh Triplett 0592e4c49e drm: radeon: Mark several functions static in mkregtable
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
2009-11-15 15:01:40 -08:00
Zhenyu Wang 5586c8bc93 drm/i915: Add more registers save/restore for Ironlake suspend
Add more display registers save/restore to fix unstable issues
during S4 testing on Ironlake. And DPLL_B_MD should not be restored
on Ironlake.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-12 11:21:14 -08:00
Zou, Nanhai 2d109a845d drm/i915: Fix IRQ stall issue on Ironlake
The master irq control in DE must be disabled before irq handling,
and enable after the process. This fixes the irq stall issue on
Ironlake.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zou, Nanhai <nanhai.zou@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-12 11:16:33 -08:00
Linus Torvalds 6b46362c0e Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (52 commits)
  drm/kms: Init the CRTC info fields for modes forced from the command line.
  drm/radeon/r600: CS parser updates
  drm/radeon/kms: add debugfs for power management for AtomBIOS devices
  drm/radeon/kms: initial mode validation support
  drm/radeon/kms/atom/dce3: call transmitter init on mode set
  drm/radeon/kms: store detailed connector info
  drm/radeon/kms/atom/dce3: fix up usPixelClock calculation for Transmitter tables
  drm/radeon/kms/r600: fix rs880 support v2
  drm/radeon/kms/r700: fix some typos in chip init
  drm/radeon/kms: remove some misleading debugging output
  drm/radeon/kms: stop putting VRAM at 0 in MC space on r600s.
  drm/radeon/kms: disable D1VGA and D2VGA if enabled
  drm/radeon/kms: Don't RMW CP_RB_CNTL
  drm/radeon/kms: fix coherency issues on AGP cards.
  drm/radeon/kms: fix rc410 suspend/resume.
  drm/radeon/kms: add quirk for hp dc5750
  drm/radeon/kms/atom: fix potential oops in spread spectrum code
  drm/kms: typo fix
  drm/radeon/kms/atom: Make card_info per device
  drm/radeon/kms/atom: Fix DVO support
  ...
2009-11-11 11:32:04 -08:00
Jesse Barnes 4efc50d697 drm: when queuing an event with NEXTONMISS, return queued sequence to userspace
If we queue a vblank event but miss it, we should return the actual
sequence number we queued to userspace, so its event handling function
will know which event to look for.

Acked-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-11 13:44:58 +10:00
Francisco Jerez eeba57518c drm/kms: Init the CRTC info fields for modes forced from the command line.
Fixes fdo bug 24710.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-10 13:41:40 +10:00
Alex Deucher a39533b4dd drm/radeon/r600: CS parser updates
Add some additional regs that require relocs.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-10 13:41:07 +10:00
Dave Airlie fe625f137d Merge branch 'drm-next' of ../drm-2.6 into drm-next 2009-11-06 14:33:40 +10:00
Rafał Miłecki 7433874e31 drm/radeon/kms: add debugfs for power management for AtomBIOS devices
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-06 14:13:25 +10:00
Dave Airlie 6782cc7b61 Merge branch 'drm-next' of ../drm-2.6 into drm-next 2009-11-06 13:47:54 +10:00
Alex Deucher a3fa6320ce drm/radeon/kms: initial mode validation support
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-06 11:35:42 +10:00
Alex Deucher f95a9f0b05 drm/radeon/kms/atom/dce3: call transmitter init on mode set
Generally this is done at post, but might not always be done
with softboot or for connectors on docking stations.

Could probably be done once when the driver loads/resumes
rather than on each mode set.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-06 11:35:36 +10:00
Alex Deucher b75fad0682 drm/radeon/kms: store detailed connector info
This will be useful for mode validation and certain
atom tables.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-06 11:35:30 +10:00
Alex Deucher 4170a6c1bc drm/radeon/kms/atom/dce3: fix up usPixelClock calculation for Transmitter tables
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-06 11:35:24 +10:00
Alex Deucher ee59f2b462 drm/radeon/kms/r600: fix rs880 support v2
Lots of cases were wrong or missing.

v2: rebased against drm-next

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-06 11:35:18 +10:00
Eric Anholt 5b8f0be0dc Merge remote branch 'airlied/drm-next' into drm-intel-next 2009-11-05 15:04:06 -08:00
Daniel Vetter 43bcd61fae drm/i915: fix get_core_clock_speed for G33 class desktop chips
Somehow the case for G33 got dropped while porting from ums code.
This made a 400MHz chip into a 133MHz one which resulted in the
unnecessary enabling of double wide pipe mode which in turn
screwed up the overlay code.

Nothing else (than the overlay code) seems to be affected.

This fixes fdo.org bug #24835

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:57:39 -08:00
Zhenyu Wang c650156af3 drm/i915: Add display hotplug event on Ironlake
Enable display hotplug irqs from Ibex Peak (PCH).

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:49:37 -08:00
Zhao Yakui 01c66889c1 drm/i915: Add ACPI OpRegion support for Ironlake
Add the support of ACPI opregion on Ironlake so that the backlight
brightness can be adjusted by using ACPI interface
   >/sys/class/backlight/acpi_video0/brightness

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Zhao Yakui <yakui.zhao@intel.com>
[zhenyuw: cleanups, fix typo for checking GSE irq and convert to
current irq handling logic.]
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:49:13 -08:00
Jesse Barnes 1dc7546d1a drm/i915: enable self-refresh on 965
Need to calculate the SR watermark and enable it.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:14 -08:00
Kristian Høgsberg a4f45cf178 drm/i915: Support 30 bit depth modes
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:13 -08:00
Chris Wilson f3cd474bb2 drm/i915: debugfs interface to manually reset the GPU
Create a /debug/dri/%d/i915_wedged file to display the current wedged
status, and to enable setting that value. On an i965, this will also
trigger a GPU reset.

Useful in order to attempt to recover from some error conditions that
are not currently caught by the automatic hang detection code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:13 -08:00
Chris Wilson aed5f1dc26 drm/i915: Use a single thread workqueue
Our work is serialised so allocating per-cpu workqueues is overkill and
a waste of resources.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:12 -08:00
Zhao Yakui d0c3b04ae9 drm/i915: Replace DRM_DEBUG with DRM_DEBUG_KMS in DVO output code.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:12 -08:00
Eric Anholt 3e0f27ed75 drm/i915: Enable the SDVO debug code, which is now under DEBUG_KMS.
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:11 -08:00
Zhao Yakui 28c97730c3 drm/i915: Replace DRM_DEBUG with DRM_DEBUG_KMS
Replace the DRM_DEBUG with DRM_DEBUG_KMS in output device code.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:11 -08:00
Zhao Yakui 44d98a6142 drm/i915: Replace DRM_DEBUG with DRM_DEBUG_DRIVER
Replace the DRM_DEBUG with DRM_DEBUG_DRIVER in generic i915 driver.
Then the debug info can be obtained by adding the boot option of
"drm.debug=0x02".

At the same time the debug info in increase/decrease clock is also
printed by using DRM_DEBUG_DRIVER instead of DRM_DEBUG_KMS.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:10 -08:00
Daniel Vetter 5c5a4359fe drm/i915: overlay: kill one more unnecessary uninterruptible sleep
I've simply overlooked one case in the conversion to interruptible
sleeps. Rectify this.

Also delete a leftover debug printk.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:10 -08:00
Daniel Vetter 1df4b35b61 drm/i915: kill i915_lp_ring_sync
It's not needed anymore.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:09 -08:00
Daniel Vetter 03f77ea597 drm/i915: implement interruptible sleeps in the overlay code
At least for the common case of userspace ioctls. When doing a
modeset operation, the wait is still uninterruptible. But considering
that failing to turn off the overlay when switching off the crtc it's
running on hangs the chip, it doesn't complicate matters _very_
much. There's just an unkillable X in addition to a black screen.
BUG() about it and explain in the code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:09 -08:00
Daniel Vetter 5a5a0c64a9 drm/i915: implement fastpath for overlay flip waiting
As long as the gpu can keep up, neither the cpu (waiting for gpu)
nore the gpu (waiting for vblank to do an overlay flip) stalls.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:09 -08:00
Daniel Vetter 240a2d12df drm/i915: fully switch off overlay when not in use
Now that the cache flushing of the memory based overlay regs works,
we can safely switch off the overlay. Beforehand it was only disabled
(like in userspace).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:08 -08:00
Daniel Vetter 02e792fbaa drm/i915: implement drmmode overlay support v4
This implements intel overlay support for kms via a device-specific
ioctl. Thomas Hellstrom brought up the idea of a general ioctl (on
dri-devel). We've reached the conclusion that such an infrastructure
only makes sense when multiple kms overlay implementations exists,
which atm don't (and it doesn't look like this is gonna change).

Open issues:
- Runs in sync with the gpu, i.e. unnecessary waiting. I've decided
  to wait on this because the hw tends to hang when changing something
  in this area. I left some dummy functions as infrastructure.
- polyphase filtering uses a static table.
- uses uninterruptible sleeps. Unfortunately the alternatives may
  unnecessarily wedged the hw if/when we timeout too early (and
  userspace only overloaded the batch buffers with stuff worth a few
  secs of gpu time).

Changes since v1:
- fix off-by-one misconception on my side. This fixes fullscreen
  playback.
Changes since v2:
- add underrun detection as spec'ed for i965.
- flush caches properly, fixing visual corruptions.
Changes since v4:
- fix up cache flushing of overlay memory regs.
- killed require_pipe_a logic - it hangs the chip.

Tested-By: diego.abelenda@gmail.com (on a 865G)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[anholt: Resolved against the MADVISE ioctl going in before this one]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:08 -08:00
Daniel Vetter f0f8a9cece drm/i915: kill superflous IS_I855 macro
It is identical to I85X. Use that one instead.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[anholt: fix conflicts against the display function pointer stuff]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:07 -08:00
Daniel Vetter 48764bf43f drm/i915: add i915_lp_ring_sync helper
This just waits until the hw passed the current ring position with
cmd execution. This slightly changes the existing i915_wait_request
function to make uninterruptible waiting possible - no point in
returning to userspace while mucking around with the overlay, that
piece of hw is just too fragile.

Also replace a magic 0 with the symbolic constant (and kill the then
superflous comment) while I was looking at the code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:07 -08:00
Daniel Vetter 7a9c906094 drm: make drm_mode_object_find typesafe
I've wasted half a day hunting a bug that could easily be spotted by
gcc. Prevent this from reoccurring.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:06 -08:00
Jesse Barnes 97f5ab6651 drm/i915: add render standby support
Render standy allows the GPU to power down the render unit when idle.
In order for this to work, it needs a page of graphics memory to save
state.  This patch allocates that page and enables the feature on
supported chipsets.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:47:06 -08:00
Zhenyu Wang d8a2d0e00c drm/i915: HDMI hardware workaround for Ironlake
This brings some hardware workaround for HDMI port on PCH (Ibex Peak),
which fixes unstable issues like during rotation.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:03:28 -08:00
Zhenyu Wang 4bfe6b6876 drm/i915: Fix and cleanup DPLL calculation for Ironlake
When the ideal error range can't be reached, this will safely use
a most closed one. Clean up some dumb codes in DPLL function too.

This fixes DPLL clock issue against one monitor at 1680x1050@60hz.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 14:00:32 -08:00
Chris Wilson ba86bf8bfc drm/i915: Avoid potential sleep whilst holding spinlock
Miles Lane reported the following error:
2 locks held by cat/4179:
  #0:  (&p->lock){+.+.+.}, at: [<c10a3884>] seq_read+0x25/0x315
  #1:  (&dev_priv->mm.active_list_lock){+.+...}, at: [<c119a854>]
i915_batchbuffer_info+0x2b/0x124
Pid: 4179, comm: cat Not tainted 2.6.32-rc5-git1 #2
Call Trace:
  [<c104874f>] ? __debug_show_held_locks+0x1e/0x20
  [<c1023fb0>] __might_sleep+0xf0/0xf7
  [<c101c393>] kmap+0x17/0x58
  [<c119a8d6>] i915_batchbuffer_info+0xad/0x124
  [<c10a39bf>] seq_read+0x160/0x315
  [<c108fb8c>] ? rw_verify_area+0x98/0xbb
  [<c10a385f>] ? seq_read+0x0/0x315
  [<c1090331>] vfs_read+0x75/0xa9
  [<c10903f9>] sys_read+0x3b/0x5d
  [<c1002a8f>] sysenter_do_call+0x12/0x36

The fix is relatively simple, use the atomic variants of kmap() that
avoid the potential sleep.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Miles Lane <miles.lane@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-05 13:33:22 -08:00
Dave Airlie 4fe9676d1a Merge branch 'drm-next' of ../drm-2.6 into drm-next 2009-11-05 08:28:54 +10:00
Linus Torvalds 91d3f9bacd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel:
  drm/i915: Ironlake suspend/resume support
  drm/i915: kill warning in intel_find_pll_g4x_dp
  drm/i915: update watermarks before enabling PLLs
  drm/i915: add FIFO watermark support for G4x
  drm/i915: quiet DP i2c init
  drm/i915: fix panel fitting filter coefficient select for Ironlake
  drm/i915: fix to setup display reference clock control on Ironlake
  drm/i915: Install a fence register for fbc on g4x
  drm/i915: save/restore BLC histogram control reg across suspend/resume
  drm/i915: Fix FDI M/N setting according with correct color depth
  drm/i915: disable powersave feature for Ironlake currently
  drm/i915: Fix render reclock availability detection.
  drm/i915: Save and restore the GM45 FBC regs on suspend and resume.
  drm/i915: Set the LVDS_BORDER when using LVDS scaling mode
  drm/i915: disable FBC for Pineview, fixing a boot hang.
2009-11-04 07:05:43 -08:00
Alex Deucher e29649db3b drm/radeon/kms/r700: fix some typos in chip init
Noticed by Andre on IRC.

Also fix up some minor whitespace issues.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-04 13:39:17 +10:00
Alex Deucher 6fa8d66af8 drm/radeon/kms: remove some misleading debugging output
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-04 13:38:02 +10:00
Dave Airlie 4d357abb89 drm/radeon/kms: stop putting VRAM at 0 in MC space on r600s.
The Lenovo W500 laptop hangs inside an SMI on brightness changes,
I thought it just needed the VGA disable but it turned out to require
slightly more work, setting the MC locations up just like the IGP
chip requirements seems to make it all happy again and I can boot
and play with brightness.

We should probably just do this for all chips and give up the VRAM
at 0x0 idea, it never seems to buy us anything but pain.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-04 12:12:44 +10:00
Dave Airlie 8a9832e89f drm/radeon/kms: disable D1VGA and D2VGA if enabled
Once kms is enabled we don't need these, and it causes a problem
with the Lenovo W500 ACPI brightness implementation, it hangs
in a loop inside an SMI.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-04 09:53:42 +10:00
Alex Deucher d6f28938d9 drm/radeon/kms: Don't RMW CP_RB_CNTL
Immediate readback seems faulty on some chips.  I
suspect it takes a while to get through the fifo
to the actual register backbone.  There's no need
to read it back, so, just write the driver's copy
of the register's value directly.

Should fix bug 24535 and possibly 24218

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-04 09:53:25 +10:00
Dave Airlie df67bed92f drm/radeon/kms: fix coherency issues on AGP cards.
When we are evicting from VRAM->RAM we allocate the ttm object,
but we don't set the caching policy on it before blitting into it.
This means on AGP we end up blitting into cached pages, and
the CPU later flushes out on top of them. This was mostly seen as
font corruption.

The other question is why we don't evict VRAM->GTT in a lot of cases,
this would save us some cache transitions since a lot of objects
that are evicted from VRAM will probably end up being pulled back in
a few operations later, and evicting them to system memory involves
2 unnecessary cache transitions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-04 09:53:14 +10:00
Linus Torvalds c9354c85c1 i915: fix intel graphics suspend breakage due to resume/lid event confusion
In commit c1c7af6089 ("drm/i915: force
mode set at lid open time") the intel graphics driver was taught to
restore the LVDS mode on lid open.

That caused problems with interaction with the suspend/resume code,
which commonly runs at the same time (suspend is often caused by the lid
close event, while lid open is commonly a resume event), which was
worked around with in commit 06891e27a9
("drm/i915: fix suspend/resume breakage in lid notifier").

However, in the meantime the lid event code had also grown a user event
notifier (commit 06324194eee97a51b5f172270df49ec39192d6cc: "drm/i915:
generate a KMS uevent at lid open/close time"), and now _that_ causes
problems with suspend/resume and some versions of Xorg reacting to those
uevents by setting the mode.

So this effectively reverts that commit 06324194ee, and makes the lid
open protection logic against suspend/resume more explicit.  This fixes
at least one laptop. See

	http://bugzilla.kernel.org/show_bug.cgi?id=14484

for more details.

Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-11-02 09:29:55 -08:00
Dave Airlie 273fad2b82 Merge branch 'drm-next' of ../drm-2.6 into drm-next 2009-10-28 16:08:41 +10:00
Dave Airlie ea1495a627 drm/radeon/kms: fix rc410 suspend/resume.
This fixes suspend/resume on my rc410 motherboard, it restores
the memory controller setup before posting the GPU, since it seems
to need the MC_FB_LOCATION setup correctly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 16:01:58 +10:00
Alex Deucher fc7f7119d2 drm/radeon/kms: add quirk for hp dc5750
Doesn't have a tv-out port

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 15:52:17 +10:00
Alex Deucher d11aa88b33 drm/radeon/kms/atom: fix potential oops in spread spectrum code
Make sure we have an LVDS encoder before casting enc_priv.

[airlied: also fix two missing cpu_to_le16 casts we noticed on irc]

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 15:30:03 +10:00
James Simmons a2d49ae7df drm/kms: typo fix
I believe this is a typo.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 15:26:56 +10:00
Mathias Fröhlich 61c4b24b3e drm/radeon/kms/atom: Make card_info per device
Make the struct card_info, which is a per struct radeon_device dataset, a
struct member of the radeon device instead of a static per kernel module
value. This should avoid potential problems with two radeon cards installed in
one system.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 13:34:21 +10:00
Alex Deucher d56ef9c8fd drm/radeon/kms/atom: Fix DVO support
DVO in 12 bit mode (which seems to be the most common
config) requires 2x ppll.

Fixes fdo bug 21857.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 13:34:19 +10:00
Alex Deucher 8f552a66a4 drm/radeon/kms/atom: loosen pll min output limits
Limiting the pll output range is a good thing generally as
it limits the number of possible pll combinations for a given
frequency presumably to the ones that work best on each card.
That's why the limits are in the bios tables. However, certain
duallink DVI monitors seem to like pll combinations that would
be limited by this at least on pre-DCE 3.0 r6xx hardware.  This
might need to be adjusted per family or per clock range in the
future.

See fdo bug 24727.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 13:34:18 +10:00
Dave Airlie 77de0846ae drm/kms: fix kms/fbdev colormap support properly.
This sets the fbcon to use TRUECOLOR by default, it then
only modifies the pseudo palette for fbcon, and only touches
the real palette when in 8-bit pseudo color mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 11:23:48 +10:00
Zhao Yakui fcb4561144 drm: Add the basic check for the detailed timing in EDID
Sometimes we will get the incorrect display modeline when parsing the detailed
timing in EDID. For example:
   >hsync/vsync width is zero
   >sync is beyond the blank.

So add the basic check for the detailed timing in EDID to avoid the incorrect
display modeline.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 11:23:39 +10:00
Dave Airlie 93239ea158 drm/radeon/kms: ignore vga arbiter return.
Since we register all radeon devices, and the arbiter only cares about
VGA class ones, we will fail to startup on display controller class devices.
We don't gain anything by using the return value here.

this helps kms on sparc64 get started.

Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-28 11:09:58 +10:00
Kristian Høgsberg c182be37ed drm: Add async event synchronization for drmWaitVblank
This patch adds a new flag to the drmWaitVblank ioctl, which asks the drm
to return immediately and notify userspace when the specified vblank sequence
happens by sending an event back on the drm fd.

The event mechanism works with the other flags supported by the ioctls,
specifically, the vblank sequence can be specified relatively or absolutely,
and works for primary and seconday crtc.

The signal field of the vblank request is used to provide user data,
which will be sent back to user space in the vblank event.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:29:27 +10:00
Robert Noland 0a5c1e61db drm/radeon: A bit of cleanup work on radeon_freelist_get()
Fix the main loop to search all buffers before sleeping.
Remove dead code

Signed-off-by: Robert Noland <rnoland@2hip.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:29:26 +10:00
Alex Deucher 3e5cb98dfe drm/radeon/kms: add support for msi
Try to enable msi on chips that support it.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:23 +10:00
Alex Deucher ebbe1cb936 drm/radeon/kms/atom: add support for spread spectrum (v2)
Spread spectrum is a periodic disturbance added
to the feedback divider to change the pixel clock
periodically to reduce interference.

Only enabled on LVDS.

v2: add support for r4xx and fix DCE 3

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:22 +10:00
Alex Deucher c290dadf4c drm/radeon/kms/r7xx: add regs for 40 bit CUR/GRPH addresses
The *_HIGH regs are reversed. The secondary ones are in the
primary block and vice versa.

We currently only use a 32 bit internal address, so these are
0 for now.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:22 +10:00
Robert Noland 33fdb15c99 drm/radeon/r600: only assign vb after we know space is available.
This patch only changes this is the swap path, where it doesn't loop.

Signed-off-by: Robert Noland <rnoland@2hip.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:21 +10:00
Robert Noland c54b1820d6 drm/radeon/r600: Replace repeated calculations with variable.
- Reduce the chance of error and avoid a bit of overhead.
  - Use switch to assign color and format

Signed-off-by: Robert Noland <rnoland@2hip.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:21 +10:00
Mathias Fröhlich bc293e58cb drm/radeon/kms/atom: get better min pixel clock info
Where supported use ulMinPixelClockPLL_Output rather than
usMinPixelClockPLL_Output for pll_out_min.  This seems to
improve pll selection on some boards.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:20 +10:00
Alex Deucher 790cfb34ad drm/radeon/kms: add quirk for acer 5102
doesn't have a tv-out port

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:20 +10:00
Alex Deucher 5885b7a9f4 drm/radeon/kms: fix vram_width calculation on r6xx/r7xx
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:19 +10:00
Mathias Fröhlich ceb776bc87 drm/radeon/kms: fix cs parser tex bit 11 check
The problem boils down to the order when the bit11
of the texture size is or'ed to the original width.
In the end each mipmap level has the same width or
height because of that 11 bit is ored to the scaled
down lod with and thus blows up the size again to the
full size or more due to the power of two rounding
afterwards.

The attached patch changes this order so that the
texture sizes are computed correct. Also the on error
the yet missing inputs to the size computation are
printed which helped me to find out where it really breaks.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:28:19 +10:00
Dave Airlie c850cb7826 drm/kms: fix kms/fbdev colormap support properly.
This sets the fbcon to use TRUECOLOR by default, it then
only modifies the pseudo palette for fbcon, and only touches
the real palette when in 8-bit pseudo color mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-26 13:27:52 +10:00
Zhenyu Wang 4204878179 drm/i915: Ironlake suspend/resume support
This adds registers save/restore for Ironlake to make suspend work.

Signed-off-by: Guo, Chaohong <chaohong.guo@intel.com>
[zhenyuw: some code re-orgnization, and add more save/restore for
FDI link and transcoder registers, also fix palette register for Ironlake]
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-23 11:31:26 -07:00
Jesse Barnes fe798b9718 drm/i915: kill warning in intel_find_pll_g4x_dp
Initialize clock.vco to silence gcc.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-23 11:31:25 -07:00
Jesse Barnes 629598da93 drm/i915: update watermarks before enabling PLLs
When coming back from DPMS or turning on a display, make sure we have
the watermarks set up before turning on the display plane, otherwise we
may get underruns.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Dirk Hohndel <hohndel@infradead.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-23 11:31:18 -07:00
Jesse Barnes 0e442c60dd drm/i915: add FIFO watermark support for G4x
Turns out G4x needs to have sensible watermarks set, especially for
self-refresh enabled modes.  Add support for it.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Dirk Hohndel <hohndel@infradead.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-23 11:31:08 -07:00
Zhenyu Wang d54e9d2824 drm/i915: quiet DP i2c init
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-19 11:04:42 -07:00
Zhenyu Wang b1f60b7029 drm/i915: fix panel fitting filter coefficient select for Ironlake
Must set filter selection as hardcoded coefficients for medium 3x3
filtering, which matches vbios setting for Ironlake.

This fixes display corrupt issue on HP arrandale with new vbios.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-19 11:03:43 -07:00
Zhenyu Wang c038e51e84 drm/i915: fix to setup display reference clock control on Ironlake
For new stepping of PCH, the display reference clock
is fully under driver's control. This one trys to setup
all needed reference clock for different outputs. Older
stepping of PCH chipset should be ignoring this.

This fixes output failure issue on newer PCH which requires
driver to take control of reference clock enabling.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-19 11:03:37 -07:00
Alex Deucher d0c403e950 drm/radeon/kms: fix support for original r100
Original radeon didn't have a connector table in the
bios.  Check for the CRT table and if we have one,
add a VGA connector.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-10-16 18:31:29 +10:00
Alex Deucher 2d152c6ba8 drm/radeon/kms: fix legacy quirk handling
Need to check the return type for the quirk function
to decide whether we add the connectors and encoders.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-10-16 18:31:28 +10:00
Zhao Yakui f059d2ad69 drm: Add the basic check for the detailed timing in EDID
Sometimes we will get the incorrect display modeline when parsing the detailed
timing in EDID. For example:
   >hsync/vsync width is zero
   >sync is beyond the blank.

So add the basic check for the detailed timing in EDID to avoid the incorrect
display modeline.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-16 08:49:27 +10:00
Matt Turner a77f171843 drm/radeon/kms: use RADEON_GPU_PAGE_SIZE instead of 4096
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-16 08:49:23 +10:00
Alex Deucher dfdd646773 drm/radeon/kms: limit default tv modes to <= 1024x768
fixes fdo bug 24496

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-16 08:47:01 +10:00
Alex Deucher ceefedd8e8 drm/radeon/kms/atom: fix tv-out
D1MODE_INTERLEAVE_EN was getting set in some cases
in the encoder quirks function due to the changes in
5a9bcacc0a

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-16 08:47:00 +10:00
Alex Deucher 0294cf4f7f drm/radeon/kms: fix connector edid handling
Based partly on a patch from
Christian Koenig <deathsimple@vodafone.de>

- fix several memory leaks in radeon_connector->edid handling
- store edid in radeon_connector->edid in detect() or get_modes()
- switch hdmi detect code to use radeon_connector->edid
- add support for oem boards multiple connectors that share
a ddc line.
- short circuit lvds_detect() if have a stored edid

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-16 08:46:52 +10:00
Chris Wilson 0d9c778978 drm/i915: Install a fence register for fbc on g4x
To enable framebuffer compression on a g4x, we not only need the buffer
to tiled (X only), we also need to hold a fence register for the buffer.
Currently we only install a fence register for pre-i965s when setting up
the scanout buffer. Rather than adding some convoluted logic to
g4x_enable_fbc() to acquire a fence register, and perhaps to
g4x_disable_fbc() to release it again, we can extend the acquisition
during setup to all chipsets.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-15 09:20:58 -07:00
Jesse Barnes 0eb96d6ed3 drm/i915: save/restore BLC histogram control reg across suspend/resume
Turns out some machines, like the ThinkPad X40 don't come back if you
don't save/restore this register.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-15 09:20:48 -07:00
Alex Deucher 1b4d7d75cc drm/radeon/kms: fix internal tmds setup on legacy display engine
- crtc 0 routing was wrong
- need to clear various timing bits in FP_GEN_CNTL
- need to set FP_H/V2_SYNC_STRT_WID regs for crtc 1

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-15 15:33:46 +10:00
Alex Deucher 8c2a6d7304 drm/radeon/kms: move active_device setup into encoder fixup()
radeon_encoder->active_device defines the active routing
between the encoder and connector.  The encoder fixup and
dpms functions need to know the active_device to function
properly.  Setting active_device in the prepare hook was
too late in some cases.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-15 10:30:23 +10:00
Zhenyu Wang 58a27471d0 drm/i915: Fix FDI M/N setting according with correct color depth
FDI M/N calculation hasn't taken the current pipe color depth into account,
but always set as 24bpp. This one checks current pipe color depth setting,
and change FDI M/N calculation a little to use bits_per_pixel first, then
convert to bytes_per_pixel later.

This fixes display corrupt issue on Arrandle LVDS with 1600x900 panel
in 18bpp dual-channel mode.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-13 10:57:10 -07:00
Zhenyu Wang c03342fa6d drm/i915: disable powersave feature for Ironlake currently
Until we figure out the right setting for powersave features on
Ironlake, disable it for now. Also disable watermark update,
which has new registers for it on Ironlake too.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[anholt: Resolved against the Pineview FBC changes]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-13 10:56:57 -07:00
Andy Lutomirski 181a5336d6 drm/i915: Fix render reclock availability detection.
If the device didn't support EDP, we would bail out too soon.

Signed-off-by: Andy Lutomirski <luto@mit.edu>
[anholt: Pulled this patch out of the patch for adding quirks to
enable reclocking.]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-13 10:41:58 -07:00
Jesse Barnes 06027f9111 drm/i915: Save and restore the GM45 FBC regs on suspend and resume.
This hasn't fixed the regressions we were testing against, but clearly
should be required.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-13 10:36:20 -07:00
Zhao Yakui a3e17eb8f4 drm/i915: Set the LVDS_BORDER when using LVDS scaling mode
According to the spec the LVDS_BORDER_ENABLE bit decides whether the border
data should be included in the active display and data sent to the panel.
Border should be used when in VGA centered (un-scaled) mode or when scaling
a 4:3 source image to a wide screen panel (typical 16:9).

So when the LVDS scaling is used, decide whether the LVDS_BORDER should be
enabled or not according to the current scaling mode.

At the same time fix the typo error in LVDS center scaling mode.

https://bugs.freedesktop.org/show_bug.cgi?id=23789

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
tested-by: Zhao Jian <jian.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-13 10:13:19 -07:00
Shaohua Li 9216d44dc1 drm/i915: disable FBC for Pineview, fixing a boot hang.
Pineview doesn't have this FBC mechanism, so this code doesn't apply.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-13 10:09:26 -07:00
Alex Deucher fb06ca8f8c drm/radeon/kms: properly handle mode id with native mode changes
drm modes are objects with indentifiers.  Make sure to preserve
the mode id when copying mode params.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-13 08:45:52 +10:00
Dave Airlie 39deb2d675 drm/radeon/kms: fix use of index before proper initialisation.
With the adjust table introduction, we need to fill out index
before getting the table version.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 14:21:42 +10:00
Dave Airlie ceeb50279b drm/radeon: Revert "drm/r600: avoid assigning vb twice in blit code"
This reverts commit 49c458e544. It
seems to have some side effects in the non-kms cases.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:54:10 +10:00
Alex Deucher 0549a061b5 drm/radeon/kms: also check for edid in lvds detect
In case the system has bad native mode info but
valid edid.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:50 +10:00
Alex Deucher de2103e452 drm/radeon/kms: use drm_mode directly for panel modes
This reduces the number of mode format conversions needed
and makes native panel mode support cleaner.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:48 +10:00
Alex Deucher 5a9bcacc0a drm/radeon/kms/atom: rework crtc modeset
- clean up tv timing handling
- unify SetCRTC_Timing and SetCRTC_UsingDTDTiming

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:44 +10:00
Alex Deucher 2606c88608 drm/radeon/kms/atom: add support for AdjustDisplayPll
DCE3+ has an AdjustDisplayPll that will adjust the pixel
clock accordingly based on the encoder/transmitter to
handle special hw requirements.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:40 +10:00
Alex Deucher 5f9a0eb5af drm/radeon/kms/atom: reorder crtc dpms
Based on recommendation from bios docs.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:35 +10:00
Alex Deucher 2ffb842948 drm/radeon/kms: make sure LVDS panel is valid in detect()
If the panel data is bogus this can lead to problems
later when the hardware trys to set the mode.  If the
data is invalid, report LVDS as disconnected.

Should fix fdo bug 24247.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:32 +10:00
Michel Dänzer b5fc901002 drm/radeon/kms: Fix apparent typo in legacy CRTC memory bandwidth calculation.
While investigating the cause of CRTC FIFO underruns, I noticed that when
converting the memory bandwidth calculation from the userspace X driver code,
an instance of '8.0' was apparently accidentally converted to '80'.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:28 +10:00
Michel Dänzer f30f37def4 drm/radeon/kms: Update memory bandwidth requirements in mode_set_base hook.
The hook may change the number of bytes per pixel being scanned out, which
affects the CRTC memory bandwidth requirements. E.g. booting in 8bpp and then
running X in 32bpp would result in the bandwidth requirements being
underestimated for the latter and consequently in CRTC FIFO underruns causing
visible artifacts with 3D intensive workloads.

ATOM changes only compile-tested.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:42:14 +10:00
Dave Airlie e33497aaae drm/radeon/kms: don't refuse LUT because no framebuffer.
The fb binding might be happening in a subsequent crtc setup call.

gets rid of some lut issues.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-12 13:37:12 +10:00
Linus Torvalds 902ff18611 Merge branch 'drm-intel-next' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel
* 'drm-intel-next' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel:
  drm/i915: Initialize HDMI outputs as HDMI connectors, not DVI.
  drm/i915: Multiply the refresh by 1000 in TV mode validatiion
  drm/i915: Enable irq to trace batch buffer completion.
  drm/i915: batch submit seqno off-by-one.
  drm/i915: Record device minor rather than pointer in TRACE_EVENT
  drm/i915: Don't call intel_update_fbc from intel_crtc_cursor_set
2009-10-09 09:19:23 -07:00
Dave Airlie c1176d6f03 Merge branch 'drm-next' of ../drm-next into drm-linus
conflict in radeon since new init path merged with vga arb code.

Conflicts:
	drivers/gpu/drm/radeon/radeon.h
	drivers/gpu/drm/radeon/radeon_asic.h
	drivers/gpu/drm/radeon/radeon_device.c
2009-10-08 14:03:05 +10:00
Dave Airlie d4ac6a05d5 drm/radeon/kms: fix vline register for second head.
Both r100/r600 had this wrong, use the macro to extract the register
to relocate.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-08 11:39:16 +10:00
Robert Noland 49c458e544 drm/r600: avoid assigning vb twice in blit code
There is no need to assign vb before you know that space is available.

[agd5f: adapted for kernel tree.]

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-08 09:56:27 +10:00
Dave Airlie 9d8401fcbb drm/radeon: use list_for_each_entry instead of list_for_each
This is just a cleanup of the list macro usage.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-08 09:40:05 +10:00
Jerome Glisse 1a029b768f drm/radeon/kms: Fix AGP support for R600/RV770 family (v2)
For AGP to work unmapped access must cover VRAM & AGP as
AGP is treated like VRAM by the GPU (ie physical address).
This patch properly setup the virtual memory system aperture
to cover AGP if AGP is enabled. It seems that there is memory
corruption after resume when using AGP (RV770 seems unaffected
thought). Version 2 just fix merge issue with updated AGP
fallback patch.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-08 09:40:04 +10:00
Jerome Glisse b574f251f7 drm/radeon/kms: Fallback to non AGP when acceleration fails to initialize (v2)
When GPU acceleration is not working with AGP try to fallback to non
AGP GART (either PCI or PCIE GART). This should make KMS failure on
AGP less painfull. We still need to find out what is wrong when AGP
fails but at least user have a lot of more chances to get a working
configuration with acceleration. This patch also cleanup R600/RV770
fallback path so they use same code as others asics. Version 2
factorize agp disabling logic to avoid code duplication and bugs.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-08 09:40:04 +10:00
Jerome Glisse 01ceae8edd drm/radeon/kms: Fix RS600/RV515/R520/RS690 IRQ
Bad generated header file leaded to use wrong register
to check IRQ status and acknowledge them. Fix the header
and use proper registers.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-08 09:40:04 +10:00
Roel Kluin aa96e341c2 drm/radeon: Fix setting of bits
Duplicate bits set

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-07 14:26:38 +10:00
Dave Airlie df748b025d drm/ttm: fix refcounting in ttm global code.
the global refcount wasn't being increased after the first reference.
this caused an oops on unload on a multi-gpu card.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-06 15:46:10 +10:00
Dave Airlie b8c00ac5b5 drm/fb: add more correct 8/16/24/32 bpp fb support.
The previous patches had some unwanted side effects, I've fixed
the lack of 32bpp working, and fixed up 16bpp so it should also work.

this also adds the interface to allow the driver to set a preferred
console depth so for example low memory rn50 can set it to 8bpp.
It also catches 24bpp on cards that can't do it and forces 32bpp.

Tested on r100/r600/i945.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-06 13:54:01 +10:00
Dave Airlie 068143d388 drm/fb: add setcmap and fix 8-bit support.
This adds support for the setcmap api and fixes the 8bpp
support at least on radeon hardware. It adds a new load_lut
hook which can be called once the color map is setup.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-05 10:00:59 +10:00
Dave Airlie dfee5614e4 drm/radeon/kms: respect single crtc cards, only create one crtc. (v2)
Also add single crtc for RN50 chips.

changes in v2:
fix vblank init to respect single crtc flag
fix r100 mode bandwidth to respect single crtc flag

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-05 10:00:58 +10:00
Zhao Yakui 185974dd59 drm: Delete the DRM_DEBUG_KMS in drm_mode_cursor_ioctl
We can get the corresponding info by adding the boot option of "drm.debug=
0x07". But On some boxes it will print the following message many times in
course of moving mouse. In such case the useful DRM debug info will be flushed.
   >[drm:drm_mode_cursor_ioctl],

Avoid using the DRM_DEBUG_KMS in drm_mode_cursor_ioctl.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-05 10:00:57 +10:00
Alex Deucher b442962a9e drm/radeon/kms: add support for "Surround View"
"Surround View" is an option in the system bios that
enables the AMD IGP chip in conjunction with a
discrete AMD card.  However, since the IGP vbios is
part of the system bios it is not accessible via the
rom bar or the legacy vga location.  When "Surround View"
is enabled in the system bios, the system bios puts a
copy of the IGP vbios image at the start of vram.

This patch adds support for reading the vbios image out
of vram on IGP cards.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-05 10:00:56 +10:00
Adam Jackson 8d91104aac drm/i915: Initialize HDMI outputs as HDMI connectors, not DVI.
Even if the physical output connector is DVI, calling it HDMI
tells the user that there's HDMI audio signaling support.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-02 14:53:42 -07:00
Zhao Yakui 0d0884cee3 drm/i915: Multiply the refresh by 1000 in TV mode validatiion
As of 559ee21d26 the actual refresh rate
is returned by the function of drm_mode_vrefresh, so multiply the refresh
rate by 1000 in TV mode validation.

At the same time the error is expanded from 10 to 1000.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-02 12:12:31 -07:00
Eric Anholt 8d23adf761 Merge commit 'ickle/for-anholt' into drm-intel-next 2009-10-02 12:07:42 -07:00
Jerome Glisse ac447df4f2 drm/radeon/kms: Fix irq handling on AVIVO hw
Avivo hw have vblank interrupt in different place, fixes
irq handling (especialy irq disabling while suspending or
shuting down the module).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 09:39:23 +10:00
Jerome Glisse e7d40b9a0a drm/radeon/kms: R600/RV770 remove dead code and print message for wrong BIOS
R600 & RV770 family are all using atombios so remove dead code and
print an error message if we fail to find a valid atombios.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 09:34:14 +10:00
Jerome Glisse 75c8129893 drm/radeon/kms: Fix R600/RV770 disable acceleration path
When acceleration doesn't work we should free associated memory
and stop GPU block responsible for hardware acceleration so we
don't waste resource or let think one component of the driver that
a GPU feature is working/running while it doesn't actualy work.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 09:34:09 +10:00
Jerome Glisse a3c1945aaf drm/radeon/kms: Fix R600/RV770 startup path & reset
We were calling reset unconditionaly in the startup path
this is bad we need to call GPU reset for a good reason
as after reset the GPU is in unknown states. To avoid any
more bad things to happen we now also unconditionaly
reinitialize the GPU after reset. This patch fix few issues
reported by different people regarding KMS & R6XX/RV7XX hw.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 09:34:03 +10:00
Jerome Glisse 81cc35bfc1 drm/radeon/kms: Fix R600 write back buffer
This split write back buffer handling into 3 functions,
wb_fini for cleanup, wb_enable/wb_disable for enabling/disabling
write back used for suspend/resume. This should fix
potential issue of letting the write back active before
suspending. We need to allocate memory in wb_enable because
we can only allocate once GART is running.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 09:33:52 +10:00
Jerome Glisse 62a8ea3f7b drm/radeon/kms: Remove old init path as no hw use it anymore
This remove old init path and allow code cleanup, now all hw
use the new init path, see top of radeon.h for description of
this.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 09:33:46 +10:00
Jerome Glisse c010f8000a drm/radeon/kms: Convert RS600 to new init path
New init path allow to simply asic initialization and make easier
to trace what happen on each different asic. We are removing most
callback. Do a massive RS600 register cleanup to clarify RS600
register, we are still bit fuzy on some register and waiting for
more informations. I don't have hw to test, so this patch is a
best effort to not break anythings and to try to improve things.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 09:25:50 +10:00
Jerome Glisse 3bc6853593 drm/radeon/kms: Convert RS690/RS740 to new init path (V2).
Also cleanup register specific to RS690/RS740. Version 2 add
missing header file for register, remove unecessary call to AGP
function and fix an indentation bug.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 08:51:50 +10:00
Jerome Glisse d455090715 drm/radeon/kms: Convert R100 to new init path (V2)
New init path allow to simply asic initialization and make easier
to trace what happen on each different asic. We are removing most
callback. More cleanup should happen latter to remove even more
callback. Also cleanup register specific to R100,RV200,RV250.
Version 2 correct the placement on IGP of the VRAM inside GPU address
space to match the stollen RAM placement of IGP.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 08:51:49 +10:00
Jerome Glisse 207bf9e90c drm/radeon/kms: Convert R300 to new init path
Also cleanup register specific to R300.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 08:51:48 +10:00
Jerome Glisse ca6ffc64cb drm/radeon/kms: Convert RS400/RS480 to new init path & fix legacy VGA (V3)
Also cleanup register specific to RS400/RS480. This patch also fix
legacy VGA register used to disable VGA access we were programming
wrong register. Now we should properly disable VGA on r100 up to
rs400 asics. Note that RS400/RS480 resume is broken, it hangs the
computer while reprogramming dynamic clock, doesn't work either
without that patch. We need to spend more time investigating this
issue. Version 2 of the patch remove dead code that was left
commented out in the previous version. Version 3 correct the
placement on IGP of the VRAM inside GPU address space to match the
stollen RAM placement of IGP.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-02 08:51:46 +10:00
Linus Torvalds e15daf6cdf Merge branch 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (25 commits)
  drm/radeon/kms: Convert R520 to new init path and associated cleanup
  drm/radeon/kms: Convert RV515 to new init path and associated cleanup
  drm: fix radeon DRM warnings when !CONFIG_DEBUG_FS
  drm: fix drm_fb_helper warning when !CONFIG_MAGIC_SYSRQ
  drm/r600: fix memory leak introduced with 64k malloc avoidance fix.
  drm/kms: make fb helper work for all drivers.
  drm/radeon/r600: fix offset handling in CS parser
  drm/radeon/kms/r600: fix forcing pci mode on agp cards
  drm/radeon/kms: fix for the extra pages copying.
  drm/radeon/kms/r600: add support for vline relocs
  drm/radeon/kms: fix some bugs in vline reloc
  drm/radeon/kms/r600: clamp vram to aperture size
  drm/kms: protect against fb helper not being created.
  drm/r600: get values from the passed in IB not the copy.
  drm: create gitignore file for radeon
  drm/radeon/kms: remove unneeded master create/destroy functions.
  drm/kms: start adding command line interface using fb.
  fb: change rules for global rules match.
  drm/radeon/kms: don't require up to 64k allocations. (v2)
  drm/radeon/kms: enable dac load detection by default.
  ...

Trivial conflicts in drivers/gpu/drm/radeon/radeon_asic.h due to adding
'->vga_set_state' function pointers.
2009-09-30 08:03:00 -07:00
Chris Wilson 9d34e5db07 drm/i915: Enable irq to trace batch buffer completion.
If we trigger a tracepoint for batch buffer submission, it is a reasonable
assumption that we wish to also trace the batch buffer completion. So in
order to capture the completion events, we need to enable irqs... However,
we cannot rely on the completion event to disable the irq later, so we
defer the irq disable to the retire request.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-29 03:15:25 +01:00
Chris Wilson 8f0dc5bf17 drm/i915: batch submit seqno off-by-one.
We increment the seqno number between submitting the batch buffer and
the flush/interrupt that demarcates its end, so the tracepoint needs to
reference the incremented value to match the completion event.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-29 03:15:24 +01:00
Chris Wilson 4f49be5468 drm/i915: Record device minor rather than pointer in TRACE_EVENT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-29 03:15:23 +01:00
Jerome Glisse f0ed1f655a drm/radeon/kms: Convert R520 to new init path and associated cleanup
Convert the r520 asic support to new init path, change are smaller than
previous one as most of the architecture is now in place and more code
sharing can happen btw various asics.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-29 11:15:56 +10:00
Jerome Glisse d39c3b8958 drm/radeon/kms: Convert RV515 to new init path and associated cleanup
Convert the rv515 asic support to new init path also add an explanation
in radeon.h about the new init path. There is also few cleanups
associated with this change (others asic calling rv515 helper
functions).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-29 11:15:54 +10:00
Mikael Pettersson f4e45d02e4 drm: fix radeon DRM warnings when !CONFIG_DEBUG_FS
Compiling the radeon DRM driver with !CONFIG_DEBUG_FS
throws the following warnings:

drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_debugfs_init':
drivers/gpu/drm/radeon/radeon_ttm.c:714: warning: unused variable 'i'
drivers/gpu/drm/radeon/radeon_ttm.c: At top level:
drivers/gpu/drm/radeon/radeon_ttm.c:692: warning: 'radeon_mem_types_list' defined but not used
drivers/gpu/drm/radeon/radeon_ttm.c:693: warning: 'radeon_mem_types_names' defined but not used

Fix: move these variables inside the #if defined(CONFIG_DEBUG_FS)
block in radeon_ttm_debugsfs_init(), which is the only place using them.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-29 11:15:44 +10:00
Mikael Pettersson bea1d35b8e drm: fix drm_fb_helper warning when !CONFIG_MAGIC_SYSRQ
Compiling DRM throws the following warning if MAGIC_SYSRQ is disabled:

drivers/gpu/drm/drm_fb_helper.c:101: warning: 'sysrq_drm_fb_helper_restore_op' defined but not used

Fix: place sysrq_drm_fb_helper_restore_op and associated
definitions inside #ifdef CONFIG_MAGIC_SYSRQ.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-29 11:15:37 +10:00
Brian Rogers 4781f20f29 drm/i915: Don't call intel_update_fbc from intel_crtc_cursor_set
Commit 74dff282 exposed this unnecessary call by causing a change in
the failure path on i965 where framebuffer compression will be turned
on and off on every cursor update. If you don't have the xf86-video-intel
fix to avoid the blinking cursor effect, this is very slow.

Symptoms were a far more noticeable cursor blink with every cursor image
change combined with severe slowdown for animated cursors.

Signed-off-by: Brian Rogers <brian@xyzw.org>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-28 16:03:21 -07:00
Dave Airlie 4c57edba45 drm/r600: fix memory leak introduced with 64k malloc avoidance fix.
The legacy r600 path shares code, but doesn't share quite enough
to get the freeing correct. Free the pages here also.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-28 15:37:25 +10:00
Dave Airlie 74bf2ad508 drm/kms: make fb helper work for all drivers.
This initialises the fb helper with the connector helper,
so that the fb cmdline code works for intel as well.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-28 15:31:10 +10:00
Alexey Dobriyan f0f37e2f77 const: mark struct vm_struct_operations
* mark struct vm_area_struct::vm_ops as const
* mark vm_ops in AGP code

But leave TTM code alone, something is fishy there with global vm_ops
being used.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-27 11:39:25 -07:00
Alex Deucher 210bed8f82 drm/radeon/r600: fix offset handling in CS parser
Need add reloc offset to the offset in the actual
packet.  Fixes use of the DRAW_INDEX packet by the 3D
driver.

[airlied: modified first one where idx_value == ib[idx+0]

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-26 09:09:50 +10:00
Alex Deucher 2b5d6c538b drm/radeon/kms/r600: fix forcing pci mode on agp cards
All we need to do on r6xx/r7xx is clear the RADEON_IS_AGP
flag; the rest is handled in r600.c

fixes fdo bug 23990:
http://bugs.freedesktop.org/show_bug.cgi?id=23990

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-26 09:07:43 +10:00
Dave Airlie c5e617e2f8 drm/radeon/kms: fix for the extra pages copying.
Thanks to Michel for pointing this out to me, this is
why I need to get more sleep, over complicate this a bit.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-26 09:03:39 +10:00
Alex Deucher 2f67c6e022 drm/radeon/kms/r600: add support for vline relocs
Provides support for anti-tearing functionality
in the ddx.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-26 07:49:00 +10:00
Alex Deucher 90ebd0655a drm/radeon/kms: fix some bugs in vline reloc
- fix offset of NOP packet for parsing
- fix p->idx increments
- fix bad mask when updating crtc vline info

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-26 07:48:59 +10:00
Alex Deucher 974b16e33e drm/radeon/kms/r600: clamp vram to aperture size
r6xx and r7xx was missing this.  We don't support
non-CPU accessible vram yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-26 07:48:58 +10:00
Dave Airlie 8ef8678c8f drm/kms: protect against fb helper not being created.
If drivers don't init the fb helper on the connector, the cmdline
code won't work, but it shouldn't crash either.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-26 06:39:00 +10:00
Dave Airlie adea4796cf drm/r600: get values from the passed in IB not the copy.
this avoids reading back the IB on AGP, also it avoids
the race where since we haven't fetched the page from the main IB
and written it to the gpu one, reading back fetches 0.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-25 14:23:47 +10:00
Amerigo Wang 31edd4824e drm: create gitignore file for radeon
Got lots of untracked files after compiling.
These files are generated, thus should be ignored by git.

Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-25 13:08:21 +10:00
Dave Airlie e3590096f7 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>
2009-09-25 13:08:20 +10:00
Dave Airlie d50ba256b5 drm/kms: start adding command line interface using fb.
[note this requires an fb patch posted to linux-fbdev-devel already]

This uses the normal video= command line option to control the kms
output setup at boot time. It is used to override the autodetection
done by kms.

video= normally takes a framebuffer as the first parameter, in kms
it will take a connector name, DVI-I-1, or LVDS-1 etc. If no output
connector is specified the mode string will apply to all connectors.

The mode specification used will match down the probed modes, and if
no mode is found it will add a CVT mode that matches.

video=1024x768 - all connectors match a 1024x768 mode or add a CVT on
video=VGA-1:1024x768, VGA-1 connector gets mode only.

The same strings as used in current fb modedb.c are used, except I've
added three more letters, e, D, d, e = enable, D = enable Digital,
d = disable, which allow a connector to be forced into a certain state.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-25 13:08:20 +10:00
Dave Airlie 513bcb4655 drm/radeon/kms: don't require up to 64k allocations. (v2)
This avoids needing to do a kmalloc > PAGE_SIZE for the main
indirect buffer chunk, it adds an accessor for all reads from
the chunk and caches a single page at a time for subsequent
reads.

changes since v1:
Use a two page pool which should be the most common case
a single packet spanning > PAGE_SIZE will be hit, but I'm
having trouble seeing anywhere we currently generate anything like that.
hopefully proper short page copying at end
added parser_error flag to set deep errors instead of having to test
every ib value fetch.
fixed bug in patch that went to list.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-25 13:08:18 +10:00
Dave Airlie 35e4b7af21 drm/radeon/kms: enable dac load detection by default.
when I added the property I forgot to enable it.

Thanks to soreau on #radeon for tracking it down.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-25 13:08:18 +10:00
Dave Airlie 4bbd497370 drm/radeon/kms: enable r600 tv outputs.
I never changed this back when I wrote tv-out support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-25 13:08:17 +10:00
Linus Torvalds 94e0fb086f Merge branch 'drm-intel-next' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel
* 'drm-intel-next' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel: (57 commits)
  drm/i915: Handle ERESTARTSYS during page fault
  drm/i915: Warn before mmaping a purgeable buffer.
  drm/i915: Track purged state.
  drm/i915: Remove eviction debug spam
  drm/i915: Immediately discard any backing storage for uneeded objects
  drm/i915: Do not mis-classify clean objects as purgeable
  drm/i915: Whitespace correction for madv
  drm/i915: BUG_ON page refleak during unbind
  drm/i915: Search harder for a reusable object
  drm/i915: Clean up evict from list.
  drm/i915: Add tracepoints
  drm/i915: framebuffer compression for GM45+
  drm/i915: split display functions by chip type
  drm/i915: Skip the sanity checks if the current relocation is valid
  drm/i915: Check that the relocation points to within the target
  drm/i915: correct FBC update when pipe base update occurs
  drm/i915: blacklist Acer AspireOne lid status
  ACPI: make ACPI button funcs no-ops if not built in
  drm/i915: prevent FIFO calculation overflows on 32 bits with high dotclocks
  drm/i915: intel_display.c handle latency variable efficiently
  ...

Fix up trivial conflicts in drivers/gpu/drm/i915/{i915_dma.c|i915_drv.h}
2009-09-24 10:30:41 -07:00
Adam Jackson f066a17d9f drm/edid: Fix standard timing parse for EDID <= 1.2
Aspect ratio code of 0 means 1:1 before EDID 1.3.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-24 09:46:08 +10:00
Adam Jackson 93dc6c2b0d drm/edid: Detailed standard timing blocks have six timings, not five.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-24 09:46:06 +10:00
Adam Jackson 23425caeeb drm/edid: Ignore bad standard timings.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-24 09:46:04 +10:00
Adam Jackson 083ae0560a drm/edid: const cleanup
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-24 09:46:03 +10:00
Linus Torvalds 85afd82780 Merge branch 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/radeon/r600: set correct pitch for 4 byte copy
  drm/radeon: consolidate family flags used in pciids.
2009-09-23 10:09:18 -07:00
Chris Wilson c715089f49 drm/i915: Handle ERESTARTSYS during page fault
During a page fault and rebinding the buffer there exists a window for a
signal to arrive during the i915_wait_request() and trigger a
ERESTARTSYS. This used to be handled by returning SIGBUS and thereby
killing the application. Try 'cairo-perf-trace & cairo-test-suite' and
watch X go boom!

The solution as suggested by H. Peter Anvin is to simply return NOPAGE and
leave the higher layers to spot we did not fill the page and resubmit
the page fault.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
[anholt: Mostly squash it with another commit]
2009-09-22 18:25:32 -07:00
Andre Maasikas 5b31aee9d7 drm/radeon/r600: set correct pitch for 4 byte copy
[agd5f: also fix the non-kms path]

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2009-09-23 10:21:06 +10:00
Dave Airlie c214271563 drm/radeon: consolidate family flags used in pciids.
having these separate was pointless and introduced a bug when
one got updated without the other.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-23 10:21:00 +10:00
Chris Wilson ab18282d58 drm/i915: Warn before mmaping a purgeable buffer.
Only allow the user to mmap buffers that have not been marked as
purgeable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:10:39 +01:00
Chris Wilson bb6baf76f4 drm/i915: Track purged state.
In order to correctly prevent the invalid reuse of a purged buffer, we
need to track such events and warn the user before something bad
happens.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:10:38 +01:00
Chris Wilson 9731129c5e drm/i915: Remove eviction debug spam
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:10:38 +01:00
Chris Wilson 2d7ef395b3 drm/i915: Immediately discard any backing storage for uneeded objects
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:10:37 +01:00
Chris Wilson 963b483691 drm/i915: Do not mis-classify clean objects as purgeable
Whilst cleaning up the patches for submission, I mis-classified non-dirty
objects as purgeable. This was causing the backing pages for those
objects to be evicted under memory-pressure, discarding valid and
unreplaceable texture data.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:10:36 +01:00
Chris Wilson 13a05fd978 drm/i915: Whitespace correction for madv
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:10:35 +01:00
Chris Wilson a32808c0a1 drm/i915: BUG_ON page refleak during unbind
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:10:21 +01:00
Chris Wilson 9a1e2582d8 drm/i915: Search harder for a reusable object
As evict_something() is called by routines that do not repeatedly search
again, try harder in the initial search to find an object that matches
the request.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:05:28 +01:00
Chris Wilson ab5ee57650 drm/i915: Clean up evict from list.
First the routine attempted to unlock a mutex it did not own along the
error path.

Secondly the routine should never be called on any list but the inactive
one, since we attempt to unbind those objects, so fix the calling semantics.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:05:26 +01:00
Chris Wilson 1c5d22f76d drm/i915: Add tracepoints
By adding tracepoint equivalents for WATCH_BUF/EXEC we are able to monitor
the lifetimes of objects, requests and significant events. These events can
then be probed using the tracing frameworks, such as systemtap and, in
particular, perf.

For example to record the stack trace for every GPU stall during a run, use

  $ perf record -e i915:i915_gem_request_wait_begin -c 1 -g

And

  $ perf report

to view the results.

[Updated to fix compilation issues caused.]
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Ben Gamari <bgamari@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-09-23 01:05:21 +01:00
Linus Torvalds 342ff1a1b5 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (34 commits)
  trivial: fix typo in aic7xxx comment
  trivial: fix comment typo in drivers/ata/pata_hpt37x.c
  trivial: typo in kernel-parameters.txt
  trivial: fix typo in tracing documentation
  trivial: add __init/__exit macros in drivers/gpio/bt8xxgpio.c
  trivial: add __init macro/ fix of __exit macro location in ipmi_poweroff.c
  trivial: remove unnecessary semicolons
  trivial: Fix duplicated word "options" in comment
  trivial: kbuild: remove extraneous blank line after declaration of usage()
  trivial: improve help text for mm debug config options
  trivial: doc: hpfall: accept disk device to unload as argument
  trivial: doc: hpfall: reduce risk that hpfall can do harm
  trivial: SubmittingPatches: Fix reference to renumbered step
  trivial: fix typos "man[ae]g?ment" -> "management"
  trivial: media/video/cx88: add __init/__exit macros to cx88 drivers
  trivial: fix typo in CONFIG_DEBUG_FS in gcov doc
  trivial: fix missing printk space in amd_k7_smp_check
  trivial: fix typo s/ketymap/keymap/ in comment
  trivial: fix typo "to to" in multiple files
  trivial: fix typos in comments s/DGBU/DBGU/
  ...
2009-09-22 07:51:45 -07:00
Jesse Barnes 74dff28223 drm/i915: framebuffer compression for GM45+
Add support for framebuffer compression on GM45 and above.  Removes
some unnecessary I915_HAS_FBC checks as well (this is now part of the
FBC display function).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-21 15:47:38 -07:00
Jesse Barnes e70236a8d3 drm/i915: split display functions by chip type
This patch splits out several of the display functions into a separate
display function table to avoid tons of chipset specific if..else
if..else if blocks all over.  There are more opportunities for this
(some noted in the structure defintition); so more cleanup patches will
follow.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-21 15:47:33 -07:00
Linus Torvalds 44040f107e Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (133 commits)
  drm/vgaarb: add VGA arbitration support to the drm and kms.
  drm/radeon: some r420s have a CP race with the DMA engine.
  drm/radeon/r600/kms: rv670 is not DCE3
  drm/radeon/kms: r420 idle after programming GA_ENHANCE
  drm/radeon/kms: more fixes to rv770 suspend/resume path.
  drm/radeon/kms: more alignment for rv770.c with r600.c
  drm/radeon/kms: rv770 blit init called too late.
  drm/radeon/kms: move around new init path code to avoid posting at init
  drm/radeon/r600: fix some issues with suspend/resume.
  drm/radeon/kms: disable VGA rendering engine before taking over VRAM
  drm/radeon/kms: Move radeon_get_clock_info() call out of radeon_clocks_init().
  drm/radeon/kms: add initial connector properties
  drm/radeon/kms: Use surfaces for scanout / cursor byte swapping on big endian.
  drm/radeon/kms: don't fail if we fail to init GPU acceleration
  drm/r600/kms: fixup number of loops per blit calculation.
  drm/radeon/kms: reprogram format in set base.
  drm/radeon: avivo chips have no separate int bit for display
  drm/radeon/r600: don't do interrupts
  drm: fix _DRM_GEM addmap error message
  drm: update crtc x/y when only fb changes
  ...

Fixed up trivial conflicts in firmware/Makefile due to network driver
(cxgb3) and drm (mga/r128/radeon) firmware being listed next to each
other.
2009-09-21 08:10:09 -07:00
Joe Perches a419aef8b8 trivial: remove unnecessary semicolons
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-21 15:14:58 +02:00
Anand Gadiyar fd589a8f0a trivial: fix typo "to to" in multiple files
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-21 15:14:55 +02:00
Dave Airlie 28d520433b drm/vgaarb: add VGA arbitration support to the drm and kms.
VGA arb requires DRM support for non-kms drivers, to turn on/off
irqs when disabling the mem/io regions.

VGA arb requires KMS support for GPUs where we can turn off VGA
decoding. Currently we know how to do this for intel and radeon
kms drivers, which allows them to be removed from the arbiter.

This patch comes from Fedora rawhide kernel.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-21 15:00:27 +10:00
Alex Deucher aadd4e1745 drm/radeon: some r420s have a CP race with the DMA engine.
This patch makes sure the CP doesn't DMA do VRAM while 2D
is active by inserting a CP resync token.

todo: port to kms.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-21 14:48:45 +10:00
Alex Deucher 5a6e9f9658 drm/radeon/r600/kms: rv670 is not DCE3
RV670 was using the wrong modesetting code.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-21 14:47:41 +10:00
Dave Airlie 18a4cd2e91 drm/radeon/kms: r420 idle after programming GA_ENHANCE
https://bugs.freedesktop.org/show_bug.cgi?id=24041

The idle allows rs690 to startup properly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-21 14:15:10 +10:00
Dave Airlie fe62e1a45d drm/radeon/kms: more fixes to rv770 suspend/resume path.
This resumes my
RV730PRO (4650)
RV770 (4850)
fine.

Still researching the RV4550 (RV710), resumes without X fine.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-21 14:14:59 +10:00
Kay Sievers e454cea20b Driver-Core: extend devnode callbacks to provide permissions
This allows subsytems to provide devtmpfs with non-default permissions
for the device node. Instead of the default mode of 0600, null, zero,
random, urandom, full, tty, ptmx now have a mode of 0666, which allows
non-privileged processes to access standard device nodes in case no
other userspace process applies the expected permissions.

This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-19 12:50:38 -07:00
Chris Wilson 8542a0bbbb drm/i915: Skip the sanity checks if the current relocation is valid
If the presumed_offset as feed to userspace and returned to the kernel
from a previous execbuffer is still valid, then we do not need to rewrite
the relocation entry and may skip the offset sanity checks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-18 15:31:39 -07:00
Chris Wilson cd0b9fb400 drm/i915: Check that the relocation points to within the target
Eric noted a potential concern with the low bits not being strictly used
as part of the absolute offset (instead part of the command stream to the
GPU), but in practice that should not be an issue.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Andy Whitcroft <apw@canonical.com>
Cc: Eric Anholt <eric@anholt.net>
CC: stable@kernel.org
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-18 15:31:21 -07:00
Dave Airlie 4153e584ee drm/radeon/kms: more alignment for rv770.c with r600.c
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 18:41:24 +10:00
Dave Airlie 9052aa2458 drm/radeon/kms: rv770 blit init called too late.
re-align with r600 code, to init blit earlier.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 18:34:53 +10:00
Dave Airlie fc30b8efbe drm/radeon/kms: move around new init path code to avoid posting at init
We really don't want to post the card at init, it takes a relatively
long time and isn't required, so split the resume path into
a startup path called by both init/resume and separate resume
entry point to do posting.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:17:42 +10:00
Dave Airlie bc1a631e51 drm/radeon/r600: fix some issues with suspend/resume.
a) don't zero gart table on gart enable
b) move pinning shader object into resume path
c) unpin shader object on suspend
d) set cp ready to false after cp shutdown on suspend.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:17:30 +10:00
Dave Airlie 698443d9ec drm/radeon/kms: disable VGA rendering engine before taking over VRAM
Before we use any of VRAM, we need to disable the VGA rendering
engine, this render text mode into a graphical framebuffer
for scanout, however it does this on vblank, and can end up
overwriting the GART table and r600 shader objects.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:13:11 +10:00
Michel Dänzer 5e6dde7ec2 drm/radeon/kms: Move radeon_get_clock_info() call out of radeon_clocks_init().
Someone on IRC reported problems after commit
95a8f1bf4f ('drm/radeon/kms: Move
radeon_clocks_init() call back after getting VRAM info.'). And indeed, at least
some ASIC vram_info hooks use the clock info obtained by
radeon_get_clock_info(). So, move that call out of radeon_clocks_init(), ahead
of the radeon_vram_info() call.

[airlied - fixup missing r600/rv770 calls]

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

drm/radeon/kms: fix get clock info calls for r600/rv770 init path.

These were missed when it got split out.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:04:10 +10:00
Dave Airlie 445282db9e drm/radeon/kms: add initial connector properties
This adds:
coherent mode: TMDS coherent mode for atom cards.
scaling mode: LVDS scaler mode
load detect: DAC load detection, DVI-I, VGA, TV
tmds pll: legacy TMDS pll selection
tv standard: TV standard selection.

for later: other TV ones? dvi subconnector selection using std prop

[contains fixes pointed out on dri-devel for atom bios mixups
 by Michel]

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:02:00 +10:00
Michel Dänzer c88f9f0c91 drm/radeon/kms: Use surfaces for scanout / cursor byte swapping on big endian.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:01:59 +10:00
Jerome Glisse 733289c265 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>
2009-09-18 16:01:57 +10:00
Dave Airlie 7cbb355e94 drm/r600/kms: fixup number of loops per blit calculation.
Some people were seeing
*ERROR* radeon: writting more dword to ring than expected
after certain blits, the loops calculation didn't take
into account that we do a separate blit for the remainder
after doing the aligned blits.

Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:01:56 +10:00
Dave Airlie 41456df2d4 drm/radeon/kms: reprogram format in set base.
This should in theory fix the problem with a mode set being required
for adjusting the color depth.

This also adds in the necessary bits to the format tables for
8-bit, though it doesn't work yet.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 16:01:53 +10:00
Dave Airlie 65cb15a686 drm/radeon: avivo chips have no separate int bit for display
display interrupts are not enabled via this register, the
DISPLAY_INT bit is a status only to show that other regs
need to be read.

Noticed by Alex Deucher

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 14:34:06 +10:00
Alex Deucher b15591f312 drm/radeon/r600: don't do interrupts
Interrupts are not supported yet.  This prevents
things like mesa from trying to use them.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 14:34:06 +10:00
Pekka Paalanen 812c369dbf drm: fix _DRM_GEM addmap error message
Fix the error message: this is add, not rm.
Move the closing brace to proper spot: _DRM_GEM branch should not be
included in the block.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 14:34:06 +10:00
Ben Skeggs 9b1596af17 drm: update crtc x/y when only fb changes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 14:34:05 +10:00
Jesse Barnes e87b2c42b3 drm: fix drm_fb_helper handling of kernel crtcs
The drm_fb_helper shouldn't mess with CRTCs that aren't enabled or in
its initial config. Ideally it shouldn't even include CRTCs in its
initial config if they're not in use, but my old fix for that no longer
works.  At any rate, this fixes a real bug I was seeing where after a
console blank, both pipes would come back on, even though only one had
been enabled before that.  Since the other pipe had a bogus config,
this led to some screen corruption.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-18 14:34:05 +10:00
Jesse Barnes edb8195642 drm/i915: correct FBC update when pipe base update occurs
We usually don't have an SAREA, and we always want to update the FBC
status anyway, so move the update up above the various master/sarea
checks.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 17:06:47 -07:00
Jesse Barnes 7121413f2a drm/i915: blacklist Acer AspireOne lid status
It reports closed when open, leading to "no outputs found" at startup
unless a VGA cable is plugged in.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 15:45:26 -07:00
Jesse Barnes d660467c3f drm/i915: prevent FIFO calculation overflows on 32 bits with high dotclocks
A very high dotclock (e.g. 229500kHz as reported by Anton) can cause
the entries_required variable to overflow, potentially leading to a
FIFO watermark value that's too low to support the given mode.  Split
the division across the calculation to avoid this.

Cc: stable@kernel.org
Reported-by: Anton Khirnov <wyskas@gmail.com>
Tested-by: Anton Khirnov <wyskas@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:46:48 -07:00
Jaswinder Singh Rajput decbbcda29 drm/i915: intel_display.c handle latency variable efficiently
By handling latency variable efficiently we also get rid of this warning :

  CC [M]  drivers/gpu/drm/i915/intel_display.o
drivers/gpu/drm/i915/intel_display.c: In function ‘igd_enable_cxsr’:
drivers/gpu/drm/i915/intel_display.c:1918: warning: ‘latency’ may be used uninitialized in this function

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:34 -07:00
Zhenyu Wang b7e53aba2f drm/i915: remove restore in resume
Don't need extra config restore like for intel_agp, which
might cause resume hang issue found by Alan on 845G.

Cc: Stable Team <stable@kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:33 -07:00
Chris Wilson 07f73f6912 drm/i915: Improve behaviour under memory pressure
Due to the necessity of having to take the struct_mutex, the i915
shrinker can not free the inactive lists if we fail to allocate memory
whilst processing a batch buffer, triggering an OOM and an ENOMEM that
is reported back to userspace. In order to fare better under such
circumstances we need to manually retry a failed allocation after
evicting inactive buffers.

To do so involves 3 steps:
1. Marking the backing shm pages as NORETRY.
2. Updating the get_pages() callers to evict something on failure and then
   retry.
3. Revamping the evict something logic to be smarter about the required
   buffer size and prefer to use volatile or clean inactive pages.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:32 -07:00
Chris Wilson 3ef94daae7 drm/i915: Add ioctl to set 'purgeability' of objects
Similar to the madvise() concept, the application may wish to mark some
data as volatile. That is in the event of memory pressure the kernel is
free to discard such buffers safe in the knowledge that the application
can recreate them on demand, and is simply using these as a cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:31 -07:00
Chris Wilson 31169714fc drm/i915: Register a shrinker to free inactive lists under memory pressure
This should help GEM handle memory pressure sitatuions more gracefully.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:31 -07:00
Chris Wilson 725ceaa08a drm/i915: Include buffer size and dirty state in debugfs lists
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:30 -07:00
Chris Wilson e67b8ce1b5 drm/i915: Remove stored gtt_alignment
There is no need to store the gtt_alignment as it is either explicitly
set according to the hardware requirements (e.g. scanout) or the
minimum alignment is computed on demand.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:29 -07:00
Chris Wilson 4960aaca14 drm/i915: Add buffer to inactive list immediately during fault
If we failed to set the domain, the buffer was no longer being tracked
on any list.

Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:28 -07:00
Jesse Barnes c1a1cdc159 drm/i915: fix startup hang on some non-mobile platforms
Due to a bogus FBC support check and failing to check for FBC support
in the right places, mode setting on non-mobile platforms could fail
and hang in the FBC disable routine.  Fix it up.

This fix highlights the need for cleanups in this area (function
pointers and better feature support checks).  Patches for that to
follow.

Tested-by: Kenny Graunke <kenny@whitecape.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:43:27 -07:00
Jesse Barnes 06891e27a9 drm/i915: fix suspend/resume breakage in lid notifier
We now unconditionally restore the mode at lid open time since some
platforms turn off the panel, pipes or other display elements when the
lid is closed.  There's a problem with doing this at resume time
however.

At resume time, we'll get a lid event, but restoring the mode at that
time may not be safe (e.g. if we get the lid event before global state
has been restored), so check the suspended state and make sure our
restore is locked against other mode updates.

Tested-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:42:54 -07:00
Ben Gamari ba1234d17b drm/i915: Make dev_priv->mm.wedged an atomic_t
There is a very real possibility that multiple CPUs will notice that the
GPU is wedged. This introduces all sorts of potential race conditions.
Make the wedged flag atomic to mitigate this risk.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:36:46 -07:00
Ben Gamari f316a42cc4 drm/i915: Hookup chip reset in error handler
This patch uses the previously introduced chip reset logic to reset the
chip when an error event is detected.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:36:30 -07:00
Ben Gamari 11ed50ec2a drm/i915: Implement GPU reset on i965
This patch puts in place the machinery to attempt to reset the GPU. This
will be used when attempting to recover from a GPU hang.

Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:36:22 -07:00
Ben Gamari f65d94211e drm/i915: Add hangcheck timer
We set a periodic timer to check on the GPU, resetting it every time a
batch is completed. If the timer elapses, we check acthd. If acthd
hasn't changed in two timer periods, we assume the chip is wedged.

This is implemented in such a way that it leaves the option open to
employ adaptive timer intervals in the future. One could wait until
several timer periods have elapsed before declaring the chip dead. If
the chip comes back after several periods but before the "dead"
threshold, the timer interval or dead threshold could be raised.

It is important to note that while checking for active requests, we need
to account for the fact that requests are removed from the list (i.e.
retired) in a deferred work queue handler. This means that merely
checking for an empty request_list is insufficient; the list could be
non-empty yet the GPU still idle, causing the hangcheck timer to
incorrectly mark the GPU as wedged (it took me a while to figure that
out---sigh...)

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:36:01 -07:00
Ben Gamari 22be172423 drm/i915: make i915_seqno_passed non-static
We'll need it in i915_irq.c for checking whether there are outstanding
requests. Also, the function really ought to return a bool, not an int.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:35:11 -07:00
Ben Gamari 1341d655dd drm/i915: Refactor save/restore code
We move the display-specific code into it's own functions, called
from the general GPU state save/restore functions. This will be needed
later by the GPU reset code.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:34:27 -07:00
Ben Gamari ffed1d0920 drm/i915: Check whether chip is wedged in i915_wait_request()
i915_wait_request() only checks mm.wedged after it interacts with the
hardware, generally causing the driver to lock up waiting for a wedged
chip. Make sure we check mm.wedged as the first thing we do.

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:33:52 -07:00
Li Peng 078a033f45 drm/i915: fix opregion backlight chip detect and range
BLC_PWM_CTL2 is for 965+ only, so add device model check for
legacy backlight control.

For native backlight control, it maps the backlight value (0~255)
in opregion ASLE[BCLP] to backlight duty cycle (0~max_backlight)
and set into control register.

It also add support for IGD device, which follows opregion spec.

Signed-off-by: Li Peng <peng.li@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:32:08 -07:00
Zhenyu Wang 8dd81a381e drm/i915: Fix LVDS panel fitting on Arrandale
Arrandale has new window based method for panel fitting.
This one enables full screen aspect scaling on LVDS. It fixes
standard mode display failure on LVDS for Arrandale.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:31:10 -07:00
Zhenyu Wang 730915d65f drm/i915: Remove DAC disable in CRT force detect on IGDNG
This is not required on newer stepping hardware to get
reliable force detect status. Removing this fixes screen
blank flicker in CRT detect on IGDNG.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:31:06 -07:00
Zhenyu Wang 339e5a4c78 drm/i915: Fix SSC frequence for IGDNG
IGDNG LVDS SSC uses 120Mhz freq. This fixes one
1600x900 LVDS panel black issue on IGDNG with SSC enabled.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:31:01 -07:00
Zhenyu Wang b09aea7fb3 drm/i915: Fix typo for wrong LVDS clock setting on IGDNG
New register for PCH LVDS on IGDNG should be used.
This is a copy-n-paste typo. This fixes possible dual
channel LVDS panel failure on IGDNG.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:30:14 -07:00
Jesse Barnes 6f465a8925 drm/i915: fix typo in compressed buffer setup
We want the compressed line length buffer address, not the framebuffer
address.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-17 14:22:44 -07:00
Michel Dänzer 8dfaa8a777 drm/radeon/kms: Get LVDS native mode details from EDID if necessary.
Fixes RMX problems on older Apple laptops which don't have an x86 BIOS ROM.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-16 16:10:19 +10:00
Yang Zhao f657c2a731 drm/radeon: Save and restore bios scratch regs during S/R
[airlied:- adapted slightly in naming]

Signed-off-by: Yang Zhao <yang@yangman.ca>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-16 10:21:35 +10:00
Dave Airlie ecb114a128 drm/radeon/kms: IB locking dumps out a lockdep ordering issue
We sometimes lock IB then the ring and sometimes the ring then
the IB. This is mostly due to the IB locking not being well defined
about what data in the structs it actually locks. Define what I
believe is the correct behaviour and gets rid of the lock dep ordering
warning.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-16 09:15:39 +10:00
Dave Airlie 42dea5ddb5 drm/radeon/kms: we should return 0 when we have no modes not -1.
This fixes my monitor with broken EDID so it at least get 800x600.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-16 09:15:19 +10:00
Michel Dänzer 48e113e516 drm/radeon/kms: Free CS parser state tracking memory.
Fixes leak hidden in commit 9f022ddfb2
('drm/radeon/kms: convert r4xx to new init path').

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-16 09:15:02 +10:00
Michel Dänzer fdd5cace73 drm/radeon/kms: Don't kzalloc memory which is immediately overwritten.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-16 09:14:59 +10:00
Michel Dänzer 95a8f1bf4f drm/radeon/kms: Move radeon_clocks_init() call back after getting VRAM info.
It may indirectly call radeon_set_clock_gating() which relies on the VRAM info.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-16 09:14:58 +10:00
Michel Dänzer fb1fbf8e09 drm/radeon/kms: Only add common modes which fit in both panel dimensions.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-16 09:14:56 +10:00
Dave Airlie 70ba2a3747 drm/radeon/kms: add 32/64 ioctl support.
Although the new radeon driver ioctls don't need this, some of
the drm initialisation ioctls require it, so add this to make them
work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-15 09:03:43 +10:00
Jerome Glisse 4aac047323 drm/radeon/kms: clear confusion in GART init/deinit path
GART static one time initialization was mixed up with GART
enabling/disabling which could happen several time for instance
during suspend/resume cycles. This patch splits all GART
handling into 4 differents function. gart_init is for one
time initialization, gart_deinit is called upon module unload
to free resources allocated by gart_init, gart_enable enable
the GART and is intented to be call after first initialization
and at each resume cycle or reset cycle. Finaly gart_disable
stop the GART and is intended to be call at suspend time or
when unloading the module.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-15 08:53:14 +10:00
Jerome Glisse 21f9a43722 drm/radeon/kms: cleanup - remove radeon_share.h
radeon_share.h was begining to give problem with include order in
respect of radeon.h. It's easier and also i think cleaner to move
what was in radeon_share.h into radeon.h. At the same time use the
extern keyword for function shared accross the module.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-14 16:10:00 +10:00
Jerome Glisse a4d68279b4 drm/radeon/kms: move mtrr range add and memory information
Move mtrr range and memory information printing to radeon_object_init,
this are memory information and initialization common to all GPU and
they better fit in this function. Will also prevent code duplication
with upcoming init path changes.

airlied: fixed warning introduced

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-14 16:10:00 +10:00
Jerome Glisse 9f022ddfb2 drm/radeon/kms: convert r4xx to new init path
This convert r4xx to new init path it also fix few bugs.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-14 16:09:59 +10:00
Alex Deucher d42571efe3 drm/radeon/kms: fix typo in quirks
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-12 08:05:06 +10:00
Alex Deucher 1be340563c drm/radeon/kms/r600: fix blit dword count for non r6xx
rv6xx emits two extra dwords in the render target setup.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-12 08:05:05 +10:00
Alex Deucher 7747b71304 drm/radeon/kms: add common lvds modes in the ddc case
previous patch only handled the non-ddc case.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-12 08:05:02 +10:00
Chris Wilson 7e61615857 drm/i915: Only destroy a constructed mmap offset
drm_ht_remove_item() does not handle removing an absent item and the hlist
in particular is incorrectly initialised. The easy remedy is simply skip
calling i915_gem_free_mmap_offset() unless we have actually created the
offset and associated ht entry.

This also fixes the mishandling of a partially constructed offset which
leaves pointers initialized after freeing them along the
i915_gem_create_mmap_offset() error paths.

In particular this should fix the oops found here:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/415357/comments/8

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Cc: stable@kernel.org
2009-09-11 11:40:39 -07:00
Eric Anholt e517a5e970 agp/intel: Fix the pre-9xx chipset flush.
Ever since we enabled GEM, the pre-9xx chipsets (particularly 865) have had
serious stability issues.  Back in May a wbinvd was added to the DRM to
work around much of the problem.  Some failure remained -- easily visible
by dragging a window around on an X -retro desktop, or by looking at bugzilla.

The chipset flush was on the right track -- hitting the right amount of
memory, and it appears to be the only way to flush on these chipsets, but the
flush page was mapped uncached.  As a result, the writes trying to clear the
writeback cache ended up bypassing the cache, and not flushing anything!  The
wbinvd would flush out other writeback data and often cause the data we wanted
to get flushed, but not always.  By removing the setting of the page to UC
and instead just clflushing the data we write to try to flush it, we get the
desired behavior with no wbinvd.

This exports clflush_cache_range(), which was laying around and happened to
basically match the code I was otherwise going to copy from the DRM.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Cc: stable@kernel.org
2009-09-11 11:39:23 -07:00
Dave Airlie 2f9a60d766 drm/radeon/kms: set fbdev_info for suspend/resume
this hopefully will bring back suspend/resume under kms.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-11 18:35:38 +10:00
Jerome Glisse 6cf8a3f588 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>
2009-09-11 15:53:59 +10:00
Alex Deucher 923f6848e1 drm/radeon/kms: add common scaled modes for TV and LVDS
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-11 15:39:18 +10:00
Jesse Barnes 8082400327 drm/i915: framebuffer compression for pre-GM45
This patch adds framebuffer compression (good for about ~0.5W power
savings in the best case) support for pre-GM45 chips.  GM45+ have a new,
more flexible FBC scheme that will be added in a separate patch.

FBC can't always be enabled: the compressed buffer must be physically
contiguous and reside in stolen space.  So if you have a large display
and a small amount of stolen memory, you may not be able to take
advantage of FBC.  In some cases, a BIOS setting controls how much
stolen space is available.  Increasing this to 8 or 16M can help.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 19:46:07 -07:00
Alex Deucher 705af9c7a8 drm/radeon/kms: pull in latest quirks and fixes from ddx
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-11 11:44:15 +10:00
Alex Deucher a381287759 drm/radeon/kms/r600: use blit for BO moves
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-11 11:41:39 +10:00
Jerome Glisse c000273ebc drm/radeon/kms: R3XX/R4XX AGP asic use PCI GART not PCIE GART
R3XX/R4XX AGP asic use the old PCI GART block, not the new PCIE GART.
Make sure we pick the right GART when disabling AGP.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-11 11:41:34 +10:00
Jesse Barnes 06324194ee drm/i915: generate a KMS uevent at lid open/close time
With all the other lid pieces in place, it's easy to generate a uevent
for the LVDS connector just like we do for other outputs.  Should make
lid open/close fit in with the rest of a userland based output
reconfiguration scheme.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 16:10:31 -07:00
Jesse Barnes b42d4c5c6a drm/i915: use ACPI LID status for LVDS ->detect hook
We can't load or hotplug detect LVDS like we can other outputs, but if
there's a lid device present we can use it as a proxy.  This allows the
LFP state to be determined at ->detect time, making configurations
requiring manual intervention today "just work" assuming the lid device
status is correct.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 16:10:21 -07:00
Jesse Barnes c1c7af6089 drm/i915: force mode set at lid open time
Some laptop platforms will disable pipes and/or planes at lid close time
and not restore them when the lid is opened again.  So catch the lid
event, and if the lid was opened, force a mode restore.

Fixes fdo bug #21230.

Acked-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 16:10:00 -07:00
Li Peng af729a26cc Add G33 series in VGA hotplug support category
Test on the IGD chip, which is a G33-like graphic device.

Signed-off-by: Li Peng <peng.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 11:32:49 -07:00
Zhao Yakui bb66c5122b drm/i915: Write zero to DPLL_MD Reg for non-SDVO output
When the output device is LVDS, maybe the pixel clock of adjusted_mode will be
less than that in mode. In such case it will set the incorrect multipler factor
in DPLL_MD register.
So the dpll_md_reg will be reset when the output type is non-SDVO

https://bugs.freedesktop.org/show_bug.cgi?id=22761

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewd-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 11:31:04 -07:00
Zhao Yakui e270846fa7 drm/i915: Add the missing clone_mask for SDVO-VGA(RGB1)
Add the missing clone_mask for SDVO-VGA(RGB1)

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 11:30:54 -07:00
Zhao Yakui d0cbde93cc drm/i915: Add the brightness property for SDVO-LVDS
When the sdvo device is detected as SDVO-LVDS, we will check whether the
brightness is supported by issue SDVO enhancement command.
If it is supported, we will add the brightness property and then brightness
can be adjusted.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 11:30:32 -07:00
Zhao Yakui b9219c5e8b drm/i915: Add the enhancement property for SDVO-TV
When the sdvo device is detected as SDVO-TV, we will check whether the
sepecific picture enhancement is supported. If it is supported, we will
add the corresponnding property for SDVO-TV. We will add the following
property for the SDVO-TV enhancements if they are supported:
 * Contrast/Brightness/Saturation/Hue.
 * left/right/top/bottom margin: This is implemented by using the
   horizontal/vertical overscan enhancements. When the overscan
   enhancements are supported, the above properties will be added. This is
   to be compatible with what we have done in integrated-TV.
 * horizontal pos/vertical pos.

http://bugs.freedesktop.org/show_bug.cgi?id=22891

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-10 11:28:57 -07:00
Alex Deucher 119e20dc14 drm/radeon/kms/r600: fix blit support
select the correct max number of bytes per blit based
on whether the size is multiple of 4 bytes.  This
determines whether we can use 8 or 32 bit pixels for
the blit.

airlied: also merged the IB padding patch +
correcting the VS offset for context

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-10 18:44:16 +10:00
Jerome Glisse a513c184d9 drm/radeon/kms: Don't try to process irq when we are unloading
If module is being unloaded we should not try to handle irq especialy
we should not call into drm helper or we could hard hang the computer
free_irq will call the irq handler to make sure we behave properly.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-10 18:41:01 +10:00
Jerome Glisse 905b68223b drm/radeon/kms: add R4XX mc register access helper.
Atombios will use the mc register access helper and R4XX hw have a
bigger mc range than R3XX so add R4XX specific mc register access
helper.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-10 10:13:33 +10:00
Jerome Glisse a18d7ea153 drm/radeon/kms: call r100_cp_disable rather than duplicating code.
r100_cp_fini was duplicating code of r100_cp_disable, call r100_cp_disable
instead.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-10 10:12:57 +10:00
Jerome Glisse 45600232b3 drm/radeon/kms: wait for cp idle before stopping it.
If we stop CP and that it's still processing thing GPU hang might
happen, this patch wait for CP idle (the wait can timeout) so we
can avoid shutting down CP at bad time. This is especialy usefull
when reseting the GPU as it seems GPU reset fails to properly reset
CP when the CP wasn't stop after being idle.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-10 10:12:41 +10:00
Alex Deucher 5d93b135fc drm/radeon/r600: fix legacy blit code
ARRAY_SIZE is number of elements not bytes.  Fix
ring counts accordingly, also make a few functions
static.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-10 06:53:17 +10:00
Dave Airlie 6ac3bd5270 PCI/vgaarb: cleanup some warnings + cleanup some comments.
Fix some warnings reported in linux-next + also cleanup some
comment errors noticed by Pekka Paalanen.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-09 13:29:41 -07:00
Benjamin Herrenschmidt deb2d2ecd4 PCI/GPU: implement VGA arbitration on Linux
Background:
Graphic devices are accessed through ranges in I/O or memory space. While most
modern devices allow relocation of such ranges, some "Legacy" VGA devices
implemented on PCI will typically have the same "hard-decoded" addresses as
they did on ISA. For more details see "PCI Bus Binding to IEEE Std 1275-1994
Standard for Boot (Initialization Configuration) Firmware Revision 2.1"
Section 7, Legacy Devices.

The Resource Access Control (RAC) module inside the X server currently does
the task of arbitration when more than one legacy device co-exists on the same
machine. But the problem happens when these devices are trying to be accessed
by different userspace clients (e.g. two server in parallel). Their address
assignments conflict. Therefore an arbitration scheme _outside_ of the X
server is needed to control the sharing of these resources. This document
introduces the operation of the VGA arbiter implemented for Linux kernel.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-09 13:29:36 -07:00
Eric Anholt 5323fd042f drm/i915: Zap mmaps of objects before unbinding them from the GTT.
Otherwise, some other userland writing into its buffer may race to land
writes either after the CPU thinks it's got a coherent view, or after its
GTT entries have been redirected to point at the scratch page.  Either
result is unpleasant.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-09 12:52:05 -07:00
Fabian Henze 7839c5d551 drm/i915: add B43 chipset support
Signed-off-by: Fabian Henze <hoacha@quantentunnel.de>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-08 23:33:26 -07:00
Linus Torvalds e6890f6f3d i915: disable interrupts before tearing down GEM state
Reinette Chatre reports a frozen system (with blinking keyboard LEDs)
when switching from graphics mode to the text console, or when
suspending (which does the same thing). With netconsole, the oops
turned out to be

	BUG: unable to handle kernel NULL pointer dereference at 0000000000000084
	IP: [<ffffffffa03ecaab>] i915_driver_irq_handler+0x26b/0xd20 [i915]

and it's due to the i915_gem.c code doing drm_irq_uninstall() after
having done i915_gem_idle(). And the i915_gem_idle() path will do

  i915_gem_idle() ->
    i915_gem_cleanup_ringbuffer() ->
      i915_gem_cleanup_hws() ->
        dev_priv->hw_status_page = NULL;

but if an i915 interrupt comes in after this stage, it may want to
access that hw_status_page, and gets the above NULL pointer dereference.

And since the NULL pointer dereference happens from within an interrupt,
and with the screen still in graphics mode, the common end result is
simply a silently hung machine.

Fix it by simply uninstalling the irq handler before idling rather than
after. Fixes

    http://bugzilla.kernel.org/show_bug.cgi?id=13819

Reported-and-tested-by: Reinette Chatre <reinette.chatre@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-08 17:09:24 -07:00
Alex Deucher cecc6b63a5 drm/radeon/r600: use fence->timeout directly
Fixes fence timeouts on r6xx/r7xx.  Noticed by
taiu on IRC.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2009-09-09 08:17:57 +10:00
Alex Deucher 60d15f551a drm/radeon/kms: re-apply 2007d633d6
Got accidently reverted by c93bb85b5c

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-09 05:35:37 +10:00
Zhenyu Wang 7c8460db30 drm/i915: fix mask bits setting
eDP is exclusive connector too, and add missing crtc_mask
setting for TV.

This fixes

	http://bugzilla.kernel.org/show_bug.cgi?id=14139

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Reported-and-tested-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-08 10:16:20 -07:00
Dave Airlie c746e205f2 drm/radeon/kms: don't allow ERESTART to hit userspace.
the pre-r600 fence code returns ebusy if we get hit by a signal
so we should continue to do that.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 14:43:27 +10:00
Adam Jackson 620f37811d drm: prune modes when output is disconnected.
When an output was disconnected, its mode list would remain.  If you later
plugged into a sink with no EDID (projector, etc), you'd inherit the mode
list from the old sink, which is not what you want.

taken from Fedora kernel

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 11:51:46 +10:00
Adam Jackson 1ecff1eb0b drm: shut the EDID warnings up.
These really aren't all that useful.

taken from Fedora kernel.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 11:48:40 +10:00
Dave Airlie ec2a4c3fdc drm/i915: get the bridge device once.
The driver gets the bridge device in a number of places, upcoming
vga arb code paths need the bridge device, however they need it in
under a lock, and the pci lookup can allocate memory. So clean
this code up before then and get the bridge once for the driver lifetime.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 11:45:15 +10:00
Dave Airlie f641e51e74 drm/radeon/kms: lower debugging on dpms events.
Lower the debugging on encoders when getting DPMS events.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 11:17:38 +10:00
Dave Airlie a0cdc6495b drm/kms/radeon: make kms default a runtime option
This makes the kms/enable disable a runtime not a build time
option.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 11:15:59 +10:00
Dave Airlie 6fcefd56f5 drm/kms: fix kms helper license + Kconfig
Allow the KMS module to work properly, and also rename
it to KMS_HELPER so its clearer what its for.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 11:15:58 +10:00
Jerome Glisse 3ce0a23d2d drm/radeon/kms: add r600 KMS support
This adds the r600 KMS + CS support to the Linux kernel.

The r600 TTM support is quite basic and still needs more
work esp around using interrupts, but the polled fencing
should work okay for now.

Also currently TTM is using memcpy to do VRAM moves,
the code is here to use a 3D blit to do this, but
isn't fully debugged yet.

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

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 11:15:52 +10:00
Dave Airlie 4ce001abaf drm/radeon/kms: add initial radeon tv-out support.
This ports the tv-out code from the DDX to KMS.

adds a radeon.tv module option, radeon.tv=0 to disable tv

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 09:24:37 +10:00
Dave Airlie 551ebd837c drm/radeon/kms: add rn50/r100/r200 CS tracker.
This adds the command stream checker for the RN50, R100 and R200 cards.

It stops any access to 3D registers on RN50, and does checks
on buffer sizes on the r100/r200 cards. It also fixes some texture
sizing checks on r300.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-08 08:54:31 +10:00
Linus Torvalds 3ff323f890 Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/radeon/kms: add LTE/GTE discard + rv515 two sided stencil register.
2009-09-07 11:42:25 -07:00
Dave Airlie 11670d3c93 Merge intel drm-intel-next branch
Merge remote branch 'anholt/drm-intel-next' of ../anholt-2.6 into drm-next

Conflicts:
	drivers/gpu/drm/i915/intel_display.c
	drivers/gpu/drm/i915/intel_drv.h
	drivers/gpu/drm/i915/intel_sdvo.c
2009-09-07 20:27:20 +10:00
Dave Airlie 575dc34ee0 drm/kms: remove old std mode fallback code.
The new code adds modes in the helper, which makes more sense
I disliked the non-driver code adding modes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 18:44:46 +10:00
ykzhao 50fe4cfdc7 drm/kms/i915: Add the default mode for CRT output without EDID
Add the default mode for every output device when there
is no mode for it.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 18:44:45 +10:00
Zhao Yakui f0fda0a47b drm/kms: add a function that can add the mode for the output device without EDID
Add a function that can be used to add the default mode for the output device
without EDID.
It will add the default mode that meets with the requirements of given
hdisplay/vdisplay limit.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 18:44:40 +10:00
Zhao Yakui 559ee21d26 drm/kms: try to find the std mode in DMT table
When we need to add the standard timing mode, we will firstly check whether it
can be found in DMT table by comparing the hdisplay/vdisplay/vfresh_rate.
If it can't be found, then we will use the cvt/gtf to add the required mode.
If it can be found, it will be returned.

At the same time the function of drm_mode_vrefresh is also fixed. It will
return the result of actual refresh_rate plus 0.5.
For example:
When the calculated value is 84.9, then the fresh_rate is 85.
When the calculated value is 70.02, then the fresh_rate is 70.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 16:04:15 +10:00
Zhao Yakui aa9eaa1f09 drm/kms: Add the default mode table
When we add a standard timing mode in UMS, we will first check whether it can
be found in default mode table. If it can't be found, then we will use cvt/gtf
to add the standard timing mode.
Add the default mode table so that we can check whether the given mode
can be found in the default mode table as what we have done in UMS mode.

If the status of one output device is connected but there is no EDID, it will
have no correct mode. In such case we can add some default modes for it. Of
course we only add the modes in the default modes list that visible part is not
greater than 1024x768.

The default mode is autogenerated from the DMT spec. And it is copied from
xserver/hw/xfree86/modes/xf86EdidModes.c. But the mode with reduced blank
feature is removed.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 16:03:35 +10:00
Dave Airlie 13a8195b14 drm: split crtc/fb helpers into a separate module
I really don't want to have core drm module rely on CONFIG_FB,
so this is the easiest answer.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 15:45:33 +10:00
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
Dave Airlie adf551bb25 drm/radeon/kms: add updated registers from drm-fixes.
Fixes up the DISCARD + 2 sided stencil in the new generator scripts.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 13:49:07 +10:00
Dave Airlie a498b8210f drm/radeon/kms: block depthxy offset from use from userspace.
This could be used to bypass CS checks.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-07 13:48:11 +10:00
Eric Anholt 01dfba93d9 drm/i915: Put the idle reclocking work on our private workqueue as well.
Fixes (again) whole-system lockups due to GPU lockups.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-06 15:18:53 -07:00
Chris Wilson 0ef82af725 drm/i915: Pad ringbuffer with NOOPs before wrapping
According to the docs, the ringbuffer is not allowed to wrap in the middle
of an instruction.

G45 PRM, Vol 1b, p101:
  While the “free space” wrap may allow commands to be wrapped around the
  end of the Ring Buffer, the wrap should only occur between commands.
  Padding (with NOP) may be required to follow this restriction.

Do as commanded.

[Having seen bug reports where there is evidence of split commands, but
apparently the GPU has continued on merrily before a bizarre and untimely
death, this may or may not fix a few random hangs.]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
CC: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-06 11:29:06 -07:00
Zhenyu Wang 5e17ee74b5 drm/i915: do dynamic clock freq control only in kernel modesetting
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:46 -07:00
Keith Packard 57cdaf90f5 drm/I915: Use the CRT DDC to get the EDID for DVI-connector on Mac
mac Mini's have a single DDC line on the DVI connector, shared between the
analog link and the digital link. So, if DDC isn't detected on GPIOE (the
usual SDVO DDC link), try GPIOA (the usual VGA DDC link) when there isn't a
VGA monitor connected.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:45 -07:00
Zhenyu Wang 553bd149bb drm/i915: fix tiling on IGDNG
It seems that on IGDNG the same swizzling setup always applys.
And front buffer tiling needs to set address swizzle in display
arb control too.

Fix plane tricle feed setting in v1 which should be disable bit,
and always setup address swizzle to let hardware care for buffer
tiling in all cases.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:44 -07:00
Daniel Vetter 65655d4ab7 drm/i915: modeset: always set intel_crtc->dpms_mode by moving the assignment up.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:43 -07:00
Daniel Vetter c05422d52e drm/i915: remove open-coded drm_mode_object_find
And clean up a small whitespace goof-up in the same function, while
I was looking at it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:41 -07:00
Eric Anholt 67cf781bea drm/i915: Make the downclocking debug code be under DRM_DEBUG not DRM_ERROR.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-04 13:05:40 -07:00
Kyle McMartin d6073d775c drm/i915: i915_modeset is signed
Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:39 -07:00
Jesse Barnes 652c393a33 drm/i915: add dynamic clock frequency control
There are several sources of unnecessary power consumption on Intel
graphics systems. The first is the LVDS clock. TFTs don't suffer from
persistence issues like CRTs, and so we can reduce the LVDS refresh rate
when the screen is idle. It will be automatically upclocked when
userspace triggers graphical activity. Beyond that, we can enable memory
self refresh. This allows the memory to go into a lower power state when
the graphics are idle. Finally, we can drop some clocks on the gpu
itself. All of these things can be reenabled between frames when GPU
activity is triggered, and so there should be no user visible graphical
changes.

Signed-off-by: Jesse Barnes <jesse.barnes@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:38 -07:00
Shaohua Li 0430296558 drm/i915: Support IGD EOS
In the event that any one of the DAC analog outputs (R,G,B) were driven
at full-scale (white video) or some analog level close to full-scale
voltage, and if the video cable were then disconnected, the analog video
voltage level would exceed the maximum electrical overstress limit of the
native (thin-oxide) transistors thus causing a long-term reliability concern.
The electrical overstress condition occurs in this particular case.

This patch address the IGD EOS (electrical overstress condition) issue.
When the EOS interrupt occurs, OS should disable DAC and then disable EOS,
then the normal hotplug operation follows.

TODO: it appears the normal unplug interrupt is missed as reported by Li Peng,
need more checks here.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:30 -07:00
Zhao Yakui ce6feabd1b drm/i915: Enable PAL and SECAM format and add the propery for SDVO-TV
Currently SDVO TV only support NTSC-M format. In this patch
we introduce PAL and SECAM formats available and create seting-format
property at init time. When user dynamically chose preferred
format by xrandr command, it will refine all modelines
provided by SDVO device, then instruct SDVO device to execute.
At the same time the property is added for SDVO-TV so that the SDVO-TV mode can be changed
by using xrandr.

https://bugs.freedesktop.org/show_bug.cgi?id=22891

Signed-off-by: Ma Ling <ling.ma@intel.com>
review-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:11 -07:00
Ma Ling 213c2e6431 drm/i915: select TV format according to connector type
For integrated TV there are 3 connector types: S-VIDEO, Composite and
Component(YprPb). Those tv formats whose component flag is true should
be assigned to Component connector, others are for S-VIDEO and Composite.
The patch intends to find appropriate tv format for each connector.
In such case it will return the correct modeline to user space. Otherwise
it will return the incorrect modeline when S-video/composite is connected.

Signed-off-by: Ma Ling <ling.ma@intel.com>
reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:10 -07:00
Zhenyu Wang 5f6a169598 drm/i915: update debugfs interrupt info on IGDNG
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:09 -07:00
Ben Gamari 9e3a6d155e drm/i915: Add i915 register dumping debugfs file
Add a debugfs file to dump the entire register range. Here we
assume that reading write-only/reserved registers won't make the chip
angry. Seems to hold true, thankfully.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:09 -07:00
Ben Gamari 27c202ad7f drm/i915: Move i915_gem_debugfs.c to i915_debugfs.c
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
[anholt: hand-applied for conflicts]
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-04 13:05:08 -07:00
Chris Wilson 58c2fb647a drm/i915: Unref old_obj on get_fence_reg() error path
Remember to release the local reference if we fail to wait on
the rendering.

(Also whilst in the vicinity add some whitespace so that the phasing of
the operations is clearer.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-02 10:49:02 -07:00
Jesse Barnes bcc24fb425 drm/i915: increase default latency constant (v2 w/comment)
Some i915/i945 platforms have a fairly high memory latency in certain
situations, so increase our constant a bit to avoid FIFO underruns.
The effect should be positive on other platforms as well; we'll have a
bit more insurance against a busy memory subsystem due to the extra
FIFO entries.

Fixes fdo bug #23368.  Needed for 2.6.31.

Tested-by: Sven Arvidsson <sa@whiz.se>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-09-02 10:33:01 -07:00
Maarten Maathuis ff6fdbed8f drm/crtc_helper: avoid NULL-pointer dereference when encoder is NULL
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-09-02 16:28:56 +10:00
Dave Airlie 9c552dd793 drm/crtc: fix mismerge of last patch.
We only want to NULL encoder->crtc when it is off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 14:00:11 +10:00
Dave Airlie a3a0544b2c drm/kms: add explicit encoder disable function and detach harder.
For shared tv-out and VGA encoders, we really need to know if
the encoder is just being switched off temporarily in blanking
or if we are really disabling it hard.

Also we need to try harder to disconnect encoders from unused
connectors so we can share more efficently.

(shared encoders stuff is coming in radeon tv-out support)

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 09:42:59 +10:00
Dave Airlie ed017d9fb1 drm: fix drm_cache.c for arch with no support.
This produces a warn on for architectures where this gets called
but we don't have a cache flushing implementation suitable.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 09:41:13 +10:00
Dave Airlie fa8a123855 drm/mm: add ability to dump mm lists via debugfs
This adds code to the drm_mm to talk to debugfs, and adds
support to radeon to add the VRAM and GTT mm lists to debugfs.

I tested with spinlock debugging and it doesn't give out.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-02 09:39:43 +10:00
Linus Torvalds b5af754405 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel:
  drm/i915: Improve CRTDDC mapping by using VBT info
  drm/i915: Fix CPU-spinning hangs related to fence usage by using an LRU.
  drm/i915: Set crtc/clone mask in different output devices
  drm/i915: Always use SDVO_B detect bit for SDVO output detection.
  drm/i915: Fix typo that broke SVID1 in intel_sdvo_multifunc_encoder()
  drm/i915: Check if BIOS enabled dual-channel LVDS on 8xx, not only on 9xx
  drm/i915: Set the multiplier for SDVO on G33 platform
2009-08-31 17:22:10 -10:00
Dave Airlie 3420e74262 drm: fix two issues with fb consolidation.
Set accel to none, we really don't want anyone thinking
fb is an accel interface.
Pass pitch not depth to function for intel.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 10:33:29 +10:00
Alexey Dobriyan 3b51096f95 drm: use proc_create_data()
airlied: fixup race against drm info by filling out
tmp before adding it to proc.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:37:22 +10:00
Zhao Yakui 882f021951 drm/kms: Parse the detailed time info in CEA-EDID
Sometimes we can obtain the EDID with multiple blocks from the display device.
For example: HDMI monitor.
When the CEA-EDID block is detected, we should also parse the detailed timing
info from it. Otherwise we will lose some modes for the display device.

The first step is check whether the CEA EDID block is found. If it exists,
it will skip the CEA-data block and parse the detailed timing info.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:22:43 +10:00
Dave Airlie 785b93ef8c drm/kms: move driver specific fb common code to helper functions (v2)
Initially I always meant this code to be shared, but things
ran away from me before I got to it.

This refactors the i915 and radeon kms fbdev interaction layers
out into generic helpers + driver specific pieces.

It moves all the panic/sysrq enhancements to the core file,
and stores a linked list of kernel fbs. This could possibly be
improved to only store the fb which has fbcon on it for panics
etc.

radeon retains some specific codes used for a big endian
workaround.

changes:
fix oops in v1
fix freeing path for crtc_info

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:31 +10:00
Ben Hutchings 7dc482dfee drm/r128: Add test for initialisation to all ioctls that require it
Almost all r128's private ioctls require that the CCE state has
already been initialised.  However, most do not test that this has
been done, and will proceed to dereference a null pointer.  This may
result in a security vulnerability, since some ioctls are
unprivileged.

This adds a macro for the common initialisation test and changes all
ioctl implementations that require prior initialisation to use that
macro.

Also, r128_do_init_cce() does not test that the CCE state has not
been initialised already.  Repeated initialisation may lead to a crash
or resource leak.  This adds that test.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:30 +10:00
Ben Hutchings 70967ab9c0 radeon: Use request_firmware()
Loosely based on a patch by
Jaswinder Singh Rajput <jaswinderlinux@gmail.com>.

KMS support by Dave Airlie <airlied@redhat.com>.

For Radeon 100- to 500-series, firmware blobs look like:
    struct {
        __be32 datah;
        __be32 datal;
    } cp_ucode[256];

For Radeon 600-series, there are two separate firmware blobs:
    __be32 me_ucode[PM4_UCODE_SIZE * 3];
    __be32 pfp_ucode[PFP_UCODE_SIZE];

For Radeon 700-series, likewise:
    __be32 me_ucode[R700_PM4_UCODE_SIZE];
    __be32 pfp_ucode[R700_PFP_UCODE_SIZE];

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:30 +10:00
Roel Kluin 1ae70072f0 drm: dereference of tmp in drm_proc_create_files()
tmp allocation may fail, prevent a dereference.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:29 +10:00
Maarten Maathuis ff846ab7f7 drm/crtc_helper: NULL encoder->crtc when switching encoders
- Previously the old encoder would be called during modeset and without a connector bad things happened.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:29 +10:00
Maarten Maathuis e67aae79f9 drm/crtc_helper: replace modeset fail path with something simpler
- The previous system was not very transparent, nor flexible.
- This is needed to be able to fix a few bugs in the mechanism.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:29 +10:00
Dave Airlie 689d7c2a11 drm/radeon: cleanup mkregtable.c
This cleans up the code in mkregtable.c to be more kernel style.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-31 09:09:28 +10:00
David Müller (ELSOFT AG) db54501900 drm/i915: Improve CRTDDC mapping by using VBT info
Use VBT information to determine which DDC bus to use for CRTDCC.
Fall back to GPIOA if VBT info is not available.

Signed-off-by: David Müller <d.mueller@elsoft.ch>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Tested on: 855 (David), and 945GM, 965GM, GM45, and G45 (anholt)
2009-08-29 18:23:40 -07:00
Eric Anholt a09ba7faf7 drm/i915: Fix CPU-spinning hangs related to fence usage by using an LRU.
The lack of a proper LRU was partially worked around by taking the fence
from the object containing the oldest seqno.  But if there are multiple
objects inactive, then they don't have seqnos and the first fence reg
among them would be chosen.  If you were trying to copy data between two
mappings, this could result in each page fault stealing the fence from
the other argument, and your application hanging.

https://bugs.freedesktop.org/show_bug.cgi?id=23566
https://bugs.freedesktop.org/show_bug.cgi?id=23220
https://bugs.freedesktop.org/show_bug.cgi?id=23253
https://bugs.freedesktop.org/show_bug.cgi?id=23366

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-08-29 17:37:21 -07:00
Pekka Paalanen a1a2d1d322 drm: GEM handles are u32, not int
Several functions in the GEM kernel API used int as handle type, but
user API has it __u32 which is also the intended type.

Replace int with u32.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 11:21:08 +10:00
Dave Airlie 3f7dc91ade drm/rs600/690: use autogenerated safe register tables.
This ports rs690 to the safe reg tables and makes rs600 also
use the same table.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 11:11:56 +10:00
Ben Hutchings 52f97df5da drm/r128: Use request_firmware() to load CCE microcode
Firmware blob looks like this:
    __be32 datah
    __be32 datal

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 10:47:00 +10:00
Ben Hutchings ece2be7993 drm/mga: Use request_firmware() to load microcode
Image format is IHEX, one record for each pipe in order (record
addresses are ignored).

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 10:46:54 +10:00
Dave Airlie c9c97b8c75 drm/ttm: consolidate cache flushing code in one place.
This merges the TTM and drm cache flushing into one file in the
drm core.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-27 09:53:47 +10:00
Ma Ling f8aed700c6 drm/i915: Set crtc/clone mask in different output devices
Based on Bspec each encoder has different sharing pipe property,
i.e. Integrated or SDVO TV both will occupy one pipe exclusively,
and sdvo-non-tv and crt are allowed to share one. The patch moves
sharing judgment into differnet output functions, and sets the right
clone bit.

This fixes both HDMI outputs choosing the same pipe.

https://bugs.freedesktop.org/show_bug.cgi?id=22247

Signed-off-by: Ma Ling <ling.ma@intel.com>
Reviewed-by : Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-08-24 17:01:33 -07:00
Ma Ling 27185ae1b7 drm/i915: Always use SDVO_B detect bit for SDVO output detection.
After the following commit is shipped, the SDVO C detection will depend on
the SDVO_C/DP detion bit.
commit 13520b051e
Author: Kristian Høgsberg <krh@redhat.com>
Date:   Fri Mar 13 15:42:14 2009 -0400

    drm/i915: Read the right SDVO register when detecting SVDO/HDMI.

According to the spec we should continue to detect the SDVO_B/C based on
the SDVO_B detection bit.  The new detection bit on G4X platform is for
the HDMI_C detection rather than SDVO_C detection.

https://bugs.freedesktop.org/show_bug.cgi?id=20639

Signed-off-by: Ma Ling <ling.ma@intel.com>
Acked-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-08-24 16:58:44 -07:00
Roel Kluin 19e1f888c6 drm/i915: Fix typo that broke SVID1 in intel_sdvo_multifunc_encoder()
Bit SDVO_OUTPUT_SVID0 was tested twice

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-08-24 16:41:23 -07:00
Bruno Prémont bc5e5718ac drm/i915: Check if BIOS enabled dual-channel LVDS on 8xx, not only on 9xx
Commit 0c2e39525b is not sufficient to
get fd.o bug #20115 fixed.
In addition intel_find_best_PLL() must not only rely on BIOS settings
for i9xx chips but also for i8xx, so drop the IS_I9XX() check.

Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-08-24 16:41:22 -07:00
Sean Young 942642a412 drm/i915: Set the multiplier for SDVO on G33 platform
http://bugs.freedesktop.org/show_bug.cgi?id=21417

Signed-off-by: Sean Young <sean@mess.org>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2009-08-24 16:41:22 -07: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 50f153036c drm/radeon/kms: generate the safe register tables.
Previously we just made these offline and included them,
but no reason we can't generate them at build time.

TODO: add rs690 + r100/r200 when done.
should we do rs480/rs690 no tcl version?

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-21 14:20:38 +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
Thomas Hellstrom 08e4d53474 drm: Fix sysfs device confusion.
The drm sysfs class suspend / resume methods could not distinguish
between different device types wich could lead to illegal type casts.

Use struct device_type and make sure the class suspend / resume callbacks
are aware of those. There is no per device-type suspend / resume. Only
new-style PM.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-21 10:01:59 +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
Thomas Hellstrom 759e4f83f4 drm/ttm: Fixes for "Memory accounting rework."
ttm:
Fix error paths when kobject_add returns an error.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-20 18:58:15 +10:00
Thomas Hellstrom 7f5f4db2d5 drm/ttm: Fixes for "Make parts of a struct ttm_bo_device global"
ttm:
Remove a stray debug printout.
Remove a re-init of the lru spinlock at device init.

radeon:
Fix the size of the bo_global allocation.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-20 18:58:13 +10:00
Dave Airlie 51c8b4071d Merge Linus master to drm-next
linux-next conflict reported needed resolution.

Conflicts:
	drivers/gpu/drm/drm_crtc.c
	drivers/gpu/drm/drm_edid.c
	drivers/gpu/drm/i915/intel_sdvo.c
	drivers/gpu/drm/radeon/radeon_ttm.c
	drivers/gpu/drm/ttm/ttm_bo.c
2009-08-20 13:38:04 +10:00
Thomas Hellstrom a987fcaa80 ttm: Make parts of a struct ttm_bo_device global.
Common resources, like memory accounting and swap lists should be
global and not per device. Introduce a struct ttm_bo_global to
accomodate this, and register it with sysfs. Add a small sysfs interface
to return the number of active buffer objects.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:10:34 +10:00
Thomas Hellstrom 5fd9cbad3a drm/ttm: Memory accounting rework.
Use inclusive zones to simplify accounting and its sysfs representation.
Use DMA32 accounting where applicable.

Add a sysfs interface to make the heuristically determined limits
readable and configurable.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:09:53 +10:00
Thomas Hellstrom e9840be8c2 drm/ttm: Add a virtual ttm sysfs device.
The device directory will be the base directory of the
sysfs representation of other ttm subsystems.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:09:04 +10:00
Thomas Hellstrom 327c225bd5 drm: Enable drm drivers to add drm sysfs devices.
Export utility functions for drivers to add specialized devices in the
sysfs drm class subdirectory.

Initially this will be needed form TTM to add a virtual device that
handles power management.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19 16:08:51 +10:00