]> git.baikalelectronics.ru Git - kernel.git/log
kernel.git
2 years agodrm/fb: rename FB CMA helpers to FB DMA helpers
Danilo Krummrich [Tue, 2 Aug 2022 00:04:02 +0000 (02:04 +0200)]
drm/fb: rename FB CMA helpers to FB DMA helpers

Rename "FB CMA" helpers to "FB DMA" helpers - considering the hierarchy
of APIs (mm/cma -> dma -> fb dma) calling them "FB DMA" seems to be
more applicable.

Besides that, commit 234df3ea69dd ("drm/doc: Task to rename CMA helpers")
requests to rename the CMA helpers and implies that people seem to be
confused about the naming.

In order to do this renaming the following script was used:

```
#!/bin/bash

DIRS="drivers/gpu include/drm Documentation/gpu"

REGEX_SYM_UPPER="[0-9A-Z_\-]"
REGEX_SYM_LOWER="[0-9a-z_\-]"

REGEX_GREP_UPPER="(${REGEX_SYM_UPPER}*)(FB)_CMA_(${REGEX_SYM_UPPER}*)"
REGEX_GREP_LOWER="(${REGEX_SYM_LOWER}*)(fb)_cma_(${REGEX_SYM_LOWER}*)"

REGEX_SED_UPPER="s/${REGEX_GREP_UPPER}/\1\2_DMA_\3/g"
REGEX_SED_LOWER="s/${REGEX_GREP_LOWER}/\1\2_dma_\3/g"

# Find all upper case 'CMA' symbols and replace them with 'DMA'.
for ff in $(grep -REHl "${REGEX_GREP_UPPER}" $DIRS)
do
       sed -i -E "$REGEX_SED_UPPER" $ff
done

# Find all lower case 'cma' symbols and replace them with 'dma'.
for ff in $(grep -REHl "${REGEX_GREP_LOWER}" $DIRS)
do
       sed -i -E "$REGEX_SED_LOWER" $ff
done

# Replace all occurrences of 'CMA' / 'cma' in comments and
# documentation files with 'DMA' / 'dma'.
for ff in $(grep -RiHl " cma " $DIRS)
do
sed -i -E "s/ cma / dma /g" $ff
sed -i -E "s/ CMA / DMA /g" $ff
done
```

Only a few more manual modifications were needed, e.g. reverting the
following modifications in some DRM Kconfig files

    -       select CMA if HAVE_DMA_CONTIGUOUS
    +       select DMA if HAVE_DMA_CONTIGUOUS

as well as manually picking the occurrences of 'CMA'/'cma' in comments and
documentation which relate to "FB CMA", but not "GEM CMA".

This patch is compile-time tested building a x86_64 kernel with
`make allyesconfig && make drivers/gpu/drm`.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> #drivers/gpu/drm/arm
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220802000405.949236-3-dakr@redhat.com
2 years agodrm/fb: remove unused includes of drm_fb_cma_helper.h
Danilo Krummrich [Tue, 2 Aug 2022 00:04:01 +0000 (02:04 +0200)]
drm/fb: remove unused includes of drm_fb_cma_helper.h

Quite a lot of drivers include the drm_fb_cma_helper.h header file
without actually making use of it's provided API, hence remove those
includes.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220802000405.949236-2-dakr@redhat.com
2 years agoMerge drm/drm-next into drm-misc-next
Thomas Zimmermann [Mon, 1 Aug 2022 13:54:52 +0000 (15:54 +0200)]
Merge drm/drm-next into drm-misc-next

Backmerging to pick up fixes from amdgpu.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2 years agodrm/mgag200: Remove type field from struct mga_device
Thomas Zimmermann [Thu, 28 Jul 2022 12:41:03 +0000 (14:41 +0200)]
drm/mgag200: Remove type field from struct mga_device

Each model's specific code is located in a separate file. The type
field in struct mga_device is no unused. Remove it.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-15-tzimmermann@suse.de
2 years agodrm/mgag200: Move CRTC atomic_enable to model-specific code
Thomas Zimmermann [Thu, 28 Jul 2022 12:41:02 +0000 (14:41 +0200)]
drm/mgag200: Move CRTC atomic_enable to model-specific code

The CRTC atomic_enable helper contains per-model branches for
G200ER, G200EV and G200SE devices. Implement a dedicated helper
for each of them and remove the branches from the shared helper.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-14-tzimmermann@suse.de
2 years agodrm/mgag200: Move mode-config to model-specific code
Thomas Zimmermann [Thu, 28 Jul 2022 12:41:01 +0000 (14:41 +0200)]
drm/mgag200: Move mode-config to model-specific code

Move the mode-config code into model-specific code and call the
plane/CRTC helpers as needed. This will help with providing per-
model implementations of individual helpers.

Duplication of the pipeline init function is accepted. Some macros
simplify this for shared helpers.

v3:
* clean up style

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-13-tzimmermann@suse.de
2 years agodrm/mgag200: Provide per-device callbacks for PIXPLLC
Thomas Zimmermann [Thu, 28 Jul 2022 12:41:00 +0000 (14:41 +0200)]
drm/mgag200: Provide per-device callbacks for PIXPLLC

Move the PIXPLLC code into per-model source files and wire it up
with per-model callbacks. No functional changes.

The PIXPLLC pixel-clock is part of the CRTC, but really separate
hardware that varies with each model of the G200. Move the PIXPLLC
code for each model into the per-model source file and call it from
CRTC helpers via device functions.

This allows to remove struct mgag200_pll and the related code. The
new callbacks behave like the CRTC's atomic_check and atomic_enable
functions.

v3:
* clean up style

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-12-tzimmermann@suse.de
2 years agodrm/mgag200: Provide per-device callbacks for BMC synchronization
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:59 +0000 (14:40 +0200)]
drm/mgag200: Provide per-device callbacks for BMC synchronization

Move the BMC-related code into its own file and wire it up with device
callbacks.

While programming a new display mode, G200EW3 and G200WB have to de-
synchronize with the BMC. Synchronization is done via VIDRST pins
and controlled via VRSTEN and HRSTEN bits. Move the BMC code behind
a serviceable interface and call it from the CRTC's enable and
disable functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-11-tzimmermann@suse.de
2 years agodrm/mgag200: Add per-device callbacks
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:58 +0000 (14:40 +0200)]
drm/mgag200: Add per-device callbacks

While currently empty, the device callbacks will allow mgag200's
modesetting code to interact with the BMC and PIXPLLC.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-10-tzimmermann@suse.de
2 years agodrm/mgag200: Set SCROFF in primary-plane code
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:57 +0000 (14:40 +0200)]
drm/mgag200: Set SCROFF in primary-plane code

The SCROFF bit controls reading the primary plane's scanout buffer
from video memory. Set it from primary-plane code, instead of CRTC
code.

v3:
* only flip SCROFF when enabling/disabling the plane (Jocelyn)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-9-tzimmermann@suse.de
2 years agodrm/mgag200: Replace simple-KMS with regular atomic helpers
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:56 +0000 (14:40 +0200)]
drm/mgag200: Replace simple-KMS with regular atomic helpers

Drop simple-KMS in favor of regular atomic helpers. Makes the code
more modular and hence better to adapt to per-model requirements.

The simple-KMS helpers provide few extra features, so the patch is
mostly about open-coding what simple-KMS does. The simple-KMS helpers
do mix up plane and CRTC state. Changing to regular atomic helpers
requires to split some of the simple-pipe functions into per-plane
and per-CRTC code

No functional changes.

v3:
* always run drm_atomic_helper_check_plane_state()
* clean up style

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-8-tzimmermann@suse.de
2 years agodrm/mgag200: Reorganize before dropping simple-KMS helpers
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:55 +0000 (14:40 +0200)]
drm/mgag200: Reorganize before dropping simple-KMS helpers

Move around some modesetting code before dropping simple-KMS helpers.
Makes the next patch more readable. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-7-tzimmermann@suse.de
2 years agodrm/mgag200: Store primary plane's color format in CRTC state
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:54 +0000 (14:40 +0200)]
drm/mgag200: Store primary plane's color format in CRTC state

Store the primary plane's color format in the CRTC state and use
it for programming the CRTC's gamma LUTs.

Gamma tables (i.e., color management) are provided by the CRTC, but
depend in the primary plane's color format. Store the format in the
CRTC state and use it. This has not been an issue with simple-KMS
helpers, which mix-up plane and CRTC state to some extent. For using
regular atomic helpers, it's necessary to distinguish between the two.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-6-tzimmermann@suse.de
2 years agodrm/mgag200: Acquire I/O-register lock in atomic_commit_tail function
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:53 +0000 (14:40 +0200)]
drm/mgag200: Acquire I/O-register lock in atomic_commit_tail function

Hold I/O-register lock in atomic_commit_tail to protect all pipeline
updates at once. Protects against concurrent I/O access in get-modes
helper.

Complex modesetting operations involve mode changes, plane updates and
possibly BMC updates. Make all this atomic wrt to reading display modes
via EDID. It's not so much an issue with simple-KMS helpers, but will
become necessary for using regular atomic helpers.

v4:
* remove empty line

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-5-tzimmermann@suse.de
2 years agodrm/mgag200: Move ER/EW3 register initialization to per-model code
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:52 +0000 (14:40 +0200)]
drm/mgag200: Move ER/EW3 register initialization to per-model code

The register initialization code contains special cases for G200ER
and G200EW3 hardware. Move this to per-model code.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-4-tzimmermann@suse.de
2 years agodrm/mgag200: Move DAC-register setup into model-specific code
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:51 +0000 (14:40 +0200)]
drm/mgag200: Move DAC-register setup into model-specific code

Provide an init function for each model's DAC registers. Remove
the shared helper.

The code for initializing the DAC registers consisted of a large
table of default value, plus many exceptions for the various G200
models. Providing a per-model implementation makes if more readable.
At some point, some of the initialization should probably move into
the modesetting code.

v2:
* don't duplicate DAC values unnecessarily (Sam, Jocelyn)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-3-tzimmermann@suse.de
2 years agodrm/mgag200: Split mgag200_modeset_init()
Thomas Zimmermann [Thu, 28 Jul 2022 12:40:50 +0000 (14:40 +0200)]
drm/mgag200: Split mgag200_modeset_init()

Split mgag200_modeset_init() into smaller helpers to initialize
the mode_config structure and the pipeline. This will be helpful
for transforming this code into per-model functions. No functional
changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-2-tzimmermann@suse.de
2 years agodrm/tests: Split up test cases in igt_check_drm_format_min_pitch
Maíra Canal [Fri, 29 Jul 2022 12:47:26 +0000 (09:47 -0300)]
drm/tests: Split up test cases in igt_check_drm_format_min_pitch

The igt_check_drm_format_min_pitch() function had a lot of
KUNIT_EXPECT_* calls, all of which ended up allocating and initializing
various test assertion structures on the stack.

This behavior was producing -Wframe-larger-than warnings on PowerPC, i386,
and MIPS architectures, such as:

drivers/gpu/drm/tests/drm_format_test.c: In function 'igt_check_drm_format_min_pitch':
drivers/gpu/drm/tests/drm_format_test.c:271:1: error: the frame size of
3712 bytes is larger than 2048 bytes

So, the igt_check_drm_format_min_pitch() test case was split into three
smaller functions: one testing single plane formats, one testing
multi-planar formats, and the other testing tiled formats.

Fixes: 86bea5be140f ("drm: selftest: convert drm_format selftest to KUnit")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220729124726.748221-1-mairacanal@riseup.net
2 years agodrm/dp_mst: fix drm_dp_dpcd_read return value checks
Simon Ser [Thu, 10 Feb 2022 15:40:25 +0000 (15:40 +0000)]
drm/dp_mst: fix drm_dp_dpcd_read return value checks

drm_dp_dpcd_read returns the number of bytes read. The previous code
would print garbage on DPCD error, and would exit with on error on
success.

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: eed1ea7b2209 ("drm/dp_mst: Fix W=1 warnings")
Cc: Lyude Paul <lyude@redhat.com>
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/473500/
2 years agodrm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb565()
José Expósito [Tue, 26 Jul 2022 23:09:16 +0000 (01:09 +0200)]
drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb565()

Extend the existing test cases to test the conversion from XRGB8888 to
RGB565.

The documentation and the color picker available on [1] are useful
resources to understand this patch and validate the values returned by
the conversion function.

Tested-by: Tales L. Aparecida <tales.aparecida@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: http://www.barth-dev.de/online/rgb565-color-picker/
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-5-jose.exposito89@gmail.com
2 years agodrm/format-helper: Support multiple target formats results
José Expósito [Tue, 26 Jul 2022 23:09:15 +0000 (01:09 +0200)]
drm/format-helper: Support multiple target formats results

In order to support multiple destination format conversions, store the
destination pitch and the expected result in its own structure.

Tested-by: Tales L. Aparecida <tales.aparecida@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-4-jose.exposito89@gmail.com
2 years agodrm/format-helper: Rename test cases to make them more generic
José Expósito [Tue, 26 Jul 2022 23:09:14 +0000 (01:09 +0200)]
drm/format-helper: Rename test cases to make them more generic

The tests available at the moment only check the conversion from
XRGB8888 to RGB332. However, more conversions will be tested in the
future.

In order to make the struct and functions present in the tests more
generic, rename xrgb8888_to_rgb332_* to convert_xrgb8888_*.

Tested-by: Tales L. Aparecida <tales.aparecida@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-3-jose.exposito89@gmail.com
2 years agodrm/format-helper: Fix test on big endian architectures
José Expósito [Tue, 26 Jul 2022 23:09:13 +0000 (01:09 +0200)]
drm/format-helper: Fix test on big endian architectures

The tests fail on big endian architectures, like PowerPC:

 $ ./tools/testing/kunit/kunit.py run \
   --kunitconfig=drivers/gpu/drm/tests \
   --arch=powerpc --cross_compile=powerpc64-linux-gnu-

Transform the XRGB8888 buffer from little endian to the CPU endian
before calling the conversion function to avoid this error.

Fixes: bd1a30f08a17 ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()")
Reported-by: David Gow <davidgow@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-2-jose.exposito89@gmail.com
2 years agodrm/todo: remove task for idr_init_base()
Danilo Krummrich [Fri, 1 Jul 2022 19:02:27 +0000 (21:02 +0200)]
drm/todo: remove task for idr_init_base()

All IDRs in the DRM core and drivers which are applicable for using
idr_init_base() over idr_init() should be set up to use a proper base in
order to avoid unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701190227.284783-3-dakr@redhat.com
2 years agodrm/via: use idr_init_base() to initialize dev_priv->object_idr
Danilo Krummrich [Fri, 1 Jul 2022 19:02:26 +0000 (21:02 +0200)]
drm/via: use idr_init_base() to initialize dev_priv->object_idr

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701190227.284783-2-dakr@redhat.com
2 years agodrm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr
Danilo Krummrich [Fri, 1 Jul 2022 19:02:25 +0000 (21:02 +0200)]
drm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701190227.284783-1-dakr@redhat.com
2 years agodrm/sis: use idr_init_base() to initialize dev_priv->object_idr
Danilo Krummrich [Fri, 1 Jul 2022 18:53:00 +0000 (20:53 +0200)]
drm/sis: use idr_init_base() to initialize dev_priv->object_idr

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701185303.284082-8-dakr@redhat.com
2 years agodrm: use idr_init_base() to initialize mode_config.tile_idr
Danilo Krummrich [Fri, 1 Jul 2022 18:52:59 +0000 (20:52 +0200)]
drm: use idr_init_base() to initialize mode_config.tile_idr

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701185303.284082-7-dakr@redhat.com
2 years agodrm: use idr_init_base() to initialize mode_config.object_idr
Danilo Krummrich [Fri, 1 Jul 2022 18:52:58 +0000 (20:52 +0200)]
drm: use idr_init_base() to initialize mode_config.object_idr

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701185303.284082-6-dakr@redhat.com
2 years agodrm: use idr_init_base() to initialize master->lessee_idr
Danilo Krummrich [Fri, 1 Jul 2022 18:52:57 +0000 (20:52 +0200)]
drm: use idr_init_base() to initialize master->lessee_idr

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701185303.284082-5-dakr@redhat.com
2 years agodrm: use idr_init_base() to initialize master->magic_map
Danilo Krummrich [Fri, 1 Jul 2022 18:52:56 +0000 (20:52 +0200)]
drm: use idr_init_base() to initialize master->magic_map

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701185303.284082-4-dakr@redhat.com
2 years agodrm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles
Danilo Krummrich [Fri, 1 Jul 2022 18:52:55 +0000 (20:52 +0200)]
drm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested/allocated, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701185303.284082-3-dakr@redhat.com
2 years agodrm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles
Danilo Krummrich [Fri, 1 Jul 2022 18:52:54 +0000 (20:52 +0200)]
drm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles

idr_init_base(), implemented by commit 3c95a175db44 ("idr: Make 1-based
IDRs more efficient"), let us set an arbitrary base other than
idr_init(), which uses base 0.

Since, for this IDR, no ID < 1 is ever requested, using
idr_init_base(&idr, 1) avoids unnecessary tree walks.

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220701185303.284082-2-dakr@redhat.com
2 years agofbdev: Make registered_fb[] private to fbmem.c
Daniel Vetter [Mon, 25 Jul 2022 07:54:00 +0000 (09:54 +0200)]
fbdev: Make registered_fb[] private to fbmem.c

No driver access this anymore, except for the olpc dcon fbdev driver but
that has been marked as broken anyways by commit ba3759d94a28 ("staging:
olpc_dcon: mark driver as broken").

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220725075400.68478-1-javierm@redhat.com
2 years agodrm/panel/panel-sitronix-st7701: Add Densitron DMT028VGHMCMI-1A TFT
Marek Vasut [Mon, 25 Jul 2022 15:17:03 +0000 (17:17 +0200)]
drm/panel/panel-sitronix-st7701: Add Densitron DMT028VGHMCMI-1A TFT

Add support for Densitron DMT028VGHMCMI-1A TFT matrix into this driver.
This is a DSI-attached 480x640 2.83 inch panel.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Guido Günther <agx@sigxcpu.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220725151703.319939-2-marex@denx.de
2 years agodt-bindings: display: panel: sitronix,st7701: Add Densitron DMT028VGHMCMI-1A TFT
Marek Vasut [Mon, 25 Jul 2022 15:17:02 +0000 (17:17 +0200)]
dt-bindings: display: panel: sitronix,st7701: Add Densitron DMT028VGHMCMI-1A TFT

Add compatible string for Densitron DMT028VGHMCMI-1A TFT matrix.
This is a DSI-attached 480x640 2.83 inch panel.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Guido Günther <agx@sigxcpu.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: devicetree@vger.kernel.org
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220725151703.319939-1-marex@denx.de
2 years agodrm: Fix typo 'the the' in comment
Slark Xiao [Thu, 21 Jul 2022 06:23:45 +0000 (14:23 +0800)]
drm: Fix typo 'the the' in comment

Replace 'the the' with 'the' in the comment.

Signed-off-by: Slark Xiao <slark_xiao@163.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220721062345.46842-1-slark_xiao@163.com
2 years agoMerge tag 'topic/nouveau-misc-2022-07-27' of git://anongit.freedesktop.org/drm/drm...
Dave Airlie [Wed, 27 Jul 2022 00:11:59 +0000 (10:11 +1000)]
Merge tag 'topic/nouveau-misc-2022-07-27' of git://anongit.freedesktop.org/drm/drm into drm-next

drm/nouveau-misc: display patches.

These are just some precursor and cleanup display patches from Ben,
tested by Lyude.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Dave Airlie <airlied@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAPM=9ty0R37q0mohBr_CegpYLXK2=fAH54QfAsMhHfPygTsdQA@mail.gmail.com
2 years agoMerge tag 'amd-drm-next-5.20-2022-07-26' of https://gitlab.freedesktop.org/agd5f...
Dave Airlie [Tue, 26 Jul 2022 23:33:44 +0000 (09:33 +1000)]
Merge tag 'amd-drm-next-5.20-2022-07-26' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amdgpu:
- VCN4 fixes
- RAS support for UMC 8.10
- ACP support for jadeite platforms
- NBIO HDP flush fixes
- Misc spelling and grammar fixes
- Runtime PM fixes
- Non-DC HPD fix
- Clean up amdgpu DM code
- DSC fixes
- Expose some additional GFXOFF data via debugfs
- More FP clean up for new DCN blocks
- PPC DC FP fixes
- DCN 3.1.4 fixes
- DC DML stack usage fixes
- GMC fixes
- SPM fixes for RDNA2

amdkfd:
- MMU notifier fix
- Mutex fix

UAPI:
- Add a comment about VCN4 unified queues
- IP version information for UMDs
  Proposed mesa change: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17411/diffs?commit_id=c8a63590dfd0d64e6e6a634dcfed993f135dd075

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220726181536.5759-1-alexander.deucher@amd.com
2 years agodrm/nouveau/disp: move DAC load detection method
Ben Skeggs [Wed, 1 Jun 2022 10:46:31 +0000 (20:46 +1000)]
drm/nouveau/disp: move DAC load detection method

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: add output class
Ben Skeggs [Wed, 1 Jun 2022 10:46:31 +0000 (20:46 +1000)]
drm/nouveau/disp: add output class

Will be used to more cleanly implement existing method interfaces that
take some confusing (IEDTkey, inherited from VBIOS, which RM no longer
uses on Ampere) match values to determine which display path to operate
on.

Methods will be protected from racing with supervisor, and from being
called where they shouldn't be (ie. without an OR assigned).

v2:
- use ?: (lyude)
v3:
- fix return code if noacquire() method fails

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: add supervisor mutex
Ben Skeggs [Wed, 1 Jun 2022 10:46:31 +0000 (20:46 +1000)]
drm/nouveau/disp: add supervisor mutex

Will be used to protect NVIF_CLASS_OUTP method calls from racing with
in-progress supervisor handling.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: add conn method to query HPD pin status
Ben Skeggs [Wed, 1 Jun 2022 10:46:30 +0000 (20:46 +1000)]
drm/nouveau/disp: add conn method to query HPD pin status

And use it to bail early in DP detection and avoid futile AUX transactions.

This could be used on other connector types too in theory, but it's not
something we've ever done before and I'd rather not risk breaking working
systems without looking into it more closely.

It's safe for DP though.  We already do this by checking an AUX register
that contains HPD status and aborting the transaction.  However, this is
much deeper in the stack - after taking various mutexes, poking HW for no
good reason, and making a mess in debug logs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: add connector class
Ben Skeggs [Wed, 1 Jun 2022 10:46:30 +0000 (20:46 +1000)]
drm/nouveau/disp: add connector class

Will be used to provide more solid driver interfaces in general, but
the immediate motivation is work towards fixing issues with handling
hotplug/DP IRQ events.

Its use is currently limited to where we support non-polled hotplug
already (ie. any GPU since NV40ish era, where our DCB handling works
well enough), until that gets cleaned up someday.

v2:
- use ?: (lyude)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: add common channel class handling
Ben Skeggs [Wed, 1 Jun 2022 10:46:29 +0000 (20:46 +1000)]
drm/nouveau/disp: add common channel class handling

Replaces a bunch of unnecessarily duplicated boilerplate in per-chipset
code with a simpler, common, implementation.

Channel "awaken" notify code is completely gone for now.  KMS has never
made use of it so far, and event notify handling is about to be changed
in general anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: split sor hda funcs out to their own struct
Ben Skeggs [Wed, 1 Jun 2022 10:46:29 +0000 (20:46 +1000)]
drm/nouveau/disp: split sor hda funcs out to their own struct

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: split sor dp funcs out to their own struct
Ben Skeggs [Wed, 1 Jun 2022 10:46:29 +0000 (20:46 +1000)]
drm/nouveau/disp: split sor dp funcs out to their own struct

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: replace hda func pointer check with flag
Ben Skeggs [Wed, 1 Jun 2022 10:46:28 +0000 (20:46 +1000)]
drm/nouveau/disp: replace hda func pointer check with flag

Simpler, and less error-prone than a separate set of function pointers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: merge nv50_disp_new_() and nvkm_disp_new()
Ben Skeggs [Wed, 1 Jun 2022 10:46:28 +0000 (20:46 +1000)]
drm/nouveau/disp: merge nv50_disp_new_() and nvkm_disp_new()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: group supervisor-related struct members
Ben Skeggs [Wed, 1 Jun 2022 10:46:28 +0000 (20:46 +1000)]
drm/nouveau/disp: group supervisor-related struct members

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: merge head/outp/ior code into chipset files
Ben Skeggs [Wed, 1 Jun 2022 10:46:27 +0000 (20:46 +1000)]
drm/nouveau/disp: merge head/outp/ior code into chipset files

No changes to code at all here, just shuffling it around and removing
a bunch of (now unnecessary) forward-declarations from headers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: add common class handling between <nv50 and >=nv50
Ben Skeggs [Wed, 1 Jun 2022 10:46:27 +0000 (20:46 +1000)]
drm/nouveau/disp: add common class handling between <nv50 and >=nv50

About to expose head/output path/connector objects everywhere, so we will
need support for child classes prior to nv50 now.

Somewhat cleaner than the code >=nv50 used previously.

v2:
- use ?: (lyude)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: collapse nv50_disp into nvkm_disp
Ben Skeggs [Wed, 1 Jun 2022 10:46:26 +0000 (20:46 +1000)]
drm/nouveau/disp: collapse nv50_disp into nvkm_disp

Dump of one struct's members into another, with a couple of list
renames because of collisions.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: collapse nv50_disp_func into nvkm_disp_func
Ben Skeggs [Wed, 1 Jun 2022 10:46:26 +0000 (20:46 +1000)]
drm/nouveau/disp: collapse nv50_disp_func into nvkm_disp_func

Aside from a chicken-and-egg problem with a duplicate 'root' member,
this is a straight dump of function pointers from one struct into
another.

The left-over wrapping mess in >=nv50 structs will be fixed later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: clean up nvkm_outp constructors
Ben Skeggs [Wed, 1 Jun 2022 10:46:25 +0000 (20:46 +1000)]
drm/nouveau/disp: clean up nvkm_outp constructors

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/nouveau/disp: collapse nvkm_dp into nvkm_outp
Ben Skeggs [Wed, 1 Jun 2022 10:46:25 +0000 (20:46 +1000)]
drm/nouveau/disp: collapse nvkm_dp into nvkm_outp

There should be no changes to code here other than modifying the
dereferences.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2 years agodrm/fsl-dcu: Use drm_plane_helper_destroy()
Thomas Zimmermann [Wed, 20 Jul 2022 08:30:58 +0000 (10:30 +0200)]
drm/fsl-dcu: Use drm_plane_helper_destroy()

Replace the driver's own function with drm_plane_helper_destroy(). No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220720083058.15371-8-tzimmermann@suse.de
2 years agodrm/armada: Use drm_plane_helper_destroy()
Thomas Zimmermann [Wed, 20 Jul 2022 08:30:57 +0000 (10:30 +0200)]
drm/armada: Use drm_plane_helper_destroy()

Replace the driver's own function with drm_plane_helper_destroy(). No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220720083058.15371-7-tzimmermann@suse.de
2 years agodrm/plane-helper: Export individual helpers
Thomas Zimmermann [Wed, 20 Jul 2022 08:30:56 +0000 (10:30 +0200)]
drm/plane-helper: Export individual helpers

Export the individual plane helpers that make up the plane functions and
align the naming with other helpers. The plane helpers are for non-atomic
modesetting and exporting them will simplify a later conversion of drivers
to atomic modesetting.

With struct drm_plane_funcs removed from drm_plane_helper.h, also remove
the include statements. It only needs linux/types.h for uint32_t and a
number of forward declarations.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220720083058.15371-6-tzimmermann@suse.de
2 years agodrm: Remove unnecessary include statements of drm_plane_helper.h
Thomas Zimmermann [Wed, 20 Jul 2022 08:30:55 +0000 (10:30 +0200)]
drm: Remove unnecessary include statements of drm_plane_helper.h

Remove the include statement for drm_plane_helper.h from all the files
that don't need it. Althogh the header file is almost empty, many drivers
include it somewhere.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220720083058.15371-5-tzimmermann@suse.de
2 years agodrm/atomic-helper: Remove _HELPER_ infix from DRM_PLANE_HELPER_NO_SCALING
Thomas Zimmermann [Wed, 20 Jul 2022 08:30:54 +0000 (10:30 +0200)]
drm/atomic-helper: Remove _HELPER_ infix from DRM_PLANE_HELPER_NO_SCALING

Rename DRM_PLANE_HELPER_NO_SCALING to DRM_PLANE_NO_SCALING. The constant
is not really a helper, but rather a characteristic of the plane itself.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220720083058.15371-4-tzimmermann@suse.de
2 years agodrm/atomic-helper: Move DRM_PLANE_HELPER_NO_SCALING to atomic helpers
Thomas Zimmermann [Wed, 20 Jul 2022 08:30:53 +0000 (10:30 +0200)]
drm/atomic-helper: Move DRM_PLANE_HELPER_NO_SCALING to atomic helpers

The macro DRM_PLANE_HELPER_NO_SCALING is only useful with the interfaces
in drm_atomic_helper.h, but defined in drm_plane_helper.h. So half of
DRM includes the latter header file for using this macro. Move the macro
and remove the include statements.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220720083058.15371-3-tzimmermann@suse.de
2 years agodrm/vmwgfx: Remove trailing whitespace
Thomas Zimmermann [Wed, 20 Jul 2022 08:30:52 +0000 (10:30 +0200)]
drm/vmwgfx: Remove trailing whitespace

Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220720083058.15371-2-tzimmermann@suse.de
2 years agodrm/amd/display: Reduce stack size in the mode support function
Rodrigo Siqueira [Fri, 22 Jul 2022 17:56:17 +0000 (13:56 -0400)]
drm/amd/display: Reduce stack size in the mode support function

When we use the allmodconfig option we see the following error:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c: In function 'dml32_ModeSupportAndSystemConfigurationFull':
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c:3799:1: error: the frame size of 2464 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
  3799 | } // ModeSupportAndSystemConfigurationFull

This commit fixes this issue by moving part of the mode support
operation from ModeSupportAndSystemConfigurationFull to a dedicated
function.

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: 3.2.196
Anthony Koo [Sun, 17 Jul 2022 15:41:44 +0000 (11:41 -0400)]
drm/amd/display: 3.2.196

This version brings along following fixes:

- Copy crc_skip_count when duplicating CRTC state
- Add debug option for idle optimizations on cursor updates
- Disable MPC split for DCN32/321
- Add missing ODM 2:1 policy logic
- Update DCN32 and DCN321 SR latencies
- Add reinstate dram in the FPO logic
- Add dc_ctx to link_enc_create() parameters
- Cache cursor when cursor exceeds 64x64
- Add support for manual DMUB FAMS trigger
- Fix dpstreamclk programming
- Add missing AUDIO_DTO_SEL reg field
- Add OTG/ODM functions
- Use correct clock source constructor for DCN314
- Use correct DTO_SRC_SEL for 128b/132b encoding
- Add pixel rate div calcs and programming
- Remove FPU flags from DCN30 Makefile
- Create patch bounding box function for isolate FPU
- Move mclk calculation function to DML
- Remove FPU operations from dcn201 resources
- Fallback to SW cursor if SubVP + cursor too big
- Drop unnecessary FPU flags on dcn302 files
- Reboot while unplug hdcp enabled dp from mst hub
- Reset pipe count when iterating for DET override
- Calculate MALL cache lines based on Mblks required
- Fix two MPO videos in single display ODM combine mode
- Guard against zero memory channels
- Updates SubVP + SubVP DRR cases updates
- Fix OPTC function pointers for DCN314
- Add enable/disable FIFO callbacks to stream setup
- Avoid MPC infinite loop

Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Copy crc_skip_count when duplicating CRTC state
Leo Li [Thu, 4 Nov 2021 23:41:55 +0000 (19:41 -0400)]
drm/amd/display: Copy crc_skip_count when duplicating CRTC state

[Why]

crc_skip_count is used to track how many frames to skip to allow the OTG
CRC engine to "warm up" before it outputs correct CRC values.
Experimentally, this seems to be 2 frames.

When duplicating CRTC states, this value was not copied to the
duplicated state. Therefore, when this state is committed, we will
needlessly wait 2 frames before outputing CRC values. Even if the CRC
engine is already warmed up.

[How]

Copy the crc_skip_count as part of dm_crtc_duplicate_state.

Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Leo Li <sunpeng.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add debug option for idle optimizations on cursor updates
Alvin Lee [Fri, 3 Jun 2022 20:39:48 +0000 (16:39 -0400)]
drm/amd/display: Add debug option for idle optimizations on cursor updates

For optimizations and debug purposes we added an option to exit idle
operations on cursor updates.

Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Disable MPC split for DCN32/321
Alvin Lee [Thu, 2 Jun 2022 20:01:33 +0000 (16:01 -0400)]
drm/amd/display: Disable MPC split for DCN32/321

Due to CRB, no need to rely on MPC splitting to maximize use of DET
anymore.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add missing ODM 2:1 policy logic
Samson Tam [Fri, 27 May 2022 01:12:23 +0000 (21:12 -0400)]
drm/amd/display: Add missing ODM 2:1 policy logic

Phantom pipes must use the same configuration used in main pipes. This
commit add this check.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Update DCN32 and DCN321 SR latencies
Alvin Lee [Thu, 19 May 2022 18:03:09 +0000 (14:03 -0400)]
drm/amd/display: Update DCN32 and DCN321 SR latencies

Update worst case SR latencies according to values measured by hardware
team.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add reinstate dram in the FPO logic
Rodrigo Siqueira [Tue, 19 Apr 2022 15:22:17 +0000 (11:22 -0400)]
drm/amd/display: Add reinstate dram in the FPO logic

In order to handle FPO correctly, we need to reinstate the dram values.
This function adds the required code to handle the vblank stretch and
the dram calculation.

Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add dc_ctx to link_enc_create() parameters
Aurabindo Pillai [Fri, 1 Apr 2022 19:29:21 +0000 (15:29 -0400)]
drm/amd/display: Add dc_ctx to link_enc_create() parameters

[Why&How]
Preparation to enable run time initialization of register offsets to add
dc_context to the link_enc_create callback. This is needed to get the
dc_ctx handle where register offset initialization routine is called.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Cache cursor when cursor exceeds 64x64
Chris Park [Tue, 28 Jun 2022 16:36:04 +0000 (12:36 -0400)]
drm/amd/display: Cache cursor when cursor exceeds 64x64

[Why]
When Static screen from MALL, the cursor needs to be
cached if cursor exceeds 64x64 size.

[How]
Program the bit that cache cursor in MALL when size
of the cursor exceeds 64x64.

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Chris Park <chris.park@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add support for manual DMUB FAMS trigger
Anthony Koo [Sun, 17 Jul 2022 03:14:01 +0000 (23:14 -0400)]
drm/amd/display: Add support for manual DMUB FAMS trigger

- Add is_drr parameter to indicate DRR is enabled on
the panel to determine whether SubVP MCLK switch
logic should be enabled

- Add DRR manual trigger in FW (instead of driver)
because manual trigger programming triggers DRR
update pending and can block SubVP MCLK switches
from taking place

Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Fix dpstreamclk programming
Michael Strauss [Fri, 10 Jun 2022 20:28:03 +0000 (16:28 -0400)]
drm/amd/display: Fix dpstreamclk programming

[WHY]
Currently programming incorrect hpo inst as well as selecting incorrect source

[HOW]
Use hpo inst instead of otg inst to select dpstreamclk inst

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add missing AUDIO_DTO_SEL reg field
Michael Strauss [Thu, 9 Jun 2022 15:02:15 +0000 (11:02 -0400)]
drm/amd/display: Add missing AUDIO_DTO_SEL reg field

[WHY]
Needed to program audio dto

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add OTG/ODM functions
Michael Strauss [Thu, 9 Jun 2022 14:52:52 +0000 (10:52 -0400)]
drm/amd/display: Add OTG/ODM functions

[WHY]
Required for correct OTG_H_TIMING_CNTL programming

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Use correct clock source constructor for DCN314
Michael Strauss [Thu, 9 Jun 2022 14:48:43 +0000 (10:48 -0400)]
drm/amd/display: Use correct clock source constructor for DCN314

[WHY]
Previously was pointing to DCN3 clock constructor rather than DCN31's

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Use correct DTO_SRC_SEL for 128b/132b encoding
Michael Strauss [Thu, 9 Jun 2022 14:45:34 +0000 (10:45 -0400)]
drm/amd/display: Use correct DTO_SRC_SEL for 128b/132b encoding

[WHY]
DP DTO isn't used for 128b/132b encoding

[HOW]
Check current link rate to determine whether using 8b/10b or 128/132b encoding

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add pixel rate div calcs and programming
Michael Strauss [Tue, 31 May 2022 20:55:32 +0000 (16:55 -0400)]
drm/amd/display: Add pixel rate div calcs and programming

[WHY/HOW]
Need to calculate and set some pixel rate divisors on correct otg_inst

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Remove FPU flags from DCN30 Makefile
Rodrigo Siqueira [Thu, 14 Jul 2022 20:32:54 +0000 (16:32 -0400)]
drm/amd/display: Remove FPU flags from DCN30 Makefile

At this stage, we must have all the FPU code for DCN30 isolated in the
DML folder. Drop FPU flags from Makefile.

Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Create patch bounding box function for isolate FPU
Rodrigo Siqueira [Thu, 14 Jul 2022 20:13:10 +0000 (16:13 -0400)]
drm/amd/display: Create patch bounding box function for isolate FPU

In the DCN30 resource, we have a small patch to the bounding box struct;
this patch uses FPU operations. This commit moves that specific part to
its function under the DML folder.

Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Move mclk calculation function to DML
Rodrigo Siqueira [Thu, 14 Jul 2022 19:27:58 +0000 (15:27 -0400)]
drm/amd/display: Move mclk calculation function to DML

The function responsible for calculating the MCLK switching has FPU
operations. This commit moves it to the dcn30_fpu file.

Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Remove FPU operations from dcn201 resources
Rodrigo Siqueira [Thu, 14 Jul 2022 19:11:31 +0000 (15:11 -0400)]
drm/amd/display: Remove FPU operations from dcn201 resources

We have some FPU operations on the resource part of the DCN201. This
commit drops FPU flags and moves any required FPU code to the DML
folder.

Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Fallback to SW cursor if SubVP + cursor too big
Alvin Lee [Thu, 14 Jul 2022 22:21:28 +0000 (18:21 -0400)]
drm/amd/display: Fallback to SW cursor if SubVP + cursor too big

[Description]
- For SubVP cursor cannot be cached in MALL, therefore
we will switch to SW cursor if the cursor size exceeds
what can fit in the local DCN buffers (64x64x4)
- Returning false / failure for set_cursor_attributes will
fallback to SW cursor

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Drop unnecessary FPU flags on dcn302 files
Rodrigo Siqueira [Thu, 14 Jul 2022 16:29:12 +0000 (12:29 -0400)]
drm/amd/display: Drop unnecessary FPU flags on dcn302 files

We already isolated the DCN302 code in the DML folder, but we forgot to
drop the FPU flags from the Makefile. This commit drops those flags.

Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Reboot while unplug hdcp enabled dp from mst hub
hersen wu [Thu, 14 Jul 2022 14:00:28 +0000 (10:00 -0400)]
drm/amd/display: Reboot while unplug hdcp enabled dp from mst hub

[Why]
event_property_update does not check NULL pointer

[How]
check aconnector->base.state equals NULL

Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: hersen wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Reset pipe count when iterating for DET override
Taimur Hassan [Wed, 13 Jul 2022 21:07:43 +0000 (17:07 -0400)]
drm/amd/display: Reset pipe count when iterating for DET override

[Why]
Coding error in DET allocation was resulting in too few DET segments
being allocated, causing underflow.

[How]
Reset pipe count each time we begin iterating through pipes for a stream.

Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Calculate MALL cache lines based on Mblks required
Alvin Lee [Wed, 13 Jul 2022 16:33:37 +0000 (12:33 -0400)]
drm/amd/display: Calculate MALL cache lines based on Mblks required

[Description]
- Calculation for NumWays in MALL should be based on
number of MBlks

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Fix two MPO videos in single display ODM combine mode
Samson Tam [Tue, 12 Jul 2022 09:54:38 +0000 (05:54 -0400)]
drm/amd/display: Fix two MPO videos in single display ODM combine mode

[Why]
In single display ODM combine mode, two MPO videos ( three
 planes ) are not working

[How]
When we detect three planes, don't set odm combine 2to1 policy
 for the MPO planes.  Otherwise, we run out of pipes available
Add support for two MPO videos in dc_add_plane_to_context().
 Don't allow both videos to be on the same side of the
 display.
Add extra check when fetching free pipe for two MPO videos.

Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Guard against zero memory channels
Nicholas Kazlauskas [Tue, 12 Jul 2022 18:32:45 +0000 (14:32 -0400)]
drm/amd/display: Guard against zero memory channels

[Why]
If BIOS doesn't specify number of memory channels then bandwidth
validation will fail due to insufficient BW in DML.

[How]
If BIOS is setting zero channels then use the default in the table.
If no entry is in the table and no BIOS value is specified then
throw an ASSERT for future developers to look into.

Reviewed-by: Michael Strauss <Michael.Strauss@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Updates SubVP and SubVP DRR cases
Alvin Lee [Tue, 12 Jul 2022 19:49:19 +0000 (15:49 -0400)]
drm/amd/display: Updates SubVP and SubVP DRR cases

[Description]
- For any DRR cases in SubVP, don't lock for VSYNC flips
- For DCN32/321 use FW to do DRR manual trigger programming
- Add bit in SubVP cmd to indicate if the SubVP pipe is DRR

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Fix OPTC function pointers for DCN314
Nicholas Kazlauskas [Thu, 7 Jul 2022 14:19:53 +0000 (10:19 -0400)]
drm/amd/display: Fix OPTC function pointers for DCN314

[Why]
Access violation occurs when swapping between HDMI and FRL monitors
because we're missing the immediate_disable_crtc callback and it's
required for the DCN314 clk manager.

[How]
Update the table to match the DCN31 optc functions for ones that
should be the same:
- immediate_disable_crtc
- configure_crc

Reviewed-by: Michael Strauss <Michael.Strauss@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Add enable/disable FIFO callbacks to stream setup
Nicholas Kazlauskas [Wed, 6 Jul 2022 20:26:40 +0000 (16:26 -0400)]
drm/amd/display: Add enable/disable FIFO callbacks to stream setup

[Why]
We don't write out attributes after disabling and re-enabling the link
on some monitors, causing some, but not all, HDMI displays to fail to
lightup on DCN314.

[How]
Firmware used to do this after DIG link setup.

Since firmware is no longer doing this to support USB4 and dynamic link
remapping we'll need to add this to driver in the equivalent paths.

New optional callbacks were created in the stream encoder interface and
implementations were added for DCN314.

Reviewed-by: Michael Strauss <Michael.Strauss@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: Avoid MPC infinite loop
Aric Cyr [Mon, 11 Jul 2022 14:03:03 +0000 (10:03 -0400)]
drm/amd/display: Avoid MPC infinite loop

[why]
In some cases MPC tree bottom pipe ends up point to itself.  This causes
iterating from top to bottom to hang the system in an infinite loop.

[how]
When looping to next MPC bottom pipe, check that the pointer is not same
as current to avoid infinite loop.

Reviewed-by: Josip Pavic <Josip.Pavic@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amdgpu: enable swiotlb for gmc 11.0
Aaron Liu [Mon, 25 Jul 2022 00:45:56 +0000 (08:45 +0800)]
drm/amdgpu: enable swiotlb for gmc 11.0

Enable swiotlb for gmc 11.0.

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amdgpu: enable swiotlb for gmc 10.0 (V2)
Aaron Liu [Tue, 19 Apr 2022 06:17:05 +0000 (14:17 +0800)]
drm/amdgpu: enable swiotlb for gmc 10.0 (V2)

Enable swiotlb for gmc 10.0.
v2: include drm_cache.h to use the function ‘drm_need_swiotlb’

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd: Fix typo 'the the' in comment
Slark Xiao [Thu, 21 Jul 2022 06:09:46 +0000 (14:09 +0800)]
drm/amd: Fix typo 'the the' in comment

Replace 'the the' with 'the' in the comment.

Signed-off-by: Slark Xiao <slark_xiao@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2 years agodrm/amd/display: reduce stack for dml32_CalculatePrefetchSchedule
Alex Deucher [Thu, 21 Jul 2022 04:35:35 +0000 (00:35 -0400)]
drm/amd/display: reduce stack for dml32_CalculatePrefetchSchedule

Move stack variables to dummy structure.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
2 years agodrm/amd/display: reduce stack for dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeS...
Alex Deucher [Thu, 21 Jul 2022 03:50:08 +0000 (23:50 -0400)]
drm/amd/display: reduce stack for dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport

Move stack variables to dummy structure.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>