OSDN Git Service

uclinux-h8/linux.git
4 years agodrm/dp_mst: Fix the DDC I2C device registration of an MST port
Imre Deak [Sun, 7 Jun 2020 21:25:21 +0000 (00:25 +0300)]
drm/dp_mst: Fix the DDC I2C device registration of an MST port

During the initial MST probing an MST port's I2C device will be
registered using the kdev of the DRM device as a parent. Later after MST
Connection Status Notifications this I2C device will be re-registered
with the kdev of the port's connector. This will also move
inconsistently the I2C device's sysfs entry from the DRM device's sysfs
dir to the connector's dir.

Fix the above by keeping the DRM kdev as the parent of the I2C device.

Ideally the connector's kdev would be used as a parent, similarly to
non-MST connectors, however that needs some more refactoring to ensure
the connector's kdev is already available early enough. So keep the
existing (initial) behavior for now.

Cc: <stable@vger.kernel.org>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200607212522.16935-2-imre.deak@intel.com
4 years agodrm/dp_mst: Fix the DDC I2C device unregistration of an MST port
Imre Deak [Sun, 7 Jun 2020 21:25:20 +0000 (00:25 +0300)]
drm/dp_mst: Fix the DDC I2C device unregistration of an MST port

The WARN below triggers during the removal of an MST port. The problem
is that the parent device's (the connector's kdev) sysfs directory is
removed recursively when the connector is unregistered (even though the
I2C device holds a reference on the parent device). To fix this set
first the Peer Device Type to none which will remove the I2C device.

Note that atm, inconsistently, the parent of the I2C device is initially set to
the DRM kdev and after a Connection Status Notification the parent may be reset
to be the connector's kdev. This problem is addressed by the next patch.

[ 4462.989299] ------------[ cut here ]------------
[ 4463.014940] sysfs group 'power' not found for kobject 'i2c-24'
[ 4463.034664] WARNING: CPU: 0 PID: 970 at fs/sysfs/group.c:281 sysfs_remove_group+0x71/0x80
[ 4463.044357] Modules linked in: snd_hda_intel i915 drm_kms_helper(O) drm netconsole snd_hda_codec_hdmi mei_hdcp x86_pkg_temp_thermal coretemp crct10dif_pclmul snd_intel_dspcf
g crc32_pclmul snd_hda_codec snd_hwdep ghash_clmulni_intel snd_hda_core asix usbnet kvm_intel mii i2c_algo_bit snd_pcm syscopyarea sysfillrect e1000e sysimgblt fb_sys_fops prim
e_numbers ptp pps_core i2c_i801 r8169 mei_me realtek mei [last unloaded: drm]
[ 4463.044399] CPU: 0 PID: 970 Comm: kworker/0:2 Tainted: G           O      5.7.0+ #172
[ 4463.044402] Hardware name: Intel Corporation Tiger Lake Client Platform/TigerLake U DDR4 SODIMM RVP
[ 4463.044423] Workqueue: events drm_dp_delayed_destroy_work [drm_kms_helper]
[ 4463.044428] RIP: 0010:sysfs_remove_group+0x71/0x80
[ 4463.044431] Code: 48 89 df 5b 5d 41 5c e9 cd b6 ff ff 48 89 df e8 95 b4 ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 20 0f 3f 82 e8 9f c5 d7 ff <0f> 0b 5b 5d 41 5c c3 0f 1f
84 00 00 00 00 00 48 85 f6 74 31 41 54
[ 4463.044433] RSP: 0018:ffffc900018bfbf0 EFLAGS: 00010282
[ 4463.044436] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
[ 4463.044439] RDX: 0000000080000001 RSI: ffff88849e828f38 RDI: 00000000ffffffff
[ 4463.052970] [drm:drm_atomic_get_plane_state [drm]] Added [PLANE:100:plane 2B] 00000000c2160caa state to 00000000d172564a
[ 4463.070533] RBP: ffffffff820cea20 R08: ffff88847f4b8958 R09: 0000000000000000
[ 4463.070535] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88848a725018
[ 4463.070537] R13: 0000000000000000 R14: ffffffff827090e0 R15: 0000000000000002
[ 4463.070539] FS:  0000000000000000(0000) GS:ffff88849e800000(0000) knlGS:0000000000000000
[ 4463.070541] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4463.070543] CR2: 00007fdf8a756538 CR3: 0000000489684001 CR4: 0000000000760ef0
[ 4463.070545] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 4463.070547] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 4463.070549] PKRU: 55555554
[ 4463.070551] Call Trace:
[ 4463.070560]  device_del+0x84/0x400
[ 4463.070571]  cdev_device_del+0x10/0x30
[ 4463.070578]  put_i2c_dev+0x69/0x80
[ 4463.070584]  i2cdev_detach_adapter+0x2e/0x60
[ 4463.070591]  notifier_call_chain+0x34/0x90
[ 4463.070599]  blocking_notifier_call_chain+0x3f/0x60
[ 4463.070606]  device_del+0x7c/0x400
[ 4463.087817]  ? lockdep_init_map_waits+0x57/0x210
[ 4463.087825]  device_unregister+0x11/0x60
[ 4463.087829]  i2c_del_adapter+0x249/0x310
[ 4463.087846]  drm_dp_port_set_pdt+0x6b/0x2c0 [drm_kms_helper]
[ 4463.087862]  drm_dp_delayed_destroy_work+0x2af/0x350 [drm_kms_helper]
[ 4463.087876]  process_one_work+0x268/0x600
[ 4463.105438]  ? __schedule+0x30c/0x920
[ 4463.105451]  worker_thread+0x37/0x380
[ 4463.105457]  ? process_one_work+0x600/0x600
[ 4463.105462]  kthread+0x140/0x160
[ 4463.105466]  ? kthread_park+0x80/0x80
[ 4463.105474]  ret_from_fork+0x24/0x50

Cc: <stable@vger.kernel.org>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200607212522.16935-1-imre.deak@intel.com
4 years agodrm/i915/dp_mst: Work around out-of-spec adapters filtering short pulses
Imre Deak [Thu, 4 Jun 2020 18:45:00 +0000 (21:45 +0300)]
drm/i915/dp_mst: Work around out-of-spec adapters filtering short pulses

Some TypeC -> native DP adapters, at least the Club 3D CAC-1557 adapter,
incorrectly filter out HPD short pulses with a duration less than
~540 usec, leading to MST probe failures.

According to the DP Standard 2.0 section 5.1.4:
- DP sinks should generate short pulses in the 500 usec -> 1 msec range
- DP sources should detect short pulses in the 250 usec -> 2 msec range

According to the DP Alt Mode on TypeC Standard section 3.9.2, adapters
should detect and forward short pulses according to how sources should
detect them as specified in the DP Standard (250 usec -> 2 msec).

Based on the above filtering out short pulses with a duration less than
540 usec is incorrect.

To make such adapters work add support for a driver polling on MST
inerrupt flags, and wire this up in the i915 driver. The sink can clear
an interrupt it raised after 110 msec if the source doesn't respond, so
use a 50 msec poll period to avoid missing an interrupt. Polling of the
MST interrupt flags is explicitly allowed by the DP Standard.

This fixes MST probe failures I saw using this adapter and a DELL U2515H
monitor.

v2:
- Fix the wait event timeout for the no-poll case.
v3 (Ville):
- Fix the short pulse duration limits in the commit log prescribed by the
  DP Standard.
- Add code comment explaining why/how polling is used.
- Factor out a helper to schedule the port's hpd irq handler and move it
  to the rest of hotplug handlers.
- Document the new MST callback.
- s/update_hpd_irq_state/poll_hpd_irq/

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200604184500.23730-2-imre.deak@intel.com
4 years agodrm/dp_mst: Sanitize mgr->qlock locking in drm_dp_mst_wait_tx_reply()
Imre Deak [Wed, 3 Jun 2020 21:10:39 +0000 (00:10 +0300)]
drm/dp_mst: Sanitize mgr->qlock locking in drm_dp_mst_wait_tx_reply()

Make the locking look symmetric with the unlocking.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200603211040.8190-2-imre.deak@intel.com
4 years agodrm/mgag200: Use managed device initialization
Thomas Zimmermann [Fri, 5 Jun 2020 13:58:03 +0000 (15:58 +0200)]
drm/mgag200: Use managed device initialization

The mgag200 driver now uses managed functions for DRM devices. The
individual helpers for modesetting and memory managed are already
covered, so only device allocation and initialization is left for
conversion.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-15-tzimmermann@suse.de
4 years agodrm/mgag200: Embed instance of struct drm_device in struct mga_device
Thomas Zimmermann [Fri, 5 Jun 2020 13:58:02 +0000 (15:58 +0200)]
drm/mgag200: Embed instance of struct drm_device in struct mga_device

Following current best practice, the instance of struct drm_device is now
embedded in struct mga_device. The respective field has been renamed from
'dev' to 'base' to reflect the relationship. Conversion from DRM device is
done via upcast. Using dev_private is no longer possible.

The patch also open-codes drm_dev_alloc() and DRM device initialization
is now performed by a call to drm_device_init().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-14-tzimmermann@suse.de
4 years agodrm/mgag200: Allocate device structures in mgag200_driver_load()
Thomas Zimmermann [Fri, 5 Jun 2020 13:58:01 +0000 (15:58 +0200)]
drm/mgag200: Allocate device structures in mgag200_driver_load()

Instances of struct drm_device and struct mga_device are now allocated
next to each other in mgag200_driver_load(). Yet another preparation
before embedding the DRM device instance in struct mga_device.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-13-tzimmermann@suse.de
4 years agodrm/mgag200: Separate device initialization into allocation
Thomas Zimmermann [Fri, 5 Jun 2020 13:58:00 +0000 (15:58 +0200)]
drm/mgag200: Separate device initialization into allocation

Embedding the DRM device instance in struct mga_device will require
changes to device allocation. Moving the device initialization into
its own functions gets it out of the way.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-12-tzimmermann@suse.de
4 years agodrm/mgag200: Move device init and cleanup to mgag200_drv.c
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:59 +0000 (15:57 +0200)]
drm/mgag200: Move device init and cleanup to mgag200_drv.c

Moving the initializer and cleanup functions for device instances
to mgag200_drv.c prepares for the conversion to managed code. No
functional changes are made. Remove mgag200_main.c, which is now
empty.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-11-tzimmermann@suse.de
4 years agodrm/mgag200: Prefix symbol names in mgag200_drv.c with mgag200_
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:58 +0000 (15:57 +0200)]
drm/mgag200: Prefix symbol names in mgag200_drv.c with mgag200_

The naming of symbols in mgag200_drv.c is inconsistent. Fix that by
prefixing all names with mgag200_.

v2:
* clarify commit message

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-10-tzimmermann@suse.de
4 years agodrm/mgag200: Separate DRM and PCI functionality from each other
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:57 +0000 (15:57 +0200)]
drm/mgag200: Separate DRM and PCI functionality from each other

Moving the DRM driver structures from the middle of the PCI code to
the top of the file makes it more readable. Also remove an obsolete
comment.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-9-tzimmermann@suse.de
4 years agodrm/mgag200: Switch to managed MM
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:56 +0000 (15:57 +0200)]
drm/mgag200: Switch to managed MM

The memory-management code now cleans up automatically as part of
device destruction.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-8-tzimmermann@suse.de
4 years agodrm/mgag200: Merge VRAM setup into MM initialization
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:55 +0000 (15:57 +0200)]
drm/mgag200: Merge VRAM setup into MM initialization

The VRAM setup in mgag200_drv.c is part of memory management and
should be done in the same place. Merge the code into the memory
management's init function.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-7-tzimmermann@suse.de
4 years agodrm/mgag200: Lookup VRAM PCI BAR start and length only once
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:54 +0000 (15:57 +0200)]
drm/mgag200: Lookup VRAM PCI BAR start and length only once

The MM setup code on mgag200 reads PCI BAR 0's start and length
several times. Reusing these values makes the code more readable.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-6-tzimmermann@suse.de
4 years agodrm/mgag200: Rename mgag200_ttm.c to mgag200_mm.c
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:53 +0000 (15:57 +0200)]
drm/mgag200: Rename mgag200_ttm.c to mgag200_mm.c

The mgag200 driver does not use TTM any longer. Rename the related file
to mgag200_mm.c (as in 'memory management').

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-5-tzimmermann@suse.de
4 years agodrm/mgag200: Use pcim_enable_device()
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:52 +0000 (15:57 +0200)]
drm/mgag200: Use pcim_enable_device()

Using the managed function simplifies the error handling. After
unloading the driver, the PCI device should now get disabled as
well.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-4-tzimmermann@suse.de
4 years agodrm/mgag200: Remove mgag200_cursor.c
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:51 +0000 (15:57 +0200)]
drm/mgag200: Remove mgag200_cursor.c

Support for HW cursors got remove by commit 5a77e2bfdd4f ("drm/mgag200:
Remove HW cursor") Apparently the source file was not deleted. Removed
it now.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Fixes: 5a77e2bfdd4f ("drm/mgag200: Remove HW cursor")
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Allison Randal <allison@lohutok.net>
Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: "José Roberto de Souza" <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-3-tzimmermann@suse.de
4 years agodrm/mgag200: Remove declaration of mgag200_mmap() from header file
Thomas Zimmermann [Fri, 5 Jun 2020 13:57:50 +0000 (15:57 +0200)]
drm/mgag200: Remove declaration of mgag200_mmap() from header file

Commit 94668ac796a5 ("drm/mgag200: Convert mgag200 driver to VRAM MM")
removed the implementation of mgag200_mmap(). Also remove the declaration.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Fixes: 94668ac796a5 ("drm/mgag200: Convert mgag200 driver to VRAM MM")
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Armijn Hemel <armijn@tjaldur.nl>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: <stable@vger.kernel.org> # v5.3+
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-2-tzimmermann@suse.de
4 years agodrivers: gpu: drm: Fix trivial spelling
Kieran Bingham [Tue, 9 Jun 2020 12:46:01 +0000 (13:46 +0100)]
drivers: gpu: drm: Fix trivial spelling

The word 'descriptor' is misspelled throughout the tree.

Fix it up accordingly:
    decriptors -> descriptors

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200609124610.3445662-9-kieran.bingham+renesas@ideasonboard.com
4 years agodrm/vc4: crtc: Restrict HACT_ACT setup to DSI
Maxime Ripard [Wed, 27 May 2020 15:47:58 +0000 (17:47 +0200)]
drm/vc4: crtc: Restrict HACT_ACT setup to DSI

The HACT_ACT field only needs to be written to when using a DSI display.
Let's move that setup to our DSI branch to clear a bit the common path.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/7a93436f97666a2aa025686ef3ff3606de4bec67.1590594512.git-series.maxime@cerno.tech
4 years agodrm/vc4: crtc: Turn static const variable into a define
Maxime Ripard [Wed, 27 May 2020 15:47:57 +0000 (17:47 +0200)]
drm/vc4: crtc: Turn static const variable into a define

The hvs_latency_pix variable doesn't need to be a variable and can just be
defined.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/8535c679f79af8abaa1b7796261bfeda11f874fd.1590594512.git-series.maxime@cerno.tech
4 years agodrm/vc4: crtc: Move crtc state to common header
Maxime Ripard [Wed, 27 May 2020 15:47:54 +0000 (17:47 +0200)]
drm/vc4: crtc: Move crtc state to common header

We'll need to access the crtc_state from outside of vc4_crtc.c, so let's
move it to vc4_drv.h

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/1e6e563f9c75961e2885c9d648a3130d3b46b6d1.1590594512.git-series.maxime@cerno.tech
4 years agodrm/vc4: crtc: Switch to of_device_get_match_data
Maxime Ripard [Wed, 27 May 2020 15:47:53 +0000 (17:47 +0200)]
drm/vc4: crtc: Switch to of_device_get_match_data

of_device_get_match_data allow to simplify a bit the retrieval of the data
associated to the pixelvalve compatible. Let's use it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/1ff06413a1350d28bc3e88b034ed7ad23834e5bd.1590594512.git-series.maxime@cerno.tech
4 years agodrm/vc4: crtc: Rename SoC data structures
Maxime Ripard [Wed, 27 May 2020 15:47:52 +0000 (17:47 +0200)]
drm/vc4: crtc: Rename SoC data structures

Since we're going to introduce pixelvalve data structures for other SoCs
than the BCM2835, let's rename the structures defined in the code to
make it obvious which SoC we're targeting.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/39aed7dd512ce2a4560902974ec26b16b88ec68b.1590594512.git-series.maxime@cerno.tech
4 years agodrm/vc4: plane: Move additional planes creation to driver
Maxime Ripard [Thu, 6 Feb 2020 13:41:41 +0000 (14:41 +0100)]
drm/vc4: plane: Move additional planes creation to driver

So far the plane creation was done when each CRTC was bound, and those
planes were only tied to the CRTC that was registering them.

This causes two main issues:
  - The planes in the vc4 hardware are actually not tied to any CRTC, but
    can be used with every combination

  - More importantly, so far, we allocate 10 planes per CRTC, with 3 CRTCs.
    However, the next generation of hardware will have 5 CRTCs, putting us
    well above the maximum of 32 planes currently allowed by DRM.

This patch is the first one in a series of patches that will take down both
of these issues so that we can support the next generation of hardware
while keeping a good amount of planes.

We start by changing the way the planes are registered to first registering
the primary planes for each CRTC in the CRTC bind function as we used to,
but moving the overlay and cursor creation to the main driver bind
function, after all the CRTCs have been bound, and make the planes
associated to all CRTCs.

This will slightly change the ID order of the planes, since the primary
planes of all CRTCs will be first, and then a pattern of 8 overlays, 1
cursor plane for each CRTC.

This shouldn't cause any trouble since the ordering between the planes is
preserved though.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/0b85a3fdb20bb4ff85fb62cabd082d5a65e2730b.1590594512.git-series.maxime@cerno.tech
4 years agodrm/vc4: plane: Move planes creation to its own function
Maxime Ripard [Wed, 27 May 2020 15:47:47 +0000 (17:47 +0200)]
drm/vc4: plane: Move planes creation to its own function

The planes so far were created as part of the CRTC binding code with
each planes created associated only to one CRTC. However, the hardware
in the vc4 doesn't really have such constraint and can be used with any
CRTC.

In order to rework this, let's first move the overlay and cursor planes
creation to a function of its own.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/a378ea56214179f1f25fcd36ecc69511edd1e790.1590594512.git-series.maxime@cerno.tech
4 years agodrm/vc4: drv: Add include guards
Maxime Ripard [Wed, 27 May 2020 15:47:41 +0000 (17:47 +0200)]
drm/vc4: drv: Add include guards

vc4_drv.h doesn't have any include guards which prevents it from being
included twice. Let's add them.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/68e89e315c4c35b313efc277c9642eca684e0ade.1590594512.git-series.maxime@cerno.tech
4 years agodt-bindings: display: vc4: hdmi: Add missing clock-names property
Maxime Ripard [Wed, 27 May 2020 15:47:39 +0000 (17:47 +0200)]
dt-bindings: display: vc4: hdmi: Add missing clock-names property

While the device tree and the driver expected a clock-names property, it
wasn't explicitly documented in the previous binding. The documented order
was wrong too, so make sure clock-names is there and in the proper order.

Cc: devicetree@vger.kernel.org
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/10ef2821e10886b66af5f8ba3e212aa87e9fd360.1590594512.git-series.maxime@cerno.tech
4 years agodt-bindings: display: vc4: dsi: Add missing clock properties
Maxime Ripard [Wed, 27 May 2020 15:47:38 +0000 (17:47 +0200)]
dt-bindings: display: vc4: dsi: Add missing clock properties

While the device tree and the driver expected a clock-names and a
clock-cells properties, it wasn't explicitly documented in the previous
binding. Make sure it is now.

Cc: devicetree@vger.kernel.org
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/867813ae6b3e9cff0e9627e6ed09569dee5573bc.1590594512.git-series.maxime@cerno.tech
4 years agodt-bindings: display: vc4: dpi: Add missing clock-names property
Maxime Ripard [Wed, 27 May 2020 15:47:37 +0000 (17:47 +0200)]
dt-bindings: display: vc4: dpi: Add missing clock-names property

While the device tree and the driver expected a clock-names property, it
wasn't explicitly documented in the previous binding. Make sure it is now.

Cc: devicetree@vger.kernel.org
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/8c7a4a9d85f7d1b23346367acf8d321ddad7cffe.1590594512.git-series.maxime@cerno.tech
4 years agodt-bindings: display: Convert VC4 bindings to schemas
Maxime Ripard [Wed, 27 May 2020 15:47:36 +0000 (17:47 +0200)]
dt-bindings: display: Convert VC4 bindings to schemas

The BCM283x SoCs have a display pipeline composed of several controllers
with device tree bindings that are supported by Linux.

Now that we have the DT validation in place, let's split into separate
files and convert the device tree bindings for those controllers to
schemas.

This is just a 1:1 conversion though, and some bindings were incomplete so
it results in example validation warnings that are going to be addressed in
the following patches.

Acked-by: Eric Anholt <eric@anholt.net>
Reviewed: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/2dc6384c945c7d35ab4f75464d3a77046dc125b3.1590594512.git-series.maxime@cerno.tech
4 years agodrm/udl: Use GEM vmap/mmap function from SHMEM helpers
Thomas Zimmermann [Tue, 9 Jun 2020 09:08:20 +0000 (11:08 +0200)]
drm/udl: Use GEM vmap/mmap function from SHMEM helpers

The udl driver contains an implementation of GEM vmap and mmap
operations that is identical to the common SHMEM helper; except
that udl's code uses cached pages by default.

Convert udl to regular SHMEM helper functions. There's no reason
to have udl behave differently from all other SHMEM drivers. The
udl driver uses the SHMEM helper to enable caching.

v3:
* rebased onto Daniel's shmem untangle series
v2:
* implement .gem_create_object with SHMEM helper

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200609090820.20256-3-tzimmermann@suse.de
4 years agodrm/shmem-helper: Add .gem_create_object helper that sets map_cached flag
Thomas Zimmermann [Tue, 9 Jun 2020 09:08:19 +0000 (11:08 +0200)]
drm/shmem-helper: Add .gem_create_object helper that sets map_cached flag

The helper drm_gem_shmem_create_object_cached() allocates an GEM SHMEM
object and sets the map_cached flag. Useful for drivers that want cached
mappings.

v3:
* style fixes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200609090820.20256-2-tzimmermann@suse.de
4 years agodrm: Remove struct drm_driver.gem_print_info
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:47 +0000 (09:32 +0200)]
drm: Remove struct drm_driver.gem_print_info

The .gem_print_info callback in struct drm_driver is obsolete and has
no users left. Remove it.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-44-tzimmermann@suse.de
4 years agodrm/zte: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:46 +0000 (09:32 +0200)]
drm/zte: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-43-tzimmermann@suse.de
4 years agodrm/zte: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:45 +0000 (09:32 +0200)]
drm/zte: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-42-tzimmermann@suse.de
4 years agodrm/tve200: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:44 +0000 (09:32 +0200)]
drm/tve200: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-41-tzimmermann@suse.de
4 years agodrm/tve200: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:43 +0000 (09:32 +0200)]
drm/tve200: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-40-tzimmermann@suse.de
4 years agodrm/tilcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:42 +0000 (09:32 +0200)]
drm/tilcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-39-tzimmermann@suse.de
4 years agodrm/tilcdc: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:41 +0000 (09:32 +0200)]
drm/tilcdc: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-38-tzimmermann@suse.de
4 years agodrm/sti: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:40 +0000 (09:32 +0200)]
drm/sti: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-37-tzimmermann@suse.de
4 years agodrm/sti: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:39 +0000 (09:32 +0200)]
drm/sti: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-36-tzimmermann@suse.de
4 years agodrm/stm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:38 +0000 (09:32 +0200)]
drm/stm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in
struct drm_driver to their defaults. No functional changes are
made.

v2:
* update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-35-tzimmermann@suse.de
4 years agodrm/stm: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:37 +0000 (09:32 +0200)]
drm/stm: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-34-tzimmermann@suse.de
4 years agodrm/shmobile: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:36 +0000 (09:32 +0200)]
drm/shmobile: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-33-tzimmermann@suse.de
4 years agodrm/shmobile: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:35 +0000 (09:32 +0200)]
drm/shmobile: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-32-tzimmermann@suse.de
4 years agodrm/rcar-du: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:34 +0000 (09:32 +0200)]
drm/rcar-du: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in
struct drm_driver to their defaults. No functional changes are
made.

v2:
* update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-31-tzimmermann@suse.de
4 years agodrm/rcar-du: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:33 +0000 (09:32 +0200)]
drm/rcar-du: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-30-tzimmermann@suse.de
4 years agodrm/mxsfb: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:32 +0000 (09:32 +0200)]
drm/mxsfb: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-29-tzimmermann@suse.de
4 years agodrm/mxsfb: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:31 +0000 (09:32 +0200)]
drm/mxsfb: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-28-tzimmermann@suse.de
4 years agodrm/meson: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:30 +0000 (09:32 +0200)]
drm/meson: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in
struct drm_driver to their defaults. No functional changes are
made.

v2:
* update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-27-tzimmermann@suse.de
4 years agodrm/meson: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:29 +0000 (09:32 +0200)]
drm/meson: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-26-tzimmermann@suse.de
4 years agodrm/mcde: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:28 +0000 (09:32 +0200)]
drm/mcde: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-25-tzimmermann@suse.de
4 years agodrm/mcde: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:27 +0000 (09:32 +0200)]
drm/mcde: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-24-tzimmermann@suse.de
4 years agodrm/malidp: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:26 +0000 (09:32 +0200)]
drm/malidp: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in
struct drm_driver to their defaults. No functional changes are
made.

v2:
* update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-23-tzimmermann@suse.de
4 years agodrm/malidp: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:25 +0000 (09:32 +0200)]
drm/malidp: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-22-tzimmermann@suse.de
4 years agodrm/komeda: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:24 +0000 (09:32 +0200)]
drm/komeda: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in
struct drm_driver to their defaults. No functional changes are
made.

v2:
* update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-21-tzimmermann@suse.de
4 years agodrm/komeda: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:23 +0000 (09:32 +0200)]
drm/komeda: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-20-tzimmermann@suse.de
4 years agodrm/ingenic: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:22 +0000 (09:32 +0200)]
drm/ingenic: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-19-tzimmermann@suse.de
4 years agodrm/ingenic: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:21 +0000 (09:32 +0200)]
drm/ingenic: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-18-tzimmermann@suse.de
4 years agodrm/imx: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:20 +0000 (09:32 +0200)]
drm/imx: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-17-tzimmermann@suse.de
4 years agodrm/imx: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:19 +0000 (09:32 +0200)]
drm/imx: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-16-tzimmermann@suse.de
4 years agodrm/hisilicon/kirin: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:18 +0000 (09:32 +0200)]
drm/hisilicon/kirin: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

v2:
* use DRM_GEM_CMA_DRIVER_OPS

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: Xu YiPing <xuyiping@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-15-tzimmermann@suse.de
4 years agodrm/hisilicon/kirin: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:17 +0000 (09:32 +0200)]
drm/hisilicon/kirin: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: Xu YiPing <xuyiping@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-14-tzimmermann@suse.de
4 years agodrm/hisilicon/kirin: Set .dumb_create to drm_gem_cma_dumb_create()
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:16 +0000 (09:32 +0200)]
drm/hisilicon/kirin: Set .dumb_create to drm_gem_cma_dumb_create()

The kirin drivers uses drm_gem_cma_dumb_create_internal() for its
.dumb_create implementation. The function is meant for internal use
only by drivers that require additional buffer setup.

Kirin does not do an additional setup, so convert it over to
drm_gem_cma_dumb_create().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: Xu YiPing <xuyiping@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-13-tzimmermann@suse.de
4 years agodrm/fsl-dcu: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:15 +0000 (09:32 +0200)]
drm/fsl-dcu: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-12-tzimmermann@suse.de
4 years agodrm/fsl-dcu: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:14 +0000 (09:32 +0200)]
drm/fsl-dcu: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-11-tzimmermann@suse.de
4 years agodrm/atmel-hlcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:13 +0000 (09:32 +0200)]
drm/atmel-hlcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-10-tzimmermann@suse.de
4 years agodrm/atmel-hlcdc: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:12 +0000 (09:32 +0200)]
drm/atmel-hlcdc: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-9-tzimmermann@suse.de
4 years agodrm/arm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:11 +0000 (09:32 +0200)]
drm/arm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-8-tzimmermann@suse.de
4 years agodrm/arm: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:10 +0000 (09:32 +0200)]
drm/arm: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-7-tzimmermann@suse.de
4 years agodrm/arc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:09 +0000 (09:32 +0200)]
drm/arc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-6-tzimmermann@suse.de
4 years agodrm/arc: Use GEM CMA object functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:08 +0000 (09:32 +0200)]
drm/arc: Use GEM CMA object functions

Create GEM objects with drm_gem_cma_create_object_default_funcs(), which
allocates the object and sets CMA's default object functions. Corresponding
callbacks in struct drm_driver are cleared. No functional changes are made.

Driver and object-function instances use the same callback functions, with
the exception of vunmap. The implementation of vunmap is empty and left out
in CMA's default object functions.

v3:
* convert to DRIVER_OPS macro in a separate patch

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-5-tzimmermann@suse.de
4 years agodrm/cma-helper: Add DRM_GEM_CMA_DRIVER_OPS to set default GEM CMA functions
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:07 +0000 (09:32 +0200)]
drm/cma-helper: Add DRM_GEM_CMA_DRIVER_OPS to set default GEM CMA functions

The macro to DRM_GEM_CMA_DRIVER_OPS sets GEM callbacks in struct drm_driver
to their defaults for CMA. A variant of the macro is provided for drivers
that override the default .dumb_create callback. Adapt drivers to the changes.

v4:
* remove parenthesis around dumb_create_func
* fix grammar in commit message

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-4-tzimmermann@suse.de
4 years agodrm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:06 +0000 (09:32 +0200)]
drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro

Rename the macro to DRM_GEM_CMA_DRIVER_OPS_VMAP to align naming with
SHMEM helpers and drm_gem_cma_prime_import_sg_table_vmap(). An variant of
the macro is provided for drivers that override the default .dumb_create
callback. Adapt drivers to the changes.

v3:
* rename macro to signal implicit vmap on imported buffers
v2:
* provide DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-3-tzimmermann@suse.de
4 years agodrm/cma-helper: Rename symbols from drm_cma_gem_ to drm_gem_cma_
Thomas Zimmermann [Fri, 5 Jun 2020 07:32:05 +0000 (09:32 +0200)]
drm/cma-helper: Rename symbols from drm_cma_gem_ to drm_gem_cma_

This fixes the naming of several symbols within CMA helpers. No functional
changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-2-tzimmermann@suse.de
4 years agodrm/shmem-helpers: Simplify dma-buf importing
Daniel Vetter [Fri, 29 May 2020 14:05:42 +0000 (16:05 +0200)]
drm/shmem-helpers: Simplify dma-buf importing

- Ditch the ->pages array
- Make it a private gem bo, which means no shmem object, which means
  fireworks if anyone calls drm_gem_object_get_pages. But we've just
  made sure that's all covered.

v2: Rebase

v3: I forgot to remove the page_count mangling from the free path too.
Noticed by Boris while testing.

Cc: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200529140542.2103713-1-daniel.vetter@ffwll.ch
4 years agodrm/shmem-helpers: Ensure get_pages is not called on imported dma-buf
Daniel Vetter [Mon, 11 May 2020 09:35:53 +0000 (11:35 +0200)]
drm/shmem-helpers: Ensure get_pages is not called on imported dma-buf

Just a bit of light paranoia. Also sprinkle this check over
drm_gem_shmem_get_sg_table, which should only be called when
exporting, same for the pin/unpin functions, on which it relies to
work correctly.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-9-daniel.vetter@ffwll.ch
4 years agodrm/mm: add ig_frag selftest
Nirmoy Das [Fri, 5 Jun 2020 09:14:02 +0000 (11:14 +0200)]
drm/mm: add ig_frag selftest

This patch introduces fragmentation in the address range
and measures time taken by 10k and 20k insertions. ig_frag()
will fail if the time taken by 20k insertions takes more than
4 times of 10k insertions as we know that insertions should at
most scale quadratically.

v2:
introduce fragmentation by freeing every other node.
only test bottom-up and top-down for now.

v3:
fix incorrect mode check

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/369076/
4 years agodrm: document how user-space should use link-status
Simon Ser [Thu, 4 Jun 2020 09:20:23 +0000 (09:20 +0000)]
drm: document how user-space should use link-status

Describe what a "BAD" link-status means for user-space and how it should
handle it. The logic described has been implemented in igt [1].

v2:

- Change wording to avoid "enabled" (Daniel)
- Add paragraph about multiple connectors sharing the same CRTC (Pekka)
- Add paragraph about performing an atomic commit on a connector without
  updating the link-status property (Daniel)

v3:

- Fix description of what happens when link-status isn't reset to
  "GOOD", and when link-status is reset without ALLOW_MODESET (Daniel,
  Ville)
- Changing link-status to "BAD" is a no-op
- Clearly state that "BAD" means black screen (Manasi)

[1]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/commit/fbe61f529737191d0920521946a575bd55f00fbe

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Pekka Paalanen <ppaalanen@gmail.com>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Acked-by: Pekka Paalanen <ppaalanen@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/kFylMmeRMGJk-oi8f-Td8A7GNa1C-GsK23-vjKg77VhWfwpkLJg7QxFlQ_g9KdVxZiyWl9eJWpUGa5PYasR9YcyvIbuBmHVfKeHb4rH0yTM=@emersion.fr
4 years agodrm/panel: simple: Add support for KOE TX26D202VM0BWA panel
Liu Ying [Mon, 1 Jun 2020 06:11:20 +0000 (14:11 +0800)]
drm/panel: simple: Add support for KOE TX26D202VM0BWA panel

This patch adds support for Kaohsiung Opto-Electronics Inc.
10.1" TX26D202VM0BWA WUXGA(1920x1200) TFT LCD panel with LVDS interface.
The panel has dual LVDS channels.

My panel is manufactured by US Micro Products(USMP).  There is a tag at
the back of the panel, which indicates the panel type is 'TX26D202VM0BWA'
and it's made by KOE in Taiwan.

The panel spec from USMP can be found at:
https://www.usmicroproducts.com/sites/default/files/datasheets/USMP-T101-192120NDU-A0.pdf

The below panel spec from KOE is basically the same to the one from USMP.
However, the panel type 'TX26D202VM0BAA' is a little bit different.
It looks that the two types of panel are compatible with each other.
http://www.koe.j-display.com/upload/product/TX26D202VM0BAA.pdf

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1590991880-24273-1-git-send-email-victor.liu@nxp.com
4 years agodt-bindings: panel-simple: Add koe,tx26d202vm0bwa compatible
Liu Ying [Mon, 1 Jun 2020 06:10:43 +0000 (14:10 +0800)]
dt-bindings: panel-simple: Add koe,tx26d202vm0bwa compatible

Add compatible to panel-simple for Kaohsiung Opto-Electronics Inc.
10.1" WUXGA(1920x1200) TX26D202VM0BWA TFT LCD panel with LVDS interface.

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1590991843-24231-1-git-send-email-victor.liu@nxp.com
4 years agodrm/panel: simple: Set connector type for DSI panels
Laurent Pinchart [Tue, 2 Jun 2020 17:12:40 +0000 (20:12 +0300)]
drm/panel: simple: Set connector type for DSI panels

None of the DSI panels set the connector_type in their panel_desc
descriptor. As they are all guaranteed to be DSI panels, that's an easy
fix, set the connector type to DRM_MODE_CONNECTOR_DSI.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200602171240.2785-1-laurent.pinchart+renesas@ideasonboard.com
4 years agodrm/mm: fix hole size comparison
Nirmoy Das [Fri, 29 May 2020 14:04:01 +0000 (16:04 +0200)]
drm/mm: fix hole size comparison

Fixes: 0cdea4455acd350a ("drm/mm: optimize rb_hole_addr rbtree search")

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reported-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/367726/
4 years agodrm/hdlcd: Don't call drm_crtc_vblank_off on unbind
Daniel Vetter [Tue, 2 Jun 2020 09:51:40 +0000 (11:51 +0200)]
drm/hdlcd: Don't call drm_crtc_vblank_off on unbind

This is already taken care of by drm_atomic_helper_shutdown(), and
in that case only for the CRTC which are actually on.

Only tricky bit here is that we kill the interrupt handling before we
shut down crtc, so need to reorder that.

Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200602095140.36678-3-daniel.vetter@ffwll.ch
4 years agodrm/malidp: Don't call drm_crtc_vblank_off on unbind
Daniel Vetter [Tue, 2 Jun 2020 09:55:05 +0000 (11:55 +0200)]
drm/malidp: Don't call drm_crtc_vblank_off on unbind

This is already done as part of the drm_atomic_helper_shutdown(),
and in that case only for the crtc which are actually on.

v2: I overlooked that malidp also needs to have it's interrupt shut
down reordered.

Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200602095505.37509-1-daniel.vetter@ffwll.ch
4 years agodrm/shmem-helpers: Redirect mmap for imported dma-buf
Daniel Vetter [Mon, 11 May 2020 09:35:52 +0000 (11:35 +0200)]
drm/shmem-helpers: Redirect mmap for imported dma-buf

Currently this seems to work by converting the sgt into a pages array,
and then treating it like a native object. Do the right thing and
redirect mmap to the exporter.

With this nothing is calling get_pages anymore on imported dma-buf,
and we can start to remove the use of the ->pages array for that case.

v2: Rebase

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-8-daniel.vetter@ffwll.ch
4 years agodrm/shmem-helpers: Don't call get/put_pages on imported dma-buf in vmap
Daniel Vetter [Thu, 14 May 2020 20:22:56 +0000 (22:22 +0200)]
drm/shmem-helpers: Don't call get/put_pages on imported dma-buf in vmap

There's no direct harm, because for the shmem helpers these are noops
on imported buffers. The trouble is in the locks these take - I want
to change dma_buf_vmap locking, and so need to make sure that we only
ever take certain locks on one side of the dma-buf interface: Either
for exporters, or for importers.

v2: Change the control flow less compared to what's there (Thomas)

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200514202256.490926-1-daniel.vetter@ffwll.ch
4 years agodrm/udl: Don't call get/put_pages on imported dma-buf
Daniel Vetter [Mon, 11 May 2020 09:35:50 +0000 (11:35 +0200)]
drm/udl: Don't call get/put_pages on imported dma-buf

There's no direct harm, because for the shmem helpers these are noops
on imported buffers. The trouble is in the locks these take - I want
to change dma_buf_vmap locking, and so need to make sure that we only
ever take certain locks on one side of the dma-buf interface: Either
for exporters, or for importers.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-6-daniel.vetter@ffwll.ch
4 years agodrm/virtio: Call the right shmem helpers
Daniel Vetter [Mon, 11 May 2020 09:35:49 +0000 (11:35 +0200)]
drm/virtio: Call the right shmem helpers

drm_gem_shmem_get_sg_table is meant to implement
obj->funcs->get_sg_table, for prime exporting. The one we want is
drm_gem_shmem_get_pages_sgt, which also handles imported dma-buf, not
just native objects.

v2: Rebase, this stuff moved around in

commit 2f2aa13724d56829d910b2fa8e80c502d388f106
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Fri Feb 7 08:46:38 2020 +0100

    drm/virtio: move virtio_gpu_mem_entry initialization to new function

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-5-daniel.vetter@ffwll.ch
4 years agodrm/doc: Some polish for shmem helpers
Daniel Vetter [Mon, 11 May 2020 09:35:48 +0000 (11:35 +0200)]
drm/doc: Some polish for shmem helpers

- Move the shmem helper section to the drm-mm.rst file, next to the
  vram helpers. Makes a lot more sense there with the now wider scope.
  Also, that's where the all the other backing storage stuff resides.
  It's just the framebuffer helpers that should be in the kms helper
  section.

- Try to clarify which functiosn are for implementing
  drm_gem_object_funcs, and which for drivers to call directly. At
  least one driver screwed that up a bit.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-4-daniel.vetter@ffwll.ch
4 years agodrm/gem: WARN if drm_gem_get_pages is called on a private obj
Daniel Vetter [Mon, 11 May 2020 09:35:47 +0000 (11:35 +0200)]
drm/gem: WARN if drm_gem_get_pages is called on a private obj

No real functional change, since this just converts an annoying Oops
into a more harmless WARNING backtrace. It's still a driver bug.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-3-daniel.vetter@ffwll.ch
4 years agodrm/msm: Don't call dma_buf_vunmap without _vmap
Daniel Vetter [Thu, 14 May 2020 20:11:17 +0000 (22:11 +0200)]
drm/msm: Don't call dma_buf_vunmap without _vmap

I honestly don't exactly understand what's going on here, but the
current code is wrong for sure: It calls dma_buf_vunmap without ever
calling dma_buf_vmap.

What I'm not sure about is whether the WARN_ON is correct:
- msm imports dma-buf using drm_prime_sg_to_page_addr_arrays. Which is
  a pretty neat layering violation of how you shouldn't peek behind
  the curtain of the dma-buf exporter, but par for course. Note that
  all the nice new helpers don't (and we should probably have a bit a
  warning about this in the kerneldoc).

- but then in the get_vaddr() in msm_gem.c, we seems to happily wrap a
  vmap() around any object with ->pages set (so including imported
  dma-buf).

- I'm not seeing any guarantees that userspace can't use an imported
  dma-buf for e.g. MSM_SUBMIT_CMD_BUF in a5xx_submit_in_rb, so no
  guarantees that an imported dma-buf won't end up with a ->vaddr set.

But even if that WARN_ON is wrong, cleaning up a vmap() done by msm by
calling dma_buf_vunmap is the wrong thing to do.

v2: Rob said in review that we do indeed have a gap in get_vaddr() that
needs to be plugged. But the users I've found aren't legit users on
imported dma-buf, so we can just reject that.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20200514201117.465146-1-daniel.vetter@ffwll.ch
4 years agodrm: add docs for standard CRTC properties
Simon Ser [Thu, 21 May 2020 11:09:31 +0000 (11:09 +0000)]
drm: add docs for standard CRTC properties

This patch adds docs for the ACTIVE and MODE_ID CRTC properties.

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Michel Dänzer <michel@daenzer.net>
Cc: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/k52vYFBQ5ZO18TgZl3W8MgP6f4qu5Ncir7w-On8Dm0V2KTAcVkUoS7-IGPcvDJAXLsyJAUsD0QFJts3Dy0yWyHXVh85axrZkybh3MGGFhQc=@emersion.fr
4 years agovideo: fbdev: Use IS_BUILTIN
Joe Perches [Mon, 4 May 2020 23:29:00 +0000 (16:29 -0700)]
video: fbdev: Use IS_BUILTIN

IS_BUILTIN can be use to replace various initializations
like #if CONFIG_<FOO> int val = 1; #else int val = 0; #endif
so do so.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b1cf967015c5beafa475aaa30d8e21a58caff870.camel@perches.com
4 years agovideo: fbdev: pxafb: Use correct return value for pxafb_probe()
Tiezhu Yang [Mon, 25 May 2020 07:11:45 +0000 (15:11 +0800)]
video: fbdev: pxafb: Use correct return value for pxafb_probe()

When call function devm_platform_ioremap_resource(), we should use IS_ERR()
to check the return value and return PTR_ERR() if failed.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Xuefeng Li <lixuefeng@loongson.cn>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1590390705-22898-1-git-send-email-yangtiezhu@loongson.cn
4 years agovideo: pxafb: Fix the function used to balance a 'dma_alloc_coherent()' call
Christophe JAILLET [Wed, 29 Apr 2020 08:45:05 +0000 (10:45 +0200)]
video: pxafb: Fix the function used to balance a 'dma_alloc_coherent()' call

'dma_alloc_coherent()' must be balanced by a call to 'dma_free_coherent()'
not 'dma_free_wc()'.
The correct dma_free_ function is already used in the error handling path
of the probe function.

Fixes: 77e196752bdd ("[ARM] pxafb: allow video memory size to be configurable")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Jani Nikula <jani.nikula@intel.com>
cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200429084505.108897-1-christophe.jaillet@wanadoo.fr
4 years agodrivers: video: hdmi: cleanup coding style in video a bit
Bernard Zhao [Mon, 27 Apr 2020 08:05:23 +0000 (01:05 -0700)]
drivers: video: hdmi: cleanup coding style in video a bit

Eliminate the magic numbers, add vendor infoframe size macro
like other hdmi modules.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: opensource.kernel@vivo.com
[b.zolnierkie: add "hdmi" to the patch summary]
[b.zolnierkie: fix "vender" -> vendor" typo in the patch description]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200427080530.3234-1-bernard@vivo.com
4 years agoconsole: newport_con: fix an issue about leak related system resources
Dejin Zheng [Thu, 23 Apr 2020 16:42:51 +0000 (00:42 +0800)]
console: newport_con: fix an issue about leak related system resources

A call of the function do_take_over_console() can fail here.
The corresponding system resources were not released then.
Thus add a call of iounmap() and release_mem_region()
together with the check of a failure predicate. and also
add release_mem_region() on device removal.

Fixes: e86bb8acc0fdc ("[PATCH] VT binding: Make newport_con support binding")
Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200423164251.3349-1-zhengdejin5@gmail.com
4 years agovideo: fbdev: sm712fb: fix an issue about iounmap for a wrong address
Dejin Zheng [Wed, 22 Apr 2020 16:07:19 +0000 (00:07 +0800)]
video: fbdev: sm712fb: fix an issue about iounmap for a wrong address

the sfb->fb->screen_base is not save the value get by iounmap() when
the chip id is 0x720. so iounmap() for address sfb->fb->screen_base
is not right.

Fixes: 1461d6672864854 ("staging: sm7xxfb: merge sm712fb with fbdev")
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Teddy Wang <teddy.wang@siliconmotion.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200422160719.27763-1-zhengdejin5@gmail.com