safe/jmp/linux-2.6
14 years agodrm/nouveau: have ttm's fault handler called directly
Ben Skeggs [Mon, 4 Jan 2010 05:52:20 +0000 (15:52 +1000)]
drm/nouveau: have ttm's fault handler called directly

There's no good reason for us to have our own anymore, this is left over
from an early port to these TTM interfaces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv50: restore correct cache1 get/put address on fifoctx load
Ben Skeggs [Mon, 4 Jan 2010 23:41:05 +0000 (09:41 +1000)]
drm/nv50: restore correct cache1 get/put address on fifoctx load

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: create function for "dealing" with gpu lockup
Marcin Slusarz [Mon, 4 Jan 2010 18:25:09 +0000 (19:25 +0100)]
drm/nouveau: create function for "dealing" with gpu lockup

It's mostly a cleanup, but in nv50_fbcon_accel_init gpu lockup
message was printed, but HWACCEL_DISBALED flag was not set.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: remove unused nouveau_channel_idle() function
Ben Skeggs [Mon, 4 Jan 2010 02:53:01 +0000 (12:53 +1000)]
drm/nouveau: remove unused nouveau_channel_idle() function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: fix handling of fbcon colours in 8bpp
Ben Skeggs [Sun, 3 Jan 2010 23:10:55 +0000 (09:10 +1000)]
drm/nouveau: fix handling of fbcon colours in 8bpp

Depending on the visual, the colours handed to us in fillrect() can either be
an actual colour, or an index into the pseudo-palette.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv04: Context switching fixes.
Francisco Jerez [Sat, 26 Dec 2009 13:39:46 +0000 (14:39 +0100)]
drm/nv04: Context switching fixes.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Use the software object for fencing.
Francisco Jerez [Sat, 26 Dec 2009 01:09:36 +0000 (02:09 +0100)]
drm/nouveau: Use the software object for fencing.

This should avoid a race condition on nv0x, if we're doing it with
actual PGRAPH objects and a there's a fence within the FIFO DMA fetch
area when a context switch kicks in.

In that case we get an ILLEGAL_MTHD interrupt as expected, but the
values in PGRAPH_TRAPPED_ADDR aren't calculated correctly and they're
almost useless (e.g. you can see ILLEGAL_MTHDs for the now inactive
channel, with a wrong offset/data pair).

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Allocate a per-channel instance of NV_SW.
Francisco Jerez [Sat, 26 Dec 2009 01:42:45 +0000 (02:42 +0100)]
drm/nouveau: Allocate a per-channel instance of NV_SW.

It will be useful for various synchronization purposes, mostly stolen
from "[PATCH] drm/nv50: synchronize user channel after buffer object
move on kernel channel" by Maarten Maathuis.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nv50: make the blocksize depend on vram size
Maarten Maathuis [Sat, 26 Dec 2009 20:46:36 +0000 (21:46 +0100)]
drm/nv50: make the blocksize depend on vram size

- This should be better than what we have now.
- I'm less sure about the non power of two path.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
14 years agodrm/nouveau: better alignment of bo sizes and use roundup instead of ALIGN
Maarten Maathuis [Fri, 25 Dec 2009 17:51:17 +0000 (18:51 +0100)]
drm/nouveau: better alignment of bo sizes and use roundup instead of ALIGN

- Aligning to block size should ensure that the extra size is enough.
- Using roundup, because not all sizes are powers of two.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
14 years agodrm/nouveau: Don't skip card take down on nv0x.
Francisco Jerez [Tue, 22 Dec 2009 17:24:09 +0000 (18:24 +0100)]
drm/nouveau: Don't skip card take down on nv0x.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Implement nv42-nv43 TV load detection.
Francisco Jerez [Thu, 17 Dec 2009 17:57:44 +0000 (18:57 +0100)]
drm/nouveau: Implement nv42-nv43 TV load detection.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Clean up the nv17-nv4x load detection code a bit.
Francisco Jerez [Thu, 17 Dec 2009 17:52:44 +0000 (18:52 +0100)]
drm/nouveau: Clean up the nv17-nv4x load detection code a bit.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nv50: fix fillrect color
Marcin Slusarz [Mon, 21 Dec 2009 22:00:41 +0000 (23:00 +0100)]
drm/nv50: fix fillrect color

struct fb_fillrect->color is not a color, but index into pseudo_palette
array

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv50: ignore vbios table's claim to the contrary if EDID says >8bpc
Ben Skeggs [Mon, 21 Dec 2009 02:16:52 +0000 (12:16 +1000)]
drm/nv50: ignore vbios table's claim to the contrary if EDID says >8bpc

Should fix dim panel issues reported on Dell M6400/M6500.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Drop redundant placement initialization.
Francisco Jerez [Wed, 16 Dec 2009 18:03:28 +0000 (19:03 +0100)]
drm/nouveau: Drop redundant placement initialization.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: No need to force evict=true when swapping evicted BOs back in.
Francisco Jerez [Wed, 16 Dec 2009 18:05:38 +0000 (19:05 +0100)]
drm/nouveau: No need to force evict=true when swapping evicted BOs back in.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Fix "general protection fault" in the flipd/flips eviction path.
Francisco Jerez [Wed, 16 Dec 2009 18:05:00 +0000 (19:05 +0100)]
drm/nouveau: Fix "general protection fault" in the flipd/flips eviction path.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/i2c/ch7006: Drop build time dependency to nouveau.
Francisco Jerez [Wed, 16 Dec 2009 11:27:11 +0000 (12:27 +0100)]
drm/i2c/ch7006: Drop build time dependency to nouveau.

This partially reverts e4b41066, as this driver is intended to be
useful with any KMS driver for suitable hardware. The missing build
dependency that commit workarounded was DRM_KMS_HELPER.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Make the MM aware of pre-G80 tiling.
Francisco Jerez [Fri, 11 Dec 2009 15:51:09 +0000 (16:51 +0100)]
drm/nouveau: Make the MM aware of pre-G80 tiling.

This commit has also the following 3 bugfix commits squashed into it from
the nouveau git tree:

drm/nouveau: Fix up the tiling alignment restrictions for nv1x.
drm/nouveau: Fix up the nv2x tiling alignment restrictions.
drm/nv50: fix align typo for g9x

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Pre-G80 tiling support.
Francisco Jerez [Wed, 16 Dec 2009 11:12:27 +0000 (12:12 +0100)]
drm/nouveau: Pre-G80 tiling support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nouveau: Add cache_flush/pull fifo engine functions.
Francisco Jerez [Sun, 13 Dec 2009 19:07:42 +0000 (20:07 +0100)]
drm/nouveau: Add cache_flush/pull fifo engine functions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm: reduce WARN_ON to a printk.
Dave Airlie [Mon, 11 Jan 2010 04:20:55 +0000 (14:20 +1000)]
drm: reduce WARN_ON to a printk.

Lots of ppl keep thinking this is an oops, it was just a warning for
me to see, just make it a printk now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/kms/fb: check for depth changes from userspace for resizing.
Dave Airlie [Thu, 7 Jan 2010 23:27:08 +0000 (09:27 +1000)]
drm/kms/fb: check for depth changes from userspace for resizing.

If userspace (plymouth in this case) asks for a deeper depth,
refuse it as well due to lack of resizing.

This fixes an issue since < 32MB cards went to 8bpp and plymouth
crashes on startup.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Keep disabled outputs disabled after suspend / resume
David John [Thu, 31 Dec 2009 06:30:46 +0000 (12:00 +0530)]
drm: Keep disabled outputs disabled after suspend / resume

With the current DRM code, an output that has been powered off
from userspace will automatically power back on when resuming
from suspend. This patch fixes this behaviour.

Tested only with the Intel i915 driver on an Intel GM45 Express
chipset.

Signed-off-by: David John <davidjon@xenontk.org>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Thu, 7 Jan 2010 04:00:29 +0000 (14:00 +1000)]
Merge remote branch 'korg/drm-radeon-next' into drm-linus

* korg/drm-radeon-next:
  drm/radeon/kms: rs600: use correct mask for SW interrupt
  gpu/drm/radeon/radeon_irq.c: move a dereference below a NULL test
  drm/radeon/radeon_device.c: move a dereference below a NULL test
  drm/radeon/radeon_fence.c: move a dereference below the NULL test
  drm/radeon/radeon_connectors.c: add a NULL test before dereference
  drm/radeon/kms: fix memory leak
  drm/radeon/kms: add missing breaks in i2c and ss lookups
  drm/radeon/kms: add primary dac adj values table
  drm/radeon/kms: fallback to default connector table

14 years agodrm/radeon/kms: rs600: use correct mask for SW interrupt
Luca Tettamanti [Mon, 28 Dec 2009 21:53:05 +0000 (22:53 +0100)]
drm/radeon/kms: rs600: use correct mask for SW interrupt

The mask happens to be the same, but the IH is reading the status, not the
not the control register.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agogpu/drm/radeon/radeon_irq.c: move a dereference below a NULL test
Darren Jenkins [Wed, 30 Dec 2009 01:16:35 +0000 (12:16 +1100)]
gpu/drm/radeon/radeon_irq.c: move a dereference below a NULL test

If a NULL value is possible, the dereference should only occur after the
NULL test.

Coverity CID: 13338

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/radeon_device.c: move a dereference below a NULL test
Darren Jenkins [Wed, 30 Dec 2009 01:18:30 +0000 (12:18 +1100)]
drm/radeon/radeon_device.c: move a dereference below a NULL test

If a NULL value is possible, the dereference should only occur after the
NULL test.

Coverity CID: 13335

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/radeon_fence.c: move a dereference below the NULL test
Darren Jenkins [Wed, 30 Dec 2009 01:20:05 +0000 (12:20 +1100)]
drm/radeon/radeon_fence.c: move a dereference below the NULL test

If a NULL value is possible, the dereference should only occur after the
NULL test.

Coverity CID: 13334

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/radeon_connectors.c: add a NULL test before dereference
Darren Jenkins [Wed, 30 Dec 2009 01:22:55 +0000 (12:22 +1100)]
drm/radeon/radeon_connectors.c: add a NULL test before dereference

The encoder variable can be NULL in this function so I believe it should
be checked before dereference.

Coverity CID: 13253

[airlied: extremely unlikely to happen]

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fix memory leak
Jiri Slaby [Wed, 6 Jan 2010 16:39:31 +0000 (17:39 +0100)]
drm/radeon/kms: fix memory leak

Stanse found a memory leak in radeon_master_create. master_priv is not
freed/assigned on all paths. Fix that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge branch 'drm-core-next' into drm-linus
Dave Airlie [Thu, 7 Jan 2010 03:36:00 +0000 (13:36 +1000)]
Merge branch 'drm-core-next' into drm-linus

* drm-core-next:
  drm/kms: Fix &&/|| confusion in drm_fb_helper_connector_parse_command_line()
  drm/edid: Fix CVT width/height decode
  drm/edid: Skip empty CVT codepoints
  drm: remove address mask param for drm_pci_alloc()

14 years agodrm/kms: Fix &&/|| confusion in drm_fb_helper_connector_parse_command_line()
Roel Kluin [Thu, 31 Dec 2009 12:06:29 +0000 (13:06 +0100)]
drm/kms: Fix &&/|| confusion in drm_fb_helper_connector_parse_command_line()

This always evaluates to true.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/edid: Fix CVT width/height decode
Adam Jackson [Mon, 4 Jan 2010 22:53:07 +0000 (17:53 -0500)]
drm/edid: Fix CVT width/height decode

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/edid: Skip empty CVT codepoints
Adam Jackson [Mon, 4 Jan 2010 22:53:06 +0000 (17:53 -0500)]
drm/edid: Skip empty CVT codepoints

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: remove address mask param for drm_pci_alloc()
Zhenyu Wang [Tue, 5 Jan 2010 03:25:05 +0000 (11:25 +0800)]
drm: remove address mask param for drm_pci_alloc()

drm_pci_alloc() has input of address mask for setting pci dma
mask on the device, which should be properly setup by drm driver.
And leave it as a param for drm_pci_alloc() would cause confusion
or mistake would corrupt the correct dma mask setting, as seen on
intel hw which set wrong dma mask for hw status page. So remove
it from drm_pci_alloc() function.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add missing breaks in i2c and ss lookups
Alex Deucher [Mon, 28 Dec 2009 18:45:23 +0000 (13:45 -0500)]
drm/radeon/kms: add missing breaks in i2c and ss lookups

Should fix fdo bug 25741

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add primary dac adj values table
Alex Deucher [Tue, 29 Dec 2009 17:09:17 +0000 (12:09 -0500)]
drm/radeon/kms: add primary dac adj values table

Look up primary dac adj values from the table if
there is no bios or bios dac table to reference.

The lookup table may need to be adjusted for certain
families.

Should fix kernel bug 14945.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fallback to default connector table
Alex Deucher [Tue, 5 Jan 2010 00:12:02 +0000 (19:12 -0500)]
drm/radeon/kms: fallback to default connector table

if necessary for combios

Some early combios radeon cards don't have a connector
table or dac table in the bios, if they do not, fallback
to the default tables.

Should fix kernel bug 14963.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Wed, 23 Dec 2009 01:18:33 +0000 (11:18 +1000)]
Merge remote branch 'korg/drm-radeon-next' into drm-linus

* korg/drm-radeon-next:
  drm/radeon/kms: add definitions for v4 power tables
  drm/radeon/kms: never combine LVDS with another encoder
  drm/radeon/kms: Check module arguments to be valid V2
  drm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
  drm/radeon/kms: add cvt mode if we only have lvds w/h and no edid (v4)
  drm/radeon/kms: add 3DC compression support
  drm/radeon/kms: allow rendering while no colorbuffer is set on r300
  drm/radeon/kms: enable memory clock reading on legacy (V2)
  drm/radeon/kms: prevent parallel AtomBIOS calls
  drm/radeon/kms: set proper default tv standard
  drm/radeon/kms: fix legacy rmx
  drm/radeon/kms/atom: fill in proper defines for digital setup

14 years agodrm/radeon/kms: add definitions for v4 power tables
Alex Deucher [Sat, 19 Dec 2009 17:45:12 +0000 (12:45 -0500)]
drm/radeon/kms: add definitions for v4 power tables

[airlied: just adding this for completeness to avoid drift between
public atombios.h files]
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: never combine LVDS with another encoder
Alex Deucher [Fri, 18 Dec 2009 16:28:22 +0000 (11:28 -0500)]
drm/radeon/kms: never combine LVDS with another encoder

When linking multiple encoders to a connector, make sure
to not link LVDS with another connector.  Some bioses
have the same i2c line for LVDS and VGA.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Check module arguments to be valid V2
Jerome Glisse [Fri, 11 Dec 2009 20:18:34 +0000 (21:18 +0100)]
drm/radeon/kms: Check module arguments to be valid V2

This patch add a function which check module argument to be
valid. On invalid argument it prints a warning and setback
the default value.

V2: Allow 0 for vram limit & agp mode which are the default
value

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
Jerome Glisse [Fri, 11 Dec 2009 19:36:19 +0000 (20:36 +0100)]
drm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure

Add boolean to record if some part of the driver are initialized or
not this allow to avoid a crash when trying to cleanup uninitialized
structure members.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add cvt mode if we only have lvds w/h and no edid (v4)
Alex Deucher [Tue, 22 Dec 2009 15:06:49 +0000 (10:06 -0500)]
drm/radeon/kms: add cvt mode if we only have lvds w/h and no edid (v4)

This fixes LVDS on some mac laptops without a panel edid.

v2 - Set proper mode type flags
v3 - Note that this is not neceesarily the exact panel mode,
but an approximation based on the cvt formula.  For these
systems we should ideally read the mode info out of the
registers or add a mode table, but this works and is much
simpler.
v4 - Update comments and debug message.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add 3DC compression support
Marek Olšák [Fri, 18 Dec 2009 23:23:00 +0000 (00:23 +0100)]
drm/radeon/kms: add 3DC compression support

There are 2 formats:
ATI1N: 64 bits per 4x4 block, one-channel format
ATI2N: 128 bits per 4x4 block, two-channel format

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: allow rendering while no colorbuffer is set on r300
Marek Olšák [Thu, 17 Dec 2009 05:02:28 +0000 (06:02 +0100)]
drm/radeon/kms: allow rendering while no colorbuffer is set on r300

Because hardware cannot disable all colorbuffers directly to do depth-only
rendering, a user should:
- disable reading from a colorbuffer in blending
- disable fastfill
- set the color channel mask to 0 to prevent writing to a colorbuffer

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: enable memory clock reading on legacy (V2)
Rafał Miłecki [Thu, 17 Dec 2009 12:50:09 +0000 (13:50 +0100)]
drm/radeon/kms: enable memory clock reading on legacy (V2)

V2: detect IGP cards (which don't have own memory)

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: prevent parallel AtomBIOS calls
Rafał Miłecki [Wed, 16 Dec 2009 23:00:46 +0000 (00:00 +0100)]
drm/radeon/kms: prevent parallel AtomBIOS calls

This just adds a mutex around the atombios table execution
so we don't call it from two contexts at once.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: set proper default tv standard
Alex Deucher [Fri, 18 Dec 2009 00:00:29 +0000 (19:00 -0500)]
drm/radeon/kms: set proper default tv standard

we were just using 1 before.

reported on irc by soreau

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fix legacy rmx
Alex Deucher [Thu, 17 Dec 2009 06:24:59 +0000 (01:24 -0500)]
drm/radeon/kms: fix legacy rmx

This makes 640x480 on my R100 work again, both
in aspect and centered mode.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Tested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms/atom: fill in proper defines for digital setup
Alex Deucher [Thu, 17 Dec 2009 16:22:01 +0000 (11:22 -0500)]
drm/radeon/kms/atom: fill in proper defines for digital setup

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'nouveau/for-airlied' into drm-linus
Dave Airlie [Wed, 23 Dec 2009 00:28:24 +0000 (10:28 +1000)]
Merge remote branch 'nouveau/for-airlied' into drm-linus

* nouveau/for-airlied:
  drm/nouveau: fix bug causing pinned buffers to lose their NO_EVICT flag
  drm/nv50: fix suspend/resume delays without firmware present
  drm/nouveau: prevent all channel creation if accel not available
  drm/nv50: fix two potential suspend/resume oopses
  drm/nv40: implement ctxprog/state generation
  drm/nv10: Add the initial graph context and soft methods needed for LMA.
  drm/nouveau: Fix up buffer eviction, and evict them to GART, if possible.
  drm/nouveau: Add proper error handling to nouveau_card_init
  drm/nv04: Fix NV04 set_operation software method.
  drm/nouveau: Kill global state in BIOS script interpreter
  drm/nouveau: Kill global state in NvShadowBIOS
  drm/nouveau: use drm debug levels
  drm/i2c/ch7006: Fix load detection false positives right after system init.
  drm/nv04-nv40: Fix "conflicting memory types" when saving/restoring VGA fonts.

14 years agodrm/kms: silencing a false positive warning.
Marin Mitov [Sun, 20 Dec 2009 07:03:27 +0000 (09:03 +0200)]
drm/kms: silencing a false positive warning.

warning: 'width' may be used uninitialized in this function
drivers/gpu/drm/drm_edid.c

Signed-off-by: Marin Mitov <mitov@issp.bas.bg>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/mm: fix logic for selection of best fit block
Bob Gleitsmann [Mon, 21 Dec 2009 03:52:09 +0000 (13:52 +1000)]
drm/mm: fix logic for selection of best fit block

This is from bug 25728.

[airlied: I'm just forwarding the patch for review, Thomas, ickle?]

Acked-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.
Thomas Hellstrom [Tue, 22 Dec 2009 15:53:41 +0000 (16:53 +0100)]
drm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.

Improve the command verifier to catch all occurences of surface handles,
and translate to SIDs.

This way DMA buffers and 3D surfaces share a common handle space,
which makes it possible for the kms code to differentiate.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.
Thomas Hellstrom [Tue, 8 Dec 2009 11:59:34 +0000 (12:59 +0100)]
drm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.

Fixes for TTM API change.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/vmwgfx: Fix unlocked ioctl and add proper access control
Thomas Hellstrom [Tue, 8 Dec 2009 11:57:51 +0000 (12:57 +0100)]
drm/vmwgfx: Fix unlocked ioctl and add proper access control

This fixes up vmwgfx for the unlocked ioctl code to avoid
doing it in the driver. Also adds ioctl flags.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: fix build on 64-bit with some compilers.
Dave Airlie [Sun, 20 Dec 2009 06:08:40 +0000 (16:08 +1000)]
drm/radeon: fix build on 64-bit with some compilers.

drivers/gpu/drm/radeon/radeon_test.c:45: undefined reference to `__udivdi3'

Reported-by: Mr. James W. Laferriere <babydr@baby-dragons.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrivers/gpu: Use kzalloc for allocating only one thing
Julia Lawall [Sat, 19 Dec 2009 07:16:33 +0000 (08:16 +0100)]
drivers/gpu: Use kzalloc for allocating only one thing

Use kzalloc rather than kcalloc(1,...)

The use of the allocated memory that looks like an array is &p->relocs[0],
but this should be the same as p->relocs.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
          ...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoDRM: Rename clamp variable
Andi Kleen [Mon, 21 Dec 2009 01:24:47 +0000 (02:24 +0100)]
DRM: Rename clamp variable

linux/kernel.h has a "clamp" macro, but r300_cmdbuf also uses a variable
with the same name. Right now it doesn't seem to include the header,
but sooner or later someone will. So better rename the variable
now.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: convert drm_ioctl to unlocked_ioctl
Arnd Bergmann [Wed, 16 Dec 2009 22:17:09 +0000 (22:17 +0000)]
drm: convert drm_ioctl to unlocked_ioctl

drm_ioctl is called with the Big Kernel Lock held,
which shows up very high in statistics on vfs_ioctl.

Moving the lock into the drm_ioctl function itself
makes sure we blame the right subsystem and it gets
us one step closer to eliminating the locked version
of fops->ioctl.

Since drm_ioctl does not require the lock itself,
we only need to hold it while calling the specific
handler. The 32 bit conversion handlers do not
interact with any other code, so they don't need
the BKL here either and can just call drm_ioctl.

As a bonus, this cleans up all the other users
of drm_ioctl which now no longer have to find
the inode or call lock_kernel.

[airlied: squashed the non-driver bits
of the second patch in here, this provides
the flag for drivers to use to select unlocked
ioctls - but doesn't modify any drivers].

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.sourceforge.net
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge branch 'drm-linus' into drm-core-next
Dave Airlie [Thu, 17 Dec 2009 23:56:49 +0000 (09:56 +1000)]
Merge branch 'drm-linus' into drm-core-next

14 years agoMerge remote branch 'korg/drm-vmware-staging' into drm-core-next
Dave Airlie [Thu, 17 Dec 2009 23:53:50 +0000 (09:53 +1000)]
Merge remote branch 'korg/drm-vmware-staging' into drm-core-next

14 years agodrm/nouveau: fix bug causing pinned buffers to lose their NO_EVICT flag
Ben Skeggs [Wed, 16 Dec 2009 06:22:42 +0000 (16:22 +1000)]
drm/nouveau: fix bug causing pinned buffers to lose their NO_EVICT flag

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv50: fix suspend/resume delays without firmware present
Ben Skeggs [Wed, 16 Dec 2009 05:07:45 +0000 (15:07 +1000)]
drm/nv50: fix suspend/resume delays without firmware present

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: prevent all channel creation if accel not available
Ben Skeggs [Wed, 16 Dec 2009 04:28:55 +0000 (14:28 +1000)]
drm/nouveau: prevent all channel creation if accel not available

Previously, if there was no firmware available, the DRM would just
disable channel creation from userspace, but still use a single
channel for its own purposes.

With a bit of care it should actually be possible to do this, due
to the DRM's very limited use of the engine.  It currently doesn't
work correctly however, resulting in corrupted fbcon and hangs on
a number of cards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv50: fix two potential suspend/resume oopses
Ben Skeggs [Wed, 16 Dec 2009 04:51:13 +0000 (14:51 +1000)]
drm/nv50: fix two potential suspend/resume oopses

This avoids touching the dummy channel 0/127 we have on nv50.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv40: implement ctxprog/state generation
Ben Skeggs [Tue, 15 Dec 2009 12:02:47 +0000 (22:02 +1000)]
drm/nv40: implement ctxprog/state generation

The context programs are *very* simple compared to the ones used by
the binary driver.  There's notes in nv40_grctx.c explaining most of
the things we don't implement.  If we discover if/why any of it is
required further down the track, we'll handle it then.

The PGRAPH state generated for each chipset should match what NVIDIA
do almost exactly (there's a couple of exceptions).  If someone has
a lot of time on their hands, they could figure out the mapping of
object/method to PGRAPH register and demagic the initial state a little,
it's not terribly important however.

At time of commit, confirmed to be working at least well enough for
accelerated X (and where tested, for 3D apps) on NV40, NV43, NV44, NV46,
NV49, NV4A, NV4B and NV4E.

A module option has been added to force the use of external firmware
blobs if it becomes required.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv10: Add the initial graph context and soft methods needed for LMA.
Francisco Jerez [Mon, 14 Dec 2009 14:00:30 +0000 (15:00 +0100)]
drm/nv10: Add the initial graph context and soft methods needed for LMA.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Fix up buffer eviction, and evict them to GART, if possible.
Francisco Jerez [Fri, 11 Dec 2009 17:40:17 +0000 (18:40 +0100)]
drm/nouveau: Fix up buffer eviction, and evict them to GART, if possible.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Add proper error handling to nouveau_card_init
Marcin Kościelnicki [Mon, 14 Dec 2009 20:58:39 +0000 (20:58 +0000)]
drm/nouveau: Add proper error handling to nouveau_card_init

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv04: Fix NV04 set_operation software method.
Marcin Kościelnicki [Mon, 14 Dec 2009 20:38:17 +0000 (20:38 +0000)]
drm/nv04: Fix NV04 set_operation software method.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Kill global state in BIOS script interpreter
Marcin Kościelnicki [Tue, 15 Dec 2009 00:37:31 +0000 (00:37 +0000)]
drm/nouveau: Kill global state in BIOS script interpreter

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Kill global state in NvShadowBIOS
Marcin Kościelnicki [Tue, 15 Dec 2009 00:37:30 +0000 (00:37 +0000)]
drm/nouveau: Kill global state in NvShadowBIOS

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: use drm debug levels
Maarten Maathuis [Sun, 13 Dec 2009 15:53:12 +0000 (16:53 +0100)]
drm/nouveau: use drm debug levels

- Use driver level (0x2) for NV_DEBUG instead of all levels
- Create a NV_DEBUG_KMS for KMS level (0x4) and use them in modesetting code
- Remove a few odd NV_TRACE calls and replace some of them with NV_DEBUG_KMS or
NV_INFO

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/i2c/ch7006: Fix load detection false positives right after system init.
Francisco Jerez [Tue, 15 Dec 2009 00:34:42 +0000 (01:34 +0100)]
drm/i2c/ch7006: Fix load detection false positives right after system init.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv04-nv40: Fix "conflicting memory types" when saving/restoring VGA fonts.
Francisco Jerez [Fri, 11 Dec 2009 22:44:49 +0000 (23:44 +0100)]
drm/nv04-nv40: Fix "conflicting memory types" when saving/restoring VGA fonts.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/radeon/kms: fix r100->r500 CS checker for compressed textures. (v2)
Dave Airlie [Mon, 7 Dec 2009 03:16:06 +0000 (13:16 +1000)]
drm/radeon/kms: fix r100->r500 CS checker for compressed textures. (v2)

This adds support for compressed textures to the r100->r500 CS
checker, it lets me run openarena and the demos in mesa fine.

Thanks to Maciej Cencora for initial comments.

Changes since v1:
fix calculations with Maciej formulas

Reviewed-by: Maciej Cencora <m.cencora@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: allow for texture tiling
Maciej Cencora [Tue, 15 Dec 2009 22:13:08 +0000 (23:13 +0100)]
drm/radeon/kms: allow for texture tiling

This adds the relocations for texture tiling for KMS.

Signed-off-by: Maciej Cencora <m.cencora@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Wed, 16 Dec 2009 05:58:36 +0000 (15:58 +1000)]
Merge remote branch 'korg/drm-radeon-next' into drm-linus

* korg/drm-radeon-next:
  drm/radeon/kms: init pm on all chipsets

14 years agodrm/radeon/kms: init pm on all chipsets
Rafał Miłecki [Tue, 15 Dec 2009 20:46:58 +0000 (21:46 +0100)]
drm/radeon/kms: init pm on all chipsets

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-linus
Dave Airlie [Wed, 16 Dec 2009 05:52:21 +0000 (15:52 +1000)]
Merge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-linus

* 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next:
  drm/nouveau: remove use of -ERESTART
  nouveau: Fix endianness with new context program loader
  drm/nouveau: fix build with CONFIG_AGP=n
  drm/nouveau: fix ch7006 build

14 years agodrm/radeon/kms: HDMI support for R600 KMS
Christian Koenig [Sun, 11 Oct 2009 21:49:13 +0000 (23:49 +0200)]
drm/radeon/kms: HDMI support for R600 KMS

Adding basic HDMI support for R600 KMS, ported from radeonhd ddx.

[airlied:- checkpatch cleanups]
Signed-off-by: Christian Koenig <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: make sure mc is initialized before mapping blit bo
Alex Deucher [Tue, 15 Dec 2009 22:15:07 +0000 (17:15 -0500)]
drm/radeon/kms: make sure mc is initialized before mapping blit bo

We need to make sure the the MC is intialized before we map the
blit shader object on r6xx+.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Return to userspace on ERESTARTSYS
Jerome Glisse [Tue, 15 Dec 2009 17:23:23 +0000 (18:23 +0100)]
drm/radeon/kms: Return to userspace on ERESTARTSYS

radeon_object.h wasn't converted to ERESTARTSYS change. No
each time we got an ERESTARTSYS we return to userspace (ie
we were interrupted by a signal and we let the userspace
reschedule the ioctl).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/gem: don't leak a gem object if reserve fails on get tiling (v2)
Dave Airlie [Wed, 16 Dec 2009 03:10:43 +0000 (13:10 +1000)]
drm/radeon/gem: don't leak a gem object if reserve fails on get tiling (v2)

Not sure it ever happens in practice, spotted during code review.

spare brace snuck in

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: don't report allocate failure on ERESTARTSYS
Dave Airlie [Tue, 15 Dec 2009 00:39:48 +0000 (10:39 +1000)]
drm/radeon/kms: don't report allocate failure on ERESTARTSYS

if we fail with ERESTARTSYS during alloc, we'll get a retry from
userspace so don't report it in dmesg.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Check if bo we got from ttm are radeon object or not
Jerome Glisse [Mon, 14 Dec 2009 20:02:09 +0000 (21:02 +0100)]
drm/radeon/kms: Check if bo we got from ttm are radeon object or not

If they are not radeon object don't do anythings special for them,
this avoid rare oops than can happen in a complex use case.

[airlied: additional fixups]

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: If no placement is supplied fallback to system
Jerome Glisse [Fri, 11 Dec 2009 14:13:22 +0000 (15:13 +0100)]
drm/radeon/kms: If no placement is supplied fallback to system

Do as we did before rework, if no placement is supplied at bo
creation time, fallback to allocating bo from system ram. This
will fix most of the creation failed issue report we got since
the rework get merged.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Fix memory type manager debug information printing
Jerome Glisse [Thu, 10 Dec 2009 17:07:26 +0000 (18:07 +0100)]
drm/ttm: Fix memory type manager debug information printing

System memory type doesn't have a drm_mm manager associated to
it. This patch avoid trying to call drm_mm_debug on unitialized
drm_mm when printing debug info on the system memory manager.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Fix printk format & compute bo->mem.size at bo initialization
Jerome Glisse [Thu, 10 Dec 2009 15:15:52 +0000 (16:15 +0100)]
drm/ttm: Fix printk format & compute bo->mem.size at bo initialization

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Fix potential ttm_mem_evict_first races.
Thomas Hellstrom [Wed, 2 Dec 2009 17:33:46 +0000 (18:33 +0100)]
drm/ttm: Fix potential ttm_mem_evict_first races.

1) The function was previously called with a potentially empty
LRU list which would have lead to an OOPS or servere corruption.
2) In rare cases, after reservation has succeeded, another process may
already have evicted it or even pinned it. We must revalidate the
buffer status after releasing the lru lock.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Delayed delete fixes.
Thomas Hellstrom [Wed, 2 Dec 2009 17:33:45 +0000 (18:33 +0100)]
drm/ttm: Delayed delete fixes.

1) Remove from lru before reserving so we avoid competing with
evicting processes.
2) Avoid calling kref_put() on bo::list_kref while spinlocked.
3) Additional refcounting bug-checking.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: fix two bugs in new placement routines.
Dave Airlie [Mon, 14 Dec 2009 04:51:35 +0000 (14:51 +1000)]
drm/ttm: fix two bugs in new placement routines.

a) the loops were going to <= not <, leading to illegal memory access
b) the busy placement checks were using the placement arrays not the
   busy placement ones.

Acked-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: fix incorrect logic in ttm_bo_io path
Dave Airlie [Mon, 14 Dec 2009 22:07:12 +0000 (08:07 +1000)]
drm/ttm: fix incorrect logic in ttm_bo_io path

This path isn't used by radeon yet, but future drivers will want it,
so fix it right.

Reported-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/nouveau: remove use of -ERESTART
Ben Skeggs [Tue, 15 Dec 2009 01:04:25 +0000 (11:04 +1000)]
drm/nouveau: remove use of -ERESTART

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agonouveau: Fix endianness with new context program loader
Benjamin Herrenschmidt [Mon, 14 Dec 2009 03:31:40 +0000 (14:31 +1100)]
nouveau: Fix endianness with new context program loader

When switching to request_firmware() to load the context programs,
some endian fixes need to be applied. This makes it work again on
my quad g5 nvidia 6600.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: fix build with CONFIG_AGP=n
Ben Skeggs [Tue, 15 Dec 2009 00:38:32 +0000 (10:38 +1000)]
drm/nouveau: fix build with CONFIG_AGP=n

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>