9 years agodrm/nouveau: initialise DMA tracking parameters earlier
Ben Skeggs [Fri, 8 Jan 2010 00:57:39 +0000]
drm/nouveau: initialise DMA tracking parameters earlier

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

9 years agodrm/nouveau: use dma.max rather than pushbuf size for checking GET validity
Ben Skeggs [Fri, 8 Jan 2010 00:53:40 +0000]
drm/nouveau: use dma.max rather than pushbuf size for checking GET validity

Some upcoming G80 DMA changes will depend on this, but it's split out for
bisectibility just in case it causes some unexpected issues.

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

9 years agodrm/nv04: differentiate between nv04/nv05
Ben Skeggs [Thu, 7 Jan 2010 03:47:57 +0000]
drm/nv04: differentiate between nv04/nv05

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

9 years agodrm/nouveau: Fix null deref in nouveau_fence_emit due to deleted fence
Luca Barbieri [Wed, 6 Jan 2010 03:02:45 +0000]
drm/nouveau: Fix null deref in nouveau_fence_emit due to deleted fence

Currently Nouveau will unvalidate all buffers if it is forced to wait on
one, and then start revalidating from the beginning.  While doing so, it
destroys the operation fence, causing nouveau_fence_emit to crash.

This patch fixes this bug by taking the fence object out of validate_op
and creating it just before emit.  The fence pointer is initialized to 0
and unref'ed unconditionally.

In addition to fixing the bug, this prevents its reintroduction and
simplifies the code.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

9 years agodrm/nv50: prevent a possible ctxprog hang
Ben Skeggs [Wed, 6 Jan 2010 02:00:02 +0000]
drm/nv50: prevent a possible ctxprog hang

The below is mainly an educated guess at what's going on, docs would
sure be handy...  NVIDIA? :P

It appears it's possible for a ctxprog to run even while a GPU exception
is pending.  The GF8 and up ctxprogs appear to have a small snippet of
code which detects this, and stalls the ctxprog until it's been handled,
which essentially looks like:

if (r2 & 0x00008000) {
r0 |= 0x80000000;
while (r0 & 0x80000000) {}
}

I don't know of any way that flag would get cleared unless the driver
intervenes (and indeed, in the cases I've seen the hang, nothing steps
in to automagically clear it for us).  This patch causes the driver to
clear the flag during the PGRAPH IRQ handler.

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

9 years agodrm/nouveau: have ttm's fault handler called directly
Ben Skeggs [Mon, 4 Jan 2010 05:52:20 +0000]
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>

9 years agodrm/nv50: restore correct cache1 get/put address on fifoctx load
Ben Skeggs [Mon, 4 Jan 2010 23:41:05 +0000]
drm/nv50: restore correct cache1 get/put address on fifoctx load

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

9 years agodrm/nouveau: create function for "dealing" with gpu lockup
Marcin Slusarz [Mon, 4 Jan 2010 18:25:09 +0000]
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>

9 years agodrm/nouveau: remove unused nouveau_channel_idle() function
Ben Skeggs [Mon, 4 Jan 2010 02:53:01 +0000]
drm/nouveau: remove unused nouveau_channel_idle() function

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

9 years agodrm/nouveau: fix handling of fbcon colours in 8bpp
Ben Skeggs [Sun, 3 Jan 2010 23:10:55 +0000]
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>

9 years agodrm/nv04: Context switching fixes.
Francisco Jerez [Sat, 26 Dec 2009 13:39:46 +0000]
drm/nv04: Context switching fixes.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm/nouveau: Use the software object for fencing.
Francisco Jerez [Sat, 26 Dec 2009 01:09:36 +0000]
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>

9 years agodrm/nouveau: Allocate a per-channel instance of NV_SW.
Francisco Jerez [Sat, 26 Dec 2009 01:42:45 +0000]
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>

9 years agodrm/nv50: make the blocksize depend on vram size
Maarten Maathuis [Sat, 26 Dec 2009 20:46:36 +0000]
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>

9 years agodrm/nouveau: better alignment of bo sizes and use roundup instead of ALIGN
Maarten Maathuis [Fri, 25 Dec 2009 17:51:17 +0000]
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>

9 years agodrm/nouveau: Don't skip card take down on nv0x.
Francisco Jerez [Tue, 22 Dec 2009 17:24:09 +0000]
drm/nouveau: Don't skip card take down on nv0x.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm/nouveau: Implement nv42-nv43 TV load detection.
Francisco Jerez [Thu, 17 Dec 2009 17:57:44 +0000]
drm/nouveau: Implement nv42-nv43 TV load detection.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm/nouveau: Clean up the nv17-nv4x load detection code a bit.
Francisco Jerez [Thu, 17 Dec 2009 17:52:44 +0000]
drm/nouveau: Clean up the nv17-nv4x load detection code a bit.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm/nv50: fix fillrect color
Marcin Slusarz [Mon, 21 Dec 2009 22:00:41 +0000]
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>

9 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]
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>

9 years agodrm/nouveau: Drop redundant placement initialization.
Francisco Jerez [Wed, 16 Dec 2009 18:03:28 +0000]
drm/nouveau: Drop redundant placement initialization.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 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]
drm/nouveau: No need to force evict=true when swapping evicted BOs back in.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm/nouveau: Fix "general protection fault" in the flipd/flips eviction path.
Francisco Jerez [Wed, 16 Dec 2009 18:05:00 +0000]
drm/nouveau: Fix "general protection fault" in the flipd/flips eviction path.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm/i2c/ch7006: Drop build time dependency to nouveau.
Francisco Jerez [Wed, 16 Dec 2009 11:27:11 +0000]
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>

9 years agodrm/nouveau: Make the MM aware of pre-G80 tiling.
Francisco Jerez [Fri, 11 Dec 2009 15:51:09 +0000]
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>

9 years agodrm/nouveau: Pre-G80 tiling support.
Francisco Jerez [Wed, 16 Dec 2009 11:12:27 +0000]
drm/nouveau: Pre-G80 tiling support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm/nouveau: Add cache_flush/pull fifo engine functions.
Francisco Jerez [Sun, 13 Dec 2009 19:07:42 +0000]
drm/nouveau: Add cache_flush/pull fifo engine functions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>

9 years agodrm: reduce WARN_ON to a printk.
Dave Airlie [Mon, 11 Jan 2010 04:20:55 +0000]
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>

9 years agodrm/kms/fb: check for depth changes from userspace for resizing.
Dave Airlie [Thu, 7 Jan 2010 23:27:08 +0000]
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>

9 years agodrm: Keep disabled outputs disabled after suspend / resume
David John [Thu, 31 Dec 2009 06:30:46 +0000]
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>

9 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Thu, 7 Jan 2010 04:00:29 +0000]
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

9 years agodrm/radeon/kms: rs600: use correct mask for SW interrupt
Luca Tettamanti [Mon, 28 Dec 2009 21:53:05 +0000]
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>

9 years agogpu/drm/radeon/radeon_irq.c: move a dereference below a NULL test
Darren Jenkins [Wed, 30 Dec 2009 01:16:35 +0000]
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>

9 years agodrm/radeon/radeon_device.c: move a dereference below a NULL test
Darren Jenkins [Wed, 30 Dec 2009 01:18:30 +0000]
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>

9 years agodrm/radeon/radeon_fence.c: move a dereference below the NULL test
Darren Jenkins [Wed, 30 Dec 2009 01:20:05 +0000]
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>

9 years agodrm/radeon/radeon_connectors.c: add a NULL test before dereference
Darren Jenkins [Wed, 30 Dec 2009 01:22:55 +0000]
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>

9 years agodrm/radeon/kms: fix memory leak
Jiri Slaby [Wed, 6 Jan 2010 16:39:31 +0000]
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>

9 years agoMerge branch 'drm-core-next' into drm-linus
Dave Airlie [Thu, 7 Jan 2010 03:36:00 +0000]
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()

9 years agodrm/kms: Fix &&/|| confusion in drm_fb_helper_connector_parse_command_line()
Roel Kluin [Thu, 31 Dec 2009 12:06:29 +0000]
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>

9 years agodrm/edid: Fix CVT width/height decode
Adam Jackson [Mon, 4 Jan 2010 22:53:07 +0000]
drm/edid: Fix CVT width/height decode

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/edid: Skip empty CVT codepoints
Adam Jackson [Mon, 4 Jan 2010 22:53:06 +0000]
drm/edid: Skip empty CVT codepoints

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm: remove address mask param for drm_pci_alloc()
Zhenyu Wang [Tue, 5 Jan 2010 03:25:05 +0000]
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>

9 years agodrm/radeon/kms: add missing breaks in i2c and ss lookups
Alex Deucher [Mon, 28 Dec 2009 18:45:23 +0000]
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>

9 years agodrm/radeon/kms: add primary dac adj values table
Alex Deucher [Tue, 29 Dec 2009 17:09:17 +0000]
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>

9 years agodrm/radeon/kms: fallback to default connector table
Alex Deucher [Tue, 5 Jan 2010 00:12:02 +0000]
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>

9 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Wed, 23 Dec 2009 01:18:33 +0000]
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

9 years agodrm/radeon/kms: add definitions for v4 power tables
Alex Deucher [Sat, 19 Dec 2009 17:45:12 +0000]
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>

9 years agodrm/radeon/kms: never combine LVDS with another encoder
Alex Deucher [Fri, 18 Dec 2009 16:28:22 +0000]
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>

9 years agodrm/radeon/kms: Check module arguments to be valid V2
Jerome Glisse [Fri, 11 Dec 2009 20:18:34 +0000]
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>

9 years agodrm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
Jerome Glisse [Fri, 11 Dec 2009 19:36:19 +0000]
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>

9 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]
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>

9 years agodrm/radeon/kms: add 3DC compression support
Marek Olšák [Fri, 18 Dec 2009 23:23:00 +0000]
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>

9 years agodrm/radeon/kms: allow rendering while no colorbuffer is set on r300
Marek Olšák [Thu, 17 Dec 2009 05:02:28 +0000]
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>

9 years agodrm/radeon/kms: enable memory clock reading on legacy (V2)
Rafał Miłecki [Thu, 17 Dec 2009 12:50:09 +0000]
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>

9 years agodrm/radeon/kms: prevent parallel AtomBIOS calls
Rafał Miłecki [Wed, 16 Dec 2009 23:00:46 +0000]
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>

9 years agodrm/radeon/kms: set proper default tv standard
Alex Deucher [Fri, 18 Dec 2009 00:00:29 +0000]
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>

9 years agodrm/radeon/kms: fix legacy rmx
Alex Deucher [Thu, 17 Dec 2009 06:24:59 +0000]
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>

9 years agodrm/radeon/kms/atom: fill in proper defines for digital setup
Alex Deucher [Thu, 17 Dec 2009 16:22:01 +0000]
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>

9 years agoMerge remote branch 'nouveau/for-airlied' into drm-linus
Dave Airlie [Wed, 23 Dec 2009 00:28:24 +0000]
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.

9 years agodrm/kms: silencing a false positive warning.
Marin Mitov [Sun, 20 Dec 2009 07:03:27 +0000]
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>

9 years agodrm/mm: fix logic for selection of best fit block
Bob Gleitsmann [Mon, 21 Dec 2009 03:52:09 +0000]
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>

9 years agodrm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.
Thomas Hellstrom [Tue, 22 Dec 2009 15:53:41 +0000]
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>

9 years agodrm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.
Thomas Hellstrom [Tue, 8 Dec 2009 11:59:34 +0000]
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>

9 years agodrm/vmwgfx: Fix unlocked ioctl and add proper access control
Thomas Hellstrom [Tue, 8 Dec 2009 11:57:51 +0000]
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>

9 years agodrm/radeon: fix build on 64-bit with some compilers.
Dave Airlie [Sun, 20 Dec 2009 06:08:40 +0000]
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>

9 years agodrivers/gpu: Use kzalloc for allocating only one thing
Julia Lawall [Sat, 19 Dec 2009 07:16:33 +0000]
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>

9 years agoDRM: Rename clamp variable
Andi Kleen [Mon, 21 Dec 2009 01:24:47 +0000]
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>

9 years agodrm: convert drm_ioctl to unlocked_ioctl
Arnd Bergmann [Wed, 16 Dec 2009 22:17:09 +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>

9 years agoMerge branch 'drm-linus' into drm-core-next
Dave Airlie [Thu, 17 Dec 2009 23:56:49 +0000]
Merge branch 'drm-linus' into drm-core-next

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

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

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

9 years agodrm/nv50: fix suspend/resume delays without firmware present
Ben Skeggs [Wed, 16 Dec 2009 05:07:45 +0000]
drm/nv50: fix suspend/resume delays without firmware present

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

9 years agodrm/nouveau: prevent all channel creation if accel not available
Ben Skeggs [Wed, 16 Dec 2009 04:28:55 +0000]
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>

9 years agodrm/nv50: fix two potential suspend/resume oopses
Ben Skeggs [Wed, 16 Dec 2009 04:51:13 +0000]
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>

9 years agodrm/nv40: implement ctxprog/state generation
Ben Skeggs [Tue, 15 Dec 2009 12:02:47 +0000]
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>

9 years agodrm/nv10: Add the initial graph context and soft methods needed for LMA.
Francisco Jerez [Mon, 14 Dec 2009 14:00:30 +0000]
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>

9 years agodrm/nouveau: Fix up buffer eviction, and evict them to GART, if possible.
Francisco Jerez [Fri, 11 Dec 2009 17:40:17 +0000]
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>

9 years agodrm/nouveau: Add proper error handling to nouveau_card_init
Marcin Kościelnicki [Mon, 14 Dec 2009 20:58:39 +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>

9 years agodrm/nv04: Fix NV04 set_operation software method.
Marcin Kościelnicki [Mon, 14 Dec 2009 20:38:17 +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>

9 years agodrm/nouveau: Kill global state in BIOS script interpreter
Marcin Kościelnicki [Tue, 15 Dec 2009 00:37:31 +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>

9 years agodrm/nouveau: Kill global state in NvShadowBIOS
Marcin Kościelnicki [Tue, 15 Dec 2009 00:37:30 +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>

9 years agodrm/nouveau: use drm debug levels
Maarten Maathuis [Sun, 13 Dec 2009 15:53:12 +0000]
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>

9 years agodrm/i2c/ch7006: Fix load detection false positives right after system init.
Francisco Jerez [Tue, 15 Dec 2009 00:34:42 +0000]
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>

9 years agodrm/nv04-nv40: Fix "conflicting memory types" when saving/restoring VGA fonts.
Francisco Jerez [Fri, 11 Dec 2009 22:44:49 +0000]
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>

9 years agodrm/radeon/kms: fix r100->r500 CS checker for compressed textures. (v2)
Dave Airlie [Mon, 7 Dec 2009 03:16:06 +0000]
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>

9 years agodrm/radeon/kms: allow for texture tiling
Maciej Cencora [Tue, 15 Dec 2009 22:13:08 +0000]
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>

9 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Wed, 16 Dec 2009 05:58:36 +0000]
Merge remote branch 'korg/drm-radeon-next' into drm-linus

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

9 years agodrm/radeon/kms: init pm on all chipsets
Rafał Miłecki [Tue, 15 Dec 2009 20:46:58 +0000]
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>

9 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]
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

9 years agodrm/radeon/kms: HDMI support for R600 KMS
Christian Koenig [Sun, 11 Oct 2009 21:49:13 +0000]
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>

9 years agodrm/radeon/kms: make sure mc is initialized before mapping blit bo
Alex Deucher [Tue, 15 Dec 2009 22:15:07 +0000]
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>

9 years agodrm/radeon/kms: Return to userspace on ERESTARTSYS
Jerome Glisse [Tue, 15 Dec 2009 17:23:23 +0000]
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>

9 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]
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>

9 years agodrm/radeon/kms: don't report allocate failure on ERESTARTSYS
Dave Airlie [Tue, 15 Dec 2009 00:39:48 +0000]
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>

9 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]
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>

9 years agodrm/radeon/kms: If no placement is supplied fallback to system
Jerome Glisse [Fri, 11 Dec 2009 14:13:22 +0000]
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>

9 years agodrm/ttm: Fix memory type manager debug information printing
Jerome Glisse [Thu, 10 Dec 2009 17:07:26 +0000]
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>

9 years agodrm/ttm: Fix printk format & compute bo->mem.size at bo initialization
Jerome Glisse [Thu, 10 Dec 2009 15:15:52 +0000]
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>

9 years agodrm/ttm: Fix potential ttm_mem_evict_first races.
Thomas Hellstrom [Wed, 2 Dec 2009 17:33:46 +0000]
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>

9 years agodrm/ttm: Delayed delete fixes.
Thomas Hellstrom [Wed, 2 Dec 2009 17:33:45 +0000]
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>