platform/kernel/linux-rpi.git
5 years agodrm: move DRM_SWITCH_POWER defines to drm_device.h
Sam Ravnborg [Tue, 8 Jan 2019 19:29:29 +0000 (20:29 +0100)]
drm: move DRM_SWITCH_POWER defines to drm_device.h

Move DRM_SWITCH_POWER out of drmP.h to allow users
to get rid of the drmP include.
Moved to drm_device.h because drm_device.switch_power_state
is the only user.

Converted to enum and added sparse kerneldoc comments.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190108192939.15255-3-sam@ravnborg.org
5 years agodrm: drm_device.h: update comments to kernel-doc style
Sam Ravnborg [Tue, 8 Jan 2019 19:29:28 +0000 (20:29 +0100)]
drm: drm_device.h: update comments to kernel-doc style

Updated comment style to kernel-doc format in drm_device.h

In struct drm_device there are 12 struct members without doc:
- registered
- filelist_mutex
- filelist
- irq
- vbl_lock
- event_lock
- hose
- sigdata
- sigdata.context
- sigdata.lock
- agp_buffer_map
- agp_buffer_token

They all need proper documentation, a task left for someone
that knows their usage.

drm_device is not plugged into Documentation/gpu/drm-internals.rst
as this would create a new load of warnings.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190108192939.15255-2-sam@ravnborg.org
5 years agodrm: i915: Cleanup drm_display_mode print str
Shayenne Moura [Thu, 20 Dec 2018 12:27:57 +0000 (10:27 -0200)]
drm: i915: Cleanup drm_display_mode print str

This patch adjust the print string of drm_display_mode object
to remove drm_mode_object dependency in i915 files.
It modifies the print style to standardize the use of DRM_MODE_FMT.

Signed-off-by: Shayenne Moura <shayenneluzmoura@gmail.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/087e07a388c7c65b6d0ec50db069640e4eb32fdf.1545308167.git.shayenneluzmoura@gmail.com
5 years agodrm: sti: Cleanup drm_display_mode print str
Shayenne Moura [Thu, 20 Dec 2018 12:27:30 +0000 (10:27 -0200)]
drm: sti: Cleanup drm_display_mode print str

This patch adjust the print string of drm_display_mode object
to remove drm_mode_object dependency in sti files.

Signed-off-by: Shayenne Moura <shayenneluzmoura@gmail.com>
Acked-by: Benjamin Gaignard <benjamin;gaignard@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/c079f461575aece9d598784da25aaadc711a2729.1545308167.git.shayenneluzmoura@gmail.com
5 years agodrm: meson: Cleanup on drm_display_mode print str
Shayenne Moura [Thu, 20 Dec 2018 12:26:55 +0000 (10:26 -0200)]
drm: meson: Cleanup on drm_display_mode print str

This patch adjust the print string of drm_display_mode object
to remove drm_mode_object dependency in meson files.

Signed-off-by: Shayenne Moura <shayenneluzmoura@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/7017942bbbb3e0e6c1e2bd854ea5a5f461784ac4.1545308167.git.shayenneluzmoura@gmail.com
5 years agodrm: omapdrm: Cleanup drm_display_mode print str
Shayenne Moura [Thu, 20 Dec 2018 12:26:10 +0000 (10:26 -0200)]
drm: omapdrm: Cleanup drm_display_mode print str

This patch adjust the print string of drm_display_mode object
to remove drm_mode_object dependency in omapdrm files.

Signed-off-by: Shayenne Moura <shayenneluzmoura@gmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/cb6079fa6de6fda8d865a1d2a61d7cf10019ae88.1545308167.git.shayenneluzmoura@gmail.com
5 years agoqxl: Use struct_size() in kzalloc()
Gustavo A. R. Silva [Tue, 8 Jan 2019 16:21:52 +0000 (10:21 -0600)]
qxl: Use struct_size() in kzalloc()

One of the more common cases of allocation size calculations is finding the
size of a structure that has a zero-sized array at the end, along with memory
for some number of elements for that array. For example:

struct foo {
    int stuff;
    void *entry[];
};

instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can now
use the new struct_size() helper:

instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190108162152.GA25361@embeddedor
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/virtio: Drop deprecated load/unload initialization
Ezequiel Garcia [Tue, 8 Jan 2019 14:59:30 +0000 (11:59 -0300)]
drm/virtio: Drop deprecated load/unload initialization

Move the code around so the driver is probed the bus
.probe and removed from the bus .remove callbacks.
This commit is just a cleanup and shouldn't affect
functionality.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190108145930.15080-1-ezequiel@collabora.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/fb-helper: fix leaks in error path of drm_fb_helper_fbdev_setup
Peter Wu [Sun, 23 Dec 2018 00:55:07 +0000 (01:55 +0100)]
drm/fb-helper: fix leaks in error path of drm_fb_helper_fbdev_setup

After drm_fb_helper_fbdev_setup calls drm_fb_helper_init,
"dev->fb_helper" will be initialized (and thus drm_fb_helper_fini will
have some effect). After that, drm_fb_helper_initial_config is called
which may call the "fb_probe" driver callback.

This driver callback may call drm_fb_helper_defio_init (as is done by
drm_fb_helper_generic_probe) or set a framebuffer (as is done by bochs)
as documented. These are normally cleaned up on exit by
drm_fb_helper_fbdev_teardown which also calls drm_fb_helper_fini.

If an error occurs after "fb_probe", but before setup is complete, then
calling just drm_fb_helper_fini will leak resources. This was triggered
by df2052cc922 ("bochs: convert to drm_fb_helper_fbdev_setup/teardown"):

    [   50.008030] bochsdrmfb: enable CONFIG_FB_LITTLE_ENDIAN to support this framebuffer
    [   50.009436] bochs-drm 0000:00:02.0: [drm:drm_fb_helper_fbdev_setup] *ERROR* fbdev: Failed to set configuration (ret=-38)
    [   50.011456] [drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:02.0 on minor 2
    [   50.013604] WARNING: CPU: 1 PID: 1 at drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x280/0x2a0
    [   50.016175] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G                T 4.20.0-rc7 #1
    [   50.017732] EIP: drm_mode_config_cleanup+0x280/0x2a0
    ...
    [   50.023155] Call Trace:
    [   50.023155]  ? bochs_kms_fini+0x1e/0x30
    [   50.023155]  ? bochs_unload+0x18/0x40

This can be reproduced with QEMU and CONFIG_FB_LITTLE_ENDIAN=n.

Link: https://lkml.kernel.org/r/20181221083226.GI23332@shao2-debian
Link: https://lkml.kernel.org/r/20181223004315.GA11455@al
Fixes: 8741216396b2 ("drm/fb-helper: Add drm_fb_helper_fbdev_setup/teardown()")
Reported-by: kernel test robot <rong.a.chen@intel.com>
Cc: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181223005507.28328-1-peter@lekensteyn.nl
5 years agodrm/fb-helper: generic: Fix setup error path
Noralf Trønnes [Sat, 5 Jan 2019 18:18:46 +0000 (19:18 +0100)]
drm/fb-helper: generic: Fix setup error path

If register_framebuffer() fails during fbdev setup we will leak the
framebuffer, the GEM buffer and the shadow buffer for defio. This is
because drm_fb_helper_fbdev_setup() just calls drm_fb_helper_fini() on
error not taking into account that register_framebuffer() can fail.

Since the generic emulation uses DRM client for its framebuffer and
backing buffer in addition to a shadow buffer, it's necessary to open code
drm_fb_helper_fbdev_setup() to properly handle the error path.

Error cleanup is removed from .fb_probe and is handled by one function for
all paths.

Fixes: 9060d7f49376 ("drm/fb-helper: Finish the generic fbdev emulation")
Reported-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190105181846.26495-1-noralf@tronnes.org
5 years agodrm/virtio: drop virtio_gpu_fence_cleanup()
Gerd Hoffmann [Wed, 19 Dec 2018 12:27:01 +0000 (13:27 +0100)]
drm/virtio: drop virtio_gpu_fence_cleanup()

Just call drm_fence_put directly instead.
Also set vgfb->fence to NULL after dropping the reference.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181219122708.4586-4-kraxel@redhat.com
5 years agodrm/virtio: fix pageflip flush
Gerd Hoffmann [Wed, 19 Dec 2018 12:27:00 +0000 (13:27 +0100)]
drm/virtio: fix pageflip flush

Sending the flush command only makes sense if we actually have
a framebuffer attached to the scanout (handle != 0).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181219122708.4586-3-kraxel@redhat.com
5 years agodrm/virtio: log error responses
Gerd Hoffmann [Wed, 19 Dec 2018 12:26:59 +0000 (13:26 +0100)]
drm/virtio: log error responses

If we got an error response code from the host, print it to the log.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181219122708.4586-2-kraxel@redhat.com
5 years agodrm/virtio: Add missing virtqueue reset
Ezequiel Garcia [Wed, 2 Jan 2019 17:55:07 +0000 (14:55 -0300)]
drm/virtio: Add missing virtqueue reset

As per the VirtIO spec, the virtqueues must be reset during cleanup
(see "3.3.1 Driver Requirements: Device Cleanup").

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190102175507.4653-2-ezequiel@collabora.com
5 years agodrm/virtio: Remove incorrect kfree()
Ezequiel Garcia [Wed, 2 Jan 2019 17:55:06 +0000 (14:55 -0300)]
drm/virtio: Remove incorrect kfree()

The virtio_gpu_output is a member of struct virtio_gpu_device
and is not a dynamically-allocated chunk, so it's wrong to kfree() it.
Removing it fixes a memory corruption BUG() that can be triggered
when the virtio-gpu driver is removed.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190102175507.4653-1-ezequiel@collabora.com
5 years agodrm/todo: Better defio support in the generic fbdev emulation
Daniel Vetter [Mon, 7 Jan 2019 10:22:38 +0000 (11:22 +0100)]
drm/todo: Better defio support in the generic fbdev emulation

The current one essentially means you need CMA or a vmalloc backed
object, which makes fbdev emulation a special case.

Since implementing this will be quite a bit of work, capture the idea
in a TODO.

Cc: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190107102238.7789-1-daniel.vetter@ffwll.ch
5 years agoMerge tag 'topic/drmp-cleanup-2019-01-02' of git://anongit.freedesktop.org/drm/drm...
Maxime Ripard [Mon, 7 Jan 2019 15:43:24 +0000 (16:43 +0100)]
Merge tag 'topic/drmp-cleanup-2019-01-02' of git://anongit.freedesktop.org/drm/drm-intel into drm-misc-next

Make some drm headers self-contained with includes and forward declarations

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
# gpg: Signature made Wed 02 Jan 2019 10:47:51 AM CET
# gpg:                using RSA key 1565A65B77B0632E1124E59CD398079D26ABEE6F
# gpg: Can't check signature: No public key
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87pntfl6pa.fsf@intel.com
5 years agodrm: Fix error handling in drm_legacy_addctx
YueHaibing [Sat, 29 Dec 2018 02:49:07 +0000 (10:49 +0800)]
drm: Fix error handling in drm_legacy_addctx

'ctx->handle' is unsigned, it never less than zero.
This patch use int 'tmp_handle' to handle the err condition.

Fixes: 62968144e673 ("drm: convert drm context code to use Linux idr")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181229024907.12852-1-yuehaibing@huawei.com
5 years agodrm: Reorder set_property_atomic to avoid returning with an active ww_ctx
Chris Wilson [Sun, 30 Dec 2018 12:28:42 +0000 (12:28 +0000)]
drm: Reorder set_property_atomic to avoid returning with an active ww_ctx

Delay the drm_modeset_acquire_init() until after we check for an
allocation failure so that we can return immediately upon error without
having to unwind.

WARNING: lock held when returning to user space!
4.20.0+ #174 Not tainted
------------------------------------------------
syz-executor556/8153 is leaving the kernel with locks still held!
1 lock held by syz-executor556/8153:
  #0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at:
set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462

Reported-by: syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com
Fixes: 144a7999d633 ("drm: Handle properties in the core for atomic drivers")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: <stable@vger.kernel.org> # v4.14+
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181230122842.21917-1-chris@chris-wilson.co.uk
5 years agodrm: forward declare struct drm_file in drm_syncobj.h
Jani Nikula [Fri, 28 Dec 2018 08:28:15 +0000 (10:28 +0200)]
drm: forward declare struct drm_file in drm_syncobj.h

drm_syncobj.h uses struct drm_file pointers, forward declare struct
drm_file to make the header self-contained. This prepares for dropping
drmP.h from files including drm_syncobj.h.

Switch from "" to <> includes while at it.

v2: forward declare instead of including drm_file.h (Daniel)

[Updated commit message per Laurent's review while applying.]

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181228082815.10797-1-jani.nikula@intel.com
5 years agodrm: include types.h from drm_hdcp.h
Jani Nikula [Thu, 27 Dec 2018 12:56:39 +0000 (14:56 +0200)]
drm: include types.h from drm_hdcp.h

drm_hdcp.h uses kernel integer types, make it self-contained by
including linux/kernel.h. This prepares for dropping drmP.h from files
including drm_hdcp.h.

[Updated commit message per Laurent's review while applying.]

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/adfc79941e827b49eb6186f317cbeff0fb365f33.1545915059.git.jani.nikula@intel.com
5 years agodrm: include idr.h from drm_file.h
Jani Nikula [Thu, 27 Dec 2018 12:56:38 +0000 (14:56 +0200)]
drm: include idr.h from drm_file.h

drm_file.h embeds idr structures in DRM-specific structures. Include the
corresponding header to make drm_file.h self-contained. Make it easier
to drop drmP.h includes.

[Updated commit message per Laurent's review while applying.]

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2818b15332ab562722dfc324cf977b7eb4a04401.1545915059.git.jani.nikula@intel.com
5 years agodrm: include kernel.h and agp_backend.h from intel-gtt.h
Jani Nikula [Thu, 27 Dec 2018 12:56:37 +0000 (14:56 +0200)]
drm: include kernel.h and agp_backend.h from intel-gtt.h

intel-gtt.h uses kernel and agp pointers, make it self-contained by
including the relevant headers. This prepares for dropping drmP.h from
files including intel-gtt.h.

[Updated commit message per Laurent's review while applying.]

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/9414800f89d6f326c6e9173233bf6c4dee254d9a.1545915059.git.jani.nikula@intel.com
5 years agodrm: un-inline drm_legacy_findmap()
Jani Nikula [Fri, 28 Dec 2018 13:04:46 +0000 (15:04 +0200)]
drm: un-inline drm_legacy_findmap()

Un-inline drm_legacy_findmap() to not depend on struct drm_device
definition within drm_legacy.h, so that a forward declaration suffices.

Also include drm_hashtab.h in drm_legacy.h to make it more
self-contained. Make it easier to drop drmP.h includes.

v2: avoid including drm_device.h by un-inlining (Daniel)

[Updated commit message per Laurent's review while applying.]

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181228130446.22141-1-jani.nikula@intel.com
5 years agodrm: move DRM_IF_VERSION to drm_internal.h
Sam Ravnborg [Wed, 26 Dec 2018 21:03:47 +0000 (22:03 +0100)]
drm: move DRM_IF_VERSION to drm_internal.h

Move DRM_IF_VERSION out of drmP.h to allow users
to get rid of the drmP include.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181226210353.13993-1-sam@ravnborg.org
5 years agodrm/drm_drv.c: Remove duplicate header
Brajeswar Ghosh [Mon, 24 Dec 2018 14:36:36 +0000 (20:06 +0530)]
drm/drm_drv.c: Remove duplicate header

Remove drm_crtc_internal.h which is included more than once

Signed-off-by: Brajeswar Ghosh <brajeswar.linux@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181224143636.GA3237@hp-pavilion-15-notebook-pc-brajeswar
5 years agodma-buf: Change to use DEFINE_SHOW_ATTRIBUTE macro
Yangtao Li [Fri, 30 Nov 2018 16:11:01 +0000 (11:11 -0500)]
dma-buf: Change to use DEFINE_SHOW_ATTRIBUTE macro

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130161101.3413-1-tiny.windzz@gmail.com
5 years agodrm/bochs: add edid present check
Gerd Hoffmann [Thu, 20 Dec 2018 10:11:21 +0000 (11:11 +0100)]
drm/bochs: add edid present check

Check header before trying to read the complete edid blob, to avoid the
log being spammed in case qemu has no edid support (old qemu or edid
support turned off).

Fixes: 01f23459cf drm/bochs: add edid support.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181220101122.16153-1-kraxel@redhat.com
5 years agodrm/vc4: Attach margin props to the HDMI connector
Boris Brezillon [Thu, 6 Dec 2018 14:24:39 +0000 (15:24 +0100)]
drm/vc4: Attach margin props to the HDMI connector

Now that the plane code takes the margins setup into account, we can
safely attach margin props to the HDMI connector.

We also take care of filling AVI infoframes correctly to expose the
top/botton/left/right bar.

Note that those margin props match pretty well the
overscan_{left,right,top,bottom} properties defined in config.txt and
parsed by the VC4 firmware.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181206142439.10441-6-boris.brezillon@bootlin.com
5 years agodrm/vc4: Take margin setup into account when updating planes
Boris Brezillon [Thu, 6 Dec 2018 14:24:38 +0000 (15:24 +0100)]
drm/vc4: Take margin setup into account when updating planes

Applyin margins is just a matter of scaling all planes appropriately
and adjusting the CRTC X/Y offset to account for the
left/right/top/bottom borders.

Create a vc4_plane_margins_adj() function doing that and call it from
vc4_plane_setup_clipping_and_scaling() so that we are ready to attach
margins properties to the HDMI connector.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181206142439.10441-5-boris.brezillon@bootlin.com
5 years agodrm/connector: Allow creation of margin props alone
Boris Brezillon [Thu, 6 Dec 2018 14:24:37 +0000 (15:24 +0100)]
drm/connector: Allow creation of margin props alone

TV margins properties can only be added as part of the SDTV TV
connector properties creation, but we might need those props for HDMI
TVs too, so let's move the margins props creation in a separate
function and expose it to drivers.

We also add an helper to attach margins props to a connector.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181206142439.10441-4-boris.brezillon@bootlin.com
5 years agodrm/connector: Clarify the unit of TV margins
Boris Brezillon [Thu, 6 Dec 2018 14:24:36 +0000 (15:24 +0100)]
drm/connector: Clarify the unit of TV margins

All margins are expressed in pixels. Clarify that in the doc.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181206142439.10441-3-boris.brezillon@bootlin.com
5 years agodrm/connector: Fix drm_mode_create_tv_properties() doc
Boris Brezillon [Thu, 6 Dec 2018 14:24:35 +0000 (15:24 +0100)]
drm/connector: Fix drm_mode_create_tv_properties() doc

The in the kernel-doc header did not match the function name.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181206142439.10441-2-boris.brezillon@bootlin.com
5 years agodrm: dw-hdmi-i2s: convert to SPDX identifiers
Kuninori Morimoto [Tue, 18 Dec 2018 06:00:24 +0000 (15:00 +0900)]
drm: dw-hdmi-i2s: convert to SPDX identifiers

This patch updates license to use SPDX-License-Identifier
instead of verbose license text.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87lg4n1izg.wl-kuninori.morimoto.gx@renesas.com
5 years agoMAINTAINERS: drm: Remove myself as drm-bridge maintainer
Archit Taneja [Thu, 13 Sep 2018 07:53:00 +0000 (13:23 +0530)]
MAINTAINERS: drm: Remove myself as drm-bridge maintainer

I have moved on to other stuff for now. Haven't been able to make time
to review bridge related work. Andrzej has been doing it by himself
for a while now.

Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180913075300.22510-1-architt@codeaurora.org
5 years agodrm/vkms: set preferred depth to 24
emersion [Sun, 16 Dec 2018 18:49:08 +0000 (18:49 +0000)]
drm/vkms: set preferred depth to 24

Otherwise DRM_CAP_DUMB_PREFERRED_DEPTH is zero.

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/o2SmEP0M6h287Fs5OeL3HtQzTr8uV0PyOhFict_qdxeS7vFvV1Zr8qzRUJh-YnCoJHo13nJgAqqQByzEzTZTqk9R2ExsOszYLj68hQLqBIc=@emersion.fr
5 years agodrm/ati_pcigart: Fix error code in drm_ati_pcigart_init()
Dan Carpenter [Mon, 17 Dec 2018 07:03:44 +0000 (10:03 +0300)]
drm/ati_pcigart: Fix error code in drm_ati_pcigart_init()

The drm_ati_pcigart_init() function was originally suppose to return one
on success and zero on failure, but these days it returns a mix of
zero, one and -ENOMEM on failure.

This patch cleans it up and modifies the caller so now the function
returns zero on success and negative error codes on failure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181217070344.GC12159@kadam
5 years agodrm: Fix an error pointer dereference()
Dan Carpenter [Mon, 17 Dec 2018 07:00:38 +0000 (10:00 +0300)]
drm: Fix an error pointer dereference()

The drm_mode_create_tile_group() is only called from
drm_parse_tiled_block() and the caller expects it to return a NULL on
error.  In other words, this function should match
drm_mode_get_tile_group().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181217065733.GA12159@kadam
5 years agodrm/dp_mst: Refactor drm_dp_update_payload_part1()
Lyude Paul [Fri, 14 Dec 2018 01:25:31 +0000 (20:25 -0500)]
drm/dp_mst: Refactor drm_dp_update_payload_part1()

This:

- Adds local variables in the first loop, instead of using array indices
  everywhere
- Adds an early continue to reduce the indent level in the second loop

There should be no functional changes here

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Juston Li <juston.li@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181214012604.13746-3-lyude@redhat.com
5 years agodrm/dp_mst: Remove bogus conditional in drm_dp_update_payload_part1()
Lyude Paul [Fri, 14 Dec 2018 01:25:30 +0000 (20:25 -0500)]
drm/dp_mst: Remove bogus conditional in drm_dp_update_payload_part1()

There's no reason we need this, it's just confusing looking.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Juston Li <juston.li@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181214012604.13746-2-lyude@redhat.com
5 years agodrm/virtio: switch to generic fbdev emulation
Gerd Hoffmann [Thu, 13 Dec 2018 13:49:15 +0000 (14:49 +0100)]
drm/virtio: switch to generic fbdev emulation

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181213134915.24722-1-kraxel@redhat.com
5 years agodrm: Remove complete task from TODO documentation
Shayenne da Luz Moura [Thu, 13 Dec 2018 22:55:37 +0000 (20:55 -0200)]
drm: Remove complete task from TODO documentation

This patch remove the follow complete task from TODO documentation:

  drm_mode_config.crtc_idr is misnamed, since it contains all KMS object.
  Should be renamed to drm_mode_config.object_idr.

Signed-off-by: Shayenne da Luz Moura <shayenneluzmoura@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181213225537.nq4dwidn6tma33iv@smtp.gmail.com
5 years agodrm/dp_mst: Fix memory leak in drm_dp_mst_topology_mgr_destroy()
Lyude Paul [Tue, 11 Dec 2018 23:50:26 +0000 (18:50 -0500)]
drm/dp_mst: Fix memory leak in drm_dp_mst_topology_mgr_destroy()

We need to call drm_dp_mst_topology_mgr_set_mst(mgr, false) when
destroying the topology manager in order to ensure that the root mstb
and all of it's descendents are actually destroyed, and additionally to
try to make sure that we leave the hub in a clean state.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181211235026.21758-1-lyude@redhat.com
5 years agodrm: Rename crtc_idr as object_idr to KMS cleanups
Shayenne da Luz Moura [Thu, 13 Dec 2018 21:29:57 +0000 (19:29 -0200)]
drm: Rename crtc_idr as object_idr to KMS cleanups

This patch solves this TODO task:
 drm_mode_config.crtc_idr is misnamed, since it contains all KMS object.
 Should be renamed to drm_mode_config.object_idr.

Signed-off-by: Shayenne da Luz Moura <shayenneluzmoura@gmail.com>
[danvet: resolve conflict with addition of privobj_list.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181213212957.vkitkyl5cj2qh7qr@smtp.gmail.com
5 years agodrm/rockchip: Add implicit fencing support for planes
Heiko Stuebner [Fri, 30 Nov 2018 10:24:49 +0000 (11:24 +0100)]
drm/rockchip: Add implicit fencing support for planes

Render like lima will attach a fence to the framebuffer dma_buf,
so the display driver should wait for it to finish before showing
the framebufferto prevent tearing.

Generally tested on rk3188, rk3288, rk3328 and rk3399 and
together with an actual lima-based kmscube on rk3188 and rk3328.

Suggested-by: Qiang Yu <yuq825@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130102449.6430-1-heiko@sntech.de
5 years agodrm/xen: Don't set the dpms hook
Daniel Vetter [Mon, 10 Dec 2018 10:03:58 +0000 (11:03 +0100)]
drm/xen: Don't set the dpms hook

Doesn't do anything for atomic.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Cc: xen-devel@lists.xen.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181210100359.22507-7-daniel.vetter@ffwll.ch
5 years agodrm/qxl: Don't set the dpms hook
Daniel Vetter [Mon, 10 Dec 2018 10:03:57 +0000 (11:03 +0100)]
drm/qxl: Don't set the dpms hook

Doesn't do anything with atomic.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Cc: spice-devel@lists.freedesktop.org
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181210100359.22507-6-daniel.vetter@ffwll.ch
5 years agodrm/syncobj: remove drm_syncobj_cb and cleanup
Christian König [Tue, 11 Dec 2018 10:34:41 +0000 (18:34 +0800)]
drm/syncobj: remove drm_syncobj_cb and cleanup

This completes "drm/syncobj: Drop add/remove_callback from driver
interface" and cleans up the implementation a bit.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Link: https://patchwork.freedesktop.org/patch/266255/
5 years agodrm/etnaviv: fix for 64bit seqno change
Christian König [Fri, 7 Dec 2018 19:10:17 +0000 (20:10 +0100)]
drm/etnaviv: fix for 64bit seqno change

The fence seqno is now 64bit, fixes build warning.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/267136/
5 years agodrm/atomic: integrate modeset lock with private objects
Rob Clark [Mon, 22 Oct 2018 12:31:22 +0000 (14:31 +0200)]
drm/atomic: integrate modeset lock with private objects

Follow the same pattern of locking as with other state objects. This
avoids boilerplate in the driver.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181022123122.30468-1-boris.brezillon@bootlin.com
5 years agodrm/dp/mst: Validate REMOTE_I2C_READ harder
Ville Syrjälä [Fri, 28 Sep 2018 18:04:00 +0000 (21:04 +0300)]
drm/dp/mst: Validate REMOTE_I2C_READ harder

Make sure i2c msgs we're asked to transfer conform to the
requirements of REMOTE_I2C_READ. We were only checking that the
last message is a read, but we must also check that the preceding
messages are all writes. Also check that the length of each
message isn't too long.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180928180403.22499-2-ville.syrjala@linux.intel.com
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
5 years agodrm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers
Ville Syrjälä [Fri, 28 Sep 2018 18:03:59 +0000 (21:03 +0300)]
drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers

We aren't supposed to force a stop+start between every i2c msg
when performing multi message transfers. This should eg. cause
the DDC segment address to be reset back to 0 between writing
the segment address and reading the actual EDID extension block.

To quote the E-DDC spec:
"... this standard requires that the segment pointer be
 reset to 00h when a NO ACK or a STOP condition is received."

Since we're going to touch this might as well consult the
I2C_M_STOP flag to determine whether we want to force the stop
or not.

Cc: Brian Vincent <brainn@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=108081
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180928180403.22499-1-ville.syrjala@linux.intel.com
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
5 years agodrm/ast: Remove set but not used variable 'bo'
YueHaibing [Sat, 8 Dec 2018 08:36:25 +0000 (08:36 +0000)]
drm/ast: Remove set but not used variable 'bo'

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

drivers/gpu/drm/ast/ast_fb.c: In function 'astfb_create':
drivers/gpu/drm/ast/ast_fb.c:194:17: warning:
 variable 'bo' set but not used [-Wunused-but-set-variable]

It never used since introduction in commit 312fec1405dd ("drm: Initial KMS
driver for AST (ASpeed Technologies) 2000 series (v2)")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1544258185-50430-1-git-send-email-yuehaibing@huawei.com
5 years agodrm/dp-mst-helper: Remove hotplug callback
Daniel Vetter [Wed, 28 Nov 2018 22:12:34 +0000 (23:12 +0100)]
drm/dp-mst-helper: Remove hotplug callback

When everyone implements it exactly the same way, among all 4
implementations, there's not really a need to overwrite this at all.

Aside: drm_kms_helper_hotplug_event is pretty much core functionality
at this point. Probably should move it there.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181128221234.15054-1-daniel.vetter@ffwll.ch
5 years agodrm/vc4: Add support for X/Y reflection
Boris Brezillon [Fri, 7 Dec 2018 08:36:06 +0000 (09:36 +0100)]
drm/vc4: Add support for X/Y reflection

Add support for X/Y reflection when the plane is using linear or
T-tiled formats. X/Y reflection hasn't been tested on SAND formats, so
we reject them until proper testing/debugging has been done.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181207083606.15449-2-boris.brezillon@bootlin.com
5 years agodrm/vc4: Fix negative X/Y positioning on SAND planes
Boris Brezillon [Fri, 7 Dec 2018 08:36:05 +0000 (09:36 +0100)]
drm/vc4: Fix negative X/Y positioning on SAND planes

Commit 3e407417b192 ("drm/vc4: Fix X/Y positioning of planes using
T_TILES modifier") fixed the problem with T_TILES format, but left
things in a non-working state for SAND formats. Address that now.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181207083606.15449-1-boris.brezillon@bootlin.com
5 years agodrm/v3d: Invalidate the caches from the outside in.
Eric Anholt [Mon, 3 Dec 2018 22:24:38 +0000 (14:24 -0800)]
drm/v3d: Invalidate the caches from the outside in.

This would be a fairly obscure race, but let's make sure we don't ever
lose it.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203222438.25417-6-eric@anholt.net
Reviewed-by: Dave Emett <david.emett@broadcom.com>
5 years agodrm/v3d: Stop trying to flush L2C on V3D 3.3+
Eric Anholt [Mon, 3 Dec 2018 22:24:37 +0000 (14:24 -0800)]
drm/v3d: Stop trying to flush L2C on V3D 3.3+

This cache was replaced with the slice accessing the L2T in the newer
generations.  Noted by Dave during review.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203222438.25417-5-eric@anholt.net
Reviewed-by: Dave Emett <david.emett@broadcom.com>
5 years agodrm/v3d: Drop the wait for L2T flush to complete.
Eric Anholt [Mon, 3 Dec 2018 22:24:36 +0000 (14:24 -0800)]
drm/v3d: Drop the wait for L2T flush to complete.

According to Dave, once you've started an L2T flush, all L2T accesses
will be blocked until the flush completes.  This fixes a consistent
3-4ms stall between the ioctl and running the job, and 3DMMES Taiji
goes from 27fps to 110fps.

v2: Leave a note about why we don't need to wait for completion.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Reviewed-by: Dave Emett <david.emett@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203222438.25417-4-eric@anholt.net
5 years agodrm/v3d: Don't bother flushing L1TD at job start.
Eric Anholt [Mon, 3 Dec 2018 22:24:35 +0000 (14:24 -0800)]
drm/v3d: Don't bother flushing L1TD at job start.

This is the write combiner for TMU writes.  You're supposed to flush
that at job end if you had dirtied any cachelines.  Flushing it at job
start then doesn't make any sense.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Reviewed-by: Dave Emett <david.emett@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203222438.25417-3-eric@anholt.net
5 years agodrm/v3d: Drop unused v3d_flush_caches().
Eric Anholt [Mon, 3 Dec 2018 22:24:34 +0000 (14:24 -0800)]
drm/v3d: Drop unused v3d_flush_caches().

Now that I've specified how the end-of-pipeline flushing should work,
we're never going to use this function.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Emett <david.emett@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203222438.25417-2-eric@anholt.net
5 years agodrm/v3d: Document cache flushing ABI.
Eric Anholt [Mon, 3 Dec 2018 22:24:33 +0000 (14:24 -0800)]
drm/v3d: Document cache flushing ABI.

Right now, userspace doesn't do any L2T writes, but we should lay out
our expectations for how it works.

v2: Explicitly mention the VCD cache flushing requirements and that
    we'll flush the other caches before each of the CLs.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203222438.25417-1-eric@anholt.net
Reviewed-by: Dave Emett <david.emett@broadcom.com>
5 years agodrm/i915: Compile fix for 64b dma-fence seqno
Mika Kuoppala [Fri, 7 Dec 2018 12:34:28 +0000 (14:34 +0200)]
drm/i915: Compile fix for 64b dma-fence seqno

Many errs of the form:
drivers/gpu/drm/i915/selftests/intel_hangcheck.c: In function ‘__igt_reset_evict_vma’:
./include/linux/kern_levels.h:5:18: error: format ‘%x’ expects argument of type ‘unsigned int’, but argum

Fixes: b312d8ca3a7c ("dma-buf: make fence sequence numbers 64 bit v2")
Cc: Christian König <christian.koenig@amd.com>
Cc: Chunming Zhou <david1.zhou@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20181207123428.16257-1-mika.kuoppala@linux.intel.com
5 years agodma-buf: make fence sequence numbers 64 bit v2
Christian König [Wed, 14 Nov 2018 15:11:06 +0000 (16:11 +0100)]
dma-buf: make fence sequence numbers 64 bit v2

For a lot of use cases we need 64bit sequence numbers. Currently drivers
overload the dma_fence structure to store the additional bits.

Stop doing that and make the sequence number in the dma_fence always
64bit.

For compatibility with hardware which can do only 32bit sequences the
comparisons in __dma_fence_is_later only takes the lower 32bits as significant
when the upper 32bits are all zero.

v2: change the logic in __dma_fence_is_later

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Link: https://patchwork.freedesktop.org/patch/266927/
5 years agodrm/qxl: add spice-devel list to MAINTAINERS
Gerd Hoffmann [Wed, 21 Nov 2018 09:01:29 +0000 (10:01 +0100)]
drm/qxl: add spice-devel list to MAINTAINERS

So qxl kernel patches are sent to the spice-devel list for review.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20181121090129.23506-1-kraxel@redhat.com
5 years agodrm/v3d: fix broken build
Christian König [Wed, 5 Dec 2018 19:43:02 +0000 (20:43 +0100)]
drm/v3d: fix broken build

I missed one case during the recent revert of the replace_fence
interface change.

Fixes: 0b258ed1a219 drm: revert "expand replace_fence to support timeline point v2"

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/266134/
5 years agodrm: revert "expand replace_fence to support timeline point v2"
Christian König [Wed, 14 Nov 2018 13:24:27 +0000 (14:24 +0100)]
drm: revert "expand replace_fence to support timeline point v2"

This reverts commit 9a09a42369a4a37a959c051d8e1a1f948c1529a4.

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

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

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Link: https://patchwork.freedesktop.org/patch/265580/
5 years agodrm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_tr...
YueHaibing [Thu, 29 Nov 2018 06:00:33 +0000 (06:00 +0000)]
drm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_transfer()

use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1543471233-159568-1-git-send-email-yuehaibing@huawei.com
5 years agodrm/vkms: Remove set but not used variable 'vkms_obj'
YueHaibing [Sat, 1 Dec 2018 03:20:44 +0000 (03:20 +0000)]
drm/vkms: Remove set but not used variable 'vkms_obj'

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

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

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

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1543634444-186448-1-git-send-email-yuehaibing@huawei.com
5 years agodrm/sun4i: Add compatible for H6 display engine
Jernej Skrabec [Sun, 4 Nov 2018 18:26:45 +0000 (19:26 +0100)]
drm/sun4i: Add compatible for H6 display engine

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

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181104182705.18047-9-jernej.skrabec@siol.net
5 years agodrm/v3d: Add more tracepoints for V3D GPU rendering.
Eric Anholt [Sat, 1 Dec 2018 00:57:58 +0000 (16:57 -0800)]
drm/v3d: Add more tracepoints for V3D GPU rendering.

The core scheduler tells us when the job is pushed to the scheduler's
queue, and I had the job_run functions saying when they actually queue
the job to the hardware.  By adding tracepoints for the very top of
the ioctls and the IRQs signaling job completion, "perf record -a -e
v3d:.\* -e gpu_scheduler:.\* <job>; perf script" gets you a pretty
decent timeline.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181201005759.28093-5-eric@anholt.net
Reviewed-by: Dave Emett <david.emett@broadcom.com>
5 years agodrm/v3d: Add missing fence timeline name for TFU.
Eric Anholt [Sat, 1 Dec 2018 00:57:59 +0000 (16:57 -0800)]
drm/v3d: Add missing fence timeline name for TFU.

We shouldn't be returning v3d-render for our new queue.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 83d5139982db ("drm/v3d: Add support for submitting jobs to the TFU.")
Link: https://patchwork.freedesktop.org/patch/msgid/20181201005759.28093-6-eric@anholt.net
Reviewed-by: Dave Emett <david.emett@broadcom.com>
5 years agodrm/syncobj: use dma_fence_get_stub
Christian König [Tue, 13 Nov 2018 13:14:00 +0000 (14:14 +0100)]
drm/syncobj: use dma_fence_get_stub

Extract of useful code from the timeline work. Let's use just a single
stub fence instance instead of allocating a new one all the time.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Link: https://patchwork.freedesktop.org/patch/265248/
5 years agodma-buf: add dma_fence_get_stub
Christian König [Mon, 3 Dec 2018 12:36:14 +0000 (13:36 +0100)]
dma-buf: add dma_fence_get_stub

Extract of useful code from the timeline work. This provides a function
to return a stub or dummy fence which is always signaled.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Link: https://patchwork.freedesktop.org/patch/265248/
5 years agodrm/panel: simple: Add AUO G101EVN010 panel support
Alex Gonzalez [Thu, 25 Oct 2018 15:09:30 +0000 (17:09 +0200)]
drm/panel: simple: Add AUO G101EVN010 panel support

The change adds support for the AU Optronics G101EVN010 10.1" TFT LCD
panel.

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
Reviewed-by: Rob Herring <robh@kernel.org>
[treding@nvidia.com: sort new entry alphabetically]
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1540480173-12009-2-git-send-email-alex.gonzalez@digi.com
5 years agodrm/meson: Fix an Alpha Primary Plane bug on Meson GXL/GXM SoCs
Neil Armstrong [Wed, 28 Nov 2018 10:07:34 +0000 (11:07 +0100)]
drm/meson: Fix an Alpha Primary Plane bug on Meson GXL/GXM SoCs

On the Amlogic GXL & GXM SoCs, a bug occurs on the primary plane when
alpha is used where the alpha is not aligned with the pixel content.

The workaround Amlogic implemented is to reset the OSD1 plane hardware
block each time the plane is (re)enabled, solving the issue.

In the reset, we still need to save the content of 2 registers which
depends on the status of the plane, in addition to reload the scaler
conversion matrix at the same time.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Maxime Jourdan <mjourdan@baylibre.com>
Reviewed-by: Maxime Jourdan <mjourdan@baylibre.com>
[narmstrong: fixed typo in commit log]
Link: https://patchwork.freedesktop.org/patch/msgid/20181128100734.6536-1-narmstrong@baylibre.com
5 years agodrm/v3d: Fix prime imports of buffers from other drivers.
Eric Anholt [Wed, 28 Nov 2018 23:09:27 +0000 (15:09 -0800)]
drm/v3d: Fix prime imports of buffers from other drivers.

v3d_bo_get_pages() checks this to decide to map the imported buffer
instead of the backing shmem file.  The caller was about to set this
value anyway, and there's no error path in between.  Ideally we
wouldn't even allocate the shmem file for our imports, but that's a
more invasive fix.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Link: https://patchwork.freedesktop.org/patch/msgid/20181128230927.10951-3-eric@anholt.net
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Dave Emett <david.emett@broadcom.com>
5 years agodrm/v3d: Drop the "dev" argument to lock/unlock of BO reservations.
Eric Anholt [Wed, 28 Nov 2018 23:09:26 +0000 (15:09 -0800)]
drm/v3d: Drop the "dev" argument to lock/unlock of BO reservations.

They were unused, as Dave Emett noticed in TFU review.

Signed-off-by: Eric Anholt <eric@anholt.net>
Cc: Dave Emett <david.emett@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181128230927.10951-2-eric@anholt.net
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
5 years agodrm/v3d: Add support for submitting jobs to the TFU.
Eric Anholt [Wed, 28 Nov 2018 23:09:25 +0000 (15:09 -0800)]
drm/v3d: Add support for submitting jobs to the TFU.

The TFU can copy from raster, UIF, and SAND input images to UIF output
images, with optional mipmap generation.  This will certainly be
useful for media EGL image input, but is also useful immediately for
mipmap generation without bogging the V3D core down.

For now we only run the queue 1 job deep, and don't have any hang
recovery (though I don't think we should need it, with TFU).  Queuing
multiple jobs in the HW will require synchronizing the YUV coefficient
regs updates since they don't get FIFOed with the job.

v2: Change the ioctl to IOW instead of IOWR, always set COEF0, explain
    why TFU is AUTH, clarify the syncing docs, drop the unused TFU
    interrupt regs (you're expected to use the hub's), don't take
    &bo->base for NULL bos.
v3: Fix a little whitespace alignment (noticed by checkpatch), rebase
    on drm_sched_job_cleanup() changes.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Emett <david.emett@broadcom.com> (v2)
Link: https://patchwork.freedesktop.org/patch/264607/
5 years agodrm: Fix up drm_atomic_state_helper.[hc] extraction
Daniel Vetter [Wed, 28 Nov 2018 10:07:28 +0000 (11:07 +0100)]
drm: Fix up drm_atomic_state_helper.[hc] extraction

I've misplaced two functions by accident:
- drm_atomic_helper_duplicate_state is really part of the
  resume/suspend/shutdown device-wide helpers.
- drm_atomic_helper_legacy_gamma_set is part of the legacy ioctl
  compat helpers.

Move them both back.

Fixes: 9ef8a9dc4b21 ("drm: Extract drm_atomic_state_helper.[hc]")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181128100728.4674-1-daniel.vetter@ffwll.ch
5 years agodrm: Fix compiler warning in drm_atomic_helper.c
Sean Paul [Thu, 29 Nov 2018 20:36:48 +0000 (15:36 -0500)]
drm: Fix compiler warning in drm_atomic_helper.c

Kbuild was complaining about:
>> drivers/gpu/drm/drm_atomic_helper.c:3169:27: warning: 'state' may be used uninitialized in this function [-Wmaybe-uninitialized]

Now state can't actually be used uninitialized, but we'll assign a value
anyways so it stops bellyaching.

Kbuild config:
link: https://lists.01.org/pipermail/kbuild-all/2018-November/055374.html
tree:   git://anongit.freedesktop.org/drm/drm-misc for-linux-next
head:   b7ea04d299c78b6cf96ab281a1683ff62a74f969
commit: b7ea04d299c78b6cf96ab281a1683ff62a74f969 [4/4] drm: Add
DRM_MODESET_LOCK_BEGIN/END helpers
config: x86_64-randconfig-x017-201847 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
git checkout b7ea04d299c78b6cf96ab281a1683ff62a74f969
# save the attached .config to linux build tree
make ARCH=x86_64

Fixes: b7ea04d299c7 ("drm: Add DRM_MODESET_LOCK_BEGIN/END helpers")
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
[seanpaul added extra details on airlied's suggestion]
Link: https://patchwork.freedesktop.org/patch/msgid/20181129203652.223634-1-sean@poorly.run
5 years agoMerge drm/drm-next into drm-misc-next
Sean Paul [Fri, 30 Nov 2018 13:47:01 +0000 (08:47 -0500)]
Merge drm/drm-next into drm-misc-next

Need to pick up the following patch to fix htmldocs build

167bfe534dc2 ("Documentation: drm: Remove dangling pointer from drm-mm.rst")

Signed-off-by: Sean Paul <seanpaul@chromium.org>
5 years agodrm/vc4: Allow YUV formats on cursor planes
Boris Brezillon [Fri, 30 Nov 2018 09:02:54 +0000 (10:02 +0100)]
drm/vc4: Allow YUV formats on cursor planes

Now that scaling is allowed on cursor planes, we can also allow YUV
formats.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130090254.594-6-boris.brezillon@bootlin.com
5 years agodrm/vc4: Allow scaling on cursor plane
Boris Brezillon [Fri, 30 Nov 2018 09:02:53 +0000 (10:02 +0100)]
drm/vc4: Allow scaling on cursor plane

Now that async update has been reworked to allow scaled planes to be
updated asynchronously when the scaling params do not change, we can
remove the NO_SCALING constraint on cursor planes.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130090254.594-5-boris.brezillon@bootlin.com
5 years agodrm/vc4: Rework the async update logic
Boris Brezillon [Fri, 30 Nov 2018 09:02:52 +0000 (10:02 +0100)]
drm/vc4: Rework the async update logic

vc4_plane_atomic_async_check() was only based on the
state->{crtc,src}_{w,h} which was fine since scaling was not allowed on
the cursor plane.

We are about to change that to properly support underscan, and, in order
to make the async check more reliable, we call vc4_plane_mode_set()
from there and check that only the pos0, pos2 and ptr0 entries in the
dlist have changed.

In vc4_plane_atomic_async_update(), we no longer call
vc4_plane_atomic_check() since vc4_plane_mode_set() has already been
called in vc4_plane_atomic_async_check(), and we don't need to allocate
a new LBM region (we reuse the one from the current state).

Note that we now have to manually update each field of the current
plane state since it's no longer updated in place (not sure we have
to sync all of them, but it's harmless if we do).
We also drop the vc4_plane_async_set_fb() call (ptr0 dlist entry has
been properly updated in vc4_plane_mode_set())

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130090254.594-4-boris.brezillon@bootlin.com
5 years agodrm/vc4: Don't check plane state more than once
Boris Brezillon [Fri, 30 Nov 2018 09:02:51 +0000 (10:02 +0100)]
drm/vc4: Don't check plane state more than once

We are about to use vc4_plane_mode_set() in the async check path, but
async check can decide that async update is not possible and force the
driver to fallback to a sync update.

All the checks that have been done on the plane state during async check
stay valid, and checking it again is not necessary. Add a ->checked
field to vc4_plane_state, and use it to track the status of the state
(checked or not).

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130090254.594-3-boris.brezillon@bootlin.com
5 years agodrm/vc4: Move LBM creation out of vc4_plane_mode_set()
Boris Brezillon [Fri, 30 Nov 2018 09:02:50 +0000 (10:02 +0100)]
drm/vc4: Move LBM creation out of vc4_plane_mode_set()

We are about to use vc4_plane_mode_set() in the async check path, and
async updates require that LBM size stay the same since they reuse the
LBM from the previous state. So we definitely don't want to allocate a
new LBM region that we know for sure will be free right away.

Move the LBM allocation out of vc4_plane_mode_set() and call the new
function (vc4_plane_update_lbm()) from vc4_plane_atomic_check().

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130090254.594-2-boris.brezillon@bootlin.com
5 years agodrm/vc4: Make vc4_lbm_size() return 0 when vertical scaling is disabled
Boris Brezillon [Fri, 30 Nov 2018 09:02:49 +0000 (10:02 +0100)]
drm/vc4: Make vc4_lbm_size() return 0 when vertical scaling is disabled

LBM is not needed when vertical scaling is disabled. Return 0 in this
case to avoid allocating LBM memory that will anyway be unused.

While at it, drop the test on ->is_unity which is now redundant.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130090254.594-1-boris.brezillon@bootlin.com
5 years agoDocumentation: drm: Remove dangling pointer from drm-mm.rst
Sean Paul [Thu, 29 Nov 2018 15:55:17 +0000 (10:55 -0500)]
Documentation: drm: Remove dangling pointer from drm-mm.rst

Fixes htmldocs build error:
Error: Cannot open file ../drivers/gpu/drm/drm_global.c

Fixes: 2bb42410b1bd ("drm: Remove drm_global.{c,h} v2")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Christian König <christian.koenig@amd.com>
Cc: Junwei Zhang <Jerry.Zhang@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129155522.33749-1-sean@poorly.run
5 years agodrm: TODO: Add DRM_MODESET_LOCK_ALL* conversion to todo.rst
Sean Paul [Thu, 29 Nov 2018 19:58:33 +0000 (14:58 -0500)]
drm: TODO: Add DRM_MODESET_LOCK_ALL* conversion to todo.rst

We should also get the drivers using the helpers. Seems like a good
intermediate TODO item.

Changes in v2:
- Add line about replacing drm_modest_lock_all() (Daniel)

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129195838.222031-1-sean@poorly.run
5 years agodrm: Add DRM_MODESET_LOCK_BEGIN/END helpers
Sean Paul [Thu, 29 Nov 2018 15:04:17 +0000 (10:04 -0500)]
drm: Add DRM_MODESET_LOCK_BEGIN/END helpers

This patch adds a couple of helpers to remove the boilerplate involved
in grabbing all of the modeset locks.

I've also converted the obvious cases in drm core to use the helpers.

The only remaining instance of drm_modeset_lock_all_ctx() is in
drm_framebuffer. It's complicated by the state clear that occurs on
deadlock. ATM, there's no way to inject code in the deadlock path with
the helpers, so it's unfit for conversion.

Changes in v2:
- Relocate ret argument to the end of the list (Daniel)
- Incorporate Daniel's doc suggestions (Daniel)

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-4-sean@poorly.run
5 years agodrm: Move atomic_state_put after locks are dropped
Sean Paul [Thu, 29 Nov 2018 15:04:16 +0000 (10:04 -0500)]
drm: Move atomic_state_put after locks are dropped

drm_atomic_state_put doesn't require any locking, and this makes things
easier for switching to modeset_lock_all helpers in a future patch

Changes in v2:
- Moved state->acquire_ctx clear to a separate patch (Daniel)

Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-3-sean@poorly.run
5 years agodrm: Move drm_mode_setcrtc() local re-init to failure path
Sean Paul [Thu, 29 Nov 2018 15:04:15 +0000 (10:04 -0500)]
drm: Move drm_mode_setcrtc() local re-init to failure path

Instead of always re-initializing the variables we need to clean up on
out, move the re-initialization into the branch that goes back to retry
label.

This is a lateral move right now, but will allow us to pull out the
modeset locking into common code. I kept this change separate to make
things easier to review.

Changes in v2:
- None

Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-2-sean@poorly.run
5 years agodrm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state()
Sean Paul [Thu, 29 Nov 2018 15:04:14 +0000 (10:04 -0500)]
drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state()

drm_atomic_helper_commit_duplicated_state() sets state->acquire_ctx to
the context given in the argument and leaves it in state after it
quits. The lifetime of state and context are not guaranteed to be the
same, so we shouldn't leave that pointer hanging around. This patch
resets the context to NULL to avoid any oopses.

Changes in v2:
- Added to the set

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-1-sean@poorly.run
5 years agodrm/rcar-du: Use drm_fbdev_generic_setup()
Noralf Trønnes [Wed, 28 Nov 2018 21:27:11 +0000 (22:27 +0100)]
drm/rcar-du: Use drm_fbdev_generic_setup()

The CMA helper is already using the drm_fb_helper_generic_probe part of
the generic fbdev emulation. This patch makes full use of the generic
fbdev emulation by using its drm_client callbacks. This means that
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
now handled by the emulation code. Additionally fbdev unregister happens
automatically on drm_dev_unregister().

The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
driver. This is done to highlight the fact that fbdev emulation is an
internal client that makes use of the driver, it is not part of the
driver as such. If fbdev setup fails, an error is printed, but the driver
succeeds probing.

drm_fbdev_generic_setup() handles mode_config.num_connector being zero.
In that case it retries fbdev setup on the next .output_poll_changed.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181128212713.43500-4-noralf@tronnes.org
5 years agoMerge remote-tracking branch 'drm/drm-next' into drm-misc-next
Maarten Lankhorst [Thu, 29 Nov 2018 15:12:27 +0000 (16:12 +0100)]
Merge remote-tracking branch 'drm/drm-next' into drm-misc-next

Requested by Boris Brezillon for some vc4 fixes that are needed for future vc4 work.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
5 years agodrm/virtio: virtio_gpu_cmd_resource_create_3d: drop unused fence arg
Gerd Hoffmann [Wed, 28 Nov 2018 15:10:21 +0000 (16:10 +0100)]
drm/virtio: virtio_gpu_cmd_resource_create_3d: drop unused fence arg

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181128151021.29565-3-kraxel@redhat.com
5 years agodrm/virtio: fence: pass plain pointer
Gerd Hoffmann [Wed, 28 Nov 2018 15:10:20 +0000 (16:10 +0100)]
drm/virtio: fence: pass plain pointer

Since commit "9fdd90c0f4 drm/virtio: add virtio_gpu_alloc_fence()"
fences are not allocated any more by virtio_gpu_fence_emit().  So there
is no need to pass down a reference to the fence pointer, a plain
pointer is enough now.

Convert virtio_gpu_fence_emit() and callers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181128151021.29565-2-kraxel@redhat.com
5 years agodrm/vkms: Fix plane duplicate_state
Daniel Vetter [Wed, 28 Nov 2018 10:10:33 +0000 (11:10 +0100)]
drm/vkms: Fix plane duplicate_state

We need to handle allocation failures and bail out. While at it, tune
the allocation failures down to debug level.

syzbot injected an allocation failure and then hit this WARN_ON.

Reported-by: syzbot+eb6e5365f23c02517dda@syzkaller.appspotmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181128101033.4840-1-daniel.vetter@ffwll.ch
5 years agoMerge v4.20-rc4 into drm-next
Dave Airlie [Thu, 29 Nov 2018 00:34:03 +0000 (10:34 +1000)]
Merge v4.20-rc4 into drm-next

Requested by Boris Brezillon for some vc4 fixes that are needed for future vc4 work.

Signed-off-by: Dave Airlie <airlied@redhat.com>