platform/kernel/linux-starfive.git
4 years agodrm/bridge: ti-sn65dsi86: zero is never greater than an unsigned int
Douglas Anderson [Wed, 18 Dec 2019 22:35:23 +0000 (14:35 -0800)]
drm/bridge: ti-sn65dsi86: zero is never greater than an unsigned int

When we iterate over ti_sn_bridge_dp_rate_lut, there's no reason to
start at index 0 which always contains the value 0.  0 is not a valid
link rate.

This change should have no real effect but is a small cleanup.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191218143416.v3.2.Id445d0057bedcb0a190009e0706e9254c2fd48eb@changeid
4 years agodrm/bridge: ti-sn65dsi86: Split the setting of the dp and dsi rates
Douglas Anderson [Wed, 18 Dec 2019 22:35:22 +0000 (14:35 -0800)]
drm/bridge: ti-sn65dsi86: Split the setting of the dp and dsi rates

These two things were in one function.  Split into two.  This looks
like it's duplicating some code, but don't worry.  This is is just in
preparation for future changes.

This is intended to have zero functional change and will just make
future patches easier to understand.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191218143416.v3.1.Icb765d5799e9651e5249c0c27627ba33a9e411cf@changeid
4 years agodrm/ttm: individualize resv objects before calling release_notify
Christian König [Mon, 10 Feb 2020 12:04:25 +0000 (13:04 +0100)]
drm/ttm: individualize resv objects before calling release_notify

This allows release_notify to add and remove fences from deleted objects.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: xinhui pan <xinhui.pan@amd.com>
Link: https://patchwork.freedesktop.org/patch/352750/
4 years agodrm/ttm: replace dma_resv object on deleted BOs v3
Christian König [Mon, 11 Nov 2019 14:16:56 +0000 (15:16 +0100)]
drm/ttm: replace dma_resv object on deleted BOs v3

When non-imported BOs are resurrected for delayed delete we replace
the dma_resv object to allow for easy reclaiming of the resources.

v2: move that to ttm_bo_individualize_resv
v3: add a comment to explain what's going on

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/352927/
4 years agodrm/ttm: rework BO delayed delete. v2
Christian König [Mon, 11 Nov 2019 13:42:13 +0000 (14:42 +0100)]
drm/ttm: rework BO delayed delete. v2

This patch reworks the whole delayed deletion of BOs which aren't idle.

Instead of having two counters for the BO structure we resurrect the BO
when we find that a deleted BO is not idle yet.

This has many advantages, especially that we don't need to
increment/decrement the BOs reference counter any more when it
moves on the LRUs.

v2: remove duplicate ttm_tt_destroy, fix holde lock for LRU move

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: xinhui pan <xinhui.pan@amd.com>
Link: https://patchwork.freedesktop.org/patch/352912/
4 years agodrm/virtio: add drm_driver.release callback.
Gerd Hoffmann [Tue, 11 Feb 2020 13:58:04 +0000 (14:58 +0100)]
drm/virtio: add drm_driver.release callback.

Split virtio_gpu_deinit(), move the drm shutdown and release to
virtio_gpu_release().  Drop vqs_ready variable, instead use
drm_dev_{enter,exit,unplug} to avoid touching hardware after
device removal.  Tidy up here and there.

v4: add changelog.
v3: use drm_dev_*().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200211135805.24436-1-kraxel@redhat.com
4 years agodrm/cirrus: add drm_driver.release callback.
Gerd Hoffmann [Tue, 11 Feb 2020 13:55:22 +0000 (14:55 +0100)]
drm/cirrus: add drm_driver.release callback.

Move final cleanups from cirrus_pci_remove() to the new callback.
Add drm_atomic_helper_shutdown() call to cirrus_pci_remove().

Use drm_dev_{enter,exit,unplug} to avoid touching hardware after
device removal.

v4: add changelog.
v3: use drm_dev*.
v2: stop touching hardware after pci_remove().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200211135522.23654-1-kraxel@redhat.com
4 years agodrm/bochs: add drm_driver.release callback.
Gerd Hoffmann [Tue, 11 Feb 2020 13:52:18 +0000 (14:52 +0100)]
drm/bochs: add drm_driver.release callback.

Call bochs_unload via drm_driver.release to make sure we release stuff
when it is safe to do so.  Use drm_dev_{enter,exit,unplug} to avoid
touching hardware after device removal.  Tidy up here and there.

v4: add changelog.
v3: use drm_dev_*().
v2: move hardware deinit to pci_remove().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200211135218.22871-1-kraxel@redhat.com
4 years agodrm/irq: remove check on dev->dev_private
Jani Nikula [Tue, 11 Feb 2020 14:47:53 +0000 (16:47 +0200)]
drm/irq: remove check on dev->dev_private

There is no real reason to require drivers to set and use
dev->dev_private. Indeed, the current recommendation, as documented in
drm_device.h, is to embed struct drm_device in the per-device struct
instead of using dev_private.

Remove the requirement for dev_private to have been set to indicate
driver initialization.

For background, quoting Daniel Vetter:

Now there might be some hilarious races this papers over, but:

- Proper drivers should only call drm_dev_register once everything is
  set up, including this stuff here. No race possible with anything else
  really.

- Slightly more wobbly drivers, including the legacy ones, all use
  drm_global_mutex. This was the former BKL, which means that it was
  impossible for soeone to go through the load/unload/reload (between
  lastclose and firstopen) paths and also run the ioctl. But the ioctl
  had to be made unlocked because blocking there killed X:

 commit 8f4ff2b06afcd6f151868474a432c603057eaf56
 Author: Ilija Hadzic <ihadzic@research.bell-labs.com>
 Date:   Mon Oct 31 17:46:18 2011 -0400

     drm: do not sleep on vblank while holding a mutex

  The even more legacy DRM_CONTROL ioctl stayed fully locked. But the
  file open/close paths are still fully locked, and that's the only
  place legacy drivers should call drm_irq_install/uninstall, so should
  all still be fully ordered and protected and happy.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200211144753.3175-1-jani.nikula@intel.com
4 years agodrm/panel: simple: Add Rocktech RK101II01D-CT panel
Jyri Sarha [Tue, 11 Feb 2020 12:17:18 +0000 (14:17 +0200)]
drm/panel: simple: Add Rocktech RK101II01D-CT panel

Add support for Rocktech RK101II01D-CT, 10.1" 1280x800 TFT with LVDS
interface, LED backlight and integrated Goodix GT928 capacitive touch
panel.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/b543b77d8af7cbbef852d3df4595f11ac1aa0046.1581423249.git.jsarha@ti.com
4 years agodt-bindings: panel-simple: Add rocktech,rk101ii01d-ct compatible
Jyri Sarha [Tue, 11 Feb 2020 12:17:17 +0000 (14:17 +0200)]
dt-bindings: panel-simple: Add rocktech,rk101ii01d-ct compatible

Add compatible to panel-simple for Rocktech Displays Limited
RK101II01D-CT 10.1" TFT 1280x800 Pixels with LVDS interface, LED
Backlight, and capacitive touch panel ("goodix,gt928" compatible).

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/2ffedf45e65943a021ed57a0d174900e43663b27.1581423249.git.jsarha@ti.com
4 years agodrm: Nerf drm_global_mutex BKL for good drivers
Daniel Vetter [Tue, 4 Feb 2020 15:01:46 +0000 (16:01 +0100)]
drm: Nerf drm_global_mutex BKL for good drivers

This catches the majority of drivers (unfortunately not if we take
users into account, because all the big drivers have at least a
lastclose hook).

With the prep patches out of the way all drm state is fully protected
and either prevents or can deal with the races from dropping the BKL
around open/close. The only thing left to audit are the various driver
hooks - by keeping the BKL around if any of them are set we have a
very simple cop-out!

Note that one of the biggest prep pieces to get here was making
dev->open_count atomic, which was done in

commit 7e13ad896484a0165a68197a2e64091ea28c9602
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 24 13:01:07 2020 +0000

    drm: Avoid drm_global_mutex for simple inc/dec of dev->open_count

v2:
- Rebase and fix locking in drm_open() (Chris)
- Indentation fix in drm_release
- Typo fix in the commit message (Sam)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200204150146.2006481-6-daniel.vetter@ffwll.ch
4 years agodrm: Push drm_global_mutex locking in drm_open
Daniel Vetter [Tue, 4 Feb 2020 15:01:45 +0000 (16:01 +0100)]
drm: Push drm_global_mutex locking in drm_open

We want to only take the BKL on crap drivers, but to know whether
we have a crap driver we first need to look it up. Split this shuffle
out from the main BKL-disabling patch, for more clarity. Historical
aside: When the kernel-wide BKL was removed, it was replaced by
drm_global_mutex within the scope of the drm subsystem hence why these
two things are (almost) interchangeable as concepts here.

Since the minors are refcounted drm_minor_acquire is purely internal
and this does not have a driver visible effect.

v2: Push the locking even further into drm_open(), suggested by Chris.
This gives us more symmetry with drm_release(), and maybe a futuer
avenue where we make drm_global_mutex locking (partially) opt-in like
with drm_release_noglobal().

v3:
- Actually push this stuff correctly, don't unlock twice (Chris)
- Fix typo on commit message, plus explain why BKL = drm_global_mutex
  (Sam)

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200204150146.2006481-5-daniel.vetter@ffwll.ch
4 years agodrm/client: Rename _force to _locked
Daniel Vetter [Tue, 4 Feb 2020 15:01:44 +0000 (16:01 +0100)]
drm/client: Rename _force to _locked

Plus extend the kerneldoc a bit to explain how this should be used.
With the previous patch to drop the force restore the main user of
this function is not emphasis on the "I hold the internal master lock
already" aspect, so rename the function to match.

Suggested by Noralf.

Cc: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200204150146.2006481-4-daniel.vetter@ffwll.ch
4 years agodrm/fbdev-helper: don't force restores
Daniel Vetter [Tue, 4 Feb 2020 15:01:43 +0000 (16:01 +0100)]
drm/fbdev-helper: don't force restores

Instead check for master status, in case we've raced.

This is the last exception to the general rule that we restore fbcon
only when there's no master active. Compositors are supposed to drop
their master status before they switch to a different console back to
text mode (or just switch to text mode directly, without a vt switch).

This is known to break some subtests of kms_fbcon_fbt in igt, but they're
just wrong - it does a graphics/text mode switch for the vt without
updating the master status.

Also add a comment to the drm_client->restore hook that this is expected
going forward from all clients (there's currently just one).

v2: Also drop the force in pan_display

v3: Restore the _force to pan_display, this actually means _locked in that
path. Spotted by Noralf.

Cc: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200204150146.2006481-3-daniel.vetter@ffwll.ch
4 years agodrm/ttm: use RCU in ttm_bo_flush_all_fences
Christian König [Mon, 10 Feb 2020 13:41:39 +0000 (14:41 +0100)]
drm/ttm: use RCU in ttm_bo_flush_all_fences

This allows it to call the function without the lock held.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: xinhui pan <xinhui.pan@amd.com>
Link: https://patchwork.freedesktop.org/patch/352742/
4 years agodrm/ttm: cleanup ttm_buffer_object_transfer
Christian König [Mon, 11 Nov 2019 12:52:03 +0000 (13:52 +0100)]
drm/ttm: cleanup ttm_buffer_object_transfer

The function is always called with deleted BOs.

While at it cleanup the indentation as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: xinhui pan <xinhui.pan@amd.com>
Link: https://patchwork.freedesktop.org/patch/352743/
4 years agodrm/ttm: refine ghost BO resv criteria
Christian König [Mon, 11 Nov 2019 12:44:40 +0000 (13:44 +0100)]
drm/ttm: refine ghost BO resv criteria

Ghost BOs need to stick with the resv object only when the origin is imported.

This is a low hanging fruit to avoid OOM situations on evictions.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: xinhui pan <xinhui.pan@amd.com>
Link: https://patchwork.freedesktop.org/patch/352740/
4 years agodrm/qxl: add drm_driver.release callback.
Gerd Hoffmann [Mon, 10 Feb 2020 11:37:52 +0000 (12:37 +0100)]
drm/qxl: add drm_driver.release callback.

Move final cleanups to qxl_drm_release() callback.
Add drm_atomic_helper_shutdown() call to qxl_pci_remove().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200210113753.5614-3-kraxel@redhat.com
4 years agodrm/qxl: reorder calls in qxl_device_fini().
Gerd Hoffmann [Mon, 10 Feb 2020 11:37:51 +0000 (12:37 +0100)]
drm/qxl: reorder calls in qxl_device_fini().

Reorder calls in qxl_device_fini().  Cleaning up gem & ttm
might trigger qxl commands, so we should do that before
releaseing command rings.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200210113753.5614-2-kraxel@redhat.com
4 years agodrm/omap: fix possible object reference leak
Wen Yang [Mon, 8 Apr 2019 02:58:32 +0000 (10:58 +0800)]
drm/omap: fix possible object reference leak

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 209, but without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 209, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yang99@zte.com.cn
4 years agodrm/omap: dmm_tiler: Remove the dma_async_issue_pending() call
Peter Ujfalusi [Wed, 31 Jul 2019 09:42:33 +0000 (12:42 +0300)]
drm/omap: dmm_tiler: Remove the dma_async_issue_pending() call

dma_sync_wait() is calling it so no need to call it in the driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190731094233.13890-3-peter.ujfalusi@ti.com
4 years agodrm/omap: dmm_tiler: Use dmaengine_prep_dma_memcpy() for i878 workaround
Peter Ujfalusi [Wed, 31 Jul 2019 09:42:32 +0000 (12:42 +0300)]
drm/omap: dmm_tiler: Use dmaengine_prep_dma_memcpy() for i878 workaround

Instead of dma_dev->device_prep_dma_memcpy() use the existing macro to
prepare the memcpy.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190731094233.13890-2-peter.ujfalusi@ti.com
4 years agodrm/omapdrm: Fix trivial spelling
Kieran Bingham [Mon, 9 Dec 2019 12:33:19 +0000 (12:33 +0000)]
drm/omapdrm: Fix trivial spelling

Fix trivial spelling identified while examining the code.

s/supprted./supported./

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191209123320.10186-1-kieran.bingham+renesas@ideasonboard.com
4 years agodrm/omap: use true,false for bool variable
Zheng Bin [Thu, 23 Jan 2020 07:05:23 +0000 (15:05 +0800)]
drm/omap: use true,false for bool variable

Fixes coccicheck warning:

drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c:681:1-15: WARNING: Assignment of 0/1 to bool variable
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c:732:1-15: WARNING: Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1579763123-62749-1-git-send-email-zhengbin13@huawei.com
4 years agodrm/bridge: tfp410: add pclk limits
Tomi Valkeinen [Tue, 21 Jan 2020 09:46:55 +0000 (11:46 +0200)]
drm/bridge: tfp410: add pclk limits

Add pixel clock limits to the driver as per TFP410 datasheet: min 25MHz,
max 165MHz.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200121094655.9092-1-tomi.valkeinen@ti.com
4 years agodrm/virtio: move virtio_gpu_mem_entry initialization to new function
Gerd Hoffmann [Fri, 7 Feb 2020 07:46:38 +0000 (08:46 +0100)]
drm/virtio: move virtio_gpu_mem_entry initialization to new function

Introduce new virtio_gpu_object_shmem_init() helper function which will
create the virtio_gpu_mem_entry array, containing the backing storage
information for the host.  For the most path this just moves code from
virtio_gpu_object_attach().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-5-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
4 years agodrm/virtio: move mapping teardown to virtio_gpu_cleanup_object()
Gerd Hoffmann [Fri, 7 Feb 2020 07:46:37 +0000 (08:46 +0100)]
drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()

Stop sending DETACH_BACKING commands, that will happening anyway when
releasing resources via UNREF.  Handle guest-side cleanup in
virtio_gpu_cleanup_object(), called when the host finished processing
the UNREF command.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-4-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
4 years agodrm/virtio: resource teardown tweaks
Gerd Hoffmann [Fri, 7 Feb 2020 07:46:36 +0000 (08:46 +0100)]
drm/virtio: resource teardown tweaks

Add new virtio_gpu_cleanup_object() helper function for object cleanup.
Wire up callback function for resource unref, do cleanup from callback
when we know the host stopped using the resource.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-3-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
4 years agodrm/virtio: simplify virtio_gpu_alloc_cmd
Gerd Hoffmann [Fri, 7 Feb 2020 07:46:35 +0000 (08:46 +0100)]
drm/virtio: simplify virtio_gpu_alloc_cmd

Just call virtio_gpu_alloc_cmd_resp with some fixed args
instead of duplicating most of the function body.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-2-kraxel@redhat.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
4 years agodrm/bochs: deinit bugfix
Gerd Hoffmann [Fri, 7 Feb 2020 12:43:48 +0000 (13:43 +0100)]
drm/bochs: deinit bugfix

Check whenever mode_config was actually properly
initialized before trying to clean it up.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207124348.21641-1-kraxel@redhat.com
4 years agodrm/bridge: panel: Fix typo in drm_panel_bridge_add docs
Enric Balletbo i Serra [Wed, 18 Dec 2019 12:12:23 +0000 (13:12 +0100)]
drm/bridge: panel: Fix typo in drm_panel_bridge_add docs

Fix the 'manged' typo with 'managed' in the drm_panel_bridge_add
kernel-doc documentation.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191218121223.30181-1-enric.balletbo@collabora.com
4 years agodrm/bridge/synopsys: dsi: missing post disable
Yannick Fertré [Tue, 21 Jan 2020 10:24:56 +0000 (11:24 +0100)]
drm/bridge/synopsys: dsi: missing post disable

Sometime the post_disable function is missing (not registered).

Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1579602296-7683-1-git-send-email-yannick.fertre@st.com
4 years agodrm/bridge: sii902x: Select SND_SOC_HDMI_CODEC if SND_SOC is configured
Jyri Sarha [Fri, 29 Nov 2019 15:23:42 +0000 (17:23 +0200)]
drm/bridge: sii902x: Select SND_SOC_HDMI_CODEC if SND_SOC is configured

To enable HDMI audio the SND_SOC_HDMI_CODEC needs to be
configured. Enable HDMI audio by selecting SND_SOC_HDMI_CODEC if
SND_SOC is configured. SND_SOC_HDMI_CODEC has no config menu entry and
should be selected automatically by the drivers using it.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
[narmstrong: atomatically -> automatically]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191129152342.29145-1-jsarha@ti.com
4 years agodrm/bridge: Add tc358768 driver
Peter Ujfalusi [Fri, 31 Jan 2020 11:15:53 +0000 (13:15 +0200)]
drm/bridge: Add tc358768 driver

Add basic support for the Toshiba TC358768 RGB to DSI bridge.
Not all the features of the TC358768 is implemented by the initial driver:
MIPI_DSI_MODE_VIDEO and MIPI_DSI_FMT_RGB888 is only supported and tested.

Only write is implemented for mipi_dsi_host_ops.transfer.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131111553.472-3-peter.ujfalusi@ti.com
4 years agodt-bindings: display: bridge: Add documentation for Toshiba tc358768
Peter Ujfalusi [Fri, 31 Jan 2020 11:15:52 +0000 (13:15 +0200)]
dt-bindings: display: bridge: Add documentation for Toshiba tc358768

TC358768/TC358778 is a Parallel RGB to MIPI DSI bridge.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131111553.472-2-peter.ujfalusi@ti.com
4 years agodt-bindings: drm: bridge: adv7511: Add ADV7535 support
Bogdan Togorean [Tue, 21 Jan 2020 08:27:24 +0000 (10:27 +0200)]
dt-bindings: drm: bridge: adv7511: Add ADV7535 support

ADV7535 is a part compatible with ADV7533 but it supports 1080p@60hz and
v1p2 supply is fixed to 1.8V

Signed-off-by: Bogdan Togorean <bogdan.togorean@analog.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200121082719.27972-4-bogdan.togorean@analog.com
4 years agodrm: bridge: adv7511: Add support for ADV7535
Bogdan Togorean [Tue, 21 Jan 2020 08:27:22 +0000 (10:27 +0200)]
drm: bridge: adv7511: Add support for ADV7535

ADV7535 is a DSI to HDMI bridge chip like ADV7533 but it allows
1080p@60Hz. v1p2 is fixed to 1.8V on ADV7535.

Signed-off-by: Bogdan Togorean <bogdan.togorean@analog.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200121082719.27972-3-bogdan.togorean@analog.com
4 years agodrm: bridge: adv7511: Remove DRM_I2C_ADV7533 Kconfig
Bogdan Togorean [Tue, 21 Jan 2020 08:27:20 +0000 (10:27 +0200)]
drm: bridge: adv7511: Remove DRM_I2C_ADV7533 Kconfig

This commit remove DRM_I2C_ADV7533 resulting a simpler driver and less
choices in Kconfig.

Signed-off-by: Bogdan Togorean <bogdan.togorean@analog.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200121082719.27972-2-bogdan.togorean@analog.com
4 years agodrm/udl: Clear struct drm_connector_funcs.dpms
Thomas Zimmermann [Fri, 7 Feb 2020 14:16:02 +0000 (15:16 +0100)]
drm/udl: Clear struct drm_connector_funcs.dpms

Atomic modesetting doesn't use struct drm_connector_funcs.dpms and
the set function, drm_helper_connector_dpms(), wouldn't support it
anyway. So keep the pointer to NULL.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200207141602.4760-2-tzimmermann@suse.de
4 years agodrm/bochs: Clear struct drm_connector_funcs.dpms
Thomas Zimmermann [Fri, 7 Feb 2020 14:16:01 +0000 (15:16 +0100)]
drm/bochs: Clear struct drm_connector_funcs.dpms

Atomic modesetting doesn't use struct drm_connector_funcs.dpms and
the set function, drm_helper_connector_dpms(), wouldn't support it
anyway. So keep the pointer to NULL.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200207141602.4760-1-tzimmermann@suse.de
4 years agodrm/tiny/st7735r: No need to set ->owner for spi_register_driver()
Andy Shevchenko [Fri, 31 Jan 2020 20:49:28 +0000 (22:49 +0200)]
drm/tiny/st7735r: No need to set ->owner for spi_register_driver()

The spi_register_driver() will set the ->owner member to THIS_MODULE.

Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: David Lechner <david@lechnology.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131204923.48928-4-andriy.shevchenko@linux.intel.com
4 years agodrm/tiny/st7735r: Make driver OF-independent
Andy Shevchenko [Fri, 31 Jan 2020 20:49:26 +0000 (22:49 +0200)]
drm/tiny/st7735r: Make driver OF-independent

There is one OF call in the driver that limits its area of use.
Replace it to generic device_get_match_data() and get rid of OF dependency.

Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: David Lechner <david@lechnology.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131204923.48928-3-andriy.shevchenko@linux.intel.com
4 years agodrm/tiny/repaper: No need to set ->owner for spi_register_driver()
Andy Shevchenko [Fri, 31 Jan 2020 20:49:24 +0000 (22:49 +0200)]
drm/tiny/repaper: No need to set ->owner for spi_register_driver()

The spi_register_driver() will set the ->owner member to THIS_MODULE.

Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: David Lechner <david@lechnology.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131204923.48928-2-andriy.shevchenko@linux.intel.com
4 years agodrm/tiny/repaper: Make driver OF-independent
Andy Shevchenko [Fri, 31 Jan 2020 20:49:22 +0000 (22:49 +0200)]
drm/tiny/repaper: Make driver OF-independent

There is one OF call in the driver that limits its area of use.
Replace it to generic device_get_match_data() and get rid of OF dependency.

While here, cast SPI driver data to certain enumerator type.

Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Lechner <david@lechnology.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131204923.48928-1-andriy.shevchenko@linux.intel.com
4 years agodrm/tiny: add support for tft displays based on ilitek,ili9486
Kamlesh Gurudasani [Sun, 9 Feb 2020 18:06:41 +0000 (23:36 +0530)]
drm/tiny: add support for tft displays based on ilitek,ili9486

This adds support fot ilitek,ili9486 based displays with shift register
in front of controller.
Ozzmaker,Piscreen and Waveshare,rpi-lcd-35 are such displays.

Acked-by: Sam Ravnborg <sam@ravnborg.org> (v4)
Reviewed-by: Noralf Tronnes <noralf@tronnes.org> (v4)
Signed-off-by: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
[fixed checkpatch warnings]
Link: https://patchwork.freedesktop.org/patch/msgid/a9c8065c3ef7707650630b3b21a0c01d725fc5a0.1581270802.git.kamlesh.gurudasani@gmail.com
4 years agodt-bindings: add binding for tft displays based on ilitek,ili9486
Kamlesh Gurudasani [Sun, 9 Feb 2020 18:06:26 +0000 (23:36 +0530)]
dt-bindings: add binding for tft displays based on ilitek,ili9486

This binding is for the tft displays based on ilitek,ili9486.
ozzmaker,piscreen and waveshare,rpi-lcd-35 are such displays

Signed-off-by: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/8938c7a53598db793bbcddf205dcf35bcc19a18e.1581270802.git.kamlesh.gurudasani@gmail.com
4 years agodt-bindings: panel: Convert orisetech,otm8009a to json-schema
Benjamin Gaignard [Thu, 6 Feb 2020 13:33:44 +0000 (14:33 +0100)]
dt-bindings: panel: Convert orisetech,otm8009a to json-schema

Convert orisetech,otm8009a to json-schema.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200206133344.724-4-benjamin.gaignard@st.com
4 years agodt-bindings: panel: Convert raydium,rm68200 to json-schema
Benjamin Gaignard [Thu, 6 Feb 2020 13:33:43 +0000 (14:33 +0100)]
dt-bindings: panel: Convert raydium,rm68200 to json-schema

Convert raydium,rm68200 to json-schema.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200206133344.724-3-benjamin.gaignard@st.com
4 years agodt-bindings: one file of all simple DSI panels
Sam Ravnborg [Thu, 6 Feb 2020 13:33:42 +0000 (14:33 +0100)]
dt-bindings: one file of all simple DSI panels

To complement panel-simple.yaml, create panel-simple-dsi.yaml.
panel-simple-dsi-yaml are for all simple DSP panels with a single
power-supply and optional backlight / enable GPIO.

Migrate panasonic,vvx10f034n00 over to the new file.

The objectives with one file for all the simple DSI panels are:
    - Make it simpler to add bindings for simple DSI panels
    - Keep the number of bindings file lower
    - Keep the binding documentation for simple DSI panels more consistent

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Yannick Fertre <yannick.fertre@st.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: devicetree@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20200206133344.724-2-benjamin.gaignard@st.com
4 years agodrm/virtio: fix ring free check
Gerd Hoffmann [Fri, 7 Feb 2020 06:46:53 +0000 (07:46 +0100)]
drm/virtio: fix ring free check

If the virtio device supports indirect ring descriptors we need only one
ring entry for the whole command.  Take that into account when checking
whenever the virtqueue has enough free entries for our command.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200207064653.14403-1-kraxel@redhat.com
4 years agodrm/virtio: move virtqueue_notify into virtio_gpu_queue_ctrl_sgs
Chia-I Wu [Wed, 5 Feb 2020 18:19:54 +0000 (10:19 -0800)]
drm/virtio: move virtqueue_notify into virtio_gpu_queue_ctrl_sgs

It becomes clear that virtio_gpu_queue_fenced_ctrl_buffer should be
responsible for setting up sgs and virtio_gpu_queue_ctrl_sgs should
be responsible for queuing sgs.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-11-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: move the check for vqs_ready earlier
Chia-I Wu [Wed, 5 Feb 2020 18:19:52 +0000 (10:19 -0800)]
drm/virtio: move the check for vqs_ready earlier

When vqs_ready is false, vq should be considered invalid and we
should not check vq->num_free.  After this change, a fenced command
queued before the vqs are ready will have fence id 0 and will be
considered done.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-9-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: move locking into virtio_gpu_queue_ctrl_sgs
Chia-I Wu [Wed, 5 Feb 2020 18:19:51 +0000 (10:19 -0800)]
drm/virtio: move locking into virtio_gpu_queue_ctrl_sgs

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-8-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: set up virtqueue sgs before locking
Chia-I Wu [Wed, 5 Feb 2020 18:19:50 +0000 (10:19 -0800)]
drm/virtio: set up virtqueue sgs before locking

sgs setup does not need to be in the critical section.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-7-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: unlock object array on errors
Chia-I Wu [Wed, 5 Feb 2020 18:19:49 +0000 (10:19 -0800)]
drm/virtio: unlock object array on errors

We don't propagate erros to the callers.  We have to unlock object
arrays on errors.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-6-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: no need to pass virtio_gpu_ctrl_hdr
Chia-I Wu [Wed, 5 Feb 2020 18:19:48 +0000 (10:19 -0800)]
drm/virtio: no need to pass virtio_gpu_ctrl_hdr

We can get it from vbuf.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-5-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: add virtio_gpu_vbuf_ctrl_hdr
Chia-I Wu [Wed, 5 Feb 2020 18:19:47 +0000 (10:19 -0800)]
drm/virtio: add virtio_gpu_vbuf_ctrl_hdr

It is a helper to return the virtio_gpu_ctrl_hdr in a vbuf.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-4-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: remove incorrect ENOSPC check
Chia-I Wu [Wed, 5 Feb 2020 18:19:46 +0000 (10:19 -0800)]
drm/virtio: remove incorrect ENOSPC check

The handling of virtqueue_add_sgs ENOSPC error is incorrect because
it can result in out-of-order virtqueue_add_sgs and break fences.
We never get ENOSPC anyway because the caller waits until there is
enough space (the other caller that did not wait was removed in
commit 32d6c2c5b522 ("drm/virtio: Rewrite virtio_gpu_queue_ctrl_buffer
using fenced version.")).  Remove the incorrect and unnecessary error
path.

This also adds a WARN_ON(ret) until we properly handle errors.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Cc: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-3-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: fix a wait_event condition
Chia-I Wu [Wed, 5 Feb 2020 18:19:45 +0000 (10:19 -0800)]
drm/virtio: fix a wait_event condition

outcnt may be greater than 1 since commit e1218b8c0cc1 ("drm/virtio:
Use vmalloc for command buffer allocations.").

Fixes: e1218b8c0cc1 ("drm/virtio: Use vmalloc for command buffer allocations.")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Cc: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-2-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm/virtio: ratelimit error logging
Gerd Hoffmann [Wed, 5 Feb 2020 10:25:52 +0000 (11:25 +0100)]
drm/virtio: ratelimit error logging

Avoid flooding the log in case we screw up badly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205102552.21409-1-kraxel@redhat.com
4 years agodrm/vboxvideo: Implement struct drm_mode_config_funcs.mode_valid
Thomas Zimmermann [Mon, 3 Feb 2020 15:52:58 +0000 (16:52 +0100)]
drm/vboxvideo: Implement struct drm_mode_config_funcs.mode_valid

The implementation of struct drm_mode_config_funcs.mode_valid verifies
that enough video memory is available for a given display mode.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200203155258.9346-5-tzimmermann@suse.de
4 years agodrm/hibmc: Implement struct drm_mode_config_funcs.mode_valid
Thomas Zimmermann [Mon, 3 Feb 2020 15:52:57 +0000 (16:52 +0100)]
drm/hibmc: Implement struct drm_mode_config_funcs.mode_valid

The implementation of struct drm_mode_config_funcs.mode_valid verifies
that enough video memory is available for a given display mode.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200203155258.9346-4-tzimmermann@suse.de
4 years agodrm/bochs: Implement struct drm_mode_config_funcs.mode_valid
Thomas Zimmermann [Mon, 3 Feb 2020 15:52:56 +0000 (16:52 +0100)]
drm/bochs: Implement struct drm_mode_config_funcs.mode_valid

The implementation of struct drm_mode_config_funcs.mode_valid verifies
that enough video memory is available for a given display mode. This
replaces similar functionality in bochs_connector_mode_valid().

v2:
* remove bochs_connector_mode_valid(), which now serves no purpose

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200203155258.9346-3-tzimmermann@suse.de
4 years agodrm/vram: Add helpers to validate a display mode's memory requirements
Thomas Zimmermann [Mon, 3 Feb 2020 15:52:55 +0000 (16:52 +0100)]
drm/vram: Add helpers to validate a display mode's memory requirements

Devices with low amount of dedicated video memory may not be able
to use all possible display modes, as the framebuffers may not fit
into VRAM. The new helper function drm_vram_helper_mode_valid()
implements a simple test to sort out all display modes that can
not be used in any case. Drivers should call this function from
struct drm_mode_config_funcs.mode_valid.

The functionality was originally implemented by the ast driver, which
is being converted as well.

v2:
* WARN_ON if VRAM memory manager has not been initialized
* documentation fixes
* unexported drm_vram_helper_mode_valid_internal()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200203155258.9346-2-tzimmermann@suse.de
4 years agodrm/virtio: fix vblank handling
Gerd Hoffmann [Wed, 5 Feb 2020 06:53:11 +0000 (07:53 +0100)]
drm/virtio: fix vblank handling

virtio has its own commit fail function.  Add the
drm_atomic_helper_fake_vblank() call there.

Fixes: 2a735ad3d211 ("drm/virtio: Remove sending of vblank event")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205065312.15790-1-kraxel@redhat.com
4 years agodrm: Remove the dma_alloc_coherent wrapper for internal usage
Chris Wilson [Sun, 2 Feb 2020 17:16:32 +0000 (17:16 +0000)]
drm: Remove the dma_alloc_coherent wrapper for internal usage

Internally for "consistent" maps, we create a temporary struct
drm_dma_handle in order to use our own dma_alloc_coherent wrapper then
destroy the temporary wrap. Simplify our logic by removing the temporary
wrapper!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-2-chris@chris-wilson.co.uk
4 years agodrm: Remove PageReserved manipulation from drm_pci_alloc
Chris Wilson [Sun, 2 Feb 2020 17:16:31 +0000 (17:16 +0000)]
drm: Remove PageReserved manipulation from drm_pci_alloc

drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma
facilities, and we have no special reason within the drm layer to behave
differently. In particular, since

commit de09d31dd38a50fdce106c15abd68432eebbd014
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Fri Jan 15 16:51:42 2016 -0800

    page-flags: define PG_reserved behavior on compound pages

    As far as I can see there's no users of PG_reserved on compound pages.
    Let's use PF_NO_COMPOUND here.

it has been illegal to combine GFP_COMP with SetPageReserved, so lets
stop doing both and leave the dma layer to its own devices.

Reported-by: Taketo Kabe
Bug: https://gitlab.freedesktop.org/drm/intel/issues/1027
Fixes: de09d31dd38a ("page-flags: define PG_reserved behavior on compound pages")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: <stable@vger.kernel.org> # v4.5+
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk
4 years agodrm/stm: dsi: stm mipi dsi doesn't print error on probe deferral
Etienne Carriere [Tue, 21 Jan 2020 10:24:05 +0000 (11:24 +0100)]
drm/stm: dsi: stm mipi dsi doesn't print error on probe deferral

Change DSI driver to not print an error trace when probe
is deferred for a clock resource.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1579602245-7577-1-git-send-email-yannick.fertre@st.com
4 years agodrm/stm: ltdc: check crtc state before enabling LIE
Yannick Fertre [Tue, 21 Jan 2020 10:14:10 +0000 (11:14 +0100)]
drm/stm: ltdc: check crtc state before enabling LIE

Following investigations of a hardware bug, the LIE interrupt
can occur while the display controller is not activated.
LIE interrupt (vblank) don't have to be set if the CRTC is not
enabled.

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1579601650-7055-1-git-send-email-yannick.fertre@st.com
4 years agodrm/stm: ltdc: add number of interrupts
Yannick Fertre [Tue, 21 Jan 2020 10:13:52 +0000 (11:13 +0100)]
drm/stm: ltdc: add number of interrupts

The number of interrupts depends on the ltdc version.
Don't try to get interrupt which not exist, avoiding
kernel warning messages.

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1579601632-7001-1-git-send-email-yannick.fertre@st.com
4 years agoMAINTAINERS: Add Thomas as drm-misc co-maintainer
Thomas Zimmermann [Thu, 30 Jan 2020 12:06:43 +0000 (13:06 +0100)]
MAINTAINERS: Add Thomas as drm-misc co-maintainer

Daniel asked me to serve as co-maintainer of the drm-misc tree.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200130120643.5759-1-tzimmermann@suse.de
4 years agodrm/panel: simple: Fix the lt089ac29000 bus_format
Boris Brezillon [Tue, 28 Jan 2020 13:55:13 +0000 (14:55 +0100)]
drm/panel: simple: Fix the lt089ac29000 bus_format

The lt089ac29000 panel is an LVDS panel, not a DPI one. Fix the
definition to reflect this fact.

v10:
* Add changelog to the commit message

v8 -> v9:
* No changes

v7:
* New patch

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-12-boris.brezillon@collabora.com
4 years agodrm/imx: pd: Use bus format/flags provided by the bridge when available
Boris Brezillon [Tue, 28 Jan 2020 13:55:09 +0000 (14:55 +0100)]
drm/imx: pd: Use bus format/flags provided by the bridge when available

Now that bridges can expose the bus format/flags they expect, we can
use those instead of the relying on the display_info provided by the
connector (which is only valid if the encoder is directly connected
to bridge element driving the panel/display).

We also explicitly expose the bus formats supported by our encoder by
filling encoder->output_bus_caps with proper info.

v10:
* Add changelog to the commit message
* Use kmalloc() instead of kcalloc()
* Add a dev_warn() when unsupported flags are requested

v8 -> v9:
* No changes

v7:
* Add an imx_pd_format_supported() helper (suggested by Philipp)
* Simplify imx_pd_bridge_atomic_get_output_bus_fmts() (suggested by Philipp)
* Simplify imx_pd_bridge_atomic_get_input_bus_fmts()
* Explicitly set the duplicate/destro_state() and reset() hooks

v4 -> v6:
* Patch was not part of the series

v3 (all suggested by Philipp):
* Adjust to match core changes
* Propagate output format to input format
* Pick a default value when output_fmt = _FIXED
* Add missing BGR888 and GBR888 fmts to imx_pd_bus_fmts[]

v2:
* Adjust things to match the new bus-format negotiation infra

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-8-boris.brezillon@collabora.com
4 years agodrm/bridge: Add the necessary bits to support bus format negotiation
Boris Brezillon [Tue, 28 Jan 2020 13:55:08 +0000 (14:55 +0100)]
drm/bridge: Add the necessary bits to support bus format negotiation

drm_bridge_state is extended to describe the input and output bus
configurations. These bus configurations are exposed through the
drm_bus_cfg struct which encodes the configuration of a physical
bus between two components in an output pipeline, usually between
two bridges, an encoder and a bridge, or a bridge and a connector.

The bus configuration is stored in drm_bridge_state separately for
the input and output buses, as seen from the point of view of each
bridge. The bus configuration of a bridge output is usually identical
to the configuration of the next bridge's input, but may differ if
the signals are modified between the two bridges, for instance by an
inverter on the board. The input and output configurations of a
bridge may differ if the bridge modifies the signals internally,
for instance by performing format conversion, or*modifying signals
polarities.

Bus format negotiation is automated by the core, drivers just have
to implement the ->atomic_get_{output,input}_bus_fmts() hooks if they
want to take part to this negotiation. Negotiation happens in reverse
order, starting from the last element of the chain (the one directly
connected to the display) up to the first element of the chain (the one
connected to the encoder).
During this negotiation all supported formats are tested until we find
one that works, meaning that the formats array should be in decreasing
preference order (assuming the driver has a preference order).

Note that the bus format negotiation works even if some elements in the
chain don't implement the ->atomic_get_{output,input}_bus_fmts() hooks.
In that case, the core advertises only MEDIA_BUS_FMT_FIXED and lets
the previous bridge element decide what to do (most of the time, bridge
drivers will pick a default bus format or extract this piece of
information from somewhere else, like a FW property).

v10:
* Add changelog to the commit message

v9:
* No changes

v8:
* Fix a test in drm_atomic_bridge_chain_select_bus_fmts() (Reported by
  Jonas)

v7:
* Adapt the code to deal with the fact that not all bridges in the
  chain have a bridge state

v5 -> v6:
* No changes

v4:
* Enhance the doc
* Fix typos
* Rename some parameters/fields
* Reword the commit message

v3:
* Fix the commit message (Reported by Laurent)
* Document the fact that bus formats should not be directly modified by
  drivers (Suggested by Laurent)
* Document the fact that format order matters (Suggested by Laurent)
* Propagate bus flags by default
* Document the fact that drivers can tweak bus flags if needed
* Let ->atomic_get_{output,input}_bus_fmts() allocate the bus format
  array (Suggested by Laurent)
* Add a drm_atomic_helper_bridge_propagate_bus_fmt()
* Mandate that bridge drivers return accurate input_fmts even if they
  are known to be the first element in the bridge chain

v2:
* Rework things to support more complex use cases

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
[narmstrong: fixed doc in include/drm/drm_bridge.h:69 fmt->format]
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Tested-by: Jonas Karlman <jonas@kwiboo.se>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-7-boris.brezillon@collabora.com
4 years agodrm/bridge: Add an ->atomic_check() hook
Boris Brezillon [Tue, 28 Jan 2020 13:55:07 +0000 (14:55 +0100)]
drm/bridge: Add an ->atomic_check() hook

So that bridge drivers have a way to check/reject an atomic operation.
The drm_atomic_bridge_chain_check() (which is just a wrapper around
the ->atomic_check() hook) is called in place of
drm_bridge_chain_mode_fixup() (when ->atomic_check() is not implemented,
the core falls back on ->mode_fixup(), so the behavior should stay
the same for existing bridge drivers).

v10:
* Add changelog to the commit message

v8 -> v9:
* No changes

v7:
* Fix a NULL pointer dereference

v5 -> v6:
* No changes

v4:
* Add R-bs

v3:
* No changes

v2:
* Clarify the fact that ->atomic_check() is replacing ->mode_fixup()

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed by: Jernej Skrabec <jernej.skrabec@siol.net>
Tested-by: Jonas Karlman <jonas@kwiboo.se>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-6-boris.brezillon@collabora.com
4 years agodrm/bridge: Patch atomic hooks to take a drm_bridge_state
Boris Brezillon [Tue, 28 Jan 2020 13:55:06 +0000 (14:55 +0100)]
drm/bridge: Patch atomic hooks to take a drm_bridge_state

This way the drm_bridge_funcs interface is consistent with the rest of
the subsystem.

The drivers implementing those hooks are patched too.

v10:
* Add changelog to the commit message

v8 -> v9:
* No changes

v7:
* Adjust things to the bridge_state changes

v6:
* Also fixed rcar-du/rcar_lvds.c same as analogix/analogix_dp_core.c

v5:
* No changes

v4:
* Rename func params into old_bridge_state
* Add Laurent's Rb

v3:
* Old state clarification moved to a separate patch

v2:
* Pass the old bridge state

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
[narmstrong: renamed state as old_bridge_state in rcar_lvds_atomic_disable]
Reviewed by: Jernej Skrabec <jernej.skrabec@siol.net>
Tested-by: Jonas Karlman <jonas@kwiboo.se>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-5-boris.brezillon@collabora.com
4 years agodrm/bridge: analogix: Plug atomic state hooks to the default implementation
Boris Brezillon [Tue, 28 Jan 2020 13:55:05 +0000 (14:55 +0100)]
drm/bridge: analogix: Plug atomic state hooks to the default implementation

This is needed to pass a bridge state to all atomic hooks, if we don't
do that, the core can't duplicate/create bridge states.

v10:
* Add changelog to the commit message

v9:
* Add Neil's R-b
* Move earlier in the series

v8:
* No changes

v7:
* New patch

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-4-boris.brezillon@collabora.com
4 years agodrm/rcar-du: Plug atomic state hooks to the default implementation
Boris Brezillon [Tue, 28 Jan 2020 13:55:04 +0000 (14:55 +0100)]
drm/rcar-du: Plug atomic state hooks to the default implementation

This is needed to pass a bridge state to all atomic hooks, if we don't
do that, the core can't duplicate/create bridge states.

v10:
* Add changelog to the commit message

v9:
* Add Neil's R-b
* Move earlier in the series

v8:
* No changes

v7:
* New patch

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-3-boris.brezillon@collabora.com
4 years agodrm/bridge: Add a drm_bridge_state object
Boris Brezillon [Tue, 28 Jan 2020 13:55:03 +0000 (14:55 +0100)]
drm/bridge: Add a drm_bridge_state object

One of the last remaining objects to not have its atomic state.

This is being motivated by our attempt to support runtime bus-format
negotiation between elements of the bridge chain.
This patch just paves the road for such a feature by adding a new
drm_bridge_state object inheriting from drm_private_obj so we can
re-use some of the existing state initialization/tracking logic.

v10:
* Add changelog to the commit message

v9:
* Clarify the fact that the bridge->atomic_reset() and
  {connector,plane,crtc,...}->reset() semantics are different
* Move the drm_atomic_private_obj_init() call back to
  drm_bridge_attach()
* Check the presence of ->atomic_duplicate_state instead of
  ->atomic_reset in drm_atomic_add_encoder_bridges()
* Fix copy&paste errors in the atomic bridge state helpers doc
* Add A-b/R-b tags

v8:
* Move bridge state helpers out of the CONFIG_DEBUGFS section

v7:
* Move helpers, struct-defs, ... to atomic helper files to avoid the
  drm -> drm_kms_helper -> drm circular dep
* Stop providing default implementation for atomic state reset,
  duplicate and destroy hooks (has to do with the helper/core split)
* Drop all R-b/T-b as helpers have now be moved to other places

v6:
* Made helpers private, removed doc and moved them to satisfy dependencies
* Renamed helpers to _default_

v5:
* Re-introduced the helpers from v4

v4:
* Fix the doc
* Kill default helpers (inlined)
* Fix drm_atomic_get_bridge_state() to check for an ERR_PTR()
* Add Neil's R-b

v3:
* No changes

v2:
* Use drm_for_each_bridge_in_chain()
* Rename helpers to be more consistent with the rest of the DRM API
* Improve/fix the doc

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128135514.108171-2-boris.brezillon@collabora.com
4 years agodrm/panel: Add Samsung s6e88a0-ams452ef01 panel driver
Michael Srba [Thu, 30 Jan 2020 20:35:55 +0000 (21:35 +0100)]
drm/panel: Add Samsung s6e88a0-ams452ef01 panel driver

Add driver for Samsung AMS452EF01 AMOLED panel, which makes
use of their S6E88A0 controller.

Signed-off-by: Michael Srba <Michael.Srba@seznam.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
[fixed checkpatch warnings, added changelog]
Link: https://patchwork.freedesktop.org/patch/msgid/20200130203555.316-2-michael.srba@seznam.cz
4 years agodt-bindings: display/panel: add bindings for S6E88A0-AMS452EF01
Michael Srba [Thu, 30 Jan 2020 20:35:54 +0000 (21:35 +0100)]
dt-bindings: display/panel: add bindings for S6E88A0-AMS452EF01

This patch adds dts bindings for Samsung AMS452EF01 AMOLED panel,
which makes use of their S6E88A0 controller.

Signed-off-by: Michael Srba <Michael.Srba@seznam.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
[fixed syntax and updated example to fix warnings]
Link: https://patchwork.freedesktop.org/patch/msgid/20200130203555.316-1-michael.srba@seznam.cz
4 years agodrm/panel: simple: Add EDT panel support
Marian-Cristian Rotariu [Thu, 30 Jan 2020 12:08:38 +0000 (12:08 +0000)]
drm/panel: simple: Add EDT panel support

EDT ET043080DH6-GP is a 4.3" WQVGA 480x272 RGB LCD panel used on the iWave
Generic SODIMM Development Platform.

Changes in v2:
-added mandatory .connector_type field
-changed the .bus_format MEDIA_BUS_FMT_RGB666_1X18

Signed-off-by: Marian-Cristian Rotariu <marian-cristian.rotariu.rb@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1580386118-22895-3-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com
4 years agodt-bindings: display: Add bindings for EDT panel
Marian-Cristian Rotariu [Thu, 30 Jan 2020 12:08:37 +0000 (12:08 +0000)]
dt-bindings: display: Add bindings for EDT panel

Document the Emerging Display Technology Corp. (EDT) ETM043080DH6-GP
display, which is a 480x272 4.3" TFT display with capacitive touchscreen.

Changes in v2:
-modify proper bindings file

Signed-off-by: Marian-Cristian Rotariu <marian-cristian.rotariu.rb@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1580386118-22895-2-git-send-email-marian-cristian.rotariu.rb@bp.renesas.com
4 years agodrm/xen: Explicitly disable automatic sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:31 +0000 (13:05 +0100)]
drm/xen: Explicitly disable automatic sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. This would apply to xen, but xen has
its own vblank logic. To avoid interfering with the atomic helpers,
disable automatic vblank events explicitly.

v5:
* update comment
v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-16-tzimmermann@suse.de
4 years agodrm/virtio: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:30 +0000 (13:05 +0100)]
drm/virtio: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-15-tzimmermann@suse.de
4 years agodrm/vboxvideo: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:29 +0000 (13:05 +0100)]
drm/vboxvideo: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-14-tzimmermann@suse.de
4 years agodrm/udl: Don't set struct drm_crtc_state.no_vblank explicitly
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:28 +0000 (13:05 +0100)]
drm/udl: Don't set struct drm_crtc_state.no_vblank explicitly

As udl does not initialize vblanking, atomic helpers initialize the
value of struct drm_crtc_state.no_vblank to be true. No need to set
it from within the driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-13-tzimmermann@suse.de
4 years agodrm/st7586: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:27 +0000 (13:05 +0100)]
drm/st7586: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-12-tzimmermann@suse.de
4 years agodrm/repaper: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:26 +0000 (13:05 +0100)]
drm/repaper: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-11-tzimmermann@suse.de
4 years agodrm/qxl: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:25 +0000 (13:05 +0100)]
drm/qxl: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-10-tzimmermann@suse.de
4 years agodrm/mipi-dbi: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:24 +0000 (13:05 +0100)]
drm/mipi-dbi: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-9-tzimmermann@suse.de
4 years agodrm/ili9225: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:23 +0000 (13:05 +0100)]
drm/ili9225: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-8-tzimmermann@suse.de
4 years agodrm/gm12u320: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:22 +0000 (13:05 +0100)]
drm/gm12u320: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-7-tzimmermann@suse.de
4 years agodrm/cirrus: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:21 +0000 (13:05 +0100)]
drm/cirrus: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-6-tzimmermann@suse.de
4 years agodrm/bochs: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:20 +0000 (13:05 +0100)]
drm/bochs: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-5-tzimmermann@suse.de
4 years agodrm/ast: Don't set struct drm_crtc_state.no_vblank explicitly
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:19 +0000 (13:05 +0100)]
drm/ast: Don't set struct drm_crtc_state.no_vblank explicitly

As ast does not initialize vblanking, atomic helpers initialize the
value of struct drm_crtc_state.no_vblank to be true. No need to set
it from within the driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-4-tzimmermann@suse.de
4 years agodrm/arc: Remove sending of vblank event
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:18 +0000 (13:05 +0100)]
drm/arc: Remove sending of vblank event

The atomic helpers automatically send out fake VBLANK events if no
vblanking has been initialized. Remove the sending code from the
driver.

v4:
* separate commit from core vblank changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-3-tzimmermann@suse.de
4 years agodrm: Initialize struct drm_crtc_state.no_vblank from device settings
Thomas Zimmermann [Wed, 29 Jan 2020 12:05:17 +0000 (13:05 +0100)]
drm: Initialize struct drm_crtc_state.no_vblank from device settings

At the end of a commit, atomic helpers can generate a fake VBLANK event
automatically. Originally implemented for writeback connectors, the
functionality can be used by any driver and/or hardware without proper
VBLANK interrupt.

The patch updates the documentation to make this behaviour official:
settings struct drm_crtc_state.no_vblank to true enables automatic
generation of fake VBLANK events.

The new interface drm_dev_has_vblank() returns true if vblanking has
been initialized for a device, or false otherwise. Atomic helpers use
this function when initializing no_vblank in the CRTC state in
drm_atomic_helper_check_modeset(). If vblanking has been initialized
for a device, no_blank is disabled. Otherwise it's enabled. Hence,
atomic helpers will automatically send out fake VBLANK events with any
driver that did not initialize vblanking.

v5:
* more precise documentation and commit message
v4:
* replace drm_crtc_has_vblank() with drm_dev_has_vblank()
* add drm_dev_has_vblank() in this patch
* move driver changes into separate patches
v3:
* squash all related changes patches into this patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200129120531.6891-2-tzimmermann@suse.de
4 years agodrm/auth: Drop master_create/destroy hooks
Daniel Vetter [Mon, 27 Jan 2020 10:02:03 +0000 (11:02 +0100)]
drm/auth: Drop master_create/destroy hooks

vmwgfx stopped using them.

With the drm device model that we've slowly evolved over the past few
years master status essentially controls access to display resources,
and nothing else. Since that's a pure access permission check drivers
should have no need at all to track additional state on a per file
basis.

Aside: For cleanup and restoring kernel-internal clients the grand
plan is to move everyone over to drm_client and
drm_master_internal_acquire/release, like the generic fbdev code
already does. That should get rid of most ->lastclose implementations,
and I think also subsumes any processing vmwgfx does in
master_set/drop.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "Thomas Hellström (VMware)" <thomas_os@shipmail.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200127100203.1299322-1-daniel.vetter@ffwll.ch