]> Git Repo - linux.git/commitdiff
drm/amd/display: Prune Invalid Modes For HDMI Output
authorFangzhi Zuo <[email protected]>
Thu, 17 Oct 2024 22:15:10 +0000 (18:15 -0400)
committerAlex Deucher <[email protected]>
Mon, 4 Nov 2024 16:40:51 +0000 (11:40 -0500)
[Why]
1. HDMI does not have 6 bpc support. Having 6 bpc pass validation
does not comply with spec.
2. Validate 420 only for native HDMI, but not apply to pcon use
case.
3. Current mode validation log is not readable.

[how]
1. Cap 8 bpc for dp-hdmi converter.
2. Validate yuv420 for pcon use case as well,
   if rgb/yuv444 8bpc cannot fit into pcon bw limitation of
   the link from the converter to HDMI sink.
3. Add readable pixel_format and color_depth into debug log.

Reviewed-by: Wayne Lin <[email protected]>
Signed-off-by: Fangzhi Zuo <[email protected]>
Signed-off-by: Zaeem Mohamed <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/core/dc_debug.c
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
drivers/gpu/drm/amd/display/dc/inc/core_status.h

index 7cfa0c91e7485c5a4f12620cc029b0a57bc3b20f..16653e0573b19a1ecf2514c4381bd8e592da5e24 100644 (file)
@@ -7323,10 +7323,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
        const struct drm_connector_state *drm_state = dm_state ? &dm_state->base : NULL;
        int requested_bpc = drm_state ? drm_state->max_requested_bpc : 8;
        enum dc_status dc_result = DC_OK;
+       uint8_t bpc_limit = 6;
 
        if (!dm_state)
                return NULL;
 
+       if (aconnector->dc_link->connector_signal == SIGNAL_TYPE_HDMI_TYPE_A ||
+           aconnector->dc_link->dpcd_caps.dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER)
+               bpc_limit = 8;
+
        do {
                stream = create_stream_for_sink(connector, drm_mode,
                                                dm_state, old_stream,
@@ -7347,11 +7352,12 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
                        dc_result = dm_validate_stream_and_context(adev->dm.dc, stream);
 
                if (dc_result != DC_OK) {
-                       DRM_DEBUG_KMS("Mode %dx%d (clk %d) failed DC validation with error %d (%s)\n",
+                       DRM_DEBUG_KMS("Mode %dx%d (clk %d) pixel_encoding:%s color_depth:%s failed validation -- %s\n",
                                      drm_mode->hdisplay,
                                      drm_mode->vdisplay,
                                      drm_mode->clock,
-                                     dc_result,
+                                     dc_pixel_encoding_to_str(stream->timing.pixel_encoding),
+                                     dc_color_depth_to_str(stream->timing.display_color_depth),
                                      dc_status_to_str(dc_result));
 
                        dc_stream_release(stream);
@@ -7359,10 +7365,13 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
                        requested_bpc -= 2; /* lower bpc to retry validation */
                }
 
-       } while (stream == NULL && requested_bpc >= 6);
+       } while (stream == NULL && requested_bpc >= bpc_limit);
 
-       if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
-               DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
+       if ((dc_result == DC_FAIL_ENC_VALIDATE ||
+            dc_result == DC_EXCEED_DONGLE_CAP) &&
+            !aconnector->force_yuv420_output) {
+               DRM_DEBUG_KMS("%s:%d Retry forcing yuv420 encoding\n",
+                                    __func__, __LINE__);
 
                aconnector->force_yuv420_output = true;
                stream = create_validate_stream_for_sink(aconnector, drm_mode,
index 0bb25c537243862078fc6bae032297db2cdb7b0f..af1ea5792560036893f001361b4b0cd35f46db12 100644 (file)
@@ -392,3 +392,43 @@ char *dc_status_to_str(enum dc_status status)
 
        return "Unexpected status error";
 }
+
+char *dc_pixel_encoding_to_str(enum dc_pixel_encoding pixel_encoding)
+{
+       switch (pixel_encoding) {
+       case PIXEL_ENCODING_RGB:
+               return "RGB";
+       case PIXEL_ENCODING_YCBCR422:
+               return "YUV422";
+       case PIXEL_ENCODING_YCBCR444:
+               return "YUV444";
+       case PIXEL_ENCODING_YCBCR420:
+               return "YUV420";
+       default:
+               return "Unknown";
+       }
+}
+
+char *dc_color_depth_to_str(enum dc_color_depth color_depth)
+{
+       switch (color_depth) {
+       case COLOR_DEPTH_666:
+               return "6-bpc";
+       case COLOR_DEPTH_888:
+               return "8-bpc";
+       case COLOR_DEPTH_101010:
+               return "10-bpc";
+       case COLOR_DEPTH_121212:
+               return "12-bpc";
+       case COLOR_DEPTH_141414:
+               return "14-bpc";
+       case COLOR_DEPTH_161616:
+               return "16-bpc";
+       case COLOR_DEPTH_999:
+               return "9-bpc";
+       case COLOR_DEPTH_111111:
+               return "11-bpc";
+       default:
+               return "Unknown";
+       }
+}
index 8b0632104aef0737673f06ad19ec99e9734c3575..55dc482d9b3660d8274e37b78f5144562bc134d7 100644 (file)
@@ -812,12 +812,12 @@ void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream)
                        stream->dst.height,
                        stream->output_color_space);
        DC_LOG_DC(
-                       "\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixelencoder:%d, displaycolorDepth:%d\n",
+                       "\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixel_encoding:%s, color_depth:%s\n",
                        stream->timing.pix_clk_100hz / 10,
                        stream->timing.h_total,
                        stream->timing.v_total,
-                       stream->timing.pixel_encoding,
-                       stream->timing.display_color_depth);
+                       dc_pixel_encoding_to_str(stream->timing.pixel_encoding),
+                       dc_color_depth_to_str(stream->timing.display_color_depth));
        DC_LOG_DC(
                        "\tlink: %d\n",
                        stream->link->link_index);
index fa5edd03d00439e751a5fb021ed174f0e1bbad2f..b5afd8c3103dba375130a25450d48c9ae417e31d 100644 (file)
@@ -60,5 +60,7 @@ enum dc_status {
 };
 
 char *dc_status_to_str(enum dc_status status);
+char *dc_pixel_encoding_to_str(enum dc_pixel_encoding pixel_encoding);
+char *dc_color_depth_to_str(enum dc_color_depth color_depth);
 
 #endif /* _CORE_STATUS_H_ */
This page took 0.076327 seconds and 4 git commands to generate.