Hi Shengyu,

I've been testing your pixel_encoding patch series (v2) on kernel 6.18.5
with an AMD RX 9070 XT (gfx1201/Navi 48) and found two bugs where
PIXEL_ENCODING_YCBCR422 handling is missing.

Both get_connector_state_pixel_encoding() and dc_pixel_encoding_to_drm_prop()
handle RGB, YCBCR444, and YCBCR420 but are missing the YCBCR422 case.
This causes YCbCr 4:2:2 to never be applied — the switch falls through to
default, get_connector_state_pixel_encoding() returns false, and auto-select
picks RGB instead.

Fix 1: get_connector_state_pixel_encoding() missing YCBCR422
-------------------------------------------------------------

  case PIXEL_ENCODING_YCBCR444:
  ret = (info->color_formats & DRM_COLOR_FORMAT_YCBCR444);
  break;
+ case PIXEL_ENCODING_YCBCR422:
+ ret = (info->color_formats & DRM_COLOR_FORMAT_YCBCR422);
+ break;
  case PIXEL_ENCODING_YCBCR420:
  ret = drm_mode_is_420(info, mode_in);
  break;

Fix 2: dc_pixel_encoding_to_drm_prop() missing YCBCR422
--------------------------------------------------------

  case PIXEL_ENCODING_YCBCR444:
  propval = DRM_COLOR_FORMAT_YCBCR444;
  break;
+ case PIXEL_ENCODING_YCBCR422:
+ propval = DRM_COLOR_FORMAT_YCBCR422;
+ break;
  case PIXEL_ENCODING_YCBCR420:
  propval = DRM_COLOR_FORMAT_YCBCR420;
  break;

Both are in drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c.

Tested with amdgpu.pixel_encoding=DP-2:ycbcr422 on the following setup:

  GPU:     AMD RX 9070 XT (gfx1201 / Navi 48)
  Kernel:  6.18.5
  KVM:     TESmart HKD402-M24 (DP 1.4 in, HDMI 2.1 out)
  Monitor: Dell AW3225QF (HDMI 2.1)
  Link:    GPU DP 1.4 -> KVM -> HDMI 2.1 -> Monitor

Without these fixes, the module parameter is accepted but ignored — display
stays in RGB. With both fixes, YCbCr 4:2:2 is correctly applied and
confirmed via modetest (pixel encoding property value: 4).

Thanks for the patch series — it fills an important gap for users with
DP-to-HDMI KVM setups who need non-RGB pixel encoding.

Regards,
Mykhailo Kalashnikov

Reply via email to