OSDN Git Service

uclinux-h8/linux.git
10 years agoMerge tag 'vmwgfx-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux...
Dave Airlie [Sat, 5 Apr 2014 06:08:27 +0000 (16:08 +1000)]
Merge tag 'vmwgfx-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux into drm-next

Pull request of 2014-04-04

The second vmwgfx pull request for the 3.15 merge window.
Contains a fbdev fix by Christopher Friedt, one fix for a locking order
violation introduced in 3.14 (hit when using queries) and finally a
removal of the DRM_AUTH requirement around some vmwgfx IOCTLS where the
caller is already required to have an open handle to the object.

* tag 'vmwgfx-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: correct fb_fix_screeninfo.line_length
  drm/vmwgfx: Remove authorization requirements around some more ioctls
  drm/vmwgfx: Fix query buffer locking order violation

10 years agoMerge tag 'ttm-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux into...
Dave Airlie [Sat, 5 Apr 2014 06:07:39 +0000 (16:07 +1000)]
Merge tag 'ttm-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux into drm-next

Pull request of 2014-04-04

Currently only a single patch fixing up mixed use of the ttm_bo_reserve and
ww_mutex APIs

* tag 'ttm-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux:
  drm/ttm: Hide the implementation details of reservation

10 years agodrm/dp_helper: don't return EPROTO for defers (v2)
Dave Airlie [Fri, 4 Apr 2014 01:34:37 +0000 (11:34 +1000)]
drm/dp_helper: don't return EPROTO for defers (v2)

If we get a msg.reply of REPLY_DEFER, we also get an err of 0
so we fail reads with 0 < size and return -EPROTO instead of trying
again.

v2: same fix in i2c code.

Found writing MST support.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/ttm: Hide the implementation details of reservation
Thomas Hellstrom [Thu, 20 Feb 2014 10:36:25 +0000 (11:36 +0100)]
drm/ttm: Hide the implementation details of reservation

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm: gem-cma: Fix warnings due to improper printk formats
Laurent Pinchart [Tue, 4 Mar 2014 18:10:17 +0000 (19:10 +0100)]
drm: gem-cma: Fix warnings due to improper printk formats

Use the %pad printk specifier to print dma_addr_t variables. This fixes
warnings on platforms where dma_addr_t has a different size than int or
size_t.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/cma: Use dma_mmap_writecombine() to mmap buffer
Laurent Pinchart [Sun, 2 Mar 2014 19:09:48 +0000 (20:09 +0100)]
drm/cma: Use dma_mmap_writecombine() to mmap buffer

The GEM CMA helpers uses a custom mmap implementation based on
remap_pfn_range(). While this works when the buffer DMA and physical
addresses are identical, it fails to take IOMMU into account and tries
to mmap the buffer to userspace using the DMA virtual address instead of
the physical address. This results in mapping random physical pages when
the device is behind an IOMMU.

Use the DMA mapping dma_mmap_writecombine() function instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/mm: Fix search for smallest hole satisfying constraints
Michel Dänzer [Wed, 19 Mar 2014 08:37:14 +0000 (17:37 +0900)]
drm/mm: Fix search for smallest hole satisfying constraints

entry->size is the size of the node, not the size of the hole after it.
So the code would actually find the hole which can satisfy the
constraints and which is preceded by the smallest node, not the smallest
hole satisfying the constraints.

Reported-by: "Huang, FrankR" <FrankR.Huang@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/cma: include <drm/drmP.h> as needed
Shawn Guo [Mon, 24 Mar 2014 12:14:48 +0000 (20:14 +0800)]
drm/cma: include <drm/drmP.h> as needed

The following error and warnings will be seen when compiling a C file
which includes <drm/drm_gem_cma_helper.h> but without <drm/drmP.h>
being included before.

include/drm/drm_gem_cma_helper.h:5:24: error: field ‘base’ has incomplete type
include/drm/drm_gem_cma_helper.h: In function ‘to_drm_gem_cma_obj’:
include/drm/drm_gem_cma_helper.h:16:9: warning: initialization from incompatible pointer type [enabled by default]
include/drm/drm_gem_cma_helper.h: At top level:
include/drm/drm_gem_cma_helper.h:24:34: warning: ‘struct drm_mode_create_dumb’ declared inside parameter list [enabled by default]
include/drm/drm_gem_cma_helper.h:24:34: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
include/drm/drm_gem_cma_helper.h:24:34: warning: ‘struct drm_device’ declared inside parameter list [enabled by default]
include/drm/drm_gem_cma_helper.h:24:34: warning: ‘struct drm_file’ declared inside parameter list [enabled by default]
include/drm/drm_gem_cma_helper.h:28:10: warning: ‘struct drm_device’ declared inside parameter list [enabled by default]
include/drm/drm_gem_cma_helper.h:28:10: warning: ‘struct drm_file’ declared inside parameter list [enabled by default]
include/drm/drm_gem_cma_helper.h:35:3: warning: ‘struct drm_device’ declared inside parameter list [enabled by default]
include/drm/drm_gem_cma_helper.h:46:14: warning: ‘struct drm_device’ declared inside parameter list [enabled by default]

Fix them by including <drm/drmP.h> in drm_gem_cma_helper.h.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Prefer noninterlace cmdline mode unless explicitly specified
Takashi Iwai [Wed, 19 Mar 2014 13:53:13 +0000 (14:53 +0100)]
drm: Prefer noninterlace cmdline mode unless explicitly specified

Currently drm_pick_cmdline_mode() doesn't care about the interlace
when the given mode line has no "i" suffix.  That is, when there are
multiple entries for the same resolution, an interlace mode might be
picked up just depending on the assigned order, and there is no way to
exclude it.

This patch changes the logic for the mode selection, to prefer the
noninterlace mode unless the interlace mode is explicitly given.
When no matching mode is found, it still tries the interlace mode as
fallback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/radeon: Use two-ended allocation by size, v2
Lauri Kasanen [Wed, 2 Apr 2014 17:33:42 +0000 (20:33 +0300)]
drm/radeon: Use two-ended allocation by size, v2

This decreases eviction by up to 20%, by improving the fragmentation
quality. No harm in normal cases that fit VRAM fully (PTS gaming suite).

In some cases, even the VRAM-fitting cases improved slightly (openarena, urban terror).

512kb was measured as the most optimal threshold for 3d workloads common to radeon.
Other drivers may need different thresholds according to their workloads.

v2: Nicer formatting
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Add support for two-ended allocation, v3
Lauri Kasanen [Wed, 2 Apr 2014 17:03:57 +0000 (20:03 +0300)]
drm: Add support for two-ended allocation, v3

Clients like i915 need to segregate cache domains within the GTT which
can lead to small amounts of fragmentation. By allocating the uncached
buffers from the bottom and the cacheable buffers from the top, we can
reduce the amount of wasted space and also optimize allocation of the
mappable portion of the GTT to only those buffers that require CPU
access through the GTT.

For other drivers, allocating small bos from one end and large ones
from the other helps improve the quality of fragmentation.

Based on drm_mm work by Chris Wilson.

v3: Changed to use a TTM placement flag
v2: Updated kerneldoc

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Christian König <deathsimple@vodafone.de>
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: David Airlie <airlied@redhat.com>
10 years agoMerge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
Dave Airlie [Thu, 3 Apr 2014 22:03:21 +0000 (08:03 +1000)]
Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next

* 'msm-next' of git://people.freedesktop.org/~robclark/linux:
  drm/omap: Don't dereference list head when the connectors list is empty
  drm/msm/mdp: add timeout for irq wait
  drm/msm: validate flags, etc
  drm/msm: use componentised device support
  drm/msm: add chip-id param
  drm/msm: crank down gpu when inactive
  drm/msm: spin helper
  drm/msm: add hang_debug module param
  drm/msm: hdmi audio support

10 years agodrm/rcar-du: Handle encoder initialization failures
Laurent Pinchart [Tue, 1 Apr 2014 11:03:52 +0000 (13:03 +0200)]
drm/rcar-du: Handle encoder initialization failures

The rcar_du_encoder_init() function can fail and return an error code.
Don't ignore it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'drm-next-3.15' of git://people.freedesktop.org/~deathsimple/linux into...
Dave Airlie [Thu, 3 Apr 2014 21:58:24 +0000 (07:58 +1000)]
Merge branch 'drm-next-3.15' of git://people.freedesktop.org/~deathsimple/linux into drm-next

- Rework of finding the right PLL numbers for display
- Couple of different bugfixes

* 'drm-next-3.15' of git://people.freedesktop.org/~deathsimple/linux:
  drm/radeon: fix typo in spectre_golden_registers
  drm/radeon: fix endian swap on hawaii clear state buffer setup
  drm/radeon: call drm_edid_to_eld when we update the edid
  drm/radeon: rework finding display PLL numbers v2
  drm/radeon: fix resuming mode in pm runtime resume path
  drm/radeon: fix runtime suspend breaking secondary GPUs
  drm/radeon: clear needs_reset flag if IB test fails

10 years agodrm/radeon: fix typo in spectre_golden_registers
Alex Deucher [Wed, 2 Apr 2014 12:42:49 +0000 (08:42 -0400)]
drm/radeon: fix typo in spectre_golden_registers

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: fix endian swap on hawaii clear state buffer setup
Alex Deucher [Wed, 2 Apr 2014 12:42:48 +0000 (08:42 -0400)]
drm/radeon: fix endian swap on hawaii clear state buffer setup

Need to swap on BE.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: call drm_edid_to_eld when we update the edid
Alex Deucher [Mon, 31 Mar 2014 15:19:46 +0000 (11:19 -0400)]
drm/radeon: call drm_edid_to_eld when we update the edid

This needs to be done to update some of the fields in
the connector structure used by the audio code.

Noticed by several users on irc.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: rework finding display PLL numbers v2
Christian König [Fri, 28 Mar 2014 17:55:10 +0000 (18:55 +0100)]
drm/radeon: rework finding display PLL numbers v2

This completely reworks how the PLL parameters are generated and
should result in better matching dot clock frequencies.

Probably needs quite a bit of testing.

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

v2: more cleanup and comments.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: fix resuming mode in pm runtime resume path
Dave Airlie [Thu, 27 Mar 2014 04:09:19 +0000 (14:09 +1000)]
drm/radeon: fix resuming mode in pm runtime resume path

For runtime pm we'd never suspend with the modesetting hw turned on,
so don't try and resume the modesetting hw, as that path will take
locks that the interface that is causing us to wake up might also
take.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/radeon: fix runtime suspend breaking secondary GPUs
Dave Airlie [Thu, 27 Mar 2014 04:09:18 +0000 (14:09 +1000)]
drm/radeon: fix runtime suspend breaking secondary GPUs

Same fix as for nouveau, when we fail with EINVAL, subsequent
gets fail hard, causing the device not to open.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/radeon: clear needs_reset flag if IB test fails
Christian König [Tue, 25 Mar 2014 10:41:40 +0000 (11:41 +0100)]
drm/radeon: clear needs_reset flag if IB test fails

If the IB test fails we don't want to reset the card over
and over again, just accept that it isn't working.

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

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/vmwgfx: correct fb_fix_screeninfo.line_length
Christopher Friedt [Sat, 1 Feb 2014 15:01:15 +0000 (10:01 -0500)]
drm/vmwgfx: correct fb_fix_screeninfo.line_length

Previously, the vmwgfx_fb driver would allow users to call FBIOSET_VINFO, but it would not adjust
the FINFO properly, resulting in distorted screen rendering. The patch corrects that behaviour.

See https://bugs.gentoo.org/show_bug.cgi?id=494794 for examples.

Cc: stable@vger.kernel.org
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
10 years agodrm/vmwgfx: Remove authorization requirements around some more ioctls
Thomas Hellstrom [Mon, 31 Mar 2014 09:01:08 +0000 (11:01 +0200)]
drm/vmwgfx: Remove authorization requirements around some more ioctls

These ioctls require a valid handle referenced by the caller to succeed,
which implies that the caller has or has had sufficient privileges.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Fix query buffer locking order violation
Thomas Hellstrom [Mon, 31 Mar 2014 08:20:30 +0000 (10:20 +0200)]
drm/vmwgfx: Fix query buffer locking order violation

The query buffers were reserved while holding the binding mutex, which
caused a circular locking dependency.

Cc: stable@vger.kernel.org
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoMerge tag 'drm-intel-next-2014-03-21' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Wed, 2 Apr 2014 21:51:54 +0000 (07:51 +1000)]
Merge tag 'drm-intel-next-2014-03-21' of git://anongit.freedesktop.org/drm-intel into drm-next

- Inherit/reuse firmwar framebuffers (for real this time) from Jesse, less
  flicker for fastbooting.
- More flexible cloning for hdmi (Ville).
- Some PPGTT fixes from Ben.
- Ring init fixes from Naresh Kumar.
- set_cache_level regression fixes for the vma conversion from Ville&Chris.
- Conversion to the new dp aux helpers (Jani).
- Unification of runtime pm with pc8 support from Paulo, prep work for runtime
  pm on other platforms than HSW.
- Larger cursor sizes (Sagar Kamble).
- Piles of improvements and fixes all over, as usual.

* tag 'drm-intel-next-2014-03-21' of git://anongit.freedesktop.org/drm-intel: (75 commits)
  drm/i915: Include a note about the dangers of I915_READ64/I915_WRITE64
  drm/i915/sdvo: fix questionable return value check
  drm/i915: Fix unsafe loop iteration over vma whilst unbinding them
  drm/i915: Enabling 128x128 and 256x256 ARGB Cursor Support
  drm/i915: Print how many objects are shared in per-process stats
  drm/i915: Per-process stats work better when evaluated per-process
  drm/i915: remove rps local variables
  drm/i915: Remove extraneous MMIO for RPS
  drm/i915: Rename and comment all the RPS *stuff*
  drm/i915: Store the HW min frequency as min_freq
  drm/i915: Fix coding style for RPS
  drm/i915: Reorganize the overclock code
  drm/i915: init pm.suspended earlier
  drm/i915: update the PC8 and runtime PM documentation
  drm/i915: rename __hsw_do_{en, dis}able_pc8
  drm/i915: kill struct i915_package_c8
  drm/i915: move pc8.irqs_disabled to pm.irqs_disabled
  drm/i915: remove dev_priv->pc8.enabled
  drm/i915: don't get/put PC8 when getting/putting power wells
  drm/i915: make intel_aux_display_runtime_get get runtime PM, not PC8
  ...

Conflicts:
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c

10 years agoMerge branch 'primary-plane' of git://people.freedesktop.org/~robclark/linux into...
Dave Airlie [Wed, 2 Apr 2014 00:31:43 +0000 (10:31 +1000)]
Merge branch 'primary-plane' of git://people.freedesktop.org/~robclark/linux into drm-next

Here's the latest iteration of the universal planes work, which I believe is
finally ready for merging.  Aside from the minor driver patches to use the
new drm_for_each_legacy_plane() macro for plane loops, these should all have
an r-b from Rob Clark now.

Actual userspace-visibility is currently hidden behind a
drm.universal_planes module parameter so that we can do some experimental
testing of this before flipping it on universally.

* 'primary-plane' of git://people.freedesktop.org/~robclark/linux:
  drm/doc: Update plane documentation and add plane helper library
  drm: Allow userspace to ask for universal plane list (v2)
  drm: Remove unused drm_crtc->fb
  drm: Replace crtc fb with primary plane fb (v3)
  drm/msm: Switch to universal plane API's
  drm: Add drm_crtc_init_with_planes() (v2)
  drm: Add plane type property (v2)
  drm: Add drm_universal_plane_init()
  drm: Add primary plane helpers (v3)
  drm: Make drm_crtc_check_viewport non-static
  drm/shmobile: Restrict plane loops to only operate on legacy planes
  drm/i915: Restrict plane loops to only operate on overlay planes (v2)
  drm/exynos: Restrict plane loops to only operate on overlay planes (v2)
  drm: Add support for multiple plane types (v2)

10 years agodrm/crtc-helper: don't disable disconnected outputs
Daniel Vetter [Tue, 1 Apr 2014 20:15:00 +0000 (22:15 +0200)]
drm/crtc-helper: don't disable disconnected outputs

This is the equivalent change in the crtc helpers as done to the i915
modeset infrastructure in

commit b0a2658acb5bf9ca86b4aab011b7106de3af0add
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue Dec 18 09:37:54 2012 +0100

    drm/i915: don't disable disconnected outputs

This was originally introduced to make encoder sharing on radone
easier for userspace, but:

- It is policy and as such belongs into userspace. E.g. personally I'm
  fairly annoyed that a flaky cable results in permanent changes of
  the desktop layout, so I'll kick out DEs which do this. Worse if the
  kernel also tries to be clever.

- It's inconsistent: We only kill disconnected outputs on setCrtc
  (which userspace might also call when just changing the
  framebuffer), but not when e.g. we receive a hpd event or in the
  output poll worker.

- It's unexpected behaviour for the userspace driver, at least in the
  intel ddx we've had tons of bugs where the driver fell over and
  killed the X session becuase pageflips/vblanks suddenly stopped
  working. We've had to fix this by wrapping every single setCrtc int
  a big "recover kms state from the kernel again" operation.

- It's suprising for the kernel, too: It took a few mails between Rob,
  Matt and me for them to notice that little dragon wreaking havoc
  with the universal plane framebuffer refcounting.

- Userspace can cope with it and e.g. Gnome already kills disconnected
  outputs and reconfigures the desktop automatically. And since there
  have been no regression reports for the i915 change from over 1 year
  ago I think all other DEs are also ready.

Note that the lines removed in this patch go back to

commit a3a0544b2c84e1d7a2022b558ecf66d8c6a8dd93
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Aug 31 15:16:30 2009 +1000

    drm/kms: add explicit encoder disable function and detach harder.

Unfortunately the patch itself doesn't explain a hole lot about why it
was added ...

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/crtc-helpers: fix dpms on logic
Daniel Vetter [Tue, 1 Apr 2014 20:14:59 +0000 (22:14 +0200)]
drm/crtc-helpers: fix dpms on logic

This was introduced in

commit 25f397a429dfa43f22c278d0119a60a343aa568f
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Jul 19 18:57:11 2013 +0200

    drm/crtc-helper: explicit DPMS on after modeset

but due to a bit of rebase fail on my side the patch actually merged
put one hunk on the wrong side of a break statement. Fix this up.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/qxl: unset a pointer in sync_obj_unref
Maarten Lankhorst [Tue, 1 Apr 2014 13:15:47 +0000 (15:15 +0200)]
drm/qxl: unset a pointer in sync_obj_unref

This fixes a BUG_ON(bo->sync_obj != NULL); in ttm_bo_release_list.

Cc: stable@vger.kernel.org #v3.10+
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Specify a bit more the DRM_CAP_CURSOR_{WIDTH, HEIGHT} caps
Lespiau, Damien [Fri, 28 Mar 2014 12:31:05 +0000 (12:31 +0000)]
drm: Specify a bit more the DRM_CAP_CURSOR_{WIDTH, HEIGHT} caps

Earlier this week, there was a bit of confusion about those new
capabilities, to the point I think it's better to document the intention
and API contract.

The comment documents the current situation:
 - the radeon driver returns the only valid size for the hw
 - i915 returns the maximun cursor size
 - other drivers fall back to returning 64x64

The common contract is to return a valid cursor size.

Cc: Sagar Kamble <sagar.a.kamble@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/nouveau: don't suspend/resume display on runtime s/r
Dave Airlie [Wed, 26 Mar 2014 04:10:06 +0000 (14:10 +1000)]
drm/nouveau: don't suspend/resume display on runtime s/r

This should ensure we don't hit a locking problem when someone
wakes us up via a connector, we should never go into suspend
while the display is on anyways.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/doc: Update plane documentation and add plane helper library
Matt Roper [Tue, 1 Apr 2014 22:22:43 +0000 (15:22 -0700)]
drm/doc: Update plane documentation and add plane helper library

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Allow userspace to ask for universal plane list (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:42 +0000 (15:22 -0700)]
drm: Allow userspace to ask for universal plane list (v2)

Userspace clients which wish to receive all DRM planes (primary and
cursor planes in addition to the traditional overlay planes) may set the
DRM_CLIENT_CAP_UNIVERSAL_PLANES capability.

v2: Hide behind drm.universal_planes module option [suggested by
    Daniel Vetter]

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Remove unused drm_crtc->fb
Matt Roper [Tue, 1 Apr 2014 22:22:41 +0000 (15:22 -0700)]
drm: Remove unused drm_crtc->fb

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Replace crtc fb with primary plane fb (v3)
Matt Roper [Tue, 1 Apr 2014 22:22:40 +0000 (15:22 -0700)]
drm: Replace crtc fb with primary plane fb (v3)

Now that CRTC's have a primary plane, there's no need to track the
framebuffer in the CRTC.  Replace all references to the CRTC fb with the
primary plane's fb.

This patch was generated by the Coccinelle semantic patching tool using
the following rules:

        @@ struct drm_crtc C; @@
        -   (C).fb
        +   C.primary->fb

        @@ struct drm_crtc *C; @@
        -   (C)->fb
        +   C->primary->fb

v3: Generate patch via coccinelle.  Actual removal of crtc->fb has been
    moved to a subsequent patch.

v2: Fixup several lingering crtc->fb instances that were missed in the
    first patch iteration.  [Rob Clark]

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: Switch to universal plane API's
Matt Roper [Tue, 1 Apr 2014 22:22:39 +0000 (15:22 -0700)]
drm/msm: Switch to universal plane API's

Use drm_universal_plane_init() and drm_crtc_init_with_planes() rather
than the legacy drm_plane_init() / drm_crtc_init().  This will ensure
that the proper primary plane is registered with the DRM (and eventually
exposed to userspace in future patches).

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Add drm_crtc_init_with_planes() (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:38 +0000 (15:22 -0700)]
drm: Add drm_crtc_init_with_planes() (v2)

Add a new drm_crtc_init_with_planes() to allow drivers to provide
specific primary and cursor planes at CRTC initialization.  The existing
drm_crtc_init() interface remains to avoid driver churn in existing
drivers; it will initialize the CRTC with a plane helper-created primary
plane and no cursor plane.

v2:
  - Move drm_crtc_init() to plane helper file so that nothing in the DRM
    core depends on helpers.  [suggested by Daniel Vetter]
  - Keep cursor parameter to drm_crtc_init_with_planes() a void* until
    we actually add cursor support.  [suggested by Daniel Vetter]

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Add plane type property (v2)
Rob Clark [Wed, 2 Apr 2014 00:16:57 +0000 (20:16 -0400)]
drm: Add plane type property (v2)

Add a plane type property to allow userspace to distinguish plane types.

v2: Driver-specific churn eliminated now that drm_plane_init() and
    drm_universal_plane_init() were separated out in a previous patch.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Add drm_universal_plane_init()
Matt Roper [Tue, 1 Apr 2014 22:22:36 +0000 (15:22 -0700)]
drm: Add drm_universal_plane_init()

Add a new plane initialization interface for universal plane support
that allows a specific plane type (primary, cursor, or overlay) to
be specified.

drm_plane_init() remains as a compatibility API to reduce churn in
existing drivers.  The 'bool priv' parameter has been changed to
'bool is_primary' under the assumption that all existing uses of
private planes were representing primary planes.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Add primary plane helpers (v3)
Matt Roper [Tue, 1 Apr 2014 22:22:35 +0000 (15:22 -0700)]
drm: Add primary plane helpers (v3)

When we expose non-overlay planes to userspace, they will become
accessible via standard userspace plane API's.  We should be able to
handle the standard plane operations against primary planes in a generic
way via the modeset handler.

Drivers that can program primary planes more efficiently, that want to
use their own primary plane structure to track additional information,
or that don't have the limitations assumed by the helpers are free to
provide their own implementation of some or all of these handlers.

v3: Tweak kerneldoc formatting slightly to avoid ugliness
v2:
 - Move plane helpers to a new file (drm_plane_helper.c)
 - Tighten checks on update handler (check for scaling, CRTC coverage,
   subpixel positioning)
 - Pass proper panning parameters to modeset interface
 - Disallow disabling primary plane (and thus CRTC) if other planes are
   still active on the CRTC.
 - Use a minimal format list that should work on all hardware/drivers.
   Drivers may call this function with a more accurate plane list to
   enable additional formats they can support.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm: Make drm_crtc_check_viewport non-static
Matt Roper [Tue, 1 Apr 2014 22:22:34 +0000 (15:22 -0700)]
drm: Make drm_crtc_check_viewport non-static

This function will be used by the universal plane helpers and may also
be useful for individual drivers.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/shmobile: Restrict plane loops to only operate on legacy planes
Matt Roper [Tue, 1 Apr 2014 22:22:33 +0000 (15:22 -0700)]
drm/shmobile: Restrict plane loops to only operate on legacy planes

Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
10 years agodrm/i915: Restrict plane loops to only operate on overlay planes (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:32 +0000 (15:22 -0700)]
drm/i915: Restrict plane loops to only operate on overlay planes (v2)

Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

v2: Switch to using drm_for_each_legacy_plane()

Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
10 years agodrm/exynos: Restrict plane loops to only operate on overlay planes (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:31 +0000 (15:22 -0700)]
drm/exynos: Restrict plane loops to only operate on overlay planes (v2)

Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

v2: Switch to using drm_for_each_legacy_plane()

Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
10 years agodrm: Add support for multiple plane types (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:30 +0000 (15:22 -0700)]
drm: Add support for multiple plane types (v2)

The DRM core currently only tracks "overlay"-style planes.  Start
refactoring the plane handling to allow other plane types (primary and
cursor) to also be placed on the DRM plane list.

v2: Add drm_for_each_legacy_plane() iterator to smooth transition
    of drivers with plane loops.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/omap: Don't dereference list head when the connectors list is empty
Laurent Pinchart [Tue, 24 Dec 2013 11:58:01 +0000 (12:58 +0100)]
drm/omap: Don't dereference list head when the connectors list is empty

The connectors list iterator returns the list head when the list is
empty. Fix it by returning NULL in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/mdp: add timeout for irq wait
Rob Clark [Mon, 24 Mar 2014 13:12:24 +0000 (09:12 -0400)]
drm/msm/mdp: add timeout for irq wait

Make things recover a bit more gracefully if we get stuck with no vblank
irq ever coming.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: validate flags, etc
Rob Clark [Mon, 3 Mar 2014 14:42:33 +0000 (09:42 -0500)]
drm/msm: validate flags, etc

After reading a nice article on LWN[1], I went back and double checked
my handling of invalid-input checking.  Turns out there were a couple
places I had missed.

Since the driver is fairly young, and the devices it supports are really
only just barely usable for basic stuff (serial console) with an
upstream kernel, I think we should fix this now and revert specific
parts of this patch later in the unlikely event that a regression is
reported.

[1] https://lwn.net/Articles/588444/

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: use componentised device support
Rob Clark [Mon, 3 Mar 2014 19:19:12 +0000 (14:19 -0500)]
drm/msm: use componentised device support

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: add chip-id param
Rob Clark [Tue, 4 Feb 2014 19:16:04 +0000 (14:16 -0500)]
drm/msm: add chip-id param

Some of the w/a or different behavior of userspace blob driver seem to
be keyed to gpu patch revision, rather than gpu-id.  So expose the full
chip-id to userspace so it can DTRT.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: crank down gpu when inactive
Rob Clark [Sat, 11 Jan 2014 21:25:08 +0000 (16:25 -0500)]
drm/msm: crank down gpu when inactive

Shut down the clks when the gpu has nothing to do.  A short inactivity
timer is used to provide a low pass filter for power transitions.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: spin helper
Rob Clark [Sat, 11 Jan 2014 21:11:59 +0000 (16:11 -0500)]
drm/msm: spin helper

Helper macro to simplify places where we need to poll with timeout
waiting for gpu.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: add hang_debug module param
Rob Clark [Sun, 22 Dec 2013 15:29:43 +0000 (10:29 -0500)]
drm/msm: add hang_debug module param

msm.hang_debug=y will dump out current register values if the gpu locks
up, for easier debugging.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: hdmi audio support
Rob Clark [Wed, 11 Dec 2013 19:44:02 +0000 (14:44 -0500)]
drm/msm: hdmi audio support

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agoMerge tag 'vmwgfx-next-2014-03-28' of git://people.freedesktop.org/~thomash/linux...
Dave Airlie [Mon, 31 Mar 2014 01:29:38 +0000 (11:29 +1000)]
Merge tag 'vmwgfx-next-2014-03-28' of git://people.freedesktop.org/~thomash/linux into drm-next

vmwgfx render-node support and drm + ttm changes it depends upon.

Pull request of 2014-03-28

* tag 'vmwgfx-next-2014-03-28' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Bump driver minor and date
  drm/vmwgfx: Enable render nodes
  drm/vmwgfx: Tighten the security around buffer maps
  drm/ttm: Add a ttm_ref_object_exists function
  drm/vmwgfx: Tighten security around surface sharing v2
  drm/vmwgfx: Allow prime fds in the surface reference ioctls
  drm/vmwgfx: Drop authentication requirement on UNREF ioctls
  drm/vmwgfx: Reinstate and tighten security around legacy master model
  drm/vmwgfx: Use a per-device semaphore for reservation protection
  drm: Add a function to get the ioctl flags
  drm: Protect the master management with a drm_device::master_mutex v3
  drm: Remove the minor master list
  drm: Improve on minor type helpers v3
  drm: Make control nodes master-less v3
  drm: Break out ioctl permission check to a separate function v2
  drm: Have the crtc code only reference master from legacy nodes v2

10 years agodrm/vmwgfx: Bump driver minor and date
Thomas Hellstrom [Thu, 20 Mar 2014 12:07:44 +0000 (13:07 +0100)]
drm/vmwgfx: Bump driver minor and date

Signal availability of prime fd reference ioctls and render nodes.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Enable render nodes
Thomas Hellstrom [Thu, 20 Mar 2014 12:06:34 +0000 (13:06 +0100)]
drm/vmwgfx: Enable render nodes

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Tighten the security around buffer maps
Thomas Hellstrom [Wed, 19 Mar 2014 14:06:21 +0000 (15:06 +0100)]
drm/vmwgfx: Tighten the security around buffer maps

Make sure only buffer objects that are referenced by the client can be mapped.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/ttm: Add a ttm_ref_object_exists function
Thomas Hellstrom [Wed, 19 Mar 2014 12:23:20 +0000 (13:23 +0100)]
drm/ttm: Add a ttm_ref_object_exists function

A function to be used to check whether a caller has put a ref object
(opened) a struct ttm_base_object

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Tighten security around surface sharing v2
Thomas Hellstrom [Wed, 19 Mar 2014 09:45:11 +0000 (10:45 +0100)]
drm/vmwgfx: Tighten security around surface sharing v2

If using legacy (non-prime) surface sharing, only allow surfaces
to be shared between clients with the same master. This will block
malicious clients from peeking at contents at surfaces from other
(possibly vt-switched) masters.

v2:
s/legacy_client/primary_client/

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Allow prime fds in the surface reference ioctls
Thomas Hellstrom [Tue, 18 Mar 2014 14:00:56 +0000 (15:00 +0100)]
drm/vmwgfx: Allow prime fds in the surface reference ioctls

Allow prime fds and at the same time block legacy handles for render-nodes
in the surface reference ioctls. This means these ioctls can be used
directly from prime-aware clients, and that they can be called from
render-nodes.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Drop authentication requirement on UNREF ioctls
Thomas Hellstrom [Thu, 27 Feb 2014 12:24:17 +0000 (13:24 +0100)]
drm/vmwgfx: Drop authentication requirement on UNREF ioctls

These ioctls will anyway only succeed if the client previously opened
referenced the object. Furthermore, closing the client would implicitly
execute the same action. This prevents clients from blocking on UNREF if
their master dropped, and will allow masters to UNREF after dropping
master privileges.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Reinstate and tighten security around legacy master model
Thomas Hellstrom [Thu, 27 Feb 2014 11:56:08 +0000 (12:56 +0100)]
drm/vmwgfx: Reinstate and tighten security around legacy master model

The following restrictions affect clients connecting using legacy nodes:

*) Masters that have dropped master privilieges are not considered
   authenticated until they regain master privileges.
*) Clients whose master have dropped master privileges block interruptibly on
   ioctls  requiring authentication until their master regains master
   privileges. If their master exits, they are killed.

This is primarily designed to prevent clients authenticated with one master to
access data from clients authenticated with another master.
(Think fast user-switching or data sniffers enabled while X is vt-switched).

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Use a per-device semaphore for reservation protection
Thomas Hellstrom [Thu, 27 Feb 2014 11:34:51 +0000 (12:34 +0100)]
drm/vmwgfx: Use a per-device semaphore for reservation protection

Don't use a per-master semaphore (ttm lock) for reservation protection, but
rather a per-device semaphore. This is needed since clients connecting using
render nodes aren't master aware.

The ttm lock used should probably be replaced with a reader-write semaphore
once the function down_xx_interruptible() is available.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm: Add a function to get the ioctl flags
Thomas Hellstrom [Wed, 26 Feb 2014 14:51:57 +0000 (15:51 +0100)]
drm: Add a function to get the ioctl flags

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm: Protect the master management with a drm_device::master_mutex v3
Thomas Hellstrom [Tue, 25 Feb 2014 18:57:44 +0000 (19:57 +0100)]
drm: Protect the master management with a drm_device::master_mutex v3

The master management was previously protected by the drm_device::struct_mutex.
In order to avoid locking order violations in a reworked dropped master
security check in the vmwgfx driver, break it out into a separate master_mutex.
Locking order is master_mutex -> struct_mutex.

Also remove drm_master::blocked since it's not used.

v2: Add an inline comment about what drm_device::master_mutex is protecting.
v3: Remove unneeded struct_mutex locks. Fix error returns in
    drm_setmaster_ioctl().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
10 years agodrm: Remove the minor master list
Thomas Hellstrom [Wed, 19 Feb 2014 13:37:44 +0000 (14:37 +0100)]
drm: Remove the minor master list

It doesn't appear to be used anywhere.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: Improve on minor type helpers v3
Thomas Hellstrom [Thu, 13 Mar 2014 10:07:44 +0000 (11:07 +0100)]
drm: Improve on minor type helpers v3

Add a drm_is_legacy() helper, constify argument to drm_is_render_client(),
and use / change helpers where appropriate.

v2: s/drm_is_legacy/drm_is_legacy_client/ and adapt to new code context.
v3: s/legacy_client/primary_client/

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm: Make control nodes master-less v3
Thomas Hellstrom [Wed, 19 Feb 2014 13:21:48 +0000 (14:21 +0100)]
drm: Make control nodes master-less v3

Like for render-nodes, there is no point in maintaining the master concept
for control nodes, so set the struct drm_file::master pointer to NULL.

At the same time, make sure DRM_MASTER | DRM_CONTROL_ALLOW ioctls are always
allowed when called through the control node. Previously the caller also
needed to be master.

v2: Adapt to refactoring of ioctl permission check.
v3: Formatting of logical expression. Use drm_is_control_client() instead of
    drm_is_control().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: Break out ioctl permission check to a separate function v2
Thomas Hellstrom [Thu, 13 Mar 2014 09:30:25 +0000 (10:30 +0100)]
drm: Break out ioctl permission check to a separate function v2

Helps reviewing and understanding these checks.
v2: Remove misplaced newlines.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: Have the crtc code only reference master from legacy nodes v2
Thomas Hellstrom [Thu, 13 Mar 2014 09:00:42 +0000 (10:00 +0100)]
drm: Have the crtc code only reference master from legacy nodes v2

control- and render nodes are intended to be master-less.

v2: Replace tests for !legacy with tests for !mode_group for readability.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm/i915: fix build warning on 32-bit (v2)
Dave Airlie [Fri, 28 Mar 2014 03:03:48 +0000 (13:03 +1000)]
drm/i915: fix build warning on 32-bit (v2)

/ssd/git/drm-next/drivers/gpu/drm/i915/i915_cmd_parser.c: In function ‘i915_parse_cmds’:
/ssd/git/drm-next/drivers/gpu/drm/i915/i915_cmd_parser.c:405:4: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘int’ [-Wformat=]
    DRM_DEBUG_DRIVER("CMD: Command length exceeds batch length: 0x%08X length=%d batchlen=%ld\n",
    ^

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the ', ' after the function name in debug logs
Lespiau, Damien [Mon, 24 Mar 2014 15:53:18 +0000 (15:53 +0000)]
drm: Remove the ', ' after the function name in debug logs

Right now a debug message looks like:

  [drm:drm_ioctl], pid=860, dev=0xe200, auth=1, DRM_IOCTL_MODE_GETCRTC

That first comma looks weird as we already have ']' as a separator.
Remove it.

If anyone sees this commit message and also thinks that auth=1 isn't the
most useful info to have here, let's just say I'd happily review a patch
removing it. If I don't get annoyed enough to submit a patch, that is.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the prefix argument of drm_ut_debug_printk()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:17 +0000 (15:53 +0000)]
drm: Remove the prefix argument of drm_ut_debug_printk()

This is always DRM_NAME, so we can just make it part of the format
string instead of asking prink to do it for us.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: drm_ut_debug_printk() isn't called with NULL anywmore
Lespiau, Damien [Mon, 24 Mar 2014 15:53:16 +0000 (15:53 +0000)]
drm: drm_ut_debug_printk() isn't called with NULL anywmore

The DRM_LOG* macros where the only sites where drm_ut_debug_printk was
called with NULL arguments for prefix and function_name. Now that they
are gone, we can remove that case.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Pull the test on drm_debug in the logging macros
Lespiau, Damien [Mon, 24 Mar 2014 15:53:15 +0000 (15:53 +0000)]
drm: Pull the test on drm_debug in the logging macros

In the logging code, we are currently checking is we need to output in
drm_ut_debug_printk(). This is too late. The problem is that when we write
something like:

    DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
                     connector->base.id,
                     drm_get_connector_name(connector),
                     connector->encoder->base.id,
                     drm_get_encoder_name(connector->encoder));

We start by evaluating the arguments (so call drm_get_connector_name() and
drm_get_connector_name()) before ending up in drm_ut_debug_printk() which will
then does nothing.

This means we execute a lot of instructions (drm_get_connector_name(), in turn,
calls snprintf() for example) to happily discard them in the normal case,
drm.debug=0.

So, let's put the test on drm_debug earlier, in the macros themselves.
Sprinkle an unlikely() as well for good measure.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the now unused DRM_LOG* macros
Lespiau, Damien [Mon, 24 Mar 2014 15:53:14 +0000 (15:53 +0000)]
drm: Remove the now unused DRM_LOG* macros

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agostaging: imx-drm: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:13 +0000 (15:53 +0000)]
staging: imx-drm: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/i915: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:12 +0000 (15:53 +0000)]
drm/i915: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/gma500: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:11 +0000 (15:53 +0000)]
drm/gma500: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/exynos: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:10 +0000 (15:53 +0000)]
drm/exynos: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the unused (and unusable) DRM_LOG_MODE()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:09 +0000 (15:53 +0000)]
drm: Remove the unused (and unusable) DRM_LOG_MODE()

This macro was trying to use the non existing DRM_UT_MODE debug category
and looks like it should be covered by DRM_LOG_KMS().

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Refresh the explanation of debug categories
Lespiau, Damien [Mon, 24 Mar 2014 15:53:08 +0000 (15:53 +0000)]
drm: Refresh the explanation of debug categories

That comment wasn't super-readable, so I tried to improve it:

- Put the comment before the values it's documenting
- Add a mention to PRIME
- Reword things a bit to be a lighter read
- Add a note about the option to set the debug value at run-time

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/bridge: PTN3460 needs DRM_KMS_HELPER
Arnd Bergmann [Tue, 25 Mar 2014 11:06:46 +0000 (12:06 +0100)]
drm/bridge: PTN3460 needs DRM_KMS_HELPER

The recently added PTN3460 device driver uses interfaces that
are provided by the KMS helper infrastructure, so we should
explicitly select that to avoid this linker error:

ERROR: "drm_helper_probe_single_connector_modes" [drivers/gpu/drm/bridge/ptn3460.ko] undefined!
ERROR: "drm_helper_connector_dpms" [drivers/gpu/drm/bridge/ptn3460.ko] undefined!

We have to drop the I2C dependency to avoid a circular dependency
chain, but that's ok because DRM already selects I2C.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux...
Dave Airlie [Wed, 26 Mar 2014 04:34:16 +0000 (14:34 +1000)]
Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next

- first stage of (ongoing) gpu fault recovery work
- initial support for maxwell (binary driver fw needed)
- various random fixes across the board

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (87 commits)
  drm/nouveau: fix missing newline
  drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses
  drm/nouveau/therm: let the vbios decide on the automatic fan management mode
  drm/nvd7/therm: handle another kind of PWM fans
  drm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling
  drm/nouveau: fix small thinko in vblank timestamping.
  drm/nouveau/therm: check for sensor presence with requested mode, not current
  drm/nouveau/disp/dp: allow 540MHz data rate
  drm/nouveau: recognise higher link rate for available dp bw calculations
  drm/nouveau/disp: limit dp capabilities as per dcb
  drm/nva3/fbram: restrict training pattern setup to GT218
  drm/nva3/devinit: restrict script access to some PFB regs
  drm/nouveau/devinit: add interface to check if a mmio access by scripts is ok
  drm/nouveau/bios: have strap reads show on devinit spam debug level
  drm/nv50/gpio: fixup reset for gpios >= 16
  drm/nv50/gpio: exclude sense value from mask when changing registers
  drm/gk104/gr: therm magic needed on some kepler boards
  drm/gm107/gr: initial support
  drm/gf100-/gf: fix a stupid typo, waiting on wrong signal for mmctx
  drm/nouveau/bios: parsing of some random table needed to bring up gr
  ...

10 years agodrm/nouveau: fix missing newline
Alexandre Courbot [Mon, 24 Mar 2014 08:42:23 +0000 (17:42 +0900)]
drm/nouveau: fix missing newline

Add a missing newline at the end of a DRM_INFO message.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses
Martin Peres [Tue, 25 Mar 2014 21:23:23 +0000 (22:23 +0100)]
drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses

Other kind of accesses are unreliable on Kepler cards. As advised by NVIDIA,
let's only use 32-bit accesses to fetch the vbios from PROM.

This fixes vbios fetching on my nve7 which failed in certain specific
conditions.

I suggest we Cc stable, for all kernels they still maintain after the big
rewrite.

Suggested-by: Christian Zander <czander@nvidia.com>
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm: let the vbios decide on the automatic fan management mode
Martin Peres [Wed, 19 Feb 2014 00:04:56 +0000 (01:04 +0100)]
drm/nouveau/therm: let the vbios decide on the automatic fan management mode

This should fix automatic fan management on fermi cards who do not have
0x46 entries in the thermal table.

On my nve6, the blob sets the default linear range from 40°C to 100°C
but my nvcf's default values are 40°C to 85°C. Let's keep 85 as a default
for everyone.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Tested-by: Timothée Ravier <tim@siosm.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvd7/therm: handle another kind of PWM fans
Martin Peres [Tue, 18 Feb 2014 02:56:11 +0000 (03:56 +0100)]
drm/nvd7/therm: handle another kind of PWM fans

This should fix fan management on many nvd7+ chipsets.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Tested-by: Timothée Ravier <tim@siosm.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling
Martin Peres [Thu, 13 Mar 2014 23:26:52 +0000 (00:26 +0100)]
drm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling

This should fix a deadlock that has been reported to us where fan_update()
would hold the fan lock and try to grab the alarm_program_lock to reschedule
an update. On an other CPU, the alarm_program_lock would have been taken
before calling fan_update(), leading to a deadlock.

We should Cc: <stable@vger.kernel.org> # 3.9+

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Tested-by: Timothée Ravier <tim@siosm.fr>
Tested-by: Boris Fersing (IRC nick fersingb, no public email address)
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: fix small thinko in vblank timestamping.
Mario Kleiner [Wed, 19 Mar 2014 09:02:11 +0000 (10:02 +0100)]
drm/nouveau: fix small thinko in vblank timestamping.

*hpos horizontal scanout position doesn't need to be corrected
to count the pixels between hactive end and htotal negative.
That is only needed for *vpos to count lines until end of
vblank for the vblank timestamping.

Use hpos as is without correction.

Removes occassional spikes in timestamps of up to 1 scanline
duration, thereby improves accuracy to about +/- 2 usecs instead
of +/- 12 usecs, wrt. true onset time as measured with high
precision equipment on NV-A5.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm: check for sensor presence with requested mode, not current
Ben Skeggs [Mon, 24 Mar 2014 03:34:47 +0000 (13:34 +1000)]
drm/nouveau/therm: check for sensor presence with requested mode, not current

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp/dp: allow 540MHz data rate
Ilia Mirkin [Wed, 19 Mar 2014 14:45:55 +0000 (10:45 -0400)]
drm/nouveau/disp/dp: allow 540MHz data rate

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76319
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: recognise higher link rate for available dp bw calculations
Ben Skeggs [Wed, 19 Mar 2014 23:32:01 +0000 (09:32 +1000)]
drm/nouveau: recognise higher link rate for available dp bw calculations

I should resurrect/merge that cleanup branch to remove the weird
duplication.. One day.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp: limit dp capabilities as per dcb
Ben Skeggs [Wed, 19 Mar 2014 23:28:00 +0000 (09:28 +1000)]
drm/nouveau/disp: limit dp capabilities as per dcb

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/fbram: restrict training pattern setup to GT218
Ben Skeggs [Tue, 18 Mar 2014 19:23:10 +0000 (05:23 +1000)]
drm/nva3/fbram: restrict training pattern setup to GT218

It doesn't look like the others have the registers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/devinit: restrict script access to some PFB regs
Ben Skeggs [Tue, 18 Mar 2014 17:08:21 +0000 (03:08 +1000)]
drm/nva3/devinit: restrict script access to some PFB regs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/devinit: add interface to check if a mmio access by scripts is ok
Ben Skeggs [Tue, 18 Mar 2014 16:56:29 +0000 (02:56 +1000)]
drm/nouveau/devinit: add interface to check if a mmio access by scripts is ok

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: have strap reads show on devinit spam debug level
Ben Skeggs [Tue, 18 Mar 2014 14:55:02 +0000 (00:55 +1000)]
drm/nouveau/bios: have strap reads show on devinit spam debug level

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/gpio: fixup reset for gpios >= 16
Ben Skeggs [Tue, 18 Mar 2014 14:46:47 +0000 (00:46 +1000)]
drm/nv50/gpio: fixup reset for gpios >= 16

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