9 years agodrm/radeon/kms: R600/RV770 remove dead code and print message for wrong BIOS
Jerome Glisse [Thu, 1 Oct 2009 16:02:15 +0000]
drm/radeon/kms: R600/RV770 remove dead code and print message for wrong BIOS

R600 & RV770 family are all using atombios so remove dead code and
print an error message if we fail to find a valid atombios.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Fix R600/RV770 disable acceleration path
Jerome Glisse [Thu, 1 Oct 2009 16:02:14 +0000]
drm/radeon/kms: Fix R600/RV770 disable acceleration path

When acceleration doesn't work we should free associated memory
and stop GPU block responsible for hardware acceleration so we
don't waste resource or let think one component of the driver that
a GPU feature is working/running while it doesn't actualy work.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Fix R600/RV770 startup path & reset
Jerome Glisse [Thu, 1 Oct 2009 16:02:13 +0000]
drm/radeon/kms: Fix R600/RV770 startup path & reset

We were calling reset unconditionaly in the startup path
this is bad we need to call GPU reset for a good reason
as after reset the GPU is in unknown states. To avoid any
more bad things to happen we now also unconditionaly
reinitialize the GPU after reset. This patch fix few issues
reported by different people regarding KMS & R6XX/RV7XX hw.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Fix R600 write back buffer
Jerome Glisse [Thu, 1 Oct 2009 16:02:12 +0000]
drm/radeon/kms: Fix R600 write back buffer

This split write back buffer handling into 3 functions,
wb_fini for cleanup, wb_enable/wb_disable for enabling/disabling
write back used for suspend/resume. This should fix
potential issue of letting the write back active before
suspending. We need to allocate memory in wb_enable because
we can only allocate once GART is running.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Remove old init path as no hw use it anymore
Jerome Glisse [Thu, 1 Oct 2009 16:02:11 +0000]
drm/radeon/kms: Remove old init path as no hw use it anymore

This remove old init path and allow code cleanup, now all hw
use the new init path, see top of radeon.h for description of
this.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Convert RS600 to new init path
Jerome Glisse [Wed, 30 Sep 2009 20:09:06 +0000]
drm/radeon/kms: Convert RS600 to new init path

New init path allow to simply asic initialization and make easier
to trace what happen on each different asic. We are removing most
callback. Do a massive RS600 register cleanup to clarify RS600
register, we are still bit fuzy on some register and waiting for
more informations. I don't have hw to test, so this patch is a
best effort to not break anythings and to try to improve things.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Convert RS690/RS740 to new init path (V2).
Jerome Glisse [Thu, 1 Oct 2009 07:39:24 +0000]
drm/radeon/kms: Convert RS690/RS740 to new init path (V2).

Also cleanup register specific to RS690/RS740. Version 2 add
missing header file for register, remove unecessary call to AGP
function and fix an indentation bug.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Convert R100 to new init path (V2)
Jerome Glisse [Thu, 1 Oct 2009 08:12:06 +0000]
drm/radeon/kms: Convert R100 to new init path (V2)

New init path allow to simply asic initialization and make easier
to trace what happen on each different asic. We are removing most
callback. More cleanup should happen latter to remove even more
callback. Also cleanup register specific to R100,RV200,RV250.
Version 2 correct the placement on IGP of the VRAM inside GPU address
space to match the stollen RAM placement of IGP.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Convert R300 to new init path
Jerome Glisse [Wed, 30 Sep 2009 13:35:32 +0000]
drm/radeon/kms: Convert R300 to new init path

Also cleanup register specific to R300.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Convert RS400/RS480 to new init path & fix legacy VGA (V3)
Jerome Glisse [Thu, 1 Oct 2009 08:20:52 +0000]
drm/radeon/kms: Convert RS400/RS480 to new init path & fix legacy VGA (V3)

Also cleanup register specific to RS400/RS480. This patch also fix
legacy VGA register used to disable VGA access we were programming
wrong register. Now we should properly disable VGA on r100 up to
rs400 asics. Note that RS400/RS480 resume is broken, it hangs the
computer while reprogramming dynamic clock, doesn't work either
without that patch. We need to spend more time investigating this
issue. Version 2 of the patch remove dead code that was left
commented out in the previous version. Version 3 correct the
placement on IGP of the VRAM inside GPU address space to match the
stollen RAM placement of IGP.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Convert R520 to new init path and associated cleanup
Jerome Glisse [Mon, 28 Sep 2009 18:39:19 +0000]
drm/radeon/kms: Convert R520 to new init path and associated cleanup

Convert the r520 asic support to new init path, change are smaller than
previous one as most of the architecture is now in place and more code
sharing can happen btw various asics.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms: Convert RV515 to new init path and associated cleanup
Jerome Glisse [Mon, 28 Sep 2009 16:34:43 +0000]
drm/radeon/kms: Convert RV515 to new init path and associated cleanup

Convert the rv515 asic support to new init path also add an explanation
in radeon.h about the new init path. There is also few cleanups
associated with this change (others asic calling rv515 helper
functions).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm: fix radeon DRM warnings when !CONFIG_DEBUG_FS
Mikael Pettersson [Mon, 28 Sep 2009 16:27:23 +0000]
drm: fix radeon DRM warnings when !CONFIG_DEBUG_FS

Compiling the radeon DRM driver with !CONFIG_DEBUG_FS
throws the following warnings:

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

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

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm: fix drm_fb_helper warning when !CONFIG_MAGIC_SYSRQ
Mikael Pettersson [Mon, 28 Sep 2009 16:26:25 +0000]
drm: fix drm_fb_helper warning when !CONFIG_MAGIC_SYSRQ

Compiling DRM throws the following warning if MAGIC_SYSRQ is disabled:

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

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

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/r600: fix memory leak introduced with 64k malloc avoidance fix.
Dave Airlie [Mon, 28 Sep 2009 05:37:25 +0000]
drm/r600: fix memory leak introduced with 64k malloc avoidance fix.

The legacy r600 path shares code, but doesn't share quite enough
to get the freeing correct. Free the pages here also.

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

9 years agodrm/kms: make fb helper work for all drivers.
Dave Airlie [Mon, 28 Sep 2009 05:31:10 +0000]
drm/kms: make fb helper work for all drivers.

This initialises the fb helper with the connector helper,
so that the fb cmdline code works for intel as well.

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

9 years agodrm/radeon/r600: fix offset handling in CS parser
Alex Deucher [Fri, 25 Sep 2009 22:33:08 +0000]
drm/radeon/r600: fix offset handling in CS parser

Need add reloc offset to the offset in the actual
packet.  Fixes use of the DRAW_INDEX packet by the 3D
driver.

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

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms/r600: fix forcing pci mode on agp cards
Alex Deucher [Fri, 25 Sep 2009 21:32:14 +0000]
drm/radeon/kms/r600: fix forcing pci mode on agp cards

All we need to do on r6xx/r7xx is clear the RADEON_IS_AGP
flag; the rest is handled in r600.c

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

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms: fix for the extra pages copying.
Dave Airlie [Fri, 25 Sep 2009 23:03:39 +0000]
drm/radeon/kms: fix for the extra pages copying.

Thanks to Michel for pointing this out to me, this is
why I need to get more sleep, over complicate this a bit.

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

9 years agodrm/radeon/kms/r600: add support for vline relocs
Alex Deucher [Fri, 25 Sep 2009 20:35:11 +0000]
drm/radeon/kms/r600: add support for vline relocs

Provides support for anti-tearing functionality
in the ddx.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms: fix some bugs in vline reloc
Alex Deucher [Fri, 25 Sep 2009 20:39:24 +0000]
drm/radeon/kms: fix some bugs in vline reloc

- fix offset of NOP packet for parsing
- fix p->idx increments
- fix bad mask when updating crtc vline info

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms/r600: clamp vram to aperture size
Alex Deucher [Fri, 25 Sep 2009 14:06:39 +0000]
drm/radeon/kms/r600: clamp vram to aperture size

r6xx and r7xx was missing this.  We don't support
non-CPU accessible vram yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/kms: protect against fb helper not being created.
Dave Airlie [Fri, 25 Sep 2009 20:39:00 +0000]
drm/kms: protect against fb helper not being created.

If drivers don't init the fb helper on the connector, the cmdline
code won't work, but it shouldn't crash either.

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

9 years agodrm/r600: get values from the passed in IB not the copy.
Dave Airlie [Fri, 25 Sep 2009 04:23:47 +0000]
drm/r600: get values from the passed in IB not the copy.

this avoids reading back the IB on AGP, also it avoids
the race where since we haven't fetched the page from the main IB
and written it to the gpu one, reading back fetches 0.

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

9 years agodrm: create gitignore file for radeon
Amerigo Wang [Wed, 23 Sep 2009 08:24:05 +0000]
drm: create gitignore file for radeon

Got lots of untracked files after compiling.
These files are generated, thus should be ignored by git.

Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: remove unneeded master create/destroy functions.
Dave Airlie [Wed, 23 Sep 2009 05:49:20 +0000]
drm/radeon/kms: remove unneeded master create/destroy functions.

We shouldn't need these at all in radeon kms mode.

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

9 years agodrm/kms: start adding command line interface using fb.
Dave Airlie [Wed, 23 Sep 2009 04:44:08 +0000]
drm/kms: start adding command line interface using fb.

[note this requires an fb patch posted to linux-fbdev-devel already]

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

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

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

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

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

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

9 years agofb: change rules for global rules match.
Dave Airlie [Wed, 16 Sep 2009 10:45:09 +0000]
fb: change rules for global rules match.

Having a : should be enough 'fb:' isn't really useful
if the fb wants to a kms output ID.

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

9 years agodrm/radeon/kms: don't require up to 64k allocations. (v2)
Dave Airlie [Wed, 23 Sep 2009 06:56:27 +0000]
drm/radeon/kms: don't require up to 64k allocations. (v2)

This avoids needing to do a kmalloc > PAGE_SIZE for the main
indirect buffer chunk, it adds an accessor for all reads from
the chunk and caches a single page at a time for subsequent
reads.

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

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

9 years agodrm/radeon/kms: enable dac load detection by default.
Dave Airlie [Fri, 25 Sep 2009 01:56:50 +0000]
drm/radeon/kms: enable dac load detection by default.

when I added the property I forgot to enable it.

Thanks to soreau on #radeon for tracking it down.

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

9 years agodrm/radeon/kms: enable r600 tv outputs.
Dave Airlie [Thu, 24 Sep 2009 22:56:12 +0000]
drm/radeon/kms: enable r600 tv outputs.

I never changed this back when I wrote tv-out support.

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

9 years agodrm/edid: Fix standard timing parse for EDID <= 1.2
Adam Jackson [Wed, 23 Sep 2009 21:31:21 +0000]
drm/edid: Fix standard timing parse for EDID <= 1.2

Aspect ratio code of 0 means 1:1 before EDID 1.3.

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

9 years agodrm/edid: Detailed standard timing blocks have six timings, not five.
Adam Jackson [Wed, 23 Sep 2009 21:31:09 +0000]
drm/edid: Detailed standard timing blocks have six timings, not five.

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

9 years agodrm/edid: Ignore bad standard timings.
Adam Jackson [Wed, 23 Sep 2009 21:30:58 +0000]
drm/edid: Ignore bad standard timings.

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

9 years agodrm/edid: const cleanup
Adam Jackson [Wed, 23 Sep 2009 21:30:45 +0000]
drm/edid: const cleanup

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

9 years agodrm/radeon/r600: set correct pitch for 4 byte copy
Andre Maasikas [Mon, 21 Sep 2009 12:59:41 +0000]
drm/radeon/r600: set correct pitch for 4 byte copy

[agd5f: also fix the non-kms path]

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>

9 years agodrm/radeon: consolidate family flags used in pciids.
Dave Airlie [Mon, 21 Sep 2009 22:50:10 +0000]
drm/radeon: consolidate family flags used in pciids.

having these separate was pointless and introduced a bug when
one got updated without the other.

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

9 years agodrm/radeon: some r420s have a CP race with the DMA engine.
Alex Deucher [Mon, 21 Sep 2009 04:48:45 +0000]
drm/radeon: some r420s have a CP race with the DMA engine.

This patch makes sure the CP doesn't DMA do VRAM while 2D
is active by inserting a CP resync token.

todo: port to kms.

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

9 years agodrm/radeon/r600/kms: rv670 is not DCE3
Alex Deucher [Fri, 18 Sep 2009 15:30:30 +0000]
drm/radeon/r600/kms: rv670 is not DCE3

RV670 was using the wrong modesetting code.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: r420 idle after programming GA_ENHANCE
Dave Airlie [Mon, 21 Sep 2009 04:15:10 +0000]
drm/radeon/kms: r420 idle after programming GA_ENHANCE

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

The idle allows rs690 to startup properly.

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

9 years agodrm/radeon/kms: more fixes to rv770 suspend/resume path.
Dave Airlie [Mon, 21 Sep 2009 04:06:30 +0000]
drm/radeon/kms: more fixes to rv770 suspend/resume path.

This resumes my
RV730PRO (4650)
RV770 (4850)
fine.

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

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

9 years agodrm/radeon/kms: more alignment for rv770.c with r600.c
Dave Airlie [Fri, 18 Sep 2009 08:41:24 +0000]
drm/radeon/kms: more alignment for rv770.c with r600.c

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

9 years agodrm/radeon/kms: rv770 blit init called too late.
Dave Airlie [Fri, 18 Sep 2009 08:33:07 +0000]
drm/radeon/kms: rv770 blit init called too late.

re-align with r600 code, to init blit earlier.

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

9 years agodrm/radeon/kms: move around new init path code to avoid posting at init
Dave Airlie [Fri, 18 Sep 2009 05:19:37 +0000]
drm/radeon/kms: move around new init path code to avoid posting at init

We really don't want to post the card at init, it takes a relatively
long time and isn't required, so split the resume path into
a startup path called by both init/resume and separate resume
entry point to do posting.

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

9 years agodrm/radeon/r600: fix some issues with suspend/resume.
Dave Airlie [Tue, 15 Sep 2009 01:07:52 +0000]
drm/radeon/r600: fix some issues with suspend/resume.

a) don't zero gart table on gart enable
b) move pinning shader object into resume path
c) unpin shader object on suspend
d) set cp ready to false after cp shutdown on suspend.

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

9 years agodrm/radeon/kms: disable VGA rendering engine before taking over VRAM
Dave Airlie [Fri, 18 Sep 2009 04:16:38 +0000]
drm/radeon/kms: disable VGA rendering engine before taking over VRAM

Before we use any of VRAM, we need to disable the VGA rendering
engine, this render text mode into a graphical framebuffer
for scanout, however it does this on vblank, and can end up
overwriting the GART table and r600 shader objects.

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

9 years agodrm/radeon/kms: Move radeon_get_clock_info() call out of radeon_clocks_init().
Michel Dänzer [Thu, 17 Sep 2009 07:42:28 +0000]
drm/radeon/kms: Move radeon_get_clock_info() call out of radeon_clocks_init().

Someone on IRC reported problems after commit
95a8f1bf4f48b434c9f839ab5a0773f66b39d7c6 ('drm/radeon/kms: Move
radeon_clocks_init() call back after getting VRAM info.'). And indeed, at least
some ASIC vram_info hooks use the clock info obtained by
radeon_get_clock_info(). So, move that call out of radeon_clocks_init(), ahead
of the radeon_vram_info() call.

[airlied - fixup missing r600/rv770 calls]

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

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

These were missed when it got split out.

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

9 years agodrm/radeon/kms: add initial connector properties
Dave Airlie [Wed, 9 Sep 2009 07:40:54 +0000]
drm/radeon/kms: add initial connector properties

This adds:
coherent mode: TMDS coherent mode for atom cards.
scaling mode: LVDS scaler mode
load detect: DAC load detection, DVI-I, VGA, TV
tmds pll: legacy TMDS pll selection
tv standard: TV standard selection.

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

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

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

9 years agodrm/radeon/kms: Use surfaces for scanout / cursor byte swapping on big endian.
Michel Dänzer [Tue, 15 Sep 2009 15:09:30 +0000]
drm/radeon/kms: Use surfaces for scanout / cursor byte swapping on big endian.

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

9 years agodrm/radeon/kms: don't fail if we fail to init GPU acceleration
Jerome Glisse [Wed, 16 Sep 2009 13:24:21 +0000]
drm/radeon/kms: don't fail if we fail to init GPU acceleration

Userspace can query if acceleration is working or not true get
info ioctl and could fallback to software if for some reason
kernel failed to initialize KMS. This should allow to give a
working KMS setup in all case (even with non functionning accel).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/r600/kms: fixup number of loops per blit calculation.
Dave Airlie [Thu, 17 Sep 2009 06:11:31 +0000]
drm/r600/kms: fixup number of loops per blit calculation.

Some people were seeing
*ERROR* radeon: writting more dword to ring than expected
after certain blits, the loops calculation didn't take
into account that we do a separate blit for the remainder
after doing the aligned blits.

Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: reprogram format in set base.
Dave Airlie [Wed, 16 Sep 2009 00:15:21 +0000]
drm/radeon/kms: reprogram format in set base.

This should in theory fix the problem with a mode set being required
for adjusting the color depth.

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

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

9 years agodrm/radeon: avivo chips have no separate int bit for display
Dave Airlie [Fri, 18 Sep 2009 04:31:48 +0000]
drm/radeon: avivo chips have no separate int bit for display

display interrupts are not enabled via this register, the
DISPLAY_INT bit is a status only to show that other regs
need to be read.

Noticed by Alex Deucher

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

9 years agodrm/radeon/r600: don't do interrupts
Alex Deucher [Thu, 17 Sep 2009 18:25:12 +0000]
drm/radeon/r600: don't do interrupts

Interrupts are not supported yet.  This prevents
things like mesa from trying to use them.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm: fix _DRM_GEM addmap error message
Pekka Paalanen [Thu, 17 Sep 2009 19:59:54 +0000]
drm: fix _DRM_GEM addmap error message

Fix the error message: this is add, not rm.
Move the closing brace to proper spot: _DRM_GEM branch should not be
included in the block.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm: update crtc x/y when only fb changes
Ben Skeggs [Fri, 18 Sep 2009 00:43:52 +0000]
drm: update crtc x/y when only fb changes

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

9 years agodrm: fix drm_fb_helper handling of kernel crtcs
Jesse Barnes [Fri, 18 Sep 2009 01:14:41 +0000]
drm: fix drm_fb_helper handling of kernel crtcs

The drm_fb_helper shouldn't mess with CRTCs that aren't enabled or in
its initial config. Ideally it shouldn't even include CRTCs in its
initial config if they're not in use, but my old fix for that no longer
works.  At any rate, this fixes a real bug I was seeing where after a
console blank, both pipes would come back on, even though only one had
been enabled before that.  Since the other pipe had a bogus config,
this led to some screen corruption.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Get LVDS native mode details from EDID if necessary.
Michel Dänzer [Tue, 15 Sep 2009 15:09:27 +0000]
drm/radeon/kms: Get LVDS native mode details from EDID if necessary.

Fixes RMX problems on older Apple laptops which don't have an x86 BIOS ROM.

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

9 years agodrm/radeon: Save and restore bios scratch regs during S/R
Yang Zhao [Tue, 15 Sep 2009 02:21:01 +0000]
drm/radeon: Save and restore bios scratch regs during S/R

[airlied:- adapted slightly in naming]

Signed-off-by: Yang Zhao <yang@yangman.ca>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: IB locking dumps out a lockdep ordering issue
Dave Airlie [Tue, 15 Sep 2009 01:12:56 +0000]
drm/radeon/kms: IB locking dumps out a lockdep ordering issue

We sometimes lock IB then the ring and sometimes the ring then
the IB. This is mostly due to the IB locking not being well defined
about what data in the structs it actually locks. Define what I
believe is the correct behaviour and gets rid of the lock dep ordering
warning.

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

9 years agodrm/radeon/kms: we should return 0 when we have no modes not -1.
Dave Airlie [Tue, 15 Sep 2009 10:21:11 +0000]
drm/radeon/kms: we should return 0 when we have no modes not -1.

This fixes my monitor with broken EDID so it at least get 800x600.

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

9 years agodrm/radeon/kms: Free CS parser state tracking memory.
Michel Dänzer [Tue, 15 Sep 2009 15:09:32 +0000]
drm/radeon/kms: Free CS parser state tracking memory.

Fixes leak hidden in commit 9f022ddfb23793b475ff7e57ac08a766dd5d31bd
('drm/radeon/kms: convert r4xx to new init path').

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

9 years agodrm/radeon/kms: Don't kzalloc memory which is immediately overwritten.
Michel Dänzer [Tue, 15 Sep 2009 15:09:33 +0000]
drm/radeon/kms: Don't kzalloc memory which is immediately overwritten.

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

9 years agodrm/radeon/kms: Move radeon_clocks_init() call back after getting VRAM info.
Michel Dänzer [Tue, 15 Sep 2009 15:09:26 +0000]
drm/radeon/kms: Move radeon_clocks_init() call back after getting VRAM info.

It may indirectly call radeon_set_clock_gating() which relies on the VRAM info.

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

9 years agodrm/radeon/kms: Only add common modes which fit in both panel dimensions.
Michel Dänzer [Tue, 15 Sep 2009 15:09:28 +0000]
drm/radeon/kms: Only add common modes which fit in both panel dimensions.

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

9 years agodrm/radeon/kms: add 32/64 ioctl support.
Dave Airlie [Mon, 14 Sep 2009 23:03:43 +0000]
drm/radeon/kms: add 32/64 ioctl support.

Although the new radeon driver ioctls don't need this, some of
the drm initialisation ioctls require it, so add this to make them
work.

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

9 years agodrm/radeon/kms: clear confusion in GART init/deinit path
Jerome Glisse [Mon, 14 Sep 2009 16:29:49 +0000]
drm/radeon/kms: clear confusion in GART init/deinit path

GART static one time initialization was mixed up with GART
enabling/disabling which could happen several time for instance
during suspend/resume cycles. This patch splits all GART
handling into 4 differents function. gart_init is for one
time initialization, gart_deinit is called upon module unload
to free resources allocated by gart_init, gart_enable enable
the GART and is intented to be call after first initialization
and at each resume cycle or reset cycle. Finaly gart_disable
stop the GART and is intended to be call at suspend time or
when unloading the module.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: cleanup - remove radeon_share.h
Jerome Glisse [Fri, 11 Sep 2009 13:55:33 +0000]
drm/radeon/kms: cleanup - remove radeon_share.h

radeon_share.h was begining to give problem with include order in
respect of radeon.h. It's easier and also i think cleaner to move
what was in radeon_share.h into radeon.h. At the same time use the
extern keyword for function shared accross the module.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: move mtrr range add and memory information
Jerome Glisse [Fri, 11 Sep 2009 11:00:43 +0000]
drm/radeon/kms: move mtrr range add and memory information

Move mtrr range and memory information printing to radeon_object_init,
this are memory information and initialization common to all GPU and
they better fit in this function. Will also prevent code duplication
with upcoming init path changes.

airlied: fixed warning introduced

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: convert r4xx to new init path
Jerome Glisse [Fri, 11 Sep 2009 13:35:22 +0000]
drm/radeon/kms: convert r4xx to new init path

This convert r4xx to new init path it also fix few bugs.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: fix typo in quirks
Alex Deucher [Fri, 11 Sep 2009 19:27:14 +0000]
drm/radeon/kms: fix typo in quirks

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms/r600: fix blit dword count for non r6xx
Alex Deucher [Fri, 11 Sep 2009 16:02:03 +0000]
drm/radeon/kms/r600: fix blit dword count for non r6xx

rv6xx emits two extra dwords in the render target setup.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms: add common lvds modes in the ddc case
Alex Deucher [Fri, 11 Sep 2009 15:15:43 +0000]
drm/radeon/kms: add common lvds modes in the ddc case

previous patch only handled the non-ddc case.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agodrm/radeon/kms: set fbdev_info for suspend/resume
Dave Airlie [Fri, 11 Sep 2009 08:35:38 +0000]
drm/radeon/kms: set fbdev_info for suspend/resume

this hopefully will bring back suspend/resume under kms.

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

9 years agodrm/radeon/kms: move modeset init outside of GPU init
Jerome Glisse [Thu, 10 Sep 2009 19:46:48 +0000]
drm/radeon/kms: move modeset init outside of GPU init

We are splitting GPU & modeset init so that it's easier
to abord only remaining GPU init when somethings fails.
We want to always provide enough funcionalities to get
fbcon and a shadowfb X working. Only acceptable error
during initialization are memory allocation failure or
io mapping failure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: add common scaled modes for TV and LVDS
Alex Deucher [Thu, 10 Sep 2009 21:53:39 +0000]
drm/radeon/kms: add common scaled modes for TV and LVDS

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: pull in latest quirks and fixes from ddx
Alex Deucher [Thu, 10 Sep 2009 20:31:13 +0000]
drm/radeon/kms: pull in latest quirks and fixes from ddx

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms/r600: use blit for BO moves
Alex Deucher [Thu, 10 Sep 2009 19:54:35 +0000]
drm/radeon/kms/r600: use blit for BO moves

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: R3XX/R4XX AGP asic use PCI GART not PCIE GART
Jerome Glisse [Thu, 10 Sep 2009 11:47:09 +0000]
drm/radeon/kms: R3XX/R4XX AGP asic use PCI GART not PCIE GART

R3XX/R4XX AGP asic use the old PCI GART block, not the new PCIE GART.
Make sure we pick the right GART when disabling AGP.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms/r600: fix blit support
Alex Deucher [Thu, 10 Sep 2009 06:53:50 +0000]
drm/radeon/kms/r600: fix blit support

select the correct max number of bytes per blit based
on whether the size is multiple of 4 bytes.  This
determines whether we can use 8 or 32 bit pixels for
the blit.

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

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: Don't try to process irq when we are unloading
Jerome Glisse [Wed, 9 Sep 2009 20:23:07 +0000]
drm/radeon/kms: Don't try to process irq when we are unloading

If module is being unloaded we should not try to handle irq especialy
we should not call into drm helper or we could hard hang the computer
free_irq will call the irq handler to make sure we behave properly.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: add R4XX mc register access helper.
Jerome Glisse [Wed, 9 Sep 2009 20:24:20 +0000]
drm/radeon/kms: add R4XX mc register access helper.

Atombios will use the mc register access helper and R4XX hw have a
bigger mc range than R3XX so add R4XX specific mc register access
helper.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: call r100_cp_disable rather than duplicating code.
Jerome Glisse [Wed, 9 Sep 2009 20:23:27 +0000]
drm/radeon/kms: call r100_cp_disable rather than duplicating code.

r100_cp_fini was duplicating code of r100_cp_disable, call r100_cp_disable
instead.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: wait for cp idle before stopping it.
Jerome Glisse [Wed, 9 Sep 2009 20:23:45 +0000]
drm/radeon/kms: wait for cp idle before stopping it.

If we stop CP and that it's still processing thing GPU hang might
happen, this patch wait for CP idle (the wait can timeout) so we
can avoid shutting down CP at bad time. This is especialy usefull
when reseting the GPU as it seems GPU reset fails to properly reset
CP when the CP wasn't stop after being idle.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/r600: fix legacy blit code
Alex Deucher [Wed, 9 Sep 2009 20:09:36 +0000]
drm/radeon/r600: fix legacy blit code

ARRAY_SIZE is number of elements not bytes.  Fix
ring counts accordingly, also make a few functions
static.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/r600: use fence->timeout directly
Alex Deucher [Tue, 8 Sep 2009 18:45:05 +0000]
drm/radeon/r600: use fence->timeout directly

Fixes fence timeouts on r6xx/r7xx.  Noticed by
taiu on IRC.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>

9 years agodrm/radeon/kms: re-apply 2007d633d639c896396e4c4b53b38068f3831307
Alex Deucher [Tue, 8 Sep 2009 18:22:45 +0000]
drm/radeon/kms: re-apply 2007d633d639c896396e4c4b53b38068f3831307

Got accidently reverted by c93bb85b5cba3e3a06f2cad8e9bc5c23d3d10aac

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>

9 years agoMerge remote branch 'origin/master' of ../linux-2.6 into drm-next
Dave Airlie [Tue, 8 Sep 2009 04:49:32 +0000]
Merge remote branch 'origin/master' of ../linux-2.6 into drm-next

This was a non-trivial merge with some patches sent to Linus
in drm-fixes.

Conflicts:
drivers/gpu/drm/radeon/r300.c
drivers/gpu/drm/radeon/radeon_asic.h
drivers/gpu/drm/radeon/rs600.c
drivers/gpu/drm/radeon/rs690.c
drivers/gpu/drm/radeon/rv515.c

9 years agodrm/radeon/kms: don't allow ERESTART to hit userspace.
Dave Airlie [Tue, 8 Sep 2009 04:38:45 +0000]
drm/radeon/kms: don't allow ERESTART to hit userspace.

the pre-r600 fence code returns ebusy if we get hit by a signal
so we should continue to do that.

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

9 years agodrm: prune modes when output is disconnected.
Adam Jackson [Tue, 8 Sep 2009 01:51:46 +0000]
drm: prune modes when output is disconnected.

When an output was disconnected, its mode list would remain.  If you later
plugged into a sink with no EDID (projector, etc), you'd inherit the mode
list from the old sink, which is not what you want.

taken from Fedora kernel

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

9 years agodrm: shut the EDID warnings up.
Adam Jackson [Tue, 8 Sep 2009 01:48:40 +0000]
drm: shut the EDID warnings up.

These really aren't all that useful.

taken from Fedora kernel.

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

9 years agodrm/i915: get the bridge device once.
Dave Airlie [Tue, 4 Aug 2009 01:43:41 +0000]
drm/i915: get the bridge device once.

The driver gets the bridge device in a number of places, upcoming
vga arb code paths need the bridge device, however they need it in
under a lock, and the pci lookup can allocate memory. So clean
this code up before then and get the bridge once for the driver lifetime.

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

9 years agodrm: include seq_file.h for debugfs builds.
Dave Airlie [Tue, 8 Sep 2009 01:32:08 +0000]
drm: include seq_file.h for debugfs builds.

Fixes a warning seen on powerpc.

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

9 years agodrm/radeon/kms: lower debugging on dpms events.
Dave Airlie [Tue, 8 Sep 2009 01:17:38 +0000]
drm/radeon/kms: lower debugging on dpms events.

Lower the debugging on encoders when getting DPMS events.

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

9 years agodrm/kms/radeon: make kms default a runtime option
Dave Airlie [Tue, 8 Sep 2009 01:09:50 +0000]
drm/kms/radeon: make kms default a runtime option

This makes the kms/enable disable a runtime not a build time
option.

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

9 years agodrm/kms: fix kms helper license + Kconfig
Dave Airlie [Tue, 8 Sep 2009 01:08:32 +0000]
drm/kms: fix kms helper license + Kconfig

Allow the KMS module to work properly, and also rename
it to KMS_HELPER so its clearer what its for.

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

9 years agodrm/radeon/kms: add r600 KMS support
Jerome Glisse [Tue, 8 Sep 2009 00:10:24 +0000]
drm/radeon/kms: add r600 KMS support

This adds the r600 KMS + CS support to the Linux kernel.

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

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

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

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

9 years agodrm/radeon/kms: add initial radeon tv-out support.
Dave Airlie [Thu, 13 Aug 2009 06:32:14 +0000]
drm/radeon/kms: add initial radeon tv-out support.

This ports the tv-out code from the DDX to KMS.

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

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

9 years agodrm/radeon/kms: add rn50/r100/r200 CS tracker.
Dave Airlie [Tue, 1 Sep 2009 05:25:57 +0000]
drm/radeon/kms: add rn50/r100/r200 CS tracker.

This adds the command stream checker for the RN50, R100 and R200 cards.

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

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

9 years agoMerge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Mon, 7 Sep 2009 18:42:25 +0000]
Merge branch 'drm-fixes' of git://git./linux/kernel/git/airlied/drm-2.6

* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/radeon/kms: add LTE/GTE discard + rv515 two sided stencil register.