Message ID | 20221011063447.904649-7-ankit.k.nautiyal@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Handle BPC for HDMI2.1 PCON without DSC1.2 sink and other fixes | expand |
Hi Ankit, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm-tip/drm-tip] url: https://github.com/intel-lab-lkp/linux/commits/Ankit-Nautiyal/Handle-BPC-for-HDMI2-1-PCON-without-DSC1-2-sink-and-other-fixes/20221011-143641 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip config: x86_64-randconfig-a002-20221010 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/b5b4f393c7d5df510838d9dffebe26096f1975a2 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Ankit-Nautiyal/Handle-BPC-for-HDMI2-1-PCON-without-DSC1-2-sink-and-other-fixes/20221011-143641 git checkout b5b4f393c7d5df510838d9dffebe26096f1975a2 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/gpu/drm/i915/display/intel_dp.c:2708:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] default: ^ drivers/gpu/drm/i915/display/intel_dp.c:2708:3: note: insert 'break;' to avoid fall-through default: ^ break; 1 warning generated. vim +2708 drivers/gpu/drm/i915/display/intel_dp.c 2663 2664 void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp, 2665 const struct intel_crtc_state *crtc_state) 2666 { 2667 struct drm_i915_private *i915 = dp_to_i915(intel_dp); 2668 bool ycbcr444_to_420 = false; 2669 bool rgb_to_ycbcr = false; 2670 u8 tmp; 2671 2672 if (intel_dp->dpcd[DP_DPCD_REV] < 0x13) 2673 return; 2674 2675 if (!drm_dp_is_branch(intel_dp->dpcd)) 2676 return; 2677 2678 tmp = intel_dp->has_hdmi_sink ? 2679 DP_HDMI_DVI_OUTPUT_CONFIG : 0; 2680 2681 if (drm_dp_dpcd_writeb(&intel_dp->aux, 2682 DP_PROTOCOL_CONVERTER_CONTROL_0, tmp) != 1) 2683 drm_dbg_kms(&i915->drm, "Failed to %s protocol converter HDMI mode\n", 2684 str_enable_disable(intel_dp->has_hdmi_sink)); 2685 2686 if (crtc_state->sink_format == INTEL_OUTPUT_FORMAT_YCBCR420) { 2687 switch (crtc_state->output_format) { 2688 case INTEL_OUTPUT_FORMAT_YCBCR420: 2689 /* 2690 * sink_format is YCBCR420, output_format is also YCBCR420: 2691 * Passthrough. 2692 */ 2693 break; 2694 case INTEL_OUTPUT_FORMAT_YCBCR444: 2695 /* 2696 * sink_format is YCBCR420, output_format is YCBCR444: 2697 * Downsample. 2698 */ 2699 ycbcr444_to_420 = true; 2700 break; 2701 case INTEL_OUTPUT_FORMAT_RGB: 2702 /* 2703 * sink_format is YCBCR420, output_format is RGB: 2704 * Convert to YCBCR444 and Downsample. 2705 */ 2706 rgb_to_ycbcr = true; 2707 ycbcr444_to_420 = true; > 2708 default: 2709 break; 2710 } 2711 } 2712 2713 tmp = ycbcr444_to_420 ? DP_CONVERSION_TO_YCBCR420_ENABLE : 0; 2714 2715 if (drm_dp_dpcd_writeb(&intel_dp->aux, 2716 DP_PROTOCOL_CONVERTER_CONTROL_1, tmp) != 1) 2717 drm_dbg_kms(&i915->drm, 2718 "Failed to %s protocol converter YCbCr 4:2:0 conversion mode\n", 2719 str_enable_disable(intel_dp->dfp.ycbcr_444_to_420)); 2720 2721 tmp = rgb_to_ycbcr ? DP_CONVERSION_BT709_RGB_YCBCR_ENABLE : 0; 2722 2723 if (drm_dp_pcon_convert_rgb_to_ycbcr(&intel_dp->aux, tmp) < 0) 2724 drm_dbg_kms(&i915->drm, 2725 "Failed to %s protocol converter RGB->YCbCr conversion mode\n", 2726 str_enable_disable(tmp)); 2727 } 2728
Hi Ankit, Thank you for the patch! Yet something to improve: [auto build test ERROR on drm-tip/drm-tip] url: https://github.com/intel-lab-lkp/linux/commits/Ankit-Nautiyal/Handle-BPC-for-HDMI2-1-PCON-without-DSC1-2-sink-and-other-fixes/20221011-143641 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip config: x86_64-randconfig-a003-20221010 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/b5b4f393c7d5df510838d9dffebe26096f1975a2 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Ankit-Nautiyal/Handle-BPC-for-HDMI2-1-PCON-without-DSC1-2-sink-and-other-fixes/20221011-143641 git checkout b5b4f393c7d5df510838d9dffebe26096f1975a2 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/gpu/drm/i915/display/intel_dp.c:2708:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] default: ^ drivers/gpu/drm/i915/display/intel_dp.c:2708:3: note: insert 'break;' to avoid fall-through default: ^ break; 1 error generated. vim +2708 drivers/gpu/drm/i915/display/intel_dp.c 2663 2664 void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp, 2665 const struct intel_crtc_state *crtc_state) 2666 { 2667 struct drm_i915_private *i915 = dp_to_i915(intel_dp); 2668 bool ycbcr444_to_420 = false; 2669 bool rgb_to_ycbcr = false; 2670 u8 tmp; 2671 2672 if (intel_dp->dpcd[DP_DPCD_REV] < 0x13) 2673 return; 2674 2675 if (!drm_dp_is_branch(intel_dp->dpcd)) 2676 return; 2677 2678 tmp = intel_dp->has_hdmi_sink ? 2679 DP_HDMI_DVI_OUTPUT_CONFIG : 0; 2680 2681 if (drm_dp_dpcd_writeb(&intel_dp->aux, 2682 DP_PROTOCOL_CONVERTER_CONTROL_0, tmp) != 1) 2683 drm_dbg_kms(&i915->drm, "Failed to %s protocol converter HDMI mode\n", 2684 str_enable_disable(intel_dp->has_hdmi_sink)); 2685 2686 if (crtc_state->sink_format == INTEL_OUTPUT_FORMAT_YCBCR420) { 2687 switch (crtc_state->output_format) { 2688 case INTEL_OUTPUT_FORMAT_YCBCR420: 2689 /* 2690 * sink_format is YCBCR420, output_format is also YCBCR420: 2691 * Passthrough. 2692 */ 2693 break; 2694 case INTEL_OUTPUT_FORMAT_YCBCR444: 2695 /* 2696 * sink_format is YCBCR420, output_format is YCBCR444: 2697 * Downsample. 2698 */ 2699 ycbcr444_to_420 = true; 2700 break; 2701 case INTEL_OUTPUT_FORMAT_RGB: 2702 /* 2703 * sink_format is YCBCR420, output_format is RGB: 2704 * Convert to YCBCR444 and Downsample. 2705 */ 2706 rgb_to_ycbcr = true; 2707 ycbcr444_to_420 = true; > 2708 default: 2709 break; 2710 } 2711 } 2712 2713 tmp = ycbcr444_to_420 ? DP_CONVERSION_TO_YCBCR420_ENABLE : 0; 2714 2715 if (drm_dp_dpcd_writeb(&intel_dp->aux, 2716 DP_PROTOCOL_CONVERTER_CONTROL_1, tmp) != 1) 2717 drm_dbg_kms(&i915->drm, 2718 "Failed to %s protocol converter YCbCr 4:2:0 conversion mode\n", 2719 str_enable_disable(intel_dp->dfp.ycbcr_444_to_420)); 2720 2721 tmp = rgb_to_ycbcr ? DP_CONVERSION_BT709_RGB_YCBCR_ENABLE : 0; 2722 2723 if (drm_dp_pcon_convert_rgb_to_ycbcr(&intel_dp->aux, tmp) < 0) 2724 drm_dbg_kms(&i915->drm, 2725 "Failed to %s protocol converter RGB->YCbCr conversion mode\n", 2726 str_enable_disable(tmp)); 2727 } 2728
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index d8ef4dccf0c1..adf9bc8ec820 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -790,6 +790,7 @@ intel_dp_output_format(struct intel_connector *connector, bool ycbcr_420_output) { struct intel_dp *intel_dp = intel_attached_dp(connector); + struct drm_i915_private *i915 = dp_to_i915(intel_dp); if (!connector->base.ycbcr_420_allowed || !ycbcr_420_output) return INTEL_OUTPUT_FORMAT_RGB; @@ -798,6 +799,10 @@ intel_dp_output_format(struct intel_connector *connector, intel_dp->dfp.ycbcr_444_to_420) return INTEL_OUTPUT_FORMAT_RGB; + /* Prefer 4:2:0 passthrough over 4:4:4->4:2:0 conversion */ + if (DISPLAY_VER(i915) >= 11 && intel_dp->dfp.ycbcr420_passthrough) + return INTEL_OUTPUT_FORMAT_YCBCR420; + if (intel_dp->dfp.ycbcr_444_to_420) return INTEL_OUTPUT_FORMAT_YCBCR444; else @@ -2660,6 +2665,8 @@ void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp, const struct intel_crtc_state *crtc_state) { struct drm_i915_private *i915 = dp_to_i915(intel_dp); + bool ycbcr444_to_420 = false; + bool rgb_to_ycbcr = false; u8 tmp; if (intel_dp->dpcd[DP_DPCD_REV] < 0x13) @@ -2676,8 +2683,34 @@ void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp, drm_dbg_kms(&i915->drm, "Failed to %s protocol converter HDMI mode\n", str_enable_disable(intel_dp->has_hdmi_sink)); - tmp = crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444 && - intel_dp->dfp.ycbcr_444_to_420 ? DP_CONVERSION_TO_YCBCR420_ENABLE : 0; + if (crtc_state->sink_format == INTEL_OUTPUT_FORMAT_YCBCR420) { + switch (crtc_state->output_format) { + case INTEL_OUTPUT_FORMAT_YCBCR420: + /* + * sink_format is YCBCR420, output_format is also YCBCR420: + * Passthrough. + */ + break; + case INTEL_OUTPUT_FORMAT_YCBCR444: + /* + * sink_format is YCBCR420, output_format is YCBCR444: + * Downsample. + */ + ycbcr444_to_420 = true; + break; + case INTEL_OUTPUT_FORMAT_RGB: + /* + * sink_format is YCBCR420, output_format is RGB: + * Convert to YCBCR444 and Downsample. + */ + rgb_to_ycbcr = true; + ycbcr444_to_420 = true; + default: + break; + } + } + + tmp = ycbcr444_to_420 ? DP_CONVERSION_TO_YCBCR420_ENABLE : 0; if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_PROTOCOL_CONVERTER_CONTROL_1, tmp) != 1) @@ -2685,13 +2718,12 @@ void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp, "Failed to %s protocol converter YCbCr 4:2:0 conversion mode\n", str_enable_disable(intel_dp->dfp.ycbcr_444_to_420)); - tmp = intel_dp->dfp.rgb_to_ycbcr ? - DP_CONVERSION_BT709_RGB_YCBCR_ENABLE : 0; + tmp = rgb_to_ycbcr ? DP_CONVERSION_BT709_RGB_YCBCR_ENABLE : 0; if (drm_dp_pcon_convert_rgb_to_ycbcr(&intel_dp->aux, tmp) < 0) drm_dbg_kms(&i915->drm, - "Failed to %s protocol converter RGB->YCbCr conversion mode\n", - str_enable_disable(tmp)); + "Failed to %s protocol converter RGB->YCbCr conversion mode\n", + str_enable_disable(tmp)); } bool intel_dp_get_colorimetry_status(struct intel_dp *intel_dp) @@ -4541,7 +4573,7 @@ intel_dp_update_420(struct intel_dp *intel_dp) { struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_connector *connector = intel_dp->attached_connector; - bool is_branch, ycbcr_420_passthrough, ycbcr_444_to_420, rgb_to_ycbcr; + bool is_branch; /* No YCbCr output support on gmch platforms */ if (HAS_GMCH(i915)) @@ -4555,38 +4587,21 @@ intel_dp_update_420(struct intel_dp *intel_dp) return; is_branch = drm_dp_is_branch(intel_dp->dpcd); - ycbcr_420_passthrough = + intel_dp->dfp.ycbcr420_passthrough = drm_dp_downstream_420_passthrough(intel_dp->dpcd, intel_dp->downstream_ports); /* on-board LSPCON always assumed to support 4:4:4->4:2:0 conversion */ - ycbcr_444_to_420 = + intel_dp->dfp.ycbcr_444_to_420 = dp_to_dig_port(intel_dp)->lspcon.active || drm_dp_downstream_444_to_420_conversion(intel_dp->dpcd, intel_dp->downstream_ports); - rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd, - intel_dp->downstream_ports, - DP_DS_HDMI_BT709_RGB_YCBCR_CONV); - - if (DISPLAY_VER(i915) >= 11) { - /* Let PCON convert from RGB->YCbCr if possible */ - if (is_branch && rgb_to_ycbcr && ycbcr_444_to_420) { - intel_dp->dfp.rgb_to_ycbcr = true; - intel_dp->dfp.ycbcr_444_to_420 = true; - connector->base.ycbcr_420_allowed = true; - } else { - /* Prefer 4:2:0 passthrough over 4:4:4->4:2:0 conversion */ - intel_dp->dfp.ycbcr_444_to_420 = - ycbcr_444_to_420 && !ycbcr_420_passthrough; + intel_dp->dfp.rgb_to_ycbcr = + drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd, + intel_dp->downstream_ports, + DP_DS_HDMI_BT709_RGB_YCBCR_CONV); - connector->base.ycbcr_420_allowed = - !is_branch || ycbcr_444_to_420 || ycbcr_420_passthrough; - } - } else { - /* 4:4:4->4:2:0 conversion is the only way */ - intel_dp->dfp.ycbcr_444_to_420 = ycbcr_444_to_420; - - connector->base.ycbcr_420_allowed = ycbcr_444_to_420; - } + if (!is_branch || intel_dp->dfp.ycbcr420_passthrough || intel_dp->dfp.ycbcr_444_to_420) + connector->base.ycbcr_420_allowed = true; drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] RGB->YcbCr conversion? %s, YCbCr 4:2:0 allowed? %s, YCbCr 4:4:4->4:2:0 conversion? %s\n",
The decision to use DFP output format conversion capabilities should be during compute_config phase. This patch uses the members of intel_dp->dfp to only store the format conversion capabilities of the DP device and uses the crtc_state sink_format member, to program the protocol-converter for colorspace/format conversion. v2: Use sink_format to determine the color conversion config for the pcon (Ville). Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> --- drivers/gpu/drm/i915/display/intel_dp.c | 79 +++++++++++++++---------- 1 file changed, 47 insertions(+), 32 deletions(-)