Skip to content

RFC Add DRM CRTC 3D LUT interface

Melissa Wen amd-gfx dri-devel lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest18 patches 17 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18drm: Add 3D LUT mode and its attributesinclude/uapi/drm/drm_mode.h+17 -00 replies
2/18drm/drm_color_mgmt: add shaper LUT to color mgmt propertiesdrivers/gpu/drm/drm_atomic_state_helper.c drivers/gpu/drm/drm_atomic_uapi.c drivers/gpu/drm/drm_color_mgmt.c +5 more+74 -30 replies
3/18drm/drm_color_mgmt: add 3D LUT props to DRM color mgmtdrivers/gpu/drm/drm_atomic_state_helper.c drivers/gpu/drm/drm_atomic_uapi.c drivers/gpu/drm/drm_color_mgmt.c +5 more+78 -20 replies
4/18drm/drm_color_mgmt: add function to create 3D LUT modes supporteddrivers/gpu/drm/drm_color_mgmt.c include/drm/drm_color_mgmt.h+46 -10 replies
5/18drm/drm_color_mgmt: add function to attach 3D LUT propsdrivers/gpu/drm/drm_color_mgmt.c include/drm/drm_color_mgmt.h+38 -00 replies
6/18drm/drm_color_mgmt: set first lut3d mode as defaultdrivers/gpu/drm/drm_color_mgmt.c include/drm/drm_color_mgmt.h+18 -30 replies
7/18drm/amd/display: remove unused regamma conditiondrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+10 -220 replies
8/18drm/amd/display: add comments to describe DM crtc color mgmt behaviordrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+12 -10 replies
9/18drm/amd/display: encapsulate atomic regamma operationdrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+33 -190 replies
10/18drm/amd/display: update lut3d and shaper lut to streamdrivers/gpu/drm/amd/display/dc/core/dc.c+9 -10 replies
11/18drm/amd/display: handle MPC 3D LUT resources for a given contextdrivers/gpu/drm/amd/display/dc/core/dc.c drivers/gpu/drm/amd/display/dc/dc.h+47 -00 replies
12/18drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c+45 -20 replies
13/18drm/amd/display: Define 3D LUT struct for HDR planesdrivers/gpu/drm/amd/display/modules/color/color_gamma.h+12 -00 replies
14/18drm/amd/display: expand array of supported 3D LUT modesdrivers/gpu/drm/amd/display/modules/color/color_gamma.h+31 -00 replies
15/18drm/amd/display: enable 3D-LUT DRM properties if supporteddrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c+28 -00 replies
16/18drm/amd/display: add user 3D LUT support to the amdgpu_dm color pipelinedrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+197 -00 replies
17/18drm/amd/display: decouple steps to reuse in shaper LUT supportdrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+14 -80 replies
18/18drm/amd/display: add user shaper LUT support to amdgpu_dm color pipelinedrivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c+83 -120 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [RFC PATCH v2 00/18] Add DRM CRTC 3D LUT interface

Hi,

After collecting comments in different places, here is a second version of the work on adding DRM CRTC 3D LUT support to the current DRM color mgmt interface. In comparison to previous proposals [1][2][3], here we add 3D LUT before gamma 1D LUT, but also a shaper 1D LUT before 3D LUT, that means the following DRM CRTC color correction pipeline:

Blend -> Degamma 1D LUT -> CTM -> Shaper 1D LUT -> 3D LUT -> Gamma 1D LUT

and we also add a DRM CRTC LUT3D_MODE property, based on Alex Hung proposal for pre-blending 3D LUT [4] (Thanks!), instead of just a LUT3D_SIZE, that allows userspace to use different supported settings of 3D LUT, fitting VA-API and new color API better. In this sense, I adjusted the pre-blending proposal for post-blending usage.

Patches 1-6 targets the addition of shaper LUT and 3D LUT properties to the current DRM CRTC color mgmt pipeline. Patch 6 can be considered an extra/optional patch to define a default value for LUT3D_MODE, inspired by what we do for the plane blend mode property (pre-multiplied).

Patches 7-18 targets AMD display code to enable shaper and 3D LUT usage on DCN 301 (our HW case). Patches 7-9 performs code cleanups on current AMD DM colors code, patch 10 updates AMD stream in case of user 3D LUT changes, patch 11/12 rework AMD MPC 3D LUT resource handling by context for DCN 301 (easily extendible to other DCN families). Finally, from 13-18, we wire up SHAPER LUT, LUT3D and LUT3D MODE to AMD display driver, exposing modes supported by HW and programming user shaper and 3D LUT accordingly.

Our target userspace is Gamescope/SteamOS.

Basic IGT tests were based on [5][6] and are available here (in-progress):
https://gitlab.freedesktop.org/mwen/igt-gpu-tools/-/commits/crtc-lut3d-api

[1] https://lore.kernel.org/all/[email protected]/
[2] https://github.com/vsyrjala/linux/commit/4d28e8ddf2a076f30f9e5bdc17cbb4656fe23e69
[3] https://lore.kernel.org/amd-gfx/[email protected]/
[4] https://lore.kernel.org/dri-devel/[email protected]/
[5] https://patchwork.freedesktop.org/series/90165/
[6] https://patchwork.freedesktop.org/series/109402/
[VA_API] http://intel.github.io/libva/structVAProcFilterParameterBuffer3DLUT.html
[KMS_pipe_API] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/11

Let me know your thoughts.

Thanks,

Melissa

Alex Hung (2):
drm: Add 3D LUT mode and its attributes drm/amd/display: Define 3D LUT struct for HDR planes

Melissa Wen (16):
drm/drm_color_mgmt: add shaper LUT to color mgmt properties drm/drm_color_mgmt: add 3D LUT props to DRM color mgmt drm/drm_color_mgmt: add function to create 3D LUT modes supported drm/drm_color_mgmt: add function to attach 3D LUT props drm/drm_color_mgmt: set first lut3d mode as default drm/amd/display: remove unused regamma condition drm/amd/display: add comments to describe DM crtc color mgmt behavior drm/amd/display: encapsulate atomic regamma operation drm/amd/display: update lut3d and shaper lut to stream drm/amd/display: handle MPC 3D LUT resources for a given context drm/amd/display: acquire/release 3D LUT resources for ctx on DCN301 drm/amd/display: expand array of supported 3D LUT modes drm/amd/display: enable 3D-LUT DRM properties if supported drm/amd/display: add user 3D LUT support to the amdgpu_dm color
pipeline
drm/amd/display: decouple steps to reuse in shaper LUT support drm/amd/display: add user shaper LUT support to amdgpu_dm color
pipeline

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   6 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   3 +
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   | 370 ++++++++++++++++--
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    |   2 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  49 ++-
 drivers/gpu/drm/amd/display/dc/dc.h           |   8 +
 .../amd/display/dc/dcn301/dcn301_resource.c   |  47 ++-
 .../amd/display/modules/color/color_gamma.h   |  43 ++
 drivers/gpu/drm/drm_atomic_state_helper.c     |   7 +
 drivers/gpu/drm/drm_atomic_uapi.c             |  24 ++
 drivers/gpu/drm/drm_color_mgmt.c              | 127 ++++++
 drivers/gpu/drm/drm_fb_helper.c               |   5 +
 drivers/gpu/drm/drm_mode_config.c             |  21 +
 include/drm/drm_color_mgmt.h                  |   8 +
 include/drm/drm_crtc.h                        |  32 +-
 include/drm/drm_mode_config.h                 |  25 ++
 include/drm/drm_mode_object.h                 |   2 +-
 include/uapi/drm/drm_mode.h                   |  17 +
 18 files changed, 757 insertions(+), 39 deletions(-)
Signature · 1 line
2.35.1