Commit graph

399 commits

Author SHA1 Message Date
Dave Airlie 794f3141a1 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>
2009-12-23 10:04:02 +10:00
Julia Lawall e265f39e1f 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>
2009-12-23 10:04:02 +10:00
Andi Kleen 01136acff8 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>
2009-12-23 10:04:01 +10:00
Arnd Bergmann ed8b670409 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>
2009-12-18 11:22:31 +10:00
Dave Airlie d785d78bbd 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>
2009-12-16 16:10:45 +10:00
Maciej Cencora 6e7267721f 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>
2009-12-16 16:09:19 +10:00
Rafał Miłecki 6234077d6b 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>
2009-12-16 15:56:15 +10:00
Christian Koenig dafc3bd515 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>
2009-12-16 15:46:48 +10:00
Alex Deucher 7923c615b8 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>
2009-12-16 15:39:24 +10:00
Jerome Glisse f89551bfe9 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>
2009-12-16 15:39:24 +10:00
Dave Airlie 51f07b7ebc 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>
2009-12-16 15:38:56 +10:00
Dave Airlie ecabd32a62 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>
2009-12-16 15:38:55 +10:00
Jerome Glisse d03d858970 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>
2009-12-16 15:38:55 +10:00
Jerome Glisse 9fb03e6351 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>
2009-12-16 15:38:54 +10:00
Alex Deucher 9062fa6612 drm/radeon/kms/avivo: fix typo in new_pll module description
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-11 14:12:13 +10:00
Jerome Glisse 1fb107fc46 drm/radeon/kms: Convert radeon to new ttm_bo_init
Now bo init use placement structure like bo validation does.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-11 14:09:27 +10:00
Dave Airlie 4361e52ad0 drm/radeon/kms: fix warning about cur_placement being uninitialised.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10 15:59:32 +10:00
Dave Airlie 550e2d9270 drm/radeon/kms: restore surface registers on resume.
On resume on my rv530 laptop surface cntl was left disabled, so
wierd stuff would happen with rendering to a tiled front buffer.

This checks if the surface regs are assigned to bos and reprograms
the surface registers on resume using the same path that clears
them all on init.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10 15:25:45 +10:00
Alex Deucher 779720a320 drm/radeon/kms/r600/r700: fallback gracefully on ucode failure
Sent the wrong patch earlier.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10 15:19:16 +10:00
Jerome Glisse cf0fe4566d drm/radeon/kms: cleanup structure and module if initialization fails
This would allow us to properly unload others module like TTM if
initialization fails after we initiliazed TTM structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-12-10 15:09:07 +10:00
Jerome Glisse eaa5fd1a66 drm/radeon/kms: actualy set the eviction placements we choose
Stupid bug, somehow copying the eviction placements into the
result structure was missing.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-12-10 15:09:06 +10:00
Jerome Glisse 4a04a844ba drm/radeon/kms: Fix NULL ptr dereference
radeon_atombios_fini might be call while there is not valid
atombios structure allocated, thus test for a not null ptr
before trying to access this structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-12-10 15:09:06 +10:00
Alex Deucher b27b63750d drm/radeon/kms/avivo: add support for new pll selection algo
Supported on all AVIVO-based asics.
Can be disabled via the new_pll module parameter:
new_pll=0 - disable
new_pll=1 - enable
enabled by default

[airlied: fixed to use do_div]
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-12-10 15:09:05 +10:00
Alex Deucher 69b3b5e59b drm/radeon/kms/avivo: fix some bugs in the display bandwidth setup
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-12-10 15:09:05 +10:00
Dave Airlie 2e7b6f7fa6 drm/radeon/kms: fix return value from fence function.
We only want to return here for errors, the wait functions return
a positive timeout otherwise, which gets back to userspace and
causes X to crash here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10 15:09:04 +10:00
Thomas Hellstrom 5cc6fbab9d drm/radeon: Remove tests for -ERESTART from the TTM code.
Also sets affected TTM calls up to not wait interruptible, since
that would cause an in-kernel spin until the TTM call succeeds, since
the Radeon code does not return to user-space when a signal is received.

Modifies interruptible fence waits to return -ERESTARTSYS rather than
-EBUSY when interrupted by a signal, since that's the (yet undocumented)
semantics required by the TTM sync object hooks.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10 15:09:03 +10:00
Jerome Glisse 312ea8da04 drm/radeon/kms: Convert radeon to new TTM validation API (V2)
This convert radeon to use new TTM validation API, it doesn't
really take advantage of it beside in the eviction case.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10 15:09:02 +10:00
Dave Airlie cf2f05d30d drm/radeon/kms: fix avivo tiling regression since radeon object rework
The object rework moved the tiling flag setup around wrongly,
so tiling we getting setup then overwritten by fb format.

Fixes regression with drm-radeon-next on rv530 laptop tiling test.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10 15:09:00 +10:00
Alex Deucher d3f420d108 drm/radeon/kms: make sure i2c id matches
Entries in the i2c table aren't always ordered
by id.  This allows us to remove some quirks
that are no longer needed.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-09 13:31:10 +10:00
Alex Deucher 279b215ecb drm/radeon/kms: make sure ss id matches
entries in the ss table aren't always ordered
by id.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-09 13:31:07 +10:00
Alex Deucher 390d0bbe88 drm/radeon/kms: connector fixes
- Don't add dac load detection property to DVI-D
- Make sure i2c info is valid before adding DP aux chan bus
- Don't create scaling_mode_property twice
- fix typo that prevented coherent and load detection from working
- add coherent prop to DP (for dp->dvi adapters)

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-09 13:31:00 +10:00
Dave Airlie 7b0a9e8302 Merge remote branch 'korg/drm-radeon-dp' into drm-linus
This merges the radeon KMS DisplayPort and hotplug detect support.

Tested on RV635 DP card with a Dell 2408 monitor.

Conflicts:
	drivers/gpu/drm/drm_fb_helper.c
2009-12-08 14:29:15 +10:00
Dave Airlie 3f838fc50c Merge remote branch 'korg/drm-radeon-next' into drm-linus
This merges all the radeon changes that weren't reliant on core-next.
2009-12-08 14:06:12 +10:00
Dave Airlie 3ff99164f6 Merge remote branch 'anholt/drm-intel-next' into drm-linus
This merges the upstream Intel tree and fixes up numerous conflicts
due to patches merged into Linus tree later in -rc cycle.

Conflicts:
	drivers/char/agp/intel-agp.c
	drivers/gpu/drm/drm_dp_i2c_helper.c
	drivers/gpu/drm/i915/i915_irq.c
	drivers/gpu/drm/i915/i915_suspend.c
2009-12-08 14:03:47 +10:00
Alex Deucher d4877cf229 drm/radeon/kms: enable hpd support
This enabled interrupt driven hpd support for all
radeon chips.  Assuming the hpd pin is wired up
correctly, the driver will generate uevents on
digital monitor connect and disconnect and retrain
DP monitors automatically.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:48:22 +10:00
Alex Deucher 429770b3e3 drm/radeon/kms: add asic callbacks for hpd
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:48:12 +10:00
Alex Deucher e0df1ac5c2 drm/radeon/kms: add hpd support for r6xx/r7xx/rs780/rs880 asics
This just adds the functionality, it's not hooked up
yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:48:07 +10:00
Alex Deucher dcfdd40835 drm/radeon/kms: add hpd support for r5xx/rs600/rs690/rs740 asics
This just adds the functionality, it's not hooked up
yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:47:58 +10:00
Alex Deucher 05a05c506f drm/radeon/kms: add hpd support for r1xx-r4xx asics
This just adds the functionality, it's not hooked up
yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:46:38 +10:00
Alex Deucher b500f68045 drm/radeon/kms: add regs and irq tracking bits for hpd
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:46:34 +10:00
Alex Deucher eed45b30cd drm/radeon/kms: get HPD info for connectors
This populates the connectors with HPD (Hot Plug Detect)
information.  This will be used in subsequent patches
for automatic digital monitor connect/disconnect handling.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:46:28 +10:00
Alex Deucher 53c1e09fea drm/radeon/kms: clean up DP debugging
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:49 +10:00
Alex Deucher 9fa05c98d6 drm/radeon/kms: fix DP detect
only return connected if there is actually a
monitor connected.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:48 +10:00
Dave Airlie e8696330e2 drm/radeon/kms: drop unused array to fix warning.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:48 +10:00
Dave Airlie 58682f107a drm/radeon/kms: do dp link training at dpms on time not mode set.
This moves the radeon DP link training call to happen when we
dpms on the encoder not when we set the mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:47 +10:00
Dave Airlie 5fbfce7fc9 drm/radeon/kms: make displayport work by reorganising vsemph setup.
This fix reorganises the initial DP link training slightly, and
actually makes DP work under kms here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:46 +10:00
Dave Airlie 54d9cb47dd drm/radeon/kms/dp: fix return in dpcd retrival.
Not returning here caused us to get a display port version of 0 for everything
this caused power up to not get sent which ends up in a black screen.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:45 +10:00
Alex Deucher ffd09c648a drm/radeon/kms: free aux channel i2c adapter on destroy
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:44 +10:00
Alex Deucher 5801ead6bd drm/radeon/kms: add support for DP modesetting
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:44 +10:00
Alex Deucher f92a8b6758 drm/radeon/kms: handle dp sinks in atom encoder/transmitter tables
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08 10:22:43 +10:00