[RFC PATCH 0/5] Proposal for Pre-blending 3D LUT interfaces

Alex Hung alex.hung at amd.com
Tue Oct 4 21:14:46 UTC 2022


This is an proposal and a draft implementation to enable 3D LUT on
drm_plane. This proposal defines a new interface for userspace
applications to query hardware capabilities and to pass/enable 3D LUT
functions via this DRM/KMS APIs.

Overviews:

┌─────────┐    ┌─────────┐    ┌───┐    ┌──────────┐   ┌────────┐
│Userspace│◄──►│3DLUT API│◄──►│DRM│◄──►│GPU driver├──►│hardware│
└─────────┘    └─────────┘    └───┘    └──────────┘   └────────┘

1. Userspace queries the 3DLUT mode (defined by drm_mode_3dlut_mode)
   from the GPU drivers (ex. amdgpu).

2. The GPU Driver replies sizes and the color depth of the
   3DLUT modes, such as defined by struct lut_3d_mode_17_12bit.

3. If applicable, userspace selects and sets one of preferred 3DLUT
   modes by "lut_3d_mode" to driver.

4. Userspace passes 3D LUT via drm_property_blob "lut_3d". In the case
   of the mode "lut_3d_mode_17_12bit", the 3D LUT should have a cube
   size = 17x17x17 (lut_size), color depth = 12 bits (bit_depth), and
   X/Y/Z axis = R/G/B (color_format).

5. The GPU driver parses 3D LUT and passes it to hardware pipeline, and
   enables 3D LUT accordingly.

Notes:

1. The patchset is based on the previous work on
   https://gitlab.freedesktop.org/hwentland/linux/-/tree/color-and-hdr

2. This interface can be part of the newly proposed DRM/KMS color pipeline
   API (https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/11). A
   future integration to the new API may be required or preferred, such
   as the followings:

  struct drm_color_pipeline_element {
    drm_color_pipeline_element_type;
    drm_color_pipeline_element_lut3d
  };

  struct drm_mode_3dlut_mode -> struct drm_color_pipeline_lut3d_config

  struct drm_color_pipeline_lut3d {
    lut_3d_mode_17_12bit;
  };

  struct drm_color_pipeline_lut3d_data {
    *lut_3d;
  };

  and etc.

3. A patchset "IGT tests for pre-blending 3D LUT interfaces" for this
   proposal is sent to IGT mailing list.

Related Work:
 - Enable 3D LUT to AMD display drivers (https://www.spinics.net/lists/amd-gfx/msg83032.html)

Alex Hung (5):
  drm: Add 3D LUT mode and its attributes
  drm: Add Plane 3DLUT and 3DLUT mode properties
  drm/amd/display: Define 3D LUT struct for HDR planes
  drm/amd/display: Enable plane 3DLUT mode
  drm/amd/display: Fill 3D LUT from userspace

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  20 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   1 +
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   | 181 ++++++++++++++++++
 .../amd/display/modules/color/color_gamma.h   |  12 ++
 drivers/gpu/drm/drm_atomic_state_helper.c     |   3 +
 drivers/gpu/drm/drm_atomic_uapi.c             |  11 ++
 drivers/gpu/drm/drm_color_mgmt.c              |  68 +++++++
 include/drm/drm_mode_object.h                 |   2 +-
 include/drm/drm_plane.h                       |  33 ++++
 include/uapi/drm/drm_mode.h                   |  17 ++
 10 files changed, 347 insertions(+), 1 deletion(-)

-- 
2.37.3



More information about the dri-devel mailing list