GitHub/LineageOS/android_kernel_motorola_exynos9610.git
12 years agodrm/nvc0/dmaobj: stub bind function for now so we can call unconditionally
Ben Skeggs [Mon, 8 Oct 2012 03:39:13 +0000 (13:39 +1000)]
drm/nvc0/dmaobj: stub bind function for now so we can call unconditionally

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/dmaobj: move parent class check to bind() method
Ben Skeggs [Mon, 8 Oct 2012 02:58:23 +0000 (12:58 +1000)]
drm/nouveau/dmaobj: move parent class check to bind() method

Otherwise when nvc0- gains a bind() method (disp needs it), the fifo
engine will attempt to create a dma object for the push buffer, which
is unnecessary on fermi.

The only sane place to put these checks is in the bind method itself,
and have it unconditionally called from wherever it might be needed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/dmaobj: merge everything except ctor and bind together
Ben Skeggs [Wed, 29 Aug 2012 00:54:49 +0000 (10:54 +1000)]
drm/nouveau/dmaobj: merge everything except ctor and bind together

Simplifies things a little, and currently no reason to need
chipset-specific dmaobj constructors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: pass address to object accessor functions as u64
Ben Skeggs [Sat, 17 Nov 2012 11:51:30 +0000 (21:51 +1000)]
drm/nouveau: pass address to object accessor functions as u64

Will be required by future work.  Make the API change now to catch any
(but hopefully none) unexpected fallout.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/gpio: place upper limit on using old-school tvdac bios data
Ben Skeggs [Wed, 21 Nov 2012 05:04:51 +0000 (15:04 +1000)]
drm/nouveau/gpio: place upper limit on using old-school tvdac bios data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: remove newline-only NV_DEBUG calls
Ben Skeggs [Wed, 21 Nov 2012 05:02:47 +0000 (15:02 +1000)]
drm/nouveau: remove newline-only NV_DEBUG calls

This used to output the function name, now doesn't, so just looks
stupid.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv50: decode PGRAPH status registers on TLB flush fail
Marcin Slusarz [Sun, 11 Nov 2012 18:52:59 +0000 (19:52 +0100)]
drm/nv50: decode PGRAPH status registers on TLB flush fail

SIgned-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/clk: fix crystal frequency retrieval on nv25
Viktor Novotný [Sat, 10 Nov 2012 18:24:06 +0000 (19:24 +0100)]
drm/nouveau/clk: fix crystal frequency retrieval on nv25

Signed-off-by: Viktor Novotný <noviktor@seznam.cz>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: remove unused variable from nouveau_bios_shadow_of
Marcin Slusarz [Sun, 11 Nov 2012 18:57:35 +0000 (19:57 +0100)]
drm/nouveau: remove unused variable from nouveau_bios_shadow_of

drivers/gpu/drm/nouveau/core/subdev/bios/base.c: warning: unused variable 'i'

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv40/fb: use an actual compressed zeta format
Ben Skeggs [Tue, 30 Oct 2012 03:55:13 +0000 (13:55 +1000)]
drm/nv40/fb: use an actual compressed zeta format

SPLIT is apparently just that, and only splits Z and S components.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv30/fb: enable z compression
Ben Skeggs [Thu, 11 Oct 2012 05:46:30 +0000 (15:46 +1000)]
drm/nv30/fb: enable z compression

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv40/fb: enable z compression
Ben Skeggs [Thu, 11 Oct 2012 05:13:10 +0000 (15:13 +1000)]
drm/nv40/fb: enable z compression

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv20/fb: fixup compression tag allocation size
Ben Skeggs [Fri, 12 Oct 2012 01:24:39 +0000 (11:24 +1000)]
drm/nv20/fb: fixup compression tag allocation size

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv30-nv40/graph: poke zcomp regs from tile_prog hook
Ben Skeggs [Thu, 11 Oct 2012 04:08:16 +0000 (14:08 +1000)]
drm/nv30-nv40/graph: poke zcomp regs from tile_prog hook

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv30-nv40/fb: call zcomp setup hook from tiling setup
Ben Skeggs [Wed, 10 Oct 2012 02:52:00 +0000 (12:52 +1000)]
drm/nv30-nv40/fb: call zcomp setup hook from tiling setup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/fb: create tag heap from common code for all relevant chipsets
Ben Skeggs [Wed, 10 Oct 2012 01:31:11 +0000 (11:31 +1000)]
drm/nouveau/fb: create tag heap from common code for all relevant chipsets

A nv2x bug wrt hardcoded tag counts is now also fixed as a side-effect.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv30/fb: start bashing zcomp registers with 'disabled' (for now)
Ben Skeggs [Wed, 10 Oct 2012 01:18:00 +0000 (11:18 +1000)]
drm/nv30/fb: start bashing zcomp registers with 'disabled' (for now)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: replace some open-coded mm_initialised checks
Ben Skeggs [Wed, 10 Oct 2012 02:13:38 +0000 (12:13 +1000)]
drm/nouveau: replace some open-coded mm_initialised checks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/fb: read TILE_BASE after writing it to avoid a hardware race
Ben Skeggs [Wed, 10 Oct 2012 01:09:48 +0000 (11:09 +1000)]
drm/nouveau/fb: read TILE_BASE after writing it to avoid a hardware race

Apparently needed for turbocache nv4x chips at least, we'll just do it
everywhere...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv40/fb: start bashing zcomp registers on relevant chipsets
Ben Skeggs [Wed, 10 Oct 2012 00:57:49 +0000 (10:57 +1000)]
drm/nv40/fb: start bashing zcomp registers on relevant chipsets

Always bashing "disabled" for now, actual compressing coming up...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv30-nv40/fb: make use of bankoff for zeta buffers, where supported
Ben Skeggs [Wed, 10 Oct 2012 00:41:04 +0000 (10:41 +1000)]
drm/nv30-nv40/fb: make use of bankoff for zeta buffers, where supported

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv20/fb: fix zcomp register calculation on big-endian systems
Ben Skeggs [Wed, 10 Oct 2012 00:34:29 +0000 (10:34 +1000)]
drm/nv20/fb: fix zcomp register calculation on big-endian systems

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv40/fb: split implementation into nv40/nv41/nv44/nv46/nv47/nv49/nv4e pieces
Ben Skeggs [Tue, 9 Oct 2012 06:03:23 +0000 (16:03 +1000)]
drm/nv40/fb: split implementation into nv40/nv41/nv44/nv46/nv47/nv49/nv4e pieces

Wow, this is a nice complicated mess of build-your-own-mc blocks...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv30/fb: split implementation into nv34(nv10)/nv30/nv35 pieces
Ben Skeggs [Tue, 9 Oct 2012 05:56:16 +0000 (15:56 +1000)]
drm/nv30/fb: split implementation into nv34(nv10)/nv30/nv35 pieces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nv20/fb: split implementation into nv20/nv25 pieces
Ben Skeggs [Tue, 9 Oct 2012 05:48:11 +0000 (15:48 +1000)]
drm/nv20/fb: split implementation into nv20/nv25 pieces

There's more stuff that can be shared in the constructor, will be merged
together again later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/fb: split tile and compression region handling
Ben Skeggs [Tue, 9 Oct 2012 05:41:09 +0000 (15:41 +1000)]
drm/nouveau/fb: split tile and compression region handling

This is in preparation for extending the support to the remaining
chipsets, to allow for sharing more functions.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/bios: attempt to fetch entire acpi rom image in one shot
Ben Skeggs [Fri, 12 Oct 2012 02:45:15 +0000 (22:45 -0400)]
drm/nouveau/bios: attempt to fetch entire acpi rom image in one shot

v2: fdo#55948 - the _ROM method silently truncates size to 4KiB, perform
    a checksum test and fall back to slow _ROM access on failure.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/doc: add new dp helpers into drm DocBook
Daniel Vetter [Thu, 1 Nov 2012 13:45:18 +0000 (14:45 +0100)]
drm/doc: add new dp helpers into drm DocBook

I didn't bother with documenting the really trivial new "extract
something from dpcd" helpers, but the i2c over aux ch is now
documented a bit.

v2: Clarify the comment for i2c_dp_aux_add_bus a bit.

v3: Fix more spelling fail spotted by Laurent Pinchart.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/doc: integrate fb helper reference into docs
Daniel Vetter [Thu, 1 Nov 2012 13:45:17 +0000 (14:45 +0100)]
drm/doc: integrate fb helper reference into docs

Again only minimal changes to make kerneldoc no longer shout. Plus a
little introduction in the form of a inline DOC: section to quickly
explain what this is all about.

v2: Fixup spelling fail.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/doc: integrate crtc helper api into docbook
Daniel Vetter [Thu, 1 Nov 2012 13:45:16 +0000 (14:45 +0100)]
drm/doc: integrate crtc helper api into docbook

- Add the missing doc for drm_helper_move_panel_connectors_to_head.
- Fixup any outdated stuff in existing sections. I've only looked at
  those kerneldoc headers that actually resulted in a complaint from
  the kerneldoc parser tool.

v2:
- Actually include the docbook snippet in the right patch.
- Fix spelling fail.

v3: It's now called drm_crtc_helper_set_mode, spotted by Laurent
Pinchart.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/doc: Helpers are not a Midlayer!
Daniel Vetter [Thu, 1 Nov 2012 13:45:15 +0000 (14:45 +0100)]
drm/doc: Helpers are not a Midlayer!

I'm devoting all my wrath to that fight, so don't misname it ;-)

v2: Make it clear that this section talks about kms helpers.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/edid: tune down debug message in parse_hdmi_vsdb
Daniel Vetter [Thu, 22 Nov 2012 08:53:55 +0000 (09:53 +0100)]
drm/edid: tune down debug message in parse_hdmi_vsdb

Those tend to be totally not interesting for end-users, and for
debugging we tend to dump the entire noise anyway by enabling all
debug messages.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57388
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: only build ati_pcigart if PCI enabled
James Hogan [Fri, 23 Nov 2012 11:12:10 +0000 (11:12 +0000)]
drm: only build ati_pcigart if PCI enabled

Prevent ati_pcigart.c being built unless PCI is enabled. The exported
functions in this file are only used by drivers which depend on PCI
(namely r128 and radeon), and it tries to use PCI specific functions
(pci_unmap_page, pci_map_page, and pci_dma_mapping_error) that cause
compiler errors when PCI is disabled.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Tighten the security around buffer maps
Thomas Hellstrom [Wed, 21 Nov 2012 15:04:18 +0000 (16:04 +0100)]
drm/vmwgfx: Tighten the security around buffer maps

Make sure that other DRM clients can't map the contents of
non-shareable buffer objects.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: tegra: Add Tegra30 support
Thierry Reding [Wed, 21 Nov 2012 08:50:41 +0000 (09:50 +0100)]
drm: tegra: Add Tegra30 support

Add support for host1x, the display controllers and HDMI on the Tegra30
SoC.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Mark Zhang <markz@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: tegra: Use framebuffer pitch as line stride
Thierry Reding [Thu, 22 Nov 2012 19:37:17 +0000 (19:37 +0000)]
drm: tegra: Use framebuffer pitch as line stride

Instead of using the stride derived from the display mode, use the pitch
associated with the currently active framebuffer. This fixes a bug where
the LCD display content would be skewed when enabling HDMI with a video
mode different from that of the LCD.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Mark Zhang <markz@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: Optimize vm locking using kref_get_unless_zero v3
Thomas Hellstrom [Wed, 21 Nov 2012 14:53:21 +0000 (14:53 +0000)]
drm/ttm: Optimize vm locking using kref_get_unless_zero v3

Removes the need for a write lock each time we call ttm_bo_unref().

v2: Remove an unused variable.
v3: Really remove the unused variable.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: Use the hashtab _rcu interface for ttm_objects
Thomas Hellstrom [Tue, 20 Nov 2012 12:16:51 +0000 (12:16 +0000)]
drm/ttm: Use the hashtab _rcu interface for ttm_objects

Also move a kref_init() out of spinlocked region

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: Fix locking in an error path
Thomas Hellstrom [Tue, 20 Nov 2012 12:16:50 +0000 (12:16 +0000)]
drm/ttm: Fix locking in an error path

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Free user-space fence objects correctly
Thomas Hellstrom [Tue, 20 Nov 2012 12:16:49 +0000 (12:16 +0000)]
drm/vmwgfx: Free user-space fence objects correctly

They need to be freed after an rcu grace period.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agokref: Add kref_get_unless_zero documentation
Thomas Hellstrom [Tue, 20 Nov 2012 12:16:48 +0000 (12:16 +0000)]
kref: Add kref_get_unless_zero documentation

Document how kref_get_unless_zero should be used and how it helps
solve a typical kref / locking problem.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Add a hash-tab rcu-safe API
Thomas Hellstrom [Tue, 20 Nov 2012 12:16:47 +0000 (12:16 +0000)]
drm: Add a hash-tab rcu-safe API

While hashtab should now be RCU-safe, Add a drm_ht_xxx_api for consumers
to use to make it obvious what locking mechanism is used.

Document the way the rcu-safe interface should be used.

Don't use rcu-safe list traversal in modify operations where we should use
a spinlock / mutex anyway.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Add and make use of a header for surface size calculation.
Thomas Hellstrom [Tue, 20 Nov 2012 12:19:37 +0000 (12:19 +0000)]
drm/vmwgfx: Add and make use of a header for surface size calculation.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Break out surface and context management to separate files
Thomas Hellstrom [Tue, 20 Nov 2012 12:19:36 +0000 (12:19 +0000)]
drm/vmwgfx: Break out surface and context management to separate files

Add a resource-private header for common resource definitions

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Refactor resource management
Thomas Hellstrom [Tue, 20 Nov 2012 12:19:35 +0000 (12:19 +0000)]
drm/vmwgfx: Refactor resource management

Refactor resource management to make it easy to hook up resources
that are backed up by buffers. In particular, resources and their
backing buffers can be evicted and rebound, if supported by the device.
To avoid query deadlocks, the query code is also modified somewhat.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Make vmw_dmabuf_unreference handle NULL objects
Thomas Hellstrom [Fri, 9 Nov 2012 12:26:15 +0000 (12:26 +0000)]
drm/vmwgfx: Make vmw_dmabuf_unreference handle NULL objects

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Refactor module load to not require fifo unless fbdev is loaded
Thomas Hellstrom [Fri, 9 Nov 2012 12:26:14 +0000 (12:26 +0000)]
drm/vmwgfx: Refactor module load to not require fifo unless fbdev is loaded

This also fixes a bug where the fence manager was left without irq
enabled when waiting for fences, causing various errors at module
load time

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Make screen object code not require fifo at init time
Thomas Hellstrom [Fri, 9 Nov 2012 12:26:13 +0000 (12:26 +0000)]
drm/vmwgfx: Make screen object code not require fifo at init time

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Make overlay code not require fifo at init time
Thomas Hellstrom [Fri, 9 Nov 2012 12:26:12 +0000 (12:26 +0000)]
drm/vmwgfx: Make overlay code not require fifo at init time

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: Enable traces *after* we've hidden SVGA
Thomas Hellstrom [Fri, 9 Nov 2012 12:26:11 +0000 (12:26 +0000)]
drm/vmwgfx: Enable traces *after* we've hidden SVGA

Hiding SVGA seems to trigger a VGA screen clear, and with no
traces dirty it doesn't seem to repaint

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: alter cpu_writers to return -EBUSY in ttm_execbuf_util reservations
Maarten Lankhorst [Tue, 6 Nov 2012 13:39:43 +0000 (14:39 +0100)]
drm/ttm: alter cpu_writers to return -EBUSY in ttm_execbuf_util reservations

This is similar to other platforms that don't allow command submission
to buffers locked on the cpu.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: Optimize reservation slightly
Thomas Hellstrom [Tue, 6 Nov 2012 11:31:51 +0000 (11:31 +0000)]
drm/ttm: Optimize reservation slightly

Reservation locking currently always takes place under the LRU spinlock.
Hence, strictly there is no need for an atomic_cmpxchg call; we can use
atomic_read followed by atomic_write since nobody else will ever reserve
without the lru spinlock held.
At least on Intel this should remove a locked bus cycle on successful
reserve.

Note that thit commit may be obsoleted by the cross-device reservation work.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm, drm/vmwgfx: Use RCU locking for object lookups v3
Thomas Hellstrom [Tue, 6 Nov 2012 11:31:50 +0000 (11:31 +0000)]
drm/ttm, drm/vmwgfx: Use RCU locking for object lookups v3

The mostly used lookup+get put+potential_destroy path of TTM objects
is converted to use RCU locks. This will substantially decrease the amount
of locked bus cycles during normal operation.
Since we use kfree_rcu to free the objects, no rcu synchronization is needed
at module unload time.

v2: Don't touch include/linux/kref.h
v3: Adapt to kref_get_unless_zero return value change

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agokref: Implement kref_get_unless_zero v3
Thomas Hellstrom [Tue, 6 Nov 2012 11:31:49 +0000 (11:31 +0000)]
kref: Implement kref_get_unless_zero v3

This function is intended to simplify locking around refcounting for
objects that can be looked up from a lookup structure, and which are
removed from that lookup structure in the object destructor.
Operations on such objects require at least a read lock around
lookup + kref_get, and a write lock around kref_put + remove from lookup
structure. Furthermore, RCU implementations become extremely tricky.
With a lookup followed by a kref_get_unless_zero *with return value check*
locking in the kref_put path can be deferred to the actual removal from
the lookup structure and RCU lookups become trivial.

v2: Formatting fixes.
v3: Invert the return value.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Make hashtab rcu-safe
Thomas Hellstrom [Tue, 6 Nov 2012 11:31:48 +0000 (11:31 +0000)]
drm: Make hashtab rcu-safe

TTM base objects will be the first consumer.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: remove sync_arg from driver functions
Maarten Lankhorst [Fri, 12 Oct 2012 15:04:00 +0000 (15:04 +0000)]
drm/ttm: remove sync_arg from driver functions

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-By: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: remove sync_obj_arg from ttm_bo_move_accel_cleanup
Maarten Lankhorst [Fri, 12 Oct 2012 15:03:11 +0000 (15:03 +0000)]
drm/ttm: remove sync_obj_arg from ttm_bo_move_accel_cleanup

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-By: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: remove sync_obj_arg member
Maarten Lankhorst [Fri, 12 Oct 2012 15:02:19 +0000 (15:02 +0000)]
drm/ttm: remove sync_obj_arg member

vmwgfx was its only user and always sets it to the same..

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-By: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/vmwgfx: remove use of fence_obj_args
Maarten Lankhorst [Fri, 12 Oct 2012 15:01:43 +0000 (15:01 +0000)]
drm/vmwgfx: remove use of fence_obj_args

It's always hardcoded to the same value.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-By: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoDRM/KMS: Add Bail-Out Conditions for Loop.
Egbert Eich [Sat, 13 Oct 2012 11:36:14 +0000 (11:36 +0000)]
DRM/KMS: Add Bail-Out Conditions for Loop.

When trying to obtain an accurate timestamp for the last vsync interrupt
in vblank_disable_and_save() we loop until the vsync counter after reading
the time stamp is identical to the one before.
In the case where no hardware timestamp can be obtained there is probably
no point in trying to make sure we remain within the same vsync during
the time we obtain the counter.
Furthermore we should make sure there's an 'emergency exit' so that we
don't end up in an endless loop when the driver get_vblank_timestamp()
function doesn't manage to return within the same vsync.
This may happen when this function prints out debugging information over
a slow (ie serial) line.

Signed-off-by: Egbert Eich <eich@suse.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: don't unnecessarily enable the polling work
Daniel Vetter [Wed, 24 Oct 2012 13:35:50 +0000 (13:35 +0000)]
drm: don't unnecessarily enable the polling work

... by properly checking connector->polled. This doesn't matter too
much because the polling work itself gets this slightly more right and
doesn't set repoll if there's nothing to do. But we can do better.

v2: Chris Wilson noticed that I broke polling, since repoll will never
ever be set true. Fix this up, and simplify the logic a bit while at
it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agovga_switcheroo: Drop unused include and unused variables.
Igor Murzov [Thu, 25 Oct 2012 13:09:01 +0000 (13:09 +0000)]
vga_switcheroo: Drop unused include and unused variables.

Signed-off-by: Igor Murzov <e-mail@date.by>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/nouveau: free memory allocated with alloc_apertures()
Tommi Rantala [Fri, 9 Nov 2012 09:19:40 +0000 (09:19 +0000)]
drm/nouveau: free memory allocated with alloc_apertures()

Fix a memory leak by deallocating the memory we got from
alloc_apertures().

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon: check alloc_apertures() success in radeon_kick_out_firmware_fb()
Tommi Rantala [Fri, 9 Nov 2012 09:19:39 +0000 (09:19 +0000)]
drm/radeon: check alloc_apertures() success in radeon_kick_out_firmware_fb()

Check for alloc_apertures() memory allocation failure, and propagate an
error code in case the allocation failed.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/mgag200: remove unneeded aper->count assignment after alloc_apertures()
Tommi Rantala [Fri, 9 Nov 2012 09:19:38 +0000 (09:19 +0000)]
drm/mgag200: remove unneeded aper->count assignment after alloc_apertures()

alloc_apertures() already does the assignment for us, so assigning the
count member after the alloc_apertures() call is not needed.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/mgag200: free memory allocated with alloc_apertures()
Tommi Rantala [Fri, 9 Nov 2012 09:19:37 +0000 (09:19 +0000)]
drm/mgag200: free memory allocated with alloc_apertures()

Fix a memory leak by deallocating the memory we got from
alloc_apertures().

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/mgag200: check alloc_apertures() success in mga_vram_init()
Tommi Rantala [Fri, 9 Nov 2012 09:19:36 +0000 (09:19 +0000)]
drm/mgag200: check alloc_apertures() success in mga_vram_init()

Check for alloc_apertures() memory allocation failure, and propagate an
error code in case the allocation failed.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/cirrus: check alloc_apertures() success in cirrus_kick_out_firmware_fb()
Tommi Rantala [Fri, 9 Nov 2012 09:19:35 +0000 (09:19 +0000)]
drm/cirrus: check alloc_apertures() success in cirrus_kick_out_firmware_fb()

Check for alloc_apertures() memory allocation failure, and propagate an
error code in case the allocation failed.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: remove ttm_mem_global->queue
Marcin Slusarz [Tue, 6 Nov 2012 21:49:54 +0000 (21:49 +0000)]
drm/ttm: remove ttm_mem_global->queue

It's unused.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: remove ttm_bo_device->nice_mode
Marcin Slusarz [Tue, 6 Nov 2012 21:49:53 +0000 (21:49 +0000)]
drm/ttm: remove ttm_bo_device->nice_mode

It's unused.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: remove ttm_buffer_object->buffer_start
Marcin Slusarz [Tue, 6 Nov 2012 21:49:51 +0000 (21:49 +0000)]
drm/ttm: remove ttm_buffer_object->buffer_start

All drivers set it to 0 and nothing uses it.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon: Use hweight32
Akinobu Mita [Fri, 9 Nov 2012 12:10:41 +0000 (12:10 +0000)]
drm/radeon: Use hweight32

Use hweight32 instead of counting for each bit

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: use memchr_inv()
Akinobu Mita [Fri, 9 Nov 2012 12:10:42 +0000 (12:10 +0000)]
drm: use memchr_inv()

Use memchr_inv() to check the specified memory region is filled with zero.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: add support for monotonic vblank timestamps
Imre Deak [Tue, 23 Oct 2012 18:53:26 +0000 (18:53 +0000)]
drm: add support for monotonic vblank timestamps

Jumps in the vblank and page flip event timestamps cause trouble for
clients, so we should avoid them. The timestamp we get currently with
gettimeofday can jump, so use instead monotonic timestamps.

For backward compatibility use a module flag to revert back to using
gettimeofday timestamps. Add also a DRM_CAP_TIMESTAMP_MONOTONIC flag
that is simply a read only version of the module flag, so that clients
can query this without depending on sysfs.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: use monotonic time in drm_calc_vbltimestamp_from_scanoutpos
Imre Deak [Tue, 23 Oct 2012 18:53:25 +0000 (18:53 +0000)]
drm: use monotonic time in drm_calc_vbltimestamp_from_scanoutpos

For measuring duration we want to avoid that our start/end timestamps
jump, so use monotonic instead of real time for that.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: mario.kleiner
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: don't poll forced connectors
Daniel Vetter [Tue, 23 Oct 2012 18:23:38 +0000 (18:23 +0000)]
drm: don't poll forced connectors

Otherwise if the detect callback reports a different state than what
the user forced (rather likely), we continously annoy userspace about
a hotplug uevent.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: don't start the poll engine in probe_single_connector
Daniel Vetter [Tue, 23 Oct 2012 18:23:36 +0000 (18:23 +0000)]
drm: don't start the poll engine in probe_single_connector

Actually there's a reason this stuff is there, and it's called

commit e58f637bb96d5a0ae0919b9998b891d1ba7e47c9
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 20 09:13:36 2010 +0100

    drm/kms: Add a module parameter to disable polling

The idea has been that users can enable/disable polling at runtime. So
the quick hack has been to just re-enable the output polling if xrandr
asks for the latest state of the connectors.

The problem with that hack is that when we force connectors to another
state than what would be detected, we nicely ping-pong:
- Userspace calls probe, gets the forced state, but polling starts
  again.
- Polling notices that the state is actually different, wakes up
  userspace.
- Repeat.

As that commit already explains, the right fix would be to make the
locking more fine-grained, so that hotplug detection on one output
does not interfere with cursor updates on another crtc.

But that is way too much work. So let's just safe this gross hack by
caching the last-seen state of drm_kms_helper_poll for that driver,
and only fire up the poll engine again if it changed from off to on.

v2: Fixup the edge detection of drm_kms_helper_poll.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49907
Tested-by: Tvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: properly init/reset connector status
Daniel Vetter [Tue, 23 Oct 2012 18:23:35 +0000 (18:23 +0000)]
drm: properly init/reset connector status

This can help drivers to make somewhat intelligent decisions in their
->detect callback: If the connector is hpd capable and in the unknown
state, the driver needs to force a full detect cycle. Otherwise it
could just (if it chooses so) to update the connector state from it's
hpd handler directly, and always return that in the ->detect callback.

Atm only drm/i915 calls drm_mode_config_reset at resume time, so other
drivers would need to add that call first before using this facility.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: run the hpd irq event code directly
Daniel Vetter [Tue, 23 Oct 2012 18:23:34 +0000 (18:23 +0000)]
drm: run the hpd irq event code directly

All drivers already have a work item to run the hpd code, so we don't
need to launch a new one in the helper code. Dave Airlie mentioned
that the cancel+re-queue might paper over DP related hpd ping-pongs,
hence why this is split out.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: handle HPD and polled connectors separately
Daniel Vetter [Tue, 23 Oct 2012 18:23:33 +0000 (18:23 +0000)]
drm: handle HPD and polled connectors separately

Instead of reusing the polling code for hpd handling, split them up.
This has a few consequences:
- Don't touch HPD capable connectors in the poll loop.
- Only touch HPD capable connectors in drm_helper_hpd_irq_event.
- We could run the HPD handling directly (because all callers already
  use their own work item), but for easier bisect that happens in it's
  own patch.

The ultimate goal is that drivers grow some smarts about which
connectors have received a hotplug event and only call the detect code
of that connector. But that's a second step.

v2: s/hdp/hpd/, noticed by Adam Jackson. I can't type.

v3: Split out the work item removal as requested by Dave Airlie. This
results in a temporary mode_config.hpd_irq_work item to keep things
the same.

v4: In the hpd_irq_event handler don't bail out if other bits than HPD
are set. This is useful where e.g. hpd is unreliably, but mostly
works. Drivers can then set both HPD and POLL flags, and users get the
best of both worlds: Quick hotplug feedback if the hpd works, but
still reliable detection with the polling. The poll loop already works
the same, and doesn't bail if HPD is set.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: extract drm_kms_helper_hotplug_event
Daniel Vetter [Tue, 23 Oct 2012 18:23:32 +0000 (18:23 +0000)]
drm: extract drm_kms_helper_hotplug_event

Useful if drivers want to be slightly more clever about hotplug
handling.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: add drm_send_vblank_event() helper (v5)
Rob Clark [Tue, 16 Oct 2012 22:48:40 +0000 (22:48 +0000)]
drm: add drm_send_vblank_event() helper (v5)

A helper that drivers can use to send vblank event after a pageflip.
If the driver doesn't support proper vblank irq based time/seqn then
just pass -1 for the pipe # to get do_gettimestamp() behavior (since
there are a lot of drivers that don't use drm_vblank_count_and_time())

Also an internal send_vblank_event() helper for the various other code
paths within drm_irq that also need to send vblank events.

v1: original
v2: add back 'vblwait->reply.sequence = seq' which should not have
    been deleted
v3: add WARN_ON() in case lock is not held and comments
v4: use WARN_ON_SMP() instead to fix issue with !SMP && !DEBUG_SPINLOCK
    as pointed out by Marcin Slusarz
v5: update docbook

Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: tegra: Add HDMI support
Thierry Reding [Thu, 15 Nov 2012 21:28:23 +0000 (21:28 +0000)]
drm: tegra: Add HDMI support

This commit adds support for the HDMI output on the Tegra20 SoC. Only
one such output is available, but it can be driven by either of the two
display controllers.

A lot of work on this patch has been contributed by NVIDIA's Mark Zhang
<markz@nvidia.com> and many other people at NVIDIA were very helpful in
getting the HDMI support and surrounding infrastructure to work.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Mark Zhang <markz@nvidia.com>
Reviewed-by: Mark Zhang <markz@nvidia.com>
Tested-by: Mark Zhang <markz@nvidia.com>
Tested-and-acked-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Add NVIDIA Tegra20 support
Thierry Reding [Thu, 15 Nov 2012 21:28:22 +0000 (21:28 +0000)]
drm: Add NVIDIA Tegra20 support

This commit adds a KMS driver for the Tegra20 SoC. This includes basic
support for host1x and the two display controllers found on the Tegra20
SoC. Each display controller can drive a separate RGB/LVDS output.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Mark Zhang <markz@nvidia.com>
Reviewed-by: Mark Zhang <markz@nvidia.com>
Tested-by: Mark Zhang <markz@nvidia.com>
Tested-and-acked-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/udl: Add missing static storage class specifiers in udl_connector.c
Sachin Kamat [Mon, 19 Nov 2012 05:27:43 +0000 (05:27 +0000)]
drm/udl: Add missing static storage class specifiers in udl_connector.c

Fixes the following sparse warnings:
drivers/gpu/drm/udl/udl_connector.c:80:20: warning:
symbol 'udl_best_single_encoder' was not declared. Should it be static?
drivers/gpu/drm/udl/udl_connector.c:93:5: warning:
symbol 'udl_connector_set_property' was not declared. Should it be static?
drivers/gpu/drm/udl/udl_connector.c:106:35: warning:
symbol 'udl_connector_helper_funcs' was not declared. Should it be static?
drivers/gpu/drm/udl/udl_connector.c:112:28: warning:
symbol 'udl_connector_funcs' was not declared. Should it be static?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/drm_stub: Remove unnecessary null check before kfree.
Sachin Kamat [Mon, 19 Nov 2012 09:44:59 +0000 (09:44 +0000)]
drm/drm_stub: Remove unnecessary null check before kfree.

kfree on a null argument is a no-op.
Silences the following smatch warning:
drivers/gpu/drm/drm_stub.c:496 drm_put_dev() info:
redundant null check on dev->devname calling kfree()

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/fb_helper: Fix potential NULL pointer dereference
Sachin Kamat [Mon, 19 Nov 2012 09:44:58 +0000 (09:44 +0000)]
drm/fb_helper: Fix potential NULL pointer dereference

kcalloc returns NULL on failure. Hence check for the return value
and exit on error to avoid NULL pointer dereference.

Fixes the following smatch errors:
drivers/gpu/drm/drm_fb_helper.c:1271 drm_setup_crtcs() error:
potential null dereference 'modes'.  (kcalloc returns null)
drivers/gpu/drm/drm_fb_helper.c:1272 drm_setup_crtcs() error:
potential null dereference 'crtcs'.  (kcalloc returns null)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/crtc: Fix potential NULL pointer dereference
Sachin Kamat [Mon, 19 Nov 2012 09:44:57 +0000 (09:44 +0000)]
drm/crtc: Fix potential NULL pointer dereference

drm_property_create_blob() could return NULL in which case NULL pointer
dereference error (on connector->edid_blob_ptr) is possible. Return if
connector->edid_blob_ptr is NULL.

Fixes the following smatch error:
drivers/gpu/drm/drm_crtc.c:3186 drm_mode_connector_update_edid_property()
error: potential null dereference 'connector->edid_blob_ptr'.
(drm_property_create_blob returns null)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/crtc: Remove redundant NULL check before kfree
Sachin Kamat [Mon, 19 Nov 2012 09:44:56 +0000 (09:44 +0000)]
drm/crtc: Remove redundant NULL check before kfree

kfree() on a NULL input is a no-op. Hence remove the check.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: Reject addfb2 with undefined flag bits set
Ville Syrjälä [Thu, 8 Nov 2012 09:09:42 +0000 (09:09 +0000)]
drm: Reject addfb2 with undefined flag bits set

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: fix documentation for drm_crtc_set_mode()
Alex Deucher [Fri, 9 Nov 2012 17:26:32 +0000 (17:26 +0000)]
drm: fix documentation for drm_crtc_set_mode()

x and y parameters are offsets, not width/height

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: get cea video id code for a given display mode
Stephane Marchesin [Fri, 9 Nov 2012 16:21:05 +0000 (16:21 +0000)]
drm: get cea video id code for a given display mode

This patch adds support for getting CEA Video ID Code for a given
display mode after matching with edid_cea_modes list. Its index in
the list added with one, gives the desired code.

This exported function will be used by hdmi drivers for composing
AVI info frame data.

Signed-off-by: Stephane Marchesin <marcheu@chromium.org>
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/drm_fb_helper: Remove unnecessary braces
Sachin Kamat [Thu, 15 Nov 2012 03:43:30 +0000 (03:43 +0000)]
drm/drm_fb_helper: Remove unnecessary braces

Remove unnecessary braces to silence the following type of
checkpatch warnings:
WARNING: braces {} are not necessary for single statement blocks
WARNING: braces {} are not necessary for any arm of this statement

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/fb_helper: Convert printk to pr_* and dev_*
Sachin Kamat [Thu, 15 Nov 2012 03:43:29 +0000 (03:43 +0000)]
drm/fb_helper: Convert printk to pr_* and dev_*

Converted printks to pr_* and dev_* to silence checkpatch warnings.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/fb_helper: Fix checkpatch errors
Sachin Kamat [Thu, 15 Nov 2012 03:43:28 +0000 (03:43 +0000)]
drm/fb_helper: Fix checkpatch errors

Fixes the following checkpatch errors:
ERROR: trailing statements should be on next line
98: FILE: gpu/drm/drm_fb_helper.c:98:
case DRM_FORCE_OFF: s = "OFF"; break;
ERROR: trailing statements should be on next line
99: FILE: gpu/drm/drm_fb_helper.c:99:
case DRM_FORCE_ON_DIGITAL: s = "ON - dig"; break;
ERROR: trailing statements should be on next line
101: FILE: gpu/drm/drm_fb_helper.c:101:
case DRM_FORCE_ON: s = "ON"; break;

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm: fix returning -EINVAL on setmaster if another master is active
David Herrmann [Thu, 15 Nov 2012 13:04:37 +0000 (13:04 +0000)]
drm: fix returning -EINVAL on setmaster if another master is active

We link every DRM "file_priv" to a "drm_master" structure. Currently, the
drmSetMaster() call returns 0 when there is _any_ active master associated
with the "drm_master" structure of the calling "file_priv". This means,
that after drmSetMaster() we are not guaranteed to be DRM-Master and might
not be able to perform mode-setting.

A way to reproduce this is by starting weston with the DRM backend from
within an X-console (eg., xterm). Because the xserver's "drm_master" is
currently active, weston is assigned to the same master but is inactive
because its VT is inactive and the xserver is still active. But when
"fake-activating" weston, it calls drmSetMaster(). With current behavior
this returns "0/success" and weston thinks that it is DRM-Master, even
though it is not (as the xserver is still DRM-Master).
Expected behavior would be drmSetMaster() to return -EINVAL, because the
xserver is still DRM-Master. This patch changes exactly that.

The only way this bogus behavior would be useful is for clients to check
whether their associated "drm_master" is currently the active DRM-Master.
But this logic fails if no DRM-Master is currently active at all. Because
then the client itself would become DRM-Master (if it is root) and this
makes this whole thing useles.

Also note that the second "if-condition":
  file_priv->minor->master != file_priv->master
is always true and can be skipped.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoMerge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel into...
Dave Airlie [Mon, 19 Nov 2012 23:22:35 +0000 (09:22 +1000)]
Merge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel into drm-next

Daniel writes:
Highlights of this -next round:
- ivb fdi B/C fixes
- hsw sprite/plane offset fixes from Damien
- unified dp/hdmi encoder for hsw, finally external dp support on hsw
  (Paulo)
- kill-agp and some other prep work in the gtt code from Ben
- some fb handling fixes from Ville
- massive pile of patches to align hsw VGA with the spec and make it
  actually work (Paulo)
- pile of workarounds from Jesse, mostly for vlv, but also some other
  related platforms
- start of a dev_priv reorg, that thing grew out of bounds and chaotic
- small bits&pieces all over the place, down to better error handling for
  load-detect on gen2 (Chris, Jani, Mika, Zhenyu, ...)

On top of the previous pile (just copypasta):
- tons of hsw dp prep patches form Paulo
- round scheduled work items and timers to nearest second (Chris)
- some hw workarounds (Jesse&Damien)
- vlv dp support and related fixups (Vijay et al.)
- basic haswell dp support, not yet wired up for external ports (Paulo)
- edp support (Paulo)
- tons of refactorings to prepare for the above (Paulo)
- panel rework, unifiying code between lvds and edp panels (Jani)
- panel fitter scaling modes (Jani + Yuly Novikov)
- panel power improvements, should now work without the BIOS setting it up
- extracting some dp helpers from radeon/i915 and move them to
  drm_dp_helper.c
- randome pile of workarounds (Damien, Ben, ...)
- some cleanups for the register restore code for suspend/resume
- secure batchbuffer support, should enable tear-free blits on gen6+
  Chris)
- random smaller fixlets and cleanups.

* 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel: (231 commits)
  drm/i915: Restore physical HWS_PGA after resume
  drm/i915: Report amount of usable graphics memory in MiB
  drm/i915/i2c: Track users of GMBUS force-bit
  drm/i915: Allocate the proper size for contexts.
  drm/i915: Update load-detect failure paths for modeset-rework
  drm/i915: Clear unused fields of mode for framebuffer creation
  drm/i915: Always calculate 8xx WM values based on a 32-bpp framebuffer
  drm/i915: Fix sparse warnings in from AGP kill code
  drm/i915: Missed lock change with rps lock
  drm/i915: Move the remaining gtt code
  drm/i915: flush system agent TLBs on SNB
  drm/i915: Kill off now unused gen6+ AGP code
  drm/i915: Calculate correct stolen size for GEN7+
  drm/i915: Stop using AGP layer for GEN6+
  drm/i915: drop the double-OP_STOREDW usage in blt_ring_flush
  drm/i915: don't rewrite the GTT on resume v4
  drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex
  drm/i915: put ring frequency and turbo setup into a work queue v5
  drm/i915: don't block resume on fb console resume v2
  drm/i915: extract l3_parity substruct from dev_priv
  ...

12 years agodrm/i915: Restore physical HWS_PGA after resume
Chris Wilson [Fri, 16 Nov 2012 11:43:20 +0000 (11:43 +0000)]
drm/i915: Restore physical HWS_PGA after resume

By always setting up the HWS register for both physical and virtual
address variations during render ring we can reduce the number of
different special cases that get set up at varying different times
during module load.

Fixes regression from

commit c630119f43471a8ece356b01dabf07f944f453b3
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Oct 17 11:32:57 2012 +0200

    drm/i915: don't save/restore HWS_PGA reg for kms

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/i915: Report amount of usable graphics memory in MiB
Chris Wilson [Sun, 11 Nov 2012 09:34:45 +0000 (09:34 +0000)]
drm/i915: Report amount of usable graphics memory in MiB

...rather than kilo-PTE.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Apply s/Usabel/usable/ bikeshed suggested by Ben Widawsky.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm/i915/i2c: Track users of GMBUS force-bit
Chris Wilson [Sat, 10 Nov 2012 15:58:21 +0000 (15:58 +0000)]
drm/i915/i2c: Track users of GMBUS force-bit

This fixes a regression for SDVO from

commit fbfcc4f3a0cf8bbde87646b74241faa8e37426bf
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Mon Oct 22 16:12:18 2012 +0300

    drm/i915/sdvo: restore i2c adapter config on intel_sdvo_init() failures

As SDVOB and SDVOC are multiplexed on the same pin, if a chipset does
not have the second SDVO encoder, it will then remove the force-bit
setting on the common i2c adapter during teardown. All subsequent
attempts of trying to use GMBUS with SDVOB then fail.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
[danvet: fixup inversion in the debug printout, noticed by Jani
Nikulai.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>