Skip to content

drm/amd/display: increase MAX_SURFACES in line with planes and streams

Melissa Wen amd-gfx dri-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2drm/amd/display: increase max surfaces in line with planes and streamsdrivers/gpu/drm/amd/display/dc/dc.h+1 -15 replies
2/2drm/amd/display: add warnings for MAX_SURFACES mismatchdrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+20 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] drm/amd/display: increase MAX_SURFACES in line with planes and streams

Hi!

AFAIU, the driver is defining two different max number of surfaces:
MAX_SURFACES (dc.h) and MAX_SURFACE_NUM (dc_types.h) Many years ago, MAX_SURFACES was set 3 just to prevent a stack size warning as in 091a97e542cf ("drm/amd/display: Fix warning. Set MAX_SURFACES to 3")[1]. But according to commit 3cfd03b79425 ("update max streams per surface")[2], from 2023, six is the real max number of surfaces supported by any asics and the warning that motivated [1] seems not valid anymore.

This mismatch looks a bit problematic per se, and I wonder if we should start using only one definition (MAX_SURFACES or MAX_SURFACE_NUM) in the whole driver.

Also, with MAX_PLANES and MAX_STREAMS both set as 6, there are some driver with max_slave_planes = 2 and so the maximum of 3 surfaces can cause an array-index-out-of-bonds, as reported by [3] and pointed out in the second patch of this series (MAX_SURFACES < plane_count).

I suppose that this blew up after 1d0c9ded4519 ("Introduce overlay cursor mode") [4], since it uses one more DCN plane for cursor overlay mode.

So, the first patch just update MAX_SURFACES to 6 and the second add some debug prints to warn when changes on these values might cause array-index-out-of-bounds.

Let me know your thoughts.

Thanks,

Melissa

[1] https://gitlab.freedesktop.org/agd5f/linux/-/commit/091a97e542cf
[2] https://gitlab.freedesktop.org/agd5f/linux/-/commit/3cfd03b79425
[3] https://gitlab.freedesktop.org/drm/amd/-/issues/3594
[4] https://lore.kernel.org/amd-gfx/[email protected]/

Melissa Wen (2):
drm/amd/display: increase max surfaces in line with planes and streams drm/amd/display: add warnings for MAX_SURFACES mismatch

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 20 +++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)
Signature · 1 line
2.45.2