GitHub/LineageOS/android_kernel_motorola_exynos9610.git
11 years agodrm/nvd0/disp: call into core to handle sor power state changes
Ben Skeggs [Thu, 8 Nov 2012 02:01:39 +0000 (12:01 +1000)]
drm/nvd0/disp: call into core to handle sor power state changes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0/disp: move link training helpers into core as display methods
Ben Skeggs [Wed, 7 Nov 2012 06:43:00 +0000 (16:43 +1000)]
drm/nvd0/disp: move link training helpers into core as display methods

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: allow representing method ranges in nouveau_omthds
Ben Skeggs [Wed, 7 Nov 2012 06:28:35 +0000 (16:28 +1000)]
drm/nouveau/core: allow representing method ranges in nouveau_omthds

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: expose full method calling capabilities with nv_exec
Ben Skeggs [Wed, 7 Nov 2012 06:16:41 +0000 (16:16 +1000)]
drm/nouveau/core: expose full method calling capabilities with nv_exec

nv_call() just allows mthd+u32 submission, nv_exec() exposes the
mthd+data+size interface which will be used in future commits.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: implement "full" BIT 'd' table (and subtable) parsing in core
Ben Skeggs [Tue, 6 Nov 2012 06:03:51 +0000 (16:03 +1000)]
drm/nouveau/bios: implement "full" BIT 'd' table (and subtable) parsing in core

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0/disp: move remaining interrupt handling to core
Ben Skeggs [Fri, 2 Nov 2012 01:33:27 +0000 (11:33 +1000)]
drm/nvd0/disp: move remaining interrupt handling to core

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: add some missing subdev/engine disable flags
Ben Skeggs [Thu, 1 Nov 2012 01:09:53 +0000 (11:09 +1000)]
drm/nouveau/core: add some missing subdev/engine disable flags

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: implement BIT 'U' table (and subtable) parsing in core
Ben Skeggs [Fri, 2 Nov 2012 01:02:47 +0000 (11:02 +1000)]
drm/nouveau/bios: implement BIT 'U' table (and subtable) parsing in core

This will, in the near future, replace what's currently in the DRM
nouveau_bios.c code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0/disp: allocate display and evo channels from driver core
Ben Skeggs [Tue, 16 Oct 2012 04:18:32 +0000 (14:18 +1000)]
drm/nvd0/disp: allocate display and evo channels from driver core

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: run mode_config destructor before destroying internal display state
Ben Skeggs [Tue, 30 Oct 2012 00:59:12 +0000 (10:59 +1000)]
drm/nouveau: run mode_config destructor before destroying internal display state

Later changes will depend on being able to pull down CRTCs etc with the
master display state still intact.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/drm/nvd0/disp: display->disp
Ben Skeggs [Mon, 29 Oct 2012 03:36:45 +0000 (13:36 +1000)]
drm/nouveau/drm/nvd0/disp: display->disp

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0/disp: introduce a nvd0_head as a subclass of nouveau_crtc
Ben Skeggs [Tue, 16 Oct 2012 04:00:31 +0000 (14:00 +1000)]
drm/nvd0/disp: introduce a nvd0_head as a subclass of nouveau_crtc

This will be used instead of storing a heap of per-head data (such as evo
channels) in nvd0_display in some other way.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0-nve0/disp: initial implementation of evo channel classes
Ben Skeggs [Tue, 28 Aug 2012 04:10:39 +0000 (14:10 +1000)]
drm/nvd0-nve0/disp: initial implementation of evo channel classes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/disp: allow PCI_US pushbuf binding
Ben Skeggs [Tue, 30 Oct 2012 00:03:38 +0000 (10:03 +1000)]
drm/nv50/disp: allow PCI_US pushbuf binding

11 years agodrm/nv50/disp: initial implementation of the various channel object classes
Ben Skeggs [Tue, 14 Aug 2012 04:11:49 +0000 (14:11 +1000)]
drm/nv50/disp: initial implementation of the various channel object classes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/disp: enable interrupts and setup memory area
Ben Skeggs [Tue, 14 Aug 2012 02:50:14 +0000 (12:50 +1000)]
drm/nv50/disp: enable interrupts and setup memory area

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/disp: copy caps to evo
Ben Skeggs [Tue, 14 Aug 2012 01:29:57 +0000 (11:29 +1000)]
drm/nv50/disp: copy caps to evo

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/disp: create skeleton display/channel object classes
Ben Skeggs [Tue, 14 Aug 2012 00:04:04 +0000 (10:04 +1000)]
drm/nv50/disp: create skeleton display/channel object classes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0/dmaobj: initial bind() method implementation
Ben Skeggs [Mon, 8 Oct 2012 04:44:00 +0000 (14:44 +1000)]
drm/nvd0/dmaobj: initial bind() method implementation

Currently unused, and rudimentary.  Lots to figure out here still, but
this is sufficient for what disp will need.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvc0/dmaobj: implement initial bind() method
Ben Skeggs [Mon, 8 Oct 2012 04:34:35 +0000 (14:34 +1000)]
drm/nvc0/dmaobj: implement initial bind() method

Currently unused.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/dmaobj: extend class to allow gpu-specific attributes to be defined
Ben Skeggs [Mon, 8 Oct 2012 04:29:16 +0000 (14:29 +1000)]
drm/nv50/dmaobj: extend class to allow gpu-specific attributes to be defined

disp is going to need to be able to create more specific dma objects
than was previously possible.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0/dmaobj: duplicate fermi class, will diverge real soon now
Ben Skeggs [Mon, 8 Oct 2012 04:11:35 +0000 (14:11 +1000)]
drm/nvd0/dmaobj: duplicate fermi class, will diverge real soon now

The hardware dmaobj format completely changed in GF119, so these will
need a separate implementation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>