GitHub/LineageOS/android_kernel_motorola_exynos9610.git
14 years agodrm/radeon: Fix stack data leak
Jean Delvare [Sun, 15 Aug 2010 12:11:24 +0000 (14:11 +0200)]
drm/radeon: Fix stack data leak

Always zero-init a structure on the stack which is returned by a
function. Otherwise you may leak random stack data from previous
function calls.

This fixes the following warning I was seeing:
  CC [M]  drivers/gpu/drm/radeon/radeon_atombios.o
drivers/gpu/drm/radeon/radeon_atombios.c: In function "radeon_atom_get_hpd_info_from_gpio":
drivers/gpu/drm/radeon/radeon_atombios.c:261: warning: "hpd.plugged_state" is used uninitialized in this function

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fix GTT/VRAM overlapping test
Jerome Glisse [Mon, 16 Aug 2010 15:54:36 +0000 (11:54 -0400)]
drm/radeon/kms: fix GTT/VRAM overlapping test

GTT/VRAM overlapping test had a typo which leaded to not
detecting case when vram_end > gtt_end. This patch fix the
logic and should fix #16574

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: block userspace under allocating buffer and having drivers overwrite it (v2)
Dave Airlie [Sat, 14 Aug 2010 10:20:34 +0000 (20:20 +1000)]
drm: block userspace under allocating buffer and having drivers overwrite it (v2)

With the current screwed but its ABI, ioctls for the drm, Linus pointed out that we could allow userspace to specify the allocation size, but we pass it to the driver which then uses it blindly to store a struct. Now if userspace specifies the allocation size as smaller than the driver needs, the driver can possibly overwrite memory.

This patch restructures the driver ioctls so we store the structure size we are expecting, and make sure we allocate at least that size. The copy from/to userspace are still restricted to the size the user specifies, this allows ioctl structs to grow on both sides of the equation.

Up until now we didn't really use the DRM_IOCTL defines in the kernel, so this cleans them up and adds them for nouveau.

v2:
fix nouveau pushbuf arg (thanks to Ben for pointing it out)

Reported-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: stop information leak of old kernel stack.
Dave Airlie [Tue, 17 Aug 2010 04:46:00 +0000 (14:46 +1000)]
drm: stop information leak of old kernel stack.

non-critical issue, CVE-2010-2803

Userspace controls the amount of memory to be allocate, so it can
get the ioctl to allocate more memory than the kernel uses, and get
access to kernel stack. This can only be done for processes authenticated
to the X server for DRI access, and if the user has DRI access.

Fix is to just memset the data to 0 if the user doesn't copy into
it in the first place.

Reported-by: Kees Cook <kees@ubuntu.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoio-mapping: move asm include inside the config option
Dave Airlie [Thu, 12 Aug 2010 01:47:50 +0000 (11:47 +1000)]
io-mapping: move asm include inside the config option

nouveau starting using these APIs, the first on non-x86 hw, and this
include isn't required on anything with real amounts of vmalloc space.

this fixes a build problem on powerpc.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agovgaarb: drop vga.h include
Dave Airlie [Thu, 12 Aug 2010 01:44:50 +0000 (11:44 +1000)]
vgaarb: drop vga.h include

We don't actually need this include on any platform.

built on powerpc + x86, reported on m68k.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: Add probing of clocks from device-tree
Benjamin Herrenschmidt [Mon, 9 Aug 2010 06:16:36 +0000 (16:16 +1000)]
drm/radeon: Add probing of clocks from device-tree

When we find no ROM we understand and a device-tree is present, see
if we can retreive clock info from there.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: drop old and broken mesa warning
Dave Airlie [Wed, 11 Aug 2010 23:40:05 +0000 (09:40 +1000)]
drm/radeon: drop old and broken mesa warning

This never really got fixed in mesa, and the kernel deals with the problem
just fine, so don't got reporting things that confuse people.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: Fix pci_map_page() error checking
Benjamin Herrenschmidt [Tue, 10 Aug 2010 04:48:58 +0000 (14:48 +1000)]
drm/radeon: Fix pci_map_page() error checking

0 is a valid DMA address from pci_map_page(), use pci_dma_mapping_error()
instead to check for errors

[airlied: fix warning + two other places with errors.]

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Remove count_lock for calling lastclose() after 58474713 (v2)
Chris Wilson [Wed, 11 Aug 2010 13:41:16 +0000 (14:41 +0100)]
drm: Remove count_lock for calling lastclose() after 58474713 (v2)

When removing of the BKL the locking around lastclose() was rearranged
and resulted in the holding of the open_count spinlock over the call
into drm_lastclose(). The drivers were not ready for this path to be
atomic - it may indeed involve long waits to release old objects and
cleanup the GPU - and so we ended up scheduling whilst atomic.

[   54.625598] BUG: scheduling while atomic: X/3546/0x00000002
[   54.625600] Modules linked in: sco bridge stp llc input_polldev rfcomm bnep l2cap crc16 sch_sfq ipv6 md_mod acpi_cpufreq mperf cryptd aes_x86_64 aes_generic xts gf128mul dm_crypt dm_mod btusb bluetooth usbhid hid zaurus cdc_ether usbnet mii cdc_wdm cdc_acm uvcvideo videodev v4l1_compat v4l2_compat_ioctl32 snd_hda_codec_conexant arc4 pcmcia ecb snd_hda_intel joydev sdhci_pci sdhci snd_hda_codec tpm_tis firewire_ohci mmc_core e1000e uhci_hcd thinkpad_acpi nvram yenta_socket pcmcia_rsrc pcmcia_core tpm wmi sr_mod firewire_core iwlagn ehci_hcd snd_hwdep snd_pcm usbcore tpm_bios thermal led_class snd_timer iwlcore snd soundcore ac snd_page_alloc pcspkr psmouse serio_raw battery sg mac80211 evdev cfg80211 i2c_i801 iTCO_wdt iTCO_vendor_support cdrom processor crc_itu_t rfkill xfs exportfs sd_mod crc_t10dif ahci libahci libata scsi_mod [last unloaded: scsi_wait_scan]
[   54.625663] Pid: 3546, comm: X Not tainted 2.6.35-04771-g1787985 #301
[   54.625665] Call Trace:
[   54.625671]  [<ffffffff8102d599>] __schedule_bug+0x57/0x5c
[   54.625675]  [<ffffffff81384141>] schedule+0xe5/0x832
[   54.625679]  [<ffffffff81163e77>] ? put_dec+0x20/0x3c
[   54.625682]  [<ffffffff81384dd4>] schedule_timeout+0x275/0x29f
[   54.625686]  [<ffffffff810455e1>] ? process_timeout+0x0/0xb
[   54.625688]  [<ffffffff81384e17>] schedule_timeout_uninterruptible+0x19/0x1b
[   54.625691]  [<ffffffff81045893>] msleep+0x16/0x1d
[   54.625695]  [<ffffffff812a2e53>] i9xx_crtc_dpms+0x273/0x2ae
[   54.625698]  [<ffffffff812a18be>] intel_crtc_dpms+0x28/0xe7
[   54.625702]  [<ffffffff811ec0fa>] drm_helper_disable_unused_functions+0xf0/0x118
[   54.625705]  [<ffffffff811ecde3>] drm_crtc_helper_set_config+0x644/0x7c8
[   54.625708]  [<ffffffff811f12dd>] ? drm_copy_field+0x40/0x50
[   54.625711]  [<ffffffff811ebca2>] drm_fb_helper_force_kernel_mode+0x3e/0x85
[   54.625713]  [<ffffffff811ebcf2>] drm_fb_helper_restore+0x9/0x24
[   54.625717]  [<ffffffff81290a41>] i915_driver_lastclose+0x2b/0x5c
[   54.625720]  [<ffffffff811f14a7>] drm_lastclose+0x44/0x2ad
[   54.625722]  [<ffffffff811f1ed2>] drm_release+0x5c6/0x609
[   54.625726]  [<ffffffff810d1275>] fput+0x109/0x1c7
[   54.625728]  [<ffffffff810ce5e4>] filp_close+0x61/0x6b
[   54.625731]  [<ffffffff810ce680>] sys_close+0x92/0xd4
[   54.625734]  [<ffffffff81002a2b>] system_call_fastpath+0x16/0x1b

v2: The spinlock is actually superfluous as access to open_count is
entirely serialised by drm_global_mutex and so can be dropped. The
count_lock spinlock instead appears to be used to protect access to
dev->buf_alloc and dev->buf_use.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: allow FG_ALPHA_VALUE on r5xx
Marek Olšák [Wed, 11 Aug 2010 18:42:51 +0000 (04:42 +1000)]
drm/radeon/kms: allow FG_ALPHA_VALUE on r5xx

This is a CS checker fix. I need this for FP16 alpha-test.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: another r6xx/r7xx CS checker fix
Alex Deucher [Wed, 11 Aug 2010 15:54:25 +0000 (11:54 -0400)]
drm/radeon/kms: another r6xx/r7xx CS checker fix

add default case for buffer formats

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: Andre Maasikas <amaasikas@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoDRM: Replace kmalloc/memset combos with kzalloc
Davidlohr Bueso [Wed, 11 Aug 2010 13:18:52 +0000 (09:18 -0400)]
DRM: Replace kmalloc/memset combos with kzalloc

Currently most, if not all, memory allocation in drm_bufs.c is followed by initializing the memory with 0.

Replace the use of kmalloc+memset with kzalloc.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: expand gamma_set
James Simmons [Tue, 3 Aug 2010 00:33:19 +0000 (01:33 +0100)]
drm: expand gamma_set

Expand the crtc_gamma_set function to accept a starting offset. The
reason for this is to eventually use this function for setcolreg from
drm_fb_helper.c. The fbdev colormap function can start at any offset in
the color map.

Signed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/edid: Split mode lists out to their own header for readability
Adam Jackson [Tue, 3 Aug 2010 18:38:20 +0000 (14:38 -0400)]
drm/edid: Split mode lists out to their own header for readability

... of the code, not of the mode lists.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/edid: Rewrite mode parse to use the generic detailed block walk
Adam Jackson [Tue, 3 Aug 2010 18:38:19 +0000 (14:38 -0400)]
drm/edid: Rewrite mode parse to use the generic detailed block walk

This brings us in line with the EDID spec recommendation for mode
priority sorting.  We still don't extract all the modes we could from
VTB, but VTB is so rare in the wild that I'm not really concerned.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/edid: Add detailed block walk for VTB extensions
Adam Jackson [Tue, 3 Aug 2010 18:38:18 +0000 (14:38 -0400)]
drm/edid: Add detailed block walk for VTB extensions

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/edid: Add detailed block walk for CEA extensions
Adam Jackson [Tue, 3 Aug 2010 18:38:17 +0000 (14:38 -0400)]
drm/edid: Add detailed block walk for CEA extensions

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Remove unused fields from drm_display_info
Adam Jackson [Tue, 3 Aug 2010 18:38:16 +0000 (14:38 -0400)]
drm: Remove unused fields from drm_display_info

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Use ENOENT consistently for the error return for an unmatched handle.
Chris Wilson [Wed, 4 Aug 2010 13:19:46 +0000 (14:19 +0100)]
drm: Use ENOENT consistently for the error return for an unmatched handle.

This is consistent with trying to access a filename that not exist
within a directory which is a good analogy here. The main reason for the
change is that it is easy to confuse the error code of EBADF as an
performing an ioctl on an invalid file descriptor (rather than an
unknown object).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: mark 3D power states as performance
Alex Deucher [Wed, 4 Aug 2010 15:10:26 +0000 (11:10 -0400)]
drm/radeon/kms: mark 3D power states as performance

Fixes lack of power saving with multiple heads on
some desktop cards.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=16474

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Only set DPMS once on the CRTC not after every encoder.
Chris Wilson [Fri, 6 Aug 2010 14:03:31 +0000 (15:03 +0100)]
drm: Only set DPMS once on the CRTC not after every encoder.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add additional quirk for Acer rv620 laptop
Alex Deucher [Fri, 6 Aug 2010 04:27:44 +0000 (00:27 -0400)]
drm/radeon/kms: add additional quirk for Acer rv620 laptop

HPD pins are reversed

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

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Propagate error code from fb_create()
Chris Wilson [Sun, 8 Aug 2010 12:36:38 +0000 (13:36 +0100)]
drm: Propagate error code from fb_create()

Change the interface to expect a PTR_ERR specifing the real error code
as opposed to assuming a NULL return => -EINVAL. Just once the user may
not be at fault!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoradeon: handle errors in radeon_hwmon_init()
Dan Carpenter [Mon, 9 Aug 2010 19:59:42 +0000 (21:59 +0200)]
radeon: handle errors in radeon_hwmon_init()

Smatch complained that the ERR_PTR from hwmon_device_register() wasn't
handled.  I added some error handling in radeon_hwmon_init() to silence
the warning.

Unfortunately errors from radeon_pm_init() aren't handled so this
doesn't really make a difference beyond silencing the warning.

Also I changed DRM_ERROR() to dev_err() which is the new preferred
method.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add support for router objects
Alex Deucher [Fri, 6 Aug 2010 01:21:18 +0000 (21:21 -0400)]
drm/radeon/kms: add support for router objects

router objects are found on systems that use a mux to control
ddc line to connector routing or to control the actual clock and data
routing from the chip to the connectors.  This patch implements ddc line
routing.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: rework combios i2c handling
Alex Deucher [Fri, 6 Aug 2010 01:21:17 +0000 (21:21 -0400)]
drm/radeon/kms: rework combios i2c handling

Handle asic specific table to hw mappings in
combios_setup_i2c_bus() directly.  This allows us
to remove most of the combios quirks and clean up
the i2c bus setup.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: unify i2c handling
Alex Deucher [Fri, 6 Aug 2010 01:21:16 +0000 (21:21 -0400)]
drm/radeon/kms: unify i2c handling

Previously we added i2c buses as needed when enumerating connectors
power management, etc.  This only exposed the actual buses used and
could have lead to the same buse getting created more than once if
one buses was used for more than one purpose.  This patch sets up
all i2c buses on the card in one place and users of the buses just
point back to the one instance.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: r600 CS parser fixes
Alex Deucher [Fri, 6 Aug 2010 06:54:05 +0000 (02:54 -0400)]
drm/radeon/kms: r600 CS parser fixes

- buffer offsets in the base regs are 256b aligned so
shift properly when comparing, fixed by Andre Maasikas
- mipmap size was calculated wrong when nlevel=0
- texture bo offsets were used after the bo base address was added
- vertex resource size register is size - 1, not size

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: Andre Maasikas <amaasikas@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: add a way to revoke hyper-z access
Marek Olšák [Sat, 7 Aug 2010 01:36:34 +0000 (03:36 +0200)]
drm/radeon: add a way to revoke hyper-z access

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Fix support for PCI domains
Benjamin Herrenschmidt [Fri, 6 Aug 2010 03:55:10 +0000 (13:55 +1000)]
drm: Fix support for PCI domains

(For some reason I thought that went in ages ago ...)

This fixes support for PCI domains in what should hopefully be a backward
compatible way along with a change to libdrm.

When the interface version is set to 1.4, we assume userspace understands
domains and the world is at peace. We thus pass proper domain numbers
instead of 0 to userspace.

The newer libdrm will then try 1.4 first, and fallback to 1.1, along with
ignoring domains in the later case (well, except on alpha of course)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-core...
Dave Airlie [Mon, 9 Aug 2010 22:17:50 +0000 (08:17 +1000)]
Merge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-core-next

* 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next: (27 commits)
  drm/nvc0: fix typo in PRAMIN flush
  drm/nouveau: Fix DCB TMDS config parsing.
  drm/nv30: Fix PFB init for nv31.
  drm/nv04: Fix up SGRAM density detection.
  drm/i2c/ch7006: Don't use POWER_LEVEL_FULL_POWER_OFF on early chip versions.
  drm/nouveau: Init dcb->or on cards that have no usable DCB table.
  drm/nouveau: reduce severity of some "error" messages
  drm/nvc0: backup bar3 channel on suspend
  drm/nouveau: implement init table opcodex 0x5e and 0x9a
  drm/nouveau: implement init table op 0x57, INIT_LTIME
  drm/nvc0: implement crtc pll setting
  drm/nvc0: fix evo dma object so we display something
  drm/nvc0: rudimentary instmem support
  drm/nvc0: implement memory detection
  drm/nvc0: allow INIT_GPIO
  drm/nvc0: starting point for GF100 support, everything stubbed
  drm/nv30: Workaround dual TMDS brain damage.
  drm/nouveau: No need to set slave TV encoder configs explicitly.
  drm/nv17-nv4x: Attempt to init some external TMDS transmitters.
  drm/nv10: Fix up switching of NV10TCL_DMA_VTXBUF.
  ...

14 years agodrm/radeon/kms: add missing copy from user
Dr. David Alan Gilbert [Sun, 1 Aug 2010 23:43:52 +0000 (09:43 +1000)]
drm/radeon/kms: add missing copy from user

This hasn't mattered up until the ioctl started using the value, and it fell
apart.

fixes fd.o 29340, Ubuntu LP 606081

[airlied: cleaned up whitespace and don't need an error before pushing]

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/nvc0: fix typo in PRAMIN flush
Ben Skeggs [Mon, 9 Aug 2010 05:18:44 +0000 (15:18 +1000)]
drm/nvc0: fix typo in PRAMIN flush

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Fix DCB TMDS config parsing.
Francisco Jerez [Sun, 8 Aug 2010 15:09:06 +0000 (17:09 +0200)]
drm/nouveau: Fix DCB TMDS config parsing.

Thinko caused by 43bda05428a3d2021f3c12220073e0251c65df8b.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
14 years agodrm/nv30: Fix PFB init for nv31.
Francisco Jerez [Fri, 6 Aug 2010 18:32:25 +0000 (20:32 +0200)]
drm/nv30: Fix PFB init for nv31.

Fixes a regression introduced by 58bbb63720c8997e0136fe1884101e7ca40d68fd
(fdo bug 29324).

Reported-by: Johannes Obermayr <johannesobermayr@gmx.de>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv04: Fix up SGRAM density detection.
Francisco Jerez [Thu, 5 Aug 2010 20:58:42 +0000 (22:58 +0200)]
drm/nv04: Fix up SGRAM density detection.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/i2c/ch7006: Don't use POWER_LEVEL_FULL_POWER_OFF on early chip versions.
Francisco Jerez [Thu, 5 Aug 2010 20:57:08 +0000 (22:57 +0200)]
drm/i2c/ch7006: Don't use POWER_LEVEL_FULL_POWER_OFF on early chip versions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Init dcb->or on cards that have no usable DCB table.
Francisco Jerez [Tue, 3 Aug 2010 13:34:53 +0000 (15:34 +0200)]
drm/nouveau: Init dcb->or on cards that have no usable DCB table.

We need a valid OR value because there're a few nv17 cards with DCB v1.4.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: reduce severity of some "error" messages
Ben Skeggs [Wed, 4 Aug 2010 13:09:30 +0000 (23:09 +1000)]
drm/nouveau: reduce severity of some "error" messages

There's some known configurations where the lack of these tables/scripts
is perfectly normal, reduce visibilty of complaint messages to debug.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nvc0: backup bar3 channel on suspend
Ben Skeggs [Wed, 4 Aug 2010 12:48:34 +0000 (22:48 +1000)]
drm/nvc0: backup bar3 channel on suspend

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: implement init table opcodex 0x5e and 0x9a
Marcin Kościelnicki [Sun, 4 Jul 2010 02:47:16 +0000 (02:47 +0000)]
drm/nouveau: implement init table opcodex 0x5e and 0x9a

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
14 years agodrm/nouveau: implement init table op 0x57, INIT_LTIME
Marcin Kościelnicki [Fri, 2 Jul 2010 19:33:01 +0000 (19:33 +0000)]
drm/nouveau: implement init table op 0x57, INIT_LTIME

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
14 years agodrm/nvc0: implement crtc pll setting
Ben Skeggs [Wed, 4 Aug 2010 12:08:03 +0000 (22:08 +1000)]
drm/nvc0: implement crtc pll setting

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nvc0: fix evo dma object so we display something
Ben Skeggs [Wed, 4 Aug 2010 07:24:57 +0000 (17:24 +1000)]
drm/nvc0: fix evo dma object so we display something

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nvc0: rudimentary instmem support
Ben Skeggs [Wed, 4 Aug 2010 05:45:33 +0000 (15:45 +1000)]
drm/nvc0: rudimentary instmem support

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nvc0: implement memory detection
Ben Skeggs [Wed, 4 Aug 2010 03:44:41 +0000 (13:44 +1000)]
drm/nvc0: implement memory detection

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nvc0: allow INIT_GPIO
Ben Skeggs [Wed, 4 Aug 2010 03:40:50 +0000 (13:40 +1000)]
drm/nvc0: allow INIT_GPIO

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nvc0: starting point for GF100 support, everything stubbed
Ben Skeggs [Tue, 3 Aug 2010 00:00:56 +0000 (10:00 +1000)]
drm/nvc0: starting point for GF100 support, everything stubbed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv30: Workaround dual TMDS brain damage.
Francisco Jerez [Sun, 25 Jul 2010 17:13:43 +0000 (19:13 +0200)]
drm/nv30: Workaround dual TMDS brain damage.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: No need to set slave TV encoder configs explicitly.
Francisco Jerez [Tue, 20 Jul 2010 15:16:33 +0000 (17:16 +0200)]
drm/nouveau: No need to set slave TV encoder configs explicitly.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv17-nv4x: Attempt to init some external TMDS transmitters.
Francisco Jerez [Tue, 20 Jul 2010 14:48:08 +0000 (16:48 +0200)]
drm/nv17-nv4x: Attempt to init some external TMDS transmitters.

sil164 and friends are the most common, usually they just need to be
poked once because a fixed configuration is enough for any modes and
clocks, so they worked without this patch if the BIOS had done a good
job on POST. Display couldn't survive a suspend/resume cycle though.
Unfortunately, BIOS scripts are useless here.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv10: Fix up switching of NV10TCL_DMA_VTXBUF.
Francisco Jerez [Wed, 4 Aug 2010 02:54:08 +0000 (04:54 +0200)]
drm/nv10: Fix up switching of NV10TCL_DMA_VTXBUF.

Not very nice, but I don't think there's a simpler workaround.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Ack the context switch interrupt before switching contexts.
Francisco Jerez [Wed, 4 Aug 2010 02:41:55 +0000 (04:41 +0200)]
drm/nouveau: Ack the context switch interrupt before switching contexts.

Leaving the IRQ unack'ed while switching contexts makes the switch
fail randomly on some nv1x.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Fix the INIT_CONFIGURE_PREINIT BIOS opcode.
Francisco Jerez [Wed, 4 Aug 2010 03:15:11 +0000 (05:15 +0200)]
drm/nouveau: Fix the INIT_CONFIGURE_PREINIT BIOS opcode.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Don't pass misaligned offsets to io_mapping_map_atomic_wc().
Francisco Jerez [Wed, 4 Aug 2010 03:10:57 +0000 (05:10 +0200)]
drm/nouveau: Don't pass misaligned offsets to io_mapping_map_atomic_wc().

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: unwind on load errors
Dan Carpenter [Fri, 30 Jul 2010 15:04:32 +0000 (17:04 +0200)]
drm/nouveau: unwind on load errors

nouveau_load() just returned directly if there was an error instead of
releasing resources.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: Fix AGP reset when AGP FW is already enabled on init.
Francisco Jerez [Fri, 30 Jul 2010 11:57:54 +0000 (13:57 +0200)]
drm/nouveau: Fix AGP reset when AGP FW is already enabled on init.

Previously nouveau_mem_reset_agp() was only disabling AGP fast writes
when coming back from suspend. However, the "locked out of the card
because of FW" problem can also be reproduced on init if you
unload/reload nouveau.ko several times. This patch makes the AGP code
reset FW on init.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: remove unused ttm bo list
Ben Skeggs [Mon, 2 Aug 2010 06:28:19 +0000 (16:28 +1000)]
drm/nouveau: remove unused ttm bo list

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nv50: use custom i2c algo for dp auxch
Ben Skeggs [Thu, 29 Jul 2010 11:01:45 +0000 (21:01 +1000)]
drm/nv50: use custom i2c algo for dp auxch

This makes it easier to see how this is working, and lets us transfer the
EDID in blocks of 16 bytes.

The primary reason for this change is because debug logs are rather hard
to read with the hundreds of single-byte auxch transactions that occur.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agoagp: intel-agp: do not use PCI resources before pci_enable_device()
Kulikov Vasiliy [Tue, 3 Aug 2010 15:42:34 +0000 (19:42 +0400)]
agp: intel-agp: do not use PCI resources before pci_enable_device()

IRQ and resource[] may not have correct values until
after PCI hotplug setup occurs at pci_enable_device() time.

The semantic match that finds this problem is as follows:

// <smpl>
@@
identifier x;
identifier request ~= "pci_request.*|pci_resource.*";
@@

(
* x->irq
|
* x->resource
|
* request(x, ...)
)
 ...
*pci_enable_device(x)
// </smpl>

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoagp: efficeon-agp: do not use PCI resources before pci_enable_device()
Kulikov Vasiliy [Tue, 3 Aug 2010 15:42:30 +0000 (19:42 +0400)]
agp: efficeon-agp: do not use PCI resources before pci_enable_device()

IRQ and resource[] may not have correct values until
after PCI hotplug setup occurs at pci_enable_device() time.

The semantic match that finds this problem is as follows:

// <smpl>
@@
identifier x;
identifier request ~= "pci_request.*|pci_resource.*";
@@

(
* x->irq
|
* x->resource
|
* request(x, ...)
)
 ...
*pci_enable_device(x)
// </smpl>

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: kill BKL from common code
Arnd Bergmann [Sat, 10 Jul 2010 21:51:39 +0000 (23:51 +0200)]
drm: kill BKL from common code

This restricts the use of the big kernel lock to the i830 and i810
device drivers. The three remaining users in common code (open, ioctl
and release) get converted to a new mutex, the drm_global_mutex,
making the locking stricter than the big kernel lock.

This may have a performance impact, but only in those cases that
currently don't use DRM_UNLOCKED flag in the ioctl list and would
benefit from that anyway.

The reason why i810 and i830 cannot use drm_global_mutex in their
mmap functions is a lock-order inversion problem between the current
use of the BKL and mmap_sem in these drivers. Since the BKL has
release-on-sleep semantics, it's harmless but it would cause trouble
if we replace the BKL with a mutex.

Instead, these drivers get their own ioctl wrappers that take the
BKL around every ioctl call and then set their own handlers as
DRM_UNLOCKED.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/kms: Simplify setup of the initial I2C encoder config.
Francisco Jerez [Thu, 22 Jul 2010 15:07:38 +0000 (17:07 +0200)]
drm/kms: Simplify setup of the initial I2C encoder config.

In most use cases the driver will be using the same static config all
the time: interpreting i2c_board_info::platform_data as the default
config we can can save the GPU driver a redundant set_config() call.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm,io-mapping: Specify slot to use for atomic mappings
Chris Wilson [Wed, 4 Aug 2010 13:34:24 +0000 (14:34 +0100)]
drm,io-mapping: Specify slot to use for atomic mappings

This is required should we ever attempt to use an io-mapping where
KM_USER0 is verboten, such as inside an IRQ context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: only expose underscan on avivo chips
Alex Deucher [Wed, 4 Aug 2010 07:45:04 +0000 (03:45 -0400)]
drm/radeon/kms: only expose underscan on avivo chips

R4xx also uses the atom add connector function, but underscan is only
supported on avivo chips.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: add new pci ids
Alex Deucher [Wed, 4 Aug 2010 15:40:00 +0000 (11:40 -0400)]
drm/radeon: add new pci ids

New evergreen and r7xx ids.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Cleanup after failing to create master->unique and dev->name
Chris Wilson [Wed, 4 Aug 2010 10:09:42 +0000 (11:09 +0100)]
drm: Cleanup after failing to create master->unique and dev->name

v2: Userspace (notably xf86-video-{intel,ati}) became confused when
drmSetInterfaceVersion() started returning -EBUSY as they used a second
call (the first done in drmOpen()) to check their master credentials.
Since userspace wants to be able to repeatedly call
drmSetInterfaceVersion() allow them to do so.

v3: Rebase to drm-core-next.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: tone down overchatty acpi debug messages.
Dave Airlie [Wed, 4 Aug 2010 01:16:56 +0000 (11:16 +1000)]
drm/radeon: tone down overchatty acpi debug messages.

On non laptop systems we'll see these the whole time, so make them
less important.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: enable underscan option for digital connectors
Alex Deucher [Tue, 3 Aug 2010 23:59:20 +0000 (19:59 -0400)]
drm/radeon/kms: enable underscan option for digital connectors

This connector attribute allows you to enable or disable underscan
on a digital output to compensate for panels that automatically
overscan (e.g., many HDMI TVs).  Valid values for the attribute are:

off - forces underscan off
on - forces underscan on
auto - enables underscan if an HDMI TV is connected, off otherwise

default value is auto.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fix calculation of h/v scaling factors
Alex Deucher [Tue, 3 Aug 2010 23:58:49 +0000 (19:58 -0400)]
drm/radeon/kms: fix calculation of h/v scaling factors

Prior to this patch the code was dividing the src_v by the dst_h
and vice versa, rather than src_v/dst_v and src_h/dst_h.

This could lead to problems in the calculation of the display
watermarks.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'intel/drm-intel-next' of /ssd/git/drm-next into drm-core-next
Dave Airlie [Tue, 3 Aug 2010 23:51:27 +0000 (09:51 +1000)]
Merge remote branch 'intel/drm-intel-next' of /ssd/git/drm-next into drm-core-next

* 'intel/drm-intel-next' of /ssd/git/drm-next: (230 commits)
  drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it.
  drm/agp/i915: trim stolen space to 32M
  drm/i915: Unset cursor if out-of-bounds upon mode change (v4)
  drm/i915: Unreference object not handle on creation
  drm/i915: Attempt to uncouple object after catastrophic failure in unbind
  drm/i915: Repeat unbinding during free if interrupted (v6)
  drm/i915: Refactor i915_gem_retire_requests()
  drm/i915: Warn if we run out of FIFO space for a mode
  drm/i915: Round up the watermark entries (v3)
  drm/i915: Typo in (unused) register mask for overlay.
  drm/i915: Check overlay stride errata for i830 and i845
  drm/i915: Validate the mode for eDP by using fixed panel size
  drm/i915: Always use the fixed panel timing for eDP
  drm/i915: Enable panel fitting for eDP
  drm/i915: Add fixed panel mode parsed from EDID for eDP without fixed mode in VBT
  drm/i915/sdvo: Set sync polarity based on actual mode
  drm/i915/hdmi: Set sync polarity based on actual mode
  drm/i915/pch: Set transcoder sync polarity for DP based on actual mode
  drm/i915: Initialize LVDS and eDP outputs before anything else
  drm/i915/dp: Correctly report eDP in the core connector type
  ...

14 years agodrm/radeon/kms/igp: sideport is AMD only
Alex Deucher [Mon, 2 Aug 2010 23:39:15 +0000 (19:39 -0400)]
drm/radeon/kms/igp: sideport is AMD only

Intel variants don't support it.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: handle the case of no active displays properly in the bandwidth code
Alex Deucher [Mon, 2 Aug 2010 16:13:46 +0000 (12:13 -0400)]
drm/radeon/kms: handle the case of no active displays properly in the bandwidth code

Logic was:
if (mode0 && mode1)
else if (mode0)
else

Should be:
if (mode0 && mode1)
else if (mode0)
else if (mode1)

Otherwise we may end up calculating the priority regs with
unitialized values.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=16492

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: move ttm global code to core drm
Dave Airlie [Tue, 9 Mar 2010 00:56:52 +0000 (10:56 +1000)]
drm: move ttm global code to core drm

I wrote this for the prime sharing work, but I also noticed other external
non-upstream drivers from a large company carrying a similiar patch, so I
may as well ship it in master.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it.
Eric Anholt [Mon, 26 Jul 2010 21:49:07 +0000 (14:49 -0700)]
drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it.

My fine DisplayPort output was getting ST dithering forever after
having had the LVDS enabled at one point.

Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/radeon/kms: make sure HPD is set to NONE on analog-only connectors
Alex Deucher [Tue, 20 Jul 2010 07:24:11 +0000 (03:24 -0400)]
drm/radeon/kms: make sure HPD is set to NONE on analog-only connectors

HPD is digital only.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: make sure rio_mem is valid before unmapping it
Alex Deucher [Thu, 8 Jul 2010 16:24:52 +0000 (12:24 -0400)]
drm/radeon/kms: make sure rio_mem is valid before unmapping it

If we were not able to map the io bar in device init, don't attempt
to unmap it in device fini.  All radeons should have a io bar, so
I doubt this would ever trigger, but just to be on the safe side...

Pointed out by: Alberto Milone <alberto.milone@canonical.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/agp/i915: trim stolen space to 32M
Jesse Barnes [Thu, 8 Jul 2010 16:22:46 +0000 (09:22 -0700)]
drm/agp/i915: trim stolen space to 32M

Some BIOSes will claim a large chunk of stolen space.  Unless we
reclaim it, our aperture for remapping buffer objects will be
constrained.  So clamp the stolen space to 32M and ignore the rest.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15469 among others.

Adding the ignored stolen memory back into the general pool using the
memory hotplug code is left as an exercise for the reader.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.com>
Tested-by: Artem S. Tashkinov <t.artem@mailcity.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Unset cursor if out-of-bounds upon mode change (v4)
Chris Wilson [Fri, 9 Jul 2010 07:45:04 +0000 (08:45 +0100)]
drm/i915: Unset cursor if out-of-bounds upon mode change (v4)

The docs warn that to position the cursor such that no part of it is
visible on the pipe is an undefined operation. Avoid such circumstances
upon changing the mode, or at any other time, by unsetting the cursor if
it moves out of bounds.

"For normal high resolution display modes, the cursor must have at least a
single pixel positioned over the active screen.” (p143, p148 of the hardware
registers docs).

Fixes:

  Bug 24748 - [965G] Graphics crashes when resolution is changed with KMS
              enabled
  https://bugs.freedesktop.org/show_bug.cgi?id=24748

v2: Only update the cursor registers if they change.
v3: Fix the unsigned comparision of x,y against width,height.
v4: Always set CUR.BASE or else the cursor may become corrupt.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Christian Eggers <ceggers@gmx.de>
Cc: Christopher James Halse Rogers <chalserogers@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Unreference object not handle on creation
Chris Wilson [Sat, 24 Jul 2010 20:03:49 +0000 (21:03 +0100)]
drm/i915: Unreference object not handle on creation

When creating an object, we create the handle by which it is known to
the process and which own the reference to the object. That reference to
the new handle is what we want to transfer to the process, not the lost
reference to the object; so free the local object reference *not* the
process's handle reference.

This brings i915_gem_object_create_ioctl() into line with
drm_gem_open_ioctl()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Attempt to uncouple object after catastrophic failure in unbind
Chris Wilson [Fri, 23 Jul 2010 22:18:51 +0000 (23:18 +0100)]
drm/i915: Attempt to uncouple object after catastrophic failure in unbind

If we fail to flush outstanding GPU writes but return the memory to the
system, we risk corrupting memory should the GPU recovery and complete
those writes. On the other hand, if we bail early and free the object
then we have a definite use-after-free and real memory corruption.
Choose the lesser of two evils, since in order to recover from the hung
GPU we need to completely reset it, those pending writes should
never happen.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Repeat unbinding during free if interrupted (v6)
Chris Wilson [Fri, 23 Jul 2010 22:18:50 +0000 (23:18 +0100)]
drm/i915: Repeat unbinding during free if interrupted (v6)

If during the freeing of an object the unbind is interrupted by a system
call, which is quite possible if we have outstanding GPU writes that
must be flushed, the unbind is silently aborted. This still leaves the
AGP region and backing pages allocated, and perhaps more importantly,
the object remains upon the various lists exposing us to memory
corruption.

I think this is the cause behind the use-after-free, such as

  Bug 15664 - Graphics hang and kernel backtrace when starting Azureus
              with Compiz enabled
  https://bugzilla.kernel.org/show_bug.cgi?id=15664

v2: Daniel Vetter reminded me that kernel space programming is never easy.
We cannot simply spin to clear the pending signal and so must deferred
the freeing of the object until later.
v3: Run from the top level retire requests.
v4: Tested with P(return -ERESTARTSYS)=.5 from i915_gem_do_wait_request()
v5: Rebase against Eric's for-linus tree.
v6: Refactor, split and add a comment about avoiding unbounded recursion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Refactor i915_gem_retire_requests()
Chris Wilson [Fri, 23 Jul 2010 22:18:49 +0000 (23:18 +0100)]
drm/i915: Refactor i915_gem_retire_requests()

Combine the iteration over active render rings into a common function.
This is in preparation for reusing the idle function to also retire
deferred free requests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Warn if we run out of FIFO space for a mode
Chris Wilson [Mon, 19 Jul 2010 20:46:08 +0000 (21:46 +0100)]
drm/i915: Warn if we run out of FIFO space for a mode

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Round up the watermark entries (v3)
Chris Wilson [Mon, 19 Jul 2010 18:59:52 +0000 (19:59 +0100)]
drm/i915: Round up the watermark entries (v3)

Even though "we have enough padding that it should be ok", round up the
watermark entries to the next unit to be on the safe side...

v2: Use the DIV_ROUND_UP macro
v3: Spotted a few more missing round-ups.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Typo in (unused) register mask for overlay.
Chris Wilson [Tue, 13 Jul 2010 12:52:17 +0000 (13:52 +0100)]
drm/i915: Typo in (unused) register mask for overlay.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Check overlay stride errata for i830 and i845
Chris Wilson [Mon, 12 Jul 2010 18:35:38 +0000 (19:35 +0100)]
drm/i915: Check overlay stride errata for i830 and i845

Apparently i830 and i845 cannot handle any stride that is not a multiple
of 256, unlike their brethren which do support 64 byte aligned strides.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Validate the mode for eDP by using fixed panel size
Zhao Yakui [Mon, 19 Jul 2010 08:43:14 +0000 (09:43 +0100)]
drm/i915: Validate the mode for eDP by using fixed panel size

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Always use the fixed panel timing for eDP
Zhao Yakui [Mon, 19 Jul 2010 08:43:13 +0000 (09:43 +0100)]
drm/i915: Always use the fixed panel timing for eDP

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Enable panel fitting for eDP
Zhao Yakui [Mon, 19 Jul 2010 08:43:12 +0000 (09:43 +0100)]
drm/i915: Enable panel fitting for eDP

When trying to set other display mode besides the fixed panel mode, the
panel fitting should be enabled. This is similar to LVDS.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Add fixed panel mode parsed from EDID for eDP without fixed mode in VBT
Zhao Yakui [Mon, 19 Jul 2010 08:43:11 +0000 (09:43 +0100)]
drm/i915: Add fixed panel mode parsed from EDID for eDP without fixed mode in VBT

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915/sdvo: Set sync polarity based on actual mode
Adam Jackson [Fri, 16 Jul 2010 18:46:32 +0000 (14:46 -0400)]
drm/i915/sdvo: Set sync polarity based on actual mode

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915/hdmi: Set sync polarity based on actual mode
Adam Jackson [Fri, 16 Jul 2010 18:46:31 +0000 (14:46 -0400)]
drm/i915/hdmi: Set sync polarity based on actual mode

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915/pch: Set transcoder sync polarity for DP based on actual mode
Adam Jackson [Fri, 16 Jul 2010 18:46:30 +0000 (14:46 -0400)]
drm/i915/pch: Set transcoder sync polarity for DP based on actual mode

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Initialize LVDS and eDP outputs before anything else
Adam Jackson [Fri, 16 Jul 2010 18:46:29 +0000 (14:46 -0400)]
drm/i915: Initialize LVDS and eDP outputs before anything else

This makes them sort to the front in X, which makes them likely to be
the primary outputs if you haven't specified a preference in your DE,
which is likely to be what you want.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915/dp: Correctly report eDP in the core connector type
Adam Jackson [Fri, 16 Jul 2010 18:46:28 +0000 (14:46 -0400)]
drm/i915/dp: Correctly report eDP in the core connector type

Do this for both real eDP and for PCH_DP_D when used as the eDP
connection.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915/dp: Rename has_edp to is_pch_edp to reflect its real meaning
Adam Jackson [Fri, 16 Jul 2010 18:46:27 +0000 (14:46 -0400)]
drm/i915/dp: Rename has_edp to is_pch_edp to reflect its real meaning

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Refactor panel fitting on the LVDS. (v2)
Chris Wilson [Sun, 18 Jul 2010 11:05:54 +0000 (12:05 +0100)]
drm/i915: Refactor panel fitting on the LVDS. (v2)

Move the common routines into separate functions to not only increase
readability, but also throwaway surplus code.

In doing so, we review the calculation of the aspect preserving scaling
and avoid the use of fixed-point until we need to calculate the accurate
scale factor.

v2: Improve comments as suggested by Jesse.

1 files changed, 105 insertions(+), 194 deletions(-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Remove the redundant check for a fixed_panel_mode
Chris Wilson [Sat, 17 Jul 2010 12:38:43 +0000 (13:38 +0100)]
drm/i915: Remove the redundant check for a fixed_panel_mode

We already checked just a couple of lines above that we have found a
fixed_panel_mode for the LVDS, so remove the surplus check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>