Commit graph

38031 commits

Author SHA1 Message Date
Jason Ekstrand
1fc08218ed drm/syncobj: Add a CREATE_SIGNALED flag
This requests that the driver create the sync object such that it
already has a signaled dma_fence attached.  Because we don't need
anything in particular (just something signaled), we use a dummy null
fence.  This is useful for Vulkan which has a similar flag that can be
passed to vkCreateFence.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 06:27:41 +10:00
Jason Ekstrand
9c19fb10a5 drm/syncobj: Add a callback mechanism for replace_fence (v3)
It is useful in certain circumstances to know when the fence is replaced
in a syncobj.  Specifically, it may be useful to know when the fence
goes from NULL to something valid.  This does make syncobj_replace_fence
a little more expensive because it has to take a lock but, in the common
case where there is no callback list, it spends a very short amount of
time inside the lock.

v2:
 - Don't lock in drm_syncobj_fence_get.  We only really need to lock
   around fence_replace to make the callback work.
v3:
 - Fix the cb_list comment to make kbuild happy

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 06:26:42 +10:00
Dave Airlie
5e60a10eae drm/syncobj: add sync obj wait interface. (v8)
This interface will allow sync object to be used to back
Vulkan fences. This API is pretty much the vulkan fence waiting
API, and I've ported the code from amdgpu.

v2: accept relative timeout, pass remaining time back
to userspace.
v3: return to absolute timeouts.
v4: absolute zero = poll,
    rewrite any/all code to have same operation for arrays
    return -EINVAL for 0 fences.
v4.1: fixup fences allocation check, use u64_to_user_ptr
v5: move to sec/nsec, and use timespec64 for calcs.
v6: use -ETIME and drop the out status flag. (-ETIME
is suggested by ickle, I can feel a shed painting)
v7: talked to Daniel/Arnd, use ktime and ns everywhere.
v8: be more careful in the timeout calculations
    use uint32_t for counter variables so we don't overflow
    graciously handle -ENOINT being returned from dma_fence_wait_timeout

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 06:26:32 +10:00
Jason Ekstrand
afca4216b8 i915: Use drm_syncobj_fence_get
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 06:20:31 +10:00
Jason Ekstrand
309a5482fa drm/syncobj: Add a race-free drm_syncobj_fence_get helper (v2)
The atomic exchange operation in drm_syncobj_replace_fence is sufficient
for the case where it races with itself.  However, if you have a race
between a replace_fence and dma_fence_get(syncobj->fence), you may end
up with the entire replace_fence happening between the point in time
where the one thread gets the syncobj->fence pointer and when it calls
dma_fence_get() on it.  If this happens, then the reference may be
dropped before we get a chance to get a new one.  The new helper uses
dma_fence_get_rcu_safe to get rid of the race.

This is also needed because it allows us to do a bit more than just get
a reference in drm_syncobj_fence_get should we wish to do so.

v2:
 - RCU isn't that scary
 - Call rcu_read_lock/unlock
 - Don't rename fence to _fence
 - Make the helper static inline

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Christian König <christian.koenig@amd.com> (v1)
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 06:20:30 +10:00
Jason Ekstrand
afaf592378 drm/syncobj: Rename fence_get to find_fence
The function has far more in common with drm_syncobj_find than with
any in the get/put functions.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Christian König <christian.koenig@amd.com> (v1)
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 06:17:37 +10:00
John Stultz
71f23543d3 drm: kirin: Add mode_valid logic to avoid mode clocks we can't generate
Currently the hikey dsi logic cannot generate accurate byte
clocks values for all pixel clock values. Thus if a mode clock
is selected that cannot match the calculated byte clock, the
device will boot with a blank screen.

This patch uses the new mode_valid callback (many thanks to
Jose Abreu for upstreaming it!) to ensure we don't select
modes we cannot generate.

Also, since the ade crtc code will adjust the mode in mode_set,
this patch also adds a mode_fixup callback which we use to make
sure we are validating the mode clock that will eventually be
used.

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Xinliang Liu <xinliang.liu@linaro.org>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Chen Feng <puck.chen@hisilicon.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 05:20:35 +10:00
Sinclair Yeh
d78acfe934 drm/vmwgfx: Bump the version for fence FD support
Minor version bump to indicate support for fence FD

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Singh Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-08-28 17:53:32 +02:00
Sinclair Yeh
c906965dee drm/vmwgfx: Add export fence to file descriptor support
Added code to link a fence to a out_fence_fd file descriptor and
thread out_fence_fd down to vmw_execbuf_copy_fence_user() so it can be
copied into the IOCTL reply and be passed back up the the user.

v2:
Make sure to sync and clean up in case of failure

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Singh Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-08-28 17:51:46 +02:00
Sinclair Yeh
5858511646 drm/vmwgfx: Add support for imported Fence File Descriptor
This allows vmwgfx to wait on a fence created by another
device.

v2:
* Remove special handling for vmwgfx fence and just use dma_fence_wait()
* Use interruptible waits
* Added function documentation

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Singh Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-08-28 17:51:38 +02:00
Sinclair Yeh
2cfa0bb25d drm/vmwgfx: Prepare to support fence fd
Make the fields and flags available.

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Singh Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-08-28 17:51:28 +02:00
Thomas Hellstrom
1f1a36cc4d drm/vmwgfx: Fix incorrect command header offset at restart
Sometimes it appears like the device modifies the command header offset
member. So explicitly clear it when restarting after an error.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-08-28 17:40:51 +02:00
Thomas Hellstrom
5f55be5f30 drm/vmwgfx: Support the NOP_ERROR command
Can be used by user-space applications to test and verify the kernel
command buffer error recovery functionality.

Malicious user-space apps could potentially use this command to slow down
graphics processing somewhat, but they could also accomplish the same thing
using a random malformed command so this should be considered safe.
At least as safe as it gets.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-08-28 17:40:49 +02:00
Thomas Hellstrom
65b97a2bec drm/vmwgfx: Restart command buffers after errors
Previously we skipped the command buffer and added an extra fence to
avoid hangs due to skipped fence commands.
Now we instead restart the command buffer after the failing command,
if there are any commands left.
In addition we print out some information about the failing command
and its location in the command buffer.

Testing Done: ran glxgears using mesa modified to send the NOP_ERROR
command before each 10th clear and verified that we detected the device
error properly and that there were no other device errors caused by
incorrectly ordered command buffers. Also ran the piglit "quick" test
suite which generates a couple of device errors and verified that
they were handled as intended.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-08-28 17:40:46 +02:00
Thomas Hellstrom
ef369904aa drm/vmwgfx: Move irq bottom half processing to threads
This gets rid of the irq bottom half tasklets and instead performs the
work needed in process context. We also convert irq-disabling spinlocks to
ordinary spinlocks.

This should decrease system latency for other system components, like
sound for example but has the potential to increase latency for processes
that wait on the GPU.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-08-28 17:40:43 +02:00
Thomas Hellstrom
e300173f06 drm/vmwgfx: Don't use drm_irq_[un]install
We're not allowed to change the upstream version of the drm_irq_install
function to be able to incorporate threaded irqs. So roll our own irq
install- and uninstall functions instead of relying on the drm core ones.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-08-28 17:40:40 +02:00
Wolfram Sang
8ce0436789 Merge branch 'i2c-mux/for-next' of https://github.com/peda-r/i2c-mux into i2c/for-4.14 2017-08-27 15:14:49 +02:00
Ingo Molnar
413d63d71b Merge branch 'linus' into x86/mm to pick up fixes and to fix conflicts
Conflicts:
	arch/x86/kernel/head64.c
	arch/x86/mm/mmap.c

Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-08-26 09:19:13 +02:00
Ingo Molnar
10c9850cb2 Merge branch 'linus' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-08-25 11:04:51 +02:00
Tobias Jakobi
5b7b1b7fa1 drm/exynos: simplify set_pixfmt() in DECON and FIMD drivers
DRM core already checks the validity of the pixelformat.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 14:30:27 +09:00
Tobias Jakobi
ac60944ccf drm/exynos: consistent use of cpp
A recent commit (272725c7db) has removed
the use of 'bits_per_pixel' in DRM. However the corresponding Exynos
driver code still uses the ambiguous 'bpp', even though it is now
initialized from fb->cpp[0].

Consistenly use 'cpp' in FIMD, DECON7 and DECON5433 drivers.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
2017-08-25 14:06:48 +09:00
Tobias Jakobi
5dff690529 drm/exynos: mixer: remove src offset from mixer_graph_buffer()
We always translate the dma address such that the offsets of
the source image are zero. Hence we can remove manipulation of
the MXR_GRAPHIC_SXY(win) register and just zero them once
in mixer_win_reset().

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 12:10:33 +09:00
Tobias Jakobi
1e60d62f38 drm/exynos: mixer: simplify mixer_graph_buffer()
DRM core already checks in drm_atomic_plane_check() if the
pixelformat is valid. Hence we can collapse the default case
of the switch statement with the XRGB8888 case.

No functional change.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 12:07:11 +09:00
Tobias Jakobi
0f75269492 drm/exynos: mixer: simplify vp_video_buffer()
DRM core already checks in drm_atomic_plane_check() if the
pixelformat is valid. Hence we can drop the default case of
the switch statement and collapse most of the code.

Also rename the two booleans to reflect what true/false
actually means, and to avoid mixing CrCb/NV21 descriptions.

No functional change.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 12:05:56 +09:00
Tobias Jakobi
f40031c231 drm/exynos: mixer: enable NV12MT support for the video plane
The video processor supports a tiled version of the NV12 format,
known as NV12MT in V4L2 terms. The support was removed in commit
083500baef due to not being a real
pixel format, but rather NV12 with a special memory layout.

With the introduction of FB modifiers, we can now properly support
this format again.

Tested with a hacked up modetest from libdrm's test suite on
an ODROID-X2 (Exynos4412).

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 12:04:51 +09:00
Tobias Jakobi
dc500cfb86 drm/exynos: mixer: fix chroma comment in vp_video_buffer()
The current comment sounds like the division op is done to
compensate for some hardware erratum. But the chroma plane
having half the height of the luma plane is just the way
NV12/NV21 is defined, so clarify this behaviour.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 12:03:52 +09:00
Andrzej Hajda
461e60ea11 drm/exynos/decon5433: use mode info stored in CRTC to detect i80 mode
Since panel's mode of work is propagated properly from panel to DECON,
there is no need to use redundant private device tree property.
The only issue with such approach is that check for required interrupts
should be postponed until panel communicate its requirements, ie to
mode validation phase - mode_valid callback.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
2017-08-25 11:58:08 +09:00
Andrzej Hajda
c3653fede5 drm/exynos: add mode_valid callback to exynos_drm
crtc::mode_valid callback is required to implement proper pipeline
validation for command/video modes. Since Exynos uses private
framework such callback should be added to it.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 11:58:07 +09:00
Andrzej Hajda
34c3db6c22 drm/exynos/decon5433: refactor irq requesting code
To allow runtime validation of mode of work irq request
code should be split into two separate phases:
- irq reqesting,
- irq checking.
Following patches will move 2nd phase to mode validation phase.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 11:58:07 +09:00
Andrzej Hajda
29c5079d9e drm/exynos/mic: use mode info stored in CRTC to detect i80 mode
MIC driver should use info from CRTC to check mode of work instead of
illegally peeking into nodes of other devices.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 11:58:01 +09:00
Andrzej Hajda
c038f53842 drm/exynos/dsi: propagate info about command mode from panel
mipi_dsi framework provides information about panel's mode of work.
This info should be propagated upstream to configure all elements of
the pipeline. As CRTC is the common denominator of the pipeline we can
put such info into its structures.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 11:26:15 +09:00
Andrzej Hajda
295e7954c0 drm/exynos/dsi: refactor panel detection logic
Description of drm_helper_hpd_irq_event clearly states that drivers
supporting hotplug events per connector should use different helper -
drm_kms_helper_hotplug_event. To achieve it following changes have
been performed:
- moved down all DSI ops - they require exynos_dsi_disable function
to be defined earlier,
- simplified exynos_dsi_detect - there is no real detection, it just
returns if panel is attached,
- DSI attach/detach callbacks attaches/detaches DRM panel and sets
connector status and other context fields accordingly, all this is
performed under mutex, as these callbacks are asynchronous.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 11:26:13 +09:00
Andrzej Hajda
1ca582f10e drm/exynos: use helper to set possible crtcs
All encoders share the same code to set encoders possible_crtcs field.
The patch creates helper to abstract out this code.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 11:26:10 +09:00
Andrzej Hajda
30b8913fd3 drm/exynos/decon5433: use readl_poll_timeout helpers
Linux core provide helpers for polling with timeout, lets use them.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2017-08-25 11:26:06 +09:00
Dave Airlie
e47ef3029b sun4i DRM changes for 4.14, take 2
A single patch switching to a new OF helper.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZnppSAAoJEBx+YmzsjxAg6vMP/RI+NyOPQAuYqYOJjJvPXhlZ
 9Dq8FeZvLpBINk8QFtjorC5Nn7wMFwpgYU2y+bbOG7TWR5fftL+nxgTf7klL05Lc
 OPL8ug3tGZBpvzRify4dWJHmG71Imb892RNOKDL3ufIzfjEAI748r1kfrWkUJMfH
 9CQay9TH1KjC8vPtLM+QP3PbZ6qJnBKYlL2oAC4oFcnhxauD2WlrCfjKjs/ywI3L
 MixKObGPBhJM5otii6T6FqfYVqO7netpm6nyZeBpFwX6RBR7SiC/WF3zdvm5gXgx
 5EowwfZ39cTzycrwYrJKuszotDXmw7woZLZQ2bM/SCo96cXHtNhfCausGfjyDfZL
 0aKeIXhqzKj/LHUXsLKBwZxmD7CpYGivdueOC5HUMDaQT+3UmUSnKIlLKpvmfarb
 nbxCmKm0ITyIM6ppNF+OiZSTK2uszSckiro+HvvORqDlM4zhfmp+IrM8rvt5tj9r
 4Q28HAkWlPvEeL/hJL/vPN0Q0fjQJ0pVqGP70S19N+CHBnXyDvsFk+qushgRXwzJ
 K3C4GvSqJtp8cXgi0OOxuCM3o2POLrdMQJhXw7GxG/cuzWIeI36wZdRj2bYbo5CJ
 zXMf9S2yXWB13iFRfdPqpMCZIKsMKsSEC2uoyprfetrgYJ+tOLGOSQKlie7OKigu
 ckZ3XFozSq6OEIxD4Nfh
 =lksW
 -----END PGP SIGNATURE-----

Merge tag 'sunxi-drm-for-4.14-2' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into drm-next

sun4i DRM changes for 4.14, take 2

A single patch switching to a new OF helper.

* tag 'sunxi-drm-for-4.14-2' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  drm/sun4i: use of_graph_get_remote_endpoint()
2017-08-25 09:30:54 +10:00
Dave Airlie
72d45a7603 omapdrm fixes for 4.14
* fix compilation when compiling omapfb driver
 * WA for OMAP3 endless sync lost issue
 * WA for OMAP5 DSI PLL issue
 * fix analog TV out modecheck
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJZnscgAAoJEPo9qoy8lh71MgUQAIJoKbQEcrJWQ01JeYDb58C4
 MwwZ8u9Fy3iVGVPM23pCAhf7Rh6f2jvDFFGw/qeZ6Ryi9OiwH6dkmpD7AElUeV03
 OqnSGqqZbKVJZYltCQYVGBJ3SOMWON476AyM1w58z9OhZkjizOw5KJPK2e2yh0wP
 WH8hdX8MkVwgFq9MVrdnu7bJiShVqP37sdAffqNQ6LYuW/kQOdSl20KNNNSKH/D4
 NctqaDXI/6EHz3RRLTIzn7ZLRl2qiW3Yp3v+uprOp/yulX7MwFKlZnJNETT9Tf0j
 9JHmEXriEZ1gl0Z/pMZOXsdDXhUum7MdiLox5BfNpe/DWPTIkUxmGWBgxKibdHo8
 5zzsjODiV42sElTZuVD+VEJZtc+8K6q1C6tFBkmJ/AKz17j+5360o1aWSXpdBj33
 gg6mSu+jGWLUH1dnjH74bcq5bQmnLGR6FkGlGy/3a2pWnACMwH+ETSQNwHu1NM/x
 MWArJQJ1SPuaCAHmhhRFyJwCPxdNDS1MW+mGBoSX21o3qqb69382KAaXXlhU5+9L
 /MhkYBhet48RdHlseTx+/GxxFkU2gV3sviGm31ts9jHcbJftyTe0aZIc/0w1UWnd
 4e43cyvAom6BTQNub4Mi3HnwCXeSUJOhNucgEwf3aTcAISHgD65MerLRcYs58k/t
 GLSkL7yBCeUPr1UiFjD/
 =9KX4
 -----END PGP SIGNATURE-----

Merge tag 'omapdrm-4.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next

omapdrm fixes for 4.14

* fix compilation when compiling omapfb driver
* WA for OMAP3 endless sync lost issue
* WA for OMAP5 DSI PLL issue
* fix analog TV out modecheck

* tag 'omapdrm-4.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
  ARM: OMAP2+: fix missing variable declaration
  drm/omap: work-around for omap3 display enable
  drm/omap: fix i886 work-around
  drm/omap: fix analog tv-out modecheck
2017-08-25 09:30:15 +10:00
Dave Airlie
cfcfb65ad1 Merge tag 'drm-msm-next-2017-08-22' of git://people.freedesktop.org/~robclark/linux into drm-next
Updates for 4.14..  I have some further patches from Jordan to add
multiple priority levels and pre-emption, but those will probably be
for 4.15 to give me time for the mesa parts.

* tag 'drm-msm-next-2017-08-22' of git://people.freedesktop.org/~robclark/linux:
  drm/msm/mdp5: mark runtime_pm functions as __maybe_unused
  drm/msm: remove unused variable
  drm/msm/mdp5: make helper function static
  drm/msm: make msm_framebuffer_init() static
  drm/msm: add helper to allocate stolen fb
  drm/msm: don't track fbdev's gem object separately
  drm/msm: add modeset module param
  drm/msm/mdp5: add tracking for clk enable-count
  drm/msm: remove unused define
  drm/msm: Add a helper function for in-kernel buffer allocations
  drm/msm: Attach the GPU MMU when it is created
  drm/msm: Add A5XX hardware fault detection
  drm/msm: Remove uneeded platform dev members
  drm/msm/mdp5: Set up runtime PM for MDSS
  drm/msm/mdp5: Write to SMP registers even if allocations don't change
  drm/msm/mdp5: Don't use mode_set helper funcs for encoders and CRTCs
  drm/msm/dsi: Implement RPM suspend/resume callbacks
  drm/msm/dsi: Set up runtime PM for DSI
  drm/msm/hdmi: Set up runtime PM for HDMI
  drm/msm/mdp5: Use runtime PM get/put API instead of toggling clocks
2017-08-25 09:29:45 +10:00
Dave Airlie
da61197977 Merge tag 'drm-misc-fixes-2017-08-24' of git://anongit.freedesktop.org/git/drm-misc into drm-fixes
Core Changes:
- Release driver tracking before making the object available again (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>

* tag 'drm-misc-fixes-2017-08-24' of git://anongit.freedesktop.org/git/drm-misc:
  drm: Release driver tracking before making the object available again
2017-08-25 09:29:38 +10:00
Dave Airlie
4b5587c8c3 Merge tag 'drm-intel-fixes-2017-08-24' of git://anongit.freedesktop.org/git/drm-intel into drm-fixes
drm/i915 fixes for v4.13-rc7

* tag 'drm-intel-fixes-2017-08-24' of git://anongit.freedesktop.org/git/drm-intel:
  drm/i915/gvt: Fix the kernel null pointer error
  drm/i915: Clear lost context-switch interrupts across reset
  drm/i915/bxt: use NULL for GPIO connection ID
  drm/i915/cnl: Fix LSPCON support.
  drm/i915/vbt: ignore extraneous child devices for a port
  drm/i915: Initialize 'data' in intel_dsi_dcs_backlight.c
2017-08-25 09:29:06 +10:00
Colin Ian King
403df1f66c drm/amdgpu: remove duplicate return statement
Remove a redundant identical return statement, it has no use.

Detected by CoverityScan, CID#1454586 ("Structurally dead code")

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 14:27:44 -04:00
Christophe JAILLET
a1d6b1901a drm/amdgpu: check memory allocation failure
Check memory allocation failure and return -ENOMEM in such a case.

'num_post_dep_syncobjs' still has to be set to 0 before the test in order
to have it initialized if 'amdgpu_cs_parser_fini()' is called to free
resources.

The calling graph would be, in such a case!
   failure in amdgpu_cs_process_syncobj_out_dep()
      ---> error code returned by amdgpu_cs_dependencies()
         --> amdgpu_cs_parser_fini() is called

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 14:27:43 -04:00
Maciej Purski
79964dbaf6 drm/bridge/sii8620: Fix memory corruption
Function sii8620_mt_read_devcap_reg_recv() used to read array index
from a wrong msg register, which caused writing out of array
bounds. It led to writing on other fields of struct sii8620.

Signed-off-by: Maciej Purski <m.purski@samsung.com>
Fixes: e9c6da270 ("drm/bridge/sii8620: add reading device capability
       registers")
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1503311571-25819-1-git-send-email-m.purski@samsung.com
2017-08-24 19:06:32 +02:00
Roger He
2959a5346b drm/amd/amdgpu: fix BANK_SELECT on Vega10 (v2)
BANK_SELECT should always be FRAGMENT_SIZE + 3 due to 8-entry (2^3)
per cache line in L2 TLB for Vega10.

v2: agd: fix warning

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 12:34:30 -04:00
Christian König
ac7afe6b3c drm/amdgpu: inline amdgpu_ttm_do_bind again
The function is called only once and doesn't do anything special.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:48 -04:00
Christian König
1d00402b4d drm/amdgpu: fix amdgpu_ttm_bind
Use ttm_bo_mem_space instead of manually allocating GART space.

This allows us to evict BOs when there isn't enought GART space any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:47 -04:00
Christian König
457e0fee04 drm/amdgpu: remove the GART copy hack
This isn't used since we don't map evicted BOs to GART any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:47 -04:00
Monk Liu
ab7039325f drm/ttm:fix wrong decoding of bo_count
we observe abnormal number from:
/sys/devices/virtual/drm/amdttm/buffer_objects/bo_count

bo_count is atomic_inc which is "int" type,
shouldn't explicitly turn it to unsigned long.

Signed-off-by: Monk Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:46 -04:00
Monk Liu
a101a41fca drm/ttm: fix missing inc bo_count
Signed-off-by: Monk Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:46 -04:00
Alex Deucher
eab2c600fc drm/amdgpu: set sched_hw_submission higher for KIQ (v3)
KIQ doesn't really use the GPU scheduler.  The base
drivers generally use the KIQ ring directly rather than
submitting IBs.  However, amdgpu_sched_hw_submission
(which defaults to 2) limits the number of outstanding
fences to 2.  KFD uses the KIQ for TLB flushes and the
2 fence limit hurts performance when there are several KFD
processes running.

v2: move some expressions to one line
    change KIQ sched_hw_submission to at least 16
v3: bump to 256

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:45 -04:00
Alex Deucher
faf5056726 drm/amdgpu: move default gart size setting into gmc modules
Move the asic specific code into the IP modules.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:44 -04:00
Alex Deucher
5df239ff22 drm/amdgpu: refine default gart size
Be more explicit and add comments explaining each case.
Also s/gart/GART/ in the parameter string as per Felix'
suggestion.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:44 -04:00
Evan Quan
547f1091b9 drm/amd/powerplay: ACG frequency added in PPTable
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:43 -04:00
Christian König
6af0883ed9 drm/amdgpu: discard commands of killed processes
When a process is killed we shouldn't submit all waiting jobs, but instead
clean up as fast as possible.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:42 -04:00
Christian König
2e8f9fbe98 drm/amdgpu: fix and cleanup shadow handling
Set the shadow flag on the shadow and not the parent, always bind shadow BOs
during allocation instead of manually, use the reservation_object wrappers
to grab the lock.

This fixes a couple of issues with binding the shadow BOs as well as correctly
evicting them when memory becomes tight.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:42 -04:00
Alex Deucher
db63042b33 drm/amdgpu: add automatic per asic settings for gart_size
We need a larger gart for asics that do not support GPUVM on all
engines (e.g., MM) to make sure we have enough space for all
gtt buffers in physical mode.  Change the default size based on
the asic type.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:41 -04:00
Alex Deucher
871594e78c drm/amdgpu/gfx8: fix spelling typo in mqd allocation
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-24 11:48:40 -04:00
Evan Quan
86b03b3321 drm/amd/powerplay: unhalt mec after loading
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-23 17:18:45 -04:00
Emily Deng
766cff839d drm/amdgpu/virtual_dce: Virtual display doesn't support disable vblank immediately
For virtual display, it uses software timer to emulate the vsync interrupt,
it doesn't have high precision, so doesn't support disable vblank immediately.

BUG: SWDEV-129274

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-23 17:18:44 -04:00
Felix Kuehling
b252903afc drm/amdgpu: Fix huge page updates with CPU
Correctly detect system memory mappings when using CPU and don't use
huge pages for them.

Avoid incorrectly translating a physical page table GPU address when
splitting a huge page while mapping system memory.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-23 17:18:43 -04:00
Kuninori Morimoto
0bd46d703e drm/sun4i: use of_graph_get_remote_endpoint()
Now, we can use of_graph_get_remote_endpoint(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-08-23 16:28:39 +02:00
Tomi Valkeinen
fc5cc9678e drm/omap: work-around for omap3 display enable
Seems that on omap3 enabling a crtc without any planes causes a sync
lost flood. This only happens on the first enable, and after that it
works. This looks like an HW issue and it's unclear why this is
happening or how to fix it.

This started happening after 897145d0c7
("drm/omapdrm: Move commit_modeset_enables() before commit_planes()")
which, as a work-around, changed omapdrm first to do the modeset enable,
and plane set only after that. This WA should be fine on all DSS
versions, but apparently OMAP3 DSS is an exception.

This patch reverts that work-around for OMAP3 DSS.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2017-08-23 12:22:12 +03:00
Tomi Valkeinen
0c43f1e025 drm/omap: fix i886 work-around
7d267f068a ("drm/omap: work-around for
errata i886") changed how the PLL dividers and multipliers are
calculated. While the new way should work fine for all the PLLs, it
breaks omap5 PLLs. The issues seen are rather odd: seemed that the
output clock rate is half of what we asked. It is unclear what's causing
there issues.

As a work-around this patch adds a "errata_i886" flag, which is set only
for DRA7's PLLs, and the PLL setup is done according to that flag.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: H. Nikolaus Schaller <hns@goldelico.com>
2017-08-23 12:22:09 +03:00
Tomi Valkeinen
beea6214d1 drm/omap: fix analog tv-out modecheck
omapdrm rejects all venc (analog tv-out) videomodes, due to somewhat
strict checking of the values, making tv-out unusable.

We only support two videomodes, one for PAL and one for NTSC, so instead
of trying to check every field in the videomode struct, this patch makes
the driver check only the pixel clock and the size of the display.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2017-08-23 12:22:08 +03:00
Jani Nikula
e7c50e1156 Merge tag 'gvt-fixes-2017-08-23' of https://github.com/01org/gvt-linux into drm-intel-fixes
gvt-fixes-2017-08-23

- Fix possible null ptr reference in error path (Fred)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170823075352.nlo7hp3bplnb5ilx@zhen-hp.sh.intel.com
2017-08-23 11:48:05 +03:00
fred gao
ffeaf9aaf9 drm/i915/gvt: Fix the kernel null pointer error
once error happens in shadow_indirect_ctx function, the variable
wa_ctx->indirect_ctx.obj is not initialized but accessed, so the
kernel null point panic occurs.

Fixes: 894cf7d156 ("drm/i915/gvt: i915_gem_object_create() returns an error pointer")
Cc: stable@vger.kernel.org # v4.8+
Signed-off-by: fred gao <fred.gao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
2017-08-23 14:08:57 +08:00
Arnd Bergmann
d1f08d8217 drm/msm/mdp5: mark runtime_pm functions as __maybe_unused
When CONFIG_PM is disabled, we get harmless warnings about unused
functions:

drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1025:12: error: 'mdp5_runtime_resume' defined but not used [-Werror=unused-function]
 static int mdp5_runtime_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1015:12: error: 'mdp5_runtime_suspend' defined but not used [-Werror=unused-function]
 static int mdp5_runtime_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~~

This marks both functions as __maybe_unused so the compiler
can drop them silently.

Fixes: d68fe15b18 ("drm/msm/mdp5: Use runtime PM get/put API instead of toggling clocks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:40 -04:00
Arnd Bergmann
6e05899dc8 drm/msm: remove unused variable
A cleanup left behind an unused variable that we have to remove
in order to avoid this harmless warning:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c: In function 'a5xx_zap_shader_init':
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:493:19: error: unused variable 'a5xx_gpu' [-Werror=unused-variable]

Fixes: 8d6f08272b ("drm/msm: Remove uneeded platform dev members")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:40 -04:00
Rob Clark
5c3ddb8585 drm/msm/mdp5: make helper function static
Not needed outside of mdp5_crtc.c.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:40 -04:00
Rob Clark
6c0693b1ed drm/msm: make msm_framebuffer_init() static
Only needed in msm_fb.c so don't export it.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:39 -04:00
Rob Clark
466e5606cc drm/msm: add helper to allocate stolen fb
We'll later want to re-use this for state-readback when bootloader
enables display, so that we can create an fb for the initial
plane->state->fb.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:39 -04:00
Rob Clark
38958bab82 drm/msm: don't track fbdev's gem object separately
The drm_framebuffer is refcnt'd these days and will unref the underlying
bo as needed.  So we can simplify a little.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:38 -04:00
Rob Clark
ba4dd71828 drm/msm: add modeset module param
At least for debugging it is nice to have an easy way to force the
driver not to load.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:37 -04:00
Rob Clark
a7d3bb0045 drm/msm/mdp5: add tracking for clk enable-count
Accessing registers for an unclocked block is an insta-reboot on
snapdragon devices.  So add a bit of logic to track the enable_count so
we can WARN_ON() unclocked register writes.  This makes it much easier
to track down mistakes.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:37 -04:00
Rob Clark
a0ce4d23b1 drm/msm: remove unused define
Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:20:36 -04:00
Jordan Crouse
8223286d62 drm/msm: Add a helper function for in-kernel buffer allocations
Nearly all of the buffer allocations for kernel allocate an buffer object,
virtual address and GPU iova at the same time. Make a helper function to
handle the details.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
[dropped msm_fbdev conversion to new helper, since it interferes with
display-handover work, where we want to separate allocation and mapping]
Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:19:17 -04:00
Jordan Crouse
1267a4dfe0 drm/msm: Attach the GPU MMU when it is created
Currently the GPU MMU is attached in the adreno_gpu code but as
more and more of the GPU initialization moves to the generic
GPU path we have a need to map and use GPU memory earlier and
earlier.  There isn't any reason to defer attaching the MMU
until later so attach it right after the address space is
created so it can be used immediately.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-22 13:19:15 -04:00
Chris Wilson
fe4600a548 drm: Release driver tracking before making the object available again
This is the same bug as we fixed in commit f6cd7daecf ("drm: Release
driver references to handle before making it available again"), but now
the exposure is via the PRIME lookup tables. If we remove the
object/handle from the PRIME lut, then a new request for the same
object/fd will generate a new handle, thus for a short window that
object is known to userspace by two different handles. Fix this by
releasing the driver tracking before PRIME.

Fixes: 0ff926c7d4 ("drm/prime: add exported buffers to current fprivs
imported buffer list (v2)")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: stable@vger.kernel.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170819120558.6465-1-chris@chris-wilson.co.uk
2017-08-22 16:03:43 +03:00
Colin Ian King
27a451e83e drm/nouveau/kms/nv50: perform null check on msto[i] rathern than msto
The null check on the array msto is incorrect since msto is never
null. The null check should be instead on msto[i] since this is
being dereferenced in the call to drm_mode_connector_attach_encoder.

Thanks to Emil Velikov for pointing out the mistake in my original
fix and for suggesting the correct fix.

Detected by CoverityScan, CID#1375915 ("Array compared against 0")

Fixes: f479c0ba4a ("drm/nouveau/kms/nv50: initial support for DP 1.2 multi-stream")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:36 +10:00
Ilia Mirkin
bc60c90f47 drm/nouveau/pci/msi: disable MSI on big-endian platforms by default
It appears that MSI does not work on either G5 PPC nor on a E5500-based
platform, where other hardware is reported to work fine with MSI.

Both tests were conducted with NV4x hardware, so perhaps other (or even
this) hardware can be made to work. It's still possible to force-enable
with config=NvMSI=1 on load.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:36 +10:00
Ben Skeggs
2d38a5359f drm/nouveau: silence suspend/resume debugging messages
These are particularly annoying on Optimus systems where these paths can
be called regularly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:36 +10:00
Ilia Mirkin
856718054a drm/nouveau/kms/nv04-nv4x: fix exposed format list
drm_crtc_init exposes the XRGB8888 and ARGB8888 formats. In actuality,
ARGB8888's 32-bit depth messes up some formulas that weren't meant for
it, and the alpha is fairly meaningless for the primary plane.

The modesetting logic appears to be fully prepared for RGB565 as well as
XRGB1555 however, as tested with modetest.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:35 +10:00
Ilia Mirkin
7fa620d577 drm/nouveau/kms/nv10-nv40: add NV21 support to overlay
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:35 +10:00
Ilia Mirkin
9a6edc3ac9 drm/nouveau/kms/nv04-nv40: improve overlay error detection, fix pitch setting
We were previously setting the pitch based on a perfectly packed buffer.
This does not necessarily happen. Either modetest started generating
such buffers recently, or earlier testing only happened with well-picked
overlay sizes.

While we're at it, beef up and refactor the error state detection.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:34 +10:00
Ilia Mirkin
3ce72bcf33 drm/nouveau/kms/nv04-nv40: prevent undisplayable framebuffers from creation
Pre-nv50 YUV overlays have stringent requirements for working with the
internal machinery. Instead of rejecting these at update_plane time, we
should instead prevent the framebuffers from being created in the first
place.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:34 +10:00
Ilia Mirkin
d257f9bf06 drm/nouveau/mpeg: print more debug info when rejecting dma objects
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:34 +10:00
Ben Skeggs
7a1af0f8bb drm/nouveau/fb/gf100-: zero mmu debug buffers
These are used for accesses to sparse mappings, and we want reads of
such mappings to return 0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:33 +10:00
Ben Skeggs
485c2c91d4 drm/nouveau/bar/gf100: add config option to limit BAR2 to 16MiB
Useful for testing, and for the userspace build where we can't kick
a framebuffer driver off the device.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:33 +10:00
Ilia Mirkin
2659b4ce28 initial support (display-only) for GP108
Forked from GP107 implementation. Secboot/gr left out as we don't have
signed blobs from NVIDIA in linux-firmware.

(Ben): Was unable to mmiotrace the binary driver for unknown reasons,
       so not able to 100% confirm that no other changes from GP107
       are needed.  Quick testing shows it seems to work well enough
       for display.  Due to NVIDIA dragging their heels on getting
       signed firmware to us, this is the best we can do for now.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101601
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:32 +10:00
Ben Skeggs
e20868b906 drm/nouveau/falcon: use a more reasonable msgqueue timeout value
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:32 +10:00
Rosen Penev
df00d5da60 drm/nouveau/disp: Silence DCB warnings.
Most of these errors seem to be WFD related. Official documentation
says dcb type 8 is reserved. It's probably used for WFD. Silence
the warning in either case.

Connector type 70 is stated to be a virtual connector for WiFi
display. Since we know this, don't warn that we don't.

Signed-off by: Rosen Penev <rosenp@gmail.com>

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:32 +10:00
Rosen Penev
8190493244 drm/nouveau/bios: Demote missing fp table message to NV_DEBUG.
This warning seems to pop up mainly in laptop cards. Silence it as
it is expected behavior.

Signed-off by: Rosen Penev <rosenp@gmail.com>

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:31 +10:00
Ben Skeggs
6b1277c837 drm/nouveau/pmu/gt215-: abstract detection of whether reset is needed
GT215, GF100-GP100, and GP10x are all different.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:31 +10:00
Ben Skeggs
715e7d261d drm/nouveau/pmu/gt215: fix reset
The NV_PMC_ENABLE bit for PMU did not appear until GF100, and some other
unknown register needs to be poked instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:30 +10:00
Ben Skeggs
1ccd7d52b1 drm/nouveau/mc/gf100: add pmu to reset mask
An upcoming commit will replace direct NV_PMC register bashing from PMU
with a call to the proper function.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:30 +10:00
Ilia Mirkin
eba5e56db6 drm/nouveau/disp/gf119-: avoid creating non-existent heads
We assume that each board has 4 heads for GF119+. However this is not
necessarily true - in the case of a GP108 board, the register indicated
that there were only 2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101601
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:22 +10:00
Karol Herbst
9d60b9c9d0 drm/nouveau/therm/gm200: Added
This allows temperature readouts on maxwell2 GPUs.

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:22 +10:00
Colin Ian King
4a84a6fd9a drm/nouveau/therm: fix spelling mistake on array thresolds
Array thresolds should be named thresholds, rename it. Also make it static
static const char * const

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2017-08-22 18:04:22 +10:00
Dave Airlie
b313f780de Merge tag 'drm-misc-fixes-2017-08-18' of git://anongit.freedesktop.org/git/drm-misc into drm-fixes
Core Changes:
- Fix framebuffer leak in setplane error condition (Nikil)
- Prevent BUG in atomic_ioctl by properly resetting state on EDEADLK (Maarten)
- Add missing return in atomic_check_only if atomic_check fails (Maarten)

Driver Changes:
- rockchip: Don't try to suspend if device not initialized (Jeffy)

Cc: Jeffy Chen <jeffy.chen@rock-chips.com>
Cc: Nikhil Mahale <nmahale@nvidia.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

* tag 'drm-misc-fixes-2017-08-18' of git://anongit.freedesktop.org/git/drm-misc:
  drm/atomic: If the atomic check fails, return its value first
  drm/atomic: Handle -EDEADLK with out-fences correctly
  drm: Fix framebuffer leak
  drm/rockchip: Fix suspend crash when drm is not bound
2017-08-22 16:53:32 +10:00
Dave Airlie
4a9f153dbd drm/imx: fix YUV primary plane and IPUv3 build corner case
- Enable color space conversion on the primary plane when the framebuffer
   format is a YUV format.
 - The IPUv3 base driver now uses drm_format_info in the PRE/PRG code. The
   PRE/PRG parts are already disabled if DRM is not available. Enforce that
   if DRM is built as a module, IPUv3 must be built as a module, too.
 -----BEGIN PGP SIGNATURE-----
 
 iQJMBAABCAA2FiEEBsBxhV1FaKwXuCOBUMKIHHCeYOsFAlmWf+0YHHBoaWxpcHAu
 emFiZWxAZ21haWwuY29tAAoJEFDCiBxwnmDr1ksQAIpFKk+1+f+stvYZVY2228n2
 O4TkzsTiJIkIgmE98BMXicIIfEumqxu6GtjhB5pdKtMFILUx+bqhwsCFMZjks5xl
 ma8fOr0kHLX98LZdvkhBw1SFGHSIvisxyjr1c4EiXEtb+5iEQFA76lZYyI7NY7i+
 dcLkpa4p5sRPKNIFE9zn/981IoNzGO9zF/1DiYvj2TfS4cnaEWBw+oMARSs6Wsn6
 8HWP0EMjX+HZk/6Bwaia4EwPPfjW5Vx441EmrYN87nrvO8kJVkIXuVtJlCM9k9oU
 HuJJvzJg2x2IKnhZrHCsUCPf8Cm8b/d1sPdmvHDVjDx0YnEgTvKVJN79WzJYJnjA
 uiSdJgfYuvhYj2xOXJfURHpAO5Ln9H0J13qZC3SL5lrQszsqj1QfqsdTMphHWJIc
 ULHoc5efOtgTK1iJghChzs22VT/6e2gFUH326elzxCqTGK/7q8RTuo0diJsSvdHQ
 KWnDubXtNboCY721vNBK45GxMQIVOqx+jLgqCoRncweIilEtpQKobvAADbperS6W
 OuxuY2qTmvq2cOamdkbNQOcWDrj6uBT8qifQx1So5H4arhs1Rd8q7+0BuOVAePwB
 ocllawtfWzPlsKT1HXAA7m4gjI6Gm8gwlTT8Q1oix8Fdn3mMQwFUdkciHpS3ZlMT
 5mOLWcLyil0o9lC0JsTG
 =nO8q
 -----END PGP SIGNATURE-----

Merge tag 'imx-drm-fixes-2017-08-18' of git://git.pengutronix.de/git/pza/linux into drm-fixes

drm/imx: fix YUV primary plane and IPUv3 build corner case

- Enable color space conversion on the primary plane when the framebuffer
  format is a YUV format.
- The IPUv3 base driver now uses drm_format_info in the PRE/PRG code. The
  PRE/PRG parts are already disabled if DRM is not available. Enforce that
  if DRM is built as a module, IPUv3 must be built as a module, too.

* tag 'imx-drm-fixes-2017-08-18' of git://git.pengutronix.de/git/pza/linux:
  drm/imx: ipuv3-plane: fix YUV framebuffer scanout on the base plane
  gpu: ipu-v3: add DRM dependency
2017-08-22 16:52:36 +10:00
Dave Airlie
6b9dfb5991 imx-drm: lock scanout transfers for consecutive bursts
- Lock the IDMAC scanout channel for multiple back-to-back bursts if possible,
   to improve memory bandwidth utilisation.
 - Replace a few occurences of state->fb with the already existing local fb
   variable in ipu_plane_atomic_update
 -----BEGIN PGP SIGNATURE-----
 
 iQJMBAABCAA2FiEEBsBxhV1FaKwXuCOBUMKIHHCeYOsFAlltvQYYHHBoaWxpcHAu
 emFiZWxAZ21haWwuY29tAAoJEFDCiBxwnmDr8HMQAIFY9yGeyhSpLlI2FM32UKvW
 Si5KYZ74DNGEMt1/zy8/ruGe20nYIgMUbSkaIlX2Brpkoo2gUcV21wxTYHpomjz+
 y9wVYosBC4OY2crd8mFbWRYLKA4UmOvN9iAs9oeZ7Yw58NKyfV2x36nHvLgPULri
 wFcDj32V9260f6DqMSNLtQDJULwbDR6tclYcmodX5zp3J2jYTS8I5o2nKtXPgeKa
 yeRwlDq0NKqq6n3tuzTrmR2qBC41ebuF7FQftEHykPyFAuV/XtKT82T2ZYJHbqPc
 NG3E3ShnbFP0wIJOTF3V4GO8lg4jBaBVrw1c5DzYtYpsalthXOZVUCTShpcRxHkk
 hZVO9nq4ooo/q7xIgmq1C/BSR5FXloDqLTZgwlv9sjHkkCeeeIIbqjN7a1ukjzJA
 zxlrlbuiNSyQMMutYcQIT60Zva0hXlS1YJ6fBH894TqT7uw0QDVaE+AbSdVfw6Mq
 OqNEktWXgMuREwSbuXtKE4d3IXhWx6PsGyxcq77jLaRe+Uk3fornjQ3IS7F2li45
 MyEQo4LJhzyy5gwVe3NUUh/BN8lfuP3iO6ukOgEP37cAS6KA37Jy02BCSNZw4NMj
 Z30Kw7r+HvwQCrVZPSXuM+qiO6U8Pp/biAPv09CleHtoyZiZmkt/xXVM6J8XPMdw
 lHjZiEGDnFGwIER1FHKw
 =nXzK
 -----END PGP SIGNATURE-----

Merge tag 'imx-drm-next-2017-07-18' of git://git.pengutronix.de/git/pza/linux into drm-next

imx-drm: lock scanout transfers for consecutive bursts

- Lock the IDMAC scanout channel for multiple back-to-back bursts if possible,
  to improve memory bandwidth utilisation.
- Replace a few occurences of state->fb with the already existing local fb
  variable in ipu_plane_atomic_update

* tag 'imx-drm-next-2017-07-18' of git://git.pengutronix.de/git/pza/linux:
  drm/imx: lock scanout transfers for consecutive bursts
  drm/imx: ipuv3-plane: use fb local variable instead of state->fb
2017-08-22 16:51:11 +10:00