Loading a DRM_COLOROP_3D_LUT on AMD HW takes a long time because the driver has to load the entire 3D LUT via register writes.
Starting with DCN 4 the HW has the ability to load a 3D LUT via DMA, which only requires an address update for programming the 3D LUT. I propose exposing a new DRM_COLOROP_3D_LUT_DMA type to support this DMA 3D LUT loading mechanism. Users of the DRM_COLOROP_3D_LUT_DMA will parse the supported formats via the LUT_3D_FORMATS blob property, select the desired format via LUT_3D_FORMAT property, and pass the 3D LUT buffer as a drm_framebuffer via FB_ID on the colorop. For details see the patches and/or posted branches. In addition to the patches posted here the 3d-fl-fixes kernel branch contains a number of fixes that will be merged via the usual amdgpu display process. It also contains a patch to enable support on Navi 4 (DCN 4.0.1), which won't be upstreamed since that generation requires a userspace workaround. The 3d-fl-workaround IGT branch exists solely for that purpose. Nonetheless, Navi 4 can serve as an enablement vehicle for anyone who wants to see the new interface working. The kwin branch makes use of a pipeline with DRM_COLOROP_3D_LUT_DMA if such a pipeline is discovered before a pipeline with a DRM_COLOROP_3D_LUT. ### Branches kernel: https://gitlab.freedesktop.org/hwentland/linux/-/commits/3d-fl kernel w/ fixes: https://gitlab.freedesktop.org/hwentland/linux/-/commits/3d-fl-fixes IGT: https://gitlab.freedesktop.org/hwentland/igt-gpu-tools/-/tree/3d-fl IGT Navi 4 w/a: https://gitlab.freedesktop.org/hwentland/igt-gpu-tools/-/tree/3d-fl-workaround kwin: https://invent.kde.org/hwentlan/kwin/-/commits/3d-fl Cc: Melissa Wen <[email protected]> Cc: Autumn Ashton <[email protected]> Cc: Xaver Hugl <[email protected]> Harry Wentland (13): drm/colorop: Add DRM_COLOROP_3D_LUT_DMA drm/colorop: add DRM_COLOROP_3D_LUT_DMA object and state drm/atomic: wire up DMA 3D LUT colorop properties drm/atomic: validate DMA 3D LUT colorop framebuffer drm/atomic: add colorop prepare_fb and cleanup_fb helper hooks drm/tests: test colorop prepare_fb and cleanup_fb helpers drm/amd/display: advertise a DMA 3D LUT color pipeline drm/amd/display: pin the DMA 3D LUT framebuffer drm/amd/display: program the DMA 3D LUT colorop drm/amd/display: add 3D LUT DMA pitch alignment cap drm/amd/display: derive the DMA 3D LUT pitch from DC caps drm/amd/display: reject direct 3D LUT loading mode changes drm/amd/display: add KUnit tests for the DMA 3D LUT colorop drivers/gpu/drm/amd/display/Kconfig | 13 + .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 68 ++- .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 131 +++++- .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h | 8 +- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 71 +++- .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c | 286 ++++++++++++- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 65 +++ drivers/gpu/drm/amd/display/dc/dc.h | 2 + .../dc/resource/dcn42/dcn42_resource.c | 2 + .../dc/resource/dcn42b/dcn42b_resource.c | 2 + drivers/gpu/drm/drm_atomic.c | 66 +++ drivers/gpu/drm/drm_atomic_helper.c | 93 ++++ drivers/gpu/drm/drm_atomic_uapi.c | 28 ++ drivers/gpu/drm/drm_colorop.c | 96 +++++ drivers/gpu/drm/drm_framebuffer.c | 45 +- drivers/gpu/drm/drm_gem_atomic_helper.c | 81 ++++ drivers/gpu/drm/tests/Makefile | 1 + .../gpu/drm/tests/drm_colorop_helper_test.c | 397 ++++++++++++++++++ include/drm/drm_atomic.h | 20 + include/drm/drm_colorop.h | 71 ++++ include/drm/drm_gem_atomic_helper.h | 11 + include/drm/drm_modeset_helper_vtables.h | 62 +++ include/uapi/drm/drm.h | 7 +- include/uapi/drm/drm_mode.h | 79 ++++ 24 files changed, 1672 insertions(+), 33 deletions(-) create mode 100644 drivers/gpu/drm/tests/drm_colorop_helper_test.c -- 2.56.0
