platform/kernel/linux-rpi.git
5 years agodrm/nouveau/bar/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/bar/tu104: initial support

New registers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/mmu/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/mmu/tu104: initial support

New flush method.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/ltc/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/ltc/tu104: initial support

Appears to be compatible with GP102.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fb/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fb/tu104: initial support

Appears to be compatible with GV100.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/imem/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/imem/tu104: initial support

Appears to be compatible with NV50.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/tmr/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/tmr/tu104: initial support

Appears to be compatible with GK20A.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/bus/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/bus/tu104: initial support

Appears to be compatible with GF100.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/mc/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/mc/tu104: initial support

Things are a bit different here on Turing, and will require further changes
yet once I've investigated them more thoroughly.

For now though, the existing GP100 code is compatible enough with one small
hack to forward on fault buffer interrupts.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fuse/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fuse/tu104: initial support

Appears to be compatible with GM107.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/i2c/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/i2c/tu104: initial support

Appears to be compatible with GM200.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/gpio/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/gpio/tu104: initial support

Appears to be compatible with GK104.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/ibus/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/ibus/tu104: initial support

Appears to be compatible with GM200.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/top/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/top/tu104: initial support

Appears to be compatible with GK104.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/devinit/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/devinit/tu104: initial support

The GPU executes DEVINIT itself now, which makes our lives a bit easier.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/bios/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/bios/tu104: initial support

No real surprises here so far.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/pci/tu104: initial support
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/pci/tu104: initial support

Appears to be compatible with GP100.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/core: recognise TU104
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/core: recognise TU104

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/kms/nv50-: allow more flexibility with lut formats
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/kms/nv50-: allow more flexibility with lut formats

Will be required for Turing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau: remove left-over struct member
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau: remove left-over struct member

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gv100: return work submission token in channel ctor args
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gv100: return work submission token in channel ctor args

The token will also contain runlist ID on Turing, so instead expose it as
an opaque value from NVKM so the client doesn't need to care.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gv100: allocate method buffer
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gv100: allocate method buffer

The GPU saves off some stuff to the address specified in this part of RAMFC
when the channel faults, so we should probably point it at a valid address.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gm200-: read pbdma count more directly
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gm200-: read pbdma count more directly

The trick we used (and still use for older GPUs) doesn't work on Turing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gk104-: virtualise pbdma enable function
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gk104-: virtualise pbdma enable function

Turing will require different code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gk104-: group pbdma functions together
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gk104-: group pbdma functions together

We're about to be adding more of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gk104-: separate runlist building from committing to hw
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gk104-: separate runlist building from committing to hw

We will need to bash different registers on Turing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gk104-: support enabling privileged ce functions
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gk104-: support enabling privileged ce functions

Will be used by SVM code to allow direct (without going through MMU) memcpy
using the GPU copy engines.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gk104-: return channel instance in ctor args
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gk104-: return channel instance in ctor args

Will be used to match fault buffer entries with a channel.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fifo/gf100-: call into BAR to reset BARs after MMU fault
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fifo/gf100-: call into BAR to reset BARs after MMU fault

This is needed for Turing, but we're supposed to wait for completion after
re-writing the value on older GPUs anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/disp/gv100: fix name of window channels in debug output
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/disp/gv100: fix name of window channels in debug output

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/mmu: add more general vmm free/node handling functions
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/mmu: add more general vmm free/node handling functions

Aside from being a nice cleanup, these will to allow the upcoming direct
page mapping interfaces to play nicely with normal mappings.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fault: add explicit control over fault buffer interrupts
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fault: add explicit control over fault buffer interrupts

The GPU will continually fire interrupts while a fault buffer GET != PUT,
and to stop the spurious interrupts while the handler does its thing, we
were disabling the fault buffer temporarily.

This is not actually a great idea to begin with, and made worse by Volta
resetting GET/PUT when it's reactivated.  So, let's not do that.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fault: store get/put pri address in nvkm_fault_buffer
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fault: store get/put pri address in nvkm_fault_buffer

Will allow more shared fault buffer handling code between Pascal/Volta.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/fault: remove manual mapping of fault buffers into BAR2
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/fault: remove manual mapping of fault buffers into BAR2

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/imem/nv50: support pinning objects in BAR2 and returning address
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/imem/nv50: support pinning objects in BAR2 and returning address

Various structures are accessed by the GPU through BAR2 for some reason
on newer GPUs.  This commit makes it more convenient to handle.

Will be used for GP100- fault buffers, and GV100- fault method buffers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/tmr: detect stalled gpu timer and break out of waits
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/tmr: detect stalled gpu timer and break out of waits

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/devinit/gm200-: export function to upload+execute PMU/PRE_OS
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/devinit/gm200-: export function to upload+execute PMU/PRE_OS

Will be used for Turing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/bios: translate USB-C connector type
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/bios: translate USB-C connector type

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/bios: translate additional memory types
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/bios: translate additional memory types

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/core: support multiple nvdec instances
Ben Skeggs [Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)]
drm/nouveau/core: support multiple nvdec instances

Turing GPUs can have more than one.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/drm/nouveau: Don't forget to label dp_aux devices
Lyude Paul [Thu, 12 Jul 2018 17:13:52 +0000 (13:13 -0400)]
drm/nouveau/drm/nouveau: Don't forget to label dp_aux devices

This makes debugging with DP tracing a lot harder to interpret, so name
each i2c based off the name of the encoder that it's for

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau/drm/nouveau: Check rc from drm_dp_mst_topology_mgr_resume()
Lyude Paul [Thu, 15 Nov 2018 01:39:51 +0000 (20:39 -0500)]
drm/nouveau/drm/nouveau: Check rc from drm_dp_mst_topology_mgr_resume()

We need to actually make sure we check this on resume since otherwise we
won't know whether or not the topology is still there once we've
resumed, which will cause us to still think the topology is connected
even after it's been removed if the removal happens mid-suspend.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau: Add size to vbios.rom file in debugfs
Lyude Paul [Wed, 19 Sep 2018 17:13:52 +0000 (13:13 -0400)]
drm/nouveau: Add size to vbios.rom file in debugfs

With this, nvbios /sys/kernel/debug/dri/*/vbios.rom now works!

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agodrm/nouveau: Add strap_peek to debugfs
Lyude Paul [Wed, 19 Sep 2018 17:13:51 +0000 (13:13 -0400)]
drm/nouveau: Add strap_peek to debugfs

Since we already expose the vbios.rom file here, why not also expose the
strap_peek?

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5 years agoMerge tag 'drm-misc-next-2018-12-06' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Fri, 7 Dec 2018 00:46:29 +0000 (10:46 +1000)]
Merge tag 'drm-misc-next-2018-12-06' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

Final changes to drm-misc-next for v4.21:

UAPI Changes:

Core Changes:
- Add dma_fence_get_stub to dma-buf, and use it in drm/syncobj.
- Add and use DRM_MODESET_LOCK_BEGIN/END helpers.
- Small fixes to drm_atomic_helper_resume(), drm_mode_setcrtc() and
  drm_atomic_helper_commit_duplicated_state()
- Fix drm_atomic_state_helper.[c] extraction.

Driver Changes:
- Small fixes to tinydrm, vkms, meson, rcar-du, virtio, vkms,
  v3d, and pl111.
- vc4: Allow scaling and YUV formats on cursor planes.
- v3d: Enable use of the Texture Formatting Unit, and fix
  prime imports of buffers from other drivers.
- Add support for the AUO G101EVN010 panel.
- sun4i: Enable support for the H6 display engine.

Signed-off-by: Dave Airlie <airlied@redhat.com>
[airlied: added drm/v3d: fix broken build to the merge commit]
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/321be9d3-ab75-5f92-8193-e5113662edef@linux.intel.com
5 years agoMerge tag 'vmwgfx-next-2018-12-05' of git://people.freedesktop.org/~thomash/linux...
Dave Airlie [Thu, 6 Dec 2018 03:43:22 +0000 (13:43 +1000)]
Merge tag 'vmwgfx-next-2018-12-05' of git://people.freedesktop.org/~thomash/linux into drm-next

Pull request of 2018-12-05

Page flip with damage by Deepak and others,
Various vmwgfx minor fixes anc cleanups.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Thomas Hellstrom <thellstrom@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181205103554.3675-1-thellstrom@vmware.com
5 years agoMerge tag 'exynos-drm-next-for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel...
Dave Airlie [Thu, 6 Dec 2018 03:29:34 +0000 (13:29 +1000)]
Merge tag 'exynos-drm-next-for-v4.21' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

- Refactoring of DMA and IOMMU code
  . This patch series simplifies DMA mapping creation by avoiding looping
    all components to get dma device object, reduces code size by merging
    IOMMU and DMA code.
- Enhance plane alpha and blend mode support
  . This patch series adds configurable plane and pixel blend mode support
    for Exynos5433 DECON device.
- Fix color format setting of Mixer driver
  . This patch series fixes color format and range setting by splitting
    range and format.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1544002853-11661-1-git-send-email-inki.dae@samsung.com
5 years agoMerge branch 'drm-next-4.21' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 6 Dec 2018 03:28:19 +0000 (13:28 +1000)]
Merge branch 'drm-next-4.21' of git://people.freedesktop.org/~agd5f/linux into drm-next

amdgpu and amdkfd:
- Freesync support
- ABM support in DC
- KFD support for vega12 and polaris12
- Add sdma paging queue support for vega
- Use ACPI to query backlight range on supported platforms
- Clean up doorbell handling
- KFD fix for pasid handling under non-HWS
- Misc cleanups and fixes

scheduler:
- Revert "fix timeout handling v2"

radeon:
- Fix possible overflow on 32 bit

ttm:
- Fix for LRU handling for ghost objects

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130192505.2946-1-alexander.deucher@amd.com
5 years agoMerge tag 'drm-intel-next-2018-12-04' of git://anongit.freedesktop.org/drm/drm-intel...
Dave Airlie [Wed, 5 Dec 2018 22:09:33 +0000 (08:09 +1000)]
Merge tag 'drm-intel-next-2018-12-04' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

Final drm/i915 changes for v4.21:
- ICL DSI video mode enabling (Madhav, Vandita, Jani, Imre)
- eDP sink count fix (José)
- PSR fixes (José)
- DRM DP helper and i915 DSC enabling (Manasi, Gaurav, Anusha)
- DP FEC enabling (Anusha)
- SKL+ watermark/ddb programming improvements (Ville)
- Pixel format fixes (Ville)
- Selftest updates (Chris, Tvrtko)
- GT and engine workaround improvements (Tvrtko)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87va496uoe.fsf@intel.com
5 years agodrm: revert "expand replace_fence to support timeline point v2"
Christian König [Wed, 14 Nov 2018 13:24:27 +0000 (14:24 +0100)]
drm: revert "expand replace_fence to support timeline point v2"

This reverts commit 9a09a42369a4a37a959c051d8e1a1f948c1529a4.

The whole interface isn't thought through. Since this function can't
fail we actually can't allocate an object to store the sync point.

Sorry, I should have taken the lead on this from the very beginning and
reviewed it more thoughtfully. Going to propose a new interface as a
follow up change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Link: https://patchwork.freedesktop.org/patch/265580/
5 years agodrm/vmwgfx: Use the standard atomic helpers for page-flip
Thomas Hellstrom [Wed, 14 Nov 2018 07:11:05 +0000 (08:11 +0100)]
drm/vmwgfx: Use the standard atomic helpers for page-flip

Our wrappers don't do anything useful anymore except calling the
atomic helpers.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
5 years agodrm/vmwgfx: Remove set but not used variable 'file_priv'
YueHaibing [Fri, 5 Oct 2018 11:36:58 +0000 (11:36 +0000)]
drm/vmwgfx: Remove set but not used variable 'file_priv'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/vmwgfx/vmwgfx_fence.c: In function 'vmw_event_fence_action_seq_passed':
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c:909:19: warning:
 variable 'file_priv' set but not used [-Wunused-but-set-variable]
  struct drm_file *file_priv;

It not used any more since
commit fb740cf2492c ("drm: Create drm_send_event helpers")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: remove redundant return ret statement
Colin Ian King [Thu, 4 Oct 2018 17:49:53 +0000 (18:49 +0100)]
drm/vmwgfx: remove redundant return ret statement

The return statement is redundant as there is a return statement
immediately before it so we have dead code that can be removed.
Also remove the unused declaration of ret.

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

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Fix a layout race condition
Thomas Hellstrom [Mon, 12 Nov 2018 14:46:39 +0000 (15:46 +0100)]
drm/vmwgfx: Fix a layout race condition

This fixes a layout update race condition. We make sure
the crtc mutex is locked before we dereference crtc->state. Otherwise the
state might change under us.

Since now we're already holding the crtc mutexes when reading the gui
coordinates, protect them with the crtc mutexes rather than with the
requested_layout mutex.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
5 years agodrm/vmwgfx: Fix up the implicit display unit handling
Thomas Hellstrom [Thu, 4 Oct 2018 22:38:17 +0000 (22:38 +0000)]
drm/vmwgfx: Fix up the implicit display unit handling

Make the connector is_implicit property immutable.
As far as we know, no user-space application is writing to it.

Also move the verification that all implicit display units scan out
from the same framebuffer to atomic_check().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
5 years agoMAINTAINERS: Update vmwgfx maintainers
Sinclair Yeh [Mon, 19 Nov 2018 17:56:07 +0000 (09:56 -0800)]
MAINTAINERS: Update vmwgfx maintainers

It's been fun! To be continued.....

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Don't clear mode::type anymore
Deepak Rawat [Thu, 27 Sep 2018 00:17:33 +0000 (17:17 -0700)]
drm/vmwgfx: Don't clear mode::type anymore

With kernel commit "drm/modes: Kill off the oddball DRM_MODE_TYPE_CRTC_C
vs. DRM_MODE_TYPE_BUILTIN handling", no need to clear mode::type for
user-space bug.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Use atomic helper function for dirty fb IOCTL
Deepak Rawat [Fri, 21 Sep 2018 21:34:02 +0000 (14:34 -0700)]
drm/vmwgfx: Use atomic helper function for dirty fb IOCTL

USe new atomic helper for dirty fb IOCTL which make use of damage
interface. Note that this is only done for STDU and SOU, for legacy
display unit still using old interface.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Enable FB_DAMAGE_CLIPS property for SOU primary plane
Deepak Rawat [Wed, 8 Aug 2018 22:41:56 +0000 (15:41 -0700)]
drm/vmwgfx: Enable FB_DAMAGE_CLIPS property for SOU primary plane

SOU primary plane now support damage clips, enable it for user-space.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Update comments for sou plane update function
Deepak Rawat [Fri, 21 Sep 2018 21:10:35 +0000 (14:10 -0700)]
drm/vmwgfx: Update comments for sou plane update function

Update comments to sync with code.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Use the new interface for SOU plane update
Deepak Rawat [Fri, 21 Sep 2018 21:07:33 +0000 (14:07 -0700)]
drm/vmwgfx: Use the new interface for SOU plane update

With new interface to do plane update on SOU available, use that instead
of old kms_dirty.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Implement SOU plane update for BO backed fb
Deepak Rawat [Wed, 8 Aug 2018 22:02:48 +0000 (15:02 -0700)]
drm/vmwgfx: Implement SOU plane update for BO backed fb

Using the new interface implement SOU plane update for BO backed fb.

v2: Rebase to new resource validation.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Implement SOU plane update for surface backed fb
Deepak Rawat [Wed, 8 Aug 2018 19:39:31 +0000 (12:39 -0700)]
drm/vmwgfx: Implement SOU plane update for surface backed fb

Using the new interface implement SOU plane update for surface backed
fb.

v2: Rebase to new resource validation.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Enable FB_DAMAGE_CLIPS property for STDU primary plane
Deepak Rawat [Sat, 28 Jul 2018 00:28:17 +0000 (17:28 -0700)]
drm/vmwgfx: Enable FB_DAMAGE_CLIPS property for STDU primary plane

STDU primary plane now support damage clips, enable it for user-space.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Update comments for stdu plane update
Deepak Rawat [Fri, 21 Sep 2018 20:46:42 +0000 (13:46 -0700)]
drm/vmwgfx: Update comments for stdu plane update

Update the comments to sync with code.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Use the new interface for STDU plane update
Deepak Rawat [Fri, 21 Sep 2018 20:42:35 +0000 (13:42 -0700)]
drm/vmwgfx: Use the new interface for STDU plane update

With new interface to do plane update on STDU available, use that
instead of old kms_dirty.

v2: Use fence from new resource validation.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Implement STDU plane update for BO backed fb
Deepak Rawat [Mon, 9 Jul 2018 23:17:17 +0000 (16:17 -0700)]
drm/vmwgfx: Implement STDU plane update for BO backed fb

Using the new interface implement STDU plane update for BO backed fb.

v2: Rebase to new resource validation.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Implement STDU plane update for surface backed fb
Deepak Rawat [Wed, 11 Jul 2018 23:25:19 +0000 (16:25 -0700)]
drm/vmwgfx: Implement STDU plane update for surface backed fb

Using the new interface implement STDU plane update for surface backed
fb.

v2: Rebase to new resource validation.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/vmwgfx: Add a new interface for plane update on a display unit
Deepak Rawat [Wed, 11 Jul 2018 22:42:45 +0000 (15:42 -0700)]
drm/vmwgfx: Add a new interface for plane update on a display unit

Add a new struct vmw_du_update_plane similar to vmw_kms_dirty which
represent the flow of operations needed to update a display unit from
surface or bo (blit a new framebuffer).

v2:
- Kernel doc correction.
- Rebase.

v3: Rebase to new resource validation.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm: Add helper to implement legacy dirtyfb
Rob Clark [Thu, 31 May 2018 00:46:20 +0000 (17:46 -0700)]
drm: Add helper to implement legacy dirtyfb

Add an atomic helper to implement dirtyfb support.  This is needed to
support DSI command-mode panels with x11 userspace (ie. when we can't
rely on pageflips to trigger a flush to the panel).

v2: Modified the helper to use plane fb_damage_clips property and
removed plane_state::dirty flag.

v3:
- Use uapi drm_mode_rect.
- Support annotate flags.

v4: Correct kernel doc.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/selftest: Add drm damage helper selftest
Deepak Rawat [Mon, 15 Oct 2018 18:07:08 +0000 (11:07 -0700)]
drm/selftest: Add drm damage helper selftest

Selftest for drm damage helper iterator functions.

v2: Rebase to new test-drm_modeset.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm: Add helper iterator functions for plane fb_damage_clips blob
Deepak Rawat [Wed, 30 May 2018 21:42:52 +0000 (14:42 -0700)]
drm: Add helper iterator functions for plane fb_damage_clips blob

With fb_damage_clips blob property in drm_plane_state, this patch adds
helper iterator to traverse the damage clips that lie inside plane src.
Iterator will return full plane src as damage in case need full plane
update or damage is not specified.

v2:
- Plane src clipping correction
- Handle no plane update case in iter_next

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm: Add a new helper to validate damage during atomic_check
Deepak Rawat [Thu, 9 Aug 2018 00:36:26 +0000 (17:36 -0700)]
drm: Add a new helper to validate damage during atomic_check

This helper function makes sure that damage from plane state is
discarded for full modeset.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm: Add a new plane property to send damage during plane update
Lukasz Spintzyk [Thu, 24 May 2018 02:04:08 +0000 (19:04 -0700)]
drm: Add a new plane property to send damage during plane update

FB_DAMAGE_CLIPS is an optional plane property to mark damaged regions
on the plane in framebuffer coordinates of the framebuffer attached to
the plane.

The layout of blob data is simply an array of "struct drm_mode_rect".
Unlike plane src coordinates, damage clips are not in 16.16 fixed point.
As plane src in framebuffer cannot be negative so are damage clips. In
damage clip, x1/y1 are inclusive and x2/y2 are exclusive.

This patch also exports the kernel internal drm_rect to userspace as
drm_mode_rect. This is because "struct drm_clip_rect" is not sufficient
to represent damage for current plane size.

Driver which are interested in enabling FB_DAMAGE_CLIPS property for a
plane should enable this property using drm_plane_enable_damage_clips.

v2:
- Input validation on damage clips against framebuffer size.
- Doc update, other minor changes.

Signed-off-by: Lukasz Spintzyk <lukasz.spintzyk@displaylink.com>
Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
5 years agodrm/exynos: mixer: Fix color range setting
Christoph Manszewski [Wed, 28 Nov 2018 15:32:12 +0000 (16:32 +0100)]
drm/exynos: mixer: Fix color range setting

Color format and color range was set based on resolution. Change that,
by splitting range and format. Leave color format setting as it is,
set color range based on drm_display_mode using
drm_default_quant_range helper function.

Tested on Odroid-U3 with Exynos 4412 CPU, kernel next-20181128
using modetest.

Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: mixer: Fix color format setting
Christoph Manszewski [Wed, 28 Nov 2018 15:32:11 +0000 (16:32 +0100)]
drm/exynos: mixer: Fix color format setting

Fix color format decision based on height(pixels).

According to CEA-861-E:
"High Definition (HD) - A CE video format that, inclusively, has between
720 to 1080 active vertical lines (Vactive) lines per video frame."

Tested on Odroid-U3 with Exynos 4412 CPU, kernel next-20181128
using modetest.

Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: decon: Make pixel blend mode configurable
Christoph Manszewski [Thu, 25 Oct 2018 16:21:53 +0000 (18:21 +0200)]
drm/exynos: decon: Make pixel blend mode configurable

The decon hardware supports different blend modes. Add pixel blend mode
property and make it configurable, by modifying the blend equation.

Tested on TM2 with Exynos 5433 CPU, on top of linux-next-20181019.

Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: decon: Make plane alpha configurable
Christoph Manszewski [Thu, 25 Oct 2018 16:21:52 +0000 (18:21 +0200)]
drm/exynos: decon: Make plane alpha configurable

The decon hardware supports variable plane alpha. Currently planes
are opaque, make this configurable.

Tested on TM2 with Exynos 5433 CPU, on top of linux-next-20181019.

Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoMerge tag 'imx-drm-next-2018-12-03' of git://git.pengutronix.de/git/pza/linux into...
Dave Airlie [Wed, 5 Dec 2018 05:00:09 +0000 (15:00 +1000)]
Merge tag 'imx-drm-next-2018-12-03' of git://git.pengutronix.de/git/pza/linux into drm-next

drm/imx: update image-convert with fixes for multi-tiled scaling

Update the ipu-v3 mem2mem image-convert code, with some fixes for race
conditions, alignment issues, and visual artifacts due to tile alignment
and scaling factor issues when scaling images larger than hardware
limitations in multiple tiles. This will allow the V4L2 mem2mem scaler
driver to write output images larger than 1024x1024 pixels.

Also switch drm/imx source files to SPDX license identifiers, constify
struct clk_ops in imx-tve, and add a timeout warning to the busy wait in
ipu_plane_disable().

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1543835266.5647.1.camel@pengutronix.de
5 years agodrm/i915: Update DRIVER_DATE to 20181204
Jani Nikula [Tue, 4 Dec 2018 17:26:17 +0000 (19:26 +0200)]
drm/i915: Update DRIVER_DATE to 20181204

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
5 years agodrm/i915/icl: fix transcoder state readout
Jani Nikula [Tue, 4 Dec 2018 10:19:26 +0000 (12:19 +0200)]
drm/i915/icl: fix transcoder state readout

Commit 2ca711caeca2 ("drm/i915/icl: Consider DSI for getting transcoder
state") clobbers the previously read TRANS_DDI_FUNC_CTL_EDP register
contents with TRANS_DDI_FUNC_CTL_DSI0 contents. Fix the state readout,
and handle DSI 1 while at it.

Use a bitmask for iterating and logging transcoders, because the allowed
combinations are a bit funky.

Fixes: 2ca711caeca2 ("drm/i915/icl: Consider DSI for getting transcoder state")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108928
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Madhav Chauhan <madhav.chauhan@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181204101926.17174-1-jani.nikula@intel.com
5 years agodrm/i915: Allocate a common scratch page
Chris Wilson [Tue, 4 Dec 2018 14:15:16 +0000 (14:15 +0000)]
drm/i915: Allocate a common scratch page

Currently we allocate a scratch page for each engine, but since we only
ever write into it for post-sync operations, it is not exposed to
userspace nor do we care for coherency. As we then do not care about its
contents, we can use one page for all, reducing our allocations and
avoid complications by not assuming per-engine isolation.

For later use, it simplifies engine initialisation (by removing the
allocation that required struct_mutex!) and means that we can always rely
on there being a scratch page.

v2: Check that we allocated a large enough scratch for I830 w/a

Fixes: 06e562e7f515 ("drm/i915/ringbuffer: Delay after EMIT_INVALIDATE for gen4/gen5") # v4.18.20
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108850
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181204141522.13640-1-chris@chris-wilson.co.uk
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.18.20+
5 years agodrm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_tr...
YueHaibing [Thu, 29 Nov 2018 06:00:33 +0000 (06:00 +0000)]
drm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_transfer()

use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1543471233-159568-1-git-send-email-yuehaibing@huawei.com
5 years agodrm/i915: Trim unused workaround list entries
Tvrtko Ursulin [Mon, 3 Dec 2018 12:50:14 +0000 (12:50 +0000)]
drm/i915: Trim unused workaround list entries

The new workaround list allocator grows the list in chunks so will end up
with some unused space. Trim it when the initialization phase is done to
free up a tiny bit of slab.

v2:
 * Simplify with kmemdup. (Chris Wilson)

v3:
 * Refactor for __size removal.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203125014.3219-8-tvrtko.ursulin@linux.intel.com
5 years agodrm/i915: Fuse per-context workaround handling with the common framework
Tvrtko Ursulin [Mon, 3 Dec 2018 13:33:57 +0000 (13:33 +0000)]
drm/i915: Fuse per-context workaround handling with the common framework

Convert the per context workaround handling code to run against the newly
introduced common workaround framework and fuse the two to use the
existing smarter list add helper, the one which does the sorted insert and
merges registers where possible.

This completes migration of all four classes of workarounds onto the
common framework.

Existing macros are kept untouched for smaller code churn.

v2:
 * Rename to list name ctx_wa_list and move from dev_priv to engine.

v3:
 * API rename and parameters tweaking. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203133357.10341-1-tvrtko.ursulin@linux.intel.com
5 years agodrm/i915: Move register white-listing to the common workaround framework
Tvrtko Ursulin [Mon, 3 Dec 2018 12:50:12 +0000 (12:50 +0000)]
drm/i915: Move register white-listing to the common workaround framework

Instead of having a separate list of white-listed registers we can
trivially move this to the common workarounds framework.

This brings us one step closer to the goal of driving all workaround
classes using the same code.

v2:
 * Use GEM_DEBUG_WARN_ON for the sanity check. (Chris Wilson)

v3:
 * API rename. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203125014.3219-6-tvrtko.ursulin@linux.intel.com
5 years agodrm/i915/selftests: Add tests for GT and engine workaround verification
Tvrtko Ursulin [Mon, 3 Dec 2018 12:50:11 +0000 (12:50 +0000)]
drm/i915/selftests: Add tests for GT and engine workaround verification

Two simple selftests which test that both GT and engine workarounds are
not lost after either a full GPU reset, or after the per-engine ones.

(Including checks that one engine reset is not affecting workarounds not
belonging to itself.)

v2:
 * Rebase for series refactoring.
 * Add spinner for actual engine reset!
 * Add idle reset test as well. (Chris Wilson)
 * Share existing global_reset_lock. (Chris Wilson)

v3:
 * intel_engine_verify_workarounds can be static.
 * API rename. (Chris Wilson)
 * Move global reset lock out of the loop. (Chris Wilson)

v4:
 * Add missing rpm puts. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203125014.3219-5-tvrtko.ursulin@linux.intel.com
5 years agodrm/i915: Verify GT workaround state after GPU init
Tvrtko Ursulin [Mon, 3 Dec 2018 12:50:10 +0000 (12:50 +0000)]
drm/i915: Verify GT workaround state after GPU init

Since we now have all the GT workarounds in a table, by adding a simple
shared helper function we can now verify that their values are still
applied after some interesting events in the lifetime of the driver.

Initially we only do this after GPU initialization.

v2:
 Chris Wilson:
 * Simplify verification by realizing it's a simple xor and and.
 * Remove verification from engine reset path.
 * Return bool straight away from the verify API.

v3:
 * API rename. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203125014.3219-4-tvrtko.ursulin@linux.intel.com
5 years agodrm/i915: Introduce per-engine workarounds
Tvrtko Ursulin [Mon, 3 Dec 2018 13:33:41 +0000 (13:33 +0000)]
drm/i915: Introduce per-engine workarounds

We stopped re-applying the GT workarounds after engine reset since commit
59b449d5c82a ("drm/i915: Split out functions for different kinds of
workarounds").

Issue with this is that some of the GT workarounds live in the MMIO space
which gets lost during engine resets. So far the registers in 0x2xxx and
0xbxxx address range have been identified to be affected.

This losing of applied workarounds has obvious negative effects and can
even lead to hard system hangs (see the linked Bugzilla).

Rather than just restoring this re-application, because we have also
observed that it is not safe to just re-write all GT workarounds after
engine resets (GPU might be live and weird hardware states can happen),
we introduce a new class of per-engine workarounds and move only the
affected GT workarounds over.

Using the framework introduced in the previous patch, we therefore after
engine reset, re-apply only the workarounds living in the affected MMIO
address ranges.

v2:
 * Move Wa_1406609255:icl to engine workarounds as well.
 * Rename API. (Chris Wilson)
 * Drop redundant IS_KABYLAKE. (Chris Wilson)
 * Re-order engine wa/ init so latest platforms are first. (Rodrigo Vivi)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Bugzilla: https://bugzilla.freedesktop.org/show_bug.cgi?id=107945
Fixes: 59b449d5c82a ("drm/i915: Split out functions for different kinds of workarounds")
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203133341.10258-1-tvrtko.ursulin@linux.intel.com
5 years agodrm/i915: Record GT workarounds in a list
Tvrtko Ursulin [Mon, 3 Dec 2018 13:33:19 +0000 (13:33 +0000)]
drm/i915: Record GT workarounds in a list

To enable later verification of GT workaround state at various stages of
driver lifetime, we record the list of applicable ones per platforms to a
list, from which they are also applied.

The added data structure is a simple array of register, mask and value
items, which is allocated on demand as workarounds are added to the list.

This is a temporary implementation which later in the series gets fused
with the existing per context workaround list handling. It is separated at
this stage since the following patch fixes a bug which needs to be as easy
to backport as possible.

Also, since in the following patch we will be adding a new class of
workarounds (per engine) which can be applied from interrupt context, we
straight away make the provision for safe read-modify-write cycle.

v2:
 * Change dev_priv to i915 along the init path. (Chris Wilson)
 * API rename. (Chris Wilson)

v3:
 * Remove explicit list size tracking in favour of growing the allocation
   in power of two chunks. (Chris Wilson)

v4:
 Chris Wilson:
 * Change wa_list_finish to early return.
 * Copy workarounds using the compiler for static checking.
 * Do not bother zeroing unused entries.
 * Re-order struct i915_wa_list.

v5:
 * kmalloc_array.
 * Whitespace cleanup.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203133319.10174-1-tvrtko.ursulin@linux.intel.com
5 years agodrm/i915: change i915_sw_fence license to MIT
Jonathan Gray [Thu, 29 Nov 2018 01:30:51 +0000 (12:30 +1100)]
drm/i915: change i915_sw_fence license to MIT

Change the license of the i915_sw_fence files to MIT matching
most of the other i915 files.  This makes it possible to use them
in a new port of i915 to OpenBSD.

Besides some mechanical tree wide changes Chris Wilson is the sole
author of these files with Intel holding the copyright.

Intel's legal team have given permission to change the license according
to Joonas Lahtinen.

v2: expand commit message and note permission from Intel legal

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129013051.17525-1-jsg@jsg.id.au
5 years agodrm/i915: Complete the fences as they are cancelled due to wedging
Chris Wilson [Mon, 3 Dec 2018 11:36:55 +0000 (11:36 +0000)]
drm/i915: Complete the fences as they are cancelled due to wedging

We inspect the requests under the assumption that they will be marked as
completed when they are removed from the queue. Currently however, in the
process of wedging the requests will be removed from the queue before they
are completed, so rearrange the code to complete the fences before the
locks are dropped.

<1>[  354.473346] BUG: unable to handle kernel NULL pointer dereference at 0000000000000250
<6>[  354.473363] PGD 0 P4D 0
<4>[  354.473370] Oops: 0000 [#1] PREEMPT SMP PTI
<4>[  354.473380] CPU: 0 PID: 4470 Comm: gem_eio Tainted: G     U            4.20.0-rc4-CI-CI_DRM_5216+ #1
<4>[  354.473393] Hardware name: Intel Corporation NUC7CJYH/NUC7JYB, BIOS JYGLKCPX.86A.0027.2018.0125.1347 01/25/2018
<4>[  354.473480] RIP: 0010:__i915_schedule+0x311/0x5e0 [i915]
<4>[  354.473490] Code: 49 89 44 24 20 4d 89 4c 24 28 4d 89 29 44 39 b3 a0 04 00 00 7d 3a 41 8b 44 24 78 85 c0 74 13 48 8b 93 78 04 00 00 48 83 e2 fc <39> 82 50 02 00 00 79 1e 44 89 b3 a0 04 00 00 48 8d bb d0 03 00 00
<4>[  354.473515] RSP: 0018:ffffc900001bba90 EFLAGS: 00010046
<4>[  354.473524] RAX: 0000000000000003 RBX: ffff8882624c8008 RCX: f34a737800000000
<4>[  354.473535] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8882624c8048
<4>[  354.473545] RBP: ffffc900001bbab0 R08: 000000005963f1f1 R09: 0000000000000000
<4>[  354.473556] R10: ffffc900001bba10 R11: ffff8882624c8060 R12: ffff88824fdd7b98
<4>[  354.473567] R13: ffff88824fdd7bb8 R14: 0000000000000001 R15: ffff88824fdd7750
<4>[  354.473578] FS:  00007f44b4b5b980(0000) GS:ffff888277e00000(0000) knlGS:0000000000000000
<4>[  354.473590] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4>[  354.473599] CR2: 0000000000000250 CR3: 000000026976e000 CR4: 0000000000340ef0
<4>[  354.473611] Call Trace:
<4>[  354.473622]  ? lock_acquire+0xa6/0x1c0
<4>[  354.473677]  ? i915_schedule_bump_priority+0x57/0xd0 [i915]
<4>[  354.473736]  i915_schedule_bump_priority+0x72/0xd0 [i915]
<4>[  354.473792]  i915_request_wait+0x4db/0x840 [i915]
<4>[  354.473804]  ? get_pwq.isra.4+0x2c/0x50
<4>[  354.473813]  ? ___preempt_schedule+0x16/0x18
<4>[  354.473824]  ? wake_up_q+0x70/0x70
<4>[  354.473831]  ? wake_up_q+0x70/0x70
<4>[  354.473882]  ? gen6_rps_boost+0x118/0x120 [i915]
<4>[  354.473936]  i915_gem_object_wait_fence+0x8a/0x110 [i915]
<4>[  354.473991]  i915_gem_object_wait+0x113/0x500 [i915]
<4>[  354.474047]  i915_gem_wait_ioctl+0x11c/0x2f0 [i915]
<4>[  354.474101]  ? i915_gem_unset_wedged+0x210/0x210 [i915]
<4>[  354.474113]  drm_ioctl_kernel+0x81/0xf0
<4>[  354.474123]  drm_ioctl+0x2de/0x390
<4>[  354.474175]  ? i915_gem_unset_wedged+0x210/0x210 [i915]
<4>[  354.474187]  ? finish_task_switch+0x95/0x260
<4>[  354.474197]  ? lock_acquire+0xa6/0x1c0
<4>[  354.474207]  do_vfs_ioctl+0xa0/0x6e0
<4>[  354.474217]  ? __fget+0xfc/0x1e0
<4>[  354.474225]  ksys_ioctl+0x35/0x60
<4>[  354.474233]  __x64_sys_ioctl+0x11/0x20
<4>[  354.474241]  do_syscall_64+0x55/0x190
<4>[  354.474251]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
<4>[  354.474260] RIP: 0033:0x7f44b3de65d7
<4>[  354.474267] Code: b3 66 90 48 8b 05 b1 48 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 81 48 2d 00 f7 d8 64 89 01 48
<4>[  354.474293] RSP: 002b:00007fff974948e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
<4>[  354.474305] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f44b3de65d7
<4>[  354.474316] RDX: 00007fff97494940 RSI: 00000000c010646c RDI: 0000000000000007
<4>[  354.474327] RBP: 00007fff97494940 R08: 0000000000000000 R09: 00007f44b40bbc40
<4>[  354.474337] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000c010646c
<4>[  354.474348] R13: 0000000000000007 R14: 0000000000000000 R15: 0000000000000000

v2: Avoid floating requests.
v3: Can't call dma_fence_signal() under the timeline lock!
v4: Can't call dma_fence_signal() from inside another fence either.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203113701.12106-2-chris@chris-wilson.co.uk
5 years agodrm/vkms: Remove set but not used variable 'vkms_obj'
YueHaibing [Sat, 1 Dec 2018 03:20:44 +0000 (03:20 +0000)]
drm/vkms: Remove set but not used variable 'vkms_obj'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/vkms/vkms_plane.c: In function 'vkms_prepare_fb':
drivers/gpu/drm/vkms/vkms_plane.c:144:26: warning:
 variable 'vkms_obj' set but not used [-Wunused-but-set-variable]

It never used since introduction in commit
8ce1bb0b5337 ("drm/vkms: map/unmap buffers in [prepare/cleanup]_fb hooks")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1543634444-186448-1-git-send-email-yuehaibing@huawei.com
5 years agodrm/i915/dp: Fix inconsistent indenting
Chris Wilson [Tue, 20 Nov 2018 20:24:39 +0000 (20:24 +0000)]
drm/i915/dp: Fix inconsistent indenting

Always show the FEC capability as it is initialised to 0 before error.
Fixing,

drivers/gpu/drm/i915/intel_dp.c:3846 intel_dp_get_dsc_sink_cap() warn: inconsistent indenting

Fixes: 08cadae8e157 ("i915/dp/fec: Cache the FEC_CAPABLE DPCD register")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181120202439.13017-2-chris@chris-wilson.co.uk
5 years agodrm/sun4i: Add compatible for H6 display engine
Jernej Skrabec [Sun, 4 Nov 2018 18:26:45 +0000 (19:26 +0100)]
drm/sun4i: Add compatible for H6 display engine

H6 is first Allwinner SoC which supports 10 bit colors, HDR and AFBC.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181104182705.18047-9-jernej.skrabec@siol.net
5 years agodrm/exynos/iommu: merge IOMMU and DMA code
Andrzej Hajda [Fri, 12 Oct 2018 10:53:46 +0000 (12:53 +0200)]
drm/exynos/iommu: merge IOMMU and DMA code

As DMA code is the only user of IOMMU code both files can be merged.
It allows to remove stub functions, after slight adjustment of
exynos_drm_register_dma. Since IOMMU functions are used locally they
can be marked static.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/iommu: replace preprocessor conditionals with C conditionals
Andrzej Hajda [Fri, 12 Oct 2018 10:53:45 +0000 (12:53 +0200)]
drm/exynos/iommu: replace preprocessor conditionals with C conditionals

Using C conditionals is preferred solution - it provides better code
coverage, makes code more clear.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/iommu: move IOMMU specific stuff into exynos_drm_iommu.c
Andrzej Hajda [Fri, 12 Oct 2018 10:53:44 +0000 (12:53 +0200)]
drm/exynos/iommu: move IOMMU specific stuff into exynos_drm_iommu.c

Since __exynos_iommu* functions are used only in exynos_drm_iommu.c we can
move them there.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/iommu: integrate IOMMU/DMA internal API
Andrzej Hajda [Fri, 12 Oct 2018 10:53:43 +0000 (12:53 +0200)]
drm/exynos/iommu: integrate IOMMU/DMA internal API

Exynos DRM drivers should work with and without IOMMU. Providing common
API generic to both scenarios should make code cleaner and allow further
code improvements.
The patch removes including of exynos_drm_iommu.h as the file contains
mostly IOMMU specific stuff, instead it exposes exynos_drm_*_dma functions
and puts them into exynos_drm_dma.c.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/iommu: remove DRM_EXYNOS_IOMMU Kconfig symbol
Andrzej Hajda [Fri, 12 Oct 2018 10:53:42 +0000 (12:53 +0200)]
drm/exynos/iommu: remove DRM_EXYNOS_IOMMU Kconfig symbol

DRM_EXYNOS_IOMMU symbol is not configurable, it is always equal to
EXYNOS_IOMMU.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: simplify DMA mapping
Andrzej Hajda [Fri, 12 Oct 2018 10:53:41 +0000 (12:53 +0200)]
drm/exynos: simplify DMA mapping

Moving DMA mapping creation to drm_iommu_attach_device allows to avoid
looping through all components and maintaining DMA device flags.

v2: take care of configurations without IOMMU

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>