openwrt/staging/blogic.git
5 years agodrm: Rename HDMI colorspace property creation function
Gwan-gyeong Mun [Thu, 19 Sep 2019 19:53:06 +0000 (22:53 +0300)]
drm: Rename HDMI colorspace property creation function

As between HDMI and DP have different colorspaces, in order to distinguish
colorspace of DP and HDMI, it renames drm_mode_create_colorspace_property()
function to drm_mode_create_hdmi_colorspace_property() function for HDMI
connector.
In order to apply changed drm api, i915 driver has channged.

It addresses review comments from Ville.
 - Split hunk into renaming and adding of code.

Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190919195311.13972-4-gwan-gyeong.mun@intel.com
5 years agodrm/v3d: clean caches at the end of render jobs on request from user space
Iago Toral Quiroga [Thu, 19 Sep 2019 07:10:16 +0000 (09:10 +0200)]
drm/v3d: clean caches at the end of render jobs on request from user space

Extends the user space ioctl for CL submissions so it can include a request
to flush the cache once the CL execution has completed. Fixes memory
write violation messages reported by the kernel in workloads involving
shader memory writes (SSBOs, shader images, scratch, etc) which sometimes
also lead to GPU resets during Piglit and CTS workloads.

v2: if v3d_job_init() fails we need to kfree() the job instead of
    v3d_job_put() it (Eric Anholt).

v3 (Eric Anholt):
  - Drop _FLAG suffix from the new flag name.
  - Add a new param so userspace can tell whether cache flushing is
    implemented in the kernel.

Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190919071016.4578-1-itoral@igalia.com
5 years agodrm/edid: Add CTA-861-G modes with VIC < 128
Ville Syrjälä [Thu, 11 Jul 2019 10:32:30 +0000 (13:32 +0300)]
drm/edid: Add CTA-861-G modes with VIC < 128

Fill out our list of cea modes with the new stuff from CTA-861-G.
We only do the modes with VIC < 128 here. Adding the higher
numbered VICs will need some slight code refactoring first.

Cc: Hans Verkuil <hansverk@cisco.com>
Cc: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190711103234.6294-2-ville.syrjala@linux.intel.com
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
5 years agodrm/dp: Add definitons for MSA MISC bits
Ville Syrjälä [Thu, 18 Jul 2019 14:50:42 +0000 (17:50 +0300)]
drm/dp: Add definitons for MSA MISC bits

Add definitions for the MSA (Main Stream Attribute) MISC bits. On
some hardware you can program these directly into a register.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190718145053.25808-2-ville.syrjala@linux.intel.com
Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
5 years agodrm/atomic-helper: Make crtc helper funcs optional
Ville Syrjälä [Mon, 8 Jul 2019 12:53:08 +0000 (15:53 +0300)]
drm/atomic-helper: Make crtc helper funcs optional

Allow drivers to call drm_atomic_helper_check_modeset() without
having the crtc helper funcs specified. i915 doesn't need those
anymore.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190708125325.16576-3-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
5 years agodrm: Add drm_modeset_lock_assert_held()
Ville Syrjälä [Mon, 8 Jul 2019 12:53:07 +0000 (15:53 +0300)]
drm: Add drm_modeset_lock_assert_held()

Add a small wrapper around lockdep_assert_held() to make
it a bit more conventinet to use with modeset locks.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190708125325.16576-2-ville.syrjala@linux.intel.com
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
5 years agodrm/v3d: don't leak bin job if v3d_job_init fails.
Iago Toral Quiroga [Mon, 16 Sep 2019 07:11:25 +0000 (09:11 +0200)]
drm/v3d: don't leak bin job if v3d_job_init fails.

If the initialization of the job fails we need to kfree() it
before returning.

Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190916071125.5255-1-itoral@igalia.com
Fixes: a783a09ee76d ("drm/v3d: Refactor job management.")
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agodrm/doc: Improve docs around connector (un)registration
Daniel Vetter [Tue, 17 Sep 2019 12:09:36 +0000 (14:09 +0200)]
drm/doc: Improve docs around connector (un)registration

Current code is quite a mess unfortunately, so also add a todo.rst
entry to maybe fix it up eventually.

Cc: Michel Dänzer <michel@daenzer.net>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190917120936.7501-2-daniel.vetter@ffwll.ch
5 years agodrm/komeda: Adds register dump support for gcu, lup and dou
Lowry Li (Arm Technology China) [Tue, 17 Sep 2019 11:25:44 +0000 (11:25 +0000)]
drm/komeda: Adds register dump support for gcu, lup and dou

Adds to support register dump on lpu and dou of pipeline and gcu on D71

Changes since v1:
- For a constant format without additional arguments, use seq_puts()
instead of seq_printf().

Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com>
Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190917112525.25490-1-lowry.li@arm.com
5 years agodrm/komeda: Remove in-code use of ifdef
Mihail Atanassov [Tue, 17 Sep 2019 15:05:08 +0000 (15:05 +0000)]
drm/komeda: Remove in-code use of ifdef

Provide a dummy static inline function in the header instead.

Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Lowry Li (Arm Technology China) <Lowry.Li@arm.com>
Cc: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
Fixes: 4d74b25ee395 ("drm/komeda: Adds error event print functionality")
Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190917150314.20892-1-mihail.atanassov@arm.com
5 years agodrm/encoder: Don't raise voice in drm_encoder_mask() documentation
Lyude Paul [Fri, 13 Sep 2019 22:27:03 +0000 (18:27 -0400)]
drm/encoder: Don't raise voice in drm_encoder_mask() documentation

There's no need to raise our voice when saying encoder, we're all
civilized adults here!

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190913222704.8241-4-lyude@redhat.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
5 years agodrm/encoder: Fix possible_crtcs documentation
Lyude Paul [Fri, 13 Sep 2019 22:27:02 +0000 (18:27 -0400)]
drm/encoder: Fix possible_crtcs documentation

Similar to possible_clones, we don't actually use possible_crtcs until
the driver is registered with userspace. So, fix the documentation to
indicate this.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190913222704.8241-3-lyude@redhat.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
5 years agodrm/encoder: Fix possible_clones documentation
Lyude Paul [Fri, 13 Sep 2019 22:27:01 +0000 (18:27 -0400)]
drm/encoder: Fix possible_clones documentation

We say that all of the bits in possible_clones must be set before
calling drm_encoder_init(). This isn't true though, since:

* The driver may not even have all of the encoder objects that could be
  used as clones initialized at that point
* possible_crtcs isn't used at all outside of userspace, so it's not
  actually needed to initialize it until drm_dev_register()

So, fix it.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190913222704.8241-2-lyude@redhat.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
5 years agodrm/selftests: fix spelling mistake "misssing" -> "missing"
Colin Ian King [Wed, 11 Sep 2019 09:12:27 +0000 (10:12 +0100)]
drm/selftests: fix spelling mistake "misssing" -> "missing"

There is a spelling mistake in a literal string, fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911091227.5710-1-colin.king@canonical.com
5 years agostaging: fbtft: make several arrays static const, makes object smaller
Colin Ian King [Fri, 6 Sep 2019 15:30:52 +0000 (16:30 +0100)]
staging: fbtft: make several arrays static const, makes object smaller

Don't populate the arrays on the stack but instead make them
static const. Makes the object code smaller by 1329 bytes.

Before:
   text    data     bss     dec     hex filename
   5581    1488      64    7133    1bdd drivers/staging/fbtft/fb_hx8340bn.o
   5444    1264       0    6708    1a34 drivers/staging/fbtft/fb_hx8347d.o
   3581    1360       0    4941    134d drivers/staging/fbtft/fb_ili9163.o
   7154    1552       0    8706    2202 drivers/staging/fbtft/fb_ili9320.o
   7478    2544       0   10022    2726 drivers/staging/fbtft/fb_ili9325.o
   6327    1424       0    7751    1e47 drivers/staging/fbtft/fb_s6d1121.o
   6498    1776       0    8274    2052 drivers/staging/fbtft/fb_ssd1289.o

After:
   text    data     bss     dec     hex filename
   5376    1584      64    7024    1b70 drivers/staging/fbtft/fb_hx8340bn.o
   5276    1328       0    6604    19cc drivers/staging/fbtft/fb_hx8347d.o
   3581    1360       0    4941    134d drivers/staging/fbtft/fb_ili9163.o
   6905    1616       0    8521    2149 drivers/staging/fbtft/fb_ili9320.o
   7229    2608       0    9837    266d drivers/staging/fbtft/fb_ili9325.o
   6030    1488       0    7518    1d5e drivers/staging/fbtft/fb_s6d1121.o
   6249    1872       0    8121    1fb9 drivers/staging/fbtft/fb_ssd1289.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906153052.31846-1-colin.king@canonical.com
5 years agodrm/mgag200: Use drm_gem_vram_{vmap, vunmap}() to map cursor source BO
Thomas Zimmermann [Wed, 11 Sep 2019 12:03:52 +0000 (14:03 +0200)]
drm/mgag200: Use drm_gem_vram_{vmap, vunmap}() to map cursor source BO

The VRAM helper's vmap interfaces provide pinning and mapping of BO
memory. This patch replaces the respective code in mgag200 cursor handling.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911120352.20084-4-tzimmermann@suse.de
5 years agodrm/ast: Use drm_gem_vram_{vmap,vunmap}() to map cursor source BO
Thomas Zimmermann [Wed, 11 Sep 2019 12:03:51 +0000 (14:03 +0200)]
drm/ast: Use drm_gem_vram_{vmap,vunmap}() to map cursor source BO

The VRAM helper's vmap interfaces provide pinning and mapping of BO
memory. This patch replaces the respective code in ast cursor handling.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911120352.20084-3-tzimmermann@suse.de
5 years agodrm/vram: Provide vmap and vunmap operations for GEM VRAM objects
Thomas Zimmermann [Wed, 11 Sep 2019 12:03:50 +0000 (14:03 +0200)]
drm/vram: Provide vmap and vunmap operations for GEM VRAM objects

The implementation of vmap and vunmap for GEM VRAM helpers is
already in PRIME helpers. The patch moves the operations to separate
functions and exports them for general use.

v3:
* remove v2's obsolete note on ref-counting
v2:
* fix documentation
* add cross references to function documentation
* document (the lack of) ref-counting for GEM VRAM BO mappings

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911120352.20084-2-tzimmermann@suse.de
5 years agodrm/komeda: Adds error event print functionality
Lowry Li (Arm Technology China) [Fri, 2 Aug 2019 09:43:10 +0000 (09:43 +0000)]
drm/komeda: Adds error event print functionality

Adds to print the event message when error happens and the same event
will not be printed until next vsync.

Changes since v2:
1. Refine komeda_sprintf();
2. Not using STR_SZ macro for the string size in komeda_print_events().

Changes since v1:
1. Handling the event print by CONFIG_KOMEDA_ERROR_PRINT;
2. Changing the max string size to 256.

Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com>
Reviewed-by: Mihail Atanassov <mihail.atanassov@arm.com>
Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1564738954-6101-1-git-send-email-lowry.li@arm.com
5 years agodrm/connector: Allow max possible encoders to attach to a connector
José Roberto de Souza [Fri, 13 Sep 2019 23:28:57 +0000 (16:28 -0700)]
drm/connector: Allow max possible encoders to attach to a connector

Currently we restrict the number of encoders that can be linked to
a connector to 3, increase it to match the maximum number of encoders
that can be initialized(32).

To more effiently do that lets switch from an array of encoder ids to
bitmask.

v2: Fixing missed return on amdgpu_dm_connector_to_encoder()

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190913232857.389834-2-jose.souza@intel.com
5 years agodrm/connector: Share with non-atomic drivers the function to get the single encoder
José Roberto de Souza [Fri, 13 Sep 2019 23:28:56 +0000 (16:28 -0700)]
drm/connector: Share with non-atomic drivers the function to get the single encoder

This 3 non-atomic drivers all have the same function getting the
only encoder available in the connector, also atomic drivers have
this fallback. So moving it a common place and sharing between atomic
and non-atomic drivers.

While at it I also removed the mention of
drm_atomic_helper_best_encoder() that was renamed in
commit 297e30b5d9b6 ("drm/atomic-helper: Unexport
drm_atomic_helper_best_encoder").

v3: moving drm_connector_get_single_encoder to drm_kms_helper module

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190913232857.389834-1-jose.souza@intel.com
5 years agodrm/prime: Remove duplicate forward declaration
Thierry Reding [Thu, 11 Jan 2018 20:17:30 +0000 (21:17 +0100)]
drm/prime: Remove duplicate forward declaration

struct device is forward-declared twice. Remove the second instance.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180111201730.30708-1-thierry.reding@gmail.com
5 years agodrm: fix warnings in DSC
Benjamin Gaignard [Wed, 11 Sep 2019 08:47:59 +0000 (10:47 +0200)]
drm: fix warnings in DSC

Remove always false comparisons due to limited range of nfl_bpg_offset
and scale_increment_interval fields.
Warnings detected when compiling with W=1.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911084759.6946-1-benjamin.gaignard@st.com
5 years agodrm: sti: fix W=1 warnings
Benjamin Gaignard [Mon, 9 Sep 2019 10:12:53 +0000 (12:12 +0200)]
drm: sti: fix W=1 warnings

Fix warnings when W=1.
No code changes, only clean up in sti internal structures and functions
descriptions.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190909101254.24191-1-benjamin.gaignard@st.com
5 years agodrm/stm: dsi: higher pll out only in video burst mode
Yannick Fertré [Thu, 12 Sep 2019 08:56:29 +0000 (10:56 +0200)]
drm/stm: dsi: higher pll out only in video burst mode

In order to better support video non-burst modes,
the +20% on pll out is added only in burst mode.

Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-by: Yannick Fertré <yannick.fertre@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1568278589-20400-1-git-send-email-yannick.fertre@st.com
5 years agodrm/bridge: analogix-anx78xx: convert to i2c_new_dummy_device
Brian Masney [Thu, 15 Aug 2019 00:48:47 +0000 (20:48 -0400)]
drm/bridge: analogix-anx78xx: convert to i2c_new_dummy_device

The i2c_new_dummy() function is deprecated since it returns NULL on
error. Change this to use the recommended replacement
i2c_new_dummy_device() that returns an error code that can be read with
PTR_ERR() and friends.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190815004854.19860-5-masneyb@onstation.org
5 years agodrm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings
Brian Masney [Thu, 15 Aug 2019 00:48:46 +0000 (20:48 -0400)]
drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings

Silence two warning messages that occur due to -EPROBE_DEFER errors to
help cleanup the system boot log.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190815004854.19860-4-masneyb@onstation.org
5 years agodrm/bridge: analogix-anx78xx: add new variants
Brian Masney [Thu, 15 Aug 2019 00:48:45 +0000 (20:48 -0400)]
drm/bridge: analogix-anx78xx: add new variants

Add support for the 7808 variant. While we're here, the of match table
was missing support for the 7812 and 7818 variants, so add them as well.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190815004854.19860-3-masneyb@onstation.org
5 years agodt-bindings: drm/bridge: analogix-anx78xx: add new variants
Brian Masney [Thu, 15 Aug 2019 00:48:44 +0000 (20:48 -0400)]
dt-bindings: drm/bridge: analogix-anx78xx: add new variants

Add support for the analogix,anx7808, analogix,anx7812, and
analogix,anx7818 variants.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190815004854.19860-2-masneyb@onstation.org
5 years agodrm/bridge: Fix references to drm_bridge_funcs in documentation
Laurent Pinchart [Wed, 21 Aug 2019 23:55:02 +0000 (02:55 +0300)]
drm/bridge: Fix references to drm_bridge_funcs in documentation

The documentation for most of the bridge atomic operations incorrectly
reference the non-atomic version when stating the operations are
optional. Fix them, and make sure that all references to bridge
operations are correctly marked with @.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190821235502.15475-1-laurent.pinchart+renesas@ideasonboard.com
5 years agodrm: bridge/dw_hdmi: add audio sample channel status setting
Yakir Yang [Wed, 11 Sep 2019 08:26:46 +0000 (16:26 +0800)]
drm: bridge/dw_hdmi: add audio sample channel status setting

When transmitting IEC60985 linear PCM audio, we configure the
Aduio Sample Channel Status information in the IEC60958 frame.
The status bit is already available in iec.status of hdmi_codec_params.

This fix the issue that audio does not come out on some monitors
(e.g. LG 22CV241)

Note that these registers are only for interfaces:
I2S audio interface, General Purpose Audio (GPA), or AHB audio DMA
(AHBAUDDMA).
For S/PDIF interface this information comes from the stream.

Currently this function dw_hdmi_set_channel_status is only called
from dw-hdmi-i2s-audio in I2S setup.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911082646.134347-1-cychiang@chromium.org
5 years agodrm/virtio: Fix warning in virtio_gpu_queue_fenced_ctrl_buffer.
David Riley [Thu, 12 Sep 2019 16:00:48 +0000 (09:00 -0700)]
drm/virtio: Fix warning in virtio_gpu_queue_fenced_ctrl_buffer.

Fix warning introduced with commit e1218b8c0cc1
("drm/virtio: Use vmalloc for command buffer allocations.")
from drm-misc-next.

Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190912160048.212495-1-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/virtio: enable prime mmap support
Gerd Hoffmann [Thu, 12 Sep 2019 11:46:27 +0000 (13:46 +0200)]
drm/virtio: enable prime mmap support

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190912114627.20176-1-kraxel@redhat.com
5 years agodrm/vram: Unconditonally set BO call-back functions
Thomas Zimmermann [Wed, 11 Sep 2019 11:09:10 +0000 (13:09 +0200)]
drm/vram: Unconditonally set BO call-back functions

The statement's condition is always true.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911110910.30698-5-tzimmermann@suse.de
5 years agodrm/vram: Unexport internal functions of VRAM MM
Thomas Zimmermann [Wed, 11 Sep 2019 11:09:09 +0000 (13:09 +0200)]
drm/vram: Unexport internal functions of VRAM MM

The init, cleanup and mmap functions of VRAM MM are only used internally.
Remove them from the public interface.

v2:
* update for debugfs support

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911110910.30698-4-tzimmermann@suse.de
5 years agodrm/vram: Have VRAM MM call GEM VRAM functions directly
Thomas Zimmermann [Wed, 11 Sep 2019 11:09:08 +0000 (13:09 +0200)]
drm/vram: Have VRAM MM call GEM VRAM functions directly

VRAM MM and GEM VRAM buffer objects are only used with each other;
connected via 3 function pointers. Simplify this code by making the
memory manager call the rsp. functions of the BOs directly; and
remove the functions from the BO's public interface.

v2:
* typos in commit message

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911110910.30698-3-tzimmermann@suse.de
5 years agodrm/vram: Move VRAM memory manager to GEM VRAM implementation
Thomas Zimmermann [Wed, 11 Sep 2019 11:09:07 +0000 (13:09 +0200)]
drm/vram: Move VRAM memory manager to GEM VRAM implementation

The separation between GEM VRAM objects and the memory manager is
artificial, as they are only used with each other. Copying both
implementations into the same file is a first step to simplifying
the code.

This patch only moves code without functional changes.

v3:
* update to use dev->vma_offset_manager
v2:
* update for debugfs support
* typos in commit message

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911110910.30698-2-tzimmermann@suse.de
5 years agodrm/virtio: Use vmalloc for command buffer allocations.
David Riley [Wed, 11 Sep 2019 18:14:03 +0000 (11:14 -0700)]
drm/virtio: Use vmalloc for command buffer allocations.

Userspace requested command buffer allocations could be too large
to make as a contiguous allocation.  Use vmalloc if necessary to
satisfy those allocations.

Signed-off-by: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20190911181403.40909-3-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/virtio: Rewrite virtio_gpu_queue_ctrl_buffer using fenced version.
David Riley [Wed, 11 Sep 2019 18:14:02 +0000 (11:14 -0700)]
drm/virtio: Rewrite virtio_gpu_queue_ctrl_buffer using fenced version.

Factor function in preparation to generating scatterlist prior to locking.

Signed-off-by: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20190911181403.40909-2-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodrm/ttm: remove embedded vma_offset_manager
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:09 +0000 (09:05 +0200)]
drm/ttm: remove embedded vma_offset_manager

No users left.  Drivers either setup vma_offset_manager themself
(vmwgfx) or pass the gem vma_offset_manager to ttm_bo_device_init
(all other drivers).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-9-kraxel@redhat.com
5 years agodrm/vmwgfx: switch to own vma manager
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:08 +0000 (09:05 +0200)]
drm/vmwgfx: switch to own vma manager

Add struct drm_vma_offset_manager to vma_private, initialize it and
pass it to ttm_bo_device_init().

With this in place the last user of ttm's embedded vma offset manager
is gone and we can remove it (in a separate patch).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellström <thellstrom@vmware.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-8-kraxel@redhat.com
5 years agodrm/qxl: switch to gem vma offset manager
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:07 +0000 (09:05 +0200)]
drm/qxl: switch to gem vma offset manager

Pass gem vma_offset_manager to ttm_bo_device_init(), so ttm uses it
instead of its own embedded struct.  This makes some gem functions
(specifically drm_gem_object_lookup) work on ttm objects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-7-kraxel@redhat.com
5 years agodrm/amdgpu: switch to gem vma offset manager
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:06 +0000 (09:05 +0200)]
drm/amdgpu: switch to gem vma offset manager

Pass gem vma_offset_manager to ttm_bo_device_init(), so ttm uses it
instead of its own embedded struct.  This makes some gem functions
(specifically drm_gem_object_lookup) work on ttm objects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-6-kraxel@redhat.com
5 years agodrm/radeon: switch to gem vma offset manager
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:05 +0000 (09:05 +0200)]
drm/radeon: switch to gem vma offset manager

Pass gem vma_offset_manager to ttm_bo_device_init(), so ttm uses it
instead of its own embedded struct.  This makes some gem functions
(specifically drm_gem_object_lookup) work on ttm objects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-5-kraxel@redhat.com
5 years agodrm/vram: switch to gem vma offset manager
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:04 +0000 (09:05 +0200)]
drm/vram: switch to gem vma offset manager

Pass gem vma_offset_manager to ttm_bo_device_init(), so ttm uses it
instead of its own embedded struct.  This makes some gem functions
(specifically drm_gem_object_lookup) work on ttm objects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-4-kraxel@redhat.com
5 years agodrm/nouveau: switch to gem vma offset manager
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:03 +0000 (09:05 +0200)]
drm/nouveau: switch to gem vma offset manager

Pass gem vma_offset_manager to ttm_bo_device_init(), so ttm uses it
instead of its own embedded struct.  This makes some gem functions
(specifically drm_gem_object_lookup) work on ttm objects.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-3-kraxel@redhat.com
5 years agodrm/ttm: turn ttm_bo_device.vma_manager into a pointer
Gerd Hoffmann [Thu, 5 Sep 2019 07:05:02 +0000 (09:05 +0200)]
drm/ttm: turn ttm_bo_device.vma_manager into a pointer

Rename the embedded struct vma_offset_manager, new name is _vma_manager.
ttm_bo_device.vma_manager changed to a pointer.

The ttm_bo_device_init() function gets an additional vma_manager
argument which allows to initialize ttm with a different vma manager.
When passing NULL the embedded _vma_manager is used.

All callers are updated to pass NULL, so the behavior doesn't change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-2-kraxel@redhat.com
5 years agodrm/vram: fix Kconfig
Gerd Hoffmann [Wed, 4 Sep 2019 05:47:40 +0000 (07:47 +0200)]
drm/vram: fix Kconfig

select isn't recursive, so we can't turn on DRM_TTM + DRM_TTM_HELPER
in config DRM_VRAM_HELPER, we have to select them on the vram users
instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904054740.20817-8-kraxel@redhat.com
5 years agodrm/qxl: use drm_gem_ttm_print_info
Gerd Hoffmann [Wed, 4 Sep 2019 05:47:39 +0000 (07:47 +0200)]
drm/qxl: use drm_gem_ttm_print_info

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904054740.20817-7-kraxel@redhat.com
5 years agodrm/qxl: use drm_gem_object_funcs callbacks
Gerd Hoffmann [Wed, 4 Sep 2019 05:47:38 +0000 (07:47 +0200)]
drm/qxl: use drm_gem_object_funcs callbacks

Switch qxl to use drm_gem_object_funcs callbacks
instead of drm_driver callbacks.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904054740.20817-6-kraxel@redhat.com
5 years agodrm/vram: add vram-mm debugfs file
Gerd Hoffmann [Wed, 4 Sep 2019 05:47:37 +0000 (07:47 +0200)]
drm/vram: add vram-mm debugfs file

Wire up drm_mm_print() for vram helpers, using a new
debugfs file, so one can see how vram is used:

   # cat /sys/kernel/debug/dri/0/vram-mm
   0x0000000000000000-0x0000000000000300: 768: used
   0x0000000000000300-0x0000000000000600: 768: used
   0x0000000000000600-0x0000000000000900: 768: used
   0x0000000000000900-0x0000000000000c00: 768: used
   0x0000000000000c00-0x0000000000004000: 13312: free
   total: 16384, used 3072 free 13312

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904054740.20817-5-kraxel@redhat.com
5 years agodrm/vram: use drm_gem_ttm_print_info
Gerd Hoffmann [Wed, 4 Sep 2019 05:47:36 +0000 (07:47 +0200)]
drm/vram: use drm_gem_ttm_print_info

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904054740.20817-4-kraxel@redhat.com
5 years agodrm/ttm: add drm gem ttm helpers, starting with drm_gem_ttm_print_info()
Gerd Hoffmann [Wed, 4 Sep 2019 05:47:35 +0000 (07:47 +0200)]
drm/ttm: add drm gem ttm helpers, starting with drm_gem_ttm_print_info()

Now with ttm_buffer_object being a subclass of drm_gem_object we can
easily lookup ttm_buffer_object for a given drm_gem_object, which in
turn allows to create common helper functions.

This patch starts off with a drm_gem_ttm_print_info() helper function
which adds some ttm specific lines to the debug output.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904054740.20817-3-kraxel@redhat.com
5 years agodrm: add drm_print_bits
Gerd Hoffmann [Wed, 4 Sep 2019 05:47:34 +0000 (07:47 +0200)]
drm: add drm_print_bits

New helper to print named bits of some value (think flags fields).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904054740.20817-2-kraxel@redhat.com
5 years agodrm/vram: Implement lazy unmapping for GEM VRAM buffers
Thomas Zimmermann [Fri, 6 Sep 2019 12:20:56 +0000 (14:20 +0200)]
drm/vram: Implement lazy unmapping for GEM VRAM buffers

Frequent mapping and unmapping a buffer object adds overhead for
modifying the page table and creates debug output. Unmapping a buffer
is only required when the memory manager evicts the buffer from its
current location.

v4:
* WARN_ON if buffer is still mapped during BO cleanup

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reported-and-tested-by: Davidlohr Bueso <dbueso@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906122056.32018-5-tzimmermann@suse.de
5 years agodrm/vram: Add infrastructure for move_notify()
Thomas Zimmermann [Fri, 6 Sep 2019 12:20:55 +0000 (14:20 +0200)]
drm/vram: Add infrastructure for move_notify()

This patch prepares VRAM helpers for lazy unmapping of buffer objects.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reported-and-tested-by: Davidlohr Bueso <dbueso@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906122056.32018-4-tzimmermann@suse.de
5 years agodrm/vram: Acquire lock only once per call to vmap()/vunmap()
Thomas Zimmermann [Fri, 6 Sep 2019 12:20:54 +0000 (14:20 +0200)]
drm/vram: Acquire lock only once per call to vmap()/vunmap()

The implementation of vmap() is a combined pin() and kmap(). As both
functions share the same lock, we can make vmap() slightly faster by
acquiring the lock only once for both operations. Same for the inverse,
vunmap().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reported-and-tested-by: Davidlohr Bueso <dbueso@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906122056.32018-3-tzimmermann@suse.de
5 years agodrm/vram: Add kmap ref-counting to GEM VRAM objects
Thomas Zimmermann [Fri, 6 Sep 2019 12:20:53 +0000 (14:20 +0200)]
drm/vram: Add kmap ref-counting to GEM VRAM objects

The kmap and kunmap operations of GEM VRAM buffers can now be called
in interleaving pairs. The first call to drm_gem_vram_kmap() maps the
buffer's memory to kernel address space and the final call to
drm_gem_vram_kunmap() unmaps the memory. Intermediate calls to these
functions increment or decrement a reference counter.

This change allows for keeping buffer memory mapped for longer and
minimizes the amount of changes to TLB, page tables, etc.

v4:
* lock in kmap()/kunmap() with ttm_bo_reserve()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reported-and-tested-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906122056.32018-2-tzimmermann@suse.de
5 years agotda9950: use cec_notifier_cec_adap_(un)register
Dariusz Marcinkiewicz [Wed, 14 Aug 2019 10:45:02 +0000 (12:45 +0200)]
tda9950: use cec_notifier_cec_adap_(un)register

Use the new cec_notifier_cec_adap_(un)register() functions to
(un)register the notifier for the CEC adapter.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://patchwork.freedesktop.org/patch/msgid/20190814104520.6001-5-darekm@google.com
5 years agodrm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register
Dariusz Marcinkiewicz [Wed, 28 Aug 2019 12:34:15 +0000 (14:34 +0200)]
drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register

Use the new cec_notifier_conn_(un)register() functions to
(un)register the notifier for the HDMI connector, and fill in
the cec_connector_info.

Changes since v7:
- err_runtime_disable -> err_rpm_disable
Changes since v2:
- removed unnecessary call to invalidate phys address before
deregistering the notifier,
- use cec_notifier_phys_addr_invalidate instead of setting
invalid address on a notifier.

Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: use 'if (!hdata->notifier)' instead of '== NULL']
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://patchwork.freedesktop.org/patch/msgid/20190828123415.139441-1-darekm@google.com
5 years agodrm/sun4i/sun4i_hdmi_enc: call cec_s_conn_info()
Hans Verkuil [Fri, 23 Aug 2019 11:24:26 +0000 (13:24 +0200)]
drm/sun4i/sun4i_hdmi_enc: call cec_s_conn_info()

Set the connector info for the CEC adapter. This helps
userspace to associate the CEC device with the HDMI connector.

Tested on a Cubieboard.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190823112427.42394-3-hverkuil-cisco@xs4all.nl
5 years agodrm/stm: ltdc: add pinctrl for DPI encoder mode
Yannick Fertré [Fri, 6 Sep 2019 09:21:48 +0000 (11:21 +0200)]
drm/stm: ltdc: add pinctrl for DPI encoder mode

The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.

Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1567761708-31777-1-git-send-email-yannick.fertre@st.com
5 years agodrm/panel: panel-simple: Set OSD070T1718 panel type
Laurent Pinchart [Wed, 4 Sep 2019 13:37:23 +0000 (16:37 +0300)]
drm/panel: panel-simple: Set OSD070T1718 panel type

The OSD070T1718 is a DPI panel, set its type accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190904133723.30418-1-laurent.pinchart@ideasonboard.com
5 years agodrm/bridge: panel: Infer connector type from panel by default
Laurent Pinchart [Wed, 4 Sep 2019 13:28:04 +0000 (16:28 +0300)]
drm/bridge: panel: Infer connector type from panel by default

The drm panel bridge creates a connector using a connector type
explicitly passed by the display controller or bridge driver that
instantiates the panel bridge. Now that drm_panel reports its connector
type, we can use it to avoid passing an explicit (and often incorrect)
connector type to drm_panel_bridge_add() and
devm_drm_panel_bridge_add().

Several drivers report incorrect or unknown connector types to
userspace. Reporting a different type may result in a breakage. For that
reason, rename (devm_)drm_panel_bridge_add() to
(devm_)drm_panel_bridge_add_typed(), and add new
(devm_)drm_panel_bridge_add() functions that use the panel connector
type. Update all callers of (devm_)drm_panel_bridge_add() to the _typed
function, they will be converted one by one after testing.

The panel drivers have been updated with the following Coccinelle
semantic patch, with manual inspection and fixes to indentation.

@@
expression bridge;
expression dev;
expression panel;
identifier type;
@@
(
-bridge = drm_panel_bridge_add(panel, type);
+bridge = drm_panel_bridge_add_typed(panel, type);
|
-bridge = devm_drm_panel_bridge_add(dev, panel, type);
+bridge = devm_drm_panel_bridge_add_typed(dev, panel, type);
)

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190904132804.29680-3-laurent.pinchart@ideasonboard.com
5 years agodrm/panel: Add and fill drm_panel type field
Laurent Pinchart [Wed, 4 Sep 2019 13:28:03 +0000 (16:28 +0300)]
drm/panel: Add and fill drm_panel type field

Add a type field to the drm_panel structure to report the panel type,
using DRM_MODE_CONNECTOR_* macros (the values that make sense are LVDS,
eDP, DSI and DPI). This will be used to initialise the corresponding
connector type.

Update all panel drivers accordingly. The panel-simple driver only
specifies the type for the known to be LVDS panels, while all other
panels are left as unknown and will be converted on a case-by-case
basis as they all need to be carefully reviewed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190904132804.29680-2-laurent.pinchart@ideasonboard.com
5 years agofbdev/sa1100fb: Remove even more dead code
Arnd Bergmann [Fri, 6 Sep 2019 15:13:00 +0000 (17:13 +0200)]
fbdev/sa1100fb: Remove even more dead code

This function lost its only call site as part of
earlier dead code removal, so remove it as well:

drivers/video/fbdev/sa1100fb.c:975:21: error: unused function 'sa1100fb_min_dma_period' [-Werror,-Wunused-function]

Fixes: 390e5de11284 ("fbdev/sa1100fb: Remove dead code")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906151307.1127187-1-arnd@arndb.de
5 years agodrm/blend: Define the direction of Z position values
Daniel Vetter [Fri, 6 Sep 2019 14:44:59 +0000 (16:44 +0200)]
drm/blend: Define the direction of Z position values

We forgot that.

Proof is the one igt testcase we have:

https://gitlab.freedesktop.org/drm/igt-gpu-tools/blob/master/tests/kms_atomic.c#L280

While at it also document that we have immutable zpos properties in
some cases.

Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906144459.16025-1-daniel.vetter@ffwll.ch
5 years agodrm: Use EOPNOTSUPP, not ENOTSUPP
Daniel Vetter [Wed, 4 Sep 2019 14:39:42 +0000 (16:39 +0200)]
drm: Use EOPNOTSUPP, not ENOTSUPP

- it's what we recommend in our docs:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#recommended-ioctl-return-values

- it's the overwhelmingly used error code for "operation not
  supported", at least in drm core (slightly less so in drivers):

$ git grep EOPNOTSUPP -- drivers/gpu/drm/*c | wc -l
83
$ git grep ENOTSUPP -- drivers/gpu/drm/*c | wc -l
5

- include/linux/errno.h makes it fairly clear that these are for nfsv3
  (plus they also have error codes above 512, which is the block with
  some special behaviour ...)

/* Defined for the NFSv3 protocol */

If the above isn't reflecting current practice, then I guess we should
at least update the docs.

Noralf commented:

Ben Hutchings made this comment[1] in a thread about use of ENOTSUPP in
drivers:

  glibc's strerror() returns these strings for ENOTSUPP and EOPNOTSUPP
  respectively:

  "Unknown error 524"
  "Operation not supported"

So at least for errors returned to userspace EOPNOTSUPP makes sense.

José asked:

> Hopefully this will not break any userspace

None of the functions in drm_edid.c affected by this reach userspace,
it's all driver internal.

Same for the mipi function, that error code should be handled by
drivers. Drivers are supposed to remap "the hw is on fire" to EIO when
reporting up to userspace, but I think if a driver sees this it would
be a driver bug.
v2: Augment commit message with comments from Noralf and José

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Andres Rodriguez <andresx7@gmail.com>
Cc: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190904143942.31756-1-daniel.vetter@ffwll.ch
5 years agodrm/virtio: fix command submission with objects but without fence.
Gerd Hoffmann [Wed, 4 Sep 2019 07:48:28 +0000 (09:48 +0200)]
drm/virtio: fix command submission with objects but without fence.

Only call virtio_gpu_array_add_fence if we actually have a fence.

Fixes: da758d51968a ("drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190904074828.32502-1-kraxel@redhat.com
5 years agodrm/virtio: add worker for object release
Gerd Hoffmann [Fri, 30 Aug 2019 06:01:16 +0000 (08:01 +0200)]
drm/virtio: add worker for object release

Move object release into a separate worker.  Releasing objects requires
sending commands to the host.  Doing that in the dequeue worker will
cause deadlocks in case the command queue gets filled up, because the
dequeue worker is also the one which will free up slots in the command
queue.

Reported-by: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Tested-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190830060116.10476-1-kraxel@redhat.com
5 years agodrm/virtio: add fence sanity check
Gerd Hoffmann [Thu, 29 Aug 2019 10:33:01 +0000 (12:33 +0200)]
drm/virtio: add fence sanity check

Make sure we don't leak half-initialized fences outside the driver.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-19-kraxel@redhat.com
5 years agodrm/virtio: drop virtio_gpu_object_{reserve, unreserve}
Gerd Hoffmann [Thu, 29 Aug 2019 10:33:00 +0000 (12:33 +0200)]
drm/virtio: drop virtio_gpu_object_{reserve, unreserve}

No users left.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-18-kraxel@redhat.com
5 years agodrm/virtio: drop virtio_gpu_object_{ref,unref}
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:59 +0000 (12:32 +0200)]
drm/virtio: drop virtio_gpu_object_{ref,unref}

No users left.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-17-kraxel@redhat.com
5 years agodrm/virtio: remove virtio_gpu_alloc_object
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:58 +0000 (12:32 +0200)]
drm/virtio: remove virtio_gpu_alloc_object

Thin wrapper around virtio_gpu_object_create(),
but calling that directly works equally well.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-16-kraxel@redhat.com
5 years agodrm/virtio: switch from ttm to gem shmem helpers
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:57 +0000 (12:32 +0200)]
drm/virtio: switch from ttm to gem shmem helpers

virtio-gpu basically needs a sg_table for the bo, to tell the host where
the backing pages for the object are.  So the gem shmem helpers are a
perfect fit.  Some drm_gem_object_funcs need thin wrappers to update the
host state, but otherwise the helpers handle everything just fine.

Once the fencing was sorted the switch was surprisingly easy and for the
most part just removing the ttm code.

v4: fix drm_gem_object_funcs name.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-15-kraxel@redhat.com
5 years agodrm/virtio: drop virtio_gpu_object_list_validate/virtio_gpu_unref_list
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:56 +0000 (12:32 +0200)]
drm/virtio: drop virtio_gpu_object_list_validate/virtio_gpu_unref_list

No users left.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-14-kraxel@redhat.com
5 years agodrm/virtio: rework virtio_gpu_cmd_context_{attach, detach}_resource
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:55 +0000 (12:32 +0200)]
drm/virtio: rework virtio_gpu_cmd_context_{attach, detach}_resource

Switch to the virtio_gpu_array_* helper workflow.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-13-kraxel@redhat.com
5 years agodrm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:54 +0000 (12:32 +0200)]
drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing

Switch to the virtio_gpu_array_* helper workflow.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-12-kraxel@redhat.com
5 years agodrm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencing
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:53 +0000 (12:32 +0200)]
drm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencing

Switch to the virtio_gpu_array_* helper workflow.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-11-kraxel@redhat.com
5 years agodrm/virtio: rework virtio_gpu_object_create fencing
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:52 +0000 (12:32 +0200)]
drm/virtio: rework virtio_gpu_object_create fencing

Rework fencing workflow.  Stop using ttm helpers, use the
virtio_gpu_array_* helpers instead.

Due to using the gem reservation object it is initialized and ready for
use before calling ttm_bo_init.  So we can simply use the standard
fencing workflow and drop the tricky logic which checks whenever the
command is in flight still.

v6: rewrite most of the patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-10-kraxel@redhat.com
5 years agodrm/virtio: rework virtio_gpu_execbuffer_ioctl fencing
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:51 +0000 (12:32 +0200)]
drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

Rework fencing workflow, starting with virtio_gpu_execbuffer_ioctl.
Stop using ttm helpers, use the virtio_gpu_array_* helpers (which work
on the reservation objects directly) instead.

Also store the object array in struct virtio_gpu_vbuffer, so we
explicitly keep a reference of all buffers used instead of depending
on ttm_bo_put() checking whenever the object is actually idle before
releasing it.

New workflow:

 (1) All gem objects needed by a command are added to a
     virtio_gpu_object_array.
 (2) All reservation objects will be locked (virtio_gpu_array_lock_resv).
 (3) virtio_gpu_fence_emit() completes fence initialization.
 (4) fence gets added to the objects, reservation objects are unlocked
     (virtio_gpu_array_add_fence, virtio_gpu_array_unlock_resv).
 (5) virtio command is submitted to the host.
 (6) The completion callback (virtio_gpu_dequeue_ctrl_func)
     will drop object references and free virtio_gpu_object_array.

v6: rewrite most of the patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-9-kraxel@redhat.com
5 years agodrm/virtio: add virtio_gpu_object_array & helpers
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:50 +0000 (12:32 +0200)]
drm/virtio: add virtio_gpu_object_array & helpers

Some helper functions to manage an array of gem objects.

v9: use dma_resv_lock_interruptible.
v6:
 - add ticket to struct virtio_gpu_object_array.
 - add virtio_gpu_array_{lock,unlock}_resv helpers.
 - add virtio_gpu_array_add_fence helper.
v5: some small optimizations (Chia-I Wu).
v4: make them virtio-private instead of generic helpers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-8-kraxel@redhat.com
5 years agodrm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:49 +0000 (12:32 +0200)]
drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

Call reservation_object_* directly instead
of using ttm_bo_{reserve,unreserve}.

v4: check for EINTR only.
v3: check for EINTR too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-7-kraxel@redhat.com
5 years agodrm/virtio: drop no_wait argument from virtio_gpu_object_reserve
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:48 +0000 (12:32 +0200)]
drm/virtio: drop no_wait argument from virtio_gpu_object_reserve

All callers pass no_wait = false.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-6-kraxel@redhat.com
5 years agodrm/virtio: remove virtio_gpu_object_wait
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:47 +0000 (12:32 +0200)]
drm/virtio: remove virtio_gpu_object_wait

No users left.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-5-kraxel@redhat.com
5 years agodrm/virtio: simplify cursor updates
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:46 +0000 (12:32 +0200)]
drm/virtio: simplify cursor updates

No need to do the reservation dance,
we can just wait on the fence directly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-4-kraxel@redhat.com
5 years agodrm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:45 +0000 (12:32 +0200)]
drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper.

Use drm_gem_reservation_object_wait() in virtio_gpu_wait_ioctl().
This also makes the ioctl run lockless.

v9: fix return value.
v5: handle lookup failure.
v2: use reservation_object_test_signaled_rcu for VIRTGPU_WAIT_NOWAIT.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-3-kraxel@redhat.com
5 years agodrm/virtio: pass gem reservation object to ttm init
Gerd Hoffmann [Thu, 29 Aug 2019 10:32:44 +0000 (12:32 +0200)]
drm/virtio: pass gem reservation object to ttm init

With this gem and ttm will use the same reservation object,
so mixing and matching ttm / gem reservation helpers should
work fine.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190829103301.3539-2-kraxel@redhat.com
5 years agodrm/dp_mst: Cleanup drm_dp_send_link_address() a bit
Lyude Paul [Tue, 3 Sep 2019 20:45:53 +0000 (16:45 -0400)]
drm/dp_mst: Cleanup drm_dp_send_link_address() a bit

Declare local pointer to the drm_dp_link_address_ack_reply struct
instead of constantly dereferencing it through the union in
txmsg->reply. Then, invert the order of conditionals so we don't have to
do the bulk of the work inside them, and can wrap lines even less. Then
finally, rearrange variable declarations a bit.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-16-lyude@redhat.com
5 years agodrm/dp_mst: Refactor drm_dp_mst_handle_down_rep()
Lyude Paul [Tue, 3 Sep 2019 20:45:51 +0000 (16:45 -0400)]
drm/dp_mst: Refactor drm_dp_mst_handle_down_rep()

* Remove the big ugly have_eomt conditional
* Store &mgr->down_rep_recv.initial_hdr in a var to make line wrapping
  easier
* Remove duplicate memset() calls
* Actually wrap lines

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-14-lyude@redhat.com
5 years agodrm/dp_mst: Refactor drm_dp_mst_handle_up_req()
Lyude Paul [Tue, 3 Sep 2019 20:45:50 +0000 (16:45 -0400)]
drm/dp_mst: Refactor drm_dp_mst_handle_up_req()

There's a couple of changes here, so to summarize:

* Remove the big ugly mgr->up_req_recv.have_eomt conditional to save on
  indenting
* Store &mgr->up_req_recv.initial_hdr in a variable so we don't keep
  going over 80 character long lines
* De-duplicate code for calling drm_dp_send_up_ack_reply() and getting
  the MSTB via it's GUID
* Remove all of the duplicate calls to memset() and just use a goto
  instead
* Actually do line wrapping
* Remove the unnecessary if (mstb) check before calling
  drm_dp_mst_topology_put_mstb() - we are guaranteed to always have
  mstb != NULL at that point in the function

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-13-lyude@redhat.com
5 years agodrm/dp_mst: Constify guid in drm_dp_get_mst_branch_by_guid()
Lyude Paul [Tue, 3 Sep 2019 20:45:49 +0000 (16:45 -0400)]
drm/dp_mst: Constify guid in drm_dp_get_mst_branch_by_guid()

And it's helper, we'll be using this in just a moment.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-12-lyude@redhat.com
5 years agodrm/dp_mst: Remove huge conditional in drm_dp_mst_handle_up_req()
Lyude Paul [Tue, 3 Sep 2019 20:45:48 +0000 (16:45 -0400)]
drm/dp_mst: Remove huge conditional in drm_dp_mst_handle_up_req()

Which reduces indentation and makes this function more legible.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-11-lyude@redhat.com
5 years agodrm/dp_mst: Refactor drm_dp_send_enum_path_resources
Lyude Paul [Tue, 3 Sep 2019 20:45:47 +0000 (16:45 -0400)]
drm/dp_mst: Refactor drm_dp_send_enum_path_resources

Use more pointers so we don't have to write out
txmsg->reply.u.path_resources each time. Also, fix line wrapping +
rearrange local variables.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-10-lyude@redhat.com
5 years agodrm/dp_mst: Add sideband down request tracing + selftests
Lyude Paul [Tue, 3 Sep 2019 20:45:45 +0000 (16:45 -0400)]
drm/dp_mst: Add sideband down request tracing + selftests

Unfortunately the DP MST helpers do not have much in the way of
debugging utilities. So, let's add some!

This adds basic debugging output for down sideband requests that we send
from the driver, so that we can actually discern what's happening when
sideband requests timeout.

Since there wasn't really a good way of testing that any of this worked,
I ended up writing simple selftests that lightly test sideband message
encoding and decoding as well. Enjoy!

Changes since v1:
* Clean up DO_TEST() and sideband_msg_req_encode_decode() - danvet
* Get rid of pr_fmt(), just define a prefix string instead and use
  drm_printf()
* Check highest bit of VCPI in drm_dp_decode_sideband_req() - danvet
* Make the switch case order between drm_dp_decode_sideband_req() and
  drm_dp_encode_sideband_req() the same - danvet
* Only check DRM_UT_DP - danvet
* Clean up sideband_msg_req_equal() from selftests a bit, and add
  comments explaining why we can't just use memcmp - danvet

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-8-lyude@redhat.com
5 years agodrm/dp_mst: Combine redundant cases in drm_dp_encode_sideband_req()
Lyude Paul [Tue, 3 Sep 2019 21:57:02 +0000 (17:57 -0400)]
drm/dp_mst: Combine redundant cases in drm_dp_encode_sideband_req()

Noticed this while working on adding a drm_dp_decode_sideband_req().
DP_POWER_DOWN_PHY/DP_POWER_UP_PHY both use the same struct as
DP_ENUM_PATH_RESOURCES, so we can just combine their cases.

Changes since v2:
* Fix commit message

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903215702.16984-1-lyude@redhat.com
5 years agodrm/print: Add drm_err_printer()
Lyude Paul [Tue, 3 Sep 2019 20:45:43 +0000 (16:45 -0400)]
drm/print: Add drm_err_printer()

A simple convienence function that returns a drm_printer which prints
using pr_err()

Changes since v1:
* Make __drm_printfn_err() more consistent with DRM_ERROR() - danvet

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-6-lyude@redhat.com
5 years agodrm/dp_mst: Move test_calc_pbn_mode() into an actual selftest
Lyude Paul [Tue, 3 Sep 2019 20:45:42 +0000 (16:45 -0400)]
drm/dp_mst: Move test_calc_pbn_mode() into an actual selftest

Yes, apparently we've been testing this for every single driver load for
quite a long time now. At least that means our PBN calculation is solid!

Anyway, introduce self tests for MST and move this into there.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-5-lyude@redhat.com
5 years agodrm/dp_mst: Get rid of list clear in destroy_connector_work
Lyude Paul [Tue, 3 Sep 2019 20:45:40 +0000 (16:45 -0400)]
drm/dp_mst: Get rid of list clear in destroy_connector_work

This seems to be some leftover detritus from before the port/mstb kref
cleanup and doesn't do anything anymore, so get rid of it.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-3-lyude@redhat.com
5 years agodrm/dp_mst: Move link address dumping into a function
Lyude Paul [Tue, 3 Sep 2019 20:45:39 +0000 (16:45 -0400)]
drm/dp_mst: Move link address dumping into a function

Makes things easier to read.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-2-lyude@redhat.com